Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » popup extension to .java files
popup extension to .java files [message #287564] Sun, 03 July 2005 15:41 Go to next message
Eclipse UserFriend
Hi,

I m trying to add a popup menu to java files in simple plugin. Following
is my relevant part of build.xml file:
---------------
<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
objectClass="org.eclipse.core.resources.IFile"
nameFilter="*.java"
id="Simple_Plugin.contribution1">
<menu
label="New Submenu"
path="additions"
id="Simple_Plugin.menu1">
<separator
name="group1">
</separator>
</menu>
<action
label="New Action"
class="simple_Plugin.popup.actions.NewAction"
menubarPath="Simple_Plugin.menu1/group1"
enablesFor="1"
id="Simple_Plugin.newAction">
</action>
</objectContribution>
</extension>
----------------

If I set nameFilter to something else it works, but I couldn't get it
working with java files. Any suggestions?

Bahadir Yagan
Re: popup extension to .java files [message #287612 is a reply to message #287564] Tue, 05 July 2005 09:13 Go to previous message
Eclipse UserFriend
Bahadir Yagan wrote:
> Hi,
>
> I m trying to add a popup menu to java files in simple plugin. Following
> is my relevant part of build.xml file:
> ---------------
> <extension
> point="org.eclipse.ui.popupMenus">
> <objectContribution
> objectClass="org.eclipse.core.resources.IFile"
> nameFilter="*.java"
> id="Simple_Plugin.contribution1">

I think it's because java files aren't IFiles, they're CompilationUnits
of some kind.

You could create a sample action and print out the class for a selected
java file:

In your action, if you have IWorkbenchWindow w;

ISelectionService serv = w.getSelectionService();
ISelection sel = serv.getSelection();
if (sel instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) sel;
Object el[] = ss.toArray();
System.err.println(el[0].getClass().getName());
}

Later,
PW
Previous Topic:Dummy process state does not get refreshed in Debug view
Next Topic:How to automate test UI contributions in RCP app ?
Goto Forum:
  


Current Time: Sun Nov 09 17:19:37 EST 2025

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

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

Back to the top