Save PHPPartitionScanner for refactoring
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / ui / actions / GenerateActionGroup.java
index 36797b8..58bf8da 100644 (file)
@@ -49,6 +49,12 @@ import org.eclipse.ui.texteditor.IUpdate;
  * @since 2.0
  */
 public class GenerateActionGroup extends ActionGroup {
+  /**
+        * Pop-up menu: id of the source sub menu (value <code>net.sourceforge.phpdt.ui.source.menu</code>).
+        * 
+        * @since 3.0
+        */
+       public static final String MENU_ID= "net.sourceforge.pheclipse.ui.source.menu"; //$NON-NLS-1$
        
   private PHPEditor fEditor;
 //     private boolean fEditorIsOwner;
@@ -252,24 +258,46 @@ public class GenerateActionGroup extends ActionGroup {
        /* (non-Javadoc)
         * Method declared in ActionGroup
         */
+//     public void fillContextMenu(IMenuManager menu) {
+//             super.fillContextMenu(menu);
+//             IMenuManager subMenu= null;
+//             if (isEditorOwner()) {
+//                     subMenu= fillEditorSubMenu(menu);
+//             } else {
+//     //              subMenu= createViewSubMenu(menu);
+//             }
+//             if (subMenu != null)
+//                     menu.appendToGroup(fGroupName, subMenu);
+//     }
        public void fillContextMenu(IMenuManager menu) {
                super.fillContextMenu(menu);
-               IMenuManager subMenu= null;
+               String shortCut= null; //$NON-NLS-1$
+//             if (fQuickAccessAction != null) {
+//                     shortCut= fQuickAccessAction.getShortCutString(); //$NON-NLS-1$
+//             }               
+               IMenuManager subMenu= new MenuManager(
+                       ActionMessages.getString("SourceMenu.label") + (shortCut != null ? "\t" + shortCut : ""), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+                       MENU_ID); 
+               int added= 0;
                if (isEditorOwner()) {
-                       subMenu= createEditorSubMenu(menu);
-               } else {
-       //              subMenu= createViewSubMenu(menu);
-               }
-               if (subMenu != null)
+                       added= fillEditorSubMenu(subMenu);
+               } 
+//             else {
+//                     added= fillViewSubMenu(subMenu);
+//             }
+               if (added > 0)
                        menu.appendToGroup(fGroupName, subMenu);
        }
-       
-  private IMenuManager createEditorSubMenu(IMenuManager mainMenu) {
-    IMenuManager result= new MenuManager(ActionMessages.getString("SourceMenu.label")); //$NON-NLS-1$
+  private int fillEditorSubMenu(IMenuManager source) {
+//    IMenuManager result= new MenuManager(ActionMessages.getString("SourceMenu.label")); //$NON-NLS-1$
     int added= 0;
-    added+= addEditorAction(result, "Comment"); //$NON-NLS-1$
-    added+= addEditorAction(result, "Uncomment"); //$NON-NLS-1$
-               added+= addEditorAction(result, "Format"); //$NON-NLS-1$
+    added+= addEditorAction(source, "Comment"); //$NON-NLS-1$
+    added+= addEditorAction(source, "Uncomment"); //$NON-NLS-1$
+    added+= addEditorAction(source, "ToggleComment"); //$NON-NLS-1$
+       added+= addEditorAction(source, "AddBlockComment"); //$NON-NLS-1$
+       added+= addEditorAction(source, "RemoveBlockComment"); //$NON-NLS-1$
+       added+= addEditorAction(source, "Format"); //$NON-NLS-1$
+       added+= addEditorAction(source, "Indent"); //$NON-NLS-1$
 //    result.add(new Separator());
 //    added+= addAction(result, fOrganizeImports);
 //    added+= addAction(result, fAddImport);
@@ -282,9 +310,9 @@ public class GenerateActionGroup extends ActionGroup {
 //    result.add(new Separator());             
 //    added+= addAction(result, fSurroundWithTryCatch);
 //    added+= addAction(result, fExternalizeStrings);
-    if (added == 0)
-      result= null;
-    return result;
+//    if (added == 0)
+//      result= null;
+    return added;
   }
        /* (non-Javadoc)
         * Method declared in ActionGroup