Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Perspectives
Perspectives [message #336938] Tue, 14 July 2009 21:02 Go to next message
Dilton McGowan II is currently offline Dilton McGowan IIFriend
Messages: 110
Registered: July 2009
Senior Member
We are porting an old C application and came up with these questions:

Is it possible to dynamically/programmatically create then show or hide
views which will show in Eclipse's Window | Show View dialog when these
views did not previously exist in plugin.xml?

Are there any best practices or has anyone tried this?
Re: Perspectives [message #336939 is a reply to message #336938] Wed, 15 July 2009 06:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: aurelien.pupier.esial.net

Dilton McGowan II a écrit :
> We are porting an old C application and came up with these questions:
>
> Is it possible to dynamically/programmatically create then show or hide
> views which will show in Eclipse's Window | Show View dialog when these
> views did not previously exist in plugin.xml?
>
> Are there any best practices or has anyone tried this?

Hi Dilton,

not sure to understand :
1.Do you want to add a view in Window->Show View?
or
2. Do you want to open views that will be available in WIndow->show View?

For 1., use org.eclipse.ui.perspectiveExtensions, choose the perspective to which you will to contribute and then add a view shortcut

For 2., use org.eclipse.ui.perspectiveExtensions, choose the perspective to which you will to contribute and then add a view. Perhaps you will need to reset your perspective (Window-> reset perspective).
Re: Perspectives [message #336949 is a reply to message #336939] Wed, 15 July 2009 14:09 Go to previous messageGo to next message
Dilton McGowan II is currently offline Dilton McGowan IIFriend
Messages: 110
Registered: July 2009
Senior Member
On Wed, 15 Jul 2009 08:52:35 +0200, Aurelien Pupier wrote:

> Dilton McGowan II a écrit :
>> We are porting an old C application and came up with these questions:
>>
>> Is it possible to dynamically/programmatically create then show or hide
>> views which will show in Eclipse's Window | Show View dialog when these
>> views did not previously exist in plugin.xml?
>>
>> Are there any best practices or has anyone tried this?
>
> Hi Dilton,
>
> not sure to understand :
> 1.Do you want to add a view in Window->Show View? or
> 2. Do you want to open views that will be available in WIndow->show
> View?
>
> For 1., use org.eclipse.ui.perspectiveExtensions, choose the perspective
> to which you will to contribute and then add a view shortcut
>
> For 2., use org.eclipse.ui.perspectiveExtensions, choose the perspective
> to which you will to contribute and then add a view. Perhaps you will
> need to reset your perspective (Window-> reset perspective).

Hi Aurelien,

I have views showing where I want them now but this is a requirement we
have and it's an odd one well two:

1) a View at some time while Eclipse is running needs to be manufactured
from some input information, a view that is not in plugin-xml and never
existed before

2) while Eclipse is running and based on some runtime parameters that
change as the plugin is used; a view will need to be marked as grey
(disabled?) in the Window | Show View dialog(wizard?) or it will simply
need to not show up when we need it to not show up and some time later
possibly show up if needed
Re: Perspectives [message #336953 is a reply to message #336938] Wed, 15 July 2009 18:52 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

There's no programmatic API to generate an individual view. You have 2
options.

1) create a multi-instance view. When these are opened, the secondaryId
is often used as a key that would allow you to look up your "input" and
customize your createPartControl accordingly. Only the default view,
without a secondary ID, will show up in the Show View menu

2) assuming you have the class available you can (in RCP apps) use
org.eclipse.core.runtime.IExtensionRegistry.addContribution( InputStream,
IContributor, boolean, String, ResourceBundle, Object) to feed a snippet
of XML (like an org.eclipse.ui.views extension) into the
IExtensionRegistry. That would then show up in the Show View menu. You
would need to be able to encode all of your input into the view XML in
some way (parameters are supported since a view is an
org.eclipse.core.runtime.IExecutableExtension) or once again, pass in a
key that can be used to look up information in the system.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: Perspectives [message #336954 is a reply to message #336953] Wed, 15 July 2009 20:05 Go to previous message
Dilton McGowan II is currently offline Dilton McGowan IIFriend
Messages: 110
Registered: July 2009
Senior Member
On Wed, 15 Jul 2009 14:52:53 -0400, Paul Webster wrote:

> There's no programmatic API to generate an individual view. You have 2
> options.
>
> 1) create a multi-instance view. When these are opened, the secondaryId
> is often used as a key that would allow you to look up your "input" and
> customize your createPartControl accordingly. Only the default view,
> without a secondary ID, will show up in the Show View menu
>

You're right we will need to address the single instance view only issue.

> 2) assuming you have the class available you can (in RCP apps) use
> org.eclipse.core.runtime.IExtensionRegistry.addContribution( InputStream,
> IContributor, boolean, String, ResourceBundle, Object) to feed a snippet
> of XML (like an org.eclipse.ui.views extension) into the
> IExtensionRegistry. That would then show up in the Show View menu. You
> would need to be able to encode all of your input into the view XML in
> some way (parameters are supported since a view is an
> org.eclipse.core.runtime.IExecutableExtension) or once again, pass in a
> key that can be used to look up information in the system.
>
> PW

Item 2 specifically addContribution and passing XML sounds very
interesting.

Thanks for the suggestions.
Previous Topic:defining menu in one plugin, but using it in another plugin.xml and adding a visibleWhen clause and
Next Topic:How To Programmatically Refresh The Workspace After Creating A New Project
Goto Forum:
  


Current Time: Fri Dec 27 00:32:09 GMT 2024

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

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

Back to the top