Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [solved] popupMenus on IMarker
[solved] popupMenus on IMarker [message #696270] Wed, 13 July 2011 15:41 Go to next message
Christian Opitz is currently offline Christian Opitz
Messages: 11
Registered: July 2009
Junior Member
Hi everyone,

I have an issue with a plugin i wrote a while ago (Eclipse 3.2 times I think) which does not work as I would expect anymore. It did in the past with the same code.

I create some IMarkers and would like to have a menu item in the popupMenu.

This is what I use as extension point:

   <extension
         point="org.eclipse.ui.popupMenus">
      <objectContribution
            id="de.test.consoleparser.objectContribution1"
            objectClass="org.eclipse.core.resources.IMarker">
            <action
                  class="de.test.consoleparser.ui.DeleteMarkerDelegate"
                  id="de.test.consoleparser.ui.DeleteMarker"
                  label="Delete Marker"
                  menubarPath="additions">
            </action>

      </objectContribution>
   </extension>


The menu item just doesn't appear. The funny thing is that when changing the object class to use IFile as in the following line, the menu item appears (in the file context menu).
objectClass="org.eclipse.core.resources.IFile"


So I guess generally what I am doing seems to be not completely wrong, but something is not working the way think it is. As mentioned it did work previously.

Any suggestions or hints?

Thanks in advance!

[Updated on: Wed, 20 July 2011 13:06]

Report message to a moderator

Re: popupMenus on IMarker [message #698001 is a reply to message #696270] Mon, 18 July 2011 15:21 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Where do you expect your objectContribution to appear? When you right-click on a problem in the Problems view?

PW


Re: popupMenus on IMarker [message #698766 is a reply to message #698001] Wed, 20 July 2011 07:50 Go to previous messageGo to next message
Christian Opitz is currently offline Christian Opitz
Messages: 11
Registered: July 2009
Junior Member
Exactly. That's also where it used to appear in the past.

Chris
Re: popupMenus on IMarker [message #698851 is a reply to message #698766] Wed, 20 July 2011 11:25 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Try adding adapt="true" to your objectContribution.

PW


Re: popupMenus on IMarker [message #698909 is a reply to message #698851] Wed, 20 July 2011 12:58 Go to previous messageGo to next message
Christian Opitz is currently offline Christian Opitz
Messages: 11
Registered: July 2009
Junior Member
Yep, you are (almost) right. The flag is called "adaptable". Something like RTFM just came to my mind after reading the documentation. Thanks for not being that "direct" Very Happy :

adaptable - a flag that indicates if types that adapt to IResource should use this object contribution. This flag is used only if objectClass adapts to IResource. Default value is false.


No idea if the flag is new, the default value has changed or it just accidentally worked in the past, but the new version looks like this:

   <extension
         point="org.eclipse.ui.popupMenus">
      <objectContribution
            adaptable="true"
            id="de.test.consoleparser.objectContribution1"
            objectClass="org.eclipse.core.resources.IMarker">
            <action
                  class="de.bosch.consoleparser.ui.DeleteMarkerDelegate"
                  id="de.bosch.consoleparser.ui.DeleteMarker"
                  label="Delete Marker"
                  menubarPath="additions">
            </action>

      </objectContribution>
    </extension>


Thank you very much!
Re: popupMenus on IMarker [message #698917 is a reply to message #698909] Wed, 20 July 2011 13:24 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Christian Opitz wrote on Wed, 20 July 2011 08:58


No idea if the flag is new, the default value has changed or it just accidentally worked in the past, but the new version looks like this:


The flag is old (often used because java projects are IJavaProjects, not IProjects, but many objectContributions care about IProjects) but all of the Markers views were re-implemented between 3.2 and now. So now (apparently) you need to adapt to see IMarker (in the previous implementation the view model objects must have implemented IMarker directly, but the no longer do so).

PW


Previous Topic:How to get an instance of the IWorkbenchPart?
Next Topic:How to run import project wizards from headless mode
Goto Forum:
  


Current Time: Sun Oct 26 09:37:37 GMT 2014

Powered by FUDForum. Page generated in 0.08831 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software