Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault (Ericsson)2013-04-05 20:17:16 -0400
committerPascal Rapicault2013-04-05 20:17:16 -0400
commitf1234380acbcaa417f903667243d9441cda35fa6 (patch)
treefcb6c4e95bfb43c5f416b88b8253d80b203a7f21 /bundles/org.eclipse.equinox.p2.ui.sdk.scheduler
parentcacedf0145c6fc46e417a2cfe5960c4913562e38 (diff)
downloadrt.equinox.p2-f1234380acbcaa417f903667243d9441cda35fa6.tar.gz
rt.equinox.p2-f1234380acbcaa417f903667243d9441cda35fa6.tar.xz
rt.equinox.p2-f1234380acbcaa417f903667243d9441cda35fa6.zip
New test cases and simple refactoring to accomodate those
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui.sdk.scheduler')
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationWizard_c.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java20
3 files changed, 16 insertions, 20 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java
index 9e99a42a1..c55d00019 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java
@@ -19,7 +19,6 @@ import org.eclipse.equinox.p2.core.*;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.engine.ProfileScope;
import org.eclipse.equinox.p2.operations.ProvisioningSession;
-import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
@@ -191,17 +190,4 @@ public class AutomaticUpdatePlugin extends AbstractUIPlugin {
getContext().ungetService(ref);
return agentProvider;
}
-
- //TODO Find a better place for these two methods
- public void rememberMigrationCompleted(String profileId) {
- IProfileRegistry registry = (IProfileRegistry) ProvisioningUI.getDefaultUI().getSession().getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME);
- long[] history = registry.listProfileTimestamps(profileId);
- AutomaticUpdatePlugin.getDefault().getPreferenceStore().setValue(AutomaticUpdateScheduler.MIGRATION_DIALOG_SHOWN, history[history.length - 1]);
- AutomaticUpdatePlugin.getDefault().savePreferences();
- }
-
- //Get the timestamp that we migrated from. O if we have not migrated.
- public long getLastMigration() {
- return AutomaticUpdatePlugin.getDefault().getPreferenceStore().getLong(AutomaticUpdateScheduler.MIGRATION_DIALOG_SHOWN);
- }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationWizard_c.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationWizard_c.java
index 8587069c0..1c4c7e7b7 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationWizard_c.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationWizard_c.java
@@ -123,7 +123,7 @@ public class ImportFromInstallationWizard_c extends InstallWizard implements IIm
//Remember that we completed the migration
private void rememberMigrationCompleted() {
- AutomaticUpdatePlugin.getDefault().rememberMigrationCompleted(toImportFrom.getProfileId());
+ new MigrationSupport().rememberMigrationCompleted(toImportFrom.getProfileId());
}
//Purge the profile registry from all the entries that are no longer relevant
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java
index 42ac844a5..572211f47 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java
@@ -16,8 +16,7 @@ import java.util.Set;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.engine.EngineActivator;
import org.eclipse.equinox.internal.p2.metadata.query.UpdateQuery;
-import org.eclipse.equinox.internal.p2.ui.sdk.scheduler.AutomaticUpdatePlugin;
-import org.eclipse.equinox.internal.p2.ui.sdk.scheduler.PreviousConfigurationFinder;
+import org.eclipse.equinox.internal.p2.ui.sdk.scheduler.*;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
@@ -28,6 +27,7 @@ import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
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.wizard.WizardDialog;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.swt.widgets.Display;
@@ -73,7 +73,7 @@ public class MigrationSupport {
openMigrationWizard(previousProfile, reposToMigrate);
} else {
//There is nothing to migrate, so we mark the migration complete
- AutomaticUpdatePlugin.getDefault().rememberMigrationCompleted(currentProfile.getProfileId());
+ rememberMigrationCompleted(currentProfile.getProfileId());
}
return true;
}
@@ -114,7 +114,7 @@ public class MigrationSupport {
long[] history = registry.listProfileTimestamps(currentProfile.getProfileId());
boolean isInitial = !IProfile.STATE_SHARED_INSTALL_VALUE_INITIAL.equals(registry.getProfileStateProperties(currentProfile.getProfileId(), history[0]).get(IProfile.STATE_PROP_SHARED_INSTALL));
if (isInitial) {
- if (AutomaticUpdatePlugin.getDefault().getLastMigration() >= history[0])
+ if (getLastMigration() >= history[0])
return false;
return true;
}
@@ -169,7 +169,7 @@ public class MigrationSupport {
}
private boolean baseChangedSinceLastPresentationOfWizard(IProvisioningAgent agent, IProfileRegistry registry, IProfile profile) {
- long lastProfileMigrated = AutomaticUpdatePlugin.getDefault().getLastMigration();
+ long lastProfileMigrated = getLastMigration();
long lastResetTimestamp = findMostRecentResetTimestamp(registry, profile);
return lastProfileMigrated <= lastResetTimestamp;
}
@@ -197,7 +197,17 @@ public class MigrationSupport {
Shell getWorkbenchWindowShell() {
IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
return activeWindow != null ? activeWindow.getShell() : null;
+ }
+ public void rememberMigrationCompleted(String profileId) {
+ IProfileRegistry registry = (IProfileRegistry) ProvisioningUI.getDefaultUI().getSession().getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME);
+ long[] history = registry.listProfileTimestamps(profileId);
+ AutomaticUpdatePlugin.getDefault().getPreferenceStore().setValue(AutomaticUpdateScheduler.MIGRATION_DIALOG_SHOWN, history[history.length - 1]);
+ AutomaticUpdatePlugin.getDefault().savePreferences();
}
+ //Get the timestamp that we migrated from. O if we have not migrated.
+ public long getLastMigration() {
+ return AutomaticUpdatePlugin.getDefault().getPreferenceStore().getLong(AutomaticUpdateScheduler.MIGRATION_DIALOG_SHOWN);
+ }
}

Back to the top