Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Adding a view to a perspective
Adding a view to a perspective [message #329697] Tue, 01 July 2008 12:48 Go to next message
Eclipse UserFriend
Originally posted by: subs._nospam_consertum.com

Hi,

I have created an update to my RCP app that has added a view to a
perspective. If the app has not been run before (i.e. a clean install),
the view appears as I expect. However, if the app has been run before
(i.e it has been updated), then the new view does not appear (as the
stored perspectives 'state' does not contain the view). I can get the
view to appear by reseting the perspective.

I want to detect this situation (the update case) and issue a message to
the user that a new view is available and ask them if they want to
display it.

Does anybody have some ideas that will point me in the right direction
for implementing this?

Thanks,

--
Derek
Re: Adding a view to a perspective [message #329731 is a reply to message #329697] Wed, 02 July 2008 08:20 Go to previous messageGo to next message
Rahul Kamdar is currently offline Rahul KamdarFriend
Messages: 63
Registered: July 2009
Member
To add a view to an already existing perspective you can use the
org.eclipse.ui.perspectiveExtensions extension point in your plugin.xml
where you can specify the perspective and the view you wish to add. But
doing this will add the view if not present (there won't be any prompts or
messages to the user). I am not sure how to do that (regarding giving the
user a message and then accordingly bringing the view up).

I don't really get your notion of the app getting updated when run once so
not sure what will really help you!

Hope the perspectiveExtensions helps,
Rahul


"Derek" <subs@_nospam_consertum.com> wrote in message
news:g4d939$bf0$1@build.eclipse.org...
> Hi,
>
> I have created an update to my RCP app that has added a view to a
> perspective. If the app has not been run before (i.e. a clean install),
> the view appears as I expect. However, if the app has been run before (i.e
> it has been updated), then the new view does not appear (as the stored
> perspectives 'state' does not contain the view). I can get the view to
> appear by reseting the perspective.
>
> I want to detect this situation (the update case) and issue a message to
> the user that a new view is available and ask them if they want to display
> it.
>
> Does anybody have some ideas that will point me in the right direction for
> implementing this?
>
> Thanks,
>
> --
> Derek
Re: Adding a view to a perspective [message #329732 is a reply to message #329731] Wed, 02 July 2008 08:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: subs._nospam_consertum.com

Rahul Kamdar wrote:
> To add a view to an already existing perspective you can use the
> org.eclipse.ui.perspectiveExtensions extension point in your plugin.xml
> where you can specify the perspective and the view you wish to add. But
> doing this will add the view if not present (there won't be any prompts or
> messages to the user). I am not sure how to do that (regarding giving the
> user a message and then accordingly bringing the view up).
>
> I don't really get your notion of the app getting updated when run once so
> not sure what will really help you!
>
> Hope the perspectiveExtensions helps,
> Rahul
>
>
> "Derek" <subs@_nospam_consertum.com> wrote in message
> news:g4d939$bf0$1@build.eclipse.org...
>> Hi,
>>
>> I have created an update to my RCP app that has added a view to a
>> perspective. If the app has not been run before (i.e. a clean install),
>> the view appears as I expect. However, if the app has been run before (i.e
>> it has been updated), then the new view does not appear (as the stored
>> perspectives 'state' does not contain the view). I can get the view to
>> appear by reseting the perspective.
>>
>> I want to detect this situation (the update case) and issue a message to
>> the user that a new view is available and ask them if they want to display
>> it.
>>
>> Does anybody have some ideas that will point me in the right direction for
>> implementing this?
>>
>> Thanks,
>>
>> --
>> Derek
>
>
Rahul,

Thanks, but I already have a perspective extension that works.

My issue is this:
I already have a product that customers have installed. I am providing
an update to that product (via the Eclipse update mechanism). In this
update, I have added a new view to an existing perspective. This new
view does not appear until the customer does a "reset perspective". I
would like to automate this process, so that the users doesn't have to
do anything.

--
Derek
Re: Adding a view to a perspective [message #329747 is a reply to message #329697] Wed, 02 July 2008 14:41 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

I can think of round-about ways to do it ... for example, when your
plugin starts up read all of the relevant perspectiveExtensions from the
IExtensionRegistry ... you can save the information you need in your
plugin state location.

Then if you startup and find the view not in your plugin state location
file, you know it has been added or removed.

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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Adding a view to a perspective [message #329791 is a reply to message #329732] Fri, 04 July 2008 09:41 Go to previous messageGo to next message
Rahul Kamdar is currently offline Rahul KamdarFriend
Messages: 63
Registered: July 2009
Member
Hi Derek,

I think the workaround suggested by Paul is a pretty neat way of doing what
you wish to achieve. If you have any other issue with the same, maybe you
could post that.

Rahul

"Derek" <subs@_nospam_consertum.com> wrote in message
news:486B3B9F.8020004@_nospam_consertum.com...
> Rahul Kamdar wrote:
>> To add a view to an already existing perspective you can use the
>> org.eclipse.ui.perspectiveExtensions extension point in your plugin.xml
>> where you can specify the perspective and the view you wish to add. But
>> doing this will add the view if not present (there won't be any prompts
>> or messages to the user). I am not sure how to do that (regarding giving
>> the user a message and then accordingly bringing the view up).
>>
>> I don't really get your notion of the app getting updated when run once
>> so not sure what will really help you!
>>
>> Hope the perspectiveExtensions helps,
>> Rahul
>>
>>
>> "Derek" <subs@_nospam_consertum.com> wrote in message
>> news:g4d939$bf0$1@build.eclipse.org...
>>> Hi,
>>>
>>> I have created an update to my RCP app that has added a view to a
>>> perspective. If the app has not been run before (i.e. a clean install),
>>> the view appears as I expect. However, if the app has been run before
>>> (i.e it has been updated), then the new view does not appear (as the
>>> stored perspectives 'state' does not contain the view). I can get the
>>> view to appear by reseting the perspective.
>>>
>>> I want to detect this situation (the update case) and issue a message to
>>> the user that a new view is available and ask them if they want to
>>> display it.
>>>
>>> Does anybody have some ideas that will point me in the right direction
>>> for implementing this?
>>>
>>> Thanks,
>>>
>>> --
>>> Derek
>>
>>
> Rahul,
>
> Thanks, but I already have a perspective extension that works.
>
> My issue is this:
> I already have a product that customers have installed. I am providing an
> update to that product (via the Eclipse update mechanism). In this update,
> I have added a new view to an existing perspective. This new view does not
> appear until the customer does a "reset perspective". I would like to
> automate this process, so that the users doesn't have to do anything.
>
> --
> Derek
Re: Adding a view to a perspective [message #329792 is a reply to message #329747] Fri, 04 July 2008 10:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: subs._nospam_consertum.com

OK. Here is what I have done.

I have registered a perspectiveListener and registered it during my
earlyStartup:

public void perspectiveActivated(IWorkbenchPage page,
IPerspectiveDescriptor desc) {
if (isMyPerspective(desc)) {
// 'my' view should be in this perspective
Perspective persp = ((WorkbenchPage) page).getActivePerspective();
IViewReference[] refs = persp.getViewReferences();
if (!containsMyView(refs)) {
// 'my' view is not currently shown
if (queryShowView()) {
// user has agreed to show 'my' view
page.showView(MY_VIEW_ID);
}
}
}
}

This works, but I get a 'access restriction' on Perspective. Is there an
API way to do this?

Thanks,

Paul Webster wrote:
> I can think of round-about ways to do it ... for example, when your
> plugin starts up read all of the relevant perspectiveExtensions from the
> IExtensionRegistry ... you can save the information you need in your
> plugin state location.
>
> Then if you startup and find the view not in your plugin state location
> file, you know it has been added or removed.
>
> PW
>
>


--
Derek
Re: Adding a view to a perspective [message #329848 is a reply to message #329792] Tue, 08 July 2008 15:07 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Derek wrote:
> OK. Here is what I have done.
>
> I have registered a perspectiveListener and registered it during my
> earlyStartup:
>
> public void perspectiveActivated(IWorkbenchPage page,
> IPerspectiveDescriptor desc) {
> if (isMyPerspective(desc)) {
> // 'my' view should be in this perspective
> Perspective persp = ((WorkbenchPage) page).getActivePerspective();
> IViewReference[] refs = persp.getViewReferences();
> if (!containsMyView(refs)) {
> // 'my' view is not currently shown
> if (queryShowView()) {
> // user has agreed to show 'my' view
> page.showView(MY_VIEW_ID);
> }
> }
> }
> }
>
> This works, but I get a 'access restriction' on Perspective. Is there an
> API way to do this?
>

You can use org.eclipse.ui.IWorkbenchPage.getViewReferences() ... it
will only return the view references for the active perspective.

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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Previous Topic:Invisible Plugin Architecture
Next Topic:Removing Import export from pop-up Menu
Goto Forum:
  


Current Time: Fri Jul 19 12:10:55 GMT 2024

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

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

Back to the top