Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusan Franklin2010-03-07 12:40:48 -0500
committerSusan Franklin2010-03-07 12:40:48 -0500
commitcbac1dc3a189b4a9a73ecca736f3e9dde5d27686 (patch)
tree4e67f046148eb12944f62e5b1fab0807a7aba2c7
parent9b2d5617f5d98b6456998bf52881cd7a85398d83 (diff)
downloadrt.equinox.p2-cbac1dc3a189b4a9a73ecca736f3e9dde5d27686.tar.gz
rt.equinox.p2-cbac1dc3a189b4a9a73ecca736f3e9dde5d27686.tar.xz
rt.equinox.p2-cbac1dc3a189b4a9a73ecca736f3e9dde5d27686.zip
Bug 302183 - [operations] ProvisioningSession is weirdv20100307-1300
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java112
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java35
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/SizingTest.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ArtifactRepositoryTracker.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/MetadataRepositoryTracker.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/operations/DiscoveryInstallOperation.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/repository/RepositoryDiscoveryStrategy.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java108
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryNameAndLocationDialog.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java25
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableUpdateElement.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java7
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchAdvisor.java3
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/P2Util.java2
37 files changed, 354 insertions, 249 deletions
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java
index 14ed2c330..23c46986d 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java
@@ -15,6 +15,7 @@ import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.operations.*;
+import org.eclipse.equinox.p2.planner.IPlanner;
/**
* Class representing a provisioning profile plan
@@ -63,7 +64,7 @@ public class PlannerResolutionJob extends ProvisioningJob implements IProfileCha
}
public IStatus runModal(IProgressMonitor monitor) {
- plan = getSession().getPlanner().getProvisioningPlan(request, provisioningContext, monitor);
+ plan = ((IPlanner) getSession().getProvisioningAgent().getService(IPlanner.SERVICE_NAME)).getProvisioningPlan(request, provisioningContext, monitor);
if (plan == null) {
return new Status(IStatus.ERROR, Activator.ID, Messages.PlannerResolutionJob_NullProvisioningPlan);
}
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java
index fe15d96cc..ff80f4186 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java
@@ -16,19 +16,17 @@ import java.io.IOException;
import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.p2.operations.*;
+import org.eclipse.equinox.internal.p2.operations.Activator;
+import org.eclipse.equinox.internal.p2.operations.Messages;
import org.eclipse.equinox.internal.provisional.configurator.Configurator;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.p2.core.IAgentLocation;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.*;
-import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery;
-import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.planner.IPlanner;
-import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
@@ -46,33 +44,6 @@ public class ProvisioningSession {
Set<Job> scheduledJobs = Collections.synchronizedSet(new HashSet<Job>());
/**
- * A constant indicating that there was nothing to size (there
- * was no valid plan that could be used to compute
- * size).
- */
- public static final long SIZE_NOTAPPLICABLE = -3L;
- /**
- * Indicates that the size is unavailable (an
- * attempt was made to compute size but it failed)
- */
- public static final long SIZE_UNAVAILABLE = -2L;
- /**
- * Indicates that the size is currently unknown
- */
- public static final long SIZE_UNKNOWN = -1L;
-
- /**
- * A status code used to indicate that there were no updates found when
- * looking for updates.
- */
- public static final int STATUS_NOTHING_TO_UPDATE = IStatusCodes.NOTHING_TO_UPDATE;
-
- /**
- * A status code used to indicate that a repository location was not valid.
- */
- public static final int STATUS_INVALID_REPOSITORY_LOCATION = IStatusCodes.INVALID_REPOSITORY_LOCATION;
-
- /**
* Create a provisioning session using the services of the supplied agent.
* @param agent the provisioning agent that supplies services. Must not be <code>null</code>.
*/
@@ -93,7 +64,7 @@ public class ProvisioningSession {
* Return the agent location for this session
* @return the agent location
*/
- public IAgentLocation getAgentLocation() {
+ IAgentLocation getAgentLocation() {
return (IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME);
}
@@ -101,7 +72,7 @@ public class ProvisioningSession {
* Return the artifact repository manager for this session
* @return the repository manager
*/
- public IArtifactRepositoryManager getArtifactRepositoryManager() {
+ IArtifactRepositoryManager getArtifactRepositoryManager() {
return (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
}
@@ -109,13 +80,15 @@ public class ProvisioningSession {
* Return the metadata repository manager for this session
* @return the repository manager
*/
- public IMetadataRepositoryManager getMetadataRepositoryManager() {
+ IMetadataRepositoryManager getMetadataRepositoryManager() {
return (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
}
/**
* Return the profile registry for this session
* @return the profile registry
+ *
+ * @deprecated this API will not appear in the final release.
*/
public IProfileRegistry getProfileRegistry() {
return (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
@@ -125,7 +98,7 @@ public class ProvisioningSession {
* Return the provisioning engine for this session
* @return the provisioning engine
*/
- public IEngine getEngine() {
+ IEngine getEngine() {
return (IEngine) agent.getService(IEngine.SERVICE_NAME);
}
@@ -133,7 +106,7 @@ public class ProvisioningSession {
* Return the provisioning event bus used for dispatching events.
* @return the event bus
*/
- public IProvisioningEventBus getProvisioningEventBus() {
+ IProvisioningEventBus getProvisioningEventBus() {
return (IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME);
}
@@ -141,51 +114,11 @@ public class ProvisioningSession {
* Return the planner used for this session
* @return the planner
*/
- public IPlanner getPlanner() {
+ IPlanner getPlanner() {
return (IPlanner) agent.getService(IPlanner.SERVICE_NAME);
}
/**
- * Get sizing information about the specified plan.
- *
- * @param plan the provisioning plan
- * @param context the provisioning context to be used for the sizing
- * @param monitor the progress monitor
- *
- * @return a long integer describing the disk size required for the provisioning plan.
- *
- * @see #SIZE_UNKNOWN
- * @see #SIZE_UNAVAILABLE
- * @see #SIZE_NOTAPPLICABLE
- */
- public long getSize(IProvisioningPlan plan, ProvisioningContext context, IProgressMonitor monitor) {
- // If there is nothing to size, return 0
- if (plan == null)
- return SIZE_NOTAPPLICABLE;
- if (countPlanElements(plan) == 0)
- return 0;
- long installPlanSize = 0;
- SubMonitor mon = SubMonitor.convert(monitor, 300);
- if (plan.getInstallerPlan() != null) {
- ISizingPhaseSet sizingPhaseSet = PhaseSetFactory.createSizingPhaseSet();
- IStatus status = getEngine().perform(plan.getInstallerPlan(), sizingPhaseSet, mon.newChild(100));
- if (status.isOK())
- installPlanSize = sizingPhaseSet.getDiskSize();
- } else {
- mon.worked(100);
- }
- ISizingPhaseSet sizingPhaseSet = PhaseSetFactory.createSizingPhaseSet();
- IStatus status = getEngine().perform(plan, sizingPhaseSet, mon.newChild(200));
- if (status.isOK())
- return installPlanSize + sizingPhaseSet.getDiskSize();
- return SIZE_UNAVAILABLE;
- }
-
- private int countPlanElements(IProvisioningPlan plan) {
- return QueryUtil.compoundQueryable(plan.getAdditions(), plan.getRemovals()).query(QueryUtil.createIUAnyQuery(), null).toUnmodifiableSet().size();
- }
-
- /**
* Perform the specified provisioning plan.
*
* @param plan the provisioning plan to be performed
@@ -290,27 +223,4 @@ public class ProvisioningSession {
}
});
}
-
- /**
- * Get the IInstallable units for the specified profile
- *
- * @param profileId the profile in question
- * @param all <code>true</code> if all IInstallableUnits in the profile should
- * be returned, <code>false</code> only those IInstallableUnits marked as (user visible) roots
- * should be returned.
- *
- * @return an array of IInstallableUnits installed in the profile.
- */
- public Collection<IInstallableUnit> getInstalledIUs(String profileId, boolean all) {
- IProfile profile = getProfileRegistry().getProfile(profileId);
- if (profile == null)
- return CollectionUtils.emptyList();
- IQuery<IInstallableUnit> query;
- if (all)
- query = QueryUtil.createIUAnyQuery();
- else
- query = new UserVisibleRootQuery();
- IQueryResult<IInstallableUnit> queryResult = profile.query(query, null);
- return queryResult.toUnmodifiableSet();
- }
}
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java
index dce8ba2f9..fd2a99abd 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java
@@ -30,6 +30,11 @@ import org.eclipse.osgi.util.NLS;
*/
public abstract class RepositoryTracker {
+ /**
+ * A status code used to indicate that a repository location was not valid.
+ */
+ public static final int STATUS_INVALID_REPOSITORY_LOCATION = IStatusCodes.INVALID_REPOSITORY_LOCATION;
+
// What repositories to show
private int artifactRepositoryFlags = IRepositoryManager.REPOSITORIES_NON_SYSTEM;
private int metadataRepositoryFlags = IRepositoryManager.REPOSITORIES_NON_SYSTEM;
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java
index 4c6d82399..45c135df8 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java
@@ -12,16 +12,16 @@
package org.eclipse.equinox.p2.operations;
-import org.eclipse.equinox.p2.planner.ProfileInclusionRules;
-
import java.util.*;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.operations.*;
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.p2.query.IQueryResult;
-import org.eclipse.equinox.p2.query.QueryUtil;
+import org.eclipse.equinox.p2.planner.ProfileInclusionRules;
+import org.eclipse.equinox.p2.query.*;
/**
* An UpdateOperation describes an operation that updates {@link IInstallableUnit}s in
@@ -61,6 +61,12 @@ import org.eclipse.equinox.p2.query.QueryUtil;
*/
public class UpdateOperation extends ProfileChangeOperation {
+ /**
+ * A status code used to indicate that there were no updates found when
+ * looking for updates.
+ */
+ public static final int STATUS_NOTHING_TO_UPDATE = IStatusCodes.NOTHING_TO_UPDATE;
+
private Collection<IInstallableUnit> iusToUpdate;
private HashMap<IInstallableUnit, List<Update>> possibleUpdatesByIU = new HashMap<IInstallableUnit, List<Update>>();
private List<Update> defaultUpdates;
@@ -270,8 +276,27 @@ public class UpdateOperation extends ProfileChangeOperation {
protected void prepareToResolve() {
super.prepareToResolve();
if (iusToUpdate == null) {
- iusToUpdate = session.getInstalledIUs(profileId, false);
+ iusToUpdate = getInstalledIUs();
}
}
+ /*
+ * Get the IInstallable units for the specified profile
+ *
+ * @param profileId the profile in question
+ * @param all <code>true</code> if all IInstallableUnits in the profile should
+ * be returned, <code>false</code> only those IInstallableUnits marked as (user visible) roots
+ * should be returned.
+ *
+ * @return an array of IInstallableUnits installed in the profile.
+ */
+ private Collection<IInstallableUnit> getInstalledIUs() {
+ IProfile profile = session.getProfileRegistry().getProfile(profileId);
+ if (profile == null)
+ return CollectionUtils.emptyList();
+ IQuery<IInstallableUnit> query = new UserVisibleRootQuery();
+ IQueryResult<IInstallableUnit> queryResult = profile.query(query, null);
+ return queryResult.toUnmodifiableSet();
+ }
+
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
index 0cdf00266..0a8cdf778 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
@@ -10,11 +10,6 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.ui;
-import org.eclipse.equinox.p2.engine.PhaseSetFactory;
-
-import org.eclipse.equinox.p2.metadata.MetadataFactory;
-import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
-
import java.io.File;
import java.net.URI;
import java.util.Dictionary;
@@ -27,6 +22,7 @@ import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.engine.*;
import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.operations.*;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
@@ -143,7 +139,7 @@ public abstract class AbstractProvisioningUITest extends AbstractProvisioningTes
req.setInstallableUnitProfileProperty(iu, IProfile.PROP_PROFILE_LOCKED_IU, new Integer(IProfile.LOCK_UNINSTALL | IProfile.LOCK_UPDATE).toString());
}
// Use an empty provisioning context to prevent repo access
- IProvisioningPlan plan = getSession().getPlanner().getProvisioningPlan(req, new ProvisioningContext(new URI[] {}), getMonitor());
+ IProvisioningPlan plan = getPlanner(getSession().getProvisioningAgent()).getProvisioningPlan(req, new ProvisioningContext(new URI[] {}), getMonitor());
if (plan.getStatus().getSeverity() == IStatus.ERROR || plan.getStatus().getSeverity() == IStatus.CANCEL)
return plan.getStatus();
return getSession().performProvisioningPlan(plan, PhaseSetFactory.createDefaultPhaseSet(), new ProvisioningContext(), getMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java
index f895ccd5e..9c021e5ab 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java
@@ -63,7 +63,7 @@ public class ElementUtilsTest extends ProfileModificationActionTest {
// Two visible repos, one is added, the other is not
URI known1 = new URI("http://example.com/known1");
URI known2 = new URI("http://example.com/known2");
- IMetadataRepositoryManager manager = session.getMetadataRepositoryManager();
+ IMetadataRepositoryManager manager = getMetadataRepositoryManager();
manager.addRepository(known1);
// Add system repos that should not be known or affected by ElementUtils
@@ -73,10 +73,10 @@ public class ElementUtilsTest extends ProfileModificationActionTest {
manager.addRepository(uri);
manager.setRepositoryProperty(uri, IRepository.PROP_SYSTEM, Boolean.toString(true));
manager.addRepository(uri2);
- session.getArtifactRepositoryManager().addRepository(uri2);
+ getArtifactRepositoryManager().addRepository(uri2);
manager.setRepositoryProperty(uri2, IRepository.PROP_SYSTEM, Boolean.toString(true));
manager.setEnabled(uri2, false);
- session.getArtifactRepositoryManager().setEnabled(uri2, false);
+ getArtifactRepositoryManager().setEnabled(uri2, false);
List children = new ArrayList();
children.add(new MetadataRepositoryElement(null, known1, true));
@@ -140,8 +140,8 @@ public class ElementUtilsTest extends ProfileModificationActionTest {
display.sleep();
}
- URI[] enabled = session.getMetadataRepositoryManager().getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
- URI[] disabled = session.getMetadataRepositoryManager().getKnownRepositories(IRepositoryManager.REPOSITORIES_DISABLED);
+ URI[] enabled = getMetadataRepositoryManager().getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
+ URI[] disabled = getMetadataRepositoryManager().getKnownRepositories(IRepositoryManager.REPOSITORIES_DISABLED);
boolean foundKnown1 = false;
boolean foundKnown2 = false;
@@ -184,7 +184,7 @@ public class ElementUtilsTest extends ProfileModificationActionTest {
manager.removeRepository(known2);
manager.removeRepository(uri);
manager.removeRepository(uri2);
- session.getArtifactRepositoryManager().removeRepository(uri2);
+ getArtifactRepositoryManager().removeRepository(uri2);
manager.removeRepository(uri3);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/SizingTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/SizingTest.java
index a740e891e..efefd7c00 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/SizingTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/SizingTest.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.ui.operations;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.p2.engine.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.equinox.p2.tests.ui.AbstractProvisioningUITest;
/**
@@ -25,9 +25,9 @@ public class SizingTest extends AbstractProvisioningUITest {
IProfile testProfile = createProfile(profileId);
ProfileChangeRequest request = new ProfileChangeRequest(testProfile);
IProvisioningPlan plan = null;
- plan = getSession().getPlanner().getProvisioningPlan(request, new ProvisioningContext(), getMonitor());
- long size = ProvisioningSession.SIZE_NOTAPPLICABLE;
- size = getSession().getSize(plan, new ProvisioningContext(), getMonitor());
+ plan = getPlanner(getSession().getProvisioningAgent()).getProvisioningPlan(request, new ProvisioningContext(), getMonitor());
+ long size = ProvUI.SIZE_NOTAPPLICABLE;
+ size = ProvUI.getSize(getEngine(), plan, new ProvisioningContext(), getMonitor());
assertEquals("1.0", 0, size);
}
@@ -41,9 +41,9 @@ public class SizingTest extends AbstractProvisioningUITest {
ProfileChangeRequest request = new ProfileChangeRequest(testProfile);
request.add(f1);
IProvisioningPlan plan = null;
- plan = getSession().getPlanner().getProvisioningPlan(request, new ProvisioningContext(), getMonitor());
- long size = ProvisioningSession.SIZE_NOTAPPLICABLE;
- size = getSession().getSize(plan, new ProvisioningContext(), getMonitor());
+ plan = getPlanner(getSession().getProvisioningAgent()).getProvisioningPlan(request, new ProvisioningContext(), getMonitor());
+ long size = ProvUI.SIZE_NOTAPPLICABLE;
+ size = ProvUI.getSize(getEngine(), plan, new ProvisioningContext(), getMonitor());
assertEquals("1.0", 0, size);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ArtifactRepositoryTracker.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ArtifactRepositoryTracker.java
index 32590953f..ba8ce8de6 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ArtifactRepositoryTracker.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ArtifactRepositoryTracker.java
@@ -14,11 +14,13 @@ package org.eclipse.equinox.internal.p2.ui.admin;
import java.net.URI;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.equinox.p2.operations.RepositoryTracker;
import org.eclipse.equinox.p2.repository.IRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
public class ArtifactRepositoryTracker extends RepositoryTracker {
@@ -30,15 +32,15 @@ public class ArtifactRepositoryTracker extends RepositoryTracker {
}
public URI[] getKnownRepositories(ProvisioningSession session) {
- return session.getArtifactRepositoryManager().getKnownRepositories(getArtifactRepositoryFlags());
+ return getArtifactRepositoryManager().getKnownRepositories(getArtifactRepositoryFlags());
}
public void addRepository(URI repoLocation, String nickname, ProvisioningSession session) {
ui.signalRepositoryOperationStart();
try {
- session.getArtifactRepositoryManager().addRepository(repoLocation);
+ getArtifactRepositoryManager().addRepository(repoLocation);
if (nickname != null)
- session.getArtifactRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname);
+ getArtifactRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname);
} finally {
ui.signalRepositoryOperationComplete(new RepositoryEvent(repoLocation, IRepository.TYPE_ARTIFACT, RepositoryEvent.ADDED, true), true);
}
@@ -51,7 +53,7 @@ public class ArtifactRepositoryTracker extends RepositoryTracker {
ui.signalRepositoryOperationStart();
try {
for (int i = 0; i < repoLocations.length; i++) {
- session.getArtifactRepositoryManager().removeRepository(repoLocations[i]);
+ getArtifactRepositoryManager().removeRepository(repoLocations[i]);
}
} finally {
ui.signalRepositoryOperationComplete(null, true);
@@ -67,7 +69,7 @@ public class ArtifactRepositoryTracker extends RepositoryTracker {
SubMonitor mon = SubMonitor.convert(monitor, locations.length * 100);
for (int i = 0; i < locations.length; i++) {
try {
- session.getArtifactRepositoryManager().refreshRepository(locations[i], mon.newChild(100));
+ getArtifactRepositoryManager().refreshRepository(locations[i], mon.newChild(100));
} catch (ProvisionException e) {
//ignore problematic repositories when refreshing
}
@@ -76,4 +78,8 @@ public class ArtifactRepositoryTracker extends RepositoryTracker {
// refreshing these, this one, so we do not use a specific repository event to represent it.
ui.signalRepositoryOperationComplete(null, true);
}
+
+ IArtifactRepositoryManager getArtifactRepositoryManager() {
+ return ProvUI.getArtifactRepositoryManager(ui.getSession());
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/MetadataRepositoryTracker.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/MetadataRepositoryTracker.java
index 7c95ee6eb..107a53152 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/MetadataRepositoryTracker.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/MetadataRepositoryTracker.java
@@ -14,11 +14,13 @@ package org.eclipse.equinox.internal.p2.ui.admin;
import java.net.URI;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.equinox.p2.operations.RepositoryTracker;
import org.eclipse.equinox.p2.repository.IRepository;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
public class MetadataRepositoryTracker extends RepositoryTracker {
@@ -30,15 +32,15 @@ public class MetadataRepositoryTracker extends RepositoryTracker {
}
public URI[] getKnownRepositories(ProvisioningSession session) {
- return session.getMetadataRepositoryManager().getKnownRepositories(getArtifactRepositoryFlags());
+ return getMetadataRepositoryManager().getKnownRepositories(getArtifactRepositoryFlags());
}
public void addRepository(URI repoLocation, String nickname, ProvisioningSession session) {
ui.signalRepositoryOperationStart();
try {
- session.getMetadataRepositoryManager().addRepository(repoLocation);
+ getMetadataRepositoryManager().addRepository(repoLocation);
if (nickname != null)
- session.getMetadataRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname);
+ getMetadataRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname);
} finally {
ui.signalRepositoryOperationComplete(new RepositoryEvent(repoLocation, IRepository.TYPE_METADATA, RepositoryEvent.ADDED, true), true);
@@ -52,7 +54,7 @@ public class MetadataRepositoryTracker extends RepositoryTracker {
ui.signalRepositoryOperationStart();
try {
for (int i = 0; i < repoLocations.length; i++) {
- session.getMetadataRepositoryManager().removeRepository(repoLocations[i]);
+ getMetadataRepositoryManager().removeRepository(repoLocations[i]);
}
} finally {
ui.signalRepositoryOperationComplete(null, true);
@@ -68,7 +70,7 @@ public class MetadataRepositoryTracker extends RepositoryTracker {
SubMonitor mon = SubMonitor.convert(monitor, locations.length * 100);
for (int i = 0; i < locations.length; i++) {
try {
- session.getArtifactRepositoryManager().refreshRepository(locations[i], mon.newChild(100));
+ getMetadataRepositoryManager().refreshRepository(locations[i], mon.newChild(100));
} catch (ProvisionException e) {
//ignore problematic repositories when refreshing
}
@@ -77,4 +79,8 @@ public class MetadataRepositoryTracker extends RepositoryTracker {
// refreshing these, this one, so we do not use a specific repository event to represent it.
ui.signalRepositoryOperationComplete(null, true);
}
+
+ IMetadataRepositoryManager getMetadataRepositoryManager() {
+ return ProvUI.getMetadataRepositoryManager(ui.getSession());
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/operations/DiscoveryInstallOperation.java b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/operations/DiscoveryInstallOperation.java
index 0d005ec29..6201c573a 100644
--- a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/operations/DiscoveryInstallOperation.java
+++ b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/operations/DiscoveryInstallOperation.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.discovery.operations;
-import org.eclipse.equinox.p2.query.QueryUtil;
-
import java.lang.reflect.InvocationTargetException;
import java.net.*;
import java.util.*;
@@ -24,9 +22,9 @@ import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.operations.*;
-import org.eclipse.equinox.p2.query.IQuery;
-import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.*;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -275,9 +273,10 @@ public class DiscoveryInstallOperation implements IRunnableWithProgress {
// fetch meta-data for these repositories
ArrayList<IMetadataRepository> repositories = new ArrayList<IMetadataRepository>();
monitor.setWorkRemaining(repositories.size());
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) session.getProvisioningAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
for (URI uri : repositoryLocations) {
checkCancelled(monitor);
- IMetadataRepository repository = session.getMetadataRepositoryManager().loadRepository(uri, monitor.newChild(1));
+ IMetadataRepository repository = manager.loadRepository(uri, monitor.newChild(1));
repositories.add(repository);
}
return repositories;
diff --git a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/repository/RepositoryDiscoveryStrategy.java b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/repository/RepositoryDiscoveryStrategy.java
index bcf8fc5ff..9976ba087 100644
--- a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/repository/RepositoryDiscoveryStrategy.java
+++ b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/repository/RepositoryDiscoveryStrategy.java
@@ -11,8 +11,6 @@
package org.eclipse.equinox.internal.p2.ui.discovery.repository;
-import org.eclipse.equinox.p2.query.QueryUtil;
-
import java.net.URI;
import java.util.*;
import org.eclipse.core.runtime.*;
@@ -27,9 +25,9 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.equinox.p2.operations.RepositoryTracker;
-import org.eclipse.equinox.p2.query.IQuery;
-import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.*;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
@@ -110,8 +108,9 @@ public class RepositoryDiscoveryStrategy extends AbstractDiscoveryStrategy {
// fetch meta-data for these repositories
ArrayList<IMetadataRepository> repositories = new ArrayList<IMetadataRepository>();
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) session.getProvisioningAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
for (URI uri : locations) {
- IMetadataRepository repository = session.getMetadataRepositoryManager().loadRepository(uri, monitor.newChild(1));
+ IMetadataRepository repository = manager.loadRepository(uri, monitor.newChild(1));
repositories.add(repository);
}
return repositories;
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java
index 3c5c01b79..b21a230de 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java
@@ -16,12 +16,17 @@ import java.lang.reflect.Method;
import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
+import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
import org.eclipse.equinox.internal.provisional.p2.updatechecker.IUpdateListener;
import org.eclipse.equinox.internal.provisional.p2.updatechecker.UpdateEvent;
import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.operations.*;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -60,15 +65,15 @@ public class AutomaticUpdater implements IUpdateListener {
}
}
};
- getProvisioningUI().getSession().getProvisioningEventBus().addListener(profileListener);
+ getProvisioningEventBus().addListener(profileListener);
}
private boolean sameProfile(String another) {
if (another.equals(IProfileRegistry.SELF)) {
- another = getSession().getProfileRegistry().getProfile(another).getProfileId();
+ another = getProfileRegistry().getProfile(another).getProfileId();
}
if (profileId.equals(IProfileRegistry.SELF)) {
- profileId = getSession().getProfileRegistry().getProfile(profileId).getProfileId();
+ profileId = getProfileRegistry().getProfile(profileId).getProfileId();
}
return profileId.equals(another);
}
@@ -161,7 +166,7 @@ public class AutomaticUpdater implements IUpdateListener {
void validateIusToUpdate() {
ArrayList<IInstallableUnit> list = new ArrayList<IInstallableUnit>(iusWithUpdates.size());
- IProfile profile = getSession().getProfileRegistry().getProfile(profileId);
+ IProfile profile = getProfileRegistry().getProfile(profileId);
for (IInstallableUnit iuWithUpdate : iusWithUpdates) {
try {
@@ -326,7 +331,7 @@ public class AutomaticUpdater implements IUpdateListener {
// notify that updates are available for all roots. We don't know for sure that
// there are any, but this will cause everything to be rechecked. Don't trigger
// a popup, just update the affordance and internal state.
- updatesAvailable(new UpdateEvent(profileId, getSession().getInstalledIUs(profileId, false)), false);
+ updatesAvailable(new UpdateEvent(profileId, getInstalledIUs()));
return Status.OK_STATUS;
}
};
@@ -336,14 +341,41 @@ public class AutomaticUpdater implements IUpdateListener {
notifyJob.schedule();
}
+ /*
+ * Get the IInstallable units for the specified profile
+ *
+ * @param profileId the profile in question
+ * @param all <code>true</code> if all IInstallableUnits in the profile should
+ * be returned, <code>false</code> only those IInstallableUnits marked as (user visible) roots
+ * should be returned.
+ *
+ * @return an array of IInstallableUnits installed in the profile.
+ */
+ public Collection<IInstallableUnit> getInstalledIUs() {
+ IProfile profile = getProfileRegistry().getProfile(profileId);
+ if (profile == null)
+ return CollectionUtils.emptyList();
+ IQuery<IInstallableUnit> query = new UserVisibleRootQuery();
+ IQueryResult<IInstallableUnit> queryResult = profile.query(query, null);
+ return queryResult.toUnmodifiableSet();
+ }
+
public void shutdown() {
statusLineManager = null;
if (profileListener != null) {
- getSession().getProvisioningEventBus().removeListener(profileListener);
+ getProvisioningEventBus().removeListener(profileListener);
profileListener = null;
}
}
+ IProfileRegistry getProfileRegistry() {
+ return (IProfileRegistry) getSession().getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME);
+ }
+
+ IProvisioningEventBus getProvisioningEventBus() {
+ return (IProvisioningEventBus) getSession().getProvisioningAgent().getService(IProvisioningEventBus.SERVICE_NAME);
+ }
+
IPreferenceStore getPreferenceStore() {
return AutomaticUpdatePlugin.getDefault().getPreferenceStore();
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java
index 5147b8238..a7dc3182a 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java
@@ -19,6 +19,8 @@ import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.equinox.p2.operations.RepositoryTracker;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.window.Window;
@@ -54,17 +56,17 @@ public class ColocatedRepositoryTracker extends RepositoryTracker {
* @see org.eclipse.equinox.internal.provisional.p2.ui.policy.RepositoryManipulator#getKnownRepositories()
*/
public URI[] getKnownRepositories(ProvisioningSession session) {
- return session.getMetadataRepositoryManager().getKnownRepositories(getMetadataRepositoryFlags());
+ return getMetadataRepositoryManager().getKnownRepositories(getMetadataRepositoryFlags());
}
public void addRepository(URI repoLocation, String nickname, ProvisioningSession session) {
ui.signalRepositoryOperationStart();
try {
- session.getMetadataRepositoryManager().addRepository(repoLocation);
- session.getArtifactRepositoryManager().addRepository(repoLocation);
+ getMetadataRepositoryManager().addRepository(repoLocation);
+ getArtifactRepositoryManager().addRepository(repoLocation);
if (nickname != null) {
- session.getMetadataRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname);
- session.getArtifactRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname);
+ getMetadataRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname);
+ getArtifactRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname);
}
} finally {
@@ -80,8 +82,8 @@ public class ColocatedRepositoryTracker extends RepositoryTracker {
ui.signalRepositoryOperationStart();
try {
for (int i = 0; i < repoLocations.length; i++) {
- session.getMetadataRepositoryManager().removeRepository(repoLocations[i]);
- session.getArtifactRepositoryManager().removeRepository(repoLocations[i]);
+ getMetadataRepositoryManager().removeRepository(repoLocations[i]);
+ getArtifactRepositoryManager().removeRepository(repoLocations[i]);
}
} finally {
ui.signalRepositoryOperationComplete(null, true);
@@ -97,8 +99,8 @@ public class ColocatedRepositoryTracker extends RepositoryTracker {
SubMonitor mon = SubMonitor.convert(monitor, locations.length * 100);
for (int i = 0; i < locations.length; i++) {
try {
- session.getArtifactRepositoryManager().refreshRepository(locations[i], mon.newChild(50));
- session.getMetadataRepositoryManager().refreshRepository(locations[i], mon.newChild(50));
+ getArtifactRepositoryManager().refreshRepository(locations[i], mon.newChild(50));
+ getMetadataRepositoryManager().refreshRepository(locations[i], mon.newChild(50));
} catch (ProvisionException e) {
//ignore problematic repositories when refreshing
}
@@ -134,7 +136,7 @@ public class ColocatedRepositoryTracker extends RepositoryTracker {
}
protected String getInitialNameText() {
- String nickname = ui.getSession().getMetadataRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NICKNAME);
+ String nickname = getMetadataRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NICKNAME);
return nickname == null ? "" : nickname; //$NON-NLS-1$
}
};
@@ -159,4 +161,12 @@ public class ColocatedRepositoryTracker extends RepositoryTracker {
ProvUI.handleException(e, null, StatusManager.SHOW | StatusManager.LOG);
}
}
+
+ IMetadataRepositoryManager getMetadataRepositoryManager() {
+ return ProvUI.getMetadataRepositoryManager(ui.getSession());
+ }
+
+ IArtifactRepositoryManager getArtifactRepositoryManager() {
+ return ProvUI.getArtifactRepositoryManager(ui.getSession());
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java
index 772f654ae..1583bccf3 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java
@@ -11,16 +11,20 @@
package org.eclipse.equinox.internal.p2.ui;
-import org.eclipse.equinox.p2.query.QueryUtil;
-
import org.eclipse.core.commands.*;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.ui.dialogs.ILayoutConstants;
import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext;
import org.eclipse.equinox.internal.p2.ui.viewers.IUColumnConfig;
+import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
+import org.eclipse.equinox.p2.engine.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.operations.UpdateOperation;
+import org.eclipse.equinox.p2.query.QueryUtil;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.ui.Policy;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Event;
@@ -47,6 +51,22 @@ public class ProvUI {
public static final String REVERT_COMMAND_LABEL = ProvUIMessages.RevertIUCommandLabel;
public static final String REVERT_COMMAND_TOOLTIP = ProvUIMessages.RevertIUCommandTooltip;
+ /**
+ * A constant indicating that there was nothing to size (there
+ * was no valid plan that could be used to compute
+ * size).
+ */
+ public static final long SIZE_NOTAPPLICABLE = -3L;
+ /**
+ * Indicates that the size is unavailable (an
+ * attempt was made to compute size but it failed)
+ */
+ public static final long SIZE_UNAVAILABLE = -2L;
+ /**
+ * Indicates that the size is currently unknown
+ */
+ public static final long SIZE_UNKNOWN = -1L;
+
private static IUColumnConfig[] columnConfig;
private static QueryProvider queryProvider;
@@ -79,7 +99,7 @@ public class ProvUI {
// unset logging for statuses that should never be logged.
// Ideally the caller would do this but this bug keeps coming back.
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=274074
- if (status.getCode() == ProvisioningSession.STATUS_NOTHING_TO_UPDATE)
+ if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE)
style = 0;
} else if (status.getSeverity() == IStatus.WARNING) {
MessageDialog.openWarning(ProvUI.getDefaultParentShell(), ProvUIMessages.ProvUI_WarningTitle, status.getMessage());
@@ -192,4 +212,86 @@ public class ProvUI {
public static void setQueryProvider(QueryProvider provider) {
queryProvider = provider;
}
+
+ /**
+ * Get sizing information about the specified plan.
+ *
+ * @param engine the engine
+ * @param plan the provisioning plan
+ * @param context the provisioning context to be used for the sizing
+ * @param monitor the progress monitor
+ *
+ * @return a long integer describing the disk size required for the provisioning plan.
+ *
+ * @see #SIZE_UNKNOWN
+ * @see #SIZE_UNAVAILABLE
+ * @see #SIZE_NOTAPPLICABLE
+ */
+ public static long getSize(IEngine engine, IProvisioningPlan plan, ProvisioningContext context, IProgressMonitor monitor) {
+ // If there is nothing to size, return 0
+ if (plan == null)
+ return SIZE_NOTAPPLICABLE;
+ if (countPlanElements(plan) == 0)
+ return 0;
+ long installPlanSize = 0;
+ SubMonitor mon = SubMonitor.convert(monitor, 300);
+ if (plan.getInstallerPlan() != null) {
+ ISizingPhaseSet sizingPhaseSet = PhaseSetFactory.createSizingPhaseSet();
+ IStatus status = engine.perform(plan.getInstallerPlan(), sizingPhaseSet, mon.newChild(100));
+ if (status.isOK())
+ installPlanSize = sizingPhaseSet.getDiskSize();
+ } else {
+ mon.worked(100);
+ }
+ ISizingPhaseSet sizingPhaseSet = PhaseSetFactory.createSizingPhaseSet();
+ IStatus status = engine.perform(plan, sizingPhaseSet, mon.newChild(200));
+ if (status.isOK())
+ return installPlanSize + sizingPhaseSet.getDiskSize();
+ return SIZE_UNAVAILABLE;
+ }
+
+ private static int countPlanElements(IProvisioningPlan plan) {
+ return QueryUtil.compoundQueryable(plan.getAdditions(), plan.getRemovals()).query(QueryUtil.createIUAnyQuery(), null).toUnmodifiableSet().size();
+ }
+
+ /**
+ * Return the artifact repository manager for the given session
+ * @return the repository manager
+ */
+ public static IArtifactRepositoryManager getArtifactRepositoryManager(ProvisioningSession session) {
+ return (IArtifactRepositoryManager) session.getProvisioningAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ }
+
+ /**
+ * Return the metadata repository manager for the given session
+ * @return the repository manager
+ */
+ public static IMetadataRepositoryManager getMetadataRepositoryManager(ProvisioningSession session) {
+ return (IMetadataRepositoryManager) session.getProvisioningAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ }
+
+ /**
+ * Return the profile registry for the given session
+ * @return the profile registry
+ */
+ public static IProfileRegistry getProfileRegistry(ProvisioningSession session) {
+ return (IProfileRegistry) session.getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME);
+ }
+
+ /**
+ * Return the provisioning engine for the given session
+ * @return the provisioning engine
+ */
+ public static IEngine getEngine(ProvisioningSession session) {
+ return (IEngine) session.getProvisioningAgent().getService(IEngine.SERVICE_NAME);
+ }
+
+ /**
+ * Return the provisioning event bus used for dispatching events.
+ * @return the event bus
+ */
+ public static IProvisioningEventBus getProvisioningEventBus(ProvisioningSession session) {
+ return (IProvisioningEventBus) session.getProvisioningAgent().getService(IProvisioningEventBus.SERVICE_NAME);
+ }
+
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java
index 30efa372b..05d2d6a2e 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java
@@ -115,7 +115,7 @@ public class ProvUIActivator extends AbstractUIPlugin {
}
public IProvisioningEventBus getProvisioningEventBus() {
- return getSession().getProvisioningEventBus();
+ return ProvUI.getProvisioningEventBus(getSession());
}
public void removeProvisioningListener(ProvUIProvisioningListener listener) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java
index 2ddade3c7..a2e5087da 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java
@@ -11,11 +11,10 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui;
-import org.eclipse.equinox.p2.core.ProvisionException;
-
import java.net.URI;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRepositoryManager;
+import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.operations.RepositoryTracker;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
@@ -33,7 +32,7 @@ public class QueryableArtifactRepositoryManager extends QueryableRepositoryManag
}
protected IArtifactRepositoryManager getRepositoryManager() {
- return getSession().getArtifactRepositoryManager();
+ return ProvUI.getArtifactRepositoryManager(getSession());
}
protected IArtifactRepository doLoadRepository(IRepositoryManager<IArtifactKey> manager, URI location, IProgressMonitor monitor) throws ProvisionException {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java
index ce65c8cce..bdfef684c 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java
@@ -10,11 +10,10 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui;
-import org.eclipse.equinox.p2.core.ProvisionException;
-
import java.net.URI;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager;
+import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.operations.RepositoryTracker;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
@@ -40,7 +39,7 @@ public class QueryableMetadataRepositoryManager extends QueryableRepositoryManag
}
protected IMetadataRepositoryManager getRepositoryManager() {
- return getSession().getMetadataRepositoryManager();
+ return ProvUI.getMetadataRepositoryManager(getSession());
}
protected IMetadataRepository doLoadRepository(IRepositoryManager<IInstallableUnit> manager, URI location, IProgressMonitor monitor) throws ProvisionException {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryNameAndLocationDialog.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryNameAndLocationDialog.java
index 8430b3b7e..d1f31d688 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryNameAndLocationDialog.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryNameAndLocationDialog.java
@@ -15,7 +15,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.equinox.p2.operations.RepositoryTracker;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.dialogs.*;
@@ -137,9 +136,9 @@ public class RepositoryNameAndLocationDialog extends StatusDialog {
status[0] = getRepositoryTracker().getInvalidLocationStatus(url.getText().trim());
final URI userLocation = getUserLocation();
if (url.getText().length() == 0)
- status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ProvisioningSession.STATUS_INVALID_REPOSITORY_LOCATION, ProvUIMessages.RepositoryGroup_URLRequired, null);
+ status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, RepositoryTracker.STATUS_INVALID_REPOSITORY_LOCATION, ProvUIMessages.RepositoryGroup_URLRequired, null);
else if (userLocation == null)
- status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ProvisioningSession.STATUS_INVALID_REPOSITORY_LOCATION, ProvUIMessages.AddRepositoryDialog_InvalidURL, null);
+ status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, RepositoryTracker.STATUS_INVALID_REPOSITORY_LOCATION, ProvUIMessages.AddRepositoryDialog_InvalidURL, null);
else {
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
public void run() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
index 1806376b9..0f5871db3 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
@@ -24,6 +24,7 @@ import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.operations.RepositoryTracker;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
@@ -360,7 +361,7 @@ public class RepositorySelectionGroup {
}
String getSiteString(URI uri) {
- String nickname = ui.getSession().getMetadataRepositoryManager().getRepositoryProperty(uri, IRepository.PROP_NICKNAME);
+ String nickname = getMetadataRepositoryManager().getRepositoryProperty(uri, IRepository.PROP_NICKNAME);
if (nickname != null && nickname.length() > 0)
return NLS.bind(ProvUIMessages.AvailableIUsPage_NameWithLocation, nickname, URIUtil.toUnencodedString(uri));
return URIUtil.toUnencodedString(uri);
@@ -419,7 +420,7 @@ public class RepositorySelectionGroup {
private URI[] getLocalSites() {
// use our current visibility flags plus the local filter
int flags = ui.getRepositoryTracker().getMetadataRepositoryFlags() | IRepositoryManager.REPOSITORIES_LOCAL;
- return ui.getSession().getMetadataRepositoryManager().getKnownRepositories(flags);
+ return getMetadataRepositoryManager().getKnownRepositories(flags);
}
String[] getComboProposals() {
@@ -427,7 +428,7 @@ public class RepositorySelectionGroup {
String[] items = repoCombo.getItems();
// Clear any previously remembered disabled repos
disabledRepoProposals = new HashMap<String, URI>();
- URI[] disabled = ui.getSession().getMetadataRepositoryManager().getKnownRepositories(flags);
+ URI[] disabled = getMetadataRepositoryManager().getKnownRepositories(flags);
String[] disabledItems = new String[disabled.length];
for (int i = 0; i < disabledItems.length; i++) {
disabledItems[i] = getSiteString(disabled[i]);
@@ -608,4 +609,8 @@ public class RepositorySelectionGroup {
((IRepositorySelectionListener) selectionListeners[i]).repositorySelectionChanged(repoChoice, repoLocation);
}
}
+
+ IMetadataRepositoryManager getMetadataRepositoryManager() {
+ return ProvUI.getMetadataRepositoryManager(ui.getSession());
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java
index 41a986516..cffaa3299 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java
@@ -13,13 +13,13 @@ package org.eclipse.equinox.internal.p2.ui.dialogs;
import java.text.NumberFormat;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
-import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
@@ -47,20 +47,20 @@ public abstract class SizeComputingWizardPage extends ResolutionResultsWizardPag
computeSizing(initialResolution.getProvisioningPlan(), initialResolution.getProvisioningContext());
else
// Set the size to indicate there is no size yet.
- size = ProvisioningSession.SIZE_NOTAPPLICABLE;
+ size = ProvUI.SIZE_NOTAPPLICABLE;
}
protected void computeSizing(final IProvisioningPlan plan, final ProvisioningContext provisioningContext) {
if (plan == lastComputedPlan)
return;
lastComputedPlan = plan;
- size = ProvisioningSession.SIZE_UNKNOWN;
+ size = ProvUI.SIZE_UNKNOWN;
updateSizingInfo();
if (sizingJob != null)
sizingJob.cancel();
sizingJob = new Job(ProvUIMessages.SizeComputingWizardPage_SizeJobTitle) {
protected IStatus run(IProgressMonitor monitor) {
- size = getProvisioningUI().getSession().getSize(plan, provisioningContext, monitor);
+ size = ProvUI.getSize(ProvUI.getEngine(getProvisioningUI().getSession()), plan, provisioningContext, monitor);
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
if (display != null) {
@@ -89,7 +89,7 @@ public abstract class SizeComputingWizardPage extends ResolutionResultsWizardPag
protected void updateSizingInfo() {
if (sizeInfo != null && !sizeInfo.isDisposed()) {
- if (size == ProvisioningSession.SIZE_NOTAPPLICABLE)
+ if (size == ProvUI.SIZE_NOTAPPLICABLE)
sizeInfo.setVisible(false);
else {
sizeInfo.setText(NLS.bind(ProvUIMessages.UpdateOrInstallWizardPage_Size, getFormattedSize()));
@@ -99,7 +99,7 @@ public abstract class SizeComputingWizardPage extends ResolutionResultsWizardPag
}
protected String getFormattedSize() {
- if (size == ProvisioningSession.SIZE_UNKNOWN || size == ProvisioningSession.SIZE_UNAVAILABLE)
+ if (size == ProvUI.SIZE_UNKNOWN || size == ProvUI.SIZE_UNAVAILABLE)
return ProvUIMessages.IUDetailsLabelProvider_Unknown;
if (size > 1000L) {
long kb = size / 1000L;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java
index ae92e2d3d..046657860 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java
@@ -15,10 +15,10 @@ import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
@@ -69,7 +69,7 @@ public class ArtifactRepositoryElement extends RemoteQueriedElement implements I
public IArtifactRepository getRepository(IProgressMonitor monitor) {
if (repo == null)
try {
- repo = ui.getSession().getArtifactRepositoryManager().loadRepository(location, monitor);
+ repo = getArtifactRepositoryManager().loadRepository(location, monitor);
} catch (ProvisionException e) {
ui.getRepositoryTracker().reportLoadFailure(location, e);
} catch (OperationCanceledException e) {
@@ -90,9 +90,9 @@ public class ArtifactRepositoryElement extends RemoteQueriedElement implements I
* @see org.eclipse.equinox.internal.provisional.p2.ui.model.RepositoryElement#getName()
*/
public String getName() {
- String name = ui.getSession().getArtifactRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NICKNAME);
+ String name = getArtifactRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NICKNAME);
if (name == null)
- name = ui.getSession().getArtifactRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NAME);
+ name = getArtifactRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NAME);
if (name == null)
name = ""; //$NON-NLS-1$
return name;
@@ -103,10 +103,9 @@ public class ArtifactRepositoryElement extends RemoteQueriedElement implements I
* @see org.eclipse.equinox.internal.provisional.p2.ui.model.RepositoryElement#getDescription()
*/
public String getDescription() {
- ProvisioningSession session = ui.getSession();
if (ui.getRepositoryTracker().hasNotFoundStatusBeenReported(location))
return ProvUIMessages.RepositoryElement_NotFound;
- String description = session.getArtifactRepositoryManager().getRepositoryProperty(location, IRepository.PROP_DESCRIPTION);
+ String description = getArtifactRepositoryManager().getRepositoryProperty(location, IRepository.PROP_DESCRIPTION);
if (description == null)
return ""; //$NON-NLS-1$
return description;
@@ -143,4 +142,8 @@ public class ArtifactRepositoryElement extends RemoteQueriedElement implements I
queryable = getRepository(new NullProgressMonitor());
return queryable;
}
+
+ IArtifactRepositoryManager getArtifactRepositoryManager() {
+ return ProvUI.getArtifactRepositoryManager(ui.getSession());
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java
index abf72fd49..564430a3c 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java
@@ -15,13 +15,12 @@ import java.net.URI;
import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.p2.ui.QueryProvider;
+import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.p2.engine.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
-import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.repository.IRepository;
/**
@@ -44,7 +43,7 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
// probably refer to some preference or policy to decide what to do.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=221087
private static boolean shouldShowSize = false;
- long size = ProvisioningSession.SIZE_UNKNOWN;
+ long size = ProvUI.SIZE_UNKNOWN;
String profileID;
public AvailableIUElement(Object parent, IInstallableUnit iu, String profileID, boolean showChildren) {
@@ -87,17 +86,29 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
return;
SubMonitor mon = SubMonitor.convert(monitor, 100);
IProvisioningPlan plan = getSizingPlan(mon.newChild(50));
- size = getProvisioningUI().getSession().getSize(plan, getProvisioningContext(), mon.newChild(50));
+ size = ProvUI.getSize(getEngine(), plan, getProvisioningContext(), mon.newChild(50));
}
protected IProfile getProfile() {
- return getProvisioningUI().getSession().getProfileRegistry().getProfile(profileID);
+ return getProfileRegistry().getProfile(profileID);
}
protected IProvisioningPlan getSizingPlan(IProgressMonitor monitor) {
ProfileChangeRequest request = ProfileChangeRequest.createByProfileId(getProvisioningUI().getSession().getProvisioningAgent(), profileID);
request.add(getIU());
- return getProvisioningUI().getSession().getPlanner().getProvisioningPlan(request, getProvisioningContext(), monitor);
+ return getPlanner().getProvisioningPlan(request, getProvisioningContext(), monitor);
+ }
+
+ IEngine getEngine() {
+ return ProvUI.getEngine(getProvisioningUI().getSession());
+ }
+
+ IPlanner getPlanner() {
+ return (IPlanner) getProvisioningUI().getSession().getProvisioningAgent().getService(IPlanner.SERVICE_NAME);
+ }
+
+ IProfileRegistry getProfileRegistry() {
+ return ProvUI.getProfileRegistry(getProvisioningUI().getSession());
}
public IInstallableUnit getIU() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableUpdateElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableUpdateElement.java
index 5bf38afc7..7aa65a0a2 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableUpdateElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableUpdateElement.java
@@ -12,7 +12,6 @@
package org.eclipse.equinox.internal.p2.ui.model;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.ProvisioningContext;
@@ -45,7 +44,7 @@ public class AvailableUpdateElement extends AvailableIUElement {
if (iuToBeUpdated.getId().equals(getIU().getId()))
request.remove(iuToBeUpdated);
request.add(getIU());
- return ProvUIActivator.getDefault().getSession().getPlanner().getProvisioningPlan(request, new ProvisioningContext(), monitor);
+ return getPlanner().getProvisioningPlan(request, new ProvisioningContext(), monitor);
}
public boolean equals(Object obj) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java
index e929b79bd..f343af353 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java
@@ -14,11 +14,9 @@ import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
-import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.p2.ui.QueryProvider;
+import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
-import org.eclipse.equinox.p2.operations.ProvisioningSession;
/**
* Element wrapper class for IU's that represent categories of
@@ -70,7 +68,7 @@ public class CategoryElement extends RemoteQueriedElement implements IIUElement
}
public long getSize() {
- return ProvisioningSession.SIZE_UNKNOWN;
+ return ProvUI.SIZE_UNKNOWN;
}
public boolean shouldShowSize() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java
index 6edd9bb71..bde26b247 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java
@@ -38,8 +38,8 @@ public class ElementUtils {
public IStatus run(IProgressMonitor monitor) {
final ProvisioningUI ui = ProvUIActivator.getDefault().getProvisioningUI();
ui.signalRepositoryOperationStart();
- IMetadataRepositoryManager metaManager = ui.getSession().getMetadataRepositoryManager();
- IArtifactRepositoryManager artManager = ui.getSession().getArtifactRepositoryManager();
+ IMetadataRepositoryManager metaManager = ProvUI.getMetadataRepositoryManager(ui.getSession());
+ IArtifactRepositoryManager artManager = ProvUI.getArtifactRepositoryManager(ui.getSession());
try {
int visibilityFlags = ui.getRepositoryTracker().getMetadataRepositoryFlags();
URI[] currentlyEnabled = metaManager.getKnownRepositories(visibilityFlags);
@@ -99,8 +99,8 @@ public class ElementUtils {
}
private static void setColocatedRepositoryEnablement(ProvisioningUI ui, URI location, boolean enable) {
- ProvUIActivator.getDefault().getSession().getArtifactRepositoryManager().setEnabled(location, enable);
- ProvUIActivator.getDefault().getSession().getMetadataRepositoryManager().setEnabled(location, enable);
+ ProvUI.getArtifactRepositoryManager(ProvUIActivator.getDefault().getSession()).setEnabled(location, enable);
+ ProvUI.getMetadataRepositoryManager(ProvUIActivator.getDefault().getSession()).setEnabled(location, enable);
}
public static IInstallableUnit getIU(Object element) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java
index 2283f24e3..d4e507234 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java
@@ -12,11 +12,9 @@ package org.eclipse.equinox.internal.p2.ui.model;
import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.p2.ui.QueryProvider;
+import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
-import org.eclipse.equinox.p2.operations.ProvisioningSession;
/**
* Element wrapper class for installed IU's. Used instead of the plain IU when
@@ -66,7 +64,7 @@ public class InstalledIUElement extends QueriedElement implements IIUElement {
// TODO Later we might consider showing this in the installed views,
// but it is less important than before install.
public long getSize() {
- return ProvisioningSession.SIZE_UNKNOWN;
+ return ProvUI.SIZE_UNKNOWN;
}
public boolean shouldShowSize() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java
index b18ffc884..0892b2829 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java
@@ -17,7 +17,6 @@ import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
@@ -146,11 +145,10 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor
* @see org.eclipse.equinox.internal.provisional.p2.ui.model.RepositoryElement#getName()
*/
public String getName() {
- ProvisioningSession session = getProvisioningUI().getSession();
if (name == null) {
- name = session.getMetadataRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NICKNAME);
+ name = getMetadataRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NICKNAME);
if (name == null)
- name = session.getMetadataRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NAME);
+ name = getMetadataRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NAME);
if (name == null)
name = ""; //$NON-NLS-1$
}
@@ -171,10 +169,9 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor
* @see org.eclipse.equinox.internal.provisional.p2.ui.model.RepositoryElement#getDescription()
*/
public String getDescription() {
- ProvisioningSession session = getProvisioningUI().getSession();
if (getProvisioningUI().getRepositoryTracker().hasNotFoundStatusBeenReported(location))
return ProvUIMessages.RepositoryElement_NotFound;
- String description = session.getMetadataRepositoryManager().getRepositoryProperty(location, IRepository.PROP_DESCRIPTION);
+ String description = getMetadataRepositoryManager().getRepositoryProperty(location, IRepository.PROP_DESCRIPTION);
if (description == null)
return ""; //$NON-NLS-1$
return description;
@@ -209,7 +206,7 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor
return true;
if (location == null)
return false;
- IMetadataRepositoryManager manager = ProvUIActivator.getDefault().getSession().getMetadataRepositoryManager();
+ IMetadataRepositoryManager manager = getMetadataRepositoryManager();
if (manager == null || !(manager instanceof MetadataRepositoryManager))
return false;
IMetadataRepository repo = ((MetadataRepositoryManager) manager).getRepository(location);
@@ -238,4 +235,8 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor
result.append(" (not loaded)"); //$NON-NLS-1$
return result.toString();
}
+
+ IMetadataRepositoryManager getMetadataRepositoryManager() {
+ return ProvUI.getMetadataRepositoryManager(getProvisioningUI().getSession());
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java
index c3cccf152..a81b6bc9d 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java
@@ -12,6 +12,7 @@
package org.eclipse.equinox.internal.p2.ui.query;
import java.net.URI;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.p2.ui.model.ArtifactRepositoryElement;
import org.eclipse.equinox.internal.p2.ui.model.QueriedElementWrapper;
import org.eclipse.equinox.p2.query.IQueryable;
@@ -45,6 +46,6 @@ public class ArtifactRepositoryElementWrapper extends QueriedElementWrapper {
* Transforms the item to a UI element
*/
protected Object wrap(Object item) {
- return super.wrap(new ArtifactRepositoryElement(parent, (URI) item, ProvisioningUI.getDefaultUI().getSession().getArtifactRepositoryManager().isEnabled((URI) item)));
+ return super.wrap(new ArtifactRepositoryElement(parent, (URI) item, ProvUI.getArtifactRepositoryManager(ProvisioningUI.getDefaultUI().getSession()).isEnabled((URI) item)));
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java
index 245f726be..3718ba120 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java
@@ -12,6 +12,7 @@
package org.eclipse.equinox.internal.p2.ui.query;
import java.net.URI;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.p2.ui.model.MetadataRepositoryElement;
import org.eclipse.equinox.internal.p2.ui.model.QueriedElementWrapper;
import org.eclipse.equinox.p2.query.IQueryable;
@@ -46,6 +47,6 @@ public class MetadataRepositoryElementWrapper extends QueriedElementWrapper {
* Transforms the item to a UI element
*/
protected Object wrap(Object item) {
- return super.wrap(new MetadataRepositoryElement(parent, (URI) item, ProvisioningUI.getDefaultUI().getSession().getMetadataRepositoryManager().isEnabled((URI) item)));
+ return super.wrap(new MetadataRepositoryElement(parent, (URI) item, ProvUI.getMetadataRepositoryManager(ProvisioningUI.getDefaultUI().getSession()).isEnabled((URI) item)));
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java
index 6570fb1bd..6da88b9da 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java
@@ -40,7 +40,7 @@ public class QueryableUpdates implements IQueryable<IInstallableUnit> {
monitor = new NullProgressMonitor();
int totalWork = 2000;
monitor.beginTask(ProvUIMessages.QueryableUpdates_UpdateListProgress, totalWork);
- IPlanner planner = ui.getSession().getPlanner();
+ IPlanner planner = (IPlanner) ui.getSession().getProvisioningAgent().getService(IPlanner.SERVICE_NAME);
try {
Set<IInstallableUnit> allUpdates = new HashSet<IInstallableUnit>();
for (int i = 0; i < iusToUpdate.length; i++) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java
index 31214f8f9..3903e0d12 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java
@@ -19,7 +19,6 @@ import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
import org.eclipse.equinox.internal.p2.ui.model.ProvElement;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.jface.viewers.*;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Font;
@@ -133,7 +132,7 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
long size = element.getSize();
// If size is already known, or we already tried
// to get it, don't try again
- if (size != ProvisioningSession.SIZE_UNKNOWN)
+ if (size != ProvUI.SIZE_UNKNOWN)
return getFormattedSize(size);
if (!jobs.containsKey(element)) {
Job resolveJob = new Job(element.getIU().getId()) {
@@ -151,7 +150,7 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
return Status.CANCEL_STATUS;
// If we still could not compute size, give up
- if (element.getSize() == ProvisioningSession.SIZE_UNKNOWN)
+ if (element.getSize() == ProvUI.SIZE_UNKNOWN)
return Status.OK_STATUS;
if (shell == null || shell.isDisposed())
@@ -181,7 +180,7 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
}
private String getFormattedSize(long size) {
- if (size == ProvisioningSession.SIZE_UNKNOWN || size == ProvisioningSession.SIZE_UNAVAILABLE)
+ if (size == ProvUI.SIZE_UNKNOWN || size == ProvUI.SIZE_UNAVAILABLE)
return ProvUIMessages.IUDetailsLabelProvider_Unknown;
if (size > 1000L) {
long kb = size / 1000L;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java
index 42043b980..312ac4041 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java
@@ -16,8 +16,7 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.operations.ProvisioningJob;
import org.eclipse.equinox.p2.operations.RepositoryTracker;
@@ -113,7 +112,7 @@ public class LoadMetadataRepositoryJob extends ProvisioningJob {
if (sub.isCanceled())
return Status.CANCEL_STATUS;
try {
- repoCache.add(ui.getSession().getMetadataRepositoryManager().loadRepository(locations[i], sub.newChild(100)));
+ repoCache.add(ProvUI.getMetadataRepositoryManager(ui.getSession()).loadRepository(locations[i], sub.newChild(100)));
} catch (ProvisionException e) {
handleLoadFailure(e, locations[i]);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java
index c9c05ee5a..fcf3a5d0f 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java
@@ -16,7 +16,7 @@ import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
-import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.operations.UpdateOperation;
import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -101,7 +101,7 @@ public class Policy {
return false;
// Special case those statuses where we would never want to open a wizard
- if (status.getCode() == ProvisioningSession.STATUS_NOTHING_TO_UPDATE) {
+ if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
ProvUI.reportStatus(status, StatusManager.BLOCK);
return false;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java
index 1b5271869..3076096ba 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java
@@ -17,7 +17,6 @@ import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.p2.metadata.TranslationSupport;
import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.internal.p2.ui.dialogs.*;
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
@@ -28,7 +27,9 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.operations.*;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.wizard.WizardDialog;
@@ -346,7 +347,7 @@ public class ProvisioningUI {
* a corresponding operation ending event is signaled.
*/
public void signalRepositoryOperationStart() {
- getSession().getProvisioningEventBus().publishEvent(new RepositoryOperationBeginningEvent(this));
+ ProvUI.getProvisioningEventBus(getSession()).publishEvent(new RepositoryOperationBeginningEvent(this));
}
/**
@@ -357,7 +358,7 @@ public class ProvisioningUI {
* @param update <code>true</code> if the event should be reflected in the UI, false if it should be ignored.
*/
public void signalRepositoryOperationComplete(RepositoryEvent event, boolean update) {
- getSession().getProvisioningEventBus().publishEvent(new RepositoryOperationEndingEvent(this, update, event));
+ ProvUI.getProvisioningEventBus(getSession()).publishEvent(new RepositoryOperationEndingEvent(this, update, event));
}
/**
@@ -375,14 +376,15 @@ public class ProvisioningUI {
IMetadataRepository repo = null;
try {
signalRepositoryOperationStart();
- repo = session.getMetadataRepositoryManager().loadRepository(location, monitor);
+ IMetadataRepositoryManager manager = ProvUI.getMetadataRepositoryManager(getSession());
+ repo = manager.loadRepository(location, monitor);
// If there is no user nickname assigned to this repo but there is a provider name, then set the nickname.
// This will keep the name in the manager even when the repo is not loaded
- String name = session.getMetadataRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NICKNAME);
+ String name = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME);
if (name == null || name.length() == 0) {
name = repo.getName();
if (name != null && name.length() > 0)
- session.getMetadataRepositoryManager().setRepositoryProperty(location, IRepository.PROP_NICKNAME, name);
+ manager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, name);
}
} catch (ProvisionException e) {
getRepositoryTracker().reportLoadFailure(location, e);
@@ -410,15 +412,16 @@ public class ProvisioningUI {
IArtifactRepository repo;
signalRepositoryOperationStart();
try {
- repo = session.getArtifactRepositoryManager().loadRepository(location, monitor);
+ IArtifactRepositoryManager manager = ProvUI.getArtifactRepositoryManager(getSession());
+ repo = manager.loadRepository(location, monitor);
// If there is no user nickname assigned to this repo but there is a provider name, then set the nickname.
// This will keep the name in the manager even when the repo is not loaded
- String name = session.getArtifactRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NICKNAME);
+ String name = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME);
if (name == null) {
- name = session.getArtifactRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NAME);
+ name = manager.getRepositoryProperty(location, IRepository.PROP_NAME);
if (name != null)
- session.getArtifactRepositoryManager().setRepositoryProperty(location, IRepository.PROP_NICKNAME, name);
+ manager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, name);
}
} finally {
// We have no idea how many repos may have been touched as a result of loading this one,
@@ -427,9 +430,4 @@ public class ProvisioningUI {
}
return repo;
}
-
- public TranslationSupport getTranslationSupport() {
- // TODO Temporary fix to enable build.
- return TranslationSupport.getInstance();
- }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java
index 2b47e6740..7dc1bb3fd 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java
@@ -27,6 +27,7 @@ import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.engine.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.operations.*;
+import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.*;
@@ -351,8 +352,10 @@ public class RevertProfilePage extends InstallationPage implements ICopyable {
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
IProfile currentProfile;
- currentProfile = getSession().getProfileRegistry().getProfile(profileId);
- plan[0] = getSession().getPlanner().getDiffPlan(currentProfile, snapshot, monitor);
+ IProfileRegistry registry = ProvUI.getProfileRegistry(getSession());
+ IPlanner planner = (IPlanner) getSession().getProvisioningAgent().getService(IPlanner.SERVICE_NAME);
+ currentProfile = registry.getProfile(profileId);
+ plan[0] = planner.getDiffPlan(currentProfile, snapshot, monitor);
}
};
ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchAdvisor.java
index 7fcbdac50..ee686a763 100644
--- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchAdvisor.java
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchAdvisor.java
@@ -10,6 +10,7 @@ import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.operations.UpdateOperation;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -49,7 +50,7 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
IStatus updateStatus = P2Util.checkForUpdates(agent, monitor);
- if (updateStatus.getCode() == ProvisioningSession.STATUS_NOTHING_TO_UPDATE) {
+ if (updateStatus.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
MessageDialog.openInformation(null, "Updates", "No updates were found");
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/P2Util.java b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/P2Util.java
index 17aa000c6..66c9027ef 100644
--- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/P2Util.java
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/P2Util.java
@@ -32,7 +32,7 @@ public class P2Util {
SubMonitor sub = SubMonitor.convert(monitor,
"Checking for application updates...", 200);
IStatus status = operation.resolveModal(sub.newChild(100));
- if (status.getCode() == ProvisioningSession.STATUS_NOTHING_TO_UPDATE) {
+ if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
return status;
}
if (status.getSeverity() == IStatus.CANCEL)

Back to the top