How to create ToolControl in Eclipse 4.x [message #1066602] |
Wed, 03 July 2013 12:08 |
|
I'm working on eclipse kepler RCP application.
I want to contribute to trimbar through ToolControl.
With E4 tool i got following option:
In above image My problem is:
1. Which class I have to add it here.?
Is this call needs to implement some interface or extend any class. I tried alot on internet but cruelness to find any thing.
What i tried yet Created class with following combination.
1. by extending WorkbenchWindowControlContribution class
2. by extending ToolControlImpl class
In 1st case constructor is called but createControl(Composite parent) is not called.
In 2nd nothing is called.
Please tell me what i'm missing here.
Thanks.
[Updated on: Wed, 03 July 2013 12:08] Report message to a moderator
|
|
|
|
|
Re: How to create ToolControl in Eclipse 4.x [message #1066690 is a reply to message #1066609] |
Wed, 03 July 2013 18:26 |
|
I've got the same problem, but this doesn't solve it.
I'm upgrading my team to 4.3. In my test environment I've updated to the latest tools (Thanks Sopot) but my ToolControl (and other things) have ceased to work. Frustratingly it works OK if I generate a new application using the template. But even when I change all my dependencies to be the exact same as in the temple, my ToolControl will not load.
Any suggestions of what I should be looking for?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jo Grant, Senior Software Engineer
Admin and Config Console Architect
OpenPages, IBM
|
|
|
|
|
Re: How to create ToolControl in Eclipse 4.x [message #1067447 is a reply to message #1066739] |
Mon, 08 July 2013 18:24 |
|
Thanks for the ideas. I've got the handler there, and all versions appear to be set to 1.0.0. Nothing appears in the log. >_<
Trying to go step by step from the generated application...
Driving me crazy here. I now have it so the exact same class gets @PostConstruct called correctly when in the same plugin as the sample application, but @PostConstruct is not called when it is loaded from another plugin.
I thought I had it when I noticed that my plugin used Import-Package: javax.inject;bundle-version="1.0.0", and the sample used Require-Bundle: javax.inject;bundle-version="1.0.0". But they now both use the same and it still fails. (cries)
I'm pretty sure it's a version thing, like you say. I started printing PostConstruct.class.hashCode() and they are different. When I get the package and print the details, it is VERY different. I'm really confused now.
This is what I've reduced my class to:
import javax.annotation.PostConstruct;
public class PerspectiveTabs
{
public PerspectiveTabs()
{
System.out.println(getClass().getName()+" - constructor");
System.out.println(" "+PostConstruct.class.getName()+" - "+PostConstruct.class.hashCode());
Package pkg = PostConstruct.class.getPackage();
System.out.println(" Package - "+pkg.getName());
System.out.println(" Implementation - "+pkg.getImplementationTitle()+", "+pkg.getImplementationVendor()+", "+pkg.getImplementationVersion());
System.out.println(" Specification - "+pkg.getSpecificationTitle()+", "+pkg.getSpecificationVendor()+", "+pkg.getSpecificationVersion());
}
@PostConstruct
public void createUI()
{
System.out.println(getClass().getSimpleName()+" - postconstruct");
}
}
And this is the output I get:
com.ibm.openpages.config.ui.e43.ctrl.PerspectiveTabs - constructor
javax.annotation.PostConstruct - 1635287180
Package - javax.annotation
Implementation - null, null, null
Specification - null, null, null
PerspectiveTabs - postconstruct
com.ibm.openpages.config.ui.ctrl.PerspectiveTabs - constructor
javax.annotation.PostConstruct - 2062082543
Package - javax.annotation
Implementation - Java Runtime Environment, Oracle Corporation, 1.7.0_11
Specification - Java Platform API Specification, Oracle Corporation, 1.7
The first is the ToolControl that points to the class declared in the generated sample's plugin (which works). The second is in the identical class in my pre-existing plugin (which doesn't). Am I correct that a different hashCode() on the .class object means they are definitely different classes? Or would the Eclipse plugin model load them uniquely per plugin, and those values can't be compared. But, even if that was the case, why would the package versions be different?
I've gone through their MANIFEST.MF line by line, and all overlaps have the exact same version dependencies.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jo Grant, Senior Software Engineer
Admin and Config Console Architect
OpenPages, IBM
|
|
|
|
Re: How to create ToolControl in Eclipse 4.x [message #1067643 is a reply to message #1067526] |
Tue, 09 July 2013 19:09 |
|
The program is a shipping product, so there's a lot going on. I can't include all of that here. It works fine on 4.2, I'm just having difficulty getting to work on 4.3.
The core product plugin was "com.ibm.openpages.config.ui", but that had the problem that PostConsturct was not being called. So I generated a new plugin from the template called "com.ibm.openpages.config.ui.e43". I put a ToolControl in this and it successfully called PostConstruct. So I made this the primary plugin and loaded com.ibm.openpages.config.ui as a secondary one, and attempted to load a ToolControl from there. This does not call PostConstruct.
So, in the attached files, the primary_ files are the com.ibm.openpages.config.ui.e43 plugin, from which PostConstruct is called correctly, and the secondary_ files are the com.ibm.openpages.config.ui plugin, from which PostConstuct is not called correctly.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jo Grant, Senior Software Engineer
Admin and Config Console Architect
OpenPages, IBM
|
|
|
Re: How to create ToolControl in Eclipse 4.x [message #1067649 is a reply to message #1067643] |
Tue, 09 July 2013 19:49 |
Eclipse User |
|
|
|
From an initial quick look the secondary manifest, the import of the javax.annotation is followed by 'bundle-version blablabla'. Package imports don't normally have 'bundle-version's but just 'version's so it should be 'Import-Package: javax.annotation;version="1.0.0" ' (without the bundle-). HTH.
|
|
|
Re: How to create ToolControl in Eclipse 4.x [message #1067650 is a reply to message #1067649] |
Tue, 09 July 2013 19:52 |
|
Sheesh. You stare at something long enough and you stop seeing the obvious. The PostConstruct is now being called correctly. Onto my next porting problem!
Many, many thanks.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jo Grant, Senior Software Engineer
Admin and Config Console Architect
OpenPages, IBM
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03908 seconds