Lines 8-22
Link Here
|
8 |
* Contributors: |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
10 |
* Jens Lukowski/Innoopract - initial renaming/restructuring |
10 |
* Jens Lukowski/Innoopract - initial renaming/restructuring |
|
|
11 |
* David Carver/STAR - [212330] can't contribute to the XML or any SSE based menu |
11 |
* |
12 |
* |
12 |
*******************************************************************************/ |
13 |
*******************************************************************************/ |
13 |
package org.eclipse.wst.sse.ui.internal.actions; |
14 |
package org.eclipse.wst.sse.ui.internal.actions; |
14 |
|
15 |
|
15 |
import java.util.ResourceBundle; |
16 |
//import java.util.ResourceBundle; |
16 |
|
17 |
|
17 |
import org.eclipse.core.runtime.Platform; |
18 |
import org.eclipse.core.runtime.Platform; |
18 |
import org.eclipse.jface.action.GroupMarker; |
19 |
import org.eclipse.jface.action.GroupMarker; |
19 |
import org.eclipse.jface.action.IAction; |
|
|
20 |
import org.eclipse.jface.action.IMenuManager; |
20 |
import org.eclipse.jface.action.IMenuManager; |
21 |
import org.eclipse.jface.action.IStatusLineManager; |
21 |
import org.eclipse.jface.action.IStatusLineManager; |
22 |
import org.eclipse.jface.action.IToolBarManager; |
22 |
import org.eclipse.jface.action.IToolBarManager; |
Lines 24-44
Link Here
|
24 |
import org.eclipse.jface.action.Separator; |
24 |
import org.eclipse.jface.action.Separator; |
25 |
import org.eclipse.ui.IActionBars; |
25 |
import org.eclipse.ui.IActionBars; |
26 |
import org.eclipse.ui.IEditorPart; |
26 |
import org.eclipse.ui.IEditorPart; |
27 |
import org.eclipse.ui.IWorkbenchActionConstants; |
|
|
28 |
import org.eclipse.ui.IWorkbenchPage; |
27 |
import org.eclipse.ui.IWorkbenchPage; |
29 |
import org.eclipse.ui.actions.ActionFactory; |
|
|
30 |
import org.eclipse.ui.editors.text.TextEditorActionContributor; |
28 |
import org.eclipse.ui.editors.text.TextEditorActionContributor; |
31 |
import org.eclipse.ui.ide.IDEActionFactory; |
|
|
32 |
import org.eclipse.ui.texteditor.ITextEditor; |
29 |
import org.eclipse.ui.texteditor.ITextEditor; |
33 |
import org.eclipse.ui.texteditor.ITextEditorActionConstants; |
|
|
34 |
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; |
35 |
import org.eclipse.ui.texteditor.ITextEditorExtension; |
30 |
import org.eclipse.ui.texteditor.ITextEditorExtension; |
36 |
import org.eclipse.ui.texteditor.RetargetTextEditorAction; |
31 |
import org.eclipse.ui.texteditor.RetargetTextEditorAction; |
37 |
import org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder; |
32 |
import org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder; |
38 |
import org.eclipse.wst.sse.ui.internal.GotoAnnotationAction; |
33 |
import org.eclipse.wst.sse.ui.internal.GotoAnnotationAction; |
39 |
import org.eclipse.wst.sse.ui.internal.IExtendedContributor; |
34 |
import org.eclipse.wst.sse.ui.internal.IExtendedContributor; |
40 |
import org.eclipse.wst.sse.ui.internal.ISourceViewerActionBarContributor; |
35 |
import org.eclipse.wst.sse.ui.internal.ISourceViewerActionBarContributor; |
41 |
import org.eclipse.wst.sse.ui.internal.SSEUIMessages; |
|
|
42 |
import org.eclipse.wst.sse.ui.internal.ui.OffsetStatusLineContributionItem; |
36 |
import org.eclipse.wst.sse.ui.internal.ui.OffsetStatusLineContributionItem; |
43 |
|
37 |
|
44 |
/** |
38 |
/** |
Lines 87-93
Link Here
|
87 |
public ActionContributor() { |
81 |
public ActionContributor() { |
88 |
super(); |
82 |
super(); |
89 |
|
83 |
|
90 |
ResourceBundle resourceBundle = SSEUIMessages.getResourceBundle(); |
84 |
/* ResourceBundle resourceBundle = SSEUIMessages.getResourceBundle(); |
91 |
|
85 |
|
92 |
fCommandsSeparator = new Separator(); |
86 |
fCommandsSeparator = new Separator(); |
93 |
|
87 |
|
Lines 136-153
Link Here
|
136 |
|
130 |
|
137 |
fGotoMatchingBracketAction = new RetargetTextEditorAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_GOTO_MATCHING_BRACKET + StructuredTextEditorActionConstants.UNDERSCORE); |
131 |
fGotoMatchingBracketAction = new RetargetTextEditorAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_GOTO_MATCHING_BRACKET + StructuredTextEditorActionConstants.UNDERSCORE); |
138 |
fGotoMatchingBracketAction.setActionDefinitionId(ActionDefinitionIds.GOTO_MATCHING_BRACKET); |
132 |
fGotoMatchingBracketAction.setActionDefinitionId(ActionDefinitionIds.GOTO_MATCHING_BRACKET); |
139 |
|
133 |
*/ |
140 |
// Read action extensions. |
134 |
// Read action extensions. |
141 |
ExtendedEditorActionBuilder builder = new ExtendedEditorActionBuilder(); |
135 |
ExtendedEditorActionBuilder builder = new ExtendedEditorActionBuilder(); |
142 |
extendedContributor = builder.readActionExtensions(getExtensionIDs()); |
136 |
extendedContributor = builder.readActionExtensions(getExtensionIDs()); |
143 |
|
137 |
/* |
144 |
fMenuAdditionsGroupMarker = new GroupMarker(StructuredTextEditorActionConstants.GROUP_NAME_MENU_ADDITIONS); |
138 |
fMenuAdditionsGroupMarker = new GroupMarker(StructuredTextEditorActionConstants.GROUP_NAME_MENU_ADDITIONS); |
145 |
fToolbarSeparator = new Separator(); |
139 |
fToolbarSeparator = new Separator(); |
146 |
fToolbarAdditionsGroupMarker = new GroupMarker(StructuredTextEditorActionConstants.GROUP_NAME_TOOLBAR_ADDITIONS); |
140 |
fToolbarAdditionsGroupMarker = new GroupMarker(StructuredTextEditorActionConstants.GROUP_NAME_TOOLBAR_ADDITIONS); |
147 |
|
141 |
|
148 |
fToggleInsertModeAction = new RetargetTextEditorAction(resourceBundle, "Editor.ToggleInsertMode.", IAction.AS_CHECK_BOX); //$NON-NLS-1$ |
142 |
fToggleInsertModeAction = new RetargetTextEditorAction(resourceBundle, "Editor.ToggleInsertMode.", IAction.AS_CHECK_BOX); //$NON-NLS-1$ |
149 |
fToggleInsertModeAction.setActionDefinitionId(ITextEditorActionDefinitionIds.TOGGLE_INSERT_MODE); |
143 |
fToggleInsertModeAction.setActionDefinitionId(ITextEditorActionDefinitionIds.TOGGLE_INSERT_MODE); |
150 |
|
144 |
*/ |
151 |
if (_showDebugStatus) { |
145 |
if (_showDebugStatus) { |
152 |
fDebugStatusOffset = new OffsetStatusLineContributionItem(StructuredTextEditorActionConstants.STATUS_CATEGORY_OFFSET, true, 20); |
146 |
fDebugStatusOffset = new OffsetStatusLineContributionItem(StructuredTextEditorActionConstants.STATUS_CATEGORY_OFFSET, true, 20); |
153 |
} |
147 |
} |
Lines 155-161
Link Here
|
155 |
|
149 |
|
156 |
protected void addToMenu(IMenuManager menu) { |
150 |
protected void addToMenu(IMenuManager menu) { |
157 |
// edit commands |
151 |
// edit commands |
158 |
IMenuManager editMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); |
152 |
/* IMenuManager editMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); |
159 |
if (editMenu != null) { |
153 |
if (editMenu != null) { |
160 |
editMenu.add(fCommandsSeparator); |
154 |
editMenu.add(fCommandsSeparator); |
161 |
editMenu.add(fToggleInsertModeAction); |
155 |
editMenu.add(fToggleInsertModeAction); |
Lines 185-190
Link Here
|
185 |
if (gotoMenu != null) { |
179 |
if (gotoMenu != null) { |
186 |
gotoMenu.add(fGotoMatchingBracketAction); |
180 |
gotoMenu.add(fGotoMatchingBracketAction); |
187 |
} |
181 |
} |
|
|
182 |
*/ |
188 |
} |
183 |
} |
189 |
|
184 |
|
190 |
protected void addToPopupMenu(IMenuManager menu) { |
185 |
protected void addToPopupMenu(IMenuManager menu) { |
Lines 198-215
Link Here
|
198 |
} |
193 |
} |
199 |
|
194 |
|
200 |
protected void addToToolBar(IToolBarManager toolBarManager) { |
195 |
protected void addToToolBar(IToolBarManager toolBarManager) { |
201 |
toolBarManager.add(fToolbarSeparator); |
196 |
/* toolBarManager.add(fToolbarSeparator); |
202 |
toolBarManager.add(fToolbarAdditionsGroupMarker); |
197 |
toolBarManager.add(fToolbarAdditionsGroupMarker); |
203 |
} |
198 |
*/ } |
204 |
|
199 |
|
205 |
/** |
200 |
/** |
206 |
* @see org.eclipse.ui.part.EditorActionBarContributor#contributeToMenu(IMenuManager) |
201 |
* @see org.eclipse.ui.part.EditorActionBarContributor#contributeToMenu(IMenuManager) |
207 |
*/ |
202 |
*/ |
208 |
public void contributeToMenu(IMenuManager menu) { |
203 |
public void contributeToMenu(IMenuManager menu) { |
209 |
super.contributeToMenu(menu); |
204 |
super.contributeToMenu(menu); |
210 |
|
205 |
/* |
211 |
addToMenu(menu); |
206 |
addToMenu(menu); |
212 |
|
207 |
*/ |
213 |
if (extendedContributor != null) { |
208 |
if (extendedContributor != null) { |
214 |
extendedContributor.contributeToMenu(menu); |
209 |
extendedContributor.contributeToMenu(menu); |
215 |
} |
210 |
} |
Lines 221-229
Link Here
|
221 |
* @see org.eclipse.wst.sse.ui.extension.IPopupMenuContributor#contributeToPopupMenu(org.eclipse.jface.action.IMenuManager) |
216 |
* @see org.eclipse.wst.sse.ui.extension.IPopupMenuContributor#contributeToPopupMenu(org.eclipse.jface.action.IMenuManager) |
222 |
*/ |
217 |
*/ |
223 |
public void contributeToPopupMenu(IMenuManager menu) { |
218 |
public void contributeToPopupMenu(IMenuManager menu) { |
224 |
|
219 |
/* |
225 |
addToPopupMenu(menu); |
220 |
addToPopupMenu(menu); |
226 |
|
221 |
*/ |
227 |
if (extendedContributor != null) { |
222 |
if (extendedContributor != null) { |
228 |
extendedContributor.contributeToPopupMenu(menu); |
223 |
extendedContributor.contributeToPopupMenu(menu); |
229 |
} |
224 |
} |
Lines 250-257
Link Here
|
250 |
public void contributeToToolBar(IToolBarManager toolBarManager) { |
245 |
public void contributeToToolBar(IToolBarManager toolBarManager) { |
251 |
super.contributeToToolBar(toolBarManager); |
246 |
super.contributeToToolBar(toolBarManager); |
252 |
|
247 |
|
253 |
addToToolBar(toolBarManager); |
248 |
/* addToToolBar(toolBarManager); |
254 |
|
249 |
*/ |
255 |
if (extendedContributor != null) { |
250 |
if (extendedContributor != null) { |
256 |
extendedContributor.contributeToToolBar(toolBarManager); |
251 |
extendedContributor.contributeToToolBar(toolBarManager); |
257 |
} |
252 |
} |
Lines 312-318
Link Here
|
312 |
|
307 |
|
313 |
ITextEditor textEditor = getTextEditor(activeEditor); |
308 |
ITextEditor textEditor = getTextEditor(activeEditor); |
314 |
|
309 |
|
315 |
IActionBars actionBars = getActionBars(); |
310 |
/* IActionBars actionBars = getActionBars(); |
316 |
if (actionBars != null) { |
311 |
if (actionBars != null) { |
317 |
actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_NEXT_ANNOTATION, fNextAnnotation); |
312 |
actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_NEXT_ANNOTATION, fNextAnnotation); |
318 |
actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_PREVIOUS_ANNOTATION, fPreviousAnnotation); |
313 |
actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_PREVIOUS_ANNOTATION, fPreviousAnnotation); |
Lines 344-350
Link Here
|
344 |
fGotoMatchingBracketAction.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_GOTO_MATCHING_BRACKET)); |
339 |
fGotoMatchingBracketAction.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_GOTO_MATCHING_BRACKET)); |
345 |
|
340 |
|
346 |
fToggleInsertModeAction.setAction(getAction(textEditor, ITextEditorActionConstants.TOGGLE_INSERT_MODE)); |
341 |
fToggleInsertModeAction.setAction(getAction(textEditor, ITextEditorActionConstants.TOGGLE_INSERT_MODE)); |
347 |
|
342 |
*/ |
348 |
if (extendedContributor != null) { |
343 |
if (extendedContributor != null) { |
349 |
extendedContributor.setActiveEditor(activeEditor); |
344 |
extendedContributor.setActiveEditor(activeEditor); |
350 |
} |
345 |
} |
Lines 361-378
Link Here
|
361 |
* @see org.eclipse.wst.sse.ui.ISourceViewerActionBarContributor#setViewerSpecificContributionsEnabled(boolean) |
356 |
* @see org.eclipse.wst.sse.ui.ISourceViewerActionBarContributor#setViewerSpecificContributionsEnabled(boolean) |
362 |
*/ |
357 |
*/ |
363 |
public void setViewerSpecificContributionsEnabled(boolean enabled) { |
358 |
public void setViewerSpecificContributionsEnabled(boolean enabled) { |
364 |
fShiftRight.setEnabled(enabled); |
359 |
/* fShiftRight.setEnabled(enabled); |
365 |
fShiftLeft.setEnabled(enabled); |
360 |
fShiftLeft.setEnabled(enabled); |
366 |
fNextAnnotation.setEnabled(enabled); |
361 |
fNextAnnotation.setEnabled(enabled); |
367 |
fPreviousAnnotation.setEnabled(enabled); |
362 |
fPreviousAnnotation.setEnabled(enabled); |
368 |
|
363 |
*/ |
369 |
/* |
364 |
/* |
370 |
* fComment.setEnabled(enabled); fUncomment.setEnabled(enabled); |
365 |
* fComment.setEnabled(enabled); fUncomment.setEnabled(enabled); |
371 |
*/ |
366 |
*/ |
|
|
367 |
/* |
372 |
fToggleComment.setEnabled(enabled); |
368 |
fToggleComment.setEnabled(enabled); |
373 |
fAddBlockComment.setEnabled(enabled); |
369 |
fAddBlockComment.setEnabled(enabled); |
374 |
fRemoveBlockComment.setEnabled(enabled); |
370 |
fRemoveBlockComment.setEnabled(enabled); |
|
|
371 |
*/ |
375 |
// convert line delimiters are not source viewer-specific |
372 |
// convert line delimiters are not source viewer-specific |
|
|
373 |
|
376 |
} |
374 |
} |
377 |
|
375 |
|
378 |
/* |
376 |
/* |