From: Marko Luukkainen Date: Thu, 23 May 2019 10:43:44 +0000 (+0300) Subject: Allow overriding Open With menu's name X-Git-Tag: v1.43.0~136^2~152^2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F02%2F2902%2F2;p=simantics%2Fplatform.git Allow overriding Open With menu's name gitlab #297 Change-Id: I2781ea15feb329bb52b622d22a30894c8e3f98fb --- diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/contribution/OpenWithMenuContribution.java b/bundles/org.simantics.ui/src/org/simantics/ui/contribution/OpenWithMenuContribution.java index 948fe4e82..2f46ddb5f 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/contribution/OpenWithMenuContribution.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/contribution/OpenWithMenuContribution.java @@ -67,9 +67,15 @@ public class OpenWithMenuContribution extends DynamicMenuContribution { return selection.length == 1; } + protected String getText() { + return "Open With"; + } + @Override protected IContributionItem[] getContributionItems(ReadGraph graph, Object[] selection) throws DatabaseException { final Object r = extractResource(graph, selection[0]); + if (r == null) + return NONE; final EditorAdapter[] editorAdapters = EditorRegistry.getInstance().getAdaptersFor(graph, r); if (editorAdapters.length == 0) return NONE; @@ -79,7 +85,7 @@ public class OpenWithMenuContribution extends DynamicMenuContribution { @Override public void fill(Menu menu, int index) { MenuItem openWith = new MenuItem(menu, SWT.CASCADE, index); - openWith.setText("Open With"); + openWith.setText(getText()); openWith.setEnabled(editorAdapters.length > 0); Menu subMenu = new Menu(menu); openWith.setMenu(subMenu);