private SearchPatternData[] getNLSFiles(IStructuredSelection selection) { Object[] selectedElements= selection.toArray(); List result= new ArrayList(); collectNLSFiles(selectedElements, result); return (SearchPatternData[])result.toArray(new SearchPatternData[result.size()]); }
@Override protected boolean isEnabled(ISelection selection) { int selectionSize = 0; if (selection instanceof IStructuredSelection) { selectionSize = ((IStructuredSelection) selection).toArray().length; } // enable for a single selection return super.isEnabled(selection) || selectionSize == 1; }
private List<RefNode> extractSelectedRefNodes() { List<RefNode> nodes = new ArrayList<RefNode>(); Object[] array = ((IStructuredSelection) super.branchTree .getSelection()).toArray(); for (Object selected : array) if (selected instanceof RefNode) nodes.add((RefNode) selected); return nodes; }
@Override public void selectionChanged(final SelectionChangedEvent event) { performSelectionChanged(((IStructuredSelection) fViewer.getSelection()).toArray()); } });
public IJavaElement[] getJavaElements(ISelection selection) { if (selection instanceof IStructuredSelection && !selection.isEmpty()) { return getJavaElements(((IStructuredSelection)selection).toArray()); } else { return new IJavaElement[0]; } }
public static boolean isDeleteAvailable(final IStructuredSelection selection) throws JavaModelException { if (!selection.isEmpty()) return isDeleteAvailable(selection.toArray()); return false; }
/** * Returns the selected resources. * * @return the selected resources */ protected IResource[] getSelectedResources() { return Utils.getContributedResources(getSelection().toArray()); }
/** * This method returns all instances of IDiffElement that are in the current * selection. * * @return the selected elements */ protected final IDiffElement[] getSelectedDiffElements() { return Utils.getDiffNodes(getStructuredSelection().toArray()); }
public Object transform(Object value) { IStructuredSelection inSelection = (IStructuredSelection)value; Selection outSelection = new Selection(); if (inSelection != null) { outSelection.setSelection( inSelection.toArray() ); } return outSelection; } }
public IJavaElement[] getJavaElements(ISelection selection) { if (selection instanceof IStructuredSelection && !selection.isEmpty()) { return getJavaElements(((IStructuredSelection)selection).toArray()); } else { return new IJavaElement[0]; } }
/** * Recheck the enablement. Called by clients when some condition outside of * the action that may effect its enablement should be changed. */ public final void checkEnablement() { ISelection selection = getSelection(); if (selection instanceof IStructuredSelection) { checkEnablement(((IStructuredSelection) selection).toArray()); } else { selectionChanged(selection); } }
/** * @see ILaunchShortcut#launch(ISelection, String) */ public void launch(ISelection selection, String mode) { if (selection instanceof IStructuredSelection) { searchAndLaunch(((IStructuredSelection)selection).toArray(), mode, getTypeSelectionTitle(), getSelectionEmptyMessage()); } }
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; }
public void widgetSelected(SelectionEvent e) { ISelection s = fList.getSelection(); if (s instanceof IStructuredSelection) { IStructuredSelection sel = (IStructuredSelection) s; fList.remove(sel.toArray()); save(); } } });
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(); }
@Override public void dragSetData(DragSourceEvent event) { if (ResourceTransfer.getInstance().isSupportedType(event.dataType)) { final IStructuredSelection selection= viewer.getStructuredSelection(); final Object [] array= selection.toArray(); event.data= Utils.getResources(array); } }
private IStructuredSelection getSelection() { final ISelection selection= getContext().getSelection(); if (!(selection instanceof IStructuredSelection)) return new StructuredSelection(); return new StructuredSelection(Utils.getResources(((IStructuredSelection)selection).toArray())); }
public void run() { IStructuredSelection selection = (IStructuredSelection)site.getSelectionProvider().getSelection(); ResourceMapping[] mappings = Utils.getResourceMappings(selection.toArray()); participant.refresh(site.getWorkbenchSite(), mappings); } };
private void updateButtons() { Object[] selected = fPackageViewer.getStructuredSelection().toArray(); int size = selected.length; TablePart tablePart = getTablePart(); tablePart.setButtonEnabled(ADD_INDEX, isEditable()); tablePart.setButtonEnabled(REMOVE_INDEX, isEditable() && size > 0); tablePart.setButtonEnabled(PROPERTIES_INDEX, shouldEnableProperties(selected)); }