Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Properties Page Title
Properties Page Title [message #478971] Fri, 07 August 2009 17:40 Go to next message
Andy is currently offline Andy
Messages: 47
Registered: July 2009
Member
Hi everyone,

I have a plugin that has a tree. On each of the nodes of the tree I have
a menu that the user can right click and select from the available
options. I added an entry in the menu that appears like so:

fillTheContextMenu(IMenuManager manager){

PropertyDialogAction pda = new PropertyDialogAction(getSite(), viewer);
manager.add(pda);

}

Here's the problem. When that properties window pops open it works fine
in the sense that it displays all my property pages correctly. At the top
of the properties window I see

"Properties for "

The issue is I would like to put the name of the node of the tree in that
spot after "Properties for" but I can't seem to find any hook to set that
text. I tried setting methods (setText) on the propertyDialogAction class
but the only thing that changed was the name in the menu, not the title of
the properties pages. So does anyone know how to set that text? Thanks,

Andy
Re: Properties Page Title [message #479474 is a reply to message #478971] Tue, 11 August 2009 09:45 Go to previous messageGo to next message
Dani Megert is currently offline Dani Megert
Messages: 3801
Registered: July 2009
Senior Member
Andy wrote:
> Hi everyone,
>
> I have a plugin that has a tree. On each of the nodes of the tree I
> have a menu that the user can right click and select from the
> available options. I added an entry in the menu that appears like so:
>
> fillTheContextMenu(IMenuManager manager){
>
> PropertyDialogAction pda = new PropertyDialogAction(getSite(), viewer);
> manager.add(pda);
>
> }
>
> Here's the problem. When that properties window pops open it works
> fine in the sense that it displays all my property pages correctly.
> At the top of the properties window I see
>
> "Properties for "
>
> The issue is I would like to put the name of the node of the tree in
> that spot after "Properties for" but I can't seem to find any hook to
> set that text. I tried setting methods (setText) on the
> propertyDialogAction class but the only thing that changed was the
> name in the menu, not the title of the properties pages. So does
> anyone know how to set that text?
Your element should be an adaptable and provide an IWorkbenchAdapter
that returns the label for the element.

Dani
> Thanks,
>
> Andy
>
Re: Properties Page Title [message #521439 is a reply to message #479474] Wed, 17 March 2010 15:36 Go to previous message
Andy is currently offline Andy
Messages: 47
Registered: July 2009
Member
Been out of the loop for a while on another project so hopefully this can still be answered.

I have added the following method to my TreeObject (which is what is in each node of the tree I am displaying)

public Object getAdapter(Class key) {

pluginLogger.log("This is the class: " + key.get);

return null;

}

Based on the previous recommendation TreeObject implements IAdaptable (because of the getAdapter method) so that step I understand.

As for the next step of returning an IWorkBenchAdapter I haven't a clue how to implement this. My TreeObject has a method called getName() which is what I want to be in the top left corner of the properties window that pops up. I want that text string to be returned in the getLabel(Object o) method for IWorkbenchAdapter.

My reading of IWorkBenchAdapter is that I need to check the input Class against a list of classes. If the input class matches the class I am working on then I would return an object that is the adapter for that class. Here is the problem: when I print out the input class name I get the following classes:

This is the class: IContributorResourceAdapter
....
This is the class: IResource
....
This is the class: IActionFilter
.....
This is the class: IWorkbenchAdapter

I don't get TreeObject or IAdaptable. This doesn't make any sense at all. I know it should be called because when I right mouse click on my menu and the Properties window pops up I see my property pages. Any ideas as to what might be going on?

And call me crazy, but wouldn't it be a much cleaner design to just have an object have the option of implementing an interface that just has "getLabel" right on the object itself instead of doing all this confusing indirection?

Thanks,

Andy
Previous Topic:Downloading specfic version using update site
Next Topic:How do you disable the prompt after a file has been modified externally?
Goto Forum:
  


Current Time: Mon Sep 22 16:22:10 GMT 2014

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

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