Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] a more general eclipse question.

i now use actions.. But how to do it then?

i already dropped the commands and handlers and i now have 1 action that is a drop down menu that creates actions in the code
that last part works perfectly. But the drop down menu is not a drop down menu because that is depending on the state of the jsjdt plugin..
I personally find that very weird that a state of a button (what it is) depends on if a plugin is activated or not..

johan


On Tue, Jun 3, 2008 at 4:45 PM, Jae Gangemi <jgangemi@xxxxxxxxx> wrote:

  i don't remember why ToggleState didn't work for me - i think i had similar issues and then went to the newsgroups and google to find another way to make it work. it is completely possible that it may be a bug.

  if you can't go to 3.4, then you're going to have to use Actions to accomplish this. the Handler bug exists in 3.3 - i know it is fixed in 3.4, but am not sure if they backported the fix for the latest 3.3.x release.

On Tue, Jun 3, 2008 at 10:41 AM, Johan Compagner <jcompagner@xxxxxxxxx> wrote:
running on 3.4 or something is not an option
We have to target 3.3.x (is it fixed in that ? )

But why didnt ToggleState not work for you? Didnt you have something with a special Handler?

Toggle items for debugging like Show Globals/Variables and so on?
Those have the exact same problem they are not remembered..

johan



On Tue, Jun 3, 2008 at 4:34 PM, Jae Gangemi <jgangemi@xxxxxxxxx> wrote:

  you don't want to use ToggleState for that - i tried that when i was working on the some of the toggle items for debugging.

  take a look at those - i'm pretty certain that you want to follow those as an example. you need to implement the IUIElement interface (i think that's what it is) and make sure you're running one of the latest eclipse releases b/c of that bug i mentioned earlier.


On Tue, Jun 3, 2008 at 10:19 AM, Johan Compagner <jcompagner@xxxxxxxxx> wrote:
Yes.. I want to keep the true/false state
Just basic preference thing. But it has to be reflected by the UI. And that just doesnt work..

For example: Break on Exception should be remembered, users really shouldnt set that every time.
So i want to store it (this is possible in our own preferences) But if it is the stored as true
then the next restart the ui is wrong, it is still displayed as false. And then if the user toggles it
it thinks that it toggled it to true, but it toggle it to false because the underlying preference was true (and that was toggled)

Stupid thing is.. i solved it:

 <action
              class="org.eclipse.dltk._javascript_.jsjdtdebugger.action._javascript_MenuAction"
              id="org.eclipse.dltk._javascript_.jsjdtdebugger._javascript_Action"
              label="_javascript_"
              menubarPath="defaultJavaScriptGroup"
              style="pulldown"
              tooltip="_javascript_">
        </action>

style="pulldown"
Now it works as expected but now i get a error of the plugin.xml editor that pulldown is an illegal value.. (but it works perfect!)

I also would love to do it with ToggleState but how to trigger the togglestate before it shows the ui?
And how do i get the preference back from that togglestate?

Why is this sooo difficult in eclipse??


johan


On Tue, Jun 3, 2008 at 3:57 PM, Jae Gangemi <jgangemi@xxxxxxxxx> wrote:

  can i ask again why you're trying to use ToggleState? is this just to get the menu items to display correctly?

On Tue, Jun 3, 2008 at 8:51 AM, Johan Compagner <jcompagner@xxxxxxxxx> wrote:
Ok worked on it today again
And i just cant get it to work
ToggleState just doesnt work at all (3.3)
Because loadState() is only called when i close eclipse!
Never when i just start up eclipse....
I guess because getValue or something is never called on it. And i cant see a path where i can trigger that.. (because my code is not loaded)

Then i thought ok lets do it another way. Lets just make it as the GroupBy entry of the same drop down menu.. (breakpoints view)
This is the GroupBreakpointsByAction class that does that.

I configured everything the same.. the GroupBreakpointsByAction is always a DROP_DOWN_MENU
But mine just doesnt want to become that by  default .. Its a normal menu entry
until i click on it. and then close the breakpoints view and the reopen it.. Then it is a drop down

