How to control Eclipse feature (3)

xiaoxiao2021-03-06  97

Organizational function

When you have developed your tool, do you consider how many plugins do you need? The answer is at least three: one is your model, that is, the core part of the non-UI, one is your UI content, and one or more is used to provide help. If you pay attention, you will find that this is the basic mode of Eclipse itself (JDT.core, JDT.UI, JDT.Doc; debug.core, debug.ui; etc.).

One of the reasons why this is that the plug-in for the UI requires a different Eclipse component support relative to the plug-in not for the UI, org.eclipse.ui.

Contains other features

Functional components are not included in the Eclipse configuration if they are not included in the Eclipse configuration. By default, the root functionality can be disabled or enabled by the user in the Install / Update perspective, and you can determine a URL in the feature.xml file. When a functional component is included, only the update URL in the root feature unit will be processed, otherwise it can only be defined by Search-Location.

By including the functional components, you can manage the organizational structure of the package. You may have multiple features, but there is only one identifier, the rest or is used to constitute a structure, or to manage components. Keep in mind that the root function component defines the updated site, although this role can be delegated to the functional components contained in the function, by setting the search-location attribute value Selfboth.

If you are building an eclipse-based product, you may want your feature to include the Eclipse feature tree. This does not need to identify this product, but you can specify another update site (Eclipse itself is

http://update.eclipse.org/updates), or do not specify an update site at all, disable web-based updates.

Optional feature role

When a functional component contains another feature, you can choose whether it is set to optional. The main reason is that the creation of such a structure allows users to disable part of the components you provide according to his own needs.

When the new features include optional features, those optional features do not exist, the Eclipse configuration logic does not allow this new feature. That is, if appropriate prerequisites are established, optional features can be used to create a layer structure. However, these layers need to be stored under different directory trees and each layer uses a separate linked file. You can add a limited number of restrictions on the Eclipse configuration to increase their features.

Let Eclipse (or any Eclipse-based products) work in your way

Now, two points are now explained: The specified primary feature controls the identity and default properties of the entire product, and Eclipse can find components under the installation configuration directory or any link. This means you can change Eclipse (there is related risk, but just mean you when you modify it!). These changes can help you manage Eclipse-based installation configurations and support it to support your personal preferences.

Use link files to manage Eclipse installation configuration

You may want to manage more management, not all plugins (I hope to be referenced by the features), without choice to install all of your plipse directory tree. If you need to update Eclipse, you don't want to add a new Eclipse or look for the features and plugins you want in the list.

Below is a way to organize your Eclipse or Eclipse-based products and components with link files: • Keep Eclipse or Eclipse-based products is clean. That is, don't add any of your functional components or plugins to the Eclipse / Features and Eclipse / Plugins directory.

• Create an Eclipse / Links directory and an Eclipse / Links-Out directory in an existing Eclipse directory. If you use an Eclipse-based product, there may already have an Eclipse / Links-Out directory. This catalog is not special, just a place to facilitate the storage of unused link files.

• Create one or more add-Ons directories for the features and plugins you want to add to your configuration. Under these directories, create an Eclipse / FeatureS and an Eclipse / PLUGINS directory structure.

· Create a link file for each add-overs directory in the Eclipse / Links-Out directory. Copy the link files you currently have to your activity configuration to the Eclipse / Links directory.

For example, assume that you extract Eclipse to a directory named Eclipse-2.1.1, then create a Add-ons directory called CoolTools, and placed in the Eclipse-2.1.1 directory. In the CoolTools directory, you can have multiple directories, each directory for one or a tool you want to add to the Eclipse. Your directory structure may be shown in Figure 3.

Figure 3. Link file directory structure of Eclipse

EditorList.Link files To include one of them (not all)

Path = D: /Eclipse-2.1.1/cooltools/editorList

PATH = D: //eclipse-2.1.1//cooltools//editorList

The slash is a (/) or two (//) depends on the directory structure. Confirm that the entry should not end with spaces, because this Eclipse will ignore it - I used a link file for the first time to understand this.

If you use a new workspace to launch Eclipse, all Eclipse comes with features and plugins found through link files are available. If you want to add a link file and restart the Eclipse using an existing workspace, the Configuration Changes dialog box will pop up. If you delete a link file (very simple, just move it to the / links-out directory), the configuration changes will also be noted by Eclipse, but you can see just splash-flash.

In fact, you don't have to move the link file into the transfer to control the configuration, and better ways to use the Install / Update perspective to adjust the configuration. Of course, the premise that you can do is that your plugin belongs to the feature (see, this is another reason for the functional components). Adjustments configured using Eclipse will be discussed later.

Modify the configuration using the Install / Update perspective

Root function components, as well as any defined feature, can be disabled in the current configuration. After being disabled, the functionality can still be recognized by the platform; they are only no longer included in the current runtime configuration.

Let's talk about adding Eclipse Examples to the active configuration. After adding, we can use the Install / Update perspective to disable it. If you are opening an install / update perspective that contains Eclipse Examples configured, you will see as shown in Figure 4.

Figure 4. Eclipse Examples feature in the Install / Update perspective Click the Disable Now button in the Preview view, you can temporarily remove the Eclipse Examples feature from the runtime configuration. After clicking, Eclipse will prompt you to restart the platform to make the configured changes.

The Eclipse Examples feature will no longer visible in the current configuration (or not active). In order to see this feature again and enable, you need to click the Show Disabled Features switch button in the Install Configuration view (see Figure 5).

Figure 5. Disable Eclipse Examples feature in the install / update perspective

Since the Eclipse Examples feature is a root functionality, you can do this. If you browse other features in the Eclipse SDK, you will find that they have no corresponding disable now buttons in the Preview view, because they are defined as required.

If you use Eclipse SDK, you should have a default configuration platform, JDT, and PDE. If you are doing some plug-ins, you don't need PDE - or in some cases, you don't need JDT - you can disable these features as long as you do a small modification for Eclipse. Open the feature.xml file of the org.eclipse.platform.sdk.win32 feature, modify the following lines to contain optional = "true" properties.

Listing 1. Disable PDE and JDT

Version = "2.1.1" match = "equivalent" />

match = "equivalent" optional = "true" />

match = "equivalent" optional = "true" />

Version = "2.1.1" match = "Equivalent"

Optional = "true" />

match = "equivalent" optional = "true" />

Now you can select these features and disable them in the Install Configuration view. If all previously mentioned those defined as optional features are disabled, the platform can still be run. Also, you can re-enable them at any time. Figure 6 is a disabled feature displayed in the Install Configuration view.

Figure 6. Disable Eclipse multiple features

These disabled / enabled settings are only valid for the current workspace. You can have additional activity workspaces, which contain some or all of the features that are disabled in the current workspace. This simple example illustrates the advantages of using the functional components (they can be disabled) and using link files to add all possible features to your configuration. Disable the features you don't need in a given work area so you can optimize the current configuration. Define your own global properties Eclipse is an excellent tool, but like any tool, you have to customize it, it can be perfect. Tools provide property pages to allow you to change the behavior or visual display of the tool. Latest statistics, there are 62 attributes pages in Eclipse. Almost every time you use a new tool, you will find some options you want to modify. But when you use multiple workspaces, or in a team's environment, some options need to be coordinated with others, so that there is a best management of the options in cross-workspace and coordination with others. problem. Eclipse provides features for import / export properties. In any property dialog box, you can export attributes into a .epf file. This file can be imported again when using other workspaces or sharing with others. You can even add it to the project with team members so that everyone can get standard properties. But this will become monotonous and boring, and if you have forgotten, you will be troublesome. When using Eclipse or any Eclipse-based product, you should realize that there is another method to define global properties. You can customize the default value of the properties by modifying the Plugin_Customization.ini file of the primary feature. You can find the primary feature in the install.ini file in the Eclipse directory. For example, the contents of install.ini in the standard Eclipse decompressed: Listing 2. The standard Eclipse decompressed content in install.ini content

# install.ini

# java.io.properties file (ISO 8859-1 with "/" escapes)

# This file does not need to be translated.

# Required Property "feature.default.id"

Contains the id of the primary feature

# (The Primary Feature Controls Product Branding,

Splash Screens, and Plug-In Customization

Feature.default.id = org.eclipse.platform

# Required property "feature.default.Application"

Contains id of the core

# Application That Gets Control

On Startup. for Products with a ui, this

# is always org.eclipse.ui.workbench;

For "Headless" Products, this is product-specific.

Feature.default.Application = org.eclipse.ui.Workbench

Feature.default.id = ... Specifies the default main feature. It should be noted that by using the -feature option when starting Eclipse, other features can be declared as main. Like most of the functional components, the actual work is done in a plugin associated with the functional component. For Eclipse, this is the same plugin as the functionality, org.eclipse.platform plugin. If you carefully view this plugin as a primary feature identifier, you will find a file called Plugin_Customization.ini. The content of this file is similar to the file export attribute. This file is read when the Eclipse starts and is used to specify all the default attribute values, not those values ​​defined by the plugin itself. This makes the product, or you can change the behavior of the plugin. The content of the default plugin_customization.ini file has only one: Listing 3. Default Plugin_Customization.ini file # plugin_customization.ini

# sets default values ​​for

PLUG-IN-Specific Preferences

# keys area qualified by plug-in id

# E.g., com.example.acmeplugin / myproperty = myvalue

# java.io.properties file

(ISO 8859-1 with "/" escapes)

# "% KEY" Are Externalized Strings

Defined in plugin_customization.properties

# This file does not need to be translated.

# Property "org.eclipse.ui

/ defaultperspectiveID "Controls the

# Perspective That The Workbench Opens Initially

Org.eclipse.ui / DefaultPerspectiveIDIDID

= Org.eclipse.ui.ResourcePerspective

This entry specifies the perspective of opening a new work area and turning off the Eclipse when you turn off all perspective. This entry may vary if you use Eclipse-based products. Specify the process of the process to be included, but at least you should do the following steps: 1. Start a clean work area. 2. Modify an attribute you want to change. 3. Export attributes to a .epf file. 4. Find a new health value in the exported file and determine if it reflects the changes you have just made. 5. Copy the entry of one or more keys to the lauGin_customization.ini file of the Org.eclipse.Platform when using Eclipse when using Eclipse. 6. Test results, or retain new keys, or try again. Note: If you are not accustomed to updating the Plugin_Customization.ini file of the product, you can create a copy of this file in other locations, using parameters when you start Eclipse or Eclipse-based products to specify it.

Eclipse -plugincustomization mycustomdefaults.ini

转载请注明原文地址:https://www.9cbs.com/read-96418.html

New Post(0)