@Override public ISelection getSelection() { return parentSelectionService.getSelection(); }
@Override public ISelection getSelection(String partId) { return parentSelectionService.getSelection(partId); }
@Override protected Object doGetValue(Object source) { ISelection selection; if (partId != null) { selection = ((ISelectionService) source).getSelection(partId); } else { selection = ((ISelectionService) source).getSelection(); } if (selection instanceof IStructuredSelection) { return ((IStructuredSelection) selection).getFirstElement(); } return null; }
private IStructuredSelection evaluateCurrentSelection() { IWorkbenchWindow window= JavaPlugin.getActiveWorkbenchWindow(); if (window != null) { ISelection selection= window.getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) { return (IStructuredSelection) selection; } } return StructuredSelection.EMPTY; }
/** * Refresh the selection for the action. */ protected void refreshSelection() { ISelection selection = window.getSelectionService().getSelection(); selectionChanged(selection); }
/** * Returns the selection of the active workbench window. * * @return the current selection in the active workbench window or <code>null</code> */ protected final ISelection getSelection() { IWorkbenchWindow window= getWorkbenchWindow(); if (window != null) return window.getSelectionService().getSelection(); return null; }
/** * Returns the selection of the active workbench window. * * @return the current selection in the active workbench window or <code>null</code> */ protected final ISelection getSelection() { IWorkbenchWindow window= getWorkbenchWindow(); if (window != null) return window.getSelectionService().getSelection(); return null; }
private IResource getSelection() { ISelection sel = srv.getSelection(); if (!(sel instanceof IStructuredSelection)) return null; Object selected = ((IStructuredSelection) sel).getFirstElement(); if (selected instanceof IAdaptable) return (IResource) ((IAdaptable) selected) .getAdapter(IResource.class); if (selected instanceof IResource) return (IResource) selected; return null; }
private IStructuredSelection evaluateCurrentSelection() { IWorkbenchWindow window= JavaPlugin.getActiveWorkbenchWindow(); if (window != null) { ISelection selection= window.getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) { return (IStructuredSelection) selection; } } return StructuredSelection.EMPTY; }
public static IStructuredSelection getCurrentSelection() { IWorkbenchWindow window = getActiveWorkbenchWindow(); if (window != null) { ISelection selection = window.getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) { return (IStructuredSelection) selection; } } return null; }
private IStructuredSelection evaluateCurrentSelection() { IWorkbenchWindow window= JavaPlugin.getActiveWorkbenchWindow(); if (window != null) { ISelection selection= window.getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) { return (IStructuredSelection) selection; } } return StructuredSelection.EMPTY; }
/** * Default constructor. */ public JavaWorkingSetPage() { super(PAGE_NAME, PAGE_TITLE, JavaPluginImages.DESC_WIZBAN_JAVA_WORKINGSET); setDescription(WorkingSetMessages.JavaWorkingSetPage_workingSet_description); IWorkbenchWindow activeWorkbenchWindow= JavaPlugin.getActiveWorkbenchWindow(); if (activeWorkbenchWindow != null) { ISelection selection= activeWorkbenchWindow.getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) fInitialSelection= (IStructuredSelection)selection; } }
/** * Default constructor. */ public JavaWorkingSetPage() { super(PAGE_NAME, PAGE_TITLE, JavaPluginImages.DESC_WIZBAN_JAVA_WORKINGSET); setDescription(WorkingSetMessages.JavaWorkingSetPage_workingSet_description); IWorkbenchWindow activeWorkbenchWindow= JavaPlugin.getActiveWorkbenchWindow(); if (activeWorkbenchWindow != null) { ISelection selection= activeWorkbenchWindow.getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) fInitialSelection= (IStructuredSelection)selection; } }
protected IStructuredSelection getCurrentSelection() { IWorkbenchWindow window = J2EEUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(); if (window != null) { ISelection selection = window.getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) { return (IStructuredSelection) selection; } } return null; }
public ISelection getSelection() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null && window.getSelectionService() != null) { return window.getSelectionService().getSelection(); } return null; }
private final void updateWindows(IWorkbenchWindow newWindow) { if (lastWindow == newWindow) { return; } ISelection selection = null; if (lastWindow != null) { lastWindow.getSelectionService().removeSelectionListener(this); } if (newWindow != null) { newWindow.getSelectionService().addSelectionListener(this); selection = newWindow.getSelectionService().getSelection(); } selectionChanged(null, selection); lastWindow = newWindow; }
public SearchDialog(IWorkbenchWindow window, String pageId) { super(window.getShell()); fWorkbenchWindow= window; fCurrentSelection= window.getSelectionService().getSelection(); fCurrentEnclosingProject= evaluateEnclosingProject(fCurrentSelection, getActiveEditor()); fDescriptors= filterByActivities(SearchPlugin.getDefault().getEnabledSearchPageDescriptors(pageId)); fInitialPageId= pageId; fPageChangeListeners= null; setUseEmbeddedProgressMonitorPart(false); }
@Override public Object execute(ExecutionEvent event) { IWorkbench workbench = PlatformUI.getWorkbench(); ISelection sel = workbench.getActiveWorkbenchWindow().getSelectionService().getSelection(); IStructuredSelection structuredSel = null; if (sel != null && sel instanceof IStructuredSelection) { structuredSel = (IStructuredSelection)sel; } SmartImportWizard wizard = new SmartImportWizard(); wizard.init(workbench, structuredSel); new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard).open(); return null; }
public SearchDialog(IWorkbenchWindow window, String pageId) { super(window.getShell()); fWorkbenchWindow= window; fCurrentSelection= window.getSelectionService().getSelection(); fCurrentEnclosingProject= evaluateEnclosingProject(fCurrentSelection, getActiveEditor()); fDescriptors= filterByActivities(SearchPlugin.getDefault().getEnabledSearchPageDescriptors(pageId)); fInitialPageId= pageId; if (fInitialPageId == null && fDialogSettings.getBoolean(STORE_IS_OPEN_PREVIOUS_PAGE)) { fInitialPageId= fDialogSettings.get(STORE_PREVIOUS_PAGE); } fPageChangeListeners= null; setUseEmbeddedProgressMonitorPart(false); }
@Override public void run(final IAction action) { if (fWindow != null) { final JarImportWizard wizard= new JarImportWizard(true); final ISelection selection= fWindow.getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) wizard.init(fWindow.getWorkbench(), (IStructuredSelection) selection); final WizardDialog dialog= new WizardDialog(fWindow.getShell(), wizard); dialog.create(); dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT); PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IJavaHelpContextIds.JARIMPORT_WIZARD_PAGE); dialog.open(); } }