So i investigated..

Its all in the PluginAction class :

 protected boolean isOkToCreateDelegate() {
        if (getStyle() == IAction.AS_DROP_DOWN_MENU
                && !WWinPluginPulldown.class.isInstance(this)) {
            return true;
        }
       
        // test if the plugin has loaded
        String bundleId = configElement.getNamespace();
        return BundleUtility.isActive(bundleId);
    }

mine is not a AS_DROP_DOWN_MENU because i have no idea how to specify that in the plugin.xml because i only have radio/push/check options
Als getStyle() will reutrn as drop down but then the value must be an instanceof MenuCreator. And yes my action is a IMenuCreator but it isnt made yet (chicken and egg problem here)
So then it goes in the the isActive check..
And yes this is why the GroupBy of the debug ui plugin does work (because yes it is activated) but mine doesnt because i am in the jsjdtdebugger plugin which is not loaded at this time.

So how to do this correctly is beyond me. Eclipse is really trying to be to lazy if you ask me. It is fine that it is that way. But i want to override it!

Does anybody knows how to activate the jsjdt plugin if before or with the debugger (ui) plugin of eclipse?

Or how to set that it is a drop down in the plugin.xml??

johan





On Mon, May 19, 2008 at 5:09 PM, Jae Gangemi <jgangemi@xxxxxxxxx> wrote:

  yeah - there is a bug in one of the 3.4 milestones (and 3.3 as well) that caused this to occur, the toggle isn't properly initialized. see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=216483.

  as long as you are storing the state of the toggle in the preference store, and reading it out of the preference store when the action is run, you'll be ok.


On Mon, May 19, 2008 at 11:04 AM, Johan Compagner <jcompagner@xxxxxxxxx> wrote:
I think i also already tried that, also doesnt seem to work
because my handler is created only when the action is triggered.

But thx for the pointer i will try to look into that direction a bit further.

johan



On Mon, May 19, 2008 at 4:23 PM, Jae Gangemi <jgangemi@xxxxxxxxx> wrote:

  are you using handlers to control the 'toggle' action?

  if so, i believe you want your handler to implement the IElememtUpdater interfacer so it will know the toggle state when it is initialized. see (AbstractToggleVariableHandler).

On Mon, May 19, 2008 at 9:14 AM, Johan Compagner <jcompagner@xxxxxxxxx> wrote:
Hi all,

in _javascript_ we have a few toggle commands contributed to various views

like: global method entry and exit breaks (i added also exception break, will commit that later) in the Breakpoints View
but also show xxx variables in the _javascript_ menu of the Variables view.

The big problem is that those are toggle that can be true when i shutdown eclipse
and we store that property in the plugin store/settings.

But i cant get eclipse so far that it reads that state in that i tell him tooo

I used the class ToggleState class as a state entry for the command
and then have that attached to STYLE id.
http://help.eclipse.org/help33/ntopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/commands/ToggleState.html

als see: http://wiki.eclipse.org/Menu_Contributions that has an example:

<extension point="org.eclipse.ui.commands">



<command categoryId="org.eclipse.jdt.ui.category.source"

description="%jdt.ui.ToggleMarkOccurrences.description"
id="org.eclipse.jdt.ui.edit.text.java.toggleMarkOccurrences"
name="%jdt.ui.ToggleMarkOccurrences.name">




<state id="NAME" class="org.eclipse.jface.menus.TextState" />
<state id="STYLE" class="org.eclipse.jface.commands.ToggleState:true" />
</command>




</extension>


but whatever i do the state is not correct.
If i place a breakpoint in the ToggleState class (load method)
then that load method is only triggered when i shutdown eclipse! Not when the command is initialized.

I have to do something wrong that is very obvious or something...

johan




_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev




--
-jae
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev



_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev




--
-jae

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev



_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev




--
-jae

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev



_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev




--
-jae

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev



_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev




--
-jae

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev



Back to the top