RCP - Trouble getting feature information [message #192187] |
Tue, 10 February 2004 15:23  |
Eclipse User |
|
|
|
Originally posted by: IanPLang.yahoo.com
I have a simple app (based on the RCP articles originally posted at
http://www.eclipsepowered.org/rcp.html) which I am slowly building up. I
am working on the about box at the moment. What I want to do is something
similar to the way the Eclipse IDE does it (but less involved). I want to
get information about the installed features and use their branding
information to display a dialog box. After reading the code used in
Eclipse's about box I started with the code below.
My problem is I have two plug-ins and two features at the moment but only
the primary one shows up in the collection from
IPlatformConfiguration.getConfiguredFeatureEntries see code below. In
fact I get different results depending on how I run it. If I run from the
command line in my install directory I get this (outside dev environment):
AboutAction run found primary feature ID: com.lesliesoftware.lphoto
Feature ID: com.lesliesoftware.lphoto
Version ID: null
Plug-in ID: com.lesliesoftware.lphoto
If I run from inside Eclipse with the target platform pointing to the
install image I get this:
AboutAction run found primary feature ID: com.lesliesoftware.lphoto
Feature ID: com.lesliesoftware.lphoto
Version ID: 0.1.0
Plug-in ID: com.lesliesoftware.lphoto
So I have two questions: Why is only one of my features showing up? And
why is the version ID missing when I run outside the debugger?
IL
---8<---
IPlatformConfiguration conf =
BootLoader.getCurrentPlatformConfiguration();
// Primary feature
String featureId = conf.getPrimaryFeatureIdentifier();
ILog log = Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog();
log.log (new Status (IStatus.INFO, PlatformUI.PLUGIN_ID, 0,
"AboutAction run found primary feature ID: " + featureId, null));
//$NON-NLS-1$
System.out.println ("AboutAction run found primary feature ID: " +
featureId); //$NON-NLS-1$
// All features
IPlatformConfiguration.IFeatureEntry[] entries =
conf.getConfiguredFeatureEntries();
for (int i = 0; i < entries.length; i++) {
featureId = entries[i].getFeatureIdentifier();
String versionId = entries[i].getFeatureVersion();
String pluginId = entries[i].getFeaturePluginIdentifier();
log.log (new Status (IStatus.INFO, PlatformUI.PLUGIN_ID, 0, "
Feature ID: " + featureId, null)); //$NON-NLS-1$
System.out.println (" Feature ID: " + featureId); //$NON-NLS-1$
log.log (new Status (IStatus.INFO, PlatformUI.PLUGIN_ID, 0, "
Version ID: " + versionId, null)); //$NON-NLS-1$
System.out.println (" Version ID: " + versionId); //$NON-NLS-1$
log.log (new Status (IStatus.INFO, PlatformUI.PLUGIN_ID, 0, "
Plug-in ID: " + pluginId, null)); //$NON-NLS-1$
System.out.println (" Plug-in ID: " + pluginId); //$NON-NLS-1$
}
---8<---
|
|
|
Re: RCP - Trouble getting feature information [message #192206 is a reply to message #192187] |
Tue, 10 February 2004 16:02   |
Eclipse User |
|
|
|
Originally posted by: manahan.NOSPAM.ca.ibm.com
This is working as far as I can tell in an rcp app.
private void loadFeatureData() {
try {
ILocalSite ls = SiteManager.getLocalSite();
IConfiguredSite[] cs = ls.getCurrentConfiguration()
.getConfiguredSites();
for (int i = 0; i < cs.length; i++) {
IConfiguredSite site = cs[i];
IFeatureReference[] fr = site.getConfiguredFeatures();
for (int j = 0; j < fr.length; j++) {
IFeatureReference ref = fr[j];
IFeature f = ref.getFeature(null);
System.out.println(
f.getVersionedIdentifier().getIdentifier() +
" " +
f.getVersionedIdentifier().getVersion().toString());
}
}
Peter
Ian Lang wrote:
> I have a simple app (based on the RCP articles originally posted at
> http://www.eclipsepowered.org/rcp.html) which I am slowly building up. I
> am working on the about box at the moment. What I want to do is something
> similar to the way the Eclipse IDE does it (but less involved). I want to
> get information about the installed features and use their branding
> information to display a dialog box. After reading the code used in
> Eclipse's about box I started with the code below.
>
> My problem is I have two plug-ins and two features at the moment but only
> the primary one shows up in the collection from
> IPlatformConfiguration.getConfiguredFeatureEntries ? see code below. In
> fact I get different results depending on how I run it. If I run from the
> command line in my install directory I get this (outside dev environment):
> AboutAction run found primary feature ID: com.lesliesoftware.lphoto
> Feature ID: com.lesliesoftware.lphoto
> Version ID: null
> Plug-in ID: com.lesliesoftware.lphoto
>
> If I run from inside Eclipse with the target platform pointing to the
> install image I get this:
> AboutAction run found primary feature ID: com.lesliesoftware.lphoto
> Feature ID: com.lesliesoftware.lphoto
> Version ID: 0.1.0
> Plug-in ID: com.lesliesoftware.lphoto
>
> So I have two questions: Why is only one of my features showing up? And
> why is the version ID missing when I run outside the debugger?
>
> IL
>
> ---8<---
> IPlatformConfiguration conf =
> BootLoader.getCurrentPlatformConfiguration();
>
> // Primary feature
> String featureId = conf.getPrimaryFeatureIdentifier();
>
> ILog log = Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog();
> log.log (new Status (IStatus.INFO, PlatformUI.PLUGIN_ID, 0,
> "AboutAction run found primary feature ID: " + featureId, null));
> //$NON-NLS-1$
> System.out.println ("AboutAction run found primary feature ID: " +
> featureId); //$NON-NLS-1$
>
> // All features
> IPlatformConfiguration.IFeatureEntry[] entries =
> conf.getConfiguredFeatureEntries();
> for (int i = 0; i < entries.length; i++) {
> featureId = entries[i].getFeatureIdentifier();
> String versionId = entries[i].getFeatureVersion();
> String pluginId = entries[i].getFeaturePluginIdentifier();
> log.log (new Status (IStatus.INFO, PlatformUI.PLUGIN_ID, 0, "
> Feature ID: " + featureId, null)); //$NON-NLS-1$
> System.out.println (" Feature ID: " + featureId); //$NON-NLS-1$
> log.log (new Status (IStatus.INFO, PlatformUI.PLUGIN_ID, 0, "
> Version ID: " + versionId, null)); //$NON-NLS-1$
> System.out.println (" Version ID: " + versionId); //$NON-NLS-1$
> log.log (new Status (IStatus.INFO, PlatformUI.PLUGIN_ID, 0, "
> Plug-in ID: " + pluginId, null)); //$NON-NLS-1$
> System.out.println (" Plug-in ID: " + pluginId); //$NON-NLS-1$
> }
> ---8<---
>
|
|
|
Re: RCP - Trouble getting feature information [message #192312 is a reply to message #192206] |
Tue, 10 February 2004 22:33   |
Eclipse User |
|
|
|
Originally posted by: jeff_mcaffer_REMOVE.ca.ibm.com
Just so you know, there is work going on in this area to remove the direct
dependency on features. I believe this is scheduled for M8. See IProduct,
IBundleGroup, IBundleGroupProvider and associated methods on Platform to get
an idea of what is coming. The About dialog will be reimplemented in terms
of these classes.
Jeff
"Peter Manahan" <manahan@NOSPAM.ca.ibm.com> wrote in message
news:c0bh2m$dql$1@eclipse.org...
> This is working as far as I can tell in an rcp app.
>
> private void loadFeatureData() {
> try {
> ILocalSite ls = SiteManager.getLocalSite();
> IConfiguredSite[] cs = ls.getCurrentConfiguration()
> .getConfiguredSites();
> for (int i = 0; i < cs.length; i++) {
> IConfiguredSite site = cs[i];
> IFeatureReference[] fr = site.getConfiguredFeatures();
> for (int j = 0; j < fr.length; j++) {
> IFeatureReference ref = fr[j];
> IFeature f = ref.getFeature(null);
> System.out.println(
> f.getVersionedIdentifier().getIdentifier() +
> " " +
> f.getVersionedIdentifier().getVersion().toString());
>
> }
> }
>
> Peter
>
> Ian Lang wrote:
> > I have a simple app (based on the RCP articles originally posted at
> > http://www.eclipsepowered.org/rcp.html) which I am slowly building up.
I
> > am working on the about box at the moment. What I want to do is
something
> > similar to the way the Eclipse IDE does it (but less involved). I want
to
> > get information about the installed features and use their branding
> > information to display a dialog box. After reading the code used in
> > Eclipse's about box I started with the code below.
> >
> > My problem is I have two plug-ins and two features at the moment but
only
> > the primary one shows up in the collection from
> > IPlatformConfiguration.getConfiguredFeatureEntries ? see code below. In
> > fact I get different results depending on how I run it. If I run from
the
> > command line in my install directory I get this (outside dev
environment):
> > AboutAction run found primary feature ID: com.lesliesoftware.lphoto
> > Feature ID: com.lesliesoftware.lphoto
> > Version ID: null
> > Plug-in ID: com.lesliesoftware.lphoto
> >
> > If I run from inside Eclipse with the target platform pointing to the
> > install image I get this:
> > AboutAction run found primary feature ID: com.lesliesoftware.lphoto
> > Feature ID: com.lesliesoftware.lphoto
> > Version ID: 0.1.0
> > Plug-in ID: com.lesliesoftware.lphoto
> >
> > So I have two questions: Why is only one of my features showing up?
And
> > why is the version ID missing when I run outside the debugger?
> >
> > IL
> >
> > ---8<---
> > IPlatformConfiguration conf =
> > BootLoader.getCurrentPlatformConfiguration();
> >
> > // Primary feature
> > String featureId = conf.getPrimaryFeatureIdentifier();
> >
> > ILog log = Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog();
> > log.log (new Status (IStatus.INFO, PlatformUI.PLUGIN_ID, 0,
> > "AboutAction run found primary feature ID: " + featureId, null));
> > //$NON-NLS-1$
> > System.out.println ("AboutAction run found primary feature ID: " +
> > featureId); //$NON-NLS-1$
> >
> > // All features
> > IPlatformConfiguration.IFeatureEntry[] entries =
> > conf.getConfiguredFeatureEntries();
> > for (int i = 0; i < entries.length; i++) {
> > featureId = entries[i].getFeatureIdentifier();
> > String versionId = entries[i].getFeatureVersion();
> > String pluginId = entries[i].getFeaturePluginIdentifier();
> > log.log (new Status (IStatus.INFO, PlatformUI.PLUGIN_ID, 0, "
> > Feature ID: " + featureId, null)); //$NON-NLS-1$
> > System.out.println (" Feature ID: " + featureId); //$NON-NLS-1$
> > log.log (new Status (IStatus.INFO, PlatformUI.PLUGIN_ID, 0, "
> > Version ID: " + versionId, null)); //$NON-NLS-1$
> > System.out.println (" Version ID: " + versionId); //$NON-NLS-1$
> > log.log (new Status (IStatus.INFO, PlatformUI.PLUGIN_ID, 0, "
> > Plug-in ID: " + pluginId, null)); //$NON-NLS-1$
> > System.out.println (" Plug-in ID: " + pluginId); //$NON-NLS-1$
> > }
> > ---8<---
> >
>
|
|
|
|
|
|
|
|
|
|
|
Re: RCP - Trouble getting feature information [message #193934 is a reply to message #193460] |
Fri, 13 February 2004 08:59  |
Eclipse User |
|
|
|
Originally posted by: IanPLang.yahoo.com
Thanks, Peter.
Funny I still do not see them in the API docs but I added a dependency and
every thing is good.
IL
Peter Manahan wrote:
> They are in org.eclipse.update.core. If you are using features and want
> to update them via the update manager function you'll need that. If you
> don't care and just want the branding, then the work Jeff mentioned
> about the IProduct etc in Platform is probably the correct direction to
> head. RCP applications may not be using features so there needs to be
> another way to brand which is feature neutral.
> Peter
|
|
|
Powered by
FUDForum. Page generated in 0.03835 seconds