org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds Java Examples

The following examples show how to use org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds. 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: EditorUtility.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private static void initializeHighlightRange(IEditorPart editorPart) {
	if (editorPart instanceof ITextEditor) {
		IAction toggleAction= editorPart.getEditorSite().getActionBars().getGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY);
		boolean enable= toggleAction != null;
		if (enable && editorPart instanceof JavaEditor)
			enable= JavaPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS);
		else
			enable= enable && toggleAction.isEnabled() && toggleAction.isChecked();
		if (enable) {
			if (toggleAction instanceof TextEditorAction) {
				// Reset the action
				((TextEditorAction)toggleAction).setEditor(null);
				// Restore the action
				((TextEditorAction)toggleAction).setEditor((ITextEditor)editorPart);
			} else {
				// Uncheck
				toggleAction.run();
				// Check
				toggleAction.run();
			}
		}
	}
}
 
Example #2
Source File: BasicCompilationUnitEditorActionContributor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public BasicCompilationUnitEditorActionContributor() {

		fRetargetContentAssist= new RetargetAction(JdtActionConstants.CONTENT_ASSIST,  JavaEditorMessages.ContentAssistProposal_label);
		fRetargetContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
		fRetargetContentAssist.setImageDescriptor(JavaPluginImages.DESC_ELCL_CODE_ASSIST);
		fRetargetContentAssist.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CODE_ASSIST);
		markAsPartListener(fRetargetContentAssist);

		fContentAssist= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "ContentAssistProposal."); //$NON-NLS-1$
		fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
		fContentAssist.setImageDescriptor(JavaPluginImages.DESC_ELCL_CODE_ASSIST);
		fContentAssist.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CODE_ASSIST);

		fContextInformation= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "ContentAssistContextInformation."); //$NON-NLS-1$
		fContextInformation.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);

		fQuickAssistAction= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "CorrectionAssistProposal."); //$NON-NLS-1$
		fQuickAssistAction.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST);

		fChangeEncodingAction= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "Editor.ChangeEncodingAction."); //$NON-NLS-1$
	}
 
Example #3
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 #4
Source File: TextViewerMoveLinesAction.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates and initializes the action for the given text viewer. The action configures its
 * visual representation from the given resource bundle.
 *
 * @param bundle the resource bundle
 * @param prefix a prefix to be prepended to the various resource keys (described in
 *            <code>ResourceAction</code> constructor), or <code>null</code> if none
 * @param viewer the text viewer
 * @param upwards <code>true</code>if the selected lines should be moved upwards,
 *            <code>false</code> if downwards
 * @param copy if <code>true</code>, the action will copy lines instead of moving them
 * @see TextViewerAction#TextViewerAction(ResourceBundle, String, ITextViewer)
 * @since 3.5
 */
public TextViewerMoveLinesAction(ResourceBundle bundle, String prefix, ITextViewer viewer, boolean upwards, boolean copy) {
	super(bundle, prefix, viewer);
	fUpwards= upwards;
	fCopy= copy;
	String[] commandIds= copy ? new String[] {ITextEditorActionDefinitionIds.COPY_LINES_UP, ITextEditorActionDefinitionIds.COPY_LINES_DOWN } : new String[] {ITextEditorActionDefinitionIds.MOVE_LINES_UP, ITextEditorActionDefinitionIds.MOVE_LINES_DOWN };
	fStrategy= new CompoundEditExitStrategy(commandIds);
	fStrategy.addCompoundListener(new ICompoundEditListener() {
		@Override
		public void endCompoundEdit() {
			TextViewerMoveLinesAction.this.endCompoundEdit();
		}
	});
	update();
}
 
Example #5
Source File: LangEditorActionContributor.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected void prepareEditMenu(IMenuManager menu) {
	IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
	if(editMenu != null) {
		editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, pushItem(
			ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, 
			ITextEditorActionConstants.CONTENT_ASSIST));
		
		editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, pushItem(
			ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION, 
			ITextEditorActionConstants.CONTENT_ASSIST_CONTEXT_INFORMATION));
	}
	
}
 
