context menu and properties [message #184076] |
Fri, 10 June 2005 08:54 |
Eclipse User |
|
|
|
Originally posted by: sidney.lee.ibs.net
hi! have looked through the posts here but found nothing on providing an
entry point to the properties view on the context menu. This would
enable the properties view to be displayed for a component (at present,
one has to do this via 'Window': 'Show View' -> 'Properties'). I have
created customized actions before so am purely interested in how to link
to the workbench action. I might have to customise it anyway so as not
to make the option available where multiple components have been selected.
any suggestions?
many thanks!
|
|
|
Re: context menu and properties [message #184255 is a reply to message #184076] |
Fri, 10 June 2005 21:25 |
Eclipse User |
|
|
|
Originally posted by: harsh.ti.com
Here are the steps...
1. Make sure the object you want to display implements the IAdaptable
method
2. Create an action to show the property view
3. In the getAdapter(Class key) method of your object, return the
IPropertySource object.
4. If you are using a TreeViewer, you will also need to fire selection
change events.
I hope this helps,
Harsh
|
|
|
Re: context menu and properties [message #184359 is a reply to message #184255] |
Mon, 13 June 2005 08:08 |
Eclipse User |
|
|
|
Originally posted by: sidney.lee.ibs.net
Thanks, but I think u have misunderstood... I have properties already
enabled in my application. What I want is to have a properties option on
the context menu such that when an edit part is selected and the context
menu invoked, a 'properties' option can be used to display the
properties view rather than going the 'Window': 'Show View' ->
'Properties' route. I want know what I need to invoke in my custom
action to enable this.
Many Thanks!
Harsh Sabikhi wrote:
> Here are the steps...
>
> 1. Make sure the object you want to display implements the IAdaptable
> method
> 2. Create an action to show the property view
> 3. In the getAdapter(Class key) method of your object, return the
> IPropertySource object.
> 4. If you are using a TreeViewer, you will also need to fire selection
> change events.
>
> I hope this helps,
> Harsh
>
|
|
|
Re: context menu and properties [message #184402 is a reply to message #184255] |
Mon, 13 June 2005 12:45 |
Eclipse User |
|
|
|
Originally posted by: sidney.lee.ibs.net
Sorry, seems it was I who misunderstood. However, u merely outlined what
I already knew. What I was after were the details in step 2, i.e. what
do I need to do in my action to show the properties view?
Many Thanks!
Harsh Sabikhi wrote:
> Here are the steps...
>
> 1. Make sure the object you want to display implements the IAdaptable
> method
> 2. Create an action to show the property view
> 3. In the getAdapter(Class key) method of your object, return the
> IPropertySource object.
> 4. If you are using a TreeViewer, you will also need to fire selection
> change events.
>
> I hope this helps,
> Harsh
>
|
|
|
Re: context menu and properties [message #184425 is a reply to message #184402] |
Mon, 13 June 2005 14:57 |
Eclipse User |
|
|
|
Originally posted by: harsh.ti.com
Not a problem. Here you go...
showProperties = new Action() {
public void run() {
String viewId "org.eclipse.ui.views.PropertySheet";
IWorkbench wb = RtaPlugin.getDefault().getWorkbench();
IWorkbenchWindow window = wb.getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
try {
page.showView(viewId, null,
IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
ErrorDialog.openError(window.getShell(),
WorkbenchMessages.getString("ShowView.errorTitle"), //$NON-NLS-1$
e.getMessage(), e.getStatus());
}
Sorry about the formating.
Harsh
}
};
showProperties.setText("Properties");
|
|
|
Powered by
FUDForum. Page generated in 0.02835 seconds