Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Enable Popup based on Filetype
Enable Popup based on Filetype [message #334073] Mon, 19 January 2009 05:20 Go to next message
Eclipse UserFriend
Hello,

short version:

How can I enable a popup action based on a base-content-type?

Eclipse Ganymede
Version: 3.4.1
Build id: M20080911-1700
Updated to the most recent version P2 could find

long version:

My plugin uses a bunch of files that can be recognized by their file
extension. So far I only had an Editor and some other custom code that I
associated with these file extensions.

Now however, I created a popup menu entry in the Project Explorer menu
to perform an action on my files. I want this action to be enabled only
when only files of my type are selected.

Googling around I found out, that I could use "objectTypeId" as a name
in objectState to control the enablement. Thus, I created a file type to
be associated with my files and several subtypes. The base-type is
basically abstract, all the semantics are linked to the subtypes. I
converted the editor from file extensions to use the base-type - works
perfectly.
Then I set the enablement of my popup. This however does not work when I
use the base-type - I have to give the specific subtype for my entry to
be enabled.

Is this a limitation (or bug) in Eclipse or am I missing something?

Regards,
Damian Philipp
Re: Enable Popup based on Filetype [message #334074 is a reply to message #334073] Mon, 19 January 2009 06:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: subs._nospam_consertum.com

This is a useful article to get you started:
http://www.eclipse.org/articles/article.php?file=Article-act ion-contribution/index.html

Damian Philipp wrote:
> Hello,
>
> short version:
>
> How can I enable a popup action based on a base-content-type?
>
> Eclipse Ganymede
> Version: 3.4.1
> Build id: M20080911-1700
> Updated to the most recent version P2 could find
>
> long version:
>
> My plugin uses a bunch of files that can be recognized by their file
> extension. So far I only had an Editor and some other custom code that I
> associated with these file extensions.
>
> Now however, I created a popup menu entry in the Project Explorer menu
> to perform an action on my files. I want this action to be enabled only
> when only files of my type are selected.
>
> Googling around I found out, that I could use "objectTypeId" as a name
> in objectState to control the enablement. Thus, I created a file type to
> be associated with my files and several subtypes. The base-type is
> basically abstract, all the semantics are linked to the subtypes. I
> converted the editor from file extensions to use the base-type - works
> perfectly.
> Then I set the enablement of my popup. This however does not work when I
> use the base-type - I have to give the specific subtype for my entry to
> be enabled.
>
> Is this a limitation (or bug) in Eclipse or am I missing something?
>
> Regards,
> Damian Philipp


--
Derek
Re: Enable Popup based on Filetype [message #334075 is a reply to message #334074] Mon, 19 January 2009 06:19 Go to previous messageGo to next message
Eclipse UserFriend
Hello Derek,

Derek schrieb:
> This is a useful article to get you started:
> http://www.eclipse.org/articles/article.php?file=Article-act ion-contribution/index.html

Thank you for your answer. This article only talks about the simplest
form of enablements - number of selected objects, type of selected
object and so forth. I already set my action to be visible only when all
selected objects are of type IFile, but I need to constrain this even
further depending on the content type of the selected Items.

Regards,
Damian Philipp
Re: Enable Popup based on Filetype [message #334111 is a reply to message #334075] Wed, 21 January 2009 06:00 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

Damian Philipp schrieb:
> I already set my action to be visible only when all
> selected objects are of type IFile, but I need to constrain this even
> further depending on the content type of the selected Items.

Perhaps everyone took from this reply that I had already solved this
problem - which I have not.

Not being able to enable an Action based on a content-type further up in
the hierarchy (rather than the actual content type) is a total
show-stopper for extensibility of a content type.

So, how can a popup action in the Project Explorer be enabled based on a
base-content-type of the selected element(s)?

Regards
Damian Philipp
Re: Enable Popup based on Filetype [message #334148 is a reply to message #334073] Thu, 22 January 2009 02:13 Go to previous message
Eclipse UserFriend
Hello,

Damian Philipp schrieb:
> How can I enable a popup action based on a base-content-type?

I filed a Bugreport: https://bugs.eclipse.org/bugs/show_bug.cgi?id=261798

Regards
Damian Philipp
Previous Topic:Individual Source Bundle
Next Topic:[JFace] Text and Dialog button CellEditor?
Goto Forum:
  


Current Time: Tue Apr 15 02:05:11 EDT 2025

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

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

Back to the top