use of org.eclipse.wst.sse.ui.internal.hyperlink.OpenHyperlinkAction 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());
}
use of org.eclipse.wst.sse.ui.internal.hyperlink.OpenHyperlinkAction in project webtools.sourceediting by eclipse.
the class StructuredTextEditor method updateSourceViewerConfiguration.
private void updateSourceViewerConfiguration() {
SourceViewerConfiguration configuration = getSourceViewerConfiguration();
// yet
if (configuration == null) {
return;
}
// do not configure source viewer configuration twice
boolean configured = false;
// structuredtextviewerconfiguration
if (!(configuration instanceof StructuredTextViewerConfiguration)) {
ConfigurationAndTarget cat = createSourceViewerConfiguration();
fViewerConfigurationTargetId = cat.getTargetId();
configuration = cat.getConfiguration();
setSourceViewerConfiguration(configuration);
configured = true;
} else {
ConfigurationAndTarget cat = createSourceViewerConfiguration();
StructuredTextViewerConfiguration newViewerConfiguration = cat.getConfiguration();
if (!(cat.getTargetId().equals(fViewerConfigurationTargetId))) {
// d282894 use newViewerConfiguration
fViewerConfigurationTargetId = cat.getTargetId();
configuration = newViewerConfiguration;
setSourceViewerConfiguration(configuration);
configured = true;
}
}
if (getSourceViewer() != null) {
// (maybe only need to reset viewerconfig's document)
if (!configured)
getSourceViewer().configure(configuration);
IAction openHyperlinkAction = getAction(StructuredTextEditorActionConstants.ACTION_NAME_OPEN_FILE);
if (openHyperlinkAction instanceof OpenHyperlinkAction) {
((OpenHyperlinkAction) openHyperlinkAction).setHyperlinkDetectors(getSourceViewerConfiguration().getHyperlinkDetectors(getSourceViewer()));
}
}
}
Aggregations