TMF: Add supplementary folder to experiments
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Mon, 18 Feb 2013 15:20:00 +0000 (10:20 -0500)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 22 Feb 2013 19:52:41 +0000 (14:52 -0500)
Just like traces, experiments can save information in supplementary
files on disk (see bug 400949).
* Added class TmfWithFolderElement that TmfTraceElement and
  TmfExperimentElement extends
* TmfExperiment constructors are modified/added to receive a
  IResource as parameter
* Call to constructors are modified in the .ui code to add the
  resources
* Added calls to delete/copy/rename supplementary folder

Change-Id: Ic6996ca2c39bd3ea499521349f04bfc7c237b419
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/10435
Reviewed-by: Bernd Hufmann <bhufmann@gmail.com>
IP-Clean: Bernd Hufmann <bhufmann@gmail.com>
Tested-by: Bernd Hufmann <bhufmann@gmail.com>
Tested-by: Hudson CI
Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfExperiment.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentHandler.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/OpenExperimentHandler.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/editors/TmfEventsEditor.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentElement.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfWithFolderElement.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/CopyExperimentDialog.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/RenameExperimentDialog.java

index 674b3dc9097e551d1ab41e08823b0b75ecba6649..296a77f97ea4afc8f83e477266c18574dd8a407d 100644 (file)
@@ -80,9 +80,26 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
      * @param traces the experiment set of traces
      */
     public TmfExperiment(final Class<? extends ITmfEvent> type, final String id, final ITmfTrace[] traces) {
-        this(type, id, traces, DEFAULT_INDEX_PAGE_SIZE);
+        this(type, id, traces, DEFAULT_INDEX_PAGE_SIZE, null);
     }
 
+    /**
+     * Constructor of experiment taking type, path, traces and resource
+     *
+     * @param type
+     *            the event type
+     * @param id
+     *            the experiment id
+     * @param traces
+     *            the experiment set of traces
+     * @param resource
+     *            the resource associated to the experiment
+     */
+    public TmfExperiment(final Class<? extends ITmfEvent> type, final String id, final ITmfTrace[] traces, IResource resource) {
+        this(type, id, traces, DEFAULT_INDEX_PAGE_SIZE, resource);
+    }
+
+
     /**
      * @param type the event type
      * @param path the experiment path
@@ -90,12 +107,31 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
      * @param indexPageSize the experiment index page size
      */
     public TmfExperiment(final Class<? extends ITmfEvent> type, final String path, final ITmfTrace[] traces, final int indexPageSize) {
+        this(type, path, traces, indexPageSize, null);
+    }
+
+    /**
+     * Full constructor of an experiment, taking the type, path, traces,
+     * indexPageSize and resource
+     *
+     * @param type
+     *            the event type
+     * @param path
+     *            the experiment path
+     * @param traces
+     *            the experiment set of traces
+     * @param indexPageSize
+     *            the experiment index page size
+     * @param resource
+     *            the resource associated to the experiment
+     */
+    public TmfExperiment(final Class<? extends ITmfEvent> type, final String path, final ITmfTrace[] traces, final int indexPageSize, IResource resource) {
         setCacheSize(indexPageSize);
         setStreamingInterval(0);
         setIndexer(new TmfCheckpointIndexer(this, indexPageSize));
         setParser(this);
         try {
-            super.initialize(null, path, type);
+            super.initialize(resource, path, type);
         } catch (TmfTraceException e) {
             e.printStackTrace();
         }
index 959d00ca078c0898333126681900fe7a7ac432f8..f86ea8e143290f418eb9ef26d66b64add501be18 100644 (file)
@@ -20,6 +20,7 @@ import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.linuxtools.internal.tmf.ui.Activator;
@@ -96,6 +97,12 @@ public class DeleteExperimentHandler extends AbstractHandler {
                             }
                         }
 
