Search in sources :

Example 1 with AddBlockCommentHandler

use of org.eclipse.wst.sse.ui.internal.handlers.AddBlockCommentHandler in project webtools.sourceediting by eclipse.

the class StructuredTextEditor method createActions.

protected void createActions() {
    super.createActions();
    ResourceBundle resourceBundle = SSEUIMessages.getResourceBundle();
    IWorkbenchHelpSystem helpSystem = SSEUIPlugin.getDefault().getWorkbench().getHelpSystem();
    // TextView Action - moving the selected text to
    // the clipboard
    // override the cut/paste/delete action to make
    // them run on read-only
    // files
    // $NON-NLS-1$
    Action action = new TextOperationAction(resourceBundle, "Editor_Cut_", this, ITextOperationTarget.CUT);
    action.setActionDefinitionId(IWorkbenchActionDefinitionIds.CUT);
    setAction(ITextEditorActionConstants.CUT, action);
    helpSystem.setHelp(action, IAbstractTextEditorHelpContextIds.CUT_ACTION);
    // TextView Action - inserting the clipboard
    // content at the current
    // position
    // override the cut/paste/delete action to make
    // them run on read-only
    // files
    // $NON-NLS-1$
    action = new TextOperationAction(resourceBundle, "Editor_Paste_", this, ITextOperationTarget.PASTE);
    action.setActionDefinitionId(IWorkbenchActionDefinitionIds.PASTE);
    setAction(ITextEditorActionConstants.PASTE, action);
    helpSystem.setHelp(action, IAbstractTextEditorHelpContextIds.PASTE_ACTION);
    // TextView Action - deleting the selected text or
    // if selection is
    // empty the character at the right of the current
    // position
    // override the cut/paste/delete action to make
    // them run on read-only
    // files
    // $NON-NLS-1$
    action = new TextOperationAction(resourceBundle, "Editor_Delete_", this, ITextOperationTarget.DELETE);
    action.setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE);
    setAction(ITextEditorActionConstants.DELETE, action);
    helpSystem.setHelp(action, IAbstractTextEditorHelpContextIds.DELETE_ACTION);
    // SourceView Action - requesting content assist to
    // show completetion
    // proposals for the current insert position
    action = new ContentAssistAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_PROPOSALS + UNDERSCORE, this);
    helpSystem.setHelp(action, IHelpContextIds.CONTMNU_CONTENTASSIST_HELPID);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    setAction(StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_PROPOSALS, action);
    markAsStateDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_PROPOSALS, true);
    // SourceView Action - requesting content assist to
    // show the content
    // information for the current insert position
    action = new TextOperationAction(SSEUIMessages.getResourceBundle(), StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_CONTEXT_INFORMATION + UNDERSCORE, this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
    setAction(StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_CONTEXT_INFORMATION, action);
    markAsStateDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_CONTEXT_INFORMATION, true);
    // StructuredTextViewer Action - requesting format
    // of the whole
    // document
    action = new TextOperationAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT + UNDERSCORE, this, StructuredTextViewer.FORMAT_DOCUMENT);
    helpSystem.setHelp(action, IHelpContextIds.CONTMNU_FORMAT_DOC_HELPID);
    action.setActionDefinitionId(ActionDefinitionIds.FORMAT_DOCUMENT);
    setAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT, action);
    markAsStateDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT, true);
    markAsSelectionDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT, true);
    // StructuredTextViewer Action - requesting format
    // of the active
    // elements
    action = new TextOperationAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS + UNDERSCORE, this, StructuredTextViewer.FORMAT_ACTIVE_ELEMENTS);
    helpSystem.setHelp(action, IHelpContextIds.CONTMNU_FORMAT_ELEMENTS_HELPID);
    action.setActionDefinitionId(ActionDefinitionIds.FORMAT_ACTIVE_ELEMENTS);
    setAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS, action);
    markAsStateDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS, true);
    markAsSelectionDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS, true);
    // StructuredTextEditor Action - add breakpoints (falling back to the
    // current double-click if they can't be added)
    action = new ToggleBreakpointAction(this, getVerticalRuler());
    setAction(ActionDefinitionIds.TOGGLE_BREAKPOINTS, action);
    // StructuredTextEditor Action - manage breakpoints
    action = new ManageBreakpointAction(this, getVerticalRuler());
    setAction(ActionDefinitionIds.MANAGE_BREAKPOINTS, action);
    // StructuredTextEditor Action - edit breakpoints
    action = new EditBreakpointAction(this, getVerticalRuler());
    setAction(ActionDefinitionIds.EDIT_BREAKPOINTS, action);
    // StructuredTextViewer Action - open file on selection
    action = new OpenHyperlinkAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_OPEN_FILE + UNDERSCORE, this, getSourceViewer());
    action.setActionDefinitionId(ActionDefinitionIds.OPEN_FILE);
    setAction(StructuredTextEditorActionConstants.ACTION_NAME_OPEN_FILE, action);
    computeAndSetDoubleClickAction();
    // add handlers to handler service
    IHandlerService handlerService = getSite().getService(IHandlerService.class);
    if (handlerService != null) {
        IHandler gotoHandler = new GotoMatchingBracketHandler();
        handlerService.activateHandler(ActionDefinitionIds.GOTO_MATCHING_BRACKET, gotoHandler);
        fOutlineHandler = new QuickOutlineHandler();
        handlerService.activateHandler(ActionDefinitionIds.SHOW_OUTLINE, fOutlineHandler);
        IHandler toggleCommentHandler = new ToggleLineCommentHandler();
        handlerService.activateHandler(ActionDefinitionIds.TOGGLE_COMMENT, toggleCommentHandler);
        IHandler addCommentBlockHandler = new AddBlockCommentHandler();
        handlerService.activateHandler(ActionDefinitionIds.ADD_BLOCK_COMMENT, addCommentBlockHandler);
        IHandler removeCommentBlockHandler = new RemoveBlockCommentHandler();
        handlerService.activateHandler(ActionDefinitionIds.REMOVE_BLOCK_COMMENT, removeCommentBlockHandler);
    }
    fShowPropertiesAction = new ShowPropertiesAction(getEditorPart(), getSelectionProvider());
    fFoldingGroup = new FoldingActionGroup(this, getSourceViewer());
}
Also used : AddBlockCommentHandler(org.eclipse.wst.sse.ui.internal.handlers.AddBlockCommentHandler) RemoveBlockCommentHandler(org.eclipse.wst.sse.ui.internal.handlers.RemoveBlockCommentHandler) ContentAssistAction(org.eclipse.ui.texteditor.ContentAssistAction) ToggleBreakpointAction(org.eclipse.wst.sse.ui.internal.debug.ToggleBreakpointAction) IAction(org.eclipse.jface.action.IAction) EditBreakpointAction(org.eclipse.wst.sse.ui.internal.debug.EditBreakpointAction) OpenHyperlinkAction(org.eclipse.wst.sse.ui.internal.hyperlink.OpenHyperlinkAction) Action(org.eclipse.jface.action.Action) BreakpointRulerAction(org.eclipse.wst.sse.ui.internal.debug.BreakpointRulerAction) ShowPropertiesAction(org.eclipse.wst.sse.ui.internal.properties.ShowPropertiesAction) ManageBreakpointAction(org.eclipse.wst.sse.ui.internal.debug.ManageBreakpointAction) TextOperationAction(org.eclipse.ui.texteditor.TextOperationAction) EditBreakpointAction(org.eclipse.wst.sse.ui.internal.debug.EditBreakpointAction) ShowPropertiesAction(org.eclipse.wst.sse.ui.internal.properties.ShowPropertiesAction) TextOperationAction(org.eclipse.ui.texteditor.TextOperationAction) ToggleLineCommentHandler(org.eclipse.wst.sse.ui.internal.handlers.ToggleLineCommentHandler) IWorkbenchHelpSystem(org.eclipse.ui.help.IWorkbenchHelpSystem) OpenHyperlinkAction(org.eclipse.wst.sse.ui.internal.hyperlink.OpenHyperlinkAction) IHandlerService(org.eclipse.ui.handlers.IHandlerService) ContentAssistAction(org.eclipse.ui.texteditor.ContentAssistAction) ManageBreakpointAction(org.eclipse.wst.sse.ui.internal.debug.ManageBreakpointAction) IHandler(org.eclipse.core.commands.IHandler) ResourceBundle(java.util.ResourceBundle) QuickOutlineHandler(org.eclipse.wst.sse.ui.internal.quickoutline.QuickOutlineHandler) ToggleBreakpointAction(org.eclipse.wst.sse.ui.internal.debug.ToggleBreakpointAction)

