Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Chouinard2011-10-18 22:32:09 +0000
committerFrancois Chouinard2011-10-18 22:32:09 +0000
commitbd3f1fb46febaf5f3a739d0efae0d28025ca8a38 (patch)
tree31a8b2da2e7325c24062ccb227e07c462a6b1104
parent0de31589c9c85cebfed0bff2a2b89a15d1106838 (diff)
downloadorg.eclipse.linuxtools-bd3f1fb46febaf5f3a739d0efae0d28025ca8a38.tar.gz
org.eclipse.linuxtools-bd3f1fb46febaf5f3a739d0efae0d28025ca8a38.tar.xz
org.eclipse.linuxtools-bd3f1fb46febaf5f3a739d0efae0d28025ca8a38.zip
Fix trace type selection field in ImportTraceWizardPage
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/handlers/SelectTraceTypeHandler.java1
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/ImportTraceWizardPage.java60
2 files changed, 42 insertions, 19 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/handlers/SelectTraceTypeHandler.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/handlers/SelectTraceTypeHandler.java
index ea4e36a7b6..cac81117c2 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/handlers/SelectTraceTypeHandler.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/handlers/SelectTraceTypeHandler.java
@@ -161,6 +161,7 @@ public class SelectTraceTypeHandler extends AbstractHandler {
}
}
}
+
return true;
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/ImportTraceWizardPage.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/ImportTraceWizardPage.java
index ab0222f648..c8962bfaca 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/ImportTraceWizardPage.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/ImportTraceWizardPage.java
@@ -115,9 +115,6 @@ public class ImportTraceWizardPage extends WizardResourceImportPage implements L
// Target import directory ('Traces' folder)
private IFolder fTargetFolder;
- // Selected trace attributes
- private final Map<String, IConfigurationElement> fTraceAttributes = new HashMap<String, IConfigurationElement>();
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
@@ -465,8 +462,7 @@ public class ImportTraceWizardPage extends WizardResourceImportPage implements L
return selectFiles(sourceDirectory, FileSystemStructureProvider.INSTANCE);
}
- private FileSystemElement selectFiles(final Object rootFileSystemObject,
- final IImportStructureProvider structureProvider) {
+ private FileSystemElement selectFiles(final Object rootFileSystemObject, final IImportStructureProvider structureProvider) {
final FileSystemElement[] results = new FileSystemElement[1];
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
@Override
@@ -535,12 +531,31 @@ public class ImportTraceWizardPage extends WizardResourceImportPage implements L
});
}
+ // The mapping of available trace type IDs to their corresponding configuration element
+ private Map<String, IConfigurationElement> fTraceTypeAttributes = new HashMap<String, IConfigurationElement>();
+ private Map<String, IConfigurationElement> fTraceCategories = new HashMap<String, IConfigurationElement>();
+ private final Map<String, IConfigurationElement> fTraceAttributes = new HashMap<String, IConfigurationElement>();
+
private String[] getAvailableTraceTypes() {
- List<String> traceTypes = new ArrayList<String>();
- IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(
- TmfCorePlugin.TMF_TRACE_TYPE_ID);
+
+ // Populate the Categories and Trace Types
+ IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TmfCorePlugin.TMF_TRACE_TYPE_ID);
for (IConfigurationElement ce : config) {
- String traceTypeName = ce.getAttribute("name"); //$NON-NLS-1$
+ String attribute = ce.getName();
+ if (attribute.equals(TmfTraceElement.TYPE)) {
+ String traceTypeId = ce.getAttribute(TmfTraceElement.ID);
+ fTraceTypeAttributes.put(traceTypeId, ce);
+ } else if (attribute.equals(TmfTraceElement.CATEGORY)) {
+ String categoryId = ce.getAttribute(TmfTraceElement.ID);
+ fTraceCategories.put(categoryId, ce);
+ }
+ }
+
+ // Generate the list of Category:TraceType to populate the ComboBox
+ List<String> traceTypes = new ArrayList<String>();
+ for (String typeId : fTraceTypeAttributes.keySet()) {
+ IConfigurationElement ce = fTraceTypeAttributes.get(typeId);
+ String traceTypeName = getCategory(ce) + " : " + ce.getAttribute(TmfTraceElement.NAME); //$NON-NLS-1$
fTraceAttributes.put(traceTypeName, ce);
traceTypes.add(traceTypeName);
}
@@ -554,6 +569,17 @@ public class ImportTraceWizardPage extends WizardResourceImportPage implements L
return result;
}
+ private String getCategory(IConfigurationElement ce) {
+ String categoryId = ce.getAttribute(TmfTraceElement.CATEGORY);
+ if (categoryId != null) {
+ IConfigurationElement category = fTraceCategories.get(categoryId);
+ if (category != null && !category.equals("")) { //$NON-NLS-1$
+ return category.getAttribute(TmfTraceElement.NAME);
+ }
+ }
+ return "[no category]"; //$NON-NLS-1$
+ }
+
// ------------------------------------------------------------------------
// Options
// ------------------------------------------------------------------------
@@ -614,8 +640,7 @@ public class ImportTraceWizardPage extends WizardResourceImportPage implements L
IContainer container = getSpecifiedContainer();
if (container != null && container.isVirtual()) {
- if (Platform.getPreferencesService().getBoolean(TmfUiPlugin.PLUGIN_ID,
- ResourcesPlugin.PREF_DISABLE_LINKING, false, null)) {
+ if (Platform.getPreferencesService().getBoolean(TmfUiPlugin.PLUGIN_ID, ResourcesPlugin.PREF_DISABLE_LINKING, false, null)) {
setMessage(null);
setErrorMessage(Messages.ImportTraceWizard_CannotImportFilesUnderAVirtualFolder);
return false;
@@ -741,12 +766,9 @@ public class ImportTraceWizardPage extends WizardResourceImportPage implements L
if (resource != null) {
try {
// Set the trace properties for this resource
- resource.setPersistentProperty(TmfTraceElement.TRACEBUNDLE, ce.getContributor()
- .getName());
- resource.setPersistentProperty(TmfTraceElement.TRACETYPE,
- ce.getAttribute(TmfTraceElement.ID));
- resource.setPersistentProperty(TmfTraceElement.TRACEICON,
- ce.getAttribute(TmfTraceElement.ICON));
+ resource.setPersistentProperty(TmfTraceElement.TRACEBUNDLE, ce.getContributor().getName());
+ resource.setPersistentProperty(TmfTraceElement.TRACETYPE, ce.getAttribute(TmfTraceElement.ID));
+ resource.setPersistentProperty(TmfTraceElement.TRACEICON, ce.getAttribute(TmfTraceElement.ICON));
} catch (CoreException e) {
e.printStackTrace();
}
@@ -799,8 +821,8 @@ public class ImportTraceWizardPage extends WizardResourceImportPage implements L
// Perform the import operation for this subset
FileSystemStructureProvider fileSystemStructureProvider = FileSystemStructureProvider.INSTANCE;
- ImportOperation operation = new ImportOperation(getContainerFullPath(), parentFolder,
- fileSystemStructureProvider, this, subList);
+ ImportOperation operation = new ImportOperation(getContainerFullPath(), parentFolder, fileSystemStructureProvider, this,
+ subList);
operation.setContext(getShell());
ok = executeImportOperation(operation);
}

Back to the top