Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 270042
Collapse All | Expand All

(-)guide/cnf.htm (-1 / +89 lines)
Lines 3-9 Link Here
3
<HEAD>
3
<HEAD>
4
4
5
<meta name="copyright"
5
<meta name="copyright"
6
	content="Copyright (c) Oakland Software and others 2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.">
6
	content="Copyright (c) Oakland Software and others 2008, 2009. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.">
7
7
8
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
8
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
9
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
9
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
Lines 17-22 Link Here
17
<BODY BGCOLOR="#ffffff">
17
<BODY BGCOLOR="#ffffff">
18
<H1>Common Navigator Framework</H1>
18
<H1>Common Navigator Framework</H1>
19
19
20
<p>A Viewer provides the user with a view of objects using a single
21
content provider, label provider, sorter and filter. The Common
22
Navigator Framework (CNF) extends this idea by allowing a single view to
23
dynamically use multiple and unrelated sets of content providers, label
24
providers, sorters and filters. These can be activated in the view
25
depending on declarative expressions or using API calls.
26
The CNF implemented by the <b><a
27
	href="../reference/api/org/eclipse/ui/navigator/package-summary.html">
28
org.eclipse.ui.navigator</a></b> plugin.</p>
29
30
<p>The CNF uses the idea of <i>Navigator Content Extensions</i>
31
(NCE) which can refer to a content provider, label provider, sorter, or
32
drag adaptor (note that filters are configured separately). An NCE has
33
associated expressions that tell it when it is active. NCEs are also
34
presented to the user in the view context menu so that user can turn
35
them on or off in order to show the view in different ways. Examples of
36
NCEs are a resource content extension that controls how resources are
37
presented and Java content extension that shows Java projects. In the
38
IDE's Project Explorer, you can turn off the Java content extension
39
getting a pure resource view of the workspace.</p>
40
41
<p>By using the NCEs it's possible to include different <i>model objects</i> directly 
42
in the view.  These model objects might be related in a cascading fashion.  For example
43
a resource object (an <code>IFile</code>) might refer to a Java class object.  This Java class
44
object can be presented directly in the view by defining an NCE.  The Java class object
45
can have children (representing methods, fields, etc) all of which appear in the view.
46
You can then add another NCE to display model objects related to the Java (or resource
47
object) that display content related to a Java Server Page object.  This can
48
all be done without the "lower level" NCEs (resources, Java) being aware of the existence of the "outer" NCEs (JSP).
49
Further, it's possible for outer NCEs to override by suppressing processing associated with 
50
lower level NCEs according to their requirements.  And even further, it's possible (using 
51
the pipelining mechanism) for even level in this cascaded set of NCEs to arrange the presentation
52
of the objects according to their specifications, moving, adding, or suppressing objects as necessary.
53
</p>
54
55
<p>???The CNF has depends only on <code>org.eclipse.ui</code> 
56
and is suitable for use both within the IDE and in an RCP application.</p>
57
58
<p>The CNF is highly configurable and many of its components can be used separately (though this is not
59
the typical case).  For example,
60
it's possible use the service that manages content extensions with a viewer other than the standard
61
<code>CommonViewer</code>.  </p>
62
63
64
<h2>Major Components of the Common Navigator Framework</h2>
65
66
<p>The CNF has the following major parts:</p>
67
<ol>
68
	<li><b>View Part</b> - <b><a
69
		href="../reference/api/org/eclipse/ui/navigator/CommonNavigator.html">CommonNavigator
70
	</a></b>.</li>
71
	<li><b>Viewer</b> -<b><a
72
		href="../reference/api/org/eclipse/ui/navigator/CommonViewer.html">CommonViewer
73
	</a></b> the implementation of a viewer that is contained in the above view
74
	part.</li>
75
	<li><b>Navigator Content Service</b> - <b><a
76
		href="../reference/api/org/eclipse/ui/navigator/INavigatorContentService.html">INavigatorContentService
77
	</a></b> a service that manages content extensions and allows them to be
78
	discovered based on objects associated with a viewer. Most users do not
79
	interact directly with the Content Service, but it is possible to use
80
	it independently from the common navigator view part.</li>
81
</ol>
82
83
<h2>Navigators - Where the CNF Fits</h2>
84
85
<p>There are currently 3 major navigators in the Eclipse IDE.</p>
86
<ol>
87
<li><b>Project Explorer</b> - This is an instance of the CommonNavigator that is provided by the  <b><a
88
	href="../reference/api/org/eclipse/ui/navigator/resources/package-summary.html">