Aggregations

ResourceBundle (java.util.ResourceBundle)1 IHandler (org.eclipse.core.commands.IHandler)1 Action (org.eclipse.jface.action.Action)1 IAction (org.eclipse.jface.action.IAction)1 IHandlerService (org.eclipse.ui.handlers.IHandlerService)1 IWorkbenchHelpSystem (org.eclipse.ui.help.IWorkbenchHelpSystem)1 ContentAssistAction (org.eclipse.ui.texteditor.ContentAssistAction)1 TextOperationAction (org.eclipse.ui.texteditor.TextOperationAction)1 BreakpointRulerAction (org.eclipse.wst.sse.ui.internal.debug.BreakpointRulerAction)1 EditBreakpointAction (org.eclipse.wst.sse.ui.internal.debug.EditBreakpointAction)1 ManageBreakpointAction (org.eclipse.wst.sse.ui.internal.debug.ManageBreakpointAction)1 ToggleBreakpointAction (org.eclipse.wst.sse.ui.internal.debug.ToggleBreakpointAction)1 AddBlockCommentHandler (org.eclipse.wst.sse.ui.internal.handlers.AddBlockCommentHandler)1 RemoveBlockCommentHandler (org.eclipse.wst.sse.ui.internal.handlers.RemoveBlockCommentHandler)1 ToggleLineCommentHandler (org.eclipse.wst.sse.ui.internal.handlers.ToggleLineCommentHandler)1 OpenHyperlinkAction (org.eclipse.wst.sse.ui.internal.hyperlink.OpenHyperlinkAction)1 ShowPropertiesAction (org.eclipse.wst.sse.ui.internal.properties.ShowPropertiesAction)1 QuickOutlineHandler (org.eclipse.wst.sse.ui.internal.quickoutline.QuickOutlineHandler)1