merge commit
authortimkelly
Wed, 25 Aug 2010 17:55:05 -0500
changeset 1887 9c8b9f280200
parent 1886 d61921bcf8f3 (current diff)
parent 1885 988b4ab1b8c1 (diff)
child 1888 fc9d5d520518
merge commit
Binary file carbidesdk/com.nokia.carbide.cpp.sdk.doc.user/html/img/about_cpp.png has changed
Binary file carbidesdk/com.nokia.carbide.cpp.sdk.doc.user/html/img/gold_header.png has changed
Binary file core/com.nokia.carbide.cpp.compiler.doc.user/html/images/about.png has changed
Binary file core/com.nokia.carbide.cpp.compiler.doc.user/html/images/about_cpp.png has changed
Binary file core/com.nokia.carbide.cpp.compiler.doc.user/html/images/gold_header.png has changed
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Messages.java	Wed Aug 25 17:54:33 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Messages.java	Wed Aug 25 17:55:05 2010 -0500
@@ -65,8 +65,10 @@
 	public static String ExportPage_Title;
 	public static String ExportPage_ViewerGroupLabel;
 	public static String ExportWizard_ErrorTitle;
+	public static String ExportWizard_ReadInstalledFeaturesError;
 	public static String ExportWizard_Title;
 	public static String ExportWizard_WriteFileError;
+	public static String ExportWizard_WriteInstalledFeaturesError;
 	public static String FeatureInstallOperation_ConfiguringTaskName;
 	public static String FeatureInstallOperation_IdLabel;
 	public static String FeatureInstallOperation_MissingFeaturesError;
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties	Wed Aug 25 17:54:33 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties	Wed Aug 25 17:55:05 2010 -0500
@@ -43,8 +43,10 @@
 ExportPage_Title=Export Installed Feature Configuration
 ExportPage_ViewerGroupLabel=Export features:
 ExportWizard_ErrorTitle=Error
+ExportWizard_ReadInstalledFeaturesError=Could not read installed features file: 
 ExportWizard_Title=Export
 ExportWizard_WriteFileError=Could not write export file due to error: {0}
+ExportWizard_WriteInstalledFeaturesError=Could not write installed features file: 
 FeatureInstallOperation_ConfiguringTaskName=Configuring install operation
 FeatureInstallOperation_IdLabel=id=
 FeatureInstallOperation_MissingFeaturesError=Install failed. Could not find some features: \n
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/AbstractImportExportPage.java	Wed Aug 25 17:54:33 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/AbstractImportExportPage.java	Wed Aug 25 17:55:05 2010 -0500
@@ -30,6 +30,7 @@
 import org.eclipse.jface.viewers.ColumnLabelProvider;
 import org.eclipse.jface.viewers.ICheckStateListener;
 import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.ViewerSorter;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -137,6 +138,7 @@
 				return null;
 			}
 		});
+		viewer.setSorter(new ViewerSorter());
 
 		viewer.getControl().setLayoutData(
 				new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ExportPage.java	Wed Aug 25 17:54:33 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ExportPage.java	Wed Aug 25 17:55:05 2010 -0500
@@ -21,6 +21,8 @@
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
 
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -46,9 +48,11 @@
 	private File file;
 	private Collection<FeatureInfo> featureInfos;
 	private static String saveAsParent;
+	private Set<String> filteredFeatureIds;
 
-	protected ExportPage() {
+	protected ExportPage(Collection<String> filteredFeatureIds) {
 		super("ExportPage"); //$NON-NLS-1$
+		this.filteredFeatureIds = new HashSet<String>(filteredFeatureIds);
 		setTitle(Messages.ExportPage_Title);
 		setDescription(Messages.ExportPage_Description);
 	}
@@ -100,14 +104,25 @@
 		UIJob j = new UIJob(Messages.ExportPage_GetFeaturesJobName) {
 			@Override
 			public IStatus runInUIThread(IProgressMonitor monitor) {
-				viewer.setInput(P2Utils.getInstalledFeatures(monitor));
+				viewer.setInput(getInstalledFeatureInfos(monitor));
 				updateViewer();
 				return Status.OK_STATUS;
-			} 
+			}
 		};
 		j.schedule();
 	}
 	
+	private Collection<FeatureInfo> getInstalledFeatureInfos(IProgressMonitor monitor) {
+		Collection<FeatureInfo> featureInfos = new ArrayList<FeatureInfo>();
+		// filter out the filtered ids
+		for (FeatureInfo featureInfo : P2Utils.getInstalledFeatures(monitor)) {
+			if (!filteredFeatureIds.contains(featureInfo.getId()))
+				featureInfos.add(featureInfo);
+		}
+		
+		return featureInfos;
+	} 
+	
 	protected boolean validatePage() {
 		setErrorMessage(null);
 		if (viewer.getTable().getItemCount() == 0) {
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ExportWizard.java	Wed Aug 25 17:54:33 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ExportWizard.java	Wed Aug 25 17:55:05 2010 -0500
@@ -19,14 +19,24 @@
 package com.nokia.carbide.internal.discovery.ui.wizard;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.OutputStream;
+import java.net.URI;
+import java.net.URL;
 import java.text.MessageFormat;
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osgi.service.datalocation.Location;
 import org.eclipse.ui.IExportWizard;
 import org.eclipse.ui.IWorkbench;
 
@@ -61,8 +71,42 @@
 	public void init(IWorkbench workbench, IStructuredSelection selection) {
 		setDefaultPageImageDescriptor(Activator.getImageDescriptor("icons\\install_wiz.gif")); //$NON-NLS-1$
 		setWindowTitle(Messages.ExportWizard_Title);
-		exportPage = new ExportPage();
+		exportPage = new ExportPage(getFilteredFeatureIds());
 		addPage(exportPage);
 	}
 
+	private Collection<String> getFilteredFeatureIds() {
+		Collection<FeatureInfo> installedFeatures = null;
+		Location installLocation = Platform.getInstallLocation();
+		URL url = installLocation.getURL();
+		IPath path = new Path(url.getPath());
+		path = path.append("configuration/installedFeatures.xml"); //$NON-NLS-1$
+		File file = path.toFile();
+		if (!file.exists()) {
+			installedFeatures = P2Utils.getInstalledFeatures(new NullProgressMonitor());
+			ImportExportData data = new ImportExportData(false, Collections.<URI>emptyList(), installedFeatures);
+			try {
+				Streamer.writeToXML(new FileOutputStream(file), data);
+			} catch (Exception e) {
+				Activator.logError(Messages.ExportWizard_WriteInstalledFeaturesError + file, e);
+			}
+		}
+		else {
+			try {
+				ImportExportData data = Streamer.readFromXML(new FileInputStream(file));
+				installedFeatures = data.getFeatureInfos();
+			} catch (Exception e) {
+				Activator.logError(Messages.ExportWizard_ReadInstalledFeaturesError + file, e);
+			}
+		}
+		
+		Collection<String> filteredIds = new ArrayList<String>();
+		if (installedFeatures != null) {
+			for (FeatureInfo featureInfo : installedFeatures) {
+				filteredIds.add(featureInfo.getId());
+			}
+		}
+		return filteredIds;
+	}
+
 }
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/FeatureInfo.java	Wed Aug 25 17:54:33 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/FeatureInfo.java	Wed Aug 25 17:55:05 2010 -0500
@@ -70,4 +70,9 @@
 			return false;
 		return true;
 	}
+	
+	@Override
+	public String toString() {
+		return getId() + " " + getVersion().toString(); //$NON-NLS-1$
+	}
 }
\ No newline at end of file