You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2013/07/19 23:40:42 UTC

svn commit: r1505032 - in /sling/whiteboard/asanso/plugins/eclipse/eclipse-ui: META-INF/ src/org/apache/sling/ide/eclipse/ui/internal/

Author: rombert
Date: Fri Jul 19 21:40:42 2013
New Revision: 1505032

URL: http://svn.apache.org/r1505032
Log:
SLING-2973 - [Tooling] Align Eclipse tooling to proposed structure

Re-apply changes from r1415704.

Added:
    sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/SharedImages.java   (with props)
    sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/sling-logo.png   (with props)
Modified:
    sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/META-INF/MANIFEST.MF
    sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java
    sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizard.java
    sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizardPage.java

Modified: sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/META-INF/MANIFEST.MF?rev=1505032&r1=1505031&r2=1505032&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/META-INF/MANIFEST.MF (original)
+++ sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/META-INF/MANIFEST.MF Fri Jul 19 21:40:42 2013
@@ -2,6 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Slingclipse-WST-plugin
 Bundle-SymbolicName: org.apache.sling.ide.eclipse-ui;singleton:=true
+Bundle-Activator: org.apache.sling.ide.eclipse.ui.internal.Activator
 Bundle-Version: 0.0.1.qualifier
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ClassPath: .
@@ -21,7 +22,9 @@ Import-Package: org.apache.sling.ide.ecl
  org.eclipse.jdt.launching,
  org.eclipse.jface.action,
  org.eclipse.jface.dialogs,
+ org.eclipse.jface.operation,
  org.eclipse.jface.preference,
+ org.eclipse.jface.resource,
  org.eclipse.jface.viewers,
  org.eclipse.jface.window,
  org.eclipse.jface.wizard,
@@ -43,3 +46,4 @@ Import-Package: org.apache.sling.ide.ecl
  org.eclipse.wst.server.ui.editor,
  org.json,
  org.osgi.framework
+Bundle-ActivationPolicy: lazy

