Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusan Franklin2010-05-07 20:58:43 +0000
committerSusan Franklin2010-05-07 20:58:43 +0000
commit754cb2fba5c9148bfe14c8f92171af80c04968e7 (patch)
treefd4db388890f7b5db16f1dcd7a52af1e2480a3ba /bundles/org.eclipse.equinox.p2.ui.sdk
parentad5efb515b313367e9fb2d1200eb0bf904deef79 (diff)
downloadrt.equinox.p2-754cb2fba5c9148bfe14c8f92171af80c04968e7.tar.gz
rt.equinox.p2-754cb2fba5c9148bfe14c8f92171af80c04968e7.tar.xz
rt.equinox.p2-754cb2fba5c9148bfe14c8f92171af80c04968e7.zip
Bug 310693 - [ui] p2 menus available, even without an agent
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui.sdk')
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties2
3 files changed, 35 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java
index 45fe4c2f0..e1f89a97a 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java
@@ -14,10 +14,16 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.statushandlers.StatusManager;
/**
* PreloadingRepositoryHandler provides background loading of
@@ -38,7 +44,31 @@ abstract class PreloadingRepositoryHandler extends AbstractHandler {
* Execute the command.
*/
public Object execute(ExecutionEvent event) {
- doExecuteAndLoad();
+ // Look for a profile. We may not immediately need it in the
+ // handler, but if we don't have one, whatever we are trying to do
+ // will ultimately fail in a more subtle/low-level way. So determine
+ // up front if the system is configured properly.
+ String profileId = getProvisioningUI().getProfileId();
+ IProvisioningAgent agent = getProvisioningUI().getSession().getProvisioningAgent();
+ IProfile profile = null;
+ if (agent != null) {
+ IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
+ if (registry != null) {
+ profile = registry.getProfile(profileId);
+ }
+ }
+ if (profile == null) {
+ // Inform the user nicely
+ MessageDialog.openInformation(null, ProvSDKMessages.Handler_SDKUpdateUIMessageTitle, ProvSDKMessages.Handler_CannotLaunchUI);
+ // Log the detailed message
+ StatusManager.getManager().handle(ProvSDKUIActivator.getNoSelfProfileStatus());
+ } else {
+ BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
+ public void run() {
+ doExecuteAndLoad();
+ }
+ });
+ }
return null;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java
index 291d8b3b3..022c13c2c 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java
@@ -24,6 +24,8 @@ public class ProvSDKMessages extends NLS {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, ProvSDKMessages.class);
}
+ public static String Handler_CannotLaunchUI;
+ public static String Handler_SDKUpdateUIMessageTitle;
public static String InstallNewSoftwareHandler_ProgressTaskName;
public static String PreferenceInitializer_Error;
public static String ProvisioningPreferencePage_AlwaysOpenWizard;
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties
index 8c95028ec..03d95281c 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties
@@ -9,6 +9,8 @@
# IBM Corporation - initial API and implementation
###############################################################################
+Handler_CannotLaunchUI=Cannot complete the request. This installation has not been configured properly for Software Updates. See the error log for details.
+Handler_SDKUpdateUIMessageTitle=Software Updates
InstallNewSoftwareHandler_ProgressTaskName=Searching for available software...
PreferenceInitializer_Error=Error accessing preferences.
ProvSDKUIActivator_ErrorSavingPrefs=Error saving update preferences

Back to the top