@Override public void selectionChanged(IFormPart masterPart, ISelection selection) { IStructuredSelection ssel = (IStructuredSelection) selection; if (ssel.size() == 1) { fInput = (IPluginExtensionPoint) ssel.getFirstElement(); } else fInput = null; update(); }
/** Tests if the current workbench selection is a suitable container to use. */ private void initialize() { if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) selection; if (ssel.size() > 1) { return; } Object obj = ssel.getFirstElement(); if (obj instanceof IResource) { IContainer container; if (obj instanceof IContainer) { container = (IContainer) obj; } else { container = ((IResource) obj).getParent(); } containerText.setText(container.getFullPath().toString()); } } fileText.setText("new.gaml"); }