Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to display a View defined in another plug-in?
How to display a View defined in another plug-in? [message #460366] Wed, 20 December 2006 22:25 Go to next message
Ameya Barve is currently offline Ameya BarveFriend
Messages: 21
Registered: July 2009
Junior Member
I have a RCP with one Perspective defined. Within this Perspective, I want
to display a View that is defined in another plug-in. I tried calling
layout.addView() using the ID of the View as defined by the plug-in, but
that didn't work. To test, I added the
ContributionItemFactory.VIEWS_SHORTLIST item to a menu on my RCP, and this
when invoked, displayed only the Views(s) defined in my RCP project; none of
the Views from any of the plug-ins came up.

I have ensured that the ID of the View is the same, and that the plug-in
package containing the View is exposed in the plug-in's Exported Packages in
the Runtime Editor. What am I missing?
Re: How to display a View defined in another plug-in? [message #460476 is a reply to message #460366] Thu, 21 December 2006 10:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ssankhua.yahoo.com

There are just 2 things to be done for using view from plugin A in plugin B.

1. Export the view from the plugin A.
2. Add plugin B in the dependency (in the plugin.xml) of plugin B.

I also suggest you to keep a static ID in the View and use that ID field to instantiate the view.

Barnali
Re: How to display a View defined in another plug-in? [message #460483 is a reply to message #460366] Thu, 21 December 2006 15:14 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Ameya Barve wrote:
> I have a RCP with one Perspective defined. Within this Perspective, I want
> to display a View that is defined in another plug-in. I tried calling
> layout.addView() using the ID of the View as defined by the plug-in, but
> that didn't work. To test, I added the
> ContributionItemFactory.VIEWS_SHORTLIST item to a menu on my RCP, and this
> when invoked, displayed only the Views(s) defined in my RCP project; none of
> the Views from any of the plug-ins came up.

Just using the view ID string is fine. addView(*) should actually
display the view in the perspective somewhere.

IPageLayout#addShowViewShortcut(*) would probably add it to that
perspective's view shortlist ... but if you can't see it already in your
perspective with addView(*) that probably indicates another problem.

Are there any errors in your error log when you show the perspective?

Later,
PW


Re: How to display a View defined in another plug-in? [message #460554 is a reply to message #460483] Thu, 21 December 2006 21:53 Go to previous messageGo to next message
Ameya Barve is currently offline Ameya BarveFriend
Messages: 21
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.

------=_NextPart_000_0094_01C72507.62C49E40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Here are the steps I followed:

1) In the plug-in containing the view (sessionmanager), I exported the =
package (and all related packages) containing the "LaunchView" view. (In =
a later step, I exported ALL packages in the plugin, just as a =
sanity-test)

2) I double-clicked my RCP plugin.xml, and=20
a) In the Dependencies tab, I added "sessionmanager" as a Required =
Plug-in
b) In the Extensions tab, I added "LaunchView" from the =
sessionmanager plugin as an org.eclipse.ui.views extension.(ID of this =
extension element came from the LaunchView class which is public static =
final)

3) In my RCP Perspective class, I loaded the LaunchView using the public =
LaunchView.ID (same id as specified in the plugin.xml in step (2)).

4) When I run my RCP, I get the following error:

!SESSION 2006-12-21 13:46:27.215 =
-----------------------------------------------
eclipse.buildId=3Dunknown
java.version=3D1.5.0_09
java.vendor=3DSun Microsystems Inc.
BootLoader constants: OS=3Dwin32, ARCH=3Dx86, WS=3Dwin32, NL=3Den_US
Framework arguments: -product com.fnfr.svt.fanfaresvt.product
Command-line arguments: -product com.fnfr.svt.fanfaresvt.product -data =
C:\Clister/../runtime-fanfaresvt.product -dev =
file:C:/Clister/.metadata/.plugins/org.eclipse.pde.core/fanf aresvt.produc=
t/dev.properties -os win32 -ws win32 -arch x86

!ENTRY org.eclipse.core.runtime 2006-12-21 13:46:28.199
!MESSAGE Product com.fnfr.svt.fanfaresvt.product could not be found.

