diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/dialog/ElementTreeSingleSelectDialog.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/dialog/ElementTreeSingleSelectDialog.java index f9069e2280fa36ab18acf7a0254358d09f68eaa6..b49234ea1400a2a5503023560ad55d4cdc7536ca 100644 --- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/dialog/ElementTreeSingleSelectDialog.java +++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/dialog/ElementTreeSingleSelectDialog.java @@ -306,7 +306,8 @@ public class ElementTreeSingleSelectDialog extends TitleAreaDialog { // find the path to the element ITreeSelection selection = (ITreeSelection) gui.getElementTreeViewer() .getSelection(); - if (selection.getPaths() == null || selection.getPaths().length != 1) { + if (selection.getPaths() == null || selection.getPaths().length != 1 + || !acceptElement(selection.getPaths()[0].getLastSegment())) { selectedPath = null; getButton(OK_ID).setEnabled(false); } else { @@ -315,6 +316,19 @@ public class ElementTreeSingleSelectDialog extends TitleAreaDialog { } } + /** + * This method can be overwritten by subclasses to accept only elements of a + * certain kind. For not-accepted elements the OK-field is disabled. + * + * The default implementation accepts all elements. + * + * @param element + * the element which is currently selected + */ + public boolean acceptElement(Object element) { + return true; + } + /** * Create the tree path from one of the given root elements to the child * element. The content provider will be used to compute the direct parent