Java Code Examples for org.eclipse.ui.texteditor.TextOperationAction#setActionDefinitionId()

The following examples show how to use org.eclipse.ui.texteditor.TextOperationAction#setActionDefinitionId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FoldingActionsGroup.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Constructs a new FoldingActionsGroup with a given text editor.
 * 
 * @param textEditor
 */
public FoldingActionsGroup(ITextEditor textEditor)
{
	// Initialize the actions.
	collapseAction = new TextOperationAction(Messages.getResourceBundle(),
			"Folding.Collapse.", textEditor, ProjectionViewer.COLLAPSE, true); //$NON-NLS-1$
	collapseAction.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE);
	textEditor.setAction(IFoldingCommandIds.FOLDING_COLLAPSE, collapseAction);

	expandAction = new TextOperationAction(Messages.getResourceBundle(),
			"Folding.Expand.", textEditor, ProjectionViewer.EXPAND, true); //$NON-NLS-1$
	expandAction.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND);
	textEditor.setAction(IFoldingCommandIds.FOLDING_EXPAND, expandAction);

	collapseAllAction = new TextOperationAction(Messages.getResourceBundle(),
			"Folding.CollapseAll.", textEditor, ProjectionViewer.COLLAPSE_ALL, true); //$NON-NLS-1$
	collapseAllAction.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE_ALL);
	textEditor.setAction(IFoldingCommandIds.FOLDING_COLLAPSE_ALL, collapseAllAction);

	expandAllAction = new TextOperationAction(Messages.getResourceBundle(),
			"Folding.ExpandAll.", textEditor, ProjectionViewer.EXPAND_ALL, true); //$NON-NLS-1$
	expandAllAction.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND_ALL);
	textEditor.setAction(IFoldingCommandIds.FOLDING_EXPAND_ALL, expandAllAction);
}
 
Example 2
Source File: FoldAllRegionsHandler.java    From tlaplus with MIT License 5 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
       final TLAEditor editor = EditorUtil.getTLAEditorWithFocus();

	if (editor != null) {
		final TextOperationAction action = new TextOperationAction(RESOURCE_BUNDLE, "Projection.CollapseAll.", editor,
				ProjectionViewer.COLLAPSE_ALL, true);

		action.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE_ALL);
		action.run();
       }

       return null;
}
 
Example 3
Source File: ExpandAllRegionsHandler.java    From tlaplus with MIT License 5 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
       final TLAEditor editor = EditorUtil.getTLAEditorWithFocus();

	if (editor != null) {
		final TextOperationAction action = new TextOperationAction(RESOURCE_BUNDLE, "Projection.ExpandAll.", editor,
				ProjectionViewer.EXPAND_ALL, true);

		action.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND_ALL);
		action.run();
       }

       return null;
}