X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2FdiagramEditor%2FOpenDiagramFromComponentAdapter.java;h=d5071303e4924b22a3f812f05b312141d03a5ed1;hp=e015796c712fe56c44eef4b40af27c0ef794e5e9;hb=47269fe0acb894f346810417d950a1ab59cdc0ea;hpb=11309f6516278203264b680235cbbe1dc2bde98e diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromComponentAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromComponentAdapter.java index e015796c7..d5071303e 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromComponentAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromComponentAdapter.java @@ -57,10 +57,10 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt private static final Logger LOGGER = LoggerFactory.getLogger(OpenDiagramFromComponentAdapter.class); - private static final String EDITOR_ID = "org.simantics.modeling.ui.diagramEditor"; + private static final String EDITOR_ID = "org.simantics.modeling.ui.diagramEditor"; //$NON-NLS-1$ public OpenDiagramFromComponentAdapter() { - super("Open Diagram Containing This Component", Activator.SYMBOL_ICON); + super(Messages.OpenDiagramFromComponentAdapter_OpenDiagramContainingComponent, Activator.SYMBOL_ICON); } @Override @@ -76,7 +76,7 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt private Pair tryGetResource(ReadGraph graph, Object input) throws DatabaseException { Resource r = ResourceAdaptionUtils.toSingleResource(input); if (r != null) - return Pair.make(r, ""); + return Pair.make(r, ""); //$NON-NLS-1$ Variable v = AdaptionUtils.adaptToSingle(input, Variable.class); return findResource(graph, v); } @@ -86,20 +86,20 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt while (v != null) { Resource r = v.getPossibleRepresents(graph); if (r != null) { - String rvi = ""; + String rvi = ""; //$NON-NLS-1$ if (path != null) { int pathLength = path.size(); for (int i = 0; i < pathLength; i++) path.set(i, URIStringUtils.escape(path.get(i))); Collections.reverse(path); - rvi = EString.implode(path, "/"); + rvi = EString.implode(path, "/"); //$NON-NLS-1$ } return Pair.make(r, rvi); } if (path == null) path = new ArrayList<>(2); path.add( v.getName(graph) ); - v = v.browsePossible(graph, "."); + v = v.browsePossible(graph, "."); //$NON-NLS-1$ } return null; } @@ -120,9 +120,9 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt Variable v = AdaptionUtils.adaptToSingle(input, Variable.class); if (LOGGER.isDebugEnabled()) { - LOGGER.debug(getClass().getSimpleName() + ".openEditor: input's nearest parent resource URI: " + NameUtils.getURIOrSafeNameInternal(graph, r.first)); - LOGGER.debug(getClass().getSimpleName() + ".openEditor: input's nearest parent RVI: " + r.second); - LOGGER.debug(getClass().getSimpleName() + ".openEditor: input variable URI: " + (v != null ? v.getURI(graph) : "null")); + LOGGER.debug(getClass().getSimpleName() + ".openEditor: input's nearest parent resource URI: " + NameUtils.getURIOrSafeNameInternal(graph, r.first)); //$NON-NLS-1$ + LOGGER.debug(getClass().getSimpleName() + ".openEditor: input's nearest parent RVI: " + r.second); //$NON-NLS-1$ + LOGGER.debug(getClass().getSimpleName() + ".openEditor: input variable URI: " + (v != null ? v.getURI(graph) : "null")); //$NON-NLS-1$ //$NON-NLS-2$ } final Collection rs = tryFindDiagram(graph, r.first, v, r.second); @@ -154,16 +154,16 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt Resource diagram = ComponentUtils.getPossibleCompositeDiagram(g, composite); if (LOGGER.isDebugEnabled()) { - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: component: " + NameUtils.getURIOrSafeNameInternal(g, component)); - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: composite: " + NameUtils.getURIOrSafeNameInternal(g, composite)); + 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$ } Collection referenceElements = diagram == null ? g.getObjects(component, MOD.HasParentComponent_Inverse) : Collections.emptyList(); if (LOGGER.isDebugEnabled()) { - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: diagram: " + NameUtils.getURIOrSafeNameInternal(g, diagram)); - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: referenceElements: " + referenceElements.size()); + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: diagram: " + NameUtils.getURIOrSafeNameInternal(g, diagram)); //$NON-NLS-1$ + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: referenceElements: " + referenceElements.size()); //$NON-NLS-1$ for (Object object : referenceElements) - LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, (Resource) object)); + LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, (Resource) object)); //$NON-NLS-1$ } if (diagram == null && referenceElements.isEmpty()) return Collections.emptyList(); @@ -175,7 +175,7 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt if (indexRoot == null) return Collections.emptyList(); if (LOGGER.isDebugEnabled()) - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: Model: " + indexRoot); + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: Model: " + indexRoot); //$NON-NLS-1$ if (diagram != null) { if(OpenDiagramFromConfigurationAdapter.isLocked(g, diagram)) @@ -192,23 +192,23 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt if (parent != null) { rvi = parent.getPossibleRVI(g); if (LOGGER.isDebugEnabled()) - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: resolved RVI: " + rvi); + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: resolved RVI: " + rvi); //$NON-NLS-1$ } } } else { allowNullRvi = true; rvi = compositeVariable.getPossibleRVI(g); if (LOGGER.isDebugEnabled()) - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: resolved RVI from resource path: " + rvi); + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: resolved RVI from resource path: " + rvi); //$NON-NLS-1$ } if (rvi == null && !allowNullRvi) return Collections.emptyList(); Collection selectedObjects = findElementObjects(g, component, rviFromComponent); if (LOGGER.isDebugEnabled()) { - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: selected objects: " + selectedObjects.size()); + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: selected objects: " + selectedObjects.size()); //$NON-NLS-1$ for (Object object : selectedObjects) - LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, (Resource) object)); + LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, (Resource) object)); //$NON-NLS-1$ } // Prevent diagram from opening if there's nothing to select // on the diagram based on the received input. @@ -218,11 +218,11 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt final MapSet referencingDiagrams = listReferenceDiagrams(g, referenceElements); final Set diagrams = referencingDiagrams.getKeys(); if (LOGGER.isDebugEnabled()) { - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: selected objects: " + diagrams.size()); + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: selected objects: " + diagrams.size()); //$NON-NLS-1$ for (NamedResource d : diagrams) { - LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, d.getResource()) + ":"); + LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, d.getResource()) + ":"); //$NON-NLS-1$ //$NON-NLS-2$ for (Resource referenceElement : referencingDiagrams.getValues(d)) { - LOGGER.debug("\t\t" + NameUtils.getURIOrSafeNameInternal(g, referenceElement)); + LOGGER.debug("\t\t" + NameUtils.getURIOrSafeNameInternal(g, referenceElement)); //$NON-NLS-1$ } } } @@ -299,7 +299,7 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt while (v != null) { Resource represents = v.getPossibleRepresents(graph); if (LOGGER.isDebugEnabled()) - LOGGER.debug(v.getURI(graph) + " -> " + NameUtils.getURIOrSafeNameInternal(graph, represents)); + LOGGER.debug(v.getURI(graph) + " -> " + NameUtils.getURIOrSafeNameInternal(graph, represents)); //$NON-NLS-1$ if (represents != null) return v; v = v.getParent(graph); @@ -364,8 +364,8 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt protected NamedResource queryTarget(final Shell parentShell, Collection options) { NavigationTargetChooserDialog dialog = new NavigationTargetChooserDialog( parentShell, options.toArray(new NamedResource[options.size()]), - "Choose Diagram with Component Reference", - "Select single diagram from list"); + Messages.OpenDiagramFromComponentAdapter_ChooseDiagramComponetReference, + Messages.OpenDiagramFromComponentAdapter_SelectSingleDiagramfromList); return dialog.open() != Window.OK ? null : dialog.getSelection(); }