Java Code Examples for org.eclipse.jface.action.IAction#setActionDefinitionId()

The following examples show how to use org.eclipse.jface.action.IAction#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: CompilationUnitEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void createNavigationActions() {
	super.createNavigationActions();

	final StyledText textWidget= getSourceViewer().getTextWidget();

	IAction action= new DeletePreviousSubWordAction();
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD);
	setAction(ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD, action);
	textWidget.setKeyBinding(SWT.CTRL | SWT.BS, SWT.NULL);
	markAsStateDependentAction(ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD, true);

	action= new DeleteNextSubWordAction();
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_NEXT_WORD);
	setAction(ITextEditorActionDefinitionIds.DELETE_NEXT_WORD, action);
	textWidget.setKeyBinding(SWT.CTRL | SWT.DEL, SWT.NULL);
	markAsStateDependentAction(ITextEditorActionDefinitionIds.DELETE_NEXT_WORD, true);
}
 
Example 2
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 3
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 4
Source File: JSSourceEditor.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createActions()
{
	super.createActions();
	IAction action = new OpenDeclarationAction(Messages.getResourceBundle(), this);
	action.setActionDefinitionId(IJSActions.OPEN_DECLARATION);
	setAction(IJSActions.OPEN_DECLARATION, action);
}
 
Example 5
Source File: PropertiesFileEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void createActions() {
	super.createActions();

	IAction action= new ToggleCommentAction(PropertiesFileEditorMessages.getBundleForConstructedKeys(), "ToggleComment.", this); //$NON-NLS-1$
	action.setActionDefinitionId(IJavaEditorActionDefinitionIds.TOGGLE_COMMENT);
	setAction(IJavaEditorActionDefinitionIds.TOGGLE_COMMENT, action);
	markAsStateDependentAction(IJavaEditorActionDefinitionIds.TOGGLE_COMMENT, true);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(action, IJavaHelpContextIds.TOGGLE_COMMENT_ACTION);
	configureToggleCommentAction();

	fOpenAction= new OpenAction(this);
	fOpenAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
	setAction(JdtActionConstants.OPEN, fOpenAction);
}
 
Example 6
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void createNavigationActions() {
	super.createNavigationActions();

	final StyledText textWidget= getSourceViewer().getTextWidget();

	IAction action= new SmartLineStartAction(textWidget, false);
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.LINE_START);
	setAction(ITextEditorActionDefinitionIds.LINE_START, action);

	action= new SmartLineStartAction(textWidget, true);
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_LINE_START);
	setAction(ITextEditorActionDefinitionIds.SELECT_LINE_START, action);

	action= new NavigatePreviousSubWordAction();
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.WORD_PREVIOUS);
	setAction(ITextEditorActionDefinitionIds.WORD_PREVIOUS, action);
	textWidget.setKeyBinding(SWT.CTRL | SWT.ARROW_LEFT, SWT.NULL);

	action= new NavigateNextSubWordAction();
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.WORD_NEXT);
	setAction(ITextEditorActionDefinitionIds.WORD_NEXT, action);
	textWidget.setKeyBinding(SWT.CTRL | SWT.ARROW_RIGHT, SWT.NULL);

	action= new SelectPreviousSubWordAction();
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_WORD_PREVIOUS);
	setAction(ITextEditorActionDefinitionIds.SELECT_WORD_PREVIOUS, action);
	textWidget.setKeyBinding(SWT.CTRL | SWT.SHIFT | SWT.ARROW_LEFT, SWT.NULL);

	action= new SelectNextSubWordAction();
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_WORD_NEXT);
	setAction(ITextEditorActionDefinitionIds.SELECT_WORD_NEXT, action);
	textWidget.setKeyBinding(SWT.CTRL | SWT.SHIFT | SWT.ARROW_RIGHT, SWT.NULL);
}
 
Example 7
Source File: SourceEditor.java    From textuml with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void createActions() {
    super.createActions();

    IAction contentAssistAction = new ContentAssistAction(Messages.RESOURCE_BUNDLE, "ContentAssistProposal.", this);
    contentAssistAction.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    setAction("ContentAssistProposal", contentAssistAction);
    markAsStateDependentAction("ContentAssistProposal", true);
}
 
Example 8
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 9
Source File: XtextEditor.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected void createNavigationActions() {
	super.createNavigationActions();

	final StyledText textWidget = getSourceViewer().getTextWidget();

	IAction action = createSmartLineStartAction(textWidget, false);
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.LINE_START);
	setAction(ITextEditorActionDefinitionIds.LINE_START, action);

	action = createSmartLineStartAction(textWidget, true);
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_LINE_START);
	setAction(ITextEditorActionDefinitionIds.SELECT_LINE_START, action);

	action = createNavigatePreviousSubWordAction();
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.WORD_PREVIOUS);
	setAction(ITextEditorActionDefinitionIds.WORD_PREVIOUS, action);
	textWidget.setKeyBinding(SWT.CTRL | SWT.ARROW_LEFT, SWT.NULL);

	action = createNavigateNextSubWordAction();
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.WORD_NEXT);
	setAction(ITextEditorActionDefinitionIds.WORD_NEXT, action);
	textWidget.setKeyBinding(SWT.CTRL | SWT.ARROW_RIGHT, SWT.NULL);

	action = createSelectPreviousSubWordAction();
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_WORD_PREVIOUS);
	setAction(ITextEditorActionDefinitionIds.SELECT_WORD_PREVIOUS, action);
	textWidget.setKeyBinding(SWT.CTRL | SWT.SHIFT | SWT.ARROW_LEFT, SWT.NULL);

	action = createSelectNextSubWordAction();
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_WORD_NEXT);
	setAction(ITextEditorActionDefinitionIds.SELECT_WORD_NEXT, action);
	textWidget.setKeyBinding(SWT.CTRL | SWT.SHIFT | SWT.ARROW_RIGHT, SWT.NULL);

	action = createDeletePreviousSubWordAction();
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD);
	setAction(ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD, action);
	textWidget.setKeyBinding(SWT.CTRL | SWT.BS, SWT.NULL);
	markAsStateDependentAction(ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD, true);

	action = createDeleteNextSubWordAction();
	action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_NEXT_WORD);
	setAction(ITextEditorActionDefinitionIds.DELETE_NEXT_WORD, action);
	textWidget.setKeyBinding(SWT.CTRL | SWT.DEL, SWT.NULL);
	markAsStateDependentAction(ITextEditorActionDefinitionIds.DELETE_NEXT_WORD, true);
}
 
Example 10
Source File: AstSelectionProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected void setAction(XtextEditor xtextEditor, IAction action, String actionDefinitionId) {
	action.setActionDefinitionId(actionDefinitionId);
	xtextEditor.setAction(actionDefinitionId, action);
}
 
Example 11
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @deprecated As of 3.5, got replaced by generic Navigate > Show In >
 */
private void createDeprecatedShowInPackageExplorerAction() {
	IAction action= new org.eclipse.jdt.ui.actions.ShowInPackageViewAction(this);
	action.setActionDefinitionId(IJavaEditorActionDefinitionIds.SHOW_IN_PACKAGE_VIEW);
	setAction("ShowInPackageView", action); //$NON-NLS-1$
}
 
Example 12
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 ) );
}