super(Messages.OpenDiagramFromComponentAdapter_OpenDiagramContainingComponent, Activator.SYMBOL_ICON);
}
+ protected String getEditorId(ReadGraph g, Resource diagram) throws DatabaseException {
+ ModelingResources MOD = ModelingResources.getInstance(g);
+ String preferredEditorId = g.getPossibleRelatedValue(diagram, MOD.PreferredDiagramEditorID);
+ if(preferredEditorId != null)
+ return preferredEditorId;
+ else
+ return EDITOR_ID;
+ }
+
@Override
public boolean canHandle(ReadGraph graph, Object input) throws DatabaseException {
Pair<Resource, String> p = tryGetResource(graph, input);
Resource composite = g.getSingleObject(component, l0.PartOf);
Resource diagram = ComponentUtils.getPossibleCompositeDiagram(g, composite);
+ String editorId = getEditorId(g, composite);
+
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(getClass().getSimpleName() + ".findDiagram: component: " + NameUtils.getURIOrSafeNameInternal(g, component)); //$NON-NLS-1$
LOGGER.debug(getClass().getSimpleName() + ".findDiagram: composite: " + NameUtils.getURIOrSafeNameInternal(g, composite)); //$NON-NLS-1$
// Prevent diagram from opening if there's nothing to select
// on the diagram based on the received input.
if (!selectedObjects.isEmpty())
- result.add( NavigateToTarget.editorActivator(EDITOR_ID, diagram, indexRoot, rvi, editorActivationCallback(selectedObjects)) );
+ result.add( NavigateToTarget.editorActivator(editorId, diagram, indexRoot, rvi, editorActivationCallback(selectedObjects)) );
} else {
final MapSet<NamedResource, Resource> referencingDiagrams = listReferenceDiagrams(g, referenceElements);
final Set<NamedResource> diagrams = referencingDiagrams.getKeys();
RVI rvi = getDiagramCompositeRvi(g, singleDiagram.getResource());
if (rvi != null) {
Collection<Resource> selectedObjects = referencingDiagrams.getValues(singleDiagram);
- result.add( NavigateToTarget.editorActivator(EDITOR_ID, singleDiagram.getResource(), indexRoot, rvi, editorActivationCallback(selectedObjects)) );
+ result.add( NavigateToTarget.editorActivator(editorId, singleDiagram.getResource(), indexRoot, rvi, editorActivationCallback(selectedObjects)) );
}
break;
if (selected != null) {
Collection<Resource> selectedObjects = referencingDiagrams.getValues(selected);
RVI drvi = diagramToRvi.get(selected);
- NavigateToTarget.editorActivator(EDITOR_ID, selected.getResource(), indexRoot, drvi, editorActivationCallback(selectedObjects)).run();
+ NavigateToTarget.editorActivator(editorId, selected.getResource(), indexRoot, drvi, editorActivationCallback(selectedObjects)).run();
}
});
break;