!ENTRY org.eclipse.osgi 4 0 2006-12-21 13:46:28.215
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: No application id has been found.
at =
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivat=
or.java:56)
at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplicati=
on(EclipseAppLauncher.java:92)
at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(Eclips=
eAppLauncher.java:68)
at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:4=
00)
at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:1=
77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)

!ENTRY org.eclipse.osgi 2 0 2006-12-21 13:46:28.231
!MESSAGE One or more bundles are not resolved because the following root =
constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2006-12-21 13:46:28.231
!MESSAGE Bundle update@../Clister/plugins/fanfaresvt/ was not resolved.
!SUBENTRY 2 com.fnfr.svt.fanfaresvt 2 0 2006-12-21 13:46:28.231
!MESSAGE Missing required bundle com.fnfr.svt.sessionmanager_0.0.0.

!ENTRY org.eclipse.osgi 2 0 2006-12-21 13:46:28.231
!MESSAGE The following is a complete list of bundles which are not =
resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2006-12-21 13:46:28.231
!MESSAGE Bundle update@../Clister/plugins/fanfaresvt/ [142] was not =
resolved.
!SUBENTRY 2 com.fnfr.svt.fanfaresvt 2 0 2006-12-21 13:46:28.231
!MESSAGE Missing required bundle com.fnfr.svt.sessionmanager_0.0.0.


"Paul Webster" <pwebster@ca.ibm.com> wrote in message =
news:eme8e6$9oq$1@utils.eclipse.org...
> Ameya Barve wrote:
>> I have a RCP with one Perspective defined. Within this Perspective, I =
want=20
>> to display a View that is defined in another plug-in. I tried calling =

