Refine search
private static IMethod getSingleSelectedMethod(IStructuredSelection selection){ if (selection.isEmpty() || selection.size() != 1) return null; if (selection.getFirstElement() instanceof IMethod) return (IMethod)selection.getFirstElement(); return null; }
protected ModuleServer[] getDeployedSelection() { IStructuredSelection sel = (IStructuredSelection) deployedTreeViewer.getSelection(); if (sel.isEmpty()) return new ModuleServer[0]; ModuleServer [] mss = new ModuleServer[sel.size()]; System.arraycopy(sel.toArray(), 0, mss, 0, sel.size()); return mss; }
private IJavaElement getFirstSelectedSourceReference(SelectionChangedEvent event) { ISelection s= event.getSelection(); if (! (s instanceof IStructuredSelection)) return null; IStructuredSelection strSel= (IStructuredSelection) s; if (strSel.size() != 1) return null; Object first= strSel.getFirstElement(); if (! (first instanceof IJavaElement)) return null; return (IJavaElement) first; }
@Override public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection= (IStructuredSelection)event.getSelection(); typeSelected((ITypeBinding)selection.getFirstElement()); } };
private static boolean containsOnlyElementsInsideCompilationUnits(IStructuredSelection selection) { for (Iterator<?> iter = selection.iterator(); iter.hasNext();) { Object object= iter.next(); if (! (object instanceof IJavaElement && ReorgUtils.isInsideCompilationUnit((IJavaElement)object))) return false; } return true; }
public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection iss = (IStructuredSelection) event .getSelection(); if (iss != null && !iss.isEmpty()) { CPWizardNode node = (CPWizardNode) iss .getFirstElement(); setDescription(node.getProvider().getDescription()); setSelectedNode(node); } } });
@Override public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = event.getStructuredSelection(); if (!selection.isEmpty()) { LaunchShortcutExtension shortcutSource = (LaunchShortcutExtension) selection.getFirstElement(); String description = shortcutSource.getShortcutDescription(fMode); fDescriptionText.setText((description == null ? LaunchConfigurationsMessages.LaunchShortcutSelectionDialog_3 : description)); } } });
private void edit() { IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection(); Object[] objects= selection.toArray(); if ((objects == null) || (objects.length != 1)) return; TemplatePersistenceData data= (TemplatePersistenceData) selection.getFirstElement(); edit(data); }
private static IPackageFragmentRoot[] getRootsToRemove(IStructuredSelection selection){ List<Object> result= new ArrayList<>(selection.size()); for (Iterator<?> iter= selection.iterator(); iter.hasNext();) { Object element= iter.next(); if (canRemove(element)) result.add(element); } return result.toArray(new IPackageFragmentRoot[result.size()]); }
public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection ss = (IStructuredSelection)selection; setEnabled(!ss.isEmpty()); return; } setEnabled(false); } }
private boolean canEnable(IStructuredSelection selection) { if (selection.isEmpty()) return false; List<?> list= selection.toList(); for (Iterator<?> iterator= list.iterator(); iterator.hasNext();) { Object object= iterator.next(); if (!(object instanceof IResource) && !(object instanceof IJavaElement)) return false; } return true; }
/** * @param selection the selection * @return returns <code>List</code> of <code>IPackageFragments</code>, <code>IPackageFragmentRoots</code> or * <code>IJavaProjects</code> (all entries are of the same kind) */ private static List<?> getSelectedElementList(IStructuredSelection selection) { if (selection == null) return null; return selection.toList(); }
public void doubleClick(DoubleClickEvent event) { IStructuredSelection s = (IStructuredSelection) event.getSelection(); selectionChanged(new SelectionChangedEvent(event.getViewer(), s)); Object element = s.getFirstElement(); if (treeViewer.isExpandable(element)) { treeViewer.setExpandedState(element, !treeViewer.getExpandedState(element)); } else if (element instanceof WorkbenchWizardElement) { page.advanceToNextPageOrFinish(); } } });
public void selectionChanged(SelectionChangedEvent event) { currentDiffs.clear(); ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection sel = (IStructuredSelection) selection; for (Object obj : sel.toList()) if (obj instanceof FileDiff) currentDiffs.add((FileDiff) obj); } format(); }
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { IStructuredSelection selection = (IStructuredSelection) window.getSelectionService().getSelection(); Object firstElement = selection.getFirstElement(); if (firstElement instanceof IAdaptable) { IProject project = (IProject)((IAdaptable)firstElement).getAdapter(IProject.class); IPath path = project.getFullPath(); System.out.println(path); } }