List of usage examples for org.eclipse.jface.viewers IStructuredSelection toList
public List toList();
List
. From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerActionGroup.java
License:Apache License
public boolean exportPackageApplies(IStructuredSelection selection) { Object element = selection.getFirstElement(); if (!(element instanceof WorkflowElement)) return false; WorkflowProject project = ((WorkflowElement) element).getProject(); if (selection.size() > 1 && !project.getProject().checkRequiredVersion(5, 5)) return false; for (Object item : selection.toList()) { if (!(item instanceof WorkflowPackage)) return false; WorkflowPackage pkg = (WorkflowPackage) item; if (pkg.isDefaultPackage() || !pkg.getProject().equals(project)) return false; }//w w w .ja v a2 s. c om return true; }
From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerDragSource.java
License:Apache License
public void dragSetData(DragSourceEvent event) { if (TextTransfer.getInstance().isSupportedType(event.dataType)) { IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection(); List<?> elements = selection.toList(); String data = ""; for (int i = 0; i < elements.size(); i++) { Object element = elements.get(i); if (element instanceof WorkflowProcess || element instanceof ExternalEvent || element instanceof ActivityImpl || element instanceof WorkflowAsset) { data += element.toString(); if (i < elements.size() - 1) data += "#"; }//from w w w . j a v a2 s. c o m } event.data = data; } }
From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerDragSource.java
License:Apache License
public void dragStart(DragSourceEvent event) { boolean allowed = true; if (!treeViewer.getSelection().isEmpty()) { IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection(); List<?> elements = selection.toList(); for (int i = 0; i < elements.size(); i++) { if (!isDragAllowed(elements.get(i))) { allowed = false;//w w w . j a v a2 s . c o m break; } } } event.doit = allowed; }
From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerView.java
License:Apache License
protected void handleSelectionChanged(IStructuredSelection selection) { List<?> list = selection.toList(); if (list.size() == 0) return;//from w ww. j av a 2 s.c om ActionContext actionContext = new ActionContext(selection); actionGroup.setContext(actionContext); // show the properties for this item Object item = list.get(0); if (item instanceof WorkflowElement) { WorkflowElement workflowElement = (WorkflowElement) item; selectionProvider.setSelection(workflowElement); // set the schema owner static qualifier if (workflowElement.getProject() != null) DBMappingUtil.setSchemaOwner(workflowElement.getProject().getMdwDataSource().getSchemaOwner()); } }
From source file:com.centurylink.mdw.plugin.designer.views.ProcessHierarchyView.java
License:Apache License
protected void handleSelectionChanged(IStructuredSelection selection) { List<?> list = selection.toList(); if (list.size() == 0) return;//from w w w .ja va 2 s. c o m ActionContext actionContext = new ActionContext(selection); actionGroup.setContext(actionContext); // TODO property tabs }
From source file:com.centurylink.mdw.plugin.designer.wizards.ImportExportWizard.java
License:Apache License
public void init(IWorkbench workbench, IStructuredSelection selection) { setDefaultPageImageDescriptor(MdwPlugin.getImageDescriptor("icons/mdw_wiz.png")); setNeedsProgressMonitor(true);// w w w . ja v a 2 s. c o m setWindowTitle(this instanceof IExportWizard ? "MDW Export" : "MDW Import"); page = createPage(); page.isExport = this instanceof IExportWizard; if (selection != null && selection.getFirstElement() instanceof WorkflowElement) { elements = new ArrayList<WorkflowElement>(); for (Object item : selection.toList()) elements.add((WorkflowElement) item); } }
From source file:com.codenvy.eclipse.ui.wizard.exporter.ExportProjectToCodenvyWizard.java
License:Open Source License
@Override public void init(IWorkbench workbench, IStructuredSelection selection) { @SuppressWarnings("unchecked") final Set<IProject> selectedProjects = FluentIterable.from((List<Object>) selection.toList()) .transform(new Function<Object, IProject>() { @Override/* w w w . j a va 2 s .co m*/ public IProject apply(Object input) { return (IProject) (input instanceof IAdaptable ? ((IAdaptable) input).getAdapter(IProject.class) : null); } }).filter(notNull()).copyInto(new HashSet<IProject>()); this.exportToCodenvyProjectsSelectionPage = new ProjectWizardPage(selectedProjects); }
From source file:com.crispico.flower.mp.contributions.FlowerCopyAction.java
License:Open Source License
/** * Update editing domain from selection/*from w w w . ja va2 s . c om*/ */ public void update(IStructuredSelection selection) { // get editing domain EditingDomain editingDomain = FlowerMPUtils.getEditingDomainFromSelection(selection.toList()); // if editingDomain not null, update action if (editingDomain != null) { setEditingDomain(editingDomain); setEnabled(copyAction.updateSelection(selection)); } else { // editingDomain is null, reset action setEnabled(false); } }
From source file:com.crispico.flower.mp.contributions.FlowerCutAction.java
License:Open Source License
/** * Update editing domain from selection/* w w w.j av a 2s. c om*/ * @flowerModelElementId _M-H9F7_SEd-259cbnb9fYw */ public void update(IStructuredSelection selection) { // get editing domain EditingDomain editingDomain = FlowerMPUtils.getEditingDomainFromSelection(selection.toList()); // if editingDomain not null, update action if (editingDomain != null) { setEditingDomain(editingDomain); setEnabled(cutAction.updateSelection(selection)); } else { // editingDomain is null, reset action setEnabled(false); } }
From source file:com.crispico.flower.mp.contributions.FlowerDeleteAction.java
License:Open Source License
/** * Update editing domain from selection/*w w w. j av a2 s . co m*/ */ public void update(IStructuredSelection selection) { // get editing domain EditingDomain editingDomain = FlowerMPUtils.getEditingDomainFromSelection(selection.toList()); // if editingDomain not null, update action if (editingDomain != null) { setEditingDomain(editingDomain); setEnabled(deleteAction.updateSelection(selection)); } else { // editingDomain is null, reset action setEnabled(false); // check to see if we have Relations elements inside the selection boolean containsVirtualElements = false; for (Object obj : selection.toList()) { if (obj instanceof RelationVirtualElement) { containsVirtualElements = true; break; } } if (containsVirtualElements) { IStructuredSelection newSelection = replaceVirtualElements(selection); // get the editingDomain from new selection EditingDomain domain = FlowerMPUtils.getEditingDomainFromSelection(selection.toList()); // update only if the found domain is not null if (domain != null) { setEditingDomain(domain); setEnabled(deleteAction.updateSelection(newSelection)); } } } }