1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Add menu group markers to asm editor

This commit is contained in:
Anton Leherbauer 2007-09-14 07:10:35 +00:00
parent 98b5fb5d33
commit 89158287cb

View file

@ -12,12 +12,18 @@
package org.eclipse.cdt.internal.ui.editor.asm;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.navigator.ICommonMenuConstants;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
/**
* Assembly text editor
@ -38,7 +44,7 @@ public class AsmTextEditor extends TextEditor {
setSourceViewerConfiguration(new AsmSourceViewerConfiguration(textTools, store));
setDocumentProvider(CUIPlugin.getDefault().getDocumentProvider());
// FIXME: Should this editor have a different preference store ?
// For now we are sharing with the CEditor and any changes will in the
// For now we are sharing with the CEditor and any changes in the
// setting of the CEditor will be reflected in this editor.
setPreferenceStore(store);
setEditorContextMenuId("#ASMEditorContext"); //$NON-NLS-1$
@ -51,8 +57,6 @@ public class AsmTextEditor extends TextEditor {
* Pulled in from 2.0
*/
protected boolean affectsTextPresentation(PropertyChangeEvent event) {
// String p= event.getProperty();
boolean affects= false;
AsmTextTools textTools= CUIPlugin.getDefault().getAsmTextTools();
affects |= textTools.affectsBehavior(event);
@ -60,4 +64,16 @@ public class AsmTextEditor extends TextEditor {
return affects ? affects : super.affectsTextPresentation(event);
}
/*
* @see org.eclipse.ui.editors.text.TextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
*/
protected void editorContextMenuAboutToShow(IMenuManager menu) {
// marker for contributions to the top
menu.add(new GroupMarker(ICommonMenuConstants.GROUP_TOP));
// separator for debug related actions (similar to ruler context menu)
menu.add(new Separator(IContextMenuConstants.GROUP_DEBUG));
menu.add(new GroupMarker(IContextMenuConstants.GROUP_DEBUG+".end")); //$NON-NLS-1$
super.editorContextMenuAboutToShow(menu);
}
}