for (Object o : selection) {
if ((o instanceof IAdaptable)) {
NodeContext nodeContext = ((IAdaptable) o).getAdapter(NodeContext.class);
- if (nodeContext != null)
+ if (nodeContext != null) {
result.add(nodeContext);
- } else if (o instanceof WorkbenchSelectionElement) {
- try {
- Resource res = WorkbenchSelectionUtils.getPossibleResource((WorkbenchSelectionElement)o);
- if(res != null) {
- result.add(NodeContextBuilder.buildWithInput(res));
- }
- } catch (DatabaseException e) {
- LOGGER.error("Failed to get node contexts for selection.", e);
- }
+ continue;
+ }
+ }
+ try {
+ Resource res = WorkbenchSelectionUtils.getPossibleResource(o);
+ if(res != null) {
+ result.add(NodeContextBuilder.buildWithInput(res));
+ }
+ } catch (DatabaseException e) {
+ LOGGER.error("Failed to get node contexts for selection.", e);
}
}