List of usage examples for org.eclipse.jface.viewers ITreeSelection toArray
public Object[] toArray();
From source file:fr.imag.adele.cadse.si.workspace.uiplatform.swt.ui.DListUI.java
License:Apache License
/** * Handle remove.//from w w w . ja va 2 s .c o m * * @param sel * the sel * @param _swtuiplatform * the field controller */ protected void handleRemove(ITreeSelection sel) { Object[] obj = sel.toArray(); if (obj == null) { return; } if (obj.length == 0) { return; } String error = _ic.canRemoveObject(obj); if (error != null) { _swtuiplatform.setMessage(error, UIPlatform.ERROR); return; } Object[] removedObj = _ic.removeObject(obj); for (Object o : removedObj) { fElements.remove(o); } setVisualValue(fElements); _swtuiplatform.broadcastValueChanged(_page, _field, getVisualValue()); }
From source file:fr.imag.adele.cadse.si.workspace.uiplatform.swt.ui.DListUI.java
License:Apache License
protected void handleDown(ITreeSelection sel) { Object[] obj = sel.toArray(); if (obj == null) { return;/*from w ww. j av a 2 s.com*/ } if (obj.length == 0) { return; } if (_ic.moveDown(obj)) { updateValue(); } }
From source file:fr.imag.adele.cadse.si.workspace.uiplatform.swt.ui.DListUI.java
License:Apache License
protected void handleUp(ITreeSelection sel) { Object[] obj = sel.toArray(); if (obj == null) { return;/* ww w . j a v a 2 s . c o m*/ } if (obj.length == 0) { return; } if (_ic.moveUp(obj)) { updateValue(); } }
From source file:net.bioclipse.structuredb.viewer.StructureDBDropAdapterAssistant.java
License:Open Source License
@Override public IStatus handleDrop(CommonDropAdapter dropAdapter, DropTargetEvent dropTargetEvent, Object target) { if (target instanceof StructureDBInstance) { StructureDBInstance structureDBInstance = (StructureDBInstance) target; if (dropTargetEvent.data instanceof ITreeSelection) { ITreeSelection selections = (ITreeSelection) dropTargetEvent.data; List<IFile> files = new ArrayList<IFile>(); for (Object selection : selections.toArray()) { if (selection instanceof IFile) { files.add((IFile) selection); }// w w w . ja v a 2 s . co m } final String dbName = structureDBInstance.getName(); Activator.getDefault().getStructuredbManager().addMoleculesFromFiles(dbName, files, new ImportMoleculesAction.ImportMoleculesUIJob()); return Status.OK_STATUS; } } return Status.CANCEL_STATUS; }
From source file:org.cs3.pdt.analysis.views.AbstractAnalysisView.java
License:Open Source License
protected List<IAnalysis> getSelectedAnalyses(ISelection selection) { TreeSet<IAnalysis> result = new TreeSet<IAnalysis>(); if (!(selection instanceof ITreeSelection)) { return new ArrayList<>(result); }/*from www. jav a 2 s . c o m*/ ITreeSelection treeSelection = (ITreeSelection) selection; for (Object o : treeSelection.toArray()) { if (o instanceof IAnalysis) { result.add((IAnalysis) o); } else if (o instanceof IAnalysisCategory) { result.addAll(((IAnalysisCategory) o).getAnalyses()); } } return new ArrayList<>(result); }
From source file:org.eclipse.cdt.internal.ui.callhierarchy.CHRemoveFromView.java
License:Open Source License
@Override public void run() { TreeViewer tree = fView.getTreeViewer(); ITreeSelection selection = (ITreeSelection) tree.getSelection(); tree.setSelection(null); // should stay before removal tree.remove(selection.toArray()); }
From source file:org.jboss.ide.eclipse.archives.webtools.filesets.FilesetActionProvider.java
License:Open Source License
protected void setSelection() { ICommonViewerSite site = actionSite.getViewSite(); if (site instanceof ICommonViewerWorkbenchSite) { ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite) site; ITreeSelection selection = (ITreeSelection) wsSite.getSelectionProvider().getSelection(); this.treeSelection = selection; selected = selection.toArray(); }//from w w w . jav a 2 s . com }
From source file:org.thanlwinsoft.languagetest.eclipse.wizards.StartTestWizard.java
License:Open Source License
public void createPageControls(Composite pageContainer) { super.createPageControls(pageContainer); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); Object[] items = null;//from w w w.j av a2 s . c o m IWorkbenchPart activePart = page.getActivePart(); if (activePart instanceof TestModuleEditor) { TestModuleEditor editor = (TestModuleEditor) activePart; if (editor.getEditorInput() instanceof IFileEditorInput) { items = new IFile[] { ((IFileEditorInput) editor.getEditorInput()).getFile() }; } } ResourceNavigator view = (ResourceNavigator) page.findView("org.eclipse.ui.views.ResourceNavigator"); if (items == null && view != null) { ITreeSelection selection = (ITreeSelection) view.getTreeViewer().getSelection(); if (selection != null) { items = selection.toArray(); } } if (items != null) moduleSelectionPage.select(items); }