0

I am currently working on an Explorer for a Eclipse RCP plugin. Nodes in that explorer have a context menu in which the user can select a toggle box, choosing to set a boolean. This context menu comes from a plugin.xml. Both its initial and current state should depend on what setting the field has in the selected node. Sadly I was not able to find a way to make a variable dependent on a field of a selected node inside the plugin.xml. How do I do this?

I basically need a

<systemProperty
selectedNode.relevantField>
</systemProperty>

that I can put in my

<state class="org.eclipse.ui.handlers.RegistryToggleState: id> </state>

Am I on a totally wrong track and attempt another way? I should

Tobi
  • 49
  • 7
  • 1
    What do you mean by : `Both its initial and current state should depend on what setting the field has in the selected node.` ? which field you are talking about ? – SomeDude Aug 09 '16 at 13:43
  • I mean the toggle state of the field in the context menu. So basically I have these nodes which have all this boolean field. If it is true in one, the toogle field in the nodes context menu should be checked, if not than not. If I than chick the field that should not influence the field for any other node – Tobi Aug 09 '16 at 14:26
  • Initial state of toggle can be `true` or `false` like ``. Then in the code you should use `HandlerUtil.toggleCommandState( "value_of_field" )` to toggle the state of the check box. – SomeDude Aug 09 '16 at 15:08
  • @svasa But what if I want to make the initial state dependent on a variable? I have I sourceProvider by now which should give me the boolean value of the field I am interested in, how do I replace the true and false with that sourceProvider? So you mean that in the code of my handler I should use HandlerUtil and use that to go through the tree postConstruction and set the togglestate to what I need with that? – Tobi Aug 10 '16 at 08:59

0 Answers0