Skip to content

vyacheslav-gurov/EclipsePlugins-UI-Extensions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

[ English ] | [ На руском ]

Eclipse Plugins (UI-Extensions)

In this repository, I collect the sources for the Plug-in Project Eclipse, demonstrating the creation/configuration of various UI extensions for Eclipse. The material is designed primarily for beginners.

Eclipse EE Version: 2018-09 (4.9.0) Java 1.8.0_191

  1. View
  2. Property Page
  3. Common Navigator

1. View

This is an example of the simplest implementation of the org.eclipse.ui.views extension. To open View, click Window> Show View > Other ... > Category Simple View> Simple View

Plugins.xml has <extension point="org.eclipse.ui.views">, which contains the settings for the view. The class field indicates the implementation of this view. It is located in the package org.evilbit.simpleview, it is an elementary class SimpleViewClass extending ViewPart.

Result:

Picture Picture

An example implementation of the org.eclipse.ui.propertyPages extension. Property Pages can be opened in the following way: in ProjectExplorer, for example on a project, call the context menu, select the lowest menu item Properties and there we will see our Sample PropertyPage.

Plugins.xml has a <extension point="org.eclipse.ui.propertyPages"> that contains the settings for the page. In the class field, the implementation for propertyPages is indicated; it is in the package org.evilbit.propertypage.

Result:

Picture Picture

3. Common Navigator

Implementation example Navigator View through the extension org.eclipse.ui.views and org.eclipse.ui.navigator.viewer. To open View, click Window > Show View > Other ...> Category custom plugin views> Project Explorer

All settings for displaying content are in plugins.xml. Content is displayed through View with Id = "org.evilbit.navigator.views.ProjectExplorerId". Settings for displaying content are in the extension <extension point = "org.eclipse.ui.navigator.viewer">.

Source: http://codexe.net/eclipse/create-a-common-navigator.html

Result:

Picture

Add the org.eclipse.ui.navigator.navigatorContent extension. We specify the class NavigatorFilter extending org.eclipse.jface.viewers.ViewerFilter. Set up filtering in the NavigatorFilter class, hide the display of Java projects.

Source: http://codexe.net/eclipse/add-filter-to-common-navigator.html

Result:

Picture

Let's make some settings in org.eclipse.ui.navigator.viewer and org.eclipse.ui.navigator.navigatorContent. The essence of the settings is as follows: Common navigator will display resource objects (what we already have) and our own type PropertiesTreeData. NavigatorContentProvider will create our nodes of type PropertiesTreeData, and NavigatorLabelProvider will create icons and labels.

Source: http://codexe.net/eclipse/add-contents-to-common-navigator.html

Result:

Picture

Let's create our own data structure, the child node will be described in the PropertiesTreeData class, and the parent in the PropertiesTreeParentData class extended from PropertiesTreeData. The data structure will create the PropertiesTreeRootData class. It is also necessary to make small changes to existing classes, such as: NavigatorContentProvider, NavigatorLabelProvider and NavigatorFilter.

Source: http://codexe.net/eclipse/show-custom-data-on-navigator.html

Result:

Picture

In the NavigatorActionProvider class, the context menu is initialized, and in the AddNodeAction class, we determine the conditions for the activity of the menu item and the action that will be performed.

Source: http://codexe.net/eclipse/add-menu-to-common-navigator.html

Result:

Picture

Sorting is implemented in the NavigatorSorter class in the overridden compare method. The method will retrieve numbers from host names and sort them in reverse order. Sorting will happen automatically immediately after receiving the children using the getChildren (Object parentElement) method.

Source: http://codexe.net/eclipse/add-sorter-to-common-navigator.html

Result:

Picture

Source: http://codexe.net/eclipse/create-tabbed-property-view.html

Result:

Picture

Releases

No releases published

Packages

No packages published

Languages