Author: timotei
Date: Tue Oct 12 15:49:25 2010
New Revision: 47035

URL: http://svn.gna.org/viewcvs/wesnoth?rev=47035&view=rev
Log:
eclipse plugin: finally wipe the 'Run' menu from main menu

Modified:
    trunk/utils/java/org.wesnoth/plugin.xml
    trunk/utils/java/org.wesnoth/src/org/wesnoth/product/ActionWiper.java
    
trunk/utils/java/org.wesnoth/src/org/wesnoth/product/ApplicationActionBarAdvisor.java

Modified: trunk/utils/java/org.wesnoth/plugin.xml
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/org.wesnoth/plugin.xml?rev=47035&r1=47034&r2=47035&view=diff
==============================================================================
--- trunk/utils/java/org.wesnoth/plugin.xml (original)
+++ trunk/utils/java/org.wesnoth/plugin.xml Tue Oct 12 15:49:25 2010
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?eclipse version="3.4"?>
 <plugin>
-
    <extension
          id="Wesnoth_Eclipse_Plugin.projectBuilder"
          name="Wesnoth Project Builder"
@@ -781,6 +780,7 @@
        <activityPatternBinding  activityId="org.wesnoth.product.disableextra" 
pattern=".*/org.eclipse.wst.*"> </activityPatternBinding>
        <activityPatternBinding  activityId="org.wesnoth.product.disableextra" 
pattern=".*/org.eclipse.team.internal.ccvs*"> </activityPatternBinding>
        <activityPatternBinding  activityId="org.wesnoth.product.disableextra" 
pattern=".*/org.eclipse.search.*"> </activityPatternBinding>
+       <activityPatternBinding  activityId="org.wesnoth.product.disableextra" 
pattern=".*/org.eclipse.ant.*"> </activityPatternBinding>
    </extension>
    <extension
          point="org.eclipse.ui.startup">

Modified: trunk/utils/java/org.wesnoth/src/org/wesnoth/product/ActionWiper.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/org.wesnoth/src/org/wesnoth/product/ActionWiper.java?rev=47035&r1=47034&r2=47035&view=diff
==============================================================================
--- trunk/utils/java/org.wesnoth/src/org/wesnoth/product/ActionWiper.java 
(original)
+++ trunk/utils/java/org.wesnoth/src/org/wesnoth/product/ActionWiper.java Tue 
Oct 12 15:49:25 2010
@@ -9,6 +9,8 @@
 package org.wesnoth.product;
 
 import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
 import org.eclipse.ui.IPerspectiveDescriptor;
 import org.eclipse.ui.IPerspectiveListener;
 import org.eclipse.ui.IStartup;
