]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Allow overriding Open With menu's name 02/2902/2
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 23 May 2019 10:43:44 +0000 (13:43 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 23 May 2019 10:48:37 +0000 (10:48 +0000)
gitlab #297

Change-Id: I2781ea15feb329bb52b622d22a30894c8e3f98fb

bundles/org.simantics.ui/src/org/simantics/ui/contribution/OpenWithMenuContribution.java

index 948fe4e8256287c4c271a5f63d51d77fc686236f..2f46ddb5fe3125bbf3005e3e137b2d31b5c70d1d 100644 (file)
@@ -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);