Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mdt-papyrus.dev] Intergration of the outline provided by Jacques Lescot

Title: Eclipse Summit meeting
Hi,
 
I have integrated the work of Jacques Lescot in a new plugin org.eclipse.papyrus.outline
 
This outline has a higher priority as org.eclipse.papyrus.outline.emftree.
 
I think that there is a  problem with extension point org.eclipse.ui.navigator.navigatorContent, because nothing is displayed and there is no mistakes.
 
I have no time before the 17 november, I will see to debug in futher.
 
To run this plugin, apply the patch provided by Jacques Lescot on the plugin org.eclipse.ui.navigator  release 3.4.
 
Patrick
 
---------------------------------------------------------
Patrick Tessier
Research Engineer
DRT LIST/DTSI/SOL/LISE CEA-Saclay
91191 Gif sur Yvette Cedex
Tel: 01 69 08 48 63
www.papyrusuml.org
---------------------------------------------------------
 

 

BEGIN:VCARD
VERSION:2.1
N:TESSIER;Patrick
FN:TESSIER Patrick 202707 (Patrick.TESSIER@xxxxxx)
ORG:;SOL/LLSP
TITLE:Ingénieur Chercheur
TEL;WORK;VOICE:(01) 69 08 48 63
ADR;WORK;ENCODING=QUOTED-PRINTABLE:;B=E2t. 451 Pce 9;CEA SACLAY=0D=0ADRT/DTSI;GIF/YVETTE CEDEX;;91191;FRANCE
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:B=E2t. 451 Pce 9=0D=0ACEA SACLAY=0D=0ADRT/DTSI=0D=0AGIF/YVETTE CEDEX 91191=
=0D=0AFRANCE
EMAIL;PREF;INTERNET:Patrick.TESSIER@xxxxxx
REV:20071011T094630Z
END:VCARD
Index: src/org/eclipse/ui/internal/navigator/CommonNavigatorManager.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CommonNavigatorManager.java,v
retrieving revision 1.16
diff -u -r1.16 CommonNavigatorManager.java
--- src/org/eclipse/ui/internal/navigator/CommonNavigatorManager.java	9 May 2008 14:12:56 -0000	1.16
+++ src/org/eclipse/ui/internal/navigator/CommonNavigatorManager.java	19 Jun 2008 15:39:20 -0000
@@ -35,11 +35,9 @@
 import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.actions.ActionContext;
 import org.eclipse.ui.actions.RetargetAction;
-import org.eclipse.ui.navigator.CommonNavigator;
 import org.eclipse.ui.navigator.CommonViewer;
-import org.eclipse.ui.navigator.CommonViewerSiteFactory;
 import org.eclipse.ui.navigator.ICommonActionConstants;
-import org.eclipse.ui.navigator.ICommonViewerSite;
+import org.eclipse.ui.navigator.ICommonNavigator;
 import org.eclipse.ui.navigator.IDescriptionProvider;
 import org.eclipse.ui.navigator.INavigatorContentService;
 import org.eclipse.ui.navigator.NavigatorActionService;
@@ -62,7 +60,7 @@
 	// delay for updating the action bars (in ms)
 	private static final long DELAY = 200;
 
-	private final CommonNavigator commonNavigator;
+	private final ICommonNavigator commonNavigator;
 
 	private final INavigatorContentService contentService;
 
@@ -101,7 +99,7 @@
 					if(commonNavigator.getCommonViewer().getInput() != null) {
 						IStructuredSelection selection = new StructuredSelection(commonNavigator.getCommonViewer().getInput());
 						actionService.setContext(new ActionContext(selection));
-						actionService.fillActionBars(commonNavigator.getViewSite().getActionBars());
+						actionService.fillActionBars(commonNavigator.getActionBars());
 					}
 				}
 				/*
@@ -127,7 +125,7 @@
 	 *            The CommonNavigator managed by this class. Requires a non-null
 	 *            value.
 	 */