@@ -16,55 +18,68 @@
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 
-public class ActionWiper implements IStartup, IPerspectiveListener {
+public class ActionWiper implements IStartup, IPerspectiveListener
+{
+       private static final String[]   ACTIONS_2_WIPE  = new String[] {
+                       "org.eclipse.search.searchActionSet",
+                       "org.eclipse.debug.ui.breakpointActionSet",
+                       "org.eclipse.debug.ui.debugActionSet",
+                       "org.eclipse.debug.ui.launchActionSet",
+                       "org.eclipse.debug.ui.profileActionSet",
+                       "org.eclipse.ui.externaltools.ExternalToolsSet"
+                                                                               
                        // "org.eclipse.ui.edit.text.actionSet.presentation",
+                                                                               
                        // 
"org.eclipse.ui.edit.text.actionSet.openExternalFile",
+                                                                               
                        // 
"org.eclipse.ui.edit.text.actionSet.annotationNavigation",
+                                                                               
                        // "org.eclipse.ui.edit.text.actionSet.navigation",
+                                                                               
                        // 
"org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo",
+                                                                               
                        // "org.eclipse.update.ui.softwareUpdates"
+                                                                               
                        };
 
-    private static final String[] ACTIONS_2_WIPE = new String[] {
-            "org.eclipse.search.searchActionSet",
-            "org.eclipse.debug.ui.breakpointActionSet",
-            "org.eclipse.debug.ui.debugActionSet",
-            "org.eclipse.debug.ui.launchActionSet",
-            "org.eclipse.debug.ui.profileActionSet"
-//            "org.eclipse.ui.edit.text.actionSet.presentation",
-//            "org.eclipse.ui.edit.text.actionSet.openExternalFile",
-//            "org.eclipse.ui.edit.text.actionSet.annotationNavigation",
-//            "org.eclipse.ui.edit.text.actionSet.navigation",
-//            "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo",
-            //"org.eclipse.update.ui.softwareUpdates"
-            };
+       public void earlyStartup()
+       {
+               IWorkbenchWindow[] windows = 
PlatformUI.getWorkbench().getWorkbenchWindows();
+               for (int i = 0; i < windows.length; i++)
+               {
+                       IWorkbenchPage page = windows[i].getActivePage();
+                       if (page != null)
+                       {
+                               wipeActions(page);
+                       }
+                       windows[i].addPerspectiveListener(this);
+               }
+       }
 
-    public void earlyStartup() {
-        IWorkbenchWindow[] windows = PlatformUI.getWorkbench()
-                .getWorkbenchWindows();
-        for (int i = 0; i < windows.length; i++) {
-            IWorkbenchPage page = windows[i].getActivePage();
-            if (page != null) {
-                wipeActions(page);
-            }
-            windows[i].addPerspectiveListener(this);
-        }
-    }
+       private void wipeActions(final IWorkbenchPage page)
+       {
+               Display.getDefault().syncExec(new Runnable() {
+                       public void run()
+                       {
+                               // remove the run menu
+                               Menu menu = 
page.getWorkbenchWindow().getShell().getMenuBar();
+                               for (MenuItem item : menu.getItems())
+                               {
+                                       if (item.getText().equals("&Run"))
+                                       {
+                                               item.dispose();
+                                       }
+                               }
 
-    private void wipeActions(IWorkbenchPage page) {
-        for (int i = 0; i < ACTIONS_2_WIPE.length; i++) {
-            wipeAction(page, ACTIONS_2_WIPE[i]);
-        }
+                               for (int i = 0; i < ACTIONS_2_WIPE.length; i++)
+                               {
+                                       page.hideActionSet(ACTIONS_2_WIPE[i]);
+                               }
+                       }
+               });
+       }
 
-    }
+       public void perspectiveActivated(IWorkbenchPage page,
+                       IPerspectiveDescriptor perspective)
+       {
+               wipeActions(page);
+       }
 
-    private void wipeAction(final IWorkbenchPage page, final String 
actionsetId) {
-        Display.getDefault().syncExec(new Runnable() {
-            public void run() {
-                page.hideActionSet(actionsetId);
-            }
-        });
-    }
-
-    public void perspectiveActivated(IWorkbenchPage page,
-            IPerspectiveDescriptor perspective) {
-        wipeActions(page);
-    }
-
-    public void perspectiveChanged(IWorkbenchPage page,
-            IPerspectiveDescriptor perspective, String changeId) {
-    }
+       public void perspectiveChanged(IWorkbenchPage page,
+                       IPerspectiveDescriptor perspective, String changeId)
+       {
+       }
 }

Modified: 
trunk/utils/java/org.wesnoth/src/org/wesnoth/product/ApplicationActionBarAdvisor.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/org.wesnoth/src/org/wesnoth/product/ApplicationActionBarAdvisor.java?rev=47035&r1=47034&r2=47035&view=diff
==============================================================================
--- 
trunk/utils/java/org.wesnoth/src/org/wesnoth/product/ApplicationActionBarAdvisor.java
 (original)
+++ 
trunk/utils/java/org.wesnoth/src/org/wesnoth/product/ApplicationActionBarAdvisor.java
 Tue Oct 12 15:49:25 2010
@@ -72,7 +72,5 @@
                MenuManager helpMenu = new MenuManager("&Help", "help");
                helpMenu.add(aboutAction_);
                menuBar.add(helpMenu);
-
-               
//WorkspaceUtils.getWorkbenchWindow().getActivePage().hideActionSet("org.eclipse.search.menu");
        }
 }


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to