+                        IPath path = resource.getLocation();
+                        if (path != null) {
+                            // Delete supplementary files
+                            experiment.deleteSupplementaryFolder();
+                        }
+
                         // Finally, delete the experiment
                         resource.delete(true, null);
 
index e11fb31466d4a64dc74351ed8ad10c798bb9610f..7d8a7c375eb53f74b1b8a06d1155d9e1384d7d6d 100644 (file)
@@ -79,13 +79,16 @@ public class DeleteExperimentSupplementaryFilesHandler extends AbstractHandler {
 
                 TmfExperimentElement trace = (TmfExperimentElement) element;
 
+                IResource[] resources = trace.getSupplementaryResources();
+                resourcesList.addAll(Arrays.asList(resources));
+
                 for (TmfTraceElement aTrace : trace.getTraces()) {
 
                     // If trace is under an experiment, use the original trace from the traces folder
                     aTrace = aTrace.getElementUnderTraceFolder();
 
                     // Delete the selected resources
-                    IResource[] resources = aTrace.getSupplementaryResources();
+                    resources = aTrace.getSupplementaryResources();
                     resourcesList.addAll(Arrays.asList(resources));
                 }
 
index 6bc0d4d88d42d023f60d9bc13544db007e41e4ed..5d367958c6e6a2ec3d8a5d44ce53c4dec8b87ef6 100644 (file)
@@ -120,6 +120,12 @@ public class OpenExperimentHandler extends AbstractHandler {
                     return;
                 }
 
+                /* Unlike traces, there is no instanceExperiment, so we call this function
+                 * here alone.  Maybe it would be better to do this on experiment's element
+                 * constructor?
+                 */
+                experimentElement.refreshSupplementaryFolder();
+
                 // Instantiate the experiment's traces
                 final List<TmfTraceElement> traceEntries = experimentElement.getTraces();
                 final int nbTraces = traceEntries.size();
@@ -167,7 +173,7 @@ public class OpenExperimentHandler extends AbstractHandler {
                 }
 
                 // Create the experiment
-                final TmfExperiment experiment = new TmfExperiment(ITmfEvent.class, experimentElement.getName(), traces, cacheSize);
+                final TmfExperiment experiment = new TmfExperiment(ITmfEvent.class, experimentElement.getName(), traces, cacheSize, experimentElement.getResource());
                 experiment.setBookmarksFile(file);
 
                 final String editorId = commonEditorId;
index 7357d1bba64d706e01f9eb0f0ba92abf9edc97c1..68c689effd11b5f2458aa58a16b1a9401c54e2b6 100644 (file)
@@ -158,7 +158,7 @@ public class TmfEventsEditor extends TmfEditor implements ITmfTraceEditor, IReus
                                 cacheSize = Math.min(cacheSize, trace.getCacheSize());
                                 traces[i] = trace;
                             }
-                            final TmfExperiment experiment = new TmfExperiment(ITmfEvent.class, experimentElement.getName(), traces, cacheSize);
+                            final TmfExperiment experiment = new TmfExperiment(ITmfEvent.class, experimentElement.getName(), traces, cacheSize, experimentElement.getResource());
                             experiment.setBookmarksFile(fFile);
                             fTrace = experiment;
                             break;
index 33448a383d3aafe8c8d13002db944cb74feb8691..3ad213d45a7b118a770d2071b97b6c25fdc4ac9c 100644 (file)
@@ -35,7 +35,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor;
  * @author Francois Chouinard
  *
  */
