public String[] getShowInTargetIds() { IStructuredSelection selection = (IStructuredSelection) getCommonViewer() .getSelection(); for (Object element : selection.toList()) if (element instanceof RepositoryNode) return new String[] { IHistoryView.VIEW_ID, ReflogView.VIEW_ID }; // Make sure History view is always listed, regardless of perspective return new String[] { IHistoryView.VIEW_ID }; }
/** * Update the active editor based on the current selection in the Navigator. */ protected void activateEditor() { ISelection selection = commonViewer.getSelection(); if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { /* * Create and schedule a UI Job to activate the editor in a valid * Display thread */ activateEditorJob.schedule(BRIEF_DELAY); } }
.getSelection(); String error = null; if (selection == null || selection.isEmpty()) {
/** * <p> * Fills aMenuManager with menu contributions from the * {@link NavigatorActionService}. * </p> * * @param aMenuManager * A popup menu * @see NavigatorActionService#fillContextMenu(IMenuManager) * */ protected void fillContextMenu(IMenuManager aMenuManager) { ISelection selection = commonNavigator.getCommonViewer().getSelection(); actionService.setContext(new ActionContext(selection)); actionService.fillContextMenu(aMenuManager); }
/** * Create new profile */ public void handleNew() { final IStructuredSelection selection = (IStructuredSelection) mViewer .getSelection(); // Create a new connection profile AddProfileViewAction newAction = new AddProfileViewAction(mCategory); newAction.selectionChanged(null, selection); if (this.mCategory != null) newAction.setCategory(this.mCategory); newAction.run(null); mViewer.refresh(); }
public ShowInContext getShowInContext() { IStructuredSelection selection = (IStructuredSelection) getCommonViewer() .getSelection(); List<Object> elements = getShowInElements(selection); // GenericHistoryView only shows a selection of a single resource (see // bug 392949), so prepare our own history page input which can contain // multiple files to support showing more than one file in history. // It's also necessary for a single file that is outside of the // workspace (and as such is not an IResource). HistoryPageInput historyPageInput = getHistoryPageInput(selection); return new ShowInContext(historyPageInput, new StructuredSelection(elements)); }
ISelection initialSelection = navigator.getCommonViewer().getSelection(); INavigatorFilterService filterService = navigator.getNavigatorContentService().getFilterService(); Set<String> filters = new HashSet<String>();
IStructuredSelection selection = (IStructuredSelection) commonViewer.getSelection();
public IStatus runInUIThread(IProgressMonitor monitor) { if (!commonViewer.getControl().isDisposed()) { ISelection selection = commonViewer.getSelection(); if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { IStructuredSelection sSelection = (IStructuredSelection) selection; if (sSelection.size() == 1) { ILinkHelper[] helpers = linkService .getLinkHelpersFor(sSelection.getFirstElement()); if (helpers.length > 0) { helpers[0].activateEditor(commonNavigator.getSite() .getPage(), sSelection); } } } } return Status.OK_STATUS; } };
commonViewer.getControl().setRedraw(false); ISelection selection = commonViewer.getSelection(); if(selection instanceof IStructuredSelection) ssel = (IStructuredSelection) selection;
private void init(IMemento memento) { updateActionBars = new UpdateActionBarsJob(commonNavigator.getTitle()); CommonViewer commonViewer = commonNavigator.getCommonViewer(); commonViewer.addSelectionChangedListener(this); commonViewer.addPostSelectionChangedListener(statusBarListener); updateStatusBar(commonViewer.getSelection()); ICommonViewerSite commonViewerSite = CommonViewerSiteFactory .createCommonViewerSite(commonNavigator.getViewSite()); actionService = new NavigatorActionService(commonViewerSite, commonViewer, commonViewer.getNavigatorContentService()); final RetargetAction openAction = new RetargetAction( ICommonActionConstants.OPEN, CommonNavigatorMessages.Open_action_label); commonNavigator.getViewSite().getPage().addPartListener(openAction); openAction.setActionDefinitionId(ICommonActionConstants.OPEN); commonNavigator.getCommonViewer().addOpenListener(new IOpenListener() { public void open(OpenEvent event) { actionService.setContext(new ActionContext(commonNavigator.getCommonViewer().getSelection())); actionService.fillActionBars(commonNavigator.getViewSite().getActionBars()); openAction.run(); } }); if(memento != null) restoreState(memento); initContextMenu(); initViewMenu(); }