简体   繁体   中英

Can the window title include the version number of the core plugin in an Eclipse 4 application with compatibility layer?

In a mixed mode Eclipse RCP application, I'd like to change the application window title to something like "Great App v1.3.22".

I basically have application (3.x based) and product (4.5 (Mars) based) split up into two plugins (following a helpful blog post describing how to use 3.x views in Eclipse 4, I need the CNF).

At the moment, the title is "got" from the org.eclipse.core.runtime.products extension point defined in the product plugin :

<extension
  id="my_product_id"
  point="org.eclipse.core.runtime.products">
  <product
    name="Great App"
    application="my.application">
  </product>
</extension>

Can I use a variable in the <product name> property? If so, what variables are available? Or can this be achieved by "overriding" the window title via the Trimmed Window entry in Application.e4xmi , and again what variables would be available? Or do I have to resort to ancient ways and set the title programmatically in the old ApplicationWorkbenchWindowAdvisor (which, however, wouldn't be available if I was able to switch to a pure E4 app once the CNF is available as a native E4 plugin)?

There are no variables you can use.

You can change the main window title in the LifeCycle class. The @ProcessAdditions method is the earliest you can do this:

@ProcessAdditions
public void processAdditions(MApplication app, EModelService modelService, IApplicationContext applicationContext)
{
  MWindow window = (MWindow)modelService.find("id of main trimmed window", app);

  window.setLabel("new text");
}

I am not sure where you want to get the version from. One possibility is a property in the product definition:

<extension
  id="my_product_id"
  point="org.eclipse.core.runtime.products">
  <product
    name="Great App"
    application="my.application">
     <property
           name="version"
           value="1.3.22">
      </property>
   </product>
</extension>

You will have to maintain this property manually or do something in your build to set it.

You can access this using the IApplicationContext

applicationContext.getBrandingProperty("version")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM