public void init(IPageSite pageSite) { super.init(pageSite); IActionBars bars = pageSite.getActionBars(); bars.getToolBarManager().add(getActionRegistry().getAction(ClearEdgeBendpointLayoutAction.ID)); bars.getToolBarManager().add(getActionRegistry().getAction(ActionFactory.DELETE.getId())); bars.getToolBarManager().add(getActionRegistry().getAction(ActionFactory.UNDO.getId())); bars.getToolBarManager().add(getActionRegistry().getAction(ActionFactory.REDO.getId())); bars.setGlobalActionHandler(ClearEdgeBendpointLayoutAction.ID, getActionRegistry().getAction(ClearEdgeBendpointLayoutAction.ID)); bars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getActionRegistry().getAction(ActionFactory.UNDO.getId())); bars.setGlobalActionHandler(ActionFactory.REDO.getId(), getActionRegistry().getAction(ActionFactory.REDO.getId())); bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getActionRegistry().getAction(ActionFactory.DELETE.getId())); bars.updateActionBars(); getViewer().setKeyHandler(keyHandler); pageSite.setSelectionProvider(getViewer()); }
public void init(IPageSite pageSite) { super.init(pageSite); ActionRegistry registry = editor.getEditorActionRegistry(); IActionBars bars = pageSite.getActionBars(); String id = ActionFactory.UNDO.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.REDO.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.DELETE.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); bars.setGlobalActionHandler(ActionFactory.COPY.getId(), registry.getAction(ActionFactory.COPY.getId())); bars.setGlobalActionHandler(ActionFactory.PASTE.getId(), registry.getAction(ActionFactory.PASTE.getId())); }
@Override public void init(IPageBookViewPage page, IConsole console) { IPageSite pageSite = page.getSite(); IWorkbenchPage workbenchPage = pageSite.getPage(); IViewPart viewPart = workbenchPage.findView(IConsoleConstants.ID_CONSOLE_VIEW); IViewSite viewSite = viewPart.getViewSite(); IActionBars actionBars = viewSite.getActionBars(); IToolBarManager toolBarManager = actionBars.getToolBarManager(); IContributionItem[] items = toolBarManager.getItems(); for(int i = 0; i < items.length; ++i) { IContributionItem item = items[i]; if(item instanceof ActionContributionItem) { IAction action = ((ActionContributionItem) item).getAction(); String text = action.getText(); if(text.equals("Pi&n Console") || text.equals("Open Console")) toolBarManager.remove(item); } } }
@Override public void dispose() { IPageSite site = getSite(); if (site != null) { IWorkbenchPage page = site.getPage(); page.removePostSelectionListener(selectionListener); UndoRedoUtils.disposeUndoRedo(site.getActionBars()); } clearChildren(); if ((form != null) && (!form.isDisposed())) { form.dispose(); } DetailUtils.PREFERENCES.removePropertyChangeListener(preferenceListener); currentSelection.clear(); super.dispose(); }
@Override public void selectionChanged(IWorkbenchPart part, ISelection selection) { if (!isRelevantChange(part)) return; IPageSite site = getSite(); if ((site != null) && (site.getSelectionProvider() == null)) { ISelectionProvider partSelectionProvider = associatedPart.getSite().getSelectionProvider(); site.setSelectionProvider(partSelectionProvider); } if ((selection != null) && (selection instanceof IStructuredSelection)) { try { updateSelection((IStructuredSelection)selection); } catch (Exception e) { printException(e); trace.error("DetailPage.updateSelection", e); } } }
@Override public void createControl(Composite parent) { super.createControl(parent); ResourcesPlugin.getWorkspace().addResourceChangeListener(workspaceListener, IResourceChangeEvent.POST_CHANGE); IPageSite site = getSite(); if (site != null) { IWorkbenchPage page = site.getPage(); page.addPostSelectionListener(selectionListener); ISelectionProvider partSelectionProvider = editorPart.getSite().getSelectionProvider(); ISelection selection = partSelectionProvider.getSelection(); if ((selection != null) && (selection instanceof IStructuredSelection)) { try { updateSelection((IStructuredSelection)selection); } catch (Exception e) { LogUtil.error("Error updating selection from editor", e); } } } }
@Override public void selectionChanged(IWorkbenchPart part, ISelection selection) { if (part != editorPart) return; IPageSite site = getSite(); if ((site != null) && (site.getSelectionProvider() == null)) { ISelectionProvider partSelectionProvider = editorPart.getSite().getSelectionProvider(); site.setSelectionProvider(partSelectionProvider); } if ((selection != null) && (selection instanceof IStructuredSelection)) { try { updateSelection((IStructuredSelection)selection); } catch (Exception e) { LogUtil.error("Error updating selection from editor", e); } } }
@Override public void init(IPageSite site) { super.init(site); IMenuManager menuManager = site.getActionBars().getMenuManager(); menuManager.insertBefore(IContextMenuConstants.GROUP_PROPERTIES, new Separator(GROUP_FILTERING)); fActionGroup.fillActionBars(site.getActionBars()); menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new Action(SearchMessages.JavaSearchResultPage_preferences_label) { @Override public void run() { String pageId= "org.eclipse.search.preferences.SearchPreferencePage"; //$NON-NLS-1$ String[] displayedPages= { pageId, "org.eclipse.ui.editors.preferencePages.Annotations", //$NON-NLS-1$ "org.eclipse.ui.preferencePages.ColorsAndFonts" //$NON-NLS-1$ }; PreferencesUtil.createPreferenceDialogOn(JavaPlugin.getActiveWorkbenchShell(), pageId, displayedPages, null).open(); } }); }
@Override public void init(final IPageSite pageSite) { super.init(pageSite); final IMenuManager menuManager = pageSite.getActionBars().getMenuManager(); menuManager.insertBefore(IContextMenuConstants.GROUP_PROPERTIES, new Separator( JiveSearchResultPage.LAYOUT_GROUP)); menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new Action("Preferences...") { @Override public void run() { final String pageId = "org.eclipse.search.preferences.SearchPreferencePage"; //$NON-NLS-1$ final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); PreferencesUtil.createPreferenceDialogOn(shell, pageId, null, null).open(); } }); }
/** * Initializes the outline; addes undo/redo/delete keyhandlers. */ public void init(IPageSite pageSite) { super.init(pageSite); ActionRegistry registry = multieditor.getActionRegistry(); IActionBars bars = pageSite.getActionBars(); String id = ActionFactory.UNDO.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.REDO.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.DELETE.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.PASTE.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.COPY.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.CUT.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); }
private void createActions() { IPageSite site = getSite(); IActionBars actionBars = site.getActionBars(); IToolBarManager toolBarManager = actionBars.getToolBarManager(); List<IAction> actions = new de.darwinspl.preferences.resource.dwprofile.ui.DwprofileOutlinePageActionProvider().getActions(treeViewer); for (IAction action : actions) { toolBarManager.add(action); } }
private void createActions() { IPageSite site = getSite(); IActionBars actionBars = site.getActionBars(); IToolBarManager toolBarManager = actionBars.getToolBarManager(); List<IAction> actions = new eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionOutlinePageActionProvider().getActions(treeViewer); for (IAction action : actions) { toolBarManager.add(action); } }
private void createActions() { IPageSite site = getSite(); IActionBars actionBars = site.getActionBars(); IToolBarManager toolBarManager = actionBars.getToolBarManager(); List<IAction> actions = new eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaOutlinePageActionProvider().getActions(treeViewer); for (IAction action : actions) { toolBarManager.add(action); } }
private void createActions() { IPageSite site = getSite(); IActionBars actionBars = site.getActionBars(); IToolBarManager toolBarManager = actionBars.getToolBarManager(); List<IAction> actions = new eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueOutlinePageActionProvider().getActions(treeViewer); for (IAction action : actions) { toolBarManager.add(action); } }
private void createActions() { IPageSite site = getSite(); IActionBars actionBars = site.getActionBars(); IToolBarManager toolBarManager = actionBars.getToolBarManager(); List<IAction> actions = new eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingOutlinePageActionProvider().getActions(treeViewer); for (IAction action : actions) { toolBarManager.add(action); } }
private void createActions() { IPageSite site = getSite(); IActionBars actionBars = site.getActionBars(); IToolBarManager toolBarManager = actionBars.getToolBarManager(); List<IAction> actions = new eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsOutlinePageActionProvider().getActions(treeViewer); for (IAction action : actions) { toolBarManager.add(action); } }
private void createActions() { IPageSite site = getSite(); IActionBars actionBars = site.getActionBars(); IToolBarManager toolBarManager = actionBars.getToolBarManager(); List<IAction> actions = new eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestOutlinePageActionProvider().getActions(treeViewer); for (IAction action : actions) { toolBarManager.add(action); } }
private void createActionControls(Tree tree) { String outlineId = FluentMkUI.PLUGIN_ID + ".outline"; MenuManager menuMgr = new MenuManager(outlineId, outlineId); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager m) { contextMenuAboutToShow(m); } }); menu = menuMgr.createContextMenu(tree); tree.setMenu(menu); IPageSite site = getSite(); site.registerContextMenu(outlineId, menuMgr, viewer); // $NON-NLS-1$ site.setSelectionProvider(viewer); actionGroups = new CompositeActionGroup(new ActionGroup[] { new OpenViewActionGroup(this) }); setAction(ACTION_EXPAND, new ExpandAllAction(viewer)); setAction(ACTION_COLLAPSE, new CollapseAllAction(viewer)); setAction(ACTION_TOGGLE, new ToggleLinkingAction(editor)); setAction(ACTION_COPY, new OutlineCopyAction(this)); setAction(ACTION_CUT, new OutlineCutAction(this)); setAction(ACTION_PASTE, new OutlinePasteAction(this)); setAction(ACTION_DELETE, new OutlineDeleteAction(this)); createToolBar(); }
/** * Is used to register several global action handlers (UNDO, REDO, COPY, PASTE, ...) on initialization of this outline page. This activates for example the * undo-action in the central Eclipse-Menu. * * @param pageSite * the page site * @see org.eclipse.ui.part.Page#init(IPageSite) */ @Override public void init(IPageSite pageSite) { super.init(pageSite); IActionBars actionBars = pageSite.getActionBars(); registerGlobalActionHandler(actionBars, ActionFactory.UNDO.getId()); registerGlobalActionHandler(actionBars, ActionFactory.REDO.getId()); registerGlobalActionHandler(actionBars, ActionFactory.COPY.getId()); registerGlobalActionHandler(actionBars, ActionFactory.PASTE.getId()); registerGlobalActionHandler(actionBars, ActionFactory.PRINT.getId()); registerGlobalActionHandler(actionBars, ActionFactory.SAVE_AS.getId()); actionBars.updateActionBars(); }
/** * Is used to register several global action handlers (UNDO, REDO, COPY, * PASTE, ...) on initialization of this outline page. This activates for * example the undo-action in the central Eclipse-Menu. * * @param pageSite * the page site * * @see org.eclipse.ui.part.Page#init(IPageSite) */ @Override public void init(IPageSite pageSite) { super.init(pageSite); IActionBars actionBars = pageSite.getActionBars(); registerGlobalActionHandler(actionBars, ActionFactory.UNDO.getId()); registerGlobalActionHandler(actionBars, ActionFactory.REDO.getId()); registerGlobalActionHandler(actionBars, ActionFactory.COPY.getId()); registerGlobalActionHandler(actionBars, ActionFactory.PASTE.getId()); registerGlobalActionHandler(actionBars, ActionFactory.PRINT.getId()); registerGlobalActionHandler(actionBars, ActionFactory.SAVE_AS.getId()); actionBars.updateActionBars(); }
@Override public void init(IPageSite pageSite) { super.init(pageSite); ActionRegistry registry = editor.getActionRegistry(); IActionBars bars = pageSite.getActionBars(); for (Iterator<IAction> it = registry.getActions(); it.hasNext();) { IAction ia = it.next(); bars.setGlobalActionHandler(ia.getId(), ia); } bars.updateActionBars(); }
@Override protected CustomPalettePage createPalettePage() { return new CustomPalettePage(getPaletteViewerProvider()) { @Override public void init(IPageSite pageSite) { super.init(pageSite); IAction copy = getActionRegistry().getAction(ActionFactory.COPY.getId()); pageSite.getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), copy); } }; }
@Override public void createControl(Composite parent) { EditingDomain editingDomain = planEditorModel.getEditingDomain(); composite = new Composite(parent, SWT.NONE); composite.setLayout(new FillLayout()); tabFolder = new TabFolder(composite, SWT.BORDER); equalityTableViewer = createEMFTreeTableViewer(editingDomain, tabFolder, 0, "Equality Requirements"); envelopeTableViewer = createEMFTreeTableViewer(editingDomain, tabFolder, 1, "Min/Max Requirements"); effectTableViewer = createEMFTreeTableViewer(editingDomain, tabFolder, 2, "Effects"); effectTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (!selection.equals(selectionProvider.getSelection())) { selectionProvider.setSelection(selection); } } }); IPageSite site = getSite(); site.setSelectionProvider(selectionProvider); IWorkbenchPage page = site.getPage(); page.addPostSelectionListener(listener); listener.selectionChanged(null, selectionProvider.getSelection()); UndoRedoUtils.setupUndoRedo(site.getActionBars(), viewSite, planEditorModel.getUndoContext()); }
@Override public void dispose() { removePostSelectionChangedListeners(cutAction); removePostSelectionChangedListeners(copyAction); removePostSelectionChangedListeners(pasteAction); removePostSelectionChangedListeners(deleteAction); composite = null; planEditorModel = null; IPageSite site = getSite(); site.setSelectionProvider(null); IWorkbenchPage page = site.getPage(); page.removePostSelectionListener(listener); }
@Override public void dispose() { ResourcesPlugin.getWorkspace().removeResourceChangeListener(workspaceListener); IPageSite site = getSite(); if (site != null) { IWorkbenchPage page = site.getPage(); page.removePostSelectionListener(selectionListener); } super.dispose(); }
/** * Creates a new <code>FindOccurrencesInFileAction</code>. The action * requires that the selection provided by the site's selection provider is of type * <code>IStructuredSelection</code>. * * @param site the site providing context information for this action * @since 3.1 */ public FindOccurrencesInFileAction(IWorkbenchSite site) { super(site); if (site instanceof IViewSite) fActionBars= ((IViewSite)site).getActionBars(); else if (site instanceof IEditorSite) fActionBars= ((IEditorSite)site).getActionBars(); else if (site instanceof IPageSite) fActionBars= ((IPageSite)site).getActionBars(); setText(SearchMessages.Search_FindOccurrencesInFile_label); setToolTipText(SearchMessages.Search_FindOccurrencesInFile_tooltip); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_OCCURRENCES_IN_FILE_ACTION); }
private void updateSelectionProvider(IPageSite site) { ISelectionProvider provider= fOutlineViewer; if (fInput != null) { ICompilationUnit cu= (ICompilationUnit)fInput.getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null && !JavaModelUtil.isPrimary(cu)) provider= new EmptySelectionProvider(); } site.setSelectionProvider(provider); }
/** * Handles all global actions */ private void handleGlobalAction( ) { IPageSite pageSite = page == null ? null : page.getSite( ); IActionBars actionBars = pageSite == null ? null : pageSite.getActionBars( ); if ( actionBars != null ) { String copyID = ActionFactory.COPY.getId( ); String pasteID = ActionFactory.PASTE.getId( ); String deleteID = ActionFactory.DELETE.getId( ); String moveID = ActionFactory.MOVE.getId( ); String renameID = ActionFactory.RENAME.getId( ); String refreshID = ActionFactory.REFRESH.getId( ); actionBars.setGlobalActionHandler( copyID, copyResourceAction ); actionBars.setGlobalActionHandler( pasteID, pasteResourceAction ); actionBars.setGlobalActionHandler( deleteID, deleteResourceAction ); actionBars.setGlobalActionHandler( moveID, moveResourceAction ); actionBars.setGlobalActionHandler( renameID, renameResourceAction ); actionBars.setGlobalActionHandler( refreshID, refreshExplorerAction ); IMenuManager menuManager = actionBars.getMenuManager( ); IToolBarManager toolBarManager = actionBars.getToolBarManager( ); if ( menuManager != null ) { menuManager.add( filterAction ); } if ( toolBarManager != null ) { toolBarManager.add( refreshExplorerAction ); } } }
/** * Updates the action bars for this page site. */ private void updateActionBars( ) { IPageSite site = page == null ? null : page.getSite( ); IActionBars actionBars = site == null ? null : site.getActionBars( ); if ( actionBars != null ) { actionBars.updateActionBars( ); } }
/** * @see org.eclipse.ui.part.IPageBookViewPage#init(org.eclipse.ui.part.IPageSite) */ public void init(IPageSite pageSite) { super.init(pageSite); ActionRegistry registry = getActionRegistry(); IActionBars bars = pageSite.getActionBars(); String id = ActionFactory.UNDO.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.REDO.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); id = ActionFactory.DELETE.getId(); bars.setGlobalActionHandler(id, registry.getAction(id)); }
@Override public IPageSite getSite() { return fSite; }
@Override public void init(IPageSite site) throws PartInitException { fSite = site; }
public void init(IPageSite pageSite) { super.init(pageSite); }