private IContributionItem getSelectAllItem() { return getItem( ActionFactory.SELECT_ALL.getId(), ActionFactory.SELECT_ALL.getCommandId(), null, null, Messages.Workbench_selectAll, Messages.Workbench_selectAllToolTip, null); }
private void createSelectAllAction() { IActionBars actionBars = getViewSite().getActionBars(); if (isInListState()) { fSelectAllAction = new SelectAllAction((TableViewer) fWrappedViewer.getViewer()); actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fSelectAllAction); } else { actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), null); fSelectAllAction = null; } actionBars.updateActionBars(); }
public void setActivePage(IEditorPart part) { if (activeEditorPart == part) return; activeEditorPart = part; IActionBars actionBars = getActionBars(); if (actionBars != null) { ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null; actionBars.setGlobalActionHandler( ActionFactory.DELETE.getId(), getAction(editor, ITextEditorActionConstants.DELETE)); actionBars.setGlobalActionHandler( ActionFactory.UNDO.getId(), getAction(editor, ITextEditorActionConstants.UNDO)); actionBars.setGlobalActionHandler( ActionFactory.REDO.getId(), getAction(editor, ITextEditorActionConstants.REDO)); actionBars.setGlobalActionHandler( ActionFactory.CUT.getId(), getAction(editor, ITextEditorActionConstants.CUT)); actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), getAction(editor, ITextEditorActionConstants.COPY)); actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), getAction(editor, ITextEditorActionConstants.PASTE)); actionBars.setGlobalActionHandler( ActionFactory.SELECT_ALL.getId(), getAction(editor, ITextEditorActionConstants.SELECT_ALL)); actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), getAction(editor, ITextEditorActionConstants.FIND)); actionBars.setGlobalActionHandler( IDEActionFactory.BOOKMARK.getId(), getAction(editor, IDEActionFactory.BOOKMARK.getId())); actionBars.updateActionBars(); } }
/** * Creates the 'Edit' menu. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ protected IMenuManager createEditMenu(IWorkbenchWindow window) { IMenuManager menu = new MenuManager(getString("_UI_Menu_Edit_label"), IWorkbenchActionConstants.M_EDIT); menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START)); addToMenuAndRegister(menu, ActionFactory.UNDO.create(window)); addToMenuAndRegister(menu, ActionFactory.REDO.create(window)); menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.CUT.create(window)); addToMenuAndRegister(menu, ActionFactory.COPY.create(window)); addToMenuAndRegister(menu, ActionFactory.PASTE.create(window)); menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.DELETE.create(window)); addToMenuAndRegister(menu, ActionFactory.SELECT_ALL.create(window)); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT)); menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END)); menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); return menu; }
/** configure key handler */ private void configureKeyHandler() { GraphicalViewer viewer = getGraphicalViewer(); keyHandler = new KeyHandler(); // keyHandler.put(KeyStroke.getPressed('a', 0x61, SWT.COMMAND), // getActionRegistry().getAction(ActionFactory.SELECT_ALL.getId())); keyHandler.put( KeyStroke.getPressed('s', 0x61, SWT.CTRL), getActionRegistry().getAction(ActionFactory.SAVE.getId())); keyHandler.put( KeyStroke.getPressed('z', 0x7a, SWT.CTRL), getActionRegistry().getAction(ActionFactory.UNDO.getId())); keyHandler.put( KeyStroke.getPressed('z', 0x7a, SWT.CTRL | SWT.SHIFT), getActionRegistry().getAction(ActionFactory.REDO.getId())); keyHandler.put( KeyStroke.getPressed('a', 0x61, SWT.CTRL), getActionRegistry().getAction(ActionFactory.SELECT_ALL.getId())); keyHandler.put( KeyStroke.getPressed(SWT.DEL, 127, 0), getActionRegistry().getAction(ActionFactory.DELETE.getId())); keyHandler.put( KeyStroke.getPressed('+', SWT.KEYPAD_ADD, 0), getActionRegistry().getAction(GEFActionConstants.ZOOM_IN)); keyHandler.put( KeyStroke.getPressed('-', SWT.KEYPAD_SUBTRACT, 0), getActionRegistry().getAction(GEFActionConstants.ZOOM_IN)); viewer.setProperty( MouseWheelHandler.KeyGenerator.getKey(SWT.NONE), MouseWheelZoomHandler.SINGLETON); viewer.setKeyHandler(keyHandler); }
/** * Fills the actions bars. * * <p>Subclasses may extend. * * @param actionBars the action bars */ protected void fillActionBars(IActionBars actionBars) { IToolBarManager toolBar = actionBars.getToolBarManager(); fillToolBar(toolBar); IAction action; action = getCopyToClipboardAction(); if (action != null) actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), action); action = getSelectAllAction(); if (action != null) actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), action); }
private void restoreSavedActions(IActionBars _actionBars) { _actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copy); _actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), paste); _actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), delete); _actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAll); _actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), cut); _actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), find); _actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undo); _actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redo); }
private void saveCurrentActions(IActionBars _actionBars) { copy = _actionBars.getGlobalActionHandler(ActionFactory.COPY.getId()); paste = _actionBars.getGlobalActionHandler(ActionFactory.PASTE.getId()); delete = _actionBars.getGlobalActionHandler(ActionFactory.DELETE.getId()); selectAll = _actionBars.getGlobalActionHandler(ActionFactory.SELECT_ALL.getId()); cut = _actionBars.getGlobalActionHandler(ActionFactory.CUT.getId()); find = _actionBars.getGlobalActionHandler(ActionFactory.FIND.getId()); undo = _actionBars.getGlobalActionHandler(ActionFactory.UNDO.getId()); redo = _actionBars.getGlobalActionHandler(ActionFactory.REDO.getId()); }
private void textEditorContextMenuAboutToShow(IMenuManager manager) { if (queryString != null) { undo.setEnabled(queryViewer.getUndoManager().undoable()); redo.setEnabled(queryViewer.getUndoManager().redoable()); manager.add(undo); manager.add(redo); manager.add(new Separator()); manager.add(getAction(ActionFactory.CUT.getId())); manager.add(getAction(ActionFactory.COPY.getId())); manager.add(getAction(ActionFactory.PASTE.getId())); manager.add(new Separator()); manager.add(getAction(ActionFactory.DELETE.getId())); manager.add(getAction(ActionFactory.SELECT_ALL.getId())); } }
private void initToolBars() { IActionBars bars = this.getViewSite().getActionBars(); bars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAllAction); bars.setGlobalActionHandler(ActionFactory.CUT.getId(), cutAction); bars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction); bars.setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction); IToolBarManager toolBarManager = bars.getToolBarManager(); addToolbarContributions(toolBarManager); addMenuContributions(bars.getMenuManager()); // pifSelector.init(getViewSite().getWorkbenchWindow()); automatedSelector.init(getViewSite().getWorkbenchWindow()); }
@Override public void createPartControl(Composite parent) { parent.setLayout(new FillLayout()); IPreferenceStore prefStore = DdmsPlugin.getDefault().getPreferenceStore(); mLogCatPanel = new LogCatPanel(prefStore); mLogCatPanel.createPanel(parent); setSelectionDependentPanel(mLogCatPanel); mLogCatPanel.addLogCatMessageSelectionListener( new ILogCatMessageSelectionListener() { @Override public void messageDoubleClicked(LogCatMessage m) { onDoubleClick(m); } }); mClipboard = new Clipboard(parent.getDisplay()); IActionBars actionBars = getViewSite().getActionBars(); actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), new Action(Messages.LogCatView_Copy) { @Override public void run() { mLogCatPanel.copySelectionToClipboard(mClipboard); } }); actionBars.setGlobalActionHandler( ActionFactory.SELECT_ALL.getId(), new Action(Messages.LogCatView_Select_All) { @Override public void run() { mLogCatPanel.selectAll(); } }); actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), new Action("Find") { @Override public void run() { mLogCatPanel.showFindDialog(); } }); }
public boolean doGlobalAction(String actionId) { if (actionId.equals(ActionFactory.CUT.getId())) { handleRemove(); return false; } if (actionId.equals(ActionFactory.PASTE.getId())) { doPaste(); return true; } if (actionId.equals(ActionFactory.DELETE.getId())) { return handleRemove(); } if (actionId.equals(ActionFactory.SELECT_ALL.getId())) { fCategoryViewer.getTree().selectAll(); refresh(); } return false; }
public void fillContextMenu(IMenuManager menu) { menu.add(getTextAction(ActionFactory.UNDO.getId())); menu.add(getTextAction(ActionFactory.REDO.getId())); menu.add(new Separator()); menu.add(getTextAction(ActionFactory.CUT.getId())); menu.add(getTextAction(ActionFactory.COPY.getId())); menu.add(getTextAction(ActionFactory.PASTE.getId())); menu.add(new Separator()); menu.add(getTextAction(ActionFactory.SELECT_ALL.getId())); menu.add(new Separator()); super.fillContextMenu(menu); if (spellingActivation != null) { IMenuContributor contributor = (IMenuContributor) spellingActivation.getAdapter(IMenuContributor.class); if (contributor != null) { menu.add(new Separator()); contributor.fillMenu(menu); } } }
/** @generated NOT */ protected void makeActions(IWorkbenchWindow window) { toggleCoolbarAction = ActionFactory.TOGGLE_COOLBAR.create(window); register(toggleCoolbarAction); lockToolBarAction = ActionFactory.LOCK_TOOL_BAR.create(window); register(lockToolBarAction); // register(ActionFactory.CLOSE.create(window)); // register(ActionFactory.CLOSE_ALL.create(window)); register(ActionFactory.SAVE.create(window)); register(ActionFactory.SAVE_AS.create(window)); register(ActionFactory.SAVE_ALL.create(window)); register(ActionFactory.QUIT.create(window)); register(ActionFactory.UNDO.create(window)); register(ActionFactory.REDO.create(window)); register(ActionFactory.CUT.create(window)); register(ActionFactory.COPY.create(window)); register(ActionFactory.PASTE.create(window)); register(ActionFactory.DELETE.create(window)); register(ActionFactory.SELECT_ALL.create(window)); register(ActionFactory.OPEN_NEW_WINDOW.create(window)); register(ActionFactory.PRINT.create(window)); }
@Override protected void declareGlobalActionKeys() { addGlobalActionKey(ActionFactory.SELECT_ALL.getId()); }
@Override public void createPartControl(Composite parent) { Display d = parent.getDisplay(); LogColors colors = new LogColors(); ImageLoader loader = ImageLoader.getDdmUiLibLoader(); colors.infoColor = new Color(d, 0, 127, 0); colors.debugColor = new Color(d, 0, 0, 127); colors.errorColor = new Color(d, 255, 0, 0); colors.warningColor = new Color(d, 255, 127, 0); colors.verboseColor = new Color(d, 0, 0, 0); mCreateFilterAction = new CommonAction("Create Filter") { @Override public void run() { mLogPanel.addFilter(); } }; mCreateFilterAction.setToolTipText("Create Filter"); mCreateFilterAction.setImageDescriptor(loader.loadDescriptor("add.png")); mEditFilterAction = new CommonAction("Edit Filter") { @Override public void run() { mLogPanel.editFilter(); } }; mEditFilterAction.setToolTipText("Edit Filter"); mEditFilterAction.setImageDescriptor(loader.loadDescriptor("edit.png")); // $NON-NLS-1$ mDeleteFilterAction = new CommonAction("Delete Filter") { @Override public void run() { mLogPanel.deleteFilter(); } }; mDeleteFilterAction.setToolTipText("Delete Filter"); mDeleteFilterAction.setImageDescriptor(loader.loadDescriptor("delete.png")); // $NON-NLS-1$ mExportAction = new CommonAction("Export Selection As Text...") { @Override public void run() { mLogPanel.save(); } }; mExportAction.setToolTipText("Export Selection As Text..."); mExportAction.setImageDescriptor(loader.loadDescriptor("save.png")); // $NON-NLS-1$ mGotoMethodDeclarationAction = new CommonAction("Go to Problem (method declaration)") { @Override public void run() { goToErrorLine(CHOICE_METHOD_DECLARATION); } }; mGotoErrorLineAction = new CommonAction("Go to Problem (error line)") { @Override public void run() { goToErrorLine(CHOICE_ERROR_LINE); } }; LogLevel[] levels = LogLevel.values(); mLogLevelActions = new CommonAction[mLogLevelIcons.length]; for (int i = 0; i < mLogLevelActions.length; i++) { String name = levels[i].getStringValue(); mLogLevelActions[i] = new CommonAction(name, IAction.AS_CHECK_BOX) { @Override public void run() { // disable the other actions and record current index for (int i = 0; i < mLogLevelActions.length; i++) { Action a = mLogLevelActions[i]; if (a == this) { a.setChecked(true); // set the log level mLogPanel.setCurrentFilterLogLevel(i + 2); } else { a.setChecked(false); } } } }; mLogLevelActions[i].setToolTipText(name); mLogLevelActions[i].setImageDescriptor(loader.loadDescriptor(mLogLevelIcons[i])); } mClearAction = new Action("Clear Log") { @Override public void run() { mLogPanel.clear(); } }; mClearAction.setImageDescriptor(loader.loadDescriptor("clear.png")); // $NON-NLS-1$ // now create the log view mLogPanel = new LogPanel(colors, new FilterStorage(), LogPanel.FILTER_MANUAL); mLogPanel.setLogCatViewInterface(this); mLogPanel.setActions(mDeleteFilterAction, mEditFilterAction, mLogLevelActions); // get the font String fontStr = DdmsPlugin.getDefault() .getPreferenceStore() .getString(PreferenceInitializer.ATTR_LOGCAT_FONT); if (fontStr != null) { FontData data = new FontData(fontStr); if (fontStr != null) { mLogPanel.setFont(new Font(parent.getDisplay(), data)); } } mLogPanel.createPanel(parent); setSelectionDependentPanel(mLogPanel); // place the actions. placeActions(); // setup the copy action mClipboard = new Clipboard(d); IActionBars actionBars = getViewSite().getActionBars(); actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), new Action("Copy") { @Override public void run() { mLogPanel.copy(mClipboard); } }); // setup the select all action actionBars.setGlobalActionHandler( ActionFactory.SELECT_ALL.getId(), new Action("Select All") { @Override public void run() { mLogPanel.selectAll(); } }); }
/** * Registers this action as a global action handler. * * @param actionBars the action bars where this action will be registered. * @see org.eclipse.core.tools.GlobalAction#registerAsGlobalAction(org.eclipse.ui.IActionBars) */ public void registerAsGlobalAction(IActionBars actionBars) { actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), this); }
/** @generated NOT */ protected void fillMenuBar(IMenuManager menu) { ContributionItemFactory.VIEWS_SHORTLIST.create(getWindow()); { IMenuManager menuX = new MenuManager(Messages.ApplicationMenuName_File, IWorkbenchActionConstants.M_FILE); menuX.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); { IMenuManager menuXX = new MenuManager(Messages.ApplicationMenuName_New, "new"); menuXX.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menuX.add(menuXX); } menuX.add(new Separator()); menuX.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menuX.add(new Separator()); menuX.add(getAction(ActionFactory.SAVE.getId())); menuX.add(getAction(ActionFactory.SAVE_AS.getId())); menuX.add(getAction(ActionFactory.SAVE_ALL.getId())); /*++ added*/ menuX.add(new Separator()); IMenuManager menuExport = new MenuManager("Export", "export"); menuExport.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menuX.add(menuExport); menuX.add(getAction(ActionFactory.PRINT.getId())); menuX.add(new Separator()); menuX.add(getAction(ActionFactory.QUIT.getId())); menuX.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); menu.add(menuX); } { IMenuManager menuX = new MenuManager(Messages.ApplicationMenuName_Edit, IWorkbenchActionConstants.M_EDIT); menuX.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START)); menuX.add(getAction(ActionFactory.UNDO.getId())); menuX.add(getAction(ActionFactory.REDO.getId())); menuX.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT)); menuX.add(new Separator()); menuX.add(getAction(ActionFactory.CUT.getId())); menuX.add(getAction(ActionFactory.COPY.getId())); menuX.add(getAction(ActionFactory.PASTE.getId())); menuX.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT)); menuX.add(new Separator()); menuX.add(getAction(ActionFactory.DELETE.getId())); menuX.add(getAction(ActionFactory.SELECT_ALL.getId())); menuX.add(new Separator()); menuX.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT)); menuX.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END)); menuX.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(menuX); } // menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); IMenuManager menuX = new MenuManager(Messages.ApplicationMenuName_Help, IWorkbenchActionConstants.M_HELP); menuX.add(new GroupMarker(IWorkbenchActionConstants.HELP_START)); menuX.add(new GroupMarker(IWorkbenchActionConstants.HELP_END)); menuX.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(menuX); }