-public class TmfExperimentElement extends TmfProjectModelElement implements IPropertySource2 {
+public class TmfExperimentElement extends TmfWithFolderElement implements IPropertySource2 {
 
     // ------------------------------------------------------------------------
     // Constants
@@ -46,6 +46,7 @@ public class TmfExperimentElement extends TmfProjectModelElement implements IPro
     private static final String sfName = "name"; //$NON-NLS-1$
     private static final String sfPath = "path"; //$NON-NLS-1$
     private static final String sfLocation = "location"; //$NON-NLS-1$
+    private static final String sfFolderSuffix = "_exp"; //$NON-NLS-1$
 
     private static final TextPropertyDescriptor sfNameDescriptor = new TextPropertyDescriptor(sfName, sfName);
     private static final TextPropertyDescriptor sfPathDescriptor = new TextPropertyDescriptor(sfPath, sfPath);
@@ -230,4 +231,13 @@ public class TmfExperimentElement extends TmfProjectModelElement implements IPro
         return false;
     }
 
+    /**
+     * Return the suffix for resource names
+     * @return The folder suffix
+     */
+    @Override
+    public String getSuffix() {
+        return sfFolderSuffix;
+    }
+
 }
index 2b3ca409d7f5c1f3cf04eeb09554c74ef4362a0a..20d985203638ecb6f4a3b251cd14cbc88944b32b 100644 (file)
@@ -9,6 +9,7 @@
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
  *   Bernd Hufmann - Added supplementary files handling
+ *   Geneviève Bastien - Moved supplementary files handling to parent class
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.ui.project.model;
@@ -24,7 +25,6 @@ import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.linuxtools.internal.tmf.ui.Activator;
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtEvent;
@@ -51,7 +51,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor;
  * @version 1.0
  * @author Francois Chouinard
  */