89
org.eclipse.ui.navigator.resources</a></b> plugin.  It provides a view of the workspace
90
and has a large number of NCEs contributed for resources, Java, C, Web Tools, Data Tools, PHP, etc.</li>
91
<li>
92
<b>Package Explorer</b> - Provided by the Java Development Tools (JDT) UI project, this provides
93
a view of Java classes for the workspace.  Generally speaking, the presentation of the Package Explorer 
94
and Project Explorer for Java objects is substantially similar.  The JDT is not used for projects beyond Java.
95
</li>
96
<li><b>Navigator</b> - This view is an implementation of the now deprecated (as of 3.5) 
97
ResourceNavigator class
98
provided in the <code>org.eclipse.ui.ide</code> plugin.  It shows only the workspace resources and does not
99
support extensibility to show other content.  In a future release, the Navigator view will 
100
be provided by an implementation of the CommonNavigator.
101
</li>
102
</ol>
103
<p>The only navigator intended for general purpose client use if the CNF, which can be used
104
either by adding NCEs visable in the Project Explorer (if developing an IDE plugin), or using a
105
separate instance of the CommonNavigator as a view.</p>
106
107
20
108
21
<p>The Common Navigator Framework (CNF) provides a general purpose
109
<p>The Common Navigator Framework (CNF) provides a general purpose
22
configurable navigator view which can be shared by many applications
110
configurable navigator view which can be shared by many applications
(-)guide/cnf_steps_rcp.htm (+119 lines)
Added Link Here
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML>
3
<HEAD>
4
5
<meta name="copyright"
6
	content="Copyright (c) Oakland Software and others 2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.">
7
8
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
9
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
10
11
<LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1"
12
	TYPE="text/css">
13
<TITLE>Using the Common Navigator in an RCP Application</TITLE>
14
15
<link rel="stylesheet" type="text/css" HREF="../book.css">
16
</HEAD>
17
<BODY BGCOLOR="#ffffff">
18
<h1>Using the Common Navigator in an RCP Application</h1>
19
20
<p>
21
To add the Common Navigator to an RCP application and have it manipulate the
22
workspace resources, first follow the <a href="cnf_steps_resources.htm">steps</a>
23
and then follow these.  If you don't want to have the CN to use resources, omit
24
the resources steps.
25
</p>
26
27
<ol>
28
<li>
29
Add the following as dependent plug-ins:
30
<ol type="a">
31
<li>org.eclipse.ui.navigator</li>
32
</ol>
33
</li>
34
<li>Add a View extension (org.eclipse.ui.views) which uses the class org.eclipse.ui.navigator.CommonNavigator.
35
<pre>
36
   &lt;extension
37
         point="org.eclipse.ui.views"&gt;
38
      &lt;view
39
            name="View"
40
            class="org.eclipse.ui.navigator.CommonNavigator"
41
            id="example.view"&gt;
42
      &lt;/view&gt;
43
   &lt;/extension&gt;
44
</pre>
45
</li>
46
<li>Update your perspective factory (IPerspectiveFactory) code to show the new View (this is necessary when adding any View):
47
48
<pre>
49
	public void createInitialLayout(IPageLayout layout) {
50
		String editorArea = layout.getEditorArea();
51
		layout.setEditorAreaVisible(false);
52
		layout.setFixed(true);
53
		
54
		layout.addStandaloneView("example.view",  true /* show title */, IPageLayout.LEFT, 1.0f, editorArea);
55
	}
