fix refresh action so data is gotten prior to viewer refresh
authordadubrow
Thu, 03 Jun 2010 13:33:24 -0500
changeset 1426 6a454f350c2a
parent 1416 809f579bf32c
child 1427 fa9156253e98
fix refresh action so data is gotten prior to viewer refresh
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	Fri May 28 14:29:31 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/view/DiscoveryView.java	Thu Jun 03 13:33:24 2010 -0500
@@ -9,8 +9,11 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.text.MessageFormat;
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 import java.util.Set;
@@ -27,7 +30,12 @@
 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.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
 import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.query.IQueryResult;
+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.ProvisioningUI;
@@ -156,8 +164,8 @@
 		refreshAction = new Action() {
 			public void run() {
 				viewer.setSelection(StructuredSelection.EMPTY);
+				viewer.updateCatalog();
 				viewer.refresh();
-				viewer.updateCatalog();
 			}
 		};
 		refreshAction.setText(Messages.DiscoveryView_RefreshLabel);
@@ -257,6 +265,20 @@
 			artifactManager.addRepository(uri);
 		}
 		defaultUI.openInstallWizard(null, null, null);
+		
+		String profileId = defaultUI.getProfileId();
+		IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
+		IProfile profile = profileRegistry.getProfile(profileId);
+		IQueryResult<IInstallableUnit> queryResult = profile.query(QueryUtil.createIUGroupQuery(), null);
+		List<String> list = new ArrayList<String>();
+		for (Iterator<IInstallableUnit> iter = queryResult.iterator(); iter.hasNext();) {
+			IInstallableUnit iu = iter.next();
+			list.add(iu.getId() + "|" + iu.getVersion());
+		}
+		Collections.sort(list);
+		for (String s : list) {
+			System.out.println(s);
+		}
 	}
 
 	private Collection<URI> getCatalogURIs() {