Skip to main content



      Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Why is a .java file not an IFile?
Why is a .java file not an IFile? [message #604651] Fri, 12 February 2010 11:50 Go to next message
Eclipse UserFriend
I want to create a context menu action for Java source files in eclipses.

In my plugin.xml

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>

<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
id="dds_gen.contribution1"
objectClass="org.eclipse.core.runtime.IAdaptable"
nameFilter="*.java">
<menu
label="HCM Trainers"
path="additions"
id="dds_gen.menu1">
<separator
name="group1">
</separator>
</menu>
<action
label="DDS Generator"
class="dds_gen.popup.actions.DdsGeneratorAction"
menubarPath="dds_gen.menu1/group1"
enablesFor="1"
id="dds_gen.newAction">
</action>
</objectContribution>
</extension>

</plugin>


If I change org.eclipse.core.runtime.IAdaptable to org.eclipse.core.resources.IFile or org.eclipse.core.resources.IResource I do not see my action in menu. But if it is an IAdaptable I do. All the docs and tutorials say I should be using IFile.

I am on eclipse 3.4.

Thanks,
~S
Re: Why is a .java file not an IFile? [message #604670 is a reply to message #604651] Sat, 13 February 2010 19:03 Go to previous messageGo to next message
Eclipse UserFriend
if you want the menu for .java files in the package explorer,
try org.eclipse.jdt.core.ICompilationUnit, which is the Java model
view of the file. The connection to the IFile is then via
getUnderlyingResource()

HTH
Stephan
Re: Why is a .java file not an IFile? [message #604687 is a reply to message #604651] Mon, 15 February 2010 14:19 Go to previous message
Eclipse UserFriend
Thanks that got it.
~S
Previous Topic:Why is a .java file not an IFile?
Next Topic:Product Export fails when optional packages are missing
Goto Forum:
  


Current Time: Wed Jul 23 01:45:54 EDT 2025

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

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

Back to the top