org.eclipse.ui.texteditor.TextOperationAction Java Examples

The following examples show how to use org.eclipse.ui.texteditor.TextOperationAction. 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: AbstractThemeableEditor.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void createActions()
{
	super.createActions();
	setAction(FilterThroughCommandAction.COMMAND_ID, FilterThroughCommandAction.create(this));
	this.fThemeableEditorFindBarExtension.createFindBarActions();

	// Code formatter setup
	Action action = new TextOperationAction(Messages.getBundleForConstructedKeys(),
			"Format.", this, ISourceViewer.FORMAT); //$NON-NLS-1$
	action.setActionDefinitionId(ICommonConstants.FORMATTER_ACTION_DEFINITION_ID);
	setAction(ICommonConstants.FORMATTER_ACTION_ID, action);
	markAsStateDependentAction(ICommonConstants.FORMATTER_ACTION_ID, true);
	markAsSelectionDependentAction(ICommonConstants.FORMATTER_ACTION_ID, true);

	// Folding setup
	foldingActionsGroup = new FoldingActionsGroup(this);
}
 
Example #3
Source File: BibEditor.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
protected void createActions() {
    super.createActions();
    IAction a = new TextOperationAction(TexlipsePlugin.getDefault().getResourceBundle(),
    		"ContentAssistProposal.", this, ISourceViewer.CONTENTASSIST_PROPOSALS);
    
    a.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    setAction("ContentAssistProposal", a);
    
    //This feature was removed because it causes errors
    //getDocumentProvider().getDocument(this.getEditorInput()).addDocumentListener(new BibStringCompleter(this));
}
 
Example #4
Source File: TexEditor.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
/** 
 * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
 */
protected void createActions() {
    super.createActions();
    
    IAction a = new TextOperationAction(TexlipsePlugin.getDefault().getResourceBundle(), "ContentAssistProposal.", this, ISourceViewer.CONTENTASSIST_PROPOSALS);
    a.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    setAction("ContentAssistProposal", a);
}
 
Example #5
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 #6
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;
}
 
Example #7
Source File: ScriptEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void createActions( )
{
	super.createActions( );

	IAction contentAssistAction = new TextOperationAction( Messages.getReportResourceBundle( ),
			"ContentAssistProposal_", this, ISourceViewer.CONTENTASSIST_PROPOSALS, true );//$NON-NLS-1$

	contentAssistAction.setActionDefinitionId( ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS );
	setAction( "ContentAssistProposal", contentAssistAction );//$NON-NLS-1$
	setAction( ITextEditorActionConstants.SAVE, new TextSaveAction( this ) );
}
 
Example #8
Source File: FoldingActionGroup.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.8
 */
protected TextEditorAction createToggleFoldingAction(ITextEditor editor) {
	return new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.Toggle.", editor,
			ProjectionViewer.TOGGLE, true);
}
 
Example #9
Source File: DecoratedScriptEditor.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected void createActions( )
{
	super.createActions( );

	IAction contentAssistAction = new TextOperationAction( Messages.getReportResourceBundle( ),
			"ContentAssistProposal_", this, ISourceViewer.CONTENTASSIST_PROPOSALS, true );//$NON-NLS-1$

	IAction expandAll = new TextOperationAction( Messages.getReportResourceBundle( ),
			"JSEditor.Folding.ExpandAll.", this, ProjectionViewer.EXPAND_ALL, true ); //$NON-NLS-1$

	IAction collapseAll = new TextOperationAction( Messages.getReportResourceBundle( ),
			"JSEditor.Folding.CollapseAll.", this, ProjectionViewer.COLLAPSE_ALL, true ); //$NON-NLS-1$

	IAction collapseComments = new ResourceAction( Messages.getReportResourceBundle( ),
			"JSEditor.Folding.CollapseComments." ) { //$NON-NLS-1$

		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.jface.action.Action#run()
		 */
		public void run( )
		{
			collapseStyle( ScriptProjectionAnnotation.SCRIPT_COMMENT );
		}
	};

	IAction collapseMethods = new ResourceAction( Messages.getReportResourceBundle( ),
			"JSEditor.Folding.CollapseMethods." ) { //$NON-NLS-1$

		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.jface.action.Action#run()
		 */
		public void run( )
		{
			collapseStyle( ScriptProjectionAnnotation.SCRIPT_METHOD );
		}
	};

	contentAssistAction.setActionDefinitionId( ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS );
	expandAll.setActionDefinitionId( IFoldingCommandIds.FOLDING_EXPAND_ALL );
	collapseAll.setActionDefinitionId( IFoldingCommandIds.FOLDING_COLLAPSE_ALL );

	setAction( "ContentAssistProposal", contentAssistAction );//$NON-NLS-1$
	setAction( "FoldingExpandAll", expandAll ); //$NON-NLS-1$
	setAction( "FoldingCollapseAll", collapseAll ); //$NON-NLS-1$
	setAction( "FoldingCollapseComments", collapseComments ); //$NON-NLS-1$
	setAction( "FoldingCollapseMethods", collapseMethods ); //$NON-NLS-1$
	setAction( ITextEditorActionConstants.SAVE, new TextSaveAction( this ) );
}