没有合适的资源?快使用搜索试试~ 我知道了~
CNF导航----building-common-navigator-framework-viewer
5星 · 超过95%的资源 需积分: 10 9 下载量 121 浏览量
2011-12-27
15:59:20
上传
评论
收藏 447KB PDF 举报
温馨提示
试读
12页
CNF 学习必备,很好的资源啊,CNF导航----building-common-navigator-framework-viewer
资源推荐
资源详情
资源评论
Digital Paper Napkin
http://scribbledideas.blogspot.com/
The opinions and ideas expressed herin are my own and do not represent the intent, opinion, or official statement of any company or
organization.
All postings by me to this site are copyrighted (C) by Michael D. Elder, 2006 and made available under the terms of the Eclipse Public
License 1.0 with the constraint that any reuse of the content must contain this copyright statement.
Building a Common Navigator Framework (CNF) Viewer
Part I: Defining the View Part
IMAGINATION IS THE BEGINNING OF CREATION. YOU IMAGINE WHAT YOU DESIRE, YOU WILL WHAT YOU
IMAGINE AND AT LAST YOU CREATE WHAT YOU WILL.
-- GEORGE BERNARD SHAW
I've started fielding questions about the Common Navigator on the eclipse.platform
newsgroup and the message from the community is resoundingly that there are not
enough examples. In order to help the community adopt the Common Navigator
framework, I'm going to be fleshing out some examples (in the Eclipse repo at
dev.eclipse.org:/home/eclipse, where you can login as "anonymous"; see the wiki for
more information. I will be documenting these examples here in this blog. Eventually I
will intgrate the documentation that evolves here back into the Platform SDK, but I want
a forum where potential consumers can provide feedback easily and directly to the
distribution media (e.g. this blog).
Specific documentation on the extension points and API is available in the Eclipse
Platform Help (Help > Help Content) under the Platform Plug-in Developer's Guide >
Reference > API Reference | Extension Points Reference. The relevant extension points
are org.eclipse.ui.navigator.viewer and
org.eclipse.ui.navigator.navigatorContent. The relevant API packages are
org.eclipse.ui.navigator. If you'd like more details on the specifics mentioned in this
post, please follow up with these references.
So where to begin? First we're going to configure our plugin that will contain the viewer
to add org.eclipse.ui.navigator to its dependencies. Then we're going to define a view
part using the org.eclipse.ui.views extension point and specify the
org.eclipse.ui.navigator.CommonNavigator class as our view part implementation,
Digital Paper Napkin
http://scribbledideas.blogspot.com/
The opinions and ideas expressed herin are my own and do not represent the intent, opinion, or official statement of any company or
organization.
All postings by me to this site are copyrighted (C) by Michael D. Elder, 2006 and made available under the terms of the Eclipse Public
License 1.0 with the constraint that any reuse of the content must contain this copyright statement.
which will provide a cradle for our viewer. Then we will define a
org.eclipse.ui.navigator.viewer extension to configure the viewer as a Common
Navigator. Finally, we can define org.eclipse.ui.navigator.navigatorContent
extensions along with bindings
(org.eclipse.ui.navigator.viewer/viewerContentBinding) to associate extensions
with our viewer.
You don't have to use org.eclipse.ui.navigator.CommonNavigator in order to take
advantage of the framework; you could embed content using the
org.eclipse.ui.navigator.INavigatorContentService virtually anywhere from dialogs
to editors or define your own viewer and view part class, but for this example, we're
going to stick to the basics.
Basic Setup
The Common Navigator Framework is a feature that is new to Eclipse 3.2. Therefore,
you must have an update to Eclipse 3.2 environment installed. The topic of this post will
not get into setting up Eclipse for self-hosting development. I assume that you have
Eclipse 3.2 setup and are either self-hosting against a target of your own choice or the
default.
Before we do anything, we need to make sure that we have our plugin configured with
the necessary dependencies. Either create a new Plugin (File> New> Project: Plug-in
Development> Plug-in Project: Set the name and accept the defaults), or open up the
Plug-in Manfiest Editor (select the "plugin.xml" file in your viewer of choice (Project
Explorer, Package Explorer, Navigator, etc) and double-click or right-click and select
Open With> Plug-in Manifest Editor. On the Dependencies tab, click Add... and begin
typing org.eclipse.ui.navigator and select it when it is highlighted or when you see it
in the list.
Now select the Extensions tab of the editor.
Digital Paper Napkin
http://scribbledideas.blogspot.com/
The opinions and ideas expressed herin are my own and do not represent the intent, opinion, or official statement of any company or
organization.
All postings by me to this site are copyrighted (C) by Michael D. Elder, 2006 and made available under the terms of the Eclipse Public
License 1.0 with the constraint that any reuse of the content must contain this copyright statement.
Defining the View Part
When defining a Common Navigator enabled viewer, you must declare the actual view
part. A view part is the container for our viewer; it has a tab handle with a label, a place
for a view menu (the little triangle in the top right corner of the view part), and can
contain any widget that we need to display to the end user. Eclipse view parts are
defined by the org.eclipse.ui.views extension point. View parts are not specific to
Common Navigator Framework viewers, we just need a cradle to hold our viewer.
You can define the view through the Extensions tab by selecting Add... and begin typing
org.eclipse.ui.views until you see it in the list. Then right-click on the entry that is
created under the "All Extensions" tree named org.eclipse.ui.views and choose New >
view. This will create the element in the plugin.xml file.
When you select the view element, the available attributes for the element should
appear as editable textboxes and widgets on the right. We are going to enter the
following values (without the quotes):
id: "org.eclipse.ui.examples.navigator.view"
name: "Example View"
class: "org.eclipse.ui.navigator.CommonNavigator"
icon: "icons/filenav_nav.gif" (or your own)
allowMultiple: false
Now select the "plugin.xml" tab of the editor. You should see something like the
following. You can choose to create a category as in the diagram, but be sure to indicate
which category your viewer should be associated with by specifying the "category"
attribute of the viewer. Otherwise, your viewer will appear in the Other category of the
Show View dialog (Window > Show View > Other...).
剩余11页未读,继续阅读
资源评论
- 泉州奇趣2013-08-03讲的很系统 值了
dui_cky
- 粉丝: 39
- 资源: 21
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功