>> layout.addView() using the ID of the View as defined by the plug-in, =
but=20
>> that didn't work. To test, I added the=20
>> ContributionItemFactory.VIEWS_SHORTLIST item to a menu on my RCP, and =
this=20
>> when invoked, displayed only the Views(s) defined in my RCP project; =
none of=20
>> the Views from any of the plug-ins came up.
>=20
> Just using the view ID string is fine. addView(*) should actually=20
> display the view in the perspective somewhere.
>=20
> IPageLayout#addShowViewShortcut(*) would probably add it to that=20
> perspective's view shortlist ... but if you can't see it already in =
your=20
> perspective with addView(*) that probably indicates another problem.
>=20
> Are there any errors in your error log when you show the perspective?
>=20
> Later,
> PW
------=_NextPart_000_0094_01C72507.62C49E40
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.3020" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2>Here are the steps I=20
followed:</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2>1) In the plug-in =
containing the=20
view (sessionmanager), I&nbsp;exported the package (and all related =
packages)=20
containing the "LaunchView" view. (In a later step, I exported ALL =
packages in=20
the plugin, just as a sanity-test)</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2>2) I =
double-clicked&nbsp;my RCP=20
plugin.xml, and </FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2>&nbsp;&nbsp;&nbsp; a) =
In the=20
Dependencies tab, I added&nbsp;"sessionmanager" as a Required=20
Plug-in</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2>&nbsp;&nbsp;&nbsp; b) =
In the=20
Extensions tab, I added "LaunchView" from the&nbsp;sessionmanager =
plugin&nbsp;as=20
an org.eclipse.ui.views extension.(ID of this extension element came =
from the=20
LaunchView class which is public static final)</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2>3) In my RCP =
Perspective class, I=20
loaded the LaunchView using the public LaunchView.ID (same id as =
specified in=20
the plugin.xml in step (2)).</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2>4) When I run my RCP, =
I get the=20
following error:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>!SESSION 2006-12-21 =
13:46:27.215=20
-----------------------------------------------<BR>eclipse.buildId=3Dunkn=
own<BR>java.version=3D1.5.0_09<BR>java.vendor=3DSun=20
Microsystems Inc.<BR>BootLoader constants: OS=3Dwin32, ARCH=3Dx86, =
WS=3Dwin32,=20
NL=3Den_US<BR>Framework arguments:&nbsp; -product=20
com.fnfr.svt.fanfaresvt.product<BR>Command-line arguments:&nbsp; =
-product=20
com.fnfr.svt.fanfaresvt.product -data =
C:\Clister/../runtime-fanfaresvt.product=20
-dev=20
file:C:/Clister/.metadata/.plugins/org.eclipse.pde.core/fanf aresvt.produc=
t/dev.properties=20
-os win32 -ws win32 -arch x86</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>!ENTRY org.eclipse.core.runtime =
2006-12-21=20
13:46:28.199<BR>!MESSAGE Product com.fnfr.svt.fanfaresvt.product could =
not be=20
found.</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>!ENTRY org.eclipse.osgi 4 0 =
2006-12-21=20
13:46:28.215<BR>!MESSAGE Application error<BR>!STACK=20
1<BR>java.lang.RuntimeException: No application id has been =
found.<BR>&nbsp;at=20
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivat=
or.java:56)<BR>&nbsp;at=20
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplicati=
on(EclipseAppLauncher.java:92)<BR>&nbsp;at=20
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(Eclips=
eAppLauncher.java:68)<BR>&nbsp;at=20
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:4=
00)<BR>&nbsp;at=20
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:1=
77)<BR>&nbsp;at=20
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<BR>&nbsp;at=20
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<BR>&nbsp;at=20
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown =
Source)<BR>&nbsp;at=20
java.lang.reflect.Method.invoke(Unknown Source)<BR>&nbsp;at=20
org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 ) <BR>&nbsp;at=
=20
org.eclipse.core.launcher.Main.basicRun(Main.java:280)<BR>&nbsp;at=20
org.eclipse.core.launcher.Main.run(Main.java:977)<BR>&nbsp;at=20
org.eclipse.core.launcher.Main.main(Main.java:952)</FONT></DIV >
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>!ENTRY org.eclipse.osgi 2 0 =
2006-12-21=20
13:46:28.231<BR>!MESSAGE One or more bundles are not resolved because =
the=20
following root constraints are not resolved:<BR>!SUBENTRY 1 =
org.eclipse.osgi 2 0=20
2006-12-21 13:46:28.231<BR>!MESSAGE Bundle </FONT><A=20
href=3D"mailto:update@../Clister/plugins/fanfaresvt/"><FONT =
face=3D"Courier New"=20
size=3D2>update@../Clister/plugins/fanfaresvt/</FONT></A><FONT =
face=3D"Courier New"=20
size=3D2> was not resolved.<BR>!SUBENTRY 2 com.fnfr.svt.fanfaresvt 2 0 =
2006-12-21=20
13:46:28.231<BR>!MESSAGE Missing required bundle=20
com.fnfr.svt.sessionmanager_0.0.0.</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>!ENTRY org.eclipse.osgi 2 0 =
2006-12-21=20
13:46:28.231<BR>!MESSAGE The following is a complete list of bundles =
which are=20
not resolved, see the prior log entry for the root cause if it=20
exists:<BR>!SUBENTRY 1 org.eclipse.osgi 2 0 2006-12-21 =
13:46:28.231<BR>!MESSAGE=20
Bundle </FONT><A =
href=3D"mailto:update@../Clister/plugins/fanfaresvt/"><FONT=20
face=3D"Courier New" =
size=3D2>update@../Clister/plugins/fanfaresvt/</FONT></A><FONT=20
face=3D"Courier New" size=3D2> [142] was not resolved.<BR>!SUBENTRY 2=20
com.fnfr.svt.fanfaresvt 2 0 2006-12-21 13:46:28.231<BR>!MESSAGE Missing =
required=20
bundle com.fnfr.svt.sessionmanager_0.0.0.</FONT></DIV></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Paul Webster" &lt;</FONT><A=20
href=3D"mailto:pwebster@ca.ibm.com"><FONT face=3DArial=20
size=3D2>pwebster@ca.ibm.com</FONT></A><FONT face=3DArial size=3D2>&gt; =
wrote in=20
message </FONT><A href=3D"news:eme8e6$9oq$1@utils.eclipse.org"><FONT =
face=3DArial=20
size=3D2>news:eme8e6$9oq$1@utils.eclipse.org</FONT></A><FONT =
face=3DArial=20
size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt; Ameya Barve=20
wrote:<BR>&gt;&gt; I have a RCP with one Perspective defined. Within =
this=20
Perspective, I want <BR>&gt;&gt; to display a View that is defined in =
another=20
plug-in. I tried calling <BR>&gt;&gt; layout.addView() using the ID of =
the View=20
as defined by the plug-in, but <BR>&gt;&gt; that didn't work. To test, I =
added=20
the <BR>&gt;&gt; ContributionItemFactory.VIEWS_SHORTLIST item to a menu =
on my=20
RCP, and this <BR>&gt;&gt; when invoked, displayed only the Views(s) =
defined in=20
my RCP project; none of <BR>&gt;&gt; the Views from any of the plug-ins =
came=20
up.<BR>&gt; <BR>&gt; Just using the view ID string is fine.&nbsp; =
addView(*)=20
should actually <BR>&gt; display the view in the perspective =
somewhere.<BR>&gt;=20
<BR>&gt; IPageLayout#addShowViewShortcut(*) would probably add it to =
that=20
<BR>&gt; perspective's view shortlist ... but if you can't see it =
already in=20
your <BR>&gt; perspective with addView(*) that probably indicates =
another=20
problem.<BR>&gt; <BR>&gt; Are there any errors in your error log when =
you show=20
the perspective?<BR>&gt; <BR>&gt; Later,<BR>&gt; PW</FONT></BODY></HTML>

