private ActionHandler createContentAssistActionHandler( final ITextOperationTarget textOperationTarget) { Action proposalAction = new Action() { @Override public void run() { if (textOperationTarget .canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS) && getTextWidget().isFocusControl()) textOperationTarget .doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); } }; proposalAction .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); return new ActionHandler(proposalAction); }
/** * Default constructor. */ public NCLActionContributor() { super(); fContentAssistProposal = new RetargetTextEditorAction(NCLEditorMessages .getInstance().getResourceBundle(), "ContentAssistProposal."); //$NON-NLS-1$ fContentAssistProposal .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); fContentFormat = new RetargetTextEditorAction(NCLEditorMessages .getInstance().getResourceBundle(), "ContentFormat."); fContentFormat.setActionDefinitionId(NCLEditor.FORMAT_ACTION); fContentGotoLastEditPosition = new RetargetTextEditorAction( NCLEditorMessages.getInstance().getResourceBundle(), "GotoLastEditPositio"); fContentGotoLastEditPosition .setActionDefinitionId(ITextEditorActionDefinitionIds.GOTO_LAST_EDIT_POSITION); //fContentAssistTip= new RetargetTextEditorAction(NCLEditorMessages.getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$ // fContentAssistTip.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION); // fTogglePresentation= new PresentationAction(); }
protected void createActions() { super.createActions(); // Add content assist propsal action ContentAssistAction action = new ContentAssistAction(Plugin .getDefault().getResourceBundle(), "VelocityEditor.ContentAssist", this); action .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); setAction("Velocity.ContentAssist", action); action.setEnabled(true); // add toggle comment action ToggleCommentAction toggleCommentAction = new ToggleCommentAction(Plugin .getDefault().getResourceBundle(), "VelocityEditor.ToggleComment", this); toggleCommentAction.configure(getSourceViewer(), getSourceViewerConfiguration()); setAction("Velocity.ToggleComment", toggleCommentAction ); toggleCommentAction.setEnabled(true); }
@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); }
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$ }
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(); } } } }
private void createDefaultLabel(Composite composite, int h_span) { final ICommandService commandSvc= (ICommandService) PlatformUI.getWorkbench().getAdapter(ICommandService.class); final Command command= commandSvc.getCommand(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); ParameterizedCommand pCmd= new ParameterizedCommand(command, null); String key= getKeyboardShortcut(pCmd); if (key == null) key= PreferencesMessages.CodeAssistAdvancedConfigurationBlock_no_shortcut; PixelConverter pixelConverter= new PixelConverter(composite); int width= pixelConverter.convertWidthInCharsToPixels(40); Label label= new Label(composite, SWT.NONE | SWT.WRAP); label.setText(Messages.format(PreferencesMessages.CodeAssistAdvancedConfigurationBlock_page_description, new Object[] { key })); GridData gd= new GridData(GridData.FILL, GridData.FILL, true, false, h_span, 1); gd.widthHint= width; label.setLayoutData(gd); createFiller(composite, h_span); label= new Label(composite, SWT.NONE | SWT.WRAP); label.setText(PreferencesMessages.CodeAssistAdvancedConfigurationBlock_default_table_description); gd= new GridData(GridData.FILL, GridData.FILL, true, false, h_span, 1); gd.widthHint= width; label.setLayoutData(gd); }
@Override protected void createActions() { super.createActions(); ResourceBundle bundle = ResourceBundle.getBundle(Messages.getBundleName()); ContentAssistAction action = new ContentAssistAction(bundle, "contentAssist.", this); //$NON-NLS-1$ action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); setAction(CONTENT_ASSIST, action); }
@Override protected void createActions() { super.createActions(); /* Configure l'autocomplétion. */ ContentAssistAction action = new ContentAssistAction(new ContentAssistBundle(), "ContentAssistProposal.", this); action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); setAction("ContentAssist", action); }
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)); }
/** * @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); }
private ActionHandler createQuickFixActionHandler( final ITextOperationTarget textOperationTarget) { Action quickFixAction = new Action() { @Override public void run() { textOperationTarget.doOperation(ISourceViewer.QUICK_ASSIST); } }; quickFixAction .setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST); return new ActionHandler(quickFixAction); }
/** * 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); }
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); }
@Execute public void execute() { TextViewerOperationAction action = null; Bundle bundle = FrameworkUtil.getBundle(getClass()); BundleContext bundleContext = bundle.getBundleContext(); IEclipseContext context = EclipseContextFactory.getServiceContext(bundleContext); action = (TextViewerOperationAction) context.get(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); // TextViewerOperationAction action = new TextViewerOperationAction(bundle, prefix, viewer, operationCode); action.run(); }
@Override protected void createActions() { super.createActions(); IAction action = new ContentAssistAction(new UmpResourceBoundle(), "ContentAssistProposal.", this); String id = ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS; action.setActionDefinitionId(id); setAction("ContentAssistProposal", action); markAsStateDependentAction("ContentAssistProposal", true); }
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(); } }); }
@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); }
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); }
@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); }
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; }
/** * Default constructor. */ public ApexActionContributor() { super(); fContentAssistProposal = new RetargetTextEditorAction(EditorMessages.getResourceBundle(), "ApexEditor.ContentAssistProposal."); fContentAssistProposal.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); fContentAssistTip = new RetargetTextEditorAction(EditorMessages.getResourceBundle(), "ApexEditor.ContentAssistTip."); fContentAssistTip.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION); fTogglePresentation = new PresentationAction(); }
@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); }
@Override protected void createActions() { super.createActions(); ResourceBundle resourceBundle = ResourceBundle.getBundle("ynn.eclipse.mylogo.ui.res.contentAssist"); Action action = new ContentAssistAction(resourceBundle, "ContentAssistProposal.", this); String id = ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS; action.setActionDefinitionId(id); setAction("ContentAssistProposal", action); markAsStateDependentAction("ContentAssistProposal", true); }
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 ) ); }
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; }
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)); }
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)); } }
public SQLEditorActionContributor() { fContentAssist= new RetargetTextEditorAction( ResourceBundle.getBundle(Messages.getBundleName()), "contentAssist."); //$NON-NLS-1$ fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); }
@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); }
void threeFingerSwipeUp() { OperationRunner.run(validator, commandRunner, ITextEditorActionDefinitionIds.TEXT_START); }