Modified: sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java?rev=1505032&r1=1505031&r2=1505032&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java (original)
+++ sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java Fri Jul 19 21:40:42 2013
@@ -38,8 +38,6 @@ public class Activator extends Plugin {
     public void start(BundleContext context) throws Exception {
         super.start(context);
 
-        System.out.println("Starting with context " + context);
-
         serializationManagerRef = context.getServiceReference(SerializationManager.class);
         serializationManager = context.getService(serializationManagerRef);
 
@@ -52,8 +50,6 @@ public class Activator extends Plugin {
 
         context.ungetService(serializationManagerRef);
 
-        System.out.println("Stopping with context " + context);
-
         super.stop(context);
     }
 

Modified: sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizard.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizard.java?rev=1505032&r1=1505031&r2=1505032&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizard.java (original)
+++ sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizard.java Fri Jul 19 21:40:42 2013
@@ -17,6 +17,7 @@
 package org.apache.sling.ide.eclipse.ui.internal;
 
 import java.io.ByteArrayInputStream;
+import java.lang.reflect.InvocationTargetException;
 import java.nio.charset.Charset;
 import java.util.Iterator;
 
@@ -35,9 +36,8 @@ import org.eclipse.core.resources.Resour
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.ui.IImportWizard;
@@ -60,7 +60,8 @@ public class ImportWizard extends Wizard
 	 */
 	public ImportWizard() {
 		super();
-        serializationManager = Activator.getDefault().getSerializationManager();
+        Activator activator = Activator.getDefault();
+        serializationManager = activator.getSerializationManager();
 	}
 
 	/*
@@ -69,8 +70,11 @@ public class ImportWizard extends Wizard
 	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
 	 */
 	public boolean performFinish() {
+
+        if (!mainPage.isPageComplete()) {
+            return false;
+        }
 		
-		if (mainPage.isPageComplete()) {
 
             final IServer server = mainPage.getServer();
 	 
@@ -80,17 +84,18 @@ public class ImportWizard extends Wizard
 			final IPath projectRelativePath = destinationPath.removeFirstSegments(1);
 			final String repositoryPath = mainPage.getRepositoryPath();
 			
-			Job job = new Job("Import") {
-
-				protected IStatus run(IProgressMonitor monitor) {
+        try {
+            getContainer().run(false, true, new IRunnableWithProgress() {
 
+                @Override
+                public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                     Repository repository = ServerUtil.getRepository(server, monitor);
 
-					monitor.setTaskName("Loading configuration...");
-					monitor.worked(5);
+                    monitor.setTaskName("Loading configuration...");
+                    monitor.worked(5);
                     ISlingLaunchpadServer launchpad = (ISlingLaunchpadServer) server.loadAdapter(
                             ISlingLaunchpadServer.class, monitor);
-					
+
                     int oldPublishState = launchpad.getPublishState();
                     // TODO disabling publish does not work; since the publish is done async
                     // Not sure if there is a simple workaround. Anyway, the only side effect is that we
@@ -99,49 +104,45 @@ public class ImportWizard extends Wizard
                         launchpad.setPublishState(ISlingLaunchpadServer.PUBLISH_STATE_NEVER);
                     }
 
-					try {
+                    try {
 
-						// TODO: We should try to make this give 'nice' progress feedback (aka here's what I'm processing)
-						monitor.setTaskName("Importing...");
-						monitor.worked(10);
+                        // TODO: We should try to make this give 'nice' progress feedback (aka here's what I'm
+                        // processing)
+                        monitor.setTaskName("Importing...");
+                        monitor.worked(10);
 
                         // we create the root node and assume this is a folder
                         createRoot(project, projectRelativePath, repositoryPath);
 
                         crawlChildrenAndImport(repository, repositoryPath, project, projectRelativePath);
-						
-						monitor.setTaskName("Import Complete");
-						monitor.worked(100);
-					} catch ( Exception e) {
-						Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, "Failed importing repository ", e);
-						Activator.getDefault().getLog().log(status);
-						return status;
-					}finally{
+
+                        monitor.setTaskName("Import Complete");
+                        monitor.worked(100);
+                    } catch (Exception e) {
+                        throw new InvocationTargetException(e);
+                    } finally {
                         if (oldPublishState != ISlingLaunchpadServer.PUBLISH_STATE_NEVER) {
                             launchpad.setPublishState(oldPublishState);
                         }
+                        monitor.done();
+                        }
 
-					}
-					
-					return Status.OK_STATUS;
-				}
-
-                private void createRoot(final IProject project, final IPath projectRelativePath,
-                        final String repositoryPath) throws CoreException {
+                }
 
-                    IPath rootImportPath = projectRelativePath.append(repositoryPath);
+            });
+        } catch (InvocationTargetException e) {
+            Throwable cause = e.getCause();
+            mainPage.setErrorMessage("Import error : " + cause.getMessage()
+                    + " . Please see the error log for details.");
+            Activator.getDefault().getLog()
+                    .log(new Status(Status.ERROR, Constants.PLUGIN_ID, "Repository import failed", cause));
+            return false;
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            return false;
+        }
 
-                    for (int i = rootImportPath.segmentCount() - 1; i > 0; i--)
-                        createFolder(project, rootImportPath.removeLastSegments(i));
-                }
-			};
-			job.setSystem(false);
-			job.setUser(true);
-			job.schedule();
-			return true;
-		} else {
-			return false;
-		}
+        return true;
 	}
 
 	/*
@@ -154,6 +155,8 @@ public class ImportWizard extends Wizard
 		setWindowTitle("Repositoy Import"); // NON-NLS-1
 		setNeedsProgressMonitor(true);
 		mainPage = new ImportWizardPage("Import from Repository", selection); // NON-NLS-1
+        setDefaultPageImageDescriptor(SharedImages.SLING_LOG);
+
 	}
 
 	/*
@@ -166,6 +169,15 @@ public class ImportWizard extends Wizard
 		addPage(mainPage);
 	}
 	
+    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/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizardPage.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizardPage.java?rev=1505032&r1=1505031&r2=1505032&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizardPage.java (original)
+++ sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportWizardPage.java Fri Jul 19 21:40:42 2013
@@ -49,12 +49,8 @@ public class ImportWizardPage extends Wi
 	private ModifyListener modifyListener = new ModifyListener() {
 		@Override
 		public void modifyText(ModifyEvent event) {
-			try{
-				determinePageCompletion();
-				updateWidgetEnablements();
-			}catch(Exception e){
-				//TODO: Log or just ignore?
-			}
+            determinePageCompletion();
+            updateWidgetEnablements();
 		}
 	};
     private Combo repositoryCombo;

Added: sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/SharedImages.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/SharedImages.java?rev=1505032&view=auto
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/SharedImages.java (added)
+++ sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/SharedImages.java Fri Jul 19 21:40:42 2013
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.eclipse.ui.internal;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * The <tt>SharedImages</tt> class contains references to images
+ * 
+ */
+public final class SharedImages {
+    
+    public static final ImageDescriptor SLING_LOG = ImageDescriptor.createFromFile(SharedImages.class, "sling-logo.png");
+
+    private SharedImages() {
+    }
+
+}

Propchange: sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/SharedImages.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/SharedImages.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/sling-logo.png
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/sling-logo.png?rev=1505032&view=auto
==============================================================================
Binary file - no diff available.

Propchange: sling/whiteboard/asanso/plugins/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/sling-logo.png
------------------------------------------------------------------------------
    svn:mime-type = image/png