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; }
@Override public boolean canFlipToNextPage() { IStructuredSelection ssel = wizardSelectionViewer.getStructuredSelection(); return ssel != null && !ssel.isEmpty(); } }
@Override public void selectionChanged(IStructuredSelection selection) { setEnabled(!selection.isEmpty()); } }
/** * Updates enablement based on the current selection. * * @param sel the selection */ public void selectionChanged(IStructuredSelection sel) { setEnabled(!sel.isEmpty()); }
private static boolean checkEnabled(IStructuredSelection selection) { if (selection.isEmpty()) return false; for (Iterator<?> iter= selection.iterator(); iter.hasNext();) { if (! canRemove(iter.next())) return false; } return true; }
public boolean show(ShowInContext context) { IStructuredSelection selection = getSelection(context); if (selection != null && !selection.isEmpty()) { selectReveal(selection); return true; } return false; }
public static boolean isDeleteAvailable(final IStructuredSelection selection) throws JavaModelException { if (!selection.isEmpty()) return isDeleteAvailable(selection.toArray()); return false; }
/** * The table viewer selection has changed. Update the remove and change button enablement. */ void handleSelection() { final boolean empty = fTable.getSelection().isEmpty(); FileTypeTable.Item selectedItem = (Item) fTable.getSelection().getFirstElement(); fRemoveButton.setEnabled(!empty && !selectedItem.contributed); fChangeButton.setEnabled(!empty); } }
public void run(IStructuredSelection selection) { if (selection.isEmpty()) { getShell().getDisplay().beep(); return; } super.run(selection); }
public static boolean isInlineConstantAvailable(final IStructuredSelection selection) throws JavaModelException { if (selection.isEmpty() || selection.size() != 1) return false; final Object first= selection.getFirstElement(); return (first instanceof IField) && isInlineConstantAvailable(((IField) first)); }
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; }
private static IType getSingleSelectedType(IStructuredSelection selection) throws JavaModelException { if (selection.isEmpty() || selection.size() != 1) return null; Object first= selection.getFirstElement(); if (first instanceof IType) return (IType)first; if (first instanceof ICompilationUnit) return JavaElementUtil.getMainType((ICompilationUnit)first); return null; }
public void selectionChanged(IAction action, ISelection selection) { if (selection instanceof IStructuredSelection) { IStructuredSelection ss= (IStructuredSelection)selection; if (ss.isEmpty() || ss.size() > 1) { return; } Object element= ss.getFirstElement(); if (element instanceof IJavaThread) { setThread((IJavaThread)element); } } }
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 void handleRemove() { IStructuredSelection ssel = fConfigurationsTable.getStructuredSelection(); if (!ssel.isEmpty()) { Object[] objects = ssel.toArray(); IPluginConfiguration[] configurations = new IPluginConfiguration[objects.length]; System.arraycopy(objects, 0, configurations, 0, objects.length); getProduct().removePluginConfigurations(configurations); } clearEditors(); }
public void activateEditor(IWorkbenchPage page, IStructuredSelection selection) { if (selection == null || selection.isEmpty()) return; Object element= selection.getFirstElement(); IEditorPart part= EditorUtility.isOpenInEditor(element); if (part != null) { page.bringToTop(part); if (element instanceof IJavaElement) EditorUtility.revealInEditor(part, (IJavaElement) element); } }
private boolean enableEditButton(final IStructuredSelection selection) { if (selection.isEmpty() || selection.size() == 0) return false; return selection.size() == countEditableInfos(getSelectedMemberActionInfos()); }
void fireSelection() { IStructuredSelection sel = fPluginViewer.getStructuredSelection(); if (!sel.isEmpty()) { fPluginViewer.setSelection(fPluginViewer.getStructuredSelection()); } else if (fPluginViewer.getElementAt(0) != null) { fPluginViewer.setSelection(new StructuredSelection(fPluginViewer.getElementAt(0))); } }
void fireSelection() { IStructuredSelection sel = fPluginViewer.getStructuredSelection(); if (!sel.isEmpty()) { fPluginViewer.setSelection(fPluginViewer.getStructuredSelection()); } else if (fPluginViewer.getElementAt(0) != null) { fPluginViewer.setSelection(new StructuredSelection(fPluginViewer.getElementAt(0))); } }
@Override protected void fillContextMenu(IMenuManager manager) { IStructuredSelection selection = fPluginViewer.getStructuredSelection(); if (!selection.isEmpty()) { manager.add(fOpenAction); manager.add(fDeleteAction); manager.add(new Separator()); } getPage().getPDEEditor().getContributor().contextMenuAboutToShow(manager); manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); }