-public class TmfTraceElement extends TmfProjectModelElement implements IActionFilter, IPropertySource2 {
+public class TmfTraceElement extends TmfWithFolderElement implements IActionFilter, IPropertySource2 {
 
     // ------------------------------------------------------------------------
     // Constants
@@ -332,146 +332,6 @@ public class TmfTraceElement extends TmfProjectModelElement implements IActionFi
         return this;
     }
 
-    /**
-     * Deletes the trace specific supplementary folder.
-     */
-    public void deleteSupplementaryFolder() {
-        IFolder supplFolder = getTraceSupplementaryFolder(fResource.getName());
-        if (supplFolder.exists()) {
-            try {
-                supplFolder.delete(true, new NullProgressMonitor());
-            } catch (CoreException e) {
-                Activator.getDefault().logError("Error deleting supplementary folder " + supplFolder, e); //$NON-NLS-1$
-            }
-        }
-    }
-
-    /**
-     * Renames the trace specific supplementary folder according to the new trace name.
-     *
-     * @param newTraceName The new trace name
-     */
-    public void renameSupplementaryFolder(String newTraceName) {
-        IFolder oldSupplFolder = getTraceSupplementaryFolder(fResource.getName());
-        IFolder newSupplFolder =  getTraceSupplementaryFolder(newTraceName);
-
-        // Rename supplementary folder
-        if (oldSupplFolder.exists()) {
-            try {
-                oldSupplFolder.move(newSupplFolder.getFullPath(), true, new NullProgressMonitor());
-            } catch (CoreException e) {
-                Activator.getDefault().logError("Error renaming supplementary folder " + oldSupplFolder, e); //$NON-NLS-1$
-            }
-        }
-    }
-
-    /**
-     * Copies the trace specific supplementary folder to the new trace name.
-     *
-     * @param newTraceName The new trace name
-     */
-    public void copySupplementaryFolder(String newTraceName) {
-        IFolder oldSupplFolder = getTraceSupplementaryFolder(fResource.getName());
-        IFolder newSupplFolder = getTraceSupplementaryFolder(newTraceName);
-
-        // copy supplementary folder
-        if (oldSupplFolder.exists()) {
-            try {
-                oldSupplFolder.copy(newSupplFolder.getFullPath(), true, new NullProgressMonitor());
-            } catch (CoreException e) {
-                Activator.getDefault().logError("Error renaming supplementary folder " + oldSupplFolder, e); //$NON-NLS-1$
-            }
-        }
-    }
-
-    /**
-     * Copies the trace specific supplementary folder a new folder.
-     *
-     * @param destination The destination folder to copy to.
-     */
-    public void copySupplementaryFolder(IFolder destination) {
-        IFolder oldSupplFolder = getTraceSupplementaryFolder(fResource.getName());
-
-        // copy supplementary folder
-        if (oldSupplFolder.exists()) {
-            try {
-                oldSupplFolder.copy(destination.getFullPath(), true, new NullProgressMonitor());
-            } catch (CoreException e) {
-                Activator.getDefault().logError("Error copying supplementary folder " + oldSupplFolder, e); //$NON-NLS-1$
-            }
-        }
-    }
-
-
-    /**
-     * Refreshes the trace specific supplementary folder information. It creates the folder if not exists.
-     * It sets the persistence property of the trace resource
-     */
-    public void refreshSupplementaryFolder() {
-        createSupplementaryDirectory();
-    }
-
-    /**
-     * Checks if supplementary resource exist or not.
-     *
-     * @return <code>true</code> if one or more files are under the trace supplementary folder
-     */
-    public boolean hasSupplementaryResources() {
-        IResource[] resources = getSupplementaryResources();
-        return (resources.length > 0);
-    }
-
-    /**
-     * Returns the supplementary resources under the trace supplementary folder.
-     *
-     * @return array of resources under the trace supplementary folder.
-     */
-    public IResource[] getSupplementaryResources() {
-        IFolder supplFolder = getTraceSupplementaryFolder(fResource.getName());
-        if (supplFolder.exists()) {
-            try {
-                return supplFolder.members();
-            } catch (CoreException e) {
-                Activator.getDefault().logError("Error deleting supplementary folder " + supplFolder, e); //$NON-NLS-1$
-            }
-        }
-        return new IResource[0];
-    }
-
-    /**
-     * Deletes the given resources.
-     *
-     * @param resources array of resources to delete.
-     */
-    public void deleteSupplementaryResources(IResource[] resources) {
-
-        for (int i = 0; i < resources.length; i++) {
-            try {
-                resources[i].delete(true, new NullProgressMonitor());
-            } catch (CoreException e) {
-                Activator.getDefault().logError("Error deleting supplementary resource " + resources[i], e); //$NON-NLS-1$
-            }
-        }
-    }
-
-    private void createSupplementaryDirectory() {
-        IFolder supplFolder = getTraceSupplementaryFolder(fResource.getName());
-        if (!supplFolder.exists()) {
-            try {
-                supplFolder.create(true, true, new NullProgressMonitor());
-            } catch (CoreException e) {
-                Activator.getDefault().logError("Error creating resource supplementary file " + supplFolder, e); //$NON-NLS-1$
-            }
-        }
-
-        try {
-            fResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, supplFolder.getLocationURI().getPath());
-        } catch (CoreException e) {
-            Activator.getDefault().logError("Error setting persistant property " + TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, e); //$NON-NLS-1$
-        }
-
-    }
-
     // ------------------------------------------------------------------------
     // IActionFilter
     // ------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfWithFolderElement.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfWithFolderElement.java
