# HG changeset patch # User dadubrow # Date 1274451127 18000 # Node ID e626d1981906beda96278b7f1fc5ab6974e49d27 # Parent 10b788ab16fe9db05a90c65f2426d8866f3d5277 Add advanced install menu action to discovery view diff -r 10b788ab16fe -r e626d1981906 core/com.nokia.carbide.cpp/src/com/nokia/carbide/cpp/p2/CarbideP2Policy.java --- a/core/com.nokia.carbide.cpp/src/com/nokia/carbide/cpp/p2/CarbideP2Policy.java Thu May 20 19:05:56 2010 -0500 +++ b/core/com.nokia.carbide.cpp/src/com/nokia/carbide/cpp/p2/CarbideP2Policy.java Fri May 21 09:12:07 2010 -0500 @@ -5,8 +5,11 @@ public class CarbideP2Policy extends Policy { public CarbideP2Policy() { + // restart policy after install setRestartPolicy(RESTART_POLICY_PROMPT); - System.setProperty("eclipse.p2.unsignedPolicy", "allow"); + // policy about install wizard + setGroupByCategory(false); + setShowLatestVersionsOnly(false); } } diff -r 10b788ab16fe -r e626d1981906 core/com.nokia.carbide.discovery.ui/META-INF/MANIFEST.MF --- a/core/com.nokia.carbide.discovery.ui/META-INF/MANIFEST.MF Thu May 20 19:05:56 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/META-INF/MANIFEST.MF Fri May 21 09:12:07 2010 -0500 @@ -10,7 +10,11 @@ org.eclipse.equinox.p2.discovery;bundle-version="1.0.0", org.eclipse.equinox.p2.discovery.compatibility;bundle-version="1.0.0", org.eclipse.equinox.p2.ui.discovery;bundle-version="1.0.0", - org.eclipse.equinox.p2.ui;bundle-version="2.0.0" + org.eclipse.equinox.p2.ui;bundle-version="2.0.0", + org.eclipse.equinox.p2.operations;bundle-version="2.0.0", + org.eclipse.equinox.p2.core;bundle-version="2.0.0", + org.eclipse.equinox.p2.metadata;bundle-version="2.0.0", + org.eclipse.equinox.p2.repository;bundle-version="2.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-Vendor: Nokia diff -r 10b788ab16fe -r e626d1981906 core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Messages.java --- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Messages.java Thu May 20 19:05:56 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Messages.java Fri May 21 09:12:07 2010 -0500 @@ -4,6 +4,7 @@ public class Messages extends NLS { private static final String BUNDLE_NAME = "com.nokia.carbide.discovery.ui.messages"; //$NON-NLS-1$ + public static String DiscoveryView_AdvancedInstallLabel; public static String DiscoveryView_CheckAllLabel; public static String DiscoveryView_InstallLabel; public static String DiscoveryView_MissingDirectoryURLError; diff -r 10b788ab16fe -r e626d1981906 core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties --- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties Thu May 20 19:05:56 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties Fri May 21 09:12:07 2010 -0500 @@ -1,3 +1,4 @@ +DiscoveryView_AdvancedInstallLabel=Advanced Install... DiscoveryView_CheckAllLabel=Check All Items DiscoveryView_InstallLabel=Install Checked Items... DiscoveryView_MissingDirectoryURLError=Could not find URL in configuration/server.properties file for key={0} diff -r 10b788ab16fe -r e626d1981906 core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/view/DiscoveryView.java --- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/view/DiscoveryView.java Thu May 20 19:05:56 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/view/DiscoveryView.java Fri May 21 09:12:07 2010 -0500 @@ -5,10 +5,15 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.text.MessageFormat; +import java.util.Collection; +import java.util.HashSet; import java.util.List; import java.util.Properties; +import java.util.Set; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -21,9 +26,15 @@ import org.eclipse.equinox.internal.p2.ui.discovery.DiscoveryUi; import org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogConfiguration; import org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogViewer; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.operations.ProvisioningSession; +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.action.Action; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.Separator; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; @@ -53,6 +64,7 @@ private BaseSelectionListenerAction checkAllAction; private BaseSelectionListenerAction checkNoneAction; private BaseSelectionListenerAction installAction; + private Action showInstallWizardAction; private boolean initialized; @@ -131,6 +143,8 @@ private void fillLocalPullDown(IMenuManager manager) { manager.add(checkAllAction); manager.add(checkNoneAction); + manager.add(new Separator()); + manager.add(showInstallWizardAction); } private void fillLocalToolBar(IToolBarManager manager) { @@ -184,6 +198,11 @@ }; }; installAction.setImageDescriptor(Activator.getImageDescriptor("icons/icon-discovery.png")); //$NON-NLS-1$ + showInstallWizardAction = new Action(Messages.DiscoveryView_AdvancedInstallLabel) { + public void run() { + showInstallWizard(); + } + }; viewer.addSelectionChangedListener(checkAllAction); viewer.addSelectionChangedListener(checkNoneAction); viewer.addSelectionChangedListener(installAction); @@ -227,4 +246,29 @@ } } + private void showInstallWizard() { + ProvisioningUI defaultUI = ProvisioningUI.getDefaultUI(); + ProvisioningSession session = defaultUI.getSession(); + IProvisioningAgent agent = session.getProvisioningAgent(); + IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME); + IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); + for (URI uri : getCatalogURIs()) { + metadataManager.addRepository(uri); + artifactManager.addRepository(uri); + } + defaultUI.openInstallWizard(null, null, null); + } + + private Collection getCatalogURIs() { + Set uris = new HashSet(); + for (CatalogItem catalogItem : viewer.getCatalog().getItems()) { + try { + uris.add(new URI(catalogItem.getSiteUrl())); + } catch (URISyntaxException e) { + // ignore bad URIs + } + } + return uris; + }; + } \ No newline at end of file