use of org.talend.repository.ui.actions.OpenPaletteFilterAction in project tdi-studio-se by Talend.
the class TalendFlyoutPaletteComposite method createActionMenu.
private Menu createActionMenu(Control parent) throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
final MenuManager manager = new MenuManager();
MenuManager mgr = new MenuManager(PaletteMessages.DOCK_LABEL);
changeDockActionClass.getDeclaredConstructors();
// reflect the constructor of ChangeDockAction
Constructor changeDockActionConstructor = changeDockActionClass.getDeclaredConstructor(FlyoutPaletteComposite.class, String.class, int.class);
changeDockActionConstructor.setAccessible(true);
// instance of ChangeDockAction for left
Object changeDockActionInstance = changeDockActionConstructor.newInstance(this, PaletteMessages.LEFT_LABEL, PositionConstants.WEST);
if (changeDockActionInstance instanceof IAction) {
mgr.add((IAction) changeDockActionInstance);
}
// instance of ChangeDockAction for right
changeDockActionInstance = changeDockActionConstructor.newInstance(this, PaletteMessages.RIGHT_LABEL, PositionConstants.EAST);
if (changeDockActionInstance instanceof IAction) {
mgr.add((IAction) changeDockActionInstance);
}
// instance of ResizeAction
Constructor resizeActionConstructor = resizeActionClass.getDeclaredConstructor(FlyoutPaletteComposite.class);
resizeActionConstructor.setAccessible(true);
Object resizeActionInstance = resizeActionConstructor.newInstance(this);
if (resizeActionInstance instanceof IAction) {
mgr.add((IAction) resizeActionInstance);
}
manager.add(mgr);
mgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager menuMgr) {
IContributionItem[] items = menuMgr.getItems();
for (IContributionItem item : items) {
((ActionContributionItem) item).update();
}
}
});
//
// ShowStandardAction showStandardAction = ShowStandardAction.getInstance();
// ShowFavoriteAction showFavoriteAction = ShowFavoriteAction.getInstance();
// manager.add(showStandardAction);
// manager.add(showFavoriteAction);
// if (ShowFavoriteAction.state) {
// showStandardAction.doSetEnable();
// }
OpenPaletteFilterAction openPaletteFilterAction = OpenPaletteFilterAction.getInstance();
manager.add(openPaletteFilterAction);
manager.add(mgr);
addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
manager.dispose();
}
});
return manager.createContextMenu(this);
}
use of org.talend.repository.ui.actions.OpenPaletteFilterAction in project tdi-studio-se by Talend.
the class TalendPaletteHelper method checkAndInitToolBar2.
private static void checkAndInitToolBar2() {
//
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow == null || activeWorkbenchWindow.getActivePage() == null) {
return;
}
boolean isTalendEditor = false;
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
IEditorPart activePart = activePage.getActiveEditor();
if (activePart != null && activePart instanceof AbstractMultiPageTalendEditor) {
isTalendEditor = true;
}
IViewPart paletteViewPart = activePage.findView(PaletteView.ID);
if (paletteViewPart != null) {
// find existing or not, and add it.
IActionBars actionBars = paletteViewPart.getViewSite().getActionBars();
// ShowStandardAction showStandardAction = ShowStandardAction.getInstance();
// updatePaletteActions(actionBars, showStandardAction, isTalendEditor);
//
// ShowFavoriteAction showFavoriteAction = ShowFavoriteAction.getInstance();
// updatePaletteActions(actionBars, showFavoriteAction, isTalendEditor);
//
// if (ShowFavoriteAction.state) {
// showStandardAction.doSetEnable();
// }
OpenPaletteFilterAction openPaletteFilterAction = OpenPaletteFilterAction.getInstance();
updatePaletteActions(actionBars, openPaletteFilterAction, isTalendEditor);
actionBars.updateActionBars();
}
}
Aggregations