|
|
Re: E3: Add a button to an EditorPart tool bar under some conditions [message #1758480 is a reply to message #1758413] |
Wed, 29 March 2017 03:04  |
Eclipse User |
|
|
|
Hi,
thank you for your reply. The problem I have with this solution is the EditorPart class and ID are the same in both cases.
Actually I don't understand well at what time the testers are called. When my editor becomes active I can see the tester is called because my test code is well executed:
public class IsJFCComposite extends PropertyTester {
public static final String PROPERTY_NAMESPACE = "org.txm.chartsengine.jfreechart.rcp.testers"; //$NON-NLS-1$
public static final String PROPERTY_EXPERT_ENABLED = "IsJFCComposite";
@Override
public boolean test(Object receiver, String property, Object[] args,
Object expectedValue) {
System.out.println("IsJFCComposite.test() recevier = " + receiver.getClass().getSimpleName());
System.out.println("IsJFCComposite.test() property = " + property);
System.out.println("IsJFCComposite.test() args = " + args);
System.out.println("IsJFCComposite.test() expectedValue = " + expectedValue);
return true;
}
}
but I can't access the editor in the test method (none of the arguments is the editor).
Writing makes me think that I could get the active editor here and maybe change the type of the property tester?
<propertyTester
class="org.txm.chartsengine.jfreechart.rcp.testers.IsJFCComposite"
id="org.txm.chartsengine.jfreechart.rcp.testers.IsJFCComposite"
namespace="org.txm.chartsengine.jfreechart.rcp.testers"
properties="IsJFCComposite"
type="org.txm.chartsengine.rcp.editors.ChartEditorPartt">
</propertyTester>
I'll try that.
Edit: Actually it can't work because I need to display the button for all visible editors and also even if they are not active. With the test above, the button disappears when the editor becomes inactive 
Also, to be more precise, we don't use the main tool bar but a custom tool bar added to the editor and registered in the menu service, so more than one tool bar can be visible at same time.
[Updated on: Thu, 30 March 2017 05:49] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.25971 seconds