chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1815011 - in /chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench: FolderTable.java TckDialog.java worker/DeleteWorker.java
Date Sun, 12 Nov 2017 12:34:26 GMT
Author: fmui
Date: Sun Nov 12 12:34:26 2017
New Revision: 1815011

URL: http://svn.apache.org/viewvc?rev=1815011&view=rev
Log:
CMIS-1048: Workbench: fixed delete on a folder

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/DeleteWorker.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java?rev=1815011&r1=1815010&r2=1815011&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java
Sun Nov 12 12:34:26 2017
@@ -56,6 +56,7 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.api.Folder;
 import org.apache.chemistry.opencmis.commons.enums.Action;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
 import org.apache.chemistry.opencmis.workbench.icons.CheckedOutIcon;
 import org.apache.chemistry.opencmis.workbench.icons.DocumentIcon;
 import org.apache.chemistry.opencmis.workbench.icons.FolderIcon;
@@ -153,13 +154,25 @@ public class FolderTable extends JTable
                             JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
 
                     if (answer == JOptionPane.YES_OPTION) {
-                        DeleteWorker worker = new DeleteWorker(FolderTable.this, model.getCurrentObject())
{
-                            @Override
-                            protected void done() {
-                                super.done();
-                                LoadFolderWorker.reloadFolder(FolderTable.this, model);
-                            }
-                        };
+                        DeleteWorker worker = null;
+                        if (model.getCurrentObject() instanceof Folder) {
+                            worker = new DeleteWorker(FolderTable.this, (Folder) model.getCurrentObject(),
true,
+                                    UnfileObject.DELETE, true) {
+                                @Override
+                                protected void done() {
+                                    super.done();
+                                    LoadFolderWorker.reloadFolder(FolderTable.this, model);
+                                }
+                            };
+                        } else {
+                            worker = new DeleteWorker(FolderTable.this, model.getCurrentObject())
{
+                                @Override
+                                protected void done() {
+                                    super.done();
+                                    LoadFolderWorker.reloadFolder(FolderTable.this, model);
+                                }
+                            };
+                        }
                         worker.executeTask();
                     }
                 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java?rev=1815011&r1=1815010&r2=1815011&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java
Sun Nov 12 12:34:26 2017
@@ -254,19 +254,17 @@ public class TckDialog {
             mainPanel.add(configPanel, BorderLayout.LINE_END);
             add(mainPanel, BorderLayout.CENTER);
 
-            final JButton runButton = new JButton("Run TCK", new TckIcon(ClientHelper.BUTTON_ICON_SIZE,
-                    ClientHelper.BUTTON_ICON_SIZE));
+            final JButton runButton = new JButton("Run TCK",
+                    new TckIcon(ClientHelper.BUTTON_ICON_SIZE, ClientHelper.BUTTON_ICON_SIZE));
             runButton.setDefaultCapable(true);
             runButton.addActionListener(new ActionListener() {
                 @Override
                 public void actionPerformed(ActionEvent event) {
-                    int answer = JOptionPane
-                            .showConfirmDialog(
-                            		TckSelectDialog.this,
-                                    "Running the TCK may take a long time and may add, remove
and alter data in the repository!\n"
-                                            + "It also puts at a strain on the repository,
performing several thousand calls!\n"
-                                            + "\nAre you sure you want to proceed?", "TCK",
JOptionPane.YES_NO_OPTION,
-                                    JOptionPane.WARNING_MESSAGE);
+                    int answer = JOptionPane.showConfirmDialog(TckSelectDialog.this,
+                            "Running the TCK may take a long time and may add, remove and
alter data in the repository!\n"
+                                    + "It also puts at a strain on the repository, performing
several thousand calls!\n"
+                                    + "\nAre you sure you want to proceed?",
+                            "TCK", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
 
                     if (answer == JOptionPane.YES_OPTION) {
                         Map<String, String> parameters = runner.getParameters();
@@ -614,10 +612,10 @@ public class TckDialog {
 
     private static class TckDialogRunner extends AbstractRunner {
         public TckDialogRunner(ClientModel model, TckDialog tckDialog) {
-            Map<String, String> parameters = new HashMap<String, String>(model.getClientSession()
-                    .getSessionParameters());
-            parameters.put(SessionParameter.REPOSITORY_ID, model.getClientSession().getSession().getRepositoryInfo()
-                    .getId());
+            Map<String, String> parameters = new HashMap<String, String>(
+                    model.getClientSession().getSessionParameters());
+            parameters.put(SessionParameter.REPOSITORY_ID,
+                    model.getClientSession().getSession().getRepositoryInfo().getId());
 
             setParameters(parameters);
         }
@@ -728,8 +726,8 @@ public class TckDialog {
             } catch (InterruptedException ie) {
                 runner.cancel();
             } catch (Exception e) {
-                JOptionPane
-                        .showMessageDialog(owner, "Error: " + e.getMessage(), "TCK Error",
JOptionPane.ERROR_MESSAGE);
+                JOptionPane.showMessageDialog(owner, "Error: " + e.getMessage(), "TCK Error",
+                        JOptionPane.ERROR_MESSAGE);
             }
 
             return null;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/DeleteWorker.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/DeleteWorker.java?rev=1815011&r1=1815010&r2=1815011&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/DeleteWorker.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/DeleteWorker.java
Sun Nov 12 12:34:26 2017
@@ -34,6 +34,7 @@ public class DeleteWorker extends InfoWo
     private boolean allversions;
     private UnfileObject unfile;
     private boolean continueOnFailure;
+    private boolean deleteTree;
 
     // out
     private List<String> failedIds;
@@ -49,6 +50,7 @@ public class DeleteWorker extends InfoWo
         this.allversions = allversions;
         this.unfile = UnfileObject.DELETE;
         this.continueOnFailure = true;
+        this.deleteTree = false;
     }
 
     public DeleteWorker(Component comp, Folder folder, boolean allversions, UnfileObject
unfile,
@@ -59,6 +61,7 @@ public class DeleteWorker extends InfoWo
         this.allversions = allversions;
         this.unfile = unfile;
         this.continueOnFailure = continueOnFailure;
+        this.deleteTree = true;
     }
 
     @Override
@@ -73,7 +76,7 @@ public class DeleteWorker extends InfoWo
 
     @Override
     protected Object doInBackground() throws Exception {
-        if (cmisObject instanceof Folder) {
+        if (cmisObject instanceof Folder && deleteTree) {
             failedIds = ((Folder) cmisObject).deleteTree(allversions, unfile, continueOnFailure);
         } else {
             cmisObject.delete(allversions);



Mime
View raw message