new file mode 100644 (file)
index 0000000..02e5b33
--- /dev/null
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Ericsson, École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Bernd Hufmann - Added supplementary files handling (in class TmfTraceElement)
+ *   Geneviève Bastien - Copied supplementary files handling from TmfTracElement
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ui.project.model;
+
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
+
+
+/**
+ * Base class for project elements who will have folder elements
+ * under them to store supplementary files.
+ *
+ * @author gbastien
+ * @since 2.0
+ */
+public abstract class TmfWithFolderElement extends TmfProjectModelElement {
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Constructor.
+     * Creates model element.
+     * @param name The name of the element
+     * @param resource The resource.
+     * @param parent The parent element
+     */
+    public TmfWithFolderElement(String name, IResource resource, TmfProjectModelElement parent) {
+        super(name, resource, parent);
+    }
+
+    /**
+     * Return the resource name for this element
+     *
+     * @return The name of the resource for this element
+     */
+    protected String getResourceName() {
+        return fResource.getName() + getSuffix();
+    }
+
+    /**
+     * @return The suffix for resource names
+     */
+    protected String getSuffix() {
+        return ""; //$NON-NLS-1$
+    }
+
+    /**
+     * Deletes this element specific supplementary folder.
+     */
+    public void deleteSupplementaryFolder() {
+        IFolder supplFolder = getTraceSupplementaryFolder(getResourceName());
+        if (supplFolder.exists()) {
+            try {
+                supplFolder.delete(true, new NullProgressMonitor());
+            } catch (CoreException e) {
+                Activator.getDefault().logError("Error deleting supplementary folder " + supplFolder, e); //$NON-NLS-1$
+            }
+        }
+    }
+
+    /**
+     * Renames the element specific supplementary folder according to the new element name.
+     *
+     * @param newName The new element name
+     */
+    public void renameSupplementaryFolder(String newName) {
+        IFolder oldSupplFolder = getTraceSupplementaryFolder(getResourceName());
+        IFolder newSupplFolder =  getTraceSupplementaryFolder(newName + getSuffix());
+
+        // Rename supplementary folder
+        if (oldSupplFolder.exists()) {
+            try {
+                oldSupplFolder.move(newSupplFolder.getFullPath(), true, new NullProgressMonitor());
+            } catch (CoreException e) {
+                Activator.getDefault().logError("Error renaming supplementary folder " + oldSupplFolder, e); //$NON-NLS-1$
+            }
+        }
+    }
+
+    /**
+     * Copies the element specific supplementary folder to the new element name.
+     *
+     * @param newName The new element name
+     */
+    public void copySupplementaryFolder(String newName) {
+        IFolder oldSupplFolder = getTraceSupplementaryFolder(getResourceName());
+        IFolder newSupplFolder = getTraceSupplementaryFolder(newName + getSuffix());
+
+        // copy supplementary folder
+        if (oldSupplFolder.exists()) {
+            try {
+                oldSupplFolder.copy(newSupplFolder.getFullPath(), true, new NullProgressMonitor());
+            } catch (CoreException e) {
+                Activator.getDefault().logError("Error renaming supplementary folder " + oldSupplFolder, e); //$NON-NLS-1$
+            }
+        }
+    }
+
+    /**
+     * Copies the element specific supplementary folder a new folder.
+     *
+     * @param destination The destination folder to copy to.
+     */
+    public void copySupplementaryFolder(IFolder destination) {
+        IFolder oldSupplFolder = getTraceSupplementaryFolder(getResourceName());
+
+        // copy supplementary folder
+        if (oldSupplFolder.exists()) {
+            try {
+                oldSupplFolder.copy(destination.getFullPath(), true, new NullProgressMonitor());
+            } catch (CoreException e) {
+                Activator.getDefault().logError("Error copying supplementary folder " + oldSupplFolder, e); //$NON-NLS-1$
+            }
+        }
+    }
+
+
+    /**
+     * Refreshes the element specific supplementary folder information. It creates the folder if not exists.
+     * It sets the persistence property of the trace resource
+     */
+    public void refreshSupplementaryFolder() {
+        createSupplementaryDirectory();
+    }
+
+    /**
+     * Checks if supplementary resource exist or not.
+     *
+     * @return <code>true</code> if one or more files are under the element supplementary folder
+     */
+    public boolean hasSupplementaryResources() {
+        IResource[] resources = getSupplementaryResources();
+        return (resources.length > 0);
+    }
+
+    /**
+     * Returns the supplementary resources under the trace supplementary folder.
+     *
+     * @return array of resources under the trace supplementary folder.
+     */
+    public IResource[] getSupplementaryResources() {
+        IFolder supplFolder = getTraceSupplementaryFolder(getResourceName());
+        if (supplFolder.exists()) {
+            try {
+                return supplFolder.members();
+            } catch (CoreException e) {
+                Activator.getDefault().logError("Error deleting supplementary folder " + supplFolder, e); //$NON-NLS-1$
+            }
+        }
+        return new IResource[0];
+    }
+
+    /**
+     * Deletes the given resources.
+     *
+     * @param resources array of resources to delete.
+     */
+    public void deleteSupplementaryResources(IResource[] resources) {
+
+        for (int i = 0; i < resources.length; i++) {
+            try {
+                resources[i].delete(true, new NullProgressMonitor());
+            } catch (CoreException e) {
+                Activator.getDefault().logError("Error deleting supplementary resource " + resources[i], e); //$NON-NLS-1$
+            }
+        }
+    }
+
+    private void createSupplementaryDirectory() {
+        IFolder supplFolder = getTraceSupplementaryFolder(getResourceName());
+        if (!supplFolder.exists()) {
+            try {
+                supplFolder.create(true, true, new NullProgressMonitor());
+            } catch (CoreException e) {
+                Activator.getDefault().logError("Error creating resource supplementary file " + supplFolder, e); //$NON-NLS-1$
+            }
+        }
+
+        try {
+            fResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, supplFolder.getLocationURI().getPath());
+        } catch (CoreException e) {
+            Activator.getDefault().logError("Error setting persistant property " + TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, e); //$NON-NLS-1$
+        }
+
+    }
+
+}
index 1dd6aee84af5e1884455c37ad3b0b84c7c2371f0..a31a3487dc5c5d214ec5091b9ada108397e02b0f 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2011, 2012 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Francois Chouinard - Copied and adapted from NewFolderDialog
  *******************************************************************************/
