下面列出了怎么用org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds的API类实例代码及写法,或者点击链接到github查看源代码。
@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();
}
}
}
}
/**
* 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();
}
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);
}
/**
* 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);
}
/**
* 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;
}
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;
}
@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);
}
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));
}
}
@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);
}
protected void navigateLeft(XtextEditor editor) {
IAction action = editor.getAction(ITextEditorActionDefinitionIds.WORD_PREVIOUS);
action.run();
}
protected void navigateRight(XtextEditor editor) {
IAction action = editor.getAction(ITextEditorActionDefinitionIds.WORD_NEXT);
action.run();
}
protected void toLineStart(XtextEditor editor) {
IAction action = editor.getAction(ITextEditorActionDefinitionIds.LINE_START);
action.run();
}
protected void navigateLeft(XtextEditor editor) {
IAction action = editor.getAction(ITextEditorActionDefinitionIds.WORD_PREVIOUS);
action.run();
}
protected void navigateRight(XtextEditor editor) {
IAction action = editor.getAction(ITextEditorActionDefinitionIds.WORD_NEXT);
action.run();
}
protected void toLineStart(XtextEditor editor) {
IAction action = editor.getAction(ITextEditorActionDefinitionIds.LINE_START);
action.run();
}
public BasicJavaEditorActionContributor() {
super();
ResourceBundle b= JavaEditorMessages.getBundleForConstructedKeys();
fRetargetShowInformationAction= new RetargetTextEditorAction(b, "Editor.ShowInformation."); //$NON-NLS-1$
fRetargetShowInformationAction.setActionDefinitionId(ITextEditorActionDefinitionIds.SHOW_INFORMATION);
// actions that are "contributed" to editors, they are considered belonging to the active editor
fTogglePresentation= new TogglePresentationAction();
fToggleMarkOccurrencesAction= new ToggleMarkOccurrencesAction();
fGotoMatchingBracket= new RetargetTextEditorAction(b, "GotoMatchingBracket."); //$NON-NLS-1$
fGotoMatchingBracket.setActionDefinitionId(IJavaEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
fShowOutline= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "ShowOutline."); //$NON-NLS-1$
fShowOutline.setActionDefinitionId(IJavaEditorActionDefinitionIds.SHOW_OUTLINE);
fOpenHierarchy= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "OpenHierarchy."); //$NON-NLS-1$
fOpenHierarchy.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_HIERARCHY);
fOpenStructure= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "OpenStructure."); //$NON-NLS-1$
fOpenStructure.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_STRUCTURE);
fStructureSelectEnclosingAction= new RetargetTextEditorAction(b, "StructureSelectEnclosing."); //$NON-NLS-1$
fStructureSelectEnclosingAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SELECT_ENCLOSING);
fStructureSelectNextAction= new RetargetTextEditorAction(b, "StructureSelectNext."); //$NON-NLS-1$
fStructureSelectNextAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SELECT_NEXT);
fStructureSelectPreviousAction= new RetargetTextEditorAction(b, "StructureSelectPrevious."); //$NON-NLS-1$
fStructureSelectPreviousAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SELECT_PREVIOUS);
fStructureSelectHistoryAction= new RetargetTextEditorAction(b, "StructureSelectHistory."); //$NON-NLS-1$
fStructureSelectHistoryAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SELECT_LAST);
fGotoNextMemberAction= new RetargetTextEditorAction(b, "GotoNextMember."); //$NON-NLS-1$
fGotoNextMemberAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.GOTO_NEXT_MEMBER);
fGotoPreviousMemberAction= new RetargetTextEditorAction(b, "GotoPreviousMember."); //$NON-NLS-1$
fGotoPreviousMemberAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.GOTO_PREVIOUS_MEMBER);
fRemoveOccurrenceAnnotationsAction= new RetargetTextEditorAction(b, "RemoveOccurrenceAnnotations."); //$NON-NLS-1$
fRemoveOccurrenceAnnotationsAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.REMOVE_OCCURRENCE_ANNOTATIONS);
}
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 ) );
}
/**
* @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);
}
/**
* @return the key sequence that is the best match for a content assist request.
*/
public static KeySequence getContentAssistProposalBinding() {
return getCommandKeyBinding(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
}