Example #6
Source File: LangEditorContextMenuContributor.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected void contributeSourceMenu(IMenuManager sourceMenu) {
	sourceMenu.appendToGroup(SOURCE_MENU_GroupComment, 
		pushItem(svcLocator, EditorCommandIds.ToggleComment));
	
	sourceMenu.appendToGroup(SOURCE_MENU_GroupFormat, 
		pushItem(svcLocator, ITextEditorActionDefinitionIds.SHIFT_RIGHT));
	sourceMenu.appendToGroup(SOURCE_MENU_GroupFormat, 
		pushItem(svcLocator, ITextEditorActionDefinitionIds.SHIFT_LEFT));
	
	sourceMenu.appendToGroup(SOURCE_MENU_GroupFormat, 
		pushItem(svcLocator, EditorCommandIds.Format));
}
 
Example #7
Source File: LangContentAssistProcessor.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected KeySequence getGroupingIterationBinding() {
IBindingService bindingSvc = (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
TriggerSequence binding = bindingSvc.getBestActiveBindingFor(
	ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
if(binding instanceof KeySequence)
	return (KeySequence) binding;
return null;
  }
 
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: 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 #10
Source File: ContentAssistProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private KeySequence getIterationBinding() {
   final IBindingService bindingSvc= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
TriggerSequence binding= bindingSvc.getBestActiveBindingFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
if (binding instanceof KeySequence)
	return (KeySequence) binding;
return null;
  }
 
Example #11
Source File: BasicJavaEditorActionContributor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(IActionBars bars, IWorkbenchPage page) {
	fToggleBreadcrumbAction= new ToggleBreadcrumbAction(page);
	Iterator<RetargetAction> e= fPartListeners.iterator();
	while (e.hasNext())
		page.addPartListener(e.next());

	super.init(bars, page);

	bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY, fTogglePresentation);
	bars.setGlobalActionHandler(IJavaEditorActionDefinitionIds.TOGGLE_MARK_OCCURRENCES, fToggleMarkOccurrencesAction);
	bars.setGlobalActionHandler(IJavaEditorActionDefinitionIds.TOGGLE_BREADCRUMB, fToggleBreadcrumbAction);
}
 
Example #12
Source File: CompilationUnitEditorActionContributor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public CompilationUnitEditorActionContributor() {
	super();

	ResourceBundle b= JavaEditorMessages.getBundleForConstructedKeys();

	fToggleInsertModeAction= new RetargetTextEditorAction(b, "CompilationUnitEditorActionContributor.ToggleInsertMode.", IAction.AS_CHECK_BOX); //$NON-NLS-1$
	fToggleInsertModeAction.setActionDefinitionId(ITextEditorActionDefinitionIds.TOGGLE_INSERT_MODE);
}
 
Example #13
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 #14
Source File: TimeGraphFindDialog.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates the panel where the user specifies the text to search for
 *
 * @param parent
 *            the parent composite
 * @return the input panel
 */
private Composite createInputPanel(Composite parent) {
    Composite panel = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    panel.setLayout(layout);

    Label findLabel = new Label(panel, SWT.LEFT);
    findLabel.setText(Messages.TimeGraphFindDialog_FindLabel);
    setGridData(findLabel, SWT.LEFT, false, SWT.CENTER, false);

    // Create the find content assist field
    ComboContentAdapter contentAdapter = new ComboContentAdapter();
    FindReplaceDocumentAdapterContentProposalProvider findProposer = new FindReplaceDocumentAdapterContentProposalProvider(true);
    fFindField = new Combo(panel, SWT.DROP_DOWN | SWT.BORDER);
    fContentAssistFindField = new ContentAssistCommandAdapter(
            fFindField,
            contentAdapter,
            findProposer,
            ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS,
            new char[0],
            true);
    setGridData(fFindField, SWT.FILL, true, SWT.CENTER, false);
    fFindField.addModifyListener(fFindModifyListener);

    return panel;
}
 
Example #15
Source File: TLAMultiPageEditorActionBarContributor.java    From tlaplus with MIT License 5 votes vote down vote up
public TLAMultiPageEditorActionBarContributor()
{
    super();
    fContentAssistProposal = new RetargetTextEditorAction(TLAEditorMessages.getResourceBundle(),
            "ContentAssistProposal."); //$NON-NLS-1$
    fContentAssistProposal.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    fContentAssistTip = new RetargetTextEditorAction(TLAEditorMessages.getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$
    fContentAssistTip.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);

    // status field for the line and column of the cursor
    cursorPositionStatusField = new StatusLineContributionItem(
            ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION);
}
 
Example #16
Source File: TLAEditorActionContributor.java    From tlaplus with MIT License 5 votes vote down vote up
/**
 * Default constructor.
 */
public TLAEditorActionContributor()
{
    super();
    fContentAssistProposal = new RetargetTextEditorAction(TLAEditorMessages.getResourceBundle(),
            "ContentAssistProposal."); //$NON-NLS-1$
    fContentAssistProposal.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    fContentAssistTip = new RetargetTextEditorAction(TLAEditorMessages.getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$
    fContentAssistTip.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
}
 
Example #17
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 #18
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 #19
Source File: JavaMoveLinesAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public SharedState(CompilationUnitEditor editor) {
	fEditor= editor;
	fExitStrategy= new CompoundEditExitStrategy(new String[] {ITextEditorActionDefinitionIds.MOVE_LINES_UP, ITextEditorActionDefinitionIds.MOVE_LINES_DOWN, ITextEditorActionDefinitionIds.COPY_LINES_UP, ITextEditorActionDefinitionIds.COPY_LINES_DOWN});
	fExitStrategy.addCompoundListener(new ICompoundEditListener() {
		public void endCompoundEdit() {
			SharedState.this.endCompoundEdit();
		}
	});
}
 
Example #20
Source File: AnnotationEditor.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
/**
 * Creates custom annotation actions:
 * 
 * Annotate Action
 * Smart Annotate Action
 * Delete Annotations Action
 * Find Annotate Action.
 */
@Override
protected void createActions() {

  super.createActions();

  mFeatureStructureSelectionProvider = new FeatureStructureSelectionProvider();
  getSite().setSelectionProvider(mFeatureStructureSelectionProvider);

  // create annotate action
  QuickAnnotateAction quickAnnotateAction = new QuickAnnotateAction(getSourceViewer().getTextWidget());
  quickAnnotateAction.setActionDefinitionId(QuickAnnotateAction.ID);
  quickAnnotateAction.setText("Quick Annotate");
  setAction(QuickAnnotateAction.ID, quickAnnotateAction);
  getSite().getSelectionProvider().addSelectionChangedListener(quickAnnotateAction);
  
  SmartAnnotateAction smartAnnotateAction = new SmartAnnotateAction();
  smartAnnotateAction.setActionDefinitionId(SmartAnnotateAction.ID);
  smartAnnotateAction.setText("Annotate");
  setAction(SmartAnnotateAction.ID, smartAnnotateAction);
  getSite().getSelectionProvider().addSelectionChangedListener(smartAnnotateAction);

  // create delete action
  DeleteFeatureStructureAction deleteAnnotationAction = new DeleteFeatureStructureAction(
          this);
  deleteAnnotationAction.setText("Delete Annotation");
  getSite().getSelectionProvider().addSelectionChangedListener(deleteAnnotationAction);

  deleteAnnotationAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE);

  setAction(IWorkbenchActionDefinitionIds.DELETE, deleteAnnotationAction);
  setActionActivationCode(IWorkbenchActionDefinitionIds.DELETE, (char) 0, SWT.CR, SWT.NONE);

  // create show annotation context editing action
  ShowAnnotationContextEditAction annotationContextEditAction =
          new ShowAnnotationContextEditAction();

  annotationContextEditAction.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST);
  setAction(ITextEditorActionDefinitionIds.QUICK_ASSIST, annotationContextEditAction);

  // Create find annotate action
  FindAnnotateAction findAnnotateAction = new FindAnnotateAction(this, getSourceViewer().getFindReplaceTarget());
  findAnnotateAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_REPLACE);
  setAction(ITextEditorActionConstants.FIND, findAnnotateAction);
  
  // Lower left side of annotation action
  LowerLeftAnnotationSideAction lowerLeftAnnotationSideAction = new LowerLeftAnnotationSideAction(this);
  lowerLeftAnnotationSideAction.setActionDefinitionId(LowerLeftAnnotationSideAction.ID);
  setAction(LowerLeftAnnotationSideAction.ID, lowerLeftAnnotationSideAction);
  getSite().getSelectionProvider().addSelectionChangedListener(lowerLeftAnnotationSideAction);
  
  // Wide left side of annotation action
  WideLeftAnnotationSideAction wideLeftAnnotationSide = new WideLeftAnnotationSideAction(this);
  wideLeftAnnotationSide.setActionDefinitionId(WideLeftAnnotationSideAction.ID);
  setAction(WideLeftAnnotationSideAction.ID, wideLeftAnnotationSide);
  getSite().getSelectionProvider().addSelectionChangedListener(wideLeftAnnotationSide);
  
  // Lower right side of annotation
  LowerRightAnnotationSideAction lowerRightAnnotationSideAction = new LowerRightAnnotationSideAction(this);
  lowerRightAnnotationSideAction.setActionDefinitionId(LowerRightAnnotationSideAction.ID);
  setAction(LowerRightAnnotationSideAction.ID, lowerRightAnnotationSideAction);
  getSite().getSelectionProvider().addSelectionChangedListener(lowerRightAnnotationSideAction);
  
  // Wide right side of annotation
  WideRightAnnotationSideAction wideRightAnnotationSideAction = new WideRightAnnotationSideAction(this);
  wideRightAnnotationSideAction.setActionDefinitionId(WideRightAnnotationSideAction.ID);
  setAction(WideRightAnnotationSideAction.ID, wideRightAnnotationSideAction);
  getSite().getSelectionProvider().addSelectionChangedListener(wideRightAnnotationSideAction);
}
 
