/** * @wbp.parser.entryPoint */ @Override public void createControl(Composite parent) { fRootControl = new Composite(parent, SWT.NULL); fRootControl.setLayout(new FillLayout(SWT.HORIZONTAL)); viewer = new TreeViewer(fRootControl, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new ViewLabelProvider(createImageDescriptor()))); viewer.addDoubleClickListener(new IDoubleClickListener () { @Override public void doubleClick(DoubleClickEvent evt) { TreeSelection sel = (TreeSelection) evt.getSelection(); IFile file = (IFile) sel.getFirstElement(); if (isModelFile(file)) { JDTManager.openEditor(file, "org.gw4e.eclipse.studio.editor.GW4EEditor", null); return; } JDTManager.openEditor(file, null); } }); files = new ArrayList<IFile>(); }
@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); setControl(container); container.setLayout(new FillLayout(SWT.HORIZONTAL)); treeViewer = new TreeViewer(container, SWT.BORDER); treeViewer.setUseHashlookup(true); treeViewer.setLabelProvider(new SigTypeLabelProvider()); treeViewer.setContentProvider(new SigTypeContentProvider()); treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects()); treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) { selection = event.getSelection(); ContainerSelectionPage.this.setPageComplete(true); } else { ContainerSelectionPage.this.setPageComplete(false); } } }); }
@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); this.setControl(container); container.setLayout(new FillLayout(SWT.HORIZONTAL)); TreeViewer treeViewer = new TreeViewer(container, SWT.BORDER); treeViewer.setUseHashlookup(true); treeViewer.setLabelProvider(new CreatingAtomWizardLabelProvider()); treeViewer.setContentProvider(new CreatingAtomWizardContentProvider()); treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects()); treeViewer.setFilters(new ViewerFilter[] {new CreatingAtomWizardFilter()}); treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) { UntypedMarkerPage.this.selection = event.getSelection(); UntypedMarkerPage.this.setPageComplete(true); } else { UntypedMarkerPage.this.setPageComplete(false); } } }); }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { TreeSelection selection = (TreeSelection) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection(); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); Object firstElement = selection.getFirstElement(); if (firstElement instanceof IAdaptable) { IFile file = (IFile)((IAdaptable)firstElement).getAdapter(IFile.class); IPath path = file.getLocation(); try { //TODO fix SurveyGenerator.generateAll(path.toOSString(), path.toOSString()); MessageDialog.openInformation(shell, "Success", "Code was generated successfully"); } catch (Exception e) { //MessageDialog.openError(shell, "Error", e.getMessage()); e.printStackTrace(); } } return null; }
@Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection structureSelection = (IStructuredSelection) selection; IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IViewPart view = activePage.findView(IMAGEVIEW_BUNDLE_ID); Bundle dataBundle = Platform.getBundle(XWING_DATA_BUNDLE_ID); if (structureSelection.getFirstElement() instanceof PilotTreeNode) { PilotTreeNode pilot = (PilotTreeNode) structureSelection.getFirstElement(); Pilot p = (Pilot) pilot.getValue(); if (view != null) { loadPilotImage(view, dataBundle, p); } } else if (structureSelection instanceof TreeSelection) { try { UpgradeTypeTreeNode upgradeNode = (UpgradeTypeTreeNode) structureSelection.getFirstElement(); loadUpgradeImage(view, dataBundle, (Upgrade)upgradeNode.getValue()); } catch (ClassCastException ex) { } } } }
public void selectionChanged(SelectionChangedEvent event) { Object firstElement = null; if (event.getSelection() instanceof TreeSelection) { TreeSelection treeSelection = (TreeSelection) event .getSelection(); firstElement = treeSelection.getFirstElement(); } if (firstElement instanceof ISourceImage) { Image image = ((ISourceImage) firstElement).getImage(); imagesBrowseDialog .setSelectedResource((ISourceImage) firstElement); imagesBrowseDialog.showImage(image); } else { imagesBrowseDialog.setSelectedResource(null); imagesBrowseDialog.showImage(null); } }
/** * 트리에서 선택된 요소가 다이어그램에 놓을 수 있는 요소인지 검사한다. * * * @param selection * @return boolean */ protected boolean checkTreeSectionSource(TreeSelection selection) { DiagramType diagramType = diagramEditor.getDiagram().getType(); if (DiagramType.CLASS_DIAGRAM.equals(diagramType)) { if (checkClassDiagram(selection)) { return true; } } else if (DiagramType.USE_CASE_DIAGRAM.equals(diagramType)) { if (checkUseCaseDiagram(selection)) { return true; } } else if (DiagramType.SEQUENCE_DIAGRAM.equals(diagramType)) { if (checkSequenceDiagram(selection)) { return true; } } else if (DiagramType.COMPONENT_DIAGRAM.equals(diagramType)) { if (checkComponentDiagram(selection)) { return true; } } return false; }
/** * 트리에서 선택된 요소가 다이어그램에 놓을 수 있는 요소인지 검사한다. * * * @param selection * @return boolean */ protected boolean checkTreeSectionSource(TreeSelection selection) { DiagramType diagramType = diagramEditor.getDiagram().getType(); if (DiagramType.CLASS_DIAGRAM.equals(diagramType)) { if (checkClassDiagram(selection)) { return true; } } else if (DiagramType.USE_CASE_DIAGRAM.equals(diagramType)) { if (checkUseCaseDiagram(selection)) { return true; } } else if (DiagramType.SEQUENCE_DIAGRAM.equals(diagramType)) { if (checkSequenceDiagram(selection)) { return true; } } return false; }
/** * hierarchyCheck * * @return boolean */ protected boolean hierarchyCheck() { CommonViewer commonViewer = ViewerRegistry.getViewer(); TreeSelection sel = (TreeSelection) commonViewer.getSelection(); List<TreePath> pathList = Arrays.asList(sel.getPaths()); for (TreePath path : pathList) { if (isContains(pathList, path.getParentPath())) { MessageDialog.openError(ProjectExplorerPlugin.getShell(), UMLMessage.LABEL_FILE_FRAGMENTATION, UMLMessage.MESSAGE_FRAGMENT_DEFRAGMENT_ERROR_MESSAGE/*"패키지 간 상하 관계가 포함된 경우 일괄 단편화/병합을 실행할 수 없습니다."*/); return false; } } return true; }
private ModelHandle getModelHandle() { ModelHandle handle = null; ISelection selection = viewer.getSelection(); if (selection instanceof TreeSelection) { TreeSelection treeSelection = (TreeSelection) selection; if (treeSelection.size() == 1) { Object selObj = treeSelection.getFirstElement(); if(selObj instanceof ModelCodeTreeNode) { ModelCodeTreeNode modelCodeNode = (ModelCodeTreeNode)selObj; try { handle = modelCodeNode.getActiveModelHandle(); } catch (EntryNotFoundException e) { // ignore and just interpret as non-drag-able... } } } } return handle; }
@Override public void doubleClick(final DoubleClickEvent event) { // safety check first if (event == null || event.getSelection() == null || !(event.getSelection() instanceof TreeSelection)) { return; } final TreeSelection selection = (TreeSelection) event.getSelection(); final TreePath[] paths = selection.getPaths(); final TreePath treePath = paths[paths.length - 1]; final Object segment = treePath.getLastSegment(); final TreeItem[] items = viewer.getTree().getItems(); final TreeItem item = getItem(items, segment); if (item != null) { item.setExpanded(!item.getExpanded()); viewer.refresh(); } }
/** * @param selection * @return first element of the selection */ public static Object getFirstSelectedElement(ISelection selection) { if (selection instanceof TreeSelection) { TreeSelection treeSelection = (TreeSelection) selection; return treeSelection.getFirstElement(); } else if (selection instanceof StructuredSelection) { StructuredSelection structuredSelection = (StructuredSelection) selection; return structuredSelection.getFirstElement(); } else if (selection instanceof IFileEditorInput) { IFileEditorInput editorInput = (FileEditorInput) selection; return editorInput.getFile(); } else if (selection instanceof TextSelection) { return null; } else { throw new RuntimeException( Messages.GeneratorUtils_SelectionNotSupported); } }
/*********************************************************************** * Open event on double click **********************************************************************/ @Override public void open(OpenEvent event) { TreeSelection sel = (TreeSelection) event.getSelection(); try { ProcedureNode item = (ProcedureNode) sel.getFirstElement(); // Open procedures only, ignore categories String category = item.getProcID(); if (category == null || category.equals("") || category.equals("CATEGORY")) { return; } CommandHelper.execute(OpenProcedure.ID); } catch (Exception e) { return; } }
/*********************************************************************** * Selection changed on the tree **********************************************************************/ @Override public void selectionChanged(SelectionChangedEvent event) { TreeSelection sel = (TreeSelection) event.getSelection(); IRuntimeSettings runtime = (IRuntimeSettings) ServiceManager.get(IRuntimeSettings.class); try { ProcedureNode item = (ProcedureNode) sel.getFirstElement(); runtime.setRuntimeProperty(RuntimeProperty.ID_NAVIGATION_VIEW_SELECTION, item.getProcID()); } catch (Exception ex) { runtime.setRuntimeProperty(RuntimeProperty.ID_NAVIGATION_VIEW_SELECTION, null); } }
public void doubleClick(TreeViewer treeViewer) { TreeSelection ts = (TreeSelection) treeViewer.getSelection(); Object el = ts.getFirstElement(); if (el instanceof MFolder) { if (treeViewer.getExpandedState(el)) treeViewer.collapseToLevel(el, 1); else { if (refreshAction.isEnabled()) refreshAction.run(); treeViewer.expandToLevel(el, 1); } } if (el instanceof MInputControl && editAction.isEnabled()) { editAction.run(); return; } if (editServerAction.isEnabled()) editServerAction.run(); // if (runReportUnitAction.isEnabled()) // runReportUnitAction.run(); else if (openInEditorAction.isEnabled()) openInEditorAction.run(); else if (runReportUnitAction.isEnabled()) runReportUnitAction.run(); }
/** * We will accept the selection in the workbench to see if we can initialize * from it. * * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) */ public void init(IWorkbench workbench, IStructuredSelection selection) { if (selection instanceof StructuredSelection) { if (selection.getFirstElement() instanceof IProject || selection.getFirstElement() instanceof IFile || selection.getFirstElement() instanceof IFolder) { this.selection = selection; return; } for (Object obj : selection.toList()) { if (obj instanceof EditPart) { IEditorInput ein = SelectionHelper.getActiveJRXMLEditor().getEditorInput(); if (ein instanceof FileEditorInput) { this.selection = new TreeSelection(new TreePath(new Object[] { ((FileEditorInput) ein).getFile() })); return; } } } } this.selection = selection; }
@Override public void init(IWorkbench workbench, IStructuredSelection selection) { if (selection instanceof StructuredSelection) { if (selection.getFirstElement() instanceof IProject || selection.getFirstElement() instanceof IFile || selection.getFirstElement() instanceof IFolder) { this.selection = selection; return; } for (Object obj : selection.toList()) { if (obj instanceof EditPart) { IEditorInput ein = SelectionHelper.getActiveJRXMLEditor().getEditorInput(); if (ein instanceof FileEditorInput) { this.selection = new TreeSelection(new TreePath(new Object[] { ((FileEditorInput) ein).getFile() })); return; } } } } this.selection = selection; }
public static void doFindResource(ServerProvider sp, TreeViewer treeViewer) { TreeSelection ts = (TreeSelection) treeViewer.getSelection(); Object el = ts.getFirstElement(); MServerProfile msp = null; if (el instanceof MServerProfile) msp = (MServerProfile) el; else if (el instanceof MResource) { INode n = ((MResource) el).getRoot(); if (n != null && n instanceof MServerProfile) msp = (MServerProfile) n; } if (msp != null) { FindResourceWizard wizard = new FindResourceWizard(msp); WizardDialog dialog = new FindWizardDialog(UIUtils.getShell(), wizard); dialog.setHelpAvailable(false); dialog.create(); if (dialog.open() == Dialog.OK) { ResourceDescriptor rd = wizard.getValue(); if (rd != null) selectResource(sp, msp, rd, treeViewer); } } }
/** * fillContextMenu * * @param manager */ private void fillContextMenu(IMenuManager manager) { ISelection selection = treeViewer.getSelection(); if (selection instanceof TreeSelection) { TreeSelection treeSelection = (TreeSelection) selection; Object item = treeSelection.getFirstElement(); if (item instanceof BaseNode) { BaseNode<?> node = (BaseNode<?>) item; Action[] actions = node.getActions(); if (actions != null) { for (Action action : actions) { manager.add(action); } } } } }
@Override public void run() { TreeSelection s = (TreeSelection) treeViewer.getSelection(); TreePath[] p = s.getPaths(); for (int i = 0; i < p.length;) { final Object obj = p[i].getLastSegment(); if (obj instanceof ANode) { ANode parent = (ANode) obj; AddResourceWizard wizard = new AddResourceWizard(parent); WizardDialog dialog = new WizardDialog(UIUtils.getShell(), wizard); dialog.create(); dialog.open(); } break; } }
@Override public void run() { final TreeSelection s = (TreeSelection) treeViewer.getSelection(); TreePath[] p = s.getPaths(); for (int i = 0; i < p.length; i++) { final Object obj = p[i].getLastSegment(); if (obj instanceof MResource) { PermissionWizard wizard = new PermissionWizard((MResource) obj); PermissionDialog dialog = new PermissionDialog(UIUtils.getShell(), wizard); dialog.addApplyListener(wizard); dialog.open(); } else if (obj instanceof MServerProfile) { EditServerAction.fillServerProfile((MServerProfile) obj, treeViewer); } } }
@Override public void run() { final TreeSelection s = (TreeSelection) treeViewer.getSelection(); TreePath[] p = s.getPaths(); for (int i = 0; i < p.length; i++) { Object obj = p[i].getLastSegment(); if (obj instanceof MResource) { INode node = ((MResource) obj).getReportUnit(); if (node != null) { final String key = ServerManager.getKey((MReportUnit) node); if (key != null) Display.getDefault().asyncExec(new Runnable() { public void run() { SelectionHelper.openEditor(key, ReportUnitEditor.ID); } }); } break; } } }
@Override public void run() { TreeSelection s = (TreeSelection) treeViewer.getSelection(); TreePath[] p = s.getPaths(); List<MResource> rlist = new ArrayList<MResource>(); for (int i = 0; i < p.length; i++) { final Object obj = p[i].getLastSegment(); if (obj instanceof MResource) { System.out.println(((MResource) obj).getToolTip()); ((MResource) obj).setCut(true); rlist.add((MResource) obj); } } if (!rlist.isEmpty()) Clipboard.getDefault().setContents(rlist); }
@Override public void run() { IConnection conn = null; TreeSelection selection = (TreeSelection) treeViewer.getSelection(); Object firstElement = selection.getFirstElement(); if (firstElement != null) { if (firstElement instanceof MServerProfile) conn = ((MServerProfile) firstElement).getWsClient(); else if (firstElement instanceof MResource) conn = ((MResource) firstElement).getWsClient(); } if (conn != null) { ImportMetadataWizard wizard = new ImportMetadataWizard(conn); WizardDialog dialog = new WizardDialog(UIUtils.getShell(), wizard); dialog.create(); if (dialog.open() == Dialog.OK) { } } }
@Override public void run() { Object obj = ((TreeSelection) treeViewer.getSelection()).getFirstElement(); if (obj instanceof MServerProfile) { MServerProfile mspold = (MServerProfile) obj; ServerProfileWizard wizard = new ServerProfileWizard(ServerManager.getMServerProfileCopy(mspold)); ServerProfileWizardDialog dialog = new ServerProfileWizardDialog(UIUtils.getShell(), wizard); wizard.bindTestButton(dialog); dialog.create(); if (dialog.open() == Dialog.OK) { MServerProfile msprof = wizard.getServerProfile(); mspold.setValue(msprof.getValue()); mspold.setWsClient(null); ServerManager.saveServerProfile(mspold); fillServerProfile(mspold, treeViewer); } } }
private void addDoubleClickSupport() { treeViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { TreeSelection s = (TreeSelection) treeViewer.getSelection(); if (s.getFirstElement() instanceof XMLNode) { XMLNode xmlNode = (XMLNode) s.getFirstElement(); String xPathExpression = documentManager .getXPathExpression(null, xmlNode); queryTextArea .setText((xPathExpression != null) ? xPathExpression : ""); //$NON-NLS-1$ } } }); }
public void setupNewFileName() { String filename = NEW_FILENAME; if (selection != null) { if (selection instanceof TreeSelection) { TreeSelection s = (TreeSelection) selection; if (s.getFirstElement() instanceof IFile) { IFile file = (IFile) s.getFirstElement(); String f = file.getProjectRelativePath().removeLastSegments(1).toOSString() + "/" + filename;//$NON-NLS-1$ int i = 1; while (file.getProject().getFile(f).exists()) { filename = NEW_NAME + i + NEW_EXT; f = file.getProjectRelativePath().removeLastSegments(1).toOSString() + "/" + filename;//$NON-NLS-1$ i++; } } } step1.setFileName(filename); } }
public void editElement(Object element, int column) { if (element instanceof TreePath) { setSelection(new TreeSelection((TreePath) element)); GalleryItem[] items = gallery.getSelection(); if (items.length == 1) { ViewerRow row = getViewerRowFromItem(items[0]); if (row != null) { ViewerCell cell = row.getCell(column); if (cell != null) { getControl().setRedraw(false); triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(cell)); getControl().setRedraw(true); } } } } else { super.editElement(element, column); } }
@Override public void run() { TreeSelection s = (TreeSelection) treeViewer.getSelection(); TreePath[] p = s.getPaths(); for (int i = 0; i < p.length; i++) { Object obj = p[i].getLastSegment(); if (obj instanceof MDataAdapter) { SaveAsDialog saveAsDialog = new SaveAsDialog(Display.getDefault().getActiveShell()); saveAsDialog.setOriginalName(((MDataAdapter) obj).getValue().getName().replace(" ", "") + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ saveAsDialog.open(); IPath path = saveAsDialog.getResult(); if (path != null) saveFile(obj, path); } } }
@Override public void run() { Object obj = ((TreeSelection) treeViewer.getSelection()).getFirstElement(); if (obj instanceof MDataAdapter) { MDataAdapter mDataAdapter = (MDataAdapter) obj; ADataAdapterStorage storage = ((MDataAdapters) mDataAdapter.getParent()).getValue(); DataAdapterDescriptor dataAdapter = mDataAdapter.getValue(); String key = storage.getUrl(dataAdapter); DataAdapterWizard wizard = new DataAdapterWizard(dataAdapter, storage); DataAdapterWizardDialog dialog = new DataAdapterWizardDialog(Display.getCurrent().getActiveShell(), wizard); wizard.setWizardDialog(dialog); dialog.create(); if (dialog.open() == Dialog.OK) { DataAdapterDescriptor modifiedDataAdapter = wizard.getDataAdapter(); storage.addDataAdapter(key, modifiedDataAdapter); treeViewer.refresh(true); } } }
@Override public void run() { TreeSelection s = (TreeSelection) treeViewer.getSelection(); TreePath[] p = s.getPaths(); if (!UIUtils.showDeleteConfirmation()) return; ADataAdapterStorage storage = null; for (int i = 0; i < p.length; i++) { Object obj = p[i].getLastSegment(); if (obj instanceof MDataAdapter) { MDataAdapter mDataAdapter = (MDataAdapter) obj; DataAdapterDescriptor m = mDataAdapter.getValue(); if (storage == null) storage = ((MDataAdapters) mDataAdapter.getParent()).getValue(); if (storage != null) storage.removeDataAdapter(m); treeViewer.refresh(true); } } }
public void setupNewFileName() { String filename = NEW_DATAADAPTER_XML; if (selection != null) { if (selection instanceof TreeSelection) { TreeSelection s = (TreeSelection) selection; if (s.getFirstElement() instanceof IFile) { IFile file = (IFile) s.getFirstElement(); String f = file.getProjectRelativePath().removeLastSegments(1).toOSString() + "/" + filename; //$NON-NLS-1$ int i = 1; while (file.getProject().getFile(f).exists()) { filename = "NEW_DATAADAPTER" + i + ".xml"; //$NON-NLS-1$ //$NON-NLS-2$ f = file.getProjectRelativePath().removeLastSegments(1).toOSString() + "/" + filename; //$NON-NLS-1$ i++; } } } step1.setFileName(filename); } }
public void setActivePart(IAction action, IWorkbenchPart targetPart) { ISelection s = targetPart.getSite().getSelectionProvider().getSelection(); if (s instanceof TreeSelection) { TreePath[] tp = ((TreeSelection) s).getPaths(); for (int i = 0; i < tp.length; i++) { Object obj = tp[i].getFirstSegment(); if (obj instanceof IProject) { try { if (((IProject) obj).hasNature(JasperReportsNature.NATURE_ID)) action.setChecked(true); else { action.setChecked(false); break; } } catch (CoreException e) { e.printStackTrace(); } } } } }
/** * The callback function for the double click listener. Finds what was * clicked on, if its a rule show it in the editor (or focus on the already * open editor). */ /* Override */ public void doubleClick( DoubleClickEvent event ) { if( event.getSelection() instanceof TreeSelection ) { TreeSelection selected = (TreeSelection) event.getSelection(); if( selected.getFirstElement() != null ) { switch( ((ModelElement) selected.getFirstElement()).getModelType() ) { case RULE: TrafficScriptEditor.openEditorForRule( (Rule) selected.getFirstElement() ); break; } } } }
@Override public final Object execute(final ExecutionEvent event) { final List<String> arguments = new ArrayList<String>(); final String command = Activator.getDefault().getPreferenceStore().getString(this.getMergeCommandPathName()); final TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event); if (selection.isEmpty() == false) { final IAdapterManager adapterManager = Platform.getAdapterManager(); final IResource resource = adapterManager.getAdapter(selection.getFirstElement(), IResource.class); if (resource != null) { arguments.add("/patchpath:" + resource.getLocation().toString()); ProcessWrapper.executeCommand(command, arguments); } } return null; }
/** * Returns the active tree resource selection if there is one. * * Examines the active workspace selection and if it is a resource inside of a tree returns it. * * @param event * The execution event * @returns The resource or {@code null} on failure. * */ private static IResource getActiveTreeResourceSelection(ExecutionEvent event) { ISelection activeSelection = HandlerUtil.getCurrentSelection(event); if (activeSelection instanceof TreeSelection) { Object firstElement = ((TreeSelection) activeSelection).getFirstElement(); if (firstElement instanceof IResource) { return (IResource) firstElement; } } return null; }
public Object execute(ExecutionEvent event) throws ExecutionException { Supplier<IExecutionEngine> engineSupplier = org.eclipse.gemoc.executionframework.debugger.Activator.getDefault().getEngineSupplier(); Supplier<String> bundleSupplier = org.eclipse.gemoc.executionframework.debugger.Activator.getDefault().getBundleSymbolicNameSupplier(); if (engineSupplier != null) { this.engine = engineSupplier.get(); } if (bundleSupplier != null) { this.bundleSymbolicName = bundleSupplier.get(); } TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event); locateAndOpenSource(selection); return null; }
@Override public void engineRegistered(final IExecutionEngine engine) { Display.getDefault().syncExec(new Runnable() { public void run() { engine.getExecutionContext().getExecutionPlatform().addEngineAddon(EnginesStatusView.this); _viewer.setInput(org.eclipse.gemoc.executionframework.engine.Activator.getDefault().gemocRunningEngineRegistry); TreeViewerHelper.resizeColumns(_viewer); TreePath treePath = new TreePath(new Object[] {engine}); TreeSelection newSelection = new TreeSelection(treePath); _viewer.setSelection(newSelection, true); } }); }
private String getSelectedProject() { if (!selection.isEmpty() && (selection instanceof TreeSelection)) { Object object = ((TreeSelection)selection).getFirstElement(); if ((object instanceof ProjectTreeObject) || (object instanceof UnloadedProjectTreeObject)) { return ((TreeObject)object).getName(); } } return null; }
@Override public String getFilePath() { String result = null; final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(); if (selection != null && selection instanceof TreeSelection) { final TreeSelection treeSelection = (TreeSelection) selection; final IFile file = (IFile) treeSelection.getFirstElement(); result = file.getLocation().makeAbsolute().toOSString(); } return result; }