@@ -87,7 +87,7 @@ public class CopyExperimentDialog extends SelectionStatusDialog {
     // ------------------------------------------------------------------------
     // Dialog
     // ------------------------------------------------------------------------
-    
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
@@ -144,7 +144,7 @@ public class CopyExperimentDialog extends SelectionStatusDialog {
     }
 
     private void validateNewExperimentName() {
-        
+
        String name = fNewExperimentName.getText();
         IWorkspace workspace = fExperimentFolder.getWorkspace();
         IStatus nameStatus = workspace.validateName(name, IResource.FOLDER);
@@ -153,12 +153,12 @@ public class CopyExperimentDialog extends SelectionStatusDialog {
                updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_EmptyNameError, null));
                return;
         }
-        
+
         if (!nameStatus.isOK()) {
                updateStatus(nameStatus);
                return;
         }
-        
+
         IPath path = new Path(name);
         if (fExperimentFolder.getFolder(path).exists() || fExperimentFolder.getFile(path).exists()) {
             updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_ExistingNameError, null));
@@ -220,6 +220,8 @@ public class CopyExperimentDialog extends SelectionStatusDialog {
                     if (monitor.isCanceled()) {
                         throw new OperationCanceledException();
                     }
+                    // Copy supplementary files first
+                    fExperiment.copySupplementaryFolder(newName);
                     fExperiment.getResource().copy(newPath, IResource.FORCE | IResource.SHALLOW, null);
                     // Delete any bookmarks file found in copied experiment folder
                     IFolder folder = fExperimentFolder.getFolder(newName);
index 657691e90a2015319bb58a2826437b31805b52d4..ad9438bed8a21d1e6cc6b26b2e2f8b6302a5debb 100644 (file)
@@ -246,6 +246,8 @@ public class RenameExperimentDialog extends SelectionStatusDialog {
                             bookmarksFile.move(newBookmarksPath, IResource.FORCE | IResource.SHALLOW, null);
                         }
                     }
+
+                    fExperiment.renameSupplementaryFolder(newName);
                        fExperiment.getResource().move(newPath, IResource.FORCE | IResource.SHALLOW, null);
                     if (monitor.isCanceled()) {
                         throw new OperationCanceledException();
This page took 0.036899 seconds and 5 git commands to generate.