Home » Eclipse Projects » P2 » cannot find packages for p2
cannot find packages for p2 [message #543715] |
Wed, 30 June 2010 11:45 |
Luca Ferrari Messages: 159 Registered: November 2009 |
Senior Member |
|
|
Hi all,
I've got an RCP stand-alone application and I'd like to use P2 to provide auto-update mechanism. Having a look at http:// wiki.eclipse.org/Equinox/p2/Adding_Self-Update_to_an_RCP_App lication it seems that the Headless Updating on Startup section gives me what I want. However, trying the following code (directly from the web page above):
public class P2Util {
// XXX Check for updates to this application and return a status.
static IStatus checkForUpdates(IProvisioningAgent agent, IProgressMonitor monitor) throws OperationCanceledException {
ProvisioningSession session = new ProvisioningSession(agent);
// the default update operation looks for updates to the currently
// running profile, using the default profile root marker. To change
// which installable units are being updated, use the more detailed
// constructors.
UpdateOperation operation = new UpdateOperation(session);
SubMonitor sub = SubMonitor.convert(monitor,
"Checking for application updates...", 200);
IStatus status = operation.resolveModal(sub.newChild(100));
if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
return status;
}
if (status.getSeverity() == IStatus.CANCEL)
throw new OperationCanceledException();
if (status.getSeverity() != IStatus.ERROR) {
// More complex status handling might include showing the user what updates
// are available if there are multiples, differentiating patches vs. updates, etc.
// In this example, we simply update as suggested by the operation.
ProvisioningJob job = operation.getProvisioningJob(null);
status = job.runModal(sub.newChild(100));
if (status.getSeverity() == IStatus.CANCEL)
throw new OperationCanceledException();
}
return status;
}
}
I got compilation errors even from IProvisioningAgent: I cannot find the package where the class is, even if I've added the p2.ui, p2.core, p2.ui.sdk and p2.ui.sched bundles to the java build path and runtime dependencies. The only doubt is that I got such bundles directly from the plugins directory of the Eclipse IDE installation.
Am I doing something wrong?
|
|
| |
Re: cannot find packages for p2 [message #544841 is a reply to message #543715] |
Mon, 05 July 2010 16:54 |
Andrew Niefer Messages: 990 Registered: July 2009 |
Senior Member |
|
|
IProvisioningAgent is in the org.eclipse.equinox.p2.core bundle.
You will need to add this to your MANIFEST.MF. On the dependencies tab of
the manifest editor, add the bundle to the "Required Plug-ins" list. Or,
add "org.eclipse.equinox.p2.core" to the "Imported Packages" list.
I don't know if adding them directly to the java build path is good enough
since for plugin projects, PDE manages the build path based on the contents
of the manifest. (If you are just using a java project, you will want to
change to a plugin project to properly work with p2).
-Andrew
Luca Ferrari wrote:
> Hi all,
> I've got an RCP stand-alone application and I'd like to use P2 to provide
> auto-update mechanism. Having a look at
>
http://wiki.eclipse.org/Equinox/p2/Adding_Self-Update_to_an_ RCP_Application
> it seems that the Headless Updating on Startup section gives me what I
> want. However, trying the following code (directly from the web page
> above):
>
>
> public class P2Util {
> // XXX Check for updates to this application and return a status.
> static IStatus checkForUpdates(IProvisioningAgent agent, IProgressMonitor
> monitor) throws OperationCanceledException { ProvisioningSession session =
> new ProvisioningSession(agent); // the default update operation looks for
> updates to the currently // running profile, using the default profile
> root marker. To change // which installable units are being updated, use
> the more detailed // constructors.
> UpdateOperation operation = new UpdateOperation(session);
> SubMonitor sub = SubMonitor.convert(monitor,
> "Checking for application updates...", 200);
> IStatus status = operation.resolveModal(sub.newChild(100));
> if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
> return status;
> }
> if (status.getSeverity() == IStatus.CANCEL)
> throw new OperationCanceledException();
>
> if (status.getSeverity() != IStatus.ERROR) {
> // More complex status handling might include showing the user what
> updates // are available if there are multiples, differentiating patches
> vs. updates, etc. // In this example, we simply update as suggested by the
> operation. ProvisioningJob job = operation.getProvisioningJob(null);
> status = job.runModal(sub.newChild(100));
> if (status.getSeverity() == IStatus.CANCEL)
> throw new OperationCanceledException();
> }
> return status;
> }
> }
>
>
>
> I got compilation errors even from IProvisioningAgent: I cannot find the
> package where the class is, even if I've added the p2.ui, p2.core,
> p2.ui.sdk and p2.ui.sched bundles to the java build path and runtime
> dependencies. The only doubt is that I got such bundles directly from the
> plugins directory of the Eclipse IDE installation. Am I doing something
> wrong?
|
|
| |
Re: cannot find packages for p2 [message #561529 is a reply to message #543715] |
Mon, 05 July 2010 16:54 |
Andrew Niefer Messages: 990 Registered: July 2009 |
Senior Member |
|
|
IProvisioningAgent is in the org.eclipse.equinox.p2.core bundle.
You will need to add this to your MANIFEST.MF. On the dependencies tab of
the manifest editor, add the bundle to the "Required Plug-ins" list. Or,
add "org.eclipse.equinox.p2.core" to the "Imported Packages" list.
I don't know if adding them directly to the java build path is good enough
since for plugin projects, PDE manages the build path based on the contents
of the manifest. (If you are just using a java project, you will want to
change to a plugin project to properly work with p2).
-Andrew
Luca Ferrari wrote:
> Hi all,
> I've got an RCP stand-alone application and I'd like to use P2 to provide
> auto-update mechanism. Having a look at
>
http://wiki.eclipse.org/Equinox/p2/Adding_Self-Update_to_an_ RCP_Application
> it seems that the Headless Updating on Startup section gives me what I
> want. However, trying the following code (directly from the web page
> above):
>
>
> public class P2Util {
> // XXX Check for updates to this application and return a status.
> static IStatus checkForUpdates(IProvisioningAgent agent, IProgressMonitor
> monitor) throws OperationCanceledException { ProvisioningSession session =
> new ProvisioningSession(agent); // the default update operation looks for
> updates to the currently // running profile, using the default profile
> root marker. To change // which installable units are being updated, use
> the more detailed // constructors.
> UpdateOperation operation = new UpdateOperation(session);
> SubMonitor sub = SubMonitor.convert(monitor,
> "Checking for application updates...", 200);
> IStatus status = operation.resolveModal(sub.newChild(100));
> if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
> return status;
> }
> if (status.getSeverity() == IStatus.CANCEL)
> throw new OperationCanceledException();
>
> if (status.getSeverity() != IStatus.ERROR) {
> // More complex status handling might include showing the user what
> updates // are available if there are multiples, differentiating patches
> vs. updates, etc. // In this example, we simply update as suggested by the
> operation. ProvisioningJob job = operation.getProvisioningJob(null);
> status = job.runModal(sub.newChild(100));
> if (status.getSeverity() == IStatus.CANCEL)
> throw new OperationCanceledException();
> }
> return status;
> }
> }
>
>
>
> I got compilation errors even from IProvisioningAgent: I cannot find the
> package where the class is, even if I've added the p2.ui, p2.core,
> p2.ui.sdk and p2.ui.sched bundles to the java build path and runtime
> dependencies. The only doubt is that I got such bundles directly from the
> plugins directory of the Eclipse IDE installation. Am I doing something
> wrong?
|
|
|
Goto Forum:
Current Time: Thu Apr 25 17:52:53 GMT 2024
Powered by FUDForum. Page generated in 0.03734 seconds
|