From: Francois Chouinard Date: Fri, 26 Aug 2011 23:24:09 +0000 (-0400) Subject: Update dialog messages and fix IAdapter issue X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=42f18e57b8d3d2ba1abd470ad6aebec52b0fae38;p=deliverable%2Ftracecompass.git Update dialog messages and fix IAdapter issue --- diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/ImportTraceWizardPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/ImportTraceWizardPage.java index 12442328a3..0e604cb122 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/ImportTraceWizardPage.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/ImportTraceWizardPage.java @@ -13,7 +13,9 @@ package org.eclipse.linuxtools.lttng.ui.views.project.dialogs; +import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.linuxtools.lttng.exceptions.LttngException; import org.eclipse.linuxtools.lttng.trace.LTTngTraceVersion; @@ -39,9 +41,12 @@ public class ImportTraceWizardPage extends WizardFileSystemResourceImportPage1 { public ImportTraceWizardPage(IWorkbench workbench, IStructuredSelection selection) { super(workbench, selection); - LTTngProjectNode folder = (LTTngProjectNode) selection.getFirstElement(); - project = folder.getProject(); - String path = folder.getTracesFolder().getFolder().getFullPath().toOSString(); + project = (IProject) selection.getFirstElement(); + IFolder folder = project.getFolder(LTTngProjectNode.TRACE_FOLDER_NAME); + if (folder == null) { + MessageDialog.openError(getShell(), Messages.ImportTrace_ErrorTitle, Messages.ImportTrace_InvalidProject); + } + String path = folder.getFullPath().toOSString(); initialContainerString = path; setContainerFieldValue(path); diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/Messages.java index 5ab2f3976b..dbafbdb696 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/Messages.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/Messages.java @@ -9,6 +9,8 @@ public class Messages extends NLS { public static String AddTraceWizardPage_columnHeader; public static String AddTraceWizardPage_description; public static String AddTraceWizardPage_windowTitle; + public static String ImportTrace_ErrorTitle; + public static String ImportTrace_InvalidProject; public static String ImportTraceWizardPage_BadTraceVersion; public static String ImportTraceWizardPage_BadTraceVersionMsg1; public static String ImportTraceWizardPage_BadTraceVersionMsg2; @@ -24,6 +26,8 @@ public class Messages extends NLS { public static String TraceLibraryPathWizardPage_TraceLoaderLibrary_notExists; public static String TraceLibraryPathWizardPage_Title; public static String TraceLibraryPathWizardPage_Description; + public static String TraceLibraryPathWizard_Message; + public static String TraceLibraryPathProperty_Message; public static String SelectTrace_ErrorTitle; public static String TraceLibraryPath_Note; public static String TraceLibraryPath_Message; diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathPropertyPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathPropertyPage.java index 238fabbd5b..713606ff60 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathPropertyPage.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathPropertyPage.java @@ -80,6 +80,17 @@ public class TraceLibraryPathPropertyPage extends PropertyPage { } }); + + Label noLabel = new Label(client, SWT.NONE); + noLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); + + Label descTextLabel = new Label(client, SWT.WRAP); + descTextLabel.setText(Messages.TraceLibraryPathProperty_Message); + GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + gd.widthHint = 400; + gd.horizontalSpan = 2; + descTextLabel.setLayoutData(gd); + Label noteBoldLabel = new Label(client, SWT.BOLD); noteBoldLabel.setText(Messages.TraceLibraryPath_Note); noteBoldLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, @@ -92,7 +103,7 @@ public class TraceLibraryPathPropertyPage extends PropertyPage { Label noteTextLabel = new Label(client, SWT.WRAP); noteTextLabel.setText(Messages.TraceLibraryPath_Message); - GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + gd = new GridData(SWT.FILL, SWT.CENTER, true, false); gd.widthHint = 400; gd.horizontalSpan = 2; noteTextLabel.setLayoutData(gd); diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathWizardPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathWizardPage.java index c728a6f4a4..c1ec75708d 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathWizardPage.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathWizardPage.java @@ -50,8 +50,7 @@ public class TraceLibraryPathWizardPage extends WizardPage { Label label = new Label(client, SWT.NONE); label.setText(Messages.TraceLibraryPath_label); traceLibraryPath = new Text(client, SWT.BORDER); - traceLibraryPath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, - false)); + traceLibraryPath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); traceLibraryPath.addModifyListener(new ModifyListener() { @Override @@ -62,8 +61,7 @@ public class TraceLibraryPathWizardPage extends WizardPage { }); browsePathButton = new Button(client, SWT.PUSH); - browsePathButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, - false)); + browsePathButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false)); browsePathButton.setText(Messages.TraceLibraryPath_browseBtn); browsePathButton.addSelectionListener(new SelectionAdapter() { @@ -79,10 +77,19 @@ public class TraceLibraryPathWizardPage extends WizardPage { }); + Label noLabel = new Label(client, SWT.NONE); + noLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); + + Label descTextLabel = new Label(client, SWT.WRAP); + descTextLabel.setText(Messages.TraceLibraryPathWizard_Message); + GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + gd.widthHint = 400; + gd.horizontalSpan = 2; + descTextLabel.setLayoutData(gd); + Label noteBoldLabel = new Label(client, SWT.BOLD); noteBoldLabel.setText(Messages.TraceLibraryPath_Note); - noteBoldLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, - false)); + noteBoldLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); Font font = noteBoldLabel.getFont(); if (font.getFontData().length > 0) noteBoldLabel.setFont(new Font(client.getDisplay(), font @@ -91,7 +98,7 @@ public class TraceLibraryPathWizardPage extends WizardPage { Label noteTextLabel = new Label(client, SWT.WRAP); noteTextLabel.setText(Messages.TraceLibraryPath_Message); - GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + gd = new GridData(SWT.FILL, SWT.CENTER, true, false); gd.widthHint = 400; gd.horizontalSpan = 2; noteTextLabel.setLayoutData(gd); diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/messages.properties index 98bb1250c3..b657933312 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/messages.properties +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/messages.properties @@ -3,33 +3,35 @@ AddTraceWizard_windowTitle=Adding traces to experiment AddTraceWizardPage_columnHeader=Trace AddTraceWizardPage_description=Select the traces to add to the experiment AddTraceWizardPage_windowTitle=Select traces -ImportTraceWizard_LocationError=Error: Trace location is wrong. -ImportTraceWizard_LocationErrorMsg1=You cannot import your trace directly into " -ImportTraceWizard_LocationErrorMsg2=The trace has to be into a directory, like " -ImportTraceWizard_LocationErrorMsg3=Please adjust the location of the LTTng trace. + +ImportTrace_ErrorTitle=Import Trace +ImportTrace_InvalidProject=Invalid project type + ImportTraceWizardPage_BadTraceVersion=Error: Unrecognized trace version for ImportTraceWizardPage_BadTraceVersionMsg1=Verify that the directory is a valid LTTng trace directory. ImportTraceWizardPage_BadTraceVersionMsg2=Make sure the top directory is the trace itself and not any of its parent. -NewExperimentDialog_DialogTitle=LTTng Experiment -NewExperimentDialog_ExperimentLabel=Experiment name: -NewFolderDialog_errorTitle= -NewFolderDialog_internalError= -NewFolderDialog_progress= + NewProjectWizard_Description=Create an LTTng Project NewProjectWizard_Title=LTTng Project + TraceErrorDialog_DalogTitle=Trace Selection TraceErrorDialog_DialogMsgLabel=Error while opening the trace\! Error message: + TraceLibraryPath_label = Trace Library Path: TraceLibraryPath_browseBtn = Browse... + TraceLibraryPathWizardPage_SpecifiedTraceLibraryLocation_notExists = Specified trace library directory does not exist! TraceLibraryPathWizardPage_TraceLoaderLibrary_notExists = Trace loader library not found at the specified path! TraceLibraryPathWizardPage_Title = LTTng Parsing Library TraceLibraryPathWizardPage_Description = Specify the directory which contains the LTTng parsing libraries +TraceLibraryPathWizard_Message = Set this field if you want to dynamically change the parsing libraries your LTTng projects use or if you do not want to set LD_LIBRARY_PATH.\n\n\ + The field is project specific and can be modified at any time from the LTTng project Properties page.\n\ + +TraceLibraryPathProperty_Message = Set this field if you want to dynamically change the parsing libraries your LTTng projects use or if you do not want to set LD_LIBRARY_PATH.\n\ + TraceLibraryPath_Note = Note: -#TraceLibraryPath_Message = The path specified needs to contain the required parser library 'liblttvtraceread_loader.so' or a link to it.\nParser library 'liblttvtraceread_loader.so' also needs to have 'RUNPATH' set with ${ORIGIN} so it can find the dependent libraries. 'RUNPATH' can be set by using patchelf utility or in the makefile. -TraceLibraryPath_Message = The parser library 'liblttvtraceread_loader.so' needs to be accessible from the path provided.\n\n\ -You only need to set this field if you don't want to set your LD_LIBRARY_PATH or if you want to have the liberty to dynamically change the parsing libraries used by your LTTng projects.\n\n\ -This field is project specific and can be modified at any time from the LTTng project's properties.\n\n\ -Also note that if you are setting this field, the library 'liblttvtraceread_loader.so' needs to have 'RUNPATH' set with ${ORIGIN} so it can find the dependent libraries. 'RUNPATH' can be set by using patchelf utility or in the makefile.\n\n\ -Refer to the LTTng User Guide for more information. +TraceLibraryPath_Message = If you set this field, the parser library 'liblttvtraceread_loader.so' must be accessible from the path provided.\n\n\ + In addition, the library 'liblttvtraceread_loader.so' must have 'RUNPATH' set with ${ORIGIN} so it can find the dependent libraries. \ + 'RUNPATH' can be set in the makefile or by using the patchelf utility. + SelectTrace_ErrorTitle = Select Trace diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectNode.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectNode.java index 525fa5f78c..2ab9baa962 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectNode.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectNode.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson + * Copyright (c) 2009, 2010, 2011 Ericsson, MontaVista Software * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which @@ -8,6 +8,7 @@ * * Contributors: * Francois Chouinard - Initial API and implementation + * Yufen Kuo (ykuo@mvista.com) - bug 354541: implement IAdaptable Project->Properties action is enabled when project is selected. *******************************************************************************/ package org.eclipse.linuxtools.lttng.ui.views.project.model; @@ -19,6 +20,8 @@ import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; import org.eclipse.linuxtools.lttng.ui.views.project.LTTngProjectNature; /** @@ -26,7 +29,7 @@ import org.eclipse.linuxtools.lttng.ui.views.project.LTTngProjectNature; *

* TODO: Implement me. Please. */ -public class LTTngProjectNode extends LTTngProjectTreeNode { +public class LTTngProjectNode extends LTTngProjectTreeNode implements IAdaptable { public static final String TRACE_FOLDER_NAME = "Traces"; //$NON-NLS-1$ public static final String EXPER_FOLDER_NAME = "Experiments"; //$NON-NLS-1$ @@ -198,4 +201,16 @@ public class LTTngProjectNode extends LTTngProjectTreeNode { return fExperimentsFolder; } + /** + * Returns the adapter + */ + @SuppressWarnings("rawtypes") + public Object getAdapter(Class adapter) { + if (adapter == IResource.class) { + return getProject(); + } + // Defer to the platform + return Platform.getAdapterManager().getAdapter(this, adapter); + } + }