Using Eclipse's Navigator link Helper to implement the Navigator's association with the editor

Source: Internet
Author: User
Tags file system resource

Implement Linkhelper

In the last example, after extending all kinds of extension points in plugin.xml, we can actually do some of the things that project Explorer has done with this com.example.test view, such as creating projects, folders , files, etc., which are implemented through reuse of navigatorcontent.

Another area to note is that, in this view of our implementation, Iresource acts as a direct interface to CNF and also acts as a model for the business Scenario "project/Folder/file". (This is why the new structedselection (file) in Linkhelper can navigate directly to the node in the Navigator)

But in the actual project development process, not every business model is as easy to show as the file system. For example, the Package concept in Java needs to be presented in a way that combines multiple folders into a single tree node (in the middle with a "." Partition), and the jar package also needs to be internally decompressed to present its internal tree structure.

So typically, the business model has a separate abstract representation and serves as a direct interface to the CNF. Its advantages are:

All changes to the model on the Eclipse UI are first passed to the domain model itself and then persisted to the operating system through Iresource. Changes to the model and the transfer of changes are more direct. As shown in Figure 6.

Figure 6. Resource Management in Eclipse

The same set of resource files, through different perspectives need to have different presentation, operation and storage. For example, a Java project is presented and manipulated in Package Explorer in a way that is closer to Java development, while Resource Explorer displays all folders and files in an operating system perspective. The point of view of resources here is the things to consider when building a business model.

Next, we will add our own business model layer on the basis of the previous example. Although in the case of files and folders, the existence of this layer is of little significance, but it can be used for reference by readers in solving specific work.

We modeled a Custom.linkwitheditor.sample plug-in project on the previous example, but this time we will implement most of our functionality and join a specific business model layer.

First change the view ID to Custom.linkwitheditor.view.myCustomNavigatorView and add an icon.

Delete the vieweractionbindin--under Org.eclipse.ui.navigator.viewer extension This means that in this example we do not extend any action,context menus etc.

Delete the viewercontentbinding--in the org.eclipse.ui.navigator.viewer extension for a while we will create our own implementation of navigatorcontent and Linkhelper.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.