Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
 
 package org.eclipse.ant.internal.ui.editor.actions;
 
Groups the Ant folding actions.

Since:
3.1
 
 public class FoldingActionGroup extends ActionGroup {
 	
 
Creates a new projection action group for editor. If the supplied viewer is not an instance of ProjectionViewer, the action group is disabled.

Parameters:
editor the text editor to operate on
viewer the viewer of the editor
 
 	public FoldingActionGroup(ITextEditor editorITextViewer viewer) {
 		if (viewer instanceof ProjectionViewer) {
 			= (ProjectionViewerviewer;
 			
 
 				public void projectionEnabled() {
 					update();
 				}
 
 				public void projectionDisabled() {
 					update();
 				}
 			};
 			
 			
 			new TextOperationAction(AntEditorActionMessages.getResourceBundle(), "Projection.Toggle."editor.true); //$NON-NLS-1$
 			editor.setAction("FoldingToggle"); //$NON-NLS-1$
 			
 			new TextOperationAction(AntEditorActionMessages.getResourceBundle(), "Projection.ExpandAll."editor.true); //$NON-NLS-1$
 			editor.setAction("FoldingExpandAll"); //$NON-NLS-1$
 			
 			new TextOperationAction(AntEditorActionMessages.getResourceBundle(), "Projection.Expand."editor.true); //$NON-NLS-1$
 			editor.setAction("FoldingExpand"); //$NON-NLS-1$
 			
 			new TextOperationAction(AntEditorActionMessages.getResourceBundle(), "Projection.Collapse."editor.true); //$NON-NLS-1$
 			editor.setAction("FoldingCollapse"); //$NON-NLS-1$
 		}
 	}

Returns true if the group is enabled.
 Invariant: isEnabled() <=> fViewer and all actions are != null.
 

Returns:
true if the group is enabled
 
 	private boolean isEnabled() {
 		return  != null;
 	}
 	
 	/*
 	 * @see org.eclipse.ui.actions.ActionGroup#dispose()
 	 */
 	public void dispose() {
 		if (isEnabled()) {
 			null;
		}
		super.dispose();
	}

Updates the actions.
	protected void update() {
		if (isEnabled()) {
		}
	}
	/*
	 * @see org.eclipse.ui.actions.ActionGroup#updateActionBars()
	 */
	public void updateActionBars() {
	}
New to GrepCode? Check out our FAQ X