------=_NextPart_000_0094_01C72507.62C49E40--
Re: How to display a View defined in another plug-in? [message #460587 is a reply to message #460554] Fri, 22 December 2006 15:02 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

you need to add all of your required plugins to your launch config under
Run>Run...

!ENTRY org.eclipse.osgi 2 0 2006-12-21 13:46:28.231
!MESSAGE One or more bundles are not resolved because the following root
constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2006-12-21 13:46:28.231
!MESSAGE Bundle update@../Clister/plugins/fanfaresvt/ was not resolved.
!SUBENTRY 2 com.fnfr.svt.fanfaresvt 2 0 2006-12-21 13:46:28.231
!MESSAGE Missing required bundle com.fnfr.svt.sessionmanager_0.0.0.

any time you see Missing .... plugin_0.0.0 it means that you've added a
required bundle to your plugin but you haven't yet updated your launch
config with the new plugin.

Later,
PW


Re: How to display a View defined in another plug-in? [message #460607 is a reply to message #460587] Fri, 22 December 2006 18:12 Go to previous message
Ameya Barve is currently offline Ameya BarveFriend
Messages: 21
Registered: July 2009
Junior Member
Yup, that worked! Thx a million!

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:emgs4f$uc9$2@utils.eclipse.org...
> you need to add all of your required plugins to your launch config under
> Run>Run...
>
> !ENTRY org.eclipse.osgi 2 0 2006-12-21 13:46:28.231
> !MESSAGE One or more bundles are not resolved because the following root
> constraints are not resolved:
> !SUBENTRY 1 org.eclipse.osgi 2 0 2006-12-21 13:46:28.231
> !MESSAGE Bundle update@../Clister/plugins/fanfaresvt/ was not resolved.
> !SUBENTRY 2 com.fnfr.svt.fanfaresvt 2 0 2006-12-21 13:46:28.231
> !MESSAGE Missing required bundle com.fnfr.svt.sessionmanager_0.0.0.
>
> any time you see Missing .... plugin_0.0.0 it means that you've added a
> required bundle to your plugin but you haven't yet updated your launch
> config with the new plugin.
>
> Later,
> PW
Previous Topic:How to update VM argument to point to java.exe?
Next Topic:Writing to DOS Console for Headless RCP
Goto Forum:
  


Current Time: Wed Apr 24 15:10:55 GMT 2024

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

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

Back to the top