Example #21
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 #22
Source File: AbstractCursorHandlingTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected void navigateLeft(XtextEditor editor) {
	IAction action = editor.getAction(ITextEditorActionDefinitionIds.WORD_PREVIOUS);
	action.run();
}
 
Example #23
Source File: AbstractCursorHandlingTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected void navigateRight(XtextEditor editor) {
	IAction action = editor.getAction(ITextEditorActionDefinitionIds.WORD_NEXT);
	action.run();
}
 
Example #24
Source File: KeyBindingHelper.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @return the key sequence that is the best match for a quick assist request.
 */
public static KeySequence getQuickAssistProposalBinding() {
    return getCommandKeyBinding(ITextEditorActionDefinitionIds.QUICK_ASSIST);
}
 
Example #25
Source File: KeyBindingHelper.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @return true if the given event matches a quick assistant keystroke (and false otherwise).
 */
public static boolean matchesQuickAssistKeybinding(KeyEvent event) {
    return matchesKeybinding(event, ITextEditorActionDefinitionIds.QUICK_ASSIST);
}
 
Example #26
Source File: KeyBindingHelper.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @return the key sequence that is the best match for a content assist request.
 */
public static KeySequence getContentAssistProposalBinding() {
    return getCommandKeyBinding(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
}
 
Example #27
Source File: KeyBindingHelper.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @return true if the given event matches a content assistant keystroke (and false otherwise).
 */
public static boolean matchesContentAssistKeybinding(KeyEvent event) {
    return matchesKeybinding(event, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
}
 
Example #28
Source File: AbstractCursorHandlingTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected void toLineStart(XtextEditor editor) {
	IAction action = editor.getAction(ITextEditorActionDefinitionIds.LINE_START);
	action.run();
}
 
Example #29
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 ) );
}
 
Example #30
Source File: AbstractCursorHandlingTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected void navigateLeft(XtextEditor editor) {
	IAction action = editor.getAction(ITextEditorActionDefinitionIds.WORD_PREVIOUS);
	action.run();
}