private IContributionItem getCopyItem() { return getItem( ActionFactory.COPY.getId(), ActionFactory.COPY.getCommandId(), ISharedImages.IMG_TOOL_COPY, ISharedImages.IMG_TOOL_COPY_DISABLED, Messages.Workbench_copy, Messages.Workbench_copyToolTip, null); }
/** * 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; }
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(); } }
@Override public void setActivePage(IEditorPart part) { if (activeEditorPart == part) return; activeEditorPart = part; IActionBars actionBars = getActionBars(); if (activeEditorPart != null && activeEditorPart instanceof ITextEditor) { IActionBars siteActionBars = ((IEditorSite) activeEditorPart.getEditorSite()).getActionBars(); siteActionBars.setGlobalActionHandler( ITextEditorActionConstants.UNDO, getAction((ITextEditor) activeEditorPart, ITextEditorActionConstants.UNDO)); siteActionBars.setGlobalActionHandler( ITextEditorActionConstants.REDO, getAction((ITextEditor) activeEditorPart, ITextEditorActionConstants.REDO)); siteActionBars.updateActionBars(); } else { if (part instanceof BPELEditor) { bpelEditor = (BPELEditor) part; } if (bpelEditor != null) { Object adapter = bpelEditor.getAdapter(ActionRegistry.class); if (adapter instanceof ActionRegistry) { ActionRegistry registry = (ActionRegistry) adapter; // COPY IAction action = registry.getAction(BPELCopyAction.ID); actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), action); // CUT action = registry.getAction(BPELCutAction.ID); actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), action); // PASTE action = registry.getAction(BPELPasteAction.ID); actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), action); // DELETE action = registry.getAction(BPELDeleteAction.ID); actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), action); } IWorkbenchPartSite site = bpelEditor.getSite(); if (site instanceof IEditorSite) { ITextEditor textEditor = bpelEditor.getMultipageEditor().getTextEditor(); IActionBars siteActionBars = ((IEditorSite) site).getActionBars(); siteActionBars.setGlobalActionHandler( ITextEditorActionConstants.UNDO, getAction(textEditor, ITextEditorActionConstants.UNDO)); siteActionBars.setGlobalActionHandler( ITextEditorActionConstants.REDO, getAction(textEditor, ITextEditorActionConstants.REDO)); siteActionBars.updateActionBars(); } } } if (actionBars != null) { // update menu bar and tool bar actionBars.updateActionBars(); } }
private void contributeToActionBars() { IActionBars bars = getViewSite().getActionBars(); fillLocalPullDown(bars.getMenuManager()); fillLocalToolBar(bars.getToolBarManager()); bars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), fRefreshAction); bars.setGlobalActionHandler(ActionFactory.COPY.getId(), fCopyAction); bars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), fPropertiesAction); }
/** * 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 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 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); }
@Override protected void init() { super.init(); setId(ActionFactory.COPY.getId()); setText("Copy"); ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); setDisabledImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED)); setEnabled(false); }
@Override public void fillActionBars(IActionBars actionBars) { { actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), removeAction); actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), cutAction); actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction); actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction); } actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction); actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction); }
/** * コンストラクタ * * @param part */ public CopyAction(IWorkbenchPart part) { super(part); this.setText(ResourceString.getResourceString("action.title.copy")); ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); setDisabledImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED)); this.setId(ActionFactory.COPY.getId()); }
public void setActiveView(IViewPart part) { IActionBars actionBars = part.getViewSite().getActionBars(); if (!(part instanceof PropertySheet)) { actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), removeAction); actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), cutAction); actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction); actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction); } actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction); actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction); actionBars.updateActionBars(); }
private void makeActions() { executeAction = new ExecuteQueryAction(); IWorkbenchWindow window = getEditorSite().getWorkbenchWindow(); IWorkbenchAction globalAction = ActionFactory.COPY.create(window); copyQueryStringAction = new Action() { @Override public void run() { queryString.copy(); } }; copyQueryStringAction.setAccelerator(globalAction.getAccelerator()); contentAssistAction = new Action() { @Override public void run() { queryViewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); } }; // Install the standard text actions. addAction( ActionFactory.CUT, ITextOperationTarget.CUT, "org.eclipse.ui.edit.cut"); // $NON-NLS-1$ addAction( ActionFactory.COPY, ITextOperationTarget.COPY, "org.eclipse.ui.edit.copy"); // $NON-NLS-1$ addAction( ActionFactory.PASTE, ITextOperationTarget.PASTE, "org.eclipse.ui.edit.paste"); //$NON-NLS-1$ addAction( ActionFactory.DELETE, ITextOperationTarget.DELETE, "org.eclipse.ui.edit.delete"); //$NON-NLS-1$ addAction( ActionFactory.SELECT_ALL, ITextOperationTarget.SELECT_ALL, "org.eclipse.ui.edit.selectAll"); //$NON-NLS-1$ undo = addAction( ActionFactory.UNDO, ITextOperationTarget.UNDO, "org.eclipse.ui.edit.undo"); //$NON-NLS-1$ redo = addAction( ActionFactory.REDO, ITextOperationTarget.REDO, "org.eclipse.ui.edit.redo"); //$NON-NLS-1$ }
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()); }
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())); } }
@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 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); } } }
private void registerContextMenu() { getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction); MenuManager mm = new MenuManager(); mm.setRemoveAllWhenShown(true); mm.addMenuListener( new IMenuListener() { @Override public void menuAboutToShow(IMenuManager mgr) { fillContextMenu(mgr); } }); Viewer viewer = getViewer(); Menu menu = mm.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); // Register menu for extension. getSite().registerContextMenu(mm, viewer); }
/** @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)); }
/** @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); }
@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(); } }); }
public IAction getGlobalAction(String id) { if (id.equals(ActionFactory.COPY.getId())) return parent.getCopyAction(); return null; }