Author: rombert
Date: Fri Sep 20 13:59:48 2013
New Revision: 1525008

URL: http://svn.apache.org/r1525008
Log:
SLING-3066 - Remove local path from content import wizard

Remove the local path component from the ImportWizard and always use the
root directory.

Modified:
    
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java
    
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizard.java
    
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizardPage.java

Modified: 
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java
URL: 
http://svn.apache.org/viewvc/sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java?rev=1525008&r1=1525007&r2=1525008&view=diff
==============================================================================
--- 
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java
 (original)
+++ 
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java
 Fri Sep 20 13:59:48 2013
@@ -55,7 +55,6 @@ import org.eclipse.wst.server.core.IServ
 // intentionally does not implement IRunnableWithProgress to cut dependency on 
JFace
 public class ImportRepositoryContentAction {
 
-    private final String repositoryPath;
     private final IServer server;
     private final IFile filterFile;
     private final IPath projectRelativePath;
@@ -64,16 +63,14 @@ public class ImportRepositoryContentActi
        private SerializationDataBuilder builder;
 
     /**
-     * @param repositoryPath
      * @param server
      * @param filterFile
      * @param projectRelativePath
      * @param project
      * @throws SerializationException 
      */
-    public ImportRepositoryContentAction(String repositoryPath, IServer 
server, IFile filterFile,
-            IPath projectRelativePath, IProject project, SerializationManager 
serializationManager) throws SerializationException {
-        this.repositoryPath = repositoryPath;
+    public ImportRepositoryContentAction(IServer server, IFile filterFile, 
IPath projectRelativePath,
+            IProject project, SerializationManager serializationManager) 
throws SerializationException {
         this.server = server;
         this.filterFile = filterFile;
         this.projectRelativePath = projectRelativePath;
@@ -141,10 +138,7 @@ public class ImportRepositoryContentActi
             monitor.setTaskName("Importing...");
             monitor.worked(10);
 
-            // we create the root node and assume this is a folder
-            createRoot(project, projectRelativePath, repositoryPath);
-
-            crawlChildrenAndImport(repository, filter, repositoryPath, 
project, projectRelativePath);
+            crawlChildrenAndImport(repository, filter, "/", project, 
projectRelativePath);
 
             monitor.setTaskName("Import Complete");
             monitor.worked(100);
@@ -163,15 +157,6 @@ public class ImportRepositoryContentActi
 
     }
 
-    private void createRoot(final IProject project, final IPath 
projectRelativePath,
-            final String repositoryPath) throws CoreException {
-
-        IPath rootImportPath = projectRelativePath.append(repositoryPath);
-
-        for (int i = rootImportPath.segmentCount() - 1; i > 0; i--)
-            createFolder(project, rootImportPath.removeLastSegments(i));
-    }
-
     /**
      * Crawls the repository and recursively imports founds resources
      * 

Modified: 
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizard.java
URL: 
http://svn.apache.org/viewvc/sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizard.java?rev=1525008&r1=1525007&r2=1525008&view=diff
==============================================================================
--- 
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizard.java
 (original)
+++ 
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizard.java
 Fri Sep 20 13:59:48 2013
@@ -68,14 +68,13 @@ public class ImportWizard extends Wizard
 
         final IProject project = 
ResourcesPlugin.getWorkspace().getRoot().getProject(destinationPath.segments()[0]);
         final IPath projectRelativePath = 
destinationPath.removeFirstSegments(1);
-        final String repositoryPath = mainPage.getRepositoryPath();
         final IFile filterFile = mainPage.getFilterFile();
         IRunnableWithProgress runnable = new IRunnableWithProgress() {
             @Override
             public void run(IProgressMonitor monitor) throws 
InvocationTargetException, InterruptedException {
 
                 try {
-                    new ImportRepositoryContentAction(repositoryPath, server, 
filterFile, projectRelativePath, project,
+                    new ImportRepositoryContentAction(server, filterFile, 
projectRelativePath, project,
                             serializationManager).run(monitor);
                 } catch (SerializationException e) {
                     throw new InvocationTargetException(e);

Modified: 
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizardPage.java
URL: 
http://svn.apache.org/viewvc/sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizardPage.java?rev=1525008&r1=1525007&r2=1525008&view=diff
==============================================================================
--- 
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizardPage.java
 (original)
+++ 
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizardPage.java
 Fri Sep 20 13:59:48 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.sling.ide.eclipse.ui.internal;
 
-
 import java.io.File;
 import java.util.List;
 
@@ -35,8 +34,6 @@ import org.eclipse.core.runtime.Path;
 import org.eclipse.jface.preference.PreferenceDialog;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
@@ -61,14 +58,6 @@ import org.eclipse.wst.server.core.Serve
  */
 public class ImportWizardPage extends WizardDataTransferPage {
 
-       private Text path;
-       private ModifyListener modifyListener = new ModifyListener() {
-               @Override
-               public void modifyText(ModifyEvent event) {
-            determinePageCompletion();
-            updateWidgetEnablements();
-               }
-       };
     private Combo repositoryCombo;
     private Label importLabel;
        private Button containerBrowseButton;
@@ -160,12 +149,6 @@ public class ImportWizardPage extends Wi
                });
         updateRepositoryList();
 
-        Label pathLabel = new Label(container, SWT.NONE);
-        pathLabel.setText("Repository Path:");
-        path = new Text(container, SWT.BORDER);
-        path.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-        path.addModifyListener(modifyListener);
-        
         Composite containerGroup = new Composite(composite, SWT.NONE);
         GridLayout layout = new GridLayout();
         layout.numColumns = 3;
@@ -207,7 +190,6 @@ public class ImportWizardPage extends Wi
         Link openPropertiesLink = new Link(composite, SWT.NONE);
         openPropertiesLink.setText("<a>Modify location here</a>");
         openPropertiesLink.addSelectionListener(new SelectionAdapter() {
-                       
                        public void widgetSelected(SelectionEvent e) {
                                PreferenceDialog dialog = 
PreferencesUtil.createPropertyDialogOn(getShell(), project, 
                                                
"org.apache.sling.ide.projectPropertyPage", 
@@ -223,7 +205,7 @@ public class ImportWizardPage extends Wi
         
         setControl(composite);
 
-        setPageComplete(false);
+        updateWidgetEnablements();
        }
 
        private void updateRepositoryList() {
@@ -241,14 +223,6 @@ public class ImportWizardPage extends Wi
         }
        }
 
-    /**
-        * Returns the path from which to import from the Sling Repository.
-        * 
-        * @return the repository path
-        */
-       public String getRepositoryPath() {
-               return path != null ? path.getText() : null;
-       }
 
        public void handleEvent(Event event) {
                if (event.widget == containerBrowseButton) {
@@ -327,12 +301,7 @@ public class ImportWizardPage extends Wi
             setErrorMessage("Please select a valid index");
                        return false;
                }
-               
-               if ( !getRepositoryPath().startsWith("/") ) {
-                       setErrorMessage("The repository path needs to be 
absolute");
-                       return false;
-               }
-               
+
         String syncDirectoryPath = ProjectUtil.getSyncDirectoryValue(project);
         IFolder syncFolder = project.getFolder(syncDirectoryPath);
 
@@ -424,11 +393,6 @@ public class ImportWizardPage extends Wi
                setErrorMessage("Please select a repository");
                return false;
         }
-               if (getRepositoryPath() == null
-                               || getRepositoryPath().trim().length() == 0) {
-                       setErrorMessage("Please enter a valid Sling Repository 
path");
-                       return false;
-               }
                return true;
        }
 


Reply via email to