use of org.eclipse.jface.action.ToolBarManager in project eclipse.platform.ui by eclipse-platform.
the class ToolBarManagerTest method testCreateControlWhenParentNull.
public void testCreateControlWhenParentNull() {
Composite parent = createComposite();
ToolBarManager manager = new ToolBarManager(DEFAULT_STYLE | SWT.VERTICAL);
assertNull(manager.createControl(null));
ToolBar toolBar = manager.createControl(parent);
assertNotNull(toolBar);
assertSame(toolBar, manager.createControl(null));
}
use of org.eclipse.jface.action.ToolBarManager in project eclipse.platform.ui by eclipse-platform.
the class ToolBarManagerTest method testDispose.
public void testDispose() {
Composite parent = createComposite();
ToolBar toolBar = new ToolBar(parent, DEFAULT_STYLE | SWT.VERTICAL);
ToolBarManager manager = new ToolBarManager(toolBar);
manager.dispose();
assertTrue(toolBar.isDisposed());
}
use of org.eclipse.jface.action.ToolBarManager in project eclipse.platform.ui by eclipse-platform.
the class ToolBarManagerTest method testSetStyleWhenToolBarDoesNotExist.
public void testSetStyleWhenToolBarDoesNotExist() {
Composite parent = createComposite();
ToolBarManager manager = new ToolBarManager(DEFAULT_STYLE | SWT.HORIZONTAL);
manager.setStyle(DEFAULT_STYLE | SWT.VERTICAL);
ToolBar toolBar = manager.createControl(parent);
assertFalse(toolBar.isDisposed());
verifyOrientation(toolBar, SWT.VERTICAL);
}
use of org.eclipse.jface.action.ToolBarManager in project eclipse.platform.ui by eclipse-platform.
the class CoolBarManagerTest method testResetItemOrderBug293433.
public void testResetItemOrderBug293433() {
IToolBarManager manager = new ToolBarManager();
manager.add(new Action() {
});
coolBarManager.add(manager);
coolBarManager.update(true);
CoolItem[] items = coolBar.getItems();
assertEquals(1, items.length);
Control control = items[0].getControl();
// reset causes items to be disposed
coolBarManager.resetItemOrder();
// ensure that the control was actually disposed
assertTrue(control.isDisposed());
}
use of org.eclipse.jface.action.ToolBarManager in project eclipse.platform.ui by eclipse-platform.
the class MenuPopulationTest method testToolBarItems.
@Test
public void testToolBarItems() throws Exception {
ToolBarManager manager = new ToolBarManager();
menuService.populateContributionManager(manager, "toolbar:" + TEST_CONTRIBUTIONS_CACHE_ID);
IContributionItem ici = manager.find(ID_DEFAULT);
if (ici instanceof CommandContributionItem) {
CommandContributionItem cmd = (CommandContributionItem) ici;
assertIcon(cmd, ICONS_ANYTHING_GIF);
} else if (ici instanceof HandledContributionItem) {
assertIcon((HandledContributionItem) ici, ICONS_ANYTHING_GIF);
} else {
fail("Failed to find correct contribution item: " + ID_DEFAULT + ": " + ici);
}
ici = manager.find(ID_ALL);
if (ici instanceof CommandContributionItem) {
assertIcon((CommandContributionItem) ici, ICONS_MOCK_GIF);
} else if (ici instanceof HandledContributionItem) {
assertIcon((HandledContributionItem) ici, ICONS_MOCK_GIF);
} else {
fail("Failed to find correct contribution item: " + ID_ALL + ": " + ici);
}
ici = manager.find(ID_TOOLBAR);
if (ici instanceof CommandContributionItem) {
assertIcon((CommandContributionItem) ici, ICONS_VIEW_GIF);
} else if (ici instanceof HandledContributionItem) {
assertIcon((HandledContributionItem) ici, ICONS_VIEW_GIF);
} else {
fail("Failed to find correct contribution item: " + ID_TOOLBAR + ": " + ici);
}
manager.dispose();
}
Aggregations