-	public CommonNavigatorManager(CommonNavigator aNavigator) {
+	public CommonNavigatorManager(ICommonNavigator aNavigator) {
 		this(aNavigator, null);
 	}
 	
@@ -142,11 +140,11 @@
 	 *            value.
 	 * @param aMemento a memento for restoring state, or <code>null</code>
 	 */
-	public CommonNavigatorManager(CommonNavigator aNavigator, IMemento aMemento) {
+	public CommonNavigatorManager(ICommonNavigator aNavigator, IMemento aMemento) {
 		super();
 		commonNavigator = aNavigator;
 		contentService = commonNavigator.getNavigatorContentService();
-		statusLineManager = commonNavigator.getViewSite().getActionBars()
+		statusLineManager = commonNavigator.getActionBars()
 				.getStatusLineManager();
 		commonDescriptionProvider = contentService
 				.createCommonDescriptionProvider();
@@ -166,21 +164,19 @@
 		commonViewer.addPostSelectionChangedListener(statusBarListener);
 		updateStatusBar(commonViewer.getSelection());
 
-		ICommonViewerSite commonViewerSite = CommonViewerSiteFactory
-				.createCommonViewerSite(commonNavigator.getViewSite());
-		actionService = new NavigatorActionService(commonViewerSite,
-				commonViewer, commonViewer.getNavigatorContentService()); 
+		actionService = new NavigatorActionService(commonNavigator
+				.getCommonViewerSite(), commonViewer, commonViewer.getNavigatorContentService()); 
 
 		final RetargetAction openAction = new RetargetAction(
 				ICommonActionConstants.OPEN,
 				CommonNavigatorMessages.Open_action_label);
-		commonNavigator.getViewSite().getPage().addPartListener(openAction);
+		commonNavigator.getWorkbenchSite().getPage().addPartListener(openAction);
 		openAction.setActionDefinitionId(ICommonActionConstants.OPEN);
 
 		commonNavigator.getCommonViewer().addOpenListener(new IOpenListener() {
 			public void open(OpenEvent event) {
 				actionService.setContext(new ActionContext(commonNavigator.getCommonViewer().getSelection()));		
-				actionService.fillActionBars(commonNavigator.getViewSite().getActionBars());							
+				actionService.fillActionBars(commonNavigator.getActionBars());							
 				openAction.run();
 			}
 		});  
@@ -195,7 +191,7 @@
 
 	/**
 	 * <p>
-	 * Called by {@link CommonNavigator} when the View Part is disposed.
+	 * Called by {@link ICommonNavigator} when the View Part is disposed.
 	 * 
 	 */
 	public void dispose() {
@@ -217,8 +213,7 @@
 			IStructuredSelection structuredSelection = (IStructuredSelection) anEvent
 					.getSelection();
 			actionService.setContext(new ActionContext(structuredSelection));
-			actionService.fillActionBars(commonNavigator.getViewSite()
-					.getActionBars());
+			actionService.fillActionBars(commonNavigator.getActionBars());
 		}
 	}
 
@@ -284,7 +279,7 @@
 	}
 
 	protected void initViewMenu() {
-		IMenuManager viewMenu = commonNavigator.getViewSite().getActionBars()
+		IMenuManager viewMenu = commonNavigator.getActionBars()
 				.getMenuManager();
 		viewMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
 		viewMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS
Index: src/org/eclipse/ui/internal/navigator/CommonNavigatorActionGroup.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CommonNavigatorActionGroup.java,v
retrieving revision 1.11
diff -u -r1.11 CommonNavigatorActionGroup.java
--- src/org/eclipse/ui/internal/navigator/CommonNavigatorActionGroup.java	24 Mar 2008 19:13:48 -0000	1.11
+++ src/org/eclipse/ui/internal/navigator/CommonNavigatorActionGroup.java	19 Jun 2008 15:39:20 -0000
@@ -10,20 +10,15 @@
  *******************************************************************************/
 package org.eclipse.ui.internal.navigator;
 
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.commands.ActionHandler;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.actions.ActionGroup;
 import org.eclipse.ui.handlers.CollapseAllHandler;
 import org.eclipse.ui.handlers.IHandlerService;
 import org.eclipse.ui.internal.navigator.actions.CollapseAllAction;
-import org.eclipse.ui.internal.navigator.actions.LinkEditorAction;
-import org.eclipse.ui.internal.navigator.extensions.LinkHelperService;
 import org.eclipse.ui.internal.navigator.filters.FilterActionGroup;
-import org.eclipse.ui.navigator.CommonNavigator;
 import org.eclipse.ui.navigator.CommonViewer;
+import org.eclipse.ui.navigator.ICommonNavigator;
 import org.eclipse.ui.navigator.INavigatorViewerDescriptor;
 
 /**
@@ -33,17 +28,13 @@
  */
 public class CommonNavigatorActionGroup extends ActionGroup {
 
-	private LinkEditorAction toggleLinkingAction;
-
 	private CollapseAllAction collapseAllAction;
 
 	private FilterActionGroup filterGroup;
 
 	private final CommonViewer commonViewer;
 
-	private CommonNavigator commonNavigator;
-
-	private final LinkHelperService linkHelperService;
+	private ICommonNavigator commonNavigator;
 
 	private CollapseAllHandler collapseAllHandler;
 
@@ -52,17 +43,15 @@
 	 * Filters.
 	 * 
 	 * @param aNavigator
-	 *            The IViewPart for this action group
+	 *            The ICommonNavigator for this action group
 	 * @param aViewer
 	 *            The Viewer for this action group
-	 * @param linkHelperService the link service helper
 	 */
-	public CommonNavigatorActionGroup(CommonNavigator aNavigator,
-			CommonViewer aViewer, LinkHelperService linkHelperService) {
+	public CommonNavigatorActionGroup(ICommonNavigator aNavigator,
+			CommonViewer aViewer) {
 		super();
 		commonNavigator = aNavigator;
 		commonViewer = aViewer;
-		this.linkHelperService = linkHelperService;
 		makeActions();
 	}
 
@@ -75,25 +64,28 @@
 	}
 
 	/**
+	 * @return The ICommonNavigator for this action group
+	 */
+	protected ICommonNavigator getCommonNavigator() {
+		return commonNavigator;
+	}
+
+	/**
+	 * @return The viewer for this action group
+	 */
+	protected CommonViewer getCommonViewer() {
+		return commonViewer;
+	}
+
+	/**
 	 * 
 	 */
 	private void makeActions() {
-		IHandlerService service = (IHandlerService) commonNavigator.getSite()
+		IHandlerService service = (IHandlerService) commonNavigator.getWorkbenchSite()
 				.getService(IHandlerService.class);
 
 		INavigatorViewerDescriptor viewerDescriptor = commonViewer
 				.getNavigatorContentService().getViewerDescriptor();
-		boolean hideLinkWithEditorAction = viewerDescriptor
-				.getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_LINK_WITH_EDITOR_ACTION);
-		if (!hideLinkWithEditorAction) {
-			toggleLinkingAction = new LinkEditorAction(commonNavigator,
-					commonViewer, linkHelperService);
-			ImageDescriptor syncIcon = getImageDescriptor("elcl16/synced.gif"); //$NON-NLS-1$
-			toggleLinkingAction.setImageDescriptor(syncIcon);
-			toggleLinkingAction.setHoverImageDescriptor(syncIcon);
-			service.activateHandler(toggleLinkingAction.getActionDefinitionId(),
-					new ActionHandler(toggleLinkingAction));
-		}
 
 		boolean hideCollapseAllAction = viewerDescriptor
 				.getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_COLLAPSE_ALL_ACTION);
@@ -116,7 +108,6 @@
 	 * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
 	 */
 	public void fillActionBars(IActionBars theActionBars) {
-		IMenuManager menu = theActionBars.getMenuManager();
 
 		filterGroup.fillActionBars(theActionBars);
 
@@ -124,14 +115,6 @@
 			theActionBars.getToolBarManager().add(collapseAllAction);
 		}
 
-		if (toggleLinkingAction != null) {
-			menu
-					.insertAfter(IWorkbenchActionConstants.MB_ADDITIONS
-							+ "-end", toggleLinkingAction); //$NON-NLS-1$
-
-			theActionBars.getToolBarManager().add(toggleLinkingAction);
-		}
-
 		theActionBars.updateActionBars();
 	}
 
@@ -142,9 +125,6 @@
 	 */
 	public void dispose() {
 		super.dispose();
-		if (toggleLinkingAction != null) {
-			toggleLinkingAction.dispose();
-		}
 		if (collapseAllHandler!=null) {
 			collapseAllHandler.dispose();
 		}
Index: src/org/eclipse/ui/internal/navigator/messages.properties
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/messages.properties,v
retrieving revision 1.12
diff -u -r1.12 messages.properties
--- src/org/eclipse/ui/internal/navigator/messages.properties	6 Jun 2008 16:50:50 -0000	1.12
+++ src/org/eclipse/ui/internal/navigator/messages.properties	19 Jun 2008 15:39:20 -0000
@@ -43,3 +43,4 @@
 CommonSorterDescriptorManager_A_navigatorContent_extesnion_in_0_=A navigatorContent extesnion in {0} is missing an id.
 FilterDialogSelectionListener_Enable_the_0_filter_=Enable the {0} filter.
 NavigatorContentServiceLabelProvider_Error_no_label_provider_for_0_=Error: no label provider for {0}
+CommonNavigatorOutline_DefaultTitle=Common Navigator Outline
Index: src/org/eclipse/ui/internal/navigator/CommonNavigatorMessages.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CommonNavigatorMessages.java,v
retrieving revision 1.10
diff -u -r1.10 CommonNavigatorMessages.java
--- src/org/eclipse/ui/internal/navigator/CommonNavigatorMessages.java	9 May 2008 14:12:56 -0000	1.10
+++ src/org/eclipse/ui/internal/navigator/CommonNavigatorMessages.java	19 Jun 2008 15:39:20 -0000
@@ -123,7 +123,10 @@
 
 	/** */
 	public static String NavigatorContentServiceLabelProvider_Error_no_label_provider_for_0_;
-
+	
+	/** */
+	public static String CommonNavigatorOutline_DefaultTitle;
+	
 	static {
 		NLS.initializeMessages(BUNDLE_NAME, CommonNavigatorMessages.class);
 	}
Index: src/org/eclipse/ui/navigator/CommonNavigator.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonNavigator.java,v
retrieving revision 1.35
diff -u -r1.35 CommonNavigator.java
--- src/org/eclipse/ui/navigator/CommonNavigator.java	9 May 2008 14:12:56 -0000	1.35
+++ src/org/eclipse/ui/navigator/CommonNavigator.java	19 Jun 2008 15:39:20 -0000
@@ -25,23 +25,24 @@
 import org.eclipse.jface.viewers.ViewerFilter;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IActionBars;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IMemento;
 import org.eclipse.ui.ISaveablePart;
 import org.eclipse.ui.ISaveablesLifecycleListener;
 import org.eclipse.ui.ISaveablesSource;
 import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchSite;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.Saveable;
 import org.eclipse.ui.SaveablesLifecycleEvent;
 import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.internal.navigator.CommonNavigatorActionGroup;
 import org.eclipse.ui.internal.navigator.CommonNavigatorManager;
+import org.eclipse.ui.internal.navigator.CommonNavigatorViewActionGroup;
 import org.eclipse.ui.internal.navigator.NavigatorContentService;
 import org.eclipse.ui.internal.navigator.NavigatorPlugin;
 import org.eclipse.ui.internal.navigator.extensions.LinkHelperService;
-import org.eclipse.ui.part.ISetSelectionTarget;
 import org.eclipse.ui.part.IShowInTarget;
 import org.eclipse.ui.part.ShowInContext;
 import org.eclipse.ui.part.ViewPart;
@@ -50,50 +51,7 @@
  * <p>
  * This class provides the IViewPart for the Common Navigator framework in the
  * Eclipse workbench. This class also serves as the backbone for navigational
- * viewers. The following types are used by this class to render the Common
- * Navigator:
- * <ul>
- * <li>
- * <p>
- * {@link org.eclipse.ui.navigator.CommonViewer}: The viewer that renders the
- * extensible tree. Creates and manages the lifecylce of the Navigator Content
- * Service (described below).
- * </p>
- * </li>
- * <li>
- * <p>
- * {@link org.eclipse.ui.navigator.NavigatorActionService}: Manages instances
- * of {@link org.eclipse.ui.navigator.CommonActionProvider}s provided by
- * individual extensions and content extensions.
- * </p>
- * </li>
- * <li>
- * <p>
- * {@link org.eclipse.ui.navigator.INavigatorContentService}: Manages instances
- * of Navigator Content Extensions. Instances are created as needed, and
- * disposed of upon the disposal of the Navigator Content Service.
- * </p>
- * </li>
- * </ul>
- * <p>
- * Clients are not expected to subclass CommonNavigator. Clients that wish to
- * define their own custom extensible navigator view need to specify an instance
- * of the <b>org.eclipse.ui.views</b> extension point:
- * 
- * <pre>
- *   
- *          &lt;extension
- *          		point=&quot;org.eclipse.ui.views&quot;&gt;
- *          	&lt;view
- *          		name=&quot;My Custom View&quot;
- *          		icon=&quot;relative/path/to/icon.gif&quot;
- *          		category=&quot;org.acme.mycategory&quot;
- *          		class=&quot;org.eclipse.ui.navigator.CommonNavigator&quot;
- *          		id=&quot;org.acme.MyCustomNavigatorID&quot;&gt;
- *          	&lt;/view&gt;
- *          &lt;/extension&gt; 
- *    
- * </pre>
+ * viewers.
  * 
  * </p> 
  * Clients that wish to extend the view menu provided via the
@@ -108,7 +66,7 @@
  *  
  * @since 3.2
  */
-public class CommonNavigator extends ViewPart implements ISetSelectionTarget, ISaveablePart, ISaveablesSource, IShowInTarget {
+public class CommonNavigator extends ViewPart implements ICommonNavigator, ISaveablePart, ISaveablesSource, IShowInTarget {
  
 	private static final Class INAVIGATOR_CONTENT_SERVICE = INavigatorContentService.class;
 	private static final Class COMMON_VIEWER_CLASS = CommonViewer.class;
@@ -341,21 +299,20 @@
 
 	/**
 	 * <p>
-	 * Provides access to the commonViewer used by the current CommonNavigator.
 	 * The field will not be valid until after
 	 * {@link #init(IViewSite, IMemento)}&nbsp;has been called by the
 	 * Workbench.
 	 * </p>
 	 *  
 	 * @return The (already created) instance of Common Viewer.
+	 * @see org.eclipse.ui.navigator.ICommonNavigator#getCommonViewer()
 	 */
 	public CommonViewer getCommonViewer() {
 		return commonViewer;
 	}
 
 	/**
-	 * @return The Navigator Content Service which populates this instance of
-	 *         Common Navigator
+	 * @see org.eclipse.ui.navigator.ICommonNavigator#getNavigatorContentService()
 	 */
 	public INavigatorContentService getNavigatorContentService() {
 		return getCommonViewer().getNavigatorContentService();
@@ -503,7 +460,7 @@
 	 *         Part.
 	 */
 	protected ActionGroup createCommonActionGroup() {
-		return new CommonNavigatorActionGroup(this, commonViewer, getLinkHelperService());
+		return new CommonNavigatorViewActionGroup(this, commonViewer, getLinkHelperService());
 	}
 
 	/**
@@ -646,5 +603,26 @@
 			linkService = new LinkHelperService((NavigatorContentService)getCommonViewer().getNavigatorContentService());
 		return linkService;
 	}
+
+	/**
+	 * @see org.eclipse.ui.navigator.ICommonNavigator#getActionBars()
+	 */
+	public IActionBars getActionBars() {
+		return getViewSite().getActionBars();
+	}
+
+	/**
+	 * @see org.eclipse.ui.navigator.ICommonNavigator#getWorkbenchSite()
+	 */
+	public IWorkbenchSite getWorkbenchSite() {
+		return getViewSite();
+	}
+
+	/**
+	 * @see org.eclipse.ui.navigator.ICommonNavigator#getCommonViewerSite()
+	 */
+	public ICommonViewerSite getCommonViewerSite() {
+		return CommonViewerSiteFactory.createCommonViewerSite(getViewSite());
+	}
  
 }
Index: src/org/eclipse/ui/navigator/NavigatorActionService.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/NavigatorActionService.java,v
retrieving revision 1.22
diff -u -r1.22 NavigatorActionService.java
--- src/org/eclipse/ui/navigator/NavigatorActionService.java	24 Mar 2008 19:13:48 -0000	1.22
+++ src/org/eclipse/ui/navigator/NavigatorActionService.java	19 Jun 2008 15:39:20 -0000
@@ -60,7 +60,7 @@
  * specify an Action Provider.
  * </p>
  * <p>
- * Clients that reuse this service outside of an instance of {@link CommonNavigator} must be sure
+ * Clients that reuse this service outside of an instance of {@link ICommonNavigator} must be sure
  * that {{@link #fillActionBars(IActionBars)} is called whenever the selection changes. The
  * retargetable actions for each selection could change, based on who contributed the items.
  * 
Index: src/org/eclipse/ui/internal/navigator/actions/LinkEditorAction.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/actions/LinkEditorAction.java,v
retrieving revision 1.13
diff -u -r1.13 LinkEditorAction.java
--- src/org/eclipse/ui/internal/navigator/actions/LinkEditorAction.java	30 Nov 2007 15:10:09 -0000	1.13
+++ src/org/eclipse/ui/internal/navigator/actions/LinkEditorAction.java	19 Jun 2008 15:39:20 -0000
@@ -69,7 +69,7 @@
 						ILinkHelper[] helpers = linkService
 								.getLinkHelpersFor(sSelection.getFirstElement());
 						if (helpers.length > 0) {
-							helpers[0].activateEditor(commonNavigator.getSite()
+							helpers[0].activateEditor(commonNavigator.getWorkbenchSite()
 									.getPage(), sSelection);
 						}
 					}
@@ -87,7 +87,7 @@
 				SafeRunner.run(new ISafeRunnable() {
 
 					public void run() throws Exception {
-						IWorkbenchPage page = commonNavigator.getSite()
+						IWorkbenchPage page = commonNavigator.getWorkbenchSite()
 								.getPage();
 						if (page != null) {
 							IEditorPart editor = page.getActiveEditor();
@@ -245,10 +245,10 @@
 			updateSelectionJob.schedule(BRIEF_DELAY);
 
 			commonViewer.addPostSelectionChangedListener(this);
-			commonNavigator.getSite().getPage().addPartListener(partListener);
+			commonNavigator.getWorkbenchSite().getPage().addPartListener(partListener);
 		} else {
 			commonViewer.removePostSelectionChangedListener(this);
-			commonNavigator.getSite().getPage()
+			commonNavigator.getWorkbenchSite().getPage()
 					.removePartListener(partListener);
 		}
 	}
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator/META-INF/MANIFEST.MF,v
retrieving revision 1.16
diff -u -r1.16 MANIFEST.MF
--- META-INF/MANIFEST.MF	23 Jan 2008 13:27:31 -0000	1.16
+++ META-INF/MANIFEST.MF	19 Jun 2008 15:39:19 -0000
@@ -18,6 +18,7 @@
  org.eclipse.ui.workbench;bundle-version="[3.2.1,4.0.0)",
  org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
  org.eclipse.ui;bundle-version="[3.2.1,4.0.0)",
- org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)"
+ org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.views;bundle-version="[3.3.0,4.0.0)"
 Bundle-RequiredExecutionEnvironment: J2SE-1.4
 Bundle-ActivationPolicy: lazy
Index: src/org/eclipse/ui/navigator/ICommonNavigator.java
===================================================================
RCS file: src/org/eclipse/ui/navigator/ICommonNavigator.java
diff -N src/org/eclipse/ui/navigator/ICommonNavigator.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/ui/navigator/ICommonNavigator.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,122 @@
+/***********************************************************************
+ * Copyright (c) 2008 Anyware Technologies
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Anyware Technologies - initial API and implementation
+ *
+ * $Id$
+ **********************************************************************/
+
+package org.eclipse.ui.navigator;
+
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.part.ISetSelectionTarget;
+
+/**
+ * <p>
+ * This interface defines the API for common navigators. Common navigators can
+ * be used in views or outlines. The following types are used by this class to
+ * render a Common Navigator:
+ * <ul>
+ * <li>
+ * <p>
+ * {@link org.eclipse.ui.navigator.CommonViewer}: The viewer that renders the
+ * extensible tree. Creates and manages the lifecylce of the Navigator Content
+ * Service (described below).
+ * </p>
+ * </li>
+ * <li>
+ * <p>
+ * {@link org.eclipse.ui.navigator.NavigatorActionService}: Manages instances of
+ * {@link org.eclipse.ui.navigator.CommonActionProvider}s provided by individual
+ * extensions and content extensions.
+ * </p>
+ * </li>
+ * <li>
+ * <p>
+ * {@link org.eclipse.ui.navigator.INavigatorContentService}: Manages instances
+ * of Navigator Content Extensions. Instances are created as needed, and
+ * disposed of upon the disposal of the Navigator Content Service.
+ * </p>
+ * </li>
+ * </ul>
+ * <p>
+ * Clients are not expected to subclass CommonNavigator. Clients that wish to
+ * define their own custom extensible navigator view need to specify an instance
+ * of the <b>org.eclipse.ui.views</b> extension point:
+ * 
+ * <pre>
+ * 
+ *          &lt;extension
+ *          		point=&quot;org.eclipse.ui.views&quot;&gt;
+ *          	&lt;view
+ *          		name=&quot;My Custom View&quot;
+ *          		icon=&quot;relative/path/to/icon.gif&quot;
+ *          		category=&quot;org.acme.mycategory&quot;
+ *          		class=&quot;org.eclipse.ui.navigator.CommonNavigator&quot;
+ *          		id=&quot;org.acme.MyCustomNavigatorID&quot;&gt;
+ *          	&lt;/view&gt;
+ *          &lt;/extension&gt;
+ * 
+ * </pre>
+ * 
+ * @since 3.5
+ */
+public interface ICommonNavigator extends ISetSelectionTarget {
+
+	/**
+	 * <p>
+	 * Provides access to the commonViewer used by the current CommonNavigator.
+	 * </p>
+	 * 
+	 * @return The (already created) instance of Common Viewer.
+	 */
+	public CommonViewer getCommonViewer();
+
+	/**
+	 * @return The Navigator Content Service which populates this instance of
+	 *         Common Navigator
+	 */
+	public INavigatorContentService getNavigatorContentService();
+
+	/**
+	 * <p>
+	 * Provides access to the Workbench Site of the current Common Navigator.
+	 * The workbench site is used to access to the Workbench Page or services.
+	 * </p>
+	 * 
+	 * @return the Workbench site of the Common Navigator
+	 */
+	public IWorkbenchSite getWorkbenchSite();
+
+	/**
+	 * <p>
+	 * Return or creates a valid context for this Common Navigator
+	 * </p>
+	 * 
+	 * @return the context of this Common Navigator
+	 */
+	public ICommonViewerSite getCommonViewerSite();
+
+	/**
+	 * @return the title of this Common Navigator
+	 */
+	public String getTitle();
+
+	/**
+	 * <p>
+	 * Provides access to the ActionBars of this Common Navigator. This method
+	 * is an abstraction to access to ActionBars from IViewPart,
+	 * IContentOutlinePage...
+	 * </p>
+	 * 
+	 * @return the ActionBar of this Common Navigator
+	 */
+	public IActionBars getActionBars();
+}
Index: src/org/eclipse/ui/internal/navigator/CommonNavigatorViewActionGroup.java
===================================================================
RCS file: src/org/eclipse/ui/internal/navigator/CommonNavigatorViewActionGroup.java
diff -N src/org/eclipse/ui/internal/navigator/CommonNavigatorViewActionGroup.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/ui/internal/navigator/CommonNavigatorViewActionGroup.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ui.internal.navigator;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.commands.ActionHandler;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.internal.navigator.actions.LinkEditorAction;
+import org.eclipse.ui.internal.navigator.extensions.LinkHelperService;
+import org.eclipse.ui.navigator.CommonNavigator;
+import org.eclipse.ui.navigator.CommonViewer;
+import org.eclipse.ui.navigator.INavigatorViewerDescriptor;
+
+/**
+ * 
+ * 
+ * @since 3.5
+ */
+public class CommonNavigatorViewActionGroup extends CommonNavigatorActionGroup {
+
+	private LinkEditorAction toggleLinkingAction;
+
+	private final LinkHelperService linkHelperService;
+
+	/**
+	 * Create a action group for Collapse All, Link with editor, and Select
+	 * Filters.
+	 * 
+	 * @param aNavigator
+	 *            The IViewPart for this action group
+	 * @param aViewer
+	 *            The Viewer for this action group
+	 * @param linkHelperService
+	 *            the link service helper
+	 */
+	public CommonNavigatorViewActionGroup(CommonNavigator aNavigator,
+			CommonViewer aViewer, LinkHelperService linkHelperService) {
+		super(aNavigator, aViewer);
+		this.linkHelperService = linkHelperService;
+		makeViewActions();
+	}
+
+	/**
+	 * 
+	 */
+	private void makeViewActions() {
+		IHandlerService service = (IHandlerService) getCommonNavigator()
+				.getWorkbenchSite().getService(IHandlerService.class);
+
+		INavigatorViewerDescriptor viewerDescriptor = getCommonViewer()
+				.getNavigatorContentService().getViewerDescriptor();
+		boolean hideLinkWithEditorAction = viewerDescriptor
+				.getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_LINK_WITH_EDITOR_ACTION);
+		if (!hideLinkWithEditorAction) {
+			toggleLinkingAction = new LinkEditorAction(
+					(CommonNavigator) getCommonNavigator(), getCommonViewer(),
+					linkHelperService);
+			ImageDescriptor syncIcon = getImageDescriptor("elcl16/synced.gif"); //$NON-NLS-1$
+			toggleLinkingAction.setImageDescriptor(syncIcon);
+			toggleLinkingAction.setHoverImageDescriptor(syncIcon);
+			service.activateHandler(
+					toggleLinkingAction.getActionDefinitionId(),
+					new ActionHandler(toggleLinkingAction));
+		}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars
+	 * )
+	 */
+	public void fillActionBars(IActionBars theActionBars) {
+		super.fillActionBars(theActionBars);
+
+		IMenuManager menu = theActionBars.getMenuManager();
+
+		if (toggleLinkingAction != null) {
+			menu
+					.insertAfter(IWorkbenchActionConstants.MB_ADDITIONS
+							+ "-end", toggleLinkingAction); //$NON-NLS-1$
+
+			theActionBars.getToolBarManager().add(toggleLinkingAction);
+		}
+
+		theActionBars.updateActionBars();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.actions.ActionGroup#dispose()
+	 */
+	public void dispose() {
+		super.dispose();
+		if (toggleLinkingAction != null) {
+			toggleLinkingAction.dispose();
+		}
+	}
+
+}
Index: src/org/eclipse/ui/navigator/CommonNavigatorOutline.java
===================================================================
RCS file: src/org/eclipse/ui/navigator/CommonNavigatorOutline.java
diff -N src/org/eclipse/ui/navigator/CommonNavigatorOutline.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/ui/navigator/CommonNavigatorOutline.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,406 @@
+/***********************************************************************
+ * Copyright (c) 2008 Anyware Technologies
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Anyware Technologies - initial API and implementation
+ *
+ * $Id$
+ **********************************************************************/
+
+package org.eclipse.ui.navigator;
+
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.actions.ActionGroup;
+import org.eclipse.ui.internal.navigator.CommonNavigatorActionGroup;
+import org.eclipse.ui.internal.navigator.CommonNavigatorManager;
+import org.eclipse.ui.internal.navigator.CommonNavigatorMessages;
+import org.eclipse.ui.part.Page;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+/**
+ * <p>
+ * This class provides an implementation of Common Navigator hosted in an
+ * IContentOutlinePage.
+ * 
+ * </p>
+ * Clients that wish to extend the view menu provided via the
+ * <b>org.eclipse.ui.popupMenu</b>s extension may specify the the
+ * <i>popupMenuId</i> specified by <b>org.eclipse.ui.navigator.viewer</b> (or a
+ * nested <b>popupMenu</b> element) of their target viewer as their target menu
+ * id.
+ * 
+ * @since 3.5
+ */
+public abstract class CommonNavigatorOutline extends Page implements
+		IContentOutlinePage, ICommonNavigator {
+
+	private static final Class INAVIGATOR_CONTENT_SERVICE = INavigatorContentService.class;
+	private static final Class COMMON_VIEWER_CLASS = CommonViewer.class;
+
+	private CommonViewer commonViewer;
+
+	private CommonNavigatorManager commonManager;
+
+	private ActionGroup commonActionGroup;
+
+	private IMemento memento;
+
+	/**
+	 * 
+	 */
+	public CommonNavigatorOutline() {
+		super();
+	}
+
+	/**
+	 * <p>
+	 * Returns The id used to initialize the Common Viewer from extensions. It
+	 * is recommended to use the same id as the editor providing this Outline.
+	 * </p>
+	 * 
+	 * @return The Id of the Common Viewer
+	 */
+	protected abstract String getCommonViewerId();
+
+	/**
+	 * <p>
+	 * Constructs and returns an instance of {@link CommonViewer}. The ID from
+	 * <code>getCommonViewer()</code> will be used to create the viewer. The ID
+	 * is important as some extensions indicate they should only be used with a
+	 * particular viewer ID.
+	 * <p>
+	 * 
+	 * @param aParent
+	 *            A composite parent to contain the Common Viewer
+	 * @return An initialized instance of CommonViewer
+	 */
+	protected CommonViewer createCommonViewer(Composite aParent) {
+		CommonViewer aViewer = new CommonViewer(getCommonViewerId(), aParent,
+				SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+		initListeners(aViewer);
+		aViewer.getNavigatorContentService().restoreState(memento);
+		return aViewer;
+	}
+
+	/**
+	 * <p>
+	 * Adds the listeners to the Common Viewer.
+	 * </p>
+	 * 
+	 * @param viewer
+	 *            The viewer
+	 * @since 2.0
+	 */
+	protected void initListeners(TreeViewer viewer) {
+
+		viewer.addDoubleClickListener(new IDoubleClickListener() {
+
+			public void doubleClick(DoubleClickEvent event) {
+				try {
+					handleDoubleClick(event);
+				} catch (RuntimeException re) {
+					re.printStackTrace();
+				}
+			}
+		});
+	}
+
+	/**
+	 * <p>
+	 * This method can be overridden to customize the behavior of the double
+	 * click.
+	 * </p>
+	 * 
+	 * @param anEvent
+	 *            Supplied by the DoubleClick listener.
+	 */
+	protected void handleDoubleClick(DoubleClickEvent anEvent) {
+
+		IStructuredSelection selection = (IStructuredSelection) anEvent
+				.getSelection();
+		Object element = selection.getFirstElement();
+
+		TreeViewer viewer = getCommonViewer();
+		if (viewer.isExpandable(element)) {
+			viewer.setExpandedState(element, !viewer.getExpandedState(element));
+		}
+	}
+
+	/**
+	 * <p>
+	 * The Common Navigator Manager handles the setup of the Common Navigator
+	 * Menu, manages updates to the ActionBars from {@link CommonActionProvider}
+	 * &nbsp; extensions as the user's selection changes, and also updates the
+	 * status bar based on the current selection.
+	 * 
+	 * @return The Common Navigator Manager class which handles menu population
+	 *         and ActionBars
+	 */
+	protected CommonNavigatorManager createCommonManager() {
+		return new CommonNavigatorManager(this, memento);
+	}
+
+	/**
+	 * <p>
+	 * The ActionGroup is used to populate the ActionBars of Common Navigator ,
+	 * and the returned implementation will have an opportunity to fill the
+	 * ActionBars of the outline as soon as it is created. (
+	 * {@link ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)}.
+	 * </p>
+	 * <p>
+	 * The default implementation returns an action group which will add the
+	 * following actions:
+	 * <ul>
+	 * <li>
+	 * <li>
+	 * <p>
+	 * Collapse all. Collapses all expanded nodes.
+	 * </p>
+	 * <li>
+	 * <p>
+	 * Select Filters. Provides access to the "Select Filters" dialog that
+	 * allows users to enable/disable filters and also the Content Extension
+	 * activations.
+	 * </p>
+	 * </ul>
+	 * 
+	 * @return The Action Group to be associated with the Common Navigator View
+	 *         Part.
+	 */
+	protected ActionGroup createCommonActionGroup() {
+		return new CommonNavigatorActionGroup(this, commonViewer);
+	}
+
+	/**
+	 * @see org.eclipse.ui.part.Page#createControl(org.eclipse.swt.widgets.Composite)
+	 */
+	public void createControl(Composite parent) {
+		commonViewer = createCommonViewer(parent);
+
+		try {
+			commonViewer.getControl().setRedraw(false);
+
+			INavigatorFilterService filterService = commonViewer
+					.getNavigatorContentService().getFilterService();
+			ViewerFilter[] visibleFilters = filterService
+					.getVisibleFilters(true);
+			for (int i = 0; i < visibleFilters.length; i++) {
+				commonViewer.addFilter(visibleFilters[i]);
+			}
+
+			commonViewer.setSorter(new CommonViewerSorter());
+
+			/*
+			 * make sure input is set after sorters and filters to avoid
+			 * unnecessary refreshes
+			 */
+			commonViewer.setInput(getInitialInput());
+
+			getSite().setSelectionProvider(commonViewer);
+
+		} finally {
+			commonViewer.getControl().setRedraw(true);
+		}
+
+		/*
+		 * Create the CommonNavigatorManager last because information about the
+		 * state of the CommonNavigator is required for the initialization of
+		 * the CommonNavigatorManager
+		 */
+		commonManager = createCommonManager();
+		if (memento != null) {
+			commonViewer.getNavigatorContentService().restoreState(memento);
+		}
+
+		commonActionGroup = createCommonActionGroup();
+		commonActionGroup.fillActionBars(getActionBars());
+
+	}
+
+	/**
+	 * <p>
+	 * Note: This method is for internal use only. Clients should not call this
+	 * method.
+	 * </p>
+	 * <p>
+	 * This method will be invoked when the DisposeListener is notified of the
+	 * disposal of the Eclipse view part.
+	 * </p>
+	 * 
+	 * @see org.eclipse.ui.part.WorkbenchPart#dispose()
+	 */
+	public void dispose() {
+		if (commonManager != null) {
+			commonManager.dispose();
+		}
+		if (commonActionGroup != null) {
+			commonActionGroup.dispose();
+		}
+		super.dispose();
+	}
+
+	/**
+	 * @see org.eclipse.ui.part.Page#getControl()
+	 */
+	public Control getControl() {
+		return commonViewer.getControl();
+	}
+
+	/**
+	 * Returns an object which is an instance of the given class associated with
+	 * this object. Returns <code>null</code> if no such object can be found.
+	 * 
+	 * @param adapter
+	 *            the adapter class to look up
+	 * @return a object castable to the given class, or <code>null</code> if
+	 *         this object does not have an adapter for the given class
+	 */
+	public Object getAdapter(Class adapter) {
+		if (adapter == COMMON_VIEWER_CLASS) {
+			return getCommonViewer();
+		} else if (adapter == INAVIGATOR_CONTENT_SERVICE) {
+			return getCommonViewer().getNavigatorContentService();
+		}
+		return null;
+	}
+
+	/**
+	 * @see org.eclipse.ui.part.Page#setFocus()
+	 */
+	public void setFocus() {
+		if (commonViewer != null) {
+			commonViewer.getTree().setFocus();
+		}
+	}
+
+	/**
+	 * <p>
+	 * Subclasses should override this method to define the initial input of the
+	 * Common Navigator Outline.
+	 * </p>
+	 * 
+	 * @return The initial input for the viewer. Defaults to
+	 *         getSite().getPage().getInput()
+	 */
+	protected Object getInitialInput() {
+		return getSite().getPage().getInput();
+	}
+
+	/**
+	 * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
+	 */
+	public void addSelectionChangedListener(ISelectionChangedListener listener) {
+		getCommonViewer().addSelectionChangedListener(listener);
+	}
+
+	/**
+	 * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
+	 */
+	public ISelection getSelection() {
+		return getCommonViewer().getSelection();
+	}
+
+	/**
+	 * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
+	 */
+	public void removeSelectionChangedListener(
+			ISelectionChangedListener listener) {
+		getCommonViewer().removeSelectionChangedListener(listener);
+	}
+
+	/**
+	 * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
+	 */
+	public void setSelection(ISelection selection) {
+		getCommonViewer().setSelection(selection);
+	}
+
+	/**
+	 * @see org.eclipse.ui.navigator.ICommonNavigator#getActionBars()
+	 */
+	public IActionBars getActionBars() {
+		return getSite().getActionBars();
+	}
+
+	/**
+	 * @see org.eclipse.ui.navigator.ICommonNavigator#getCommonViewer()
+	 */
+	public CommonViewer getCommonViewer() {
+		return commonViewer;
+	}
+
+	/**
+	 * @see org.eclipse.ui.navigator.ICommonNavigator#getCommonViewerSite()
+	 */
+	public ICommonViewerSite getCommonViewerSite() {
+		return CommonViewerSiteFactory.createCommonViewerSite(
+				getCommonViewerId(), getSite());
+	}
+
+	/**
+	 * @return The Navigator Content Service which populates this instance of
+	 *         Common Navigator
+	 */
+	public INavigatorContentService getNavigatorContentService() {
+		return getCommonViewer().getNavigatorContentService();
+	}
+
+	/**
+	 * @see org.eclipse.ui.navigator.ICommonNavigator#getTitle()
+	 */
+	public String getTitle() {
+		return CommonNavigatorMessages.CommonNavigatorOutline_DefaultTitle;
+	}
+
+	/**
+	 * @see org.eclipse.ui.navigator.ICommonNavigator#getWorkbenchSite()
+	 */
+	public IWorkbenchSite getWorkbenchSite() {
+		return getSite();
+	}
+
+	/**
+	 * <p>
+	 * Set the selection to the Common Navigator tree, and expand nodes if
+	 * necessary. Use caution when invoking this method as it can cause
+	 * Navigator Content Extensions to load, thus causing plugin activation.
+	 * </p>
+	 * 
+	 * @see org.eclipse.ui.part.ISetSelectionTarget#selectReveal(org.eclipse.jface.viewers.ISelection)
+	 */
+	public void selectReveal(ISelection selection) {
+		if (commonViewer != null) {
+			if (selection instanceof IStructuredSelection) {
+				Object[] newSelection = ((IStructuredSelection) selection)
+						.toArray();
+				Object[] expandedElements = commonViewer.getExpandedElements();
+				Object[] newExpandedElements = new Object[newSelection.length
+						+ expandedElements.length];
+				System.arraycopy(expandedElements, 0, newExpandedElements, 0,
+						expandedElements.length);
+				System.arraycopy(newSelection, 0, newExpandedElements,
+						expandedElements.length, newSelection.length);
+				commonViewer.setExpandedElements(newExpandedElements);
+			}
+			commonViewer.setSelection(selection, true);
+		}
+	}
+
+}

Back to the top