Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Selectively adding actions to Outline popup menu
Selectively adding actions to Outline popup menu [message #762327] Wed, 07 December 2011 22:10
Daniel Tuohy is currently offline Daniel TuohyFriend
Messages: 41
Registered: July 2009
Member
Hello,

We are using XText 2.0.1 and are interested in adding items to the Content Outline's popup menu only for certain nodes in the tree. For the Helio build of XText, this is described in this article, but the classes mentioned no longer exist in XText and there do not appear to be equivalent instructions in the indigo version.

I did find a bugzilla that seems to explain why it went away, and a deprecation comment that suggests this sort of thing was still possible, but I haven't been able to get it to work.

Here is the entry in my plugin.xml:

  <extension point="org.eclipse.ui.menus">
		<menuContribution locationURI="popup:com.stottlerhenke.anml.ui.outline?after=additions"
			allPopups="false">
			<command commandId="com.stottlerhenke.anml.ui.editor.commands.OpenTypeHierarchy"
			label="Open Type Hierarchy" style="push">
				<visibleWhen checkEnabled="false">
        			<iterate>
          				<adapt type="com.foo.mydsl.TypeDeclaration" />			
          				<adapt type="com.foo.mydsl.Type" />        				
        			</iterate>
      			</visibleWhen>
			</command>
		</menuContribution>
	</extension>


Unfortunately, I can't get the adapter to work for my custom implementation of AbstractOutlineNode. I can see that eclipse is calling getAdapter(Class adapterType), but the only values for adapterType are:

interface org.eclipse.core.resources.IResource
interface org.eclipse.ui.IContributorResourceAdapter
class org.eclipse.core.resources.mapping.ResourceMapping

None of these seems useful (I certainly don't have instances of these to hand return). Should I be seeing calls for the adapter for EClass?

Alternatively, is there any other way to get the behavior that I want? The instanceof expression seemed useful (instead of adapt), but I have no idea what to test for. I tried testing for my custom AbstractOutlineNode, but it does not appear to work. In fact, the only test that works is for java.lang.Object. What object is being evaluated here? Is there any way to debug this?

Thanks for your time,

Daniel


Previous Topic:grammar mixin
Next Topic:reference but in content assist
Goto Forum:
  


Current Time: Wed Apr 08 18:18:24 GMT 2020

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

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

Back to the top