Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] allow contribution to the C Outliner menu

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.84
diff -u -r1.84 ChangeLog
--- ChangeLog	5 Apr 2003 19:50:43 -0000	1.84
+++ ChangeLog	7 Apr 2003 19:04:50 -0000
@@ -1,3 +1,11 @@
+2003-04-07 Alain Magloire
+
+	Enable contribution to the outliner ContentProvider, in the future
+	this will let other modules like the debugger add action like
+	breakpoint in the outliner view to a IFunction.
+
+	* src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java:
+
 2003-04-05 Alain Magloire
 
 	Implement the new CollapseAll button to be consistent with the
Index: src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java,v
retrieving revision 1.9
diff -u -r1.9 CContentOutlinePage.java
--- src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java	5 Apr 2003 06:33:29 -0000	1.9
+++ src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java	7 Apr 2003 19:04:50 -0000
@@ -23,6 +23,7 @@
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
 import org.eclipse.jface.util.ListenerList;
 import org.eclipse.jface.viewers.AbstractTreeViewer;
 import org.eclipse.jface.viewers.ISelection;
@@ -39,6 +40,7 @@
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IFileEditorInput;
 import org.eclipse.ui.IStorageEditorInput;
+import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.part.IPageSite;
 import org.eclipse.ui.part.Page;
 import org.eclipse.ui.texteditor.IDocumentProvider;
@@ -50,14 +52,20 @@
 	private ProblemTreeViewer treeViewer;
 	private ListenerList selectionChangedListeners = new ListenerList();
 	private TogglePresentationAction fTogglePresentation;
+	private String fContextMenuId;
 	
 	private OpenIncludeAction fOpenIncludeAction;
 	private SearchForReferencesAction fSearchForReferencesAction;
 
 	public CContentOutlinePage(CEditor editor) {
+		this("#TranslationUnitOutlinerContext", editor);
+	}
+	
+	public CContentOutlinePage(String contextMenuID, CEditor editor) {
 		super();
 		fEditor= editor;
 		fInput= null;
+		fContextMenuId = contextMenuID;
 
 		fTogglePresentation= new TogglePresentationAction();
 		fTogglePresentation.setEditor(editor);
@@ -126,6 +134,8 @@
 		if (SearchForReferencesAction.canActionBeAdded(getSelection())) {
 			menu.add(fSearchForReferencesAction);
 		}
+		menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+		menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS+"-end"));//$NON-NLS-1$
 	}
 	
 	/**
@@ -143,7 +153,7 @@
 		
 		CUIPlugin.getDefault().getProblemMarkerManager().addListener(treeViewer);
 				
-		MenuManager manager= new MenuManager("#PopUp");
+		MenuManager manager= new MenuManager(fContextMenuId);
 		manager.setRemoveAllWhenShown(true);
 		manager.addMenuListener(new IMenuListener() {
 			public void menuAboutToShow(IMenuManager manager) {
@@ -156,6 +166,8 @@
 
 		// register global actions
 		IPageSite site= getSite();
+		site.registerContextMenu(fContextMenuId, manager, treeViewer);
+		site.setSelectionProvider(treeViewer);
 		IActionBars bars= site.getActionBars();		
 		bars.setGlobalActionHandler(ICEditorActionDefinitionIds.TOGGLE_PRESENTATION, fTogglePresentation);
 



Back to the top