Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » P2 » cannot find packages for p2
cannot find packages for p2 [message #543715] Wed, 30 June 2010 11:45 Go to next message
Luca Ferrari is currently offline Luca FerrariFriend
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 #544571 is a reply to message #543715] Sun, 04 July 2010 03:45 Go to previous messageGo to next message
Janaka Padukka is currently offline Janaka PadukkaFriend
Messages: 14
Registered: February 2010
Junior Member
Hi Luca,

I have the same problem. Did you find an answer?. If yes please post in this thread. I will do the same if I find some clue. I think the problem is we are working with eclipse 3.5 and these new packages reside on 3.6 version. I tried to find plugins, had no luck with it


Thanks,
Janaka
Re: cannot find packages for p2 [message #544841 is a reply to message #543715] Mon, 05 July 2010 16:54 Go to previous message
Andrew Niefer is currently offline Andrew NieferFriend
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 #561468 is a reply to message #543715] Sun, 04 July 2010 03:46 Go to previous message
Janaka Padukka is currently offline Janaka PadukkaFriend
Messages: 14
Registered: February 2010
Junior Member
Hi Luca,

I have the same problem. Did you find an answer?. If yes please post in this thread. I will do the same if I find some clue. I think the problem is we are working with eclipse 3.5 and these new packages reside on 3.6 version. I tried to find plugins, had no luck with it


Thanks,
Janaka
Re: cannot find packages for p2 [message #561529 is a reply to message #543715] Mon, 05 July 2010 16:54 Go to previous message
Andrew Niefer is currently offline Andrew NieferFriend
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?
Previous Topic:Custom installer: multiple app. installation
Next Topic:Huge export size of RCP p2 enabled product
Goto Forum:
  


Current Time: Sun Dec 21 15:18:49 GMT 2014

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

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