56
</pre>
57
58
<p>
59
Note that for the moment you need to specify "true" to show title, otherwise the viewer will not render correctly
60
(<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235171">bug 235171</a>).</p>
61
</li>
62
<li>
63
Add a org.eclipse.ui.navigator.viewer extension that has:
64
<ul>
65
<li>viewerContentBinding, point this to your View Id above (example.view)
66
<ul>
67
<li>includes of:
68
<ul>
69
<li>com.yourcompany.yourapp.yournav.*</li>
70
</ul>
71
</li>
72
</ul>
73
</li>
74
</ul>
75
76
<pre>
77
78
   &lt;extension
79
         point="org.eclipse.ui.navigator.viewer"&gt;
80
       &lt;viewerContentBinding 
81
            viewerId="example.view"&gt;
82
          &lt;includes&gt;
83
       	     &lt;contentExtension pattern="com.yourcompany.yourapp.yournav.*" /&gt;		       	      
84
          &lt;/includes&gt;
85
       &lt;/viewerContentBinding&gt;
86
   &lt;/extension&gt;
87
</pre>
88
</li>
89
90
<li>Add navigator content extensions as required:
91
</li>
92
93
<li>If you need resources, add the following to your WorkbenchAdvisor
94
95
<ol type="a">
96
<li>To get the resource workspace as input, override this method:
97
98
<pre>
99
	public IAdaptable getDefaultPageInput() {
100
		IWorkspace workspace = ResourcesPlugin.getWorkspace();
101
		return workspace.getRoot();
102
	}
103
</pre>
104
</li>
105
<li>If you need resources, you need to have the workbench adapters correctly hooked up, so
106
add this code to the initialize() method:
107
108
<pre>
109
	public void initialize(IWorkbenchConfigurer configurer) {
110
		IDE.registerAdapters();
111
	}
112
</pre>
113
114
</li>
115
</ol>
116
</li>
117
</ol>
118
</BODY>
119
</HTML>
(-)guide/cnf_steps_contents.htm (+38 lines)
Added Link Here
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML>
3
<HEAD>
4
5
<meta name="copyright"
6
	content="Copyright (c) Oakland Software and others 2009. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.">
7
8
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
9
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
10
11
<LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1"
12
	TYPE="text/css">
13
<TITLE>Configuring the Common Navigator</TITLE>
14
</HEAD>
15
<BODY BGCOLOR="#ffffff">
16
17
<h1>Procedures for Using the CNF</h1>
18
19
<p>The sections below define the set of steps for using the CNF 
20
in various scenarios.
21
Some of the sets of below have a plugin in the UI examples
22
that shows the end result.
23
</p>
24
25
<p>
26
<ul>
27
<li><a href="cnf_steps_resources.htm">Using only Resources</a>
28
 (<code>org.eclipse.ui.examples.navigators.resources</code>)</li>
29
<li><a href="cnf_steps_rcp.htm">Using with an RCP Application</a></li>
30
<li><a href="cnf_steps_rn_migration.htm">Migrating from the ResourceNavigator</a></li>
31
<li><a href="cnf_steps_resources.htm">Using Resources Combined with Model Objects</a>
32
 (<code>org.eclipse.ui.examples.navigators.properties</code>)</li>
33
</ul>
34
</p>
35
36
37
</BODY>
38
</HTML>
(-)guide/cnf_steps_resources.htm (+97 lines)
Added Link Here
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML>
3
<HEAD>
4
5
<meta name="copyright"
6
	content="Copyright (c) Oakland Software and others 2008, 2009. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.">
7
8
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
9
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
10
11
<LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1"
12
	TYPE="text/css">
13
<TITLE>Using the Common Navigator with Resources</TITLE>
14
15
<link rel="stylesheet" type="text/css" HREF="../book.css">
16
</HEAD>
17
<BODY BGCOLOR="#ffffff">
18
<h1>Using the Common Navigator with Resources</h1>
19
20
<p>
21
To create a Common Navigator view that manipulates workspace resources
22
(in the IDE) use the steps below.  These steps can also be applied to an RCP application, but 
23
you will also need to do the some additional <a href="cnf_steps_rcp.htm">work</a>.  You don't need to
24
use any code at all to do this.
25
</p>
26
27
<p>The example plugin <code>org.eclipse.ui.examples.navigators.resources</code> shows this.
28
</p>
29
30
<ol>
31
<li>
32
Add the following as dependent plug-ins:
33
<ol type="a">
34
<li>org.eclipse.ui.navigator</li>
35
<li>org.eclipse.ui.navigator.resources</li>
36
</ol>
37
</li>
38
<li>Add a View extension (org.eclipse.ui.views) which uses the class org.eclipse.ui.navigator.CommonNavigator.
39
<pre>
40
   &lt;extension
41
         point="org.eclipse.ui.views"&gt;
42
      &lt;view
43
            name="View"
44
            class="org.eclipse.ui.navigator.CommonNavigator"
45
            id="example.view"&gt;
46
      &lt;/view&gt;
47
   &lt;/extension&gt;
48
</pre>
49
</li>
50
51
<li>
52
Add a org.eclipse.ui.navigator.viewer extension that has:
53
<ul>
54
<li>viewerActionBinding, point this to your View Id above (example.view)
55
<ul>
56
<li>includes of org.eclipse.ui.navigator.resources</li>
57
</ul>
58
</li>
59
<li>viewerContentBinding, point this to your View Id above (example.view)
60
<ul>
61
<li>includes of:
62
<ul>
63
<li>org.eclipse.ui.navigator.resources</li>
64
<li>org.eclipse.ui.navigator.resourceContent</li>
65
<li>org.eclipse.ui.navigator.resources.*</li>
66
</ul>
67
</li>
68
</ul>
69
</li>
70
</ul>
71
72
<pre>
73
74
   &lt;extension
75
         point="org.eclipse.ui.navigator.viewer"&gt;
76
       &lt;viewerActionBinding
77
            viewerId="example.view"&gt;
78
         &lt;includes&gt;
79
             &lt;actionExtension pattern="org.eclipse.ui.navigator.resources.*" /&gt;
80
         &lt;/includes&gt;
81
       &lt;/viewerActionBinding&gt;
82
       &lt;viewerContentBinding 
83
            viewerId="example.view"&gt;
84
          &lt;includes&gt;
85
       	     &lt;contentExtension pattern="org.eclipse.ui.navigator.resourceContent" /&gt;		       	      
86
	     &lt;contentExtension pattern="org.eclipse.ui.navigator.resources.filters.*"/&gt;
87
          &lt;/includes&gt;
88
       &lt;/viewerContentBinding&gt;
89
   &lt;/extension&gt;
90
</pre>
91
</li>
92
93
</ol>
94
</li>
95
</ol>
96
</BODY>
97
</HTML>
(-)guide/cnf_steps_rn_migration.htm (+97 lines)
Added Link Here
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML>
3
<HEAD>
4
5
<meta name="copyright"
6
	content="Copyright (c) Oakland Software and others 2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.">
7
8
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
9
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
10
11
<LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1"
12
	TYPE="text/css">
13
<TITLE>Migrating from the ResourceNavigator</TITLE>
14
15
<link rel="stylesheet" type="text/css" HREF="../book.css">
16
</HEAD>
17
<BODY BGCOLOR="#ffffff">
18
<h1>Migrating from the ResourceNavigator</h1>
19
20
<p>
21
First follow the steps to add the Common Navigator for <a href="cnf_steps_resources.htm">resources</a>.
22
If your application is an RCP application, also do the <a href="cnf_steps_resources.htm">RCP steps</a>.
23
</p>
24
25
<p>The following steps discuss the migration component for each part of the ResourceNavigator</p>
26
27
<ol>
28
<li>
29
<code>org.eclipse.ui.ide.resourceFilters</code>
30
<p>
31
Add the corresponding 
32
<b><a href="../reference/extension-points/org_eclipse_ui_navigator_navigatorContent.html">org.eclipse.ui.navigator.navigatorContent/commonFilter</a></b>
33
extensions.
34
</p>
35
</li>
36
37
<li>
38
<code>FrameList</code> support <code>get/setFrameList()</code>
39
<p>
40
The FrameList support is used for the Go Into functionality.  Support for this 
41
is included in the ProjectExplorer subclass of CommonNavigator.  You should subclass ProjectExplorer
42
instead of CommonNavigator. 
43
</p>
44
</li>
45
46
47
<li>
48
49
<code>ResourcePatternFilter</code> support <code>get/setPatternFilter()</code>
50
<p>
51
Configure the ResourcePatternFilter using the 
52
<b><a href="../reference/extension-points/org_eclipse_ui_navigator_navigatorContent.html">org.eclipse.ui.navigator.navigatorContent/commonFilter</a></b>
53
extension.  Then you can access the instance of the filter using the following code (where <code>yourViewer</code> is the instance
54
of the CommonViewer and <code>yourFilterId</code> is the string of the Id of your common filter configured above:
55
<pre>
56
INavigatorContentService contentService = yourViewer.getNavigatorContentService();
57
INavigatorFilterService filterService = contentService.getFilterService();
58
ICommonFilterDescriptor[] fds = filterService.getVisibleFilterDescriptors();
59
for (int i = i; i < fds.length; i++) {
60
	if (fds[i].getId().equals(yourFilterId))
61
		return filterService.getViewerFilter(filterDescriptor);
62
}
63
</pre>
64
</p>
65
<p>
66
Note:
67
(??? possibly don't deprecate ResourcePatternFilter, or move this into 
68
org.eclipse.ui.navigator.resources as it is; this class does not depend on ResourceNavigator.)
69
</p>
70
</li>
71
72
<li>
73
<code>IWorkingSet</code> support <code>get/setWorkingSet()</code>
74
<p>
75
??? figure out the corresponding ProjectExplorer way to do this.
76
</p>
77
</li>
78
79
<li>
80
<code>ResourceSorter</code> support <code>get/setResourceSorter()</code>
81
<p>
82
??? Similar to the filter service.
83
</p>
84
</li>
85
86
<li>
87
<code>ResourceComparator</code> support <code>get/setResourceComparator()</code>
88
<p>
89
??? Have to use ResourceSorter instead for now as the CN does not directly support
90
ResourceComparators
91
</p>
92
</li>
93
94
</ol>
95
96
</BODY>
97
</HTML>

Return to bug 270042