Update dialog messages and fix IAdapter issue
authorFrancois Chouinard <fchouinard@gmail.com>
Fri, 26 Aug 2011 23:24:09 +0000 (19:24 -0400)
committerFrancois Chouinard <fchouinard@gmail.com>
Mon, 29 Aug 2011 00:25:21 +0000 (20:25 -0400)
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/ImportTraceWizardPage.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/Messages.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathPropertyPage.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathWizardPage.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/messages.properties
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectNode.java

index 12442328a30ca80d0d42a6e1271b914fe5d7f3a3..0e604cb122bc456529dc645ed9d3387c632e74e0 100644 (file)
@@ -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);
index 5ab2f3976befd66f7ffb2b836783502aa0b23c2d..dbafbdb696cba364301300983e37549b1c266852 100644 (file)
@@ -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;
index 238fabbd5b2954d5fba67e2ac871c0d5f9ac792d..713606ff60dd31a211130cef163aee180d5784da 100644 (file)
@@ -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);
index c728a6f4a48ad20fda14ef5e368166eb51ad06ef..c1ec75708db3b4922f729b518a339a6ee15d873d 100644 (file)
@@ -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);
index 98bb1250c3cece8660ce195d5e1c5c918ad73441..b6579333123d40f8ce82c55c734f4df34072fd93 100644 (file)
@@ -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
index 525fa5f78cc3e71f7ce01d72c7bfb3f2996d6ff5..2ab9baa9628914fb1f93241a00eb27ed7b2487b3 100644 (file)
@@ -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;
  * <p>
  * 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);
+    }
+
 }
This page took 0.035467 seconds and 5 git commands to generate.