/** * @param selection the selection * @return if selection is applicable for this action */ public boolean isApplicable(ISelection selection) { boolean result = false; if (!SelectionUtilities.isMultiSelection(selection)) { Object obj = SelectionUtilities.getSelectedObject(selection); if (obj instanceof IResource) { IResource iRes = (IResource) obj; if (ModelIdentifier.isRelationalViewModel(iRes)) { this.selectedModel = (IFile) obj; result = true; } } } return result; }
private boolean virtualModelSelected(ISelection theSelection) { boolean result = false; List allObjs = SelectionUtilities.getSelectedObjects(theSelection); if (!allObjs.isEmpty() && allObjs.size() == 1) { Iterator iter = allObjs.iterator(); result = true; Object nextObj = null; while (iter.hasNext() && result) { nextObj = iter.next(); if (nextObj instanceof IFile) { result = ModelIdentifier.isRelationalViewModel((IFile) nextObj); } else { result = false; } } } return result; }