X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/FoldingActionGroup.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/FoldingActionGroup.java index e40f478..844fe84 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/FoldingActionGroup.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/FoldingActionGroup.java @@ -11,45 +11,47 @@ package net.sourceforge.phpdt.internal.ui.actions; import org.eclipse.jface.action.IMenuManager; - import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.source.projection.IProjectionListener; import org.eclipse.jface.text.source.projection.ProjectionViewer; - import org.eclipse.ui.actions.ActionGroup; import org.eclipse.ui.editors.text.IFoldingCommandIds; import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.TextOperationAction; - /** * Groups the JDT folding actions. - * + * * @since 3.0 */ public class FoldingActionGroup extends ActionGroup { private ProjectionViewer fViewer; - + private TextOperationAction fToggle; + private TextOperationAction fExpand; + private TextOperationAction fCollapse; + private TextOperationAction fExpandAll; private IProjectionListener fProjectionListener; - + /** * Creates a new projection action group for editor. If the - * supplied viewer is not an instance of ProjectionViewer, the - * action group is disabled. + * supplied viewer is not an instance of ProjectionViewer, + * the action group is disabled. * - * @param editor the text editor to operate on - * @param viewer the viewer of the editor + * @param editor + * the text editor to operate on + * @param viewer + * the viewer of the editor */ public FoldingActionGroup(ITextEditor editor, ITextViewer viewer) { if (viewer instanceof ProjectionViewer) { - fViewer= (ProjectionViewer) viewer; - - fProjectionListener= new IProjectionListener() { + fViewer = (ProjectionViewer) viewer; + + fProjectionListener = new IProjectionListener() { public void projectionEnabled() { update(); @@ -59,32 +61,43 @@ public class FoldingActionGroup extends ActionGroup { update(); } }; - + fViewer.addProjectionListener(fProjectionListener); - - fToggle= new TextOperationAction(ActionMessages.getResourceBundle(), "Projection.Toggle.", editor, ProjectionViewer.TOGGLE, true); //$NON-NLS-1$ + + fToggle = new TextOperationAction(ActionMessages + .getResourceBundle(), + "Projection.Toggle.", editor, ProjectionViewer.TOGGLE, true); //$NON-NLS-1$ fToggle.setChecked(true); fToggle.setActionDefinitionId(IFoldingCommandIds.FOLDING_TOGGLE); editor.setAction("FoldingToggle", fToggle); //$NON-NLS-1$ - - fExpandAll= new TextOperationAction(ActionMessages.getResourceBundle(), "Projection.ExpandAll.", editor, ProjectionViewer.EXPAND_ALL, true); //$NON-NLS-1$ - fExpandAll.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND_ALL); + + fExpandAll = new TextOperationAction( + ActionMessages.getResourceBundle(), + "Projection.ExpandAll.", editor, ProjectionViewer.EXPAND_ALL, true); //$NON-NLS-1$ + fExpandAll + .setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND_ALL); editor.setAction("FoldingExpandAll", fExpandAll); //$NON-NLS-1$ - - fExpand= new TextOperationAction(ActionMessages.getResourceBundle(), "Projection.Expand.", editor, ProjectionViewer.EXPAND, true); //$NON-NLS-1$ + + fExpand = new TextOperationAction(ActionMessages + .getResourceBundle(), + "Projection.Expand.", editor, ProjectionViewer.EXPAND, true); //$NON-NLS-1$ fExpand.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND); editor.setAction("FoldingExpand", fExpand); //$NON-NLS-1$ - - fCollapse= new TextOperationAction(ActionMessages.getResourceBundle(), "Projection.Collapse.", editor, ProjectionViewer.COLLAPSE, true); //$NON-NLS-1$ - fCollapse.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE); + + fCollapse = new TextOperationAction( + ActionMessages.getResourceBundle(), + "Projection.Collapse.", editor, ProjectionViewer.COLLAPSE, true); //$NON-NLS-1$ + fCollapse + .setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE); editor.setAction("FoldingCollapse", fCollapse); //$NON-NLS-1$ } } - + /** - * Returns true if the group is enabled. + * Returns true if the group is enabled. + * *
-	 * Invariant: isEnabled() <=> fViewer and all actions are != null.
+	 *  Invariant: isEnabled() <=> fViewer and all actions are != null.
 	 * 
* * @return true if the group is enabled @@ -92,18 +105,18 @@ public class FoldingActionGroup extends ActionGroup { protected boolean isEnabled() { return fViewer != null; } - + /* * @see org.eclipse.ui.actions.ActionGroup#dispose() */ public void dispose() { if (isEnabled()) { fViewer.removeProjectionListener(fProjectionListener); - fViewer= null; + fViewer = null; } super.dispose(); } - + /** * Updates the actions. */ @@ -116,11 +129,12 @@ public class FoldingActionGroup extends ActionGroup { fCollapse.update(); } } - + /** * Fills the menu with all folding actions. * - * @param manager the menu manager for the folding submenu + * @param manager + * the menu manager for the folding submenu */ public void fillMenu(IMenuManager manager) { if (isEnabled()) { @@ -131,7 +145,7 @@ public class FoldingActionGroup extends ActionGroup { manager.add(fCollapse); } } - + /* * @see org.eclipse.ui.actions.ActionGroup#updateActionBars() */