Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8E85017265 for ; Fri, 10 Oct 2014 20:26:16 +0000 (UTC) Received: (qmail 22072 invoked by uid 500); 10 Oct 2014 20:26:16 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 22010 invoked by uid 500); 10 Oct 2014 20:26:16 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 22000 invoked by uid 99); 10 Oct 2014 20:26:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Oct 2014 20:26:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Oct 2014 20:25:50 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 839A723889F1; Fri, 10 Oct 2014 20:25:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1630976 - in /sling/trunk/tooling/ide: eclipse-core/src/org/apache/sling/ide/eclipse/core/ eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ eclipse-test/src/org/apache/sling/ide/test/impl/ eclipse-test/src/org/apache/sling/ide/... Date: Fri, 10 Oct 2014 20:25:48 -0000 To: commits@sling.apache.org From: rombert@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141010202548.839A723889F1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rombert Date: Fri Oct 10 20:25:47 2014 New Revision: 1630976 URL: http://svn.apache.org/r1630976 Log: SLING-4020 - Importing content from the repository triggers publish operations Replace the previous mechanisms from ignoring resource changes from import action by comparing IResource modification stamps with modification stamps set as persistent properties when importing. Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ISlingLaunchpadServer.java sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ResourceUtil.java sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ResourceChangeCommandFactory.java sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadServer.java sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SlingWstServer.java sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ImportWizard.java sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ISlingLaunchpadServer.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ISlingLaunchpadServer.java?rev=1630976&r1=1630975&r2=1630976&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ISlingLaunchpadServer.java (original) +++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ISlingLaunchpadServer.java Fri Oct 10 20:25:47 2014 @@ -21,10 +21,6 @@ import org.osgi.framework.Version; public interface ISlingLaunchpadServer { - public static final int PUBLISH_STATE_NEVER = 1; - public static final int PUBLISH_STATE_RESOURCE_CHANGE = 2; - public static final int PUBLISH_STATE_BUILD_EVENT = 3; - public static final String PROP_PASSWORD = "launchpad.password"; public static final String PROP_USERNAME = "launchpad.username"; public static final String PROP_CONTEXT_PATH = "launchpad.contextPath"; @@ -33,10 +29,6 @@ public interface ISlingLaunchpadServer { public static final String PROP_INSTALL_LOCALLY = "launchpad.installLocally"; public static final String PROP_BUNDLE_VERSION_FORMAT = "launchpad.bundle.%s.version"; - - void setPublishState(int publishState, IProgressMonitor monitor); - - int getPublishState(); ISlingLaunchpadConfiguration getConfiguration(); Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ResourceUtil.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ResourceUtil.java?rev=1630976&r1=1630975&r2=1630976&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ResourceUtil.java (original) +++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ResourceUtil.java Fri Oct 10 20:25:47 2014 @@ -17,11 +17,26 @@ package org.apache.sling.ide.eclipse.core; import org.apache.sling.ide.eclipse.core.internal.Activator; +import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.QualifiedName; public abstract class ResourceUtil { - public static final QualifiedName QN_IGNORE_NEXT_CHANGE = new QualifiedName(Activator.PLUGIN_ID, "ignoreNextChange"); + /** + * This property is set by code which imports content from the repository into the workspace + * + *

+ * It serves to distinguish between changes which are triggered by the user directly and changes which are triggered + * by an import run. + *

+ * + *

+ * If an exporter finds this property and the property of the {#link {@link IResource#getModificationStamp()} is + * older than or equal to the value of this property, the change should be ignored. + *

+ */ + public static final QualifiedName QN_IMPORT_MODIFICATION_TIMESTAMP = new QualifiedName(Activator.PLUGIN_ID, + "importModificationTimestamp"); private ResourceUtil() { Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ResourceChangeCommandFactory.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ResourceChangeCommandFactory.java?rev=1630976&r1=1630975&r2=1630976&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ResourceChangeCommandFactory.java (original) +++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ResourceChangeCommandFactory.java Fri Oct 10 20:25:47 2014 @@ -115,10 +115,17 @@ public class ResourceChangeCommandFactor return null; } - Object ignoreNextUpdate = resource.getSessionProperty(ResourceUtil.QN_IGNORE_NEXT_CHANGE); - if (ignoreNextUpdate != null) { - resource.setSessionProperty(ResourceUtil.QN_IGNORE_NEXT_CHANGE, null); - return null; + Long modificationTimestamp = (Long) resource.getSessionProperty(ResourceUtil.QN_IMPORT_MODIFICATION_TIMESTAMP); + + if (modificationTimestamp != null) { + if (modificationTimestamp >= resource.getModificationStamp()) { + Activator.getDefault().getPluginLogger() + .trace("Change for resource {0} ignored as the import timestamp {1} >= modification timestamp {2}", + resource, modificationTimestamp, resource.getModificationStamp()); + } else { + // clear the import modification timestamp since this is a more recent change + resource.setSessionProperty(ResourceUtil.QN_IMPORT_MODIFICATION_TIMESTAMP, null); + } } if (resource.isTeamPrivateMember(IResource.CHECK_ANCESTORS)) { Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadServer.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadServer.java?rev=1630976&r1=1630975&r2=1630976&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadServer.java (original) +++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadServer.java Fri Oct 10 20:25:47 2014 @@ -29,8 +29,6 @@ import org.osgi.framework.Version; public class SlingLaunchpadServer extends ServerDelegate implements ISlingLaunchpadServer { - private static final String PROP_AUTO_PUBLISH_SETTING = "auto-publish-setting"; - private static final String MODULE_TYPE_SLING_CONTENT = "sling.content"; private static final String MODULE_TYPE_SLING_BUNDLE = "sling.bundle"; @@ -127,25 +125,6 @@ public class SlingLaunchpadServer extend } @Override - public int getPublishState() { - return getAttribute(PROP_AUTO_PUBLISH_SETTING, PUBLISH_STATE_NEVER); - } - - @Override - public void setPublishState(int publishState, IProgressMonitor monitor) { - - Activator.getDefault().getPluginLogger().trace("Set {0} to {1}", PROP_AUTO_PUBLISH_SETTING, publishState); - - IServerWorkingCopy wc = getServer().createWorkingCopy(); - wc.setAttribute(PROP_AUTO_PUBLISH_SETTING, publishState); - try { - wc.save(false, monitor); - } catch (CoreException e) { - throw new RuntimeException(e); - } - } - - @Override public Version getBundleVersion(String bundleSymbolicName) { String rawValue = getAttribute(String.format(PROP_BUNDLE_VERSION_FORMAT, bundleSymbolicName), (String) null); Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java?rev=1630976&r1=1630975&r2=1630976&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java (original) +++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java Fri Oct 10 20:25:47 2014 @@ -36,6 +36,7 @@ import org.apache.sling.ide.eclipse.ui.i import org.apache.sling.ide.serialization.SerializationException; import org.apache.sling.ide.test.impl.helpers.DisableDebugStatusHandlers; import org.apache.sling.ide.test.impl.helpers.ExternalSlingLaunchpad; +import org.apache.sling.ide.test.impl.helpers.FailOnModificationEventsRule; import org.apache.sling.ide.test.impl.helpers.LaunchpadConfig; import org.apache.sling.ide.test.impl.helpers.ProjectAdapter; import org.apache.sling.ide.test.impl.helpers.RepositoryAccessor; @@ -71,6 +72,9 @@ public class ContentImportTest { @Rule public DisableDebugStatusHandlers disableDebugHandlers = new DisableDebugStatusHandlers(); + @Rule + public FailOnModificationEventsRule deh = new FailOnModificationEventsRule(); + @Test public void importFilesAndFolders() throws Exception { @@ -85,13 +89,13 @@ public class ContentImportTest { wstServer.waitForServerToStart(); - ServerAdapter server = new ServerAdapter(wstServer.getServer()); - server.installModule(contentProject); - project.createVltFilterWithRoots("/content/test-root/en"); project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/en/hello.txt"), new ByteArrayInputStream("hello, world".getBytes())); + ServerAdapter server = new ServerAdapter(wstServer.getServer()); + server.installModule(contentProject); + // create server-side content RepositoryAccessor repo = new RepositoryAccessor(config); repo.createNode("/content/test-root/en", "nt:folder"); @@ -118,13 +122,13 @@ public class ContentImportTest { wstServer.waitForServerToStart(); - ServerAdapter server = new ServerAdapter(wstServer.getServer()); - server.installModule(contentProject); - project.createVltFilterWithRoots("/content/test-root/en"); project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/en/hello.txt"), new ByteArrayInputStream("hello, world".getBytes())); + ServerAdapter server = new ServerAdapter(wstServer.getServer()); + server.installModule(contentProject); + // create server-side content RepositoryAccessor repo = new RepositoryAccessor(config); repo.createNode("/content/test-root/de", "nt:folder"); @@ -150,13 +154,13 @@ public class ContentImportTest { wstServer.waitForServerToStart(); - ServerAdapter server = new ServerAdapter(wstServer.getServer()); - server.installModule(contentProject); - project.createVltFilterWithRoots("/content/test-root/en"); project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/.vltignore"), new ByteArrayInputStream("en\n".getBytes())); + ServerAdapter server = new ServerAdapter(wstServer.getServer()); + server.installModule(contentProject); + // create server-side content RepositoryAccessor repo = new RepositoryAccessor(config); repo.createNode("/content/test-root/en", "nt:folder"); @@ -182,9 +186,6 @@ public class ContentImportTest { wstServer.waitForServerToStart(); - ServerAdapter server = new ServerAdapter(wstServer.getServer()); - server.installModule(contentProject); - project.createVltFilterWithRoots("/content/test-root/en"); project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/hello.txt"), new ByteArrayInputStream( "hello, world".getBytes())); @@ -192,6 +193,9 @@ public class ContentImportTest { project.createOrUpdateFile(Path.fromPortableString("jcr_root/.vltignore"), new ByteArrayInputStream( "content/test-root/en\n".getBytes())); + ServerAdapter server = new ServerAdapter(wstServer.getServer()); + server.installModule(contentProject); + // create server-side content RepositoryAccessor repo = new RepositoryAccessor(config); repo.createNode("/content/test-root/en", "nt:folder"); @@ -265,7 +269,6 @@ public class ContentImportTest { assertThat(repo.getNode("/content/test-root").getPrimaryNodeType().getName(), equalTo("sling:Folder")); - runImport(contentProject); assertThat("File not properly imported", contentProject, @@ -298,13 +301,13 @@ public class ContentImportTest { wstServer.waitForServerToStart(); - ServerAdapter server = new ServerAdapter(wstServer.getServer()); - server.installModule(contentProject); - project.createVltFilterWithRoots("/content/test-root"); project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/hello.txt"), new ByteArrayInputStream("hello, world".getBytes())); + ServerAdapter server = new ServerAdapter(wstServer.getServer()); + server.installModule(contentProject); + // create server-side content RepositoryAccessor repo = new RepositoryAccessor(config); repo.doWithSession(new SessionRunnable() { @@ -342,13 +345,13 @@ public class ContentImportTest { wstServer.waitForServerToStart(); - ServerAdapter server = new ServerAdapter(wstServer.getServer()); - server.installModule(contentProject); - project.createVltFilterWithRoots("/content/test-root"); project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/hello.txt"), new ByteArrayInputStream("hello, world".getBytes())); + ServerAdapter server = new ServerAdapter(wstServer.getServer()); + server.installModule(contentProject); + // create server-side content RepositoryAccessor repo = new RepositoryAccessor(config); repo.createNode("/content/test-root/en", "nt:folder"); @@ -385,13 +388,13 @@ public class ContentImportTest { wstServer.waitForServerToStart(); - ServerAdapter server = new ServerAdapter(wstServer.getServer()); - server.installModule(contentProject); - project.createVltFilterWithRoots("/content/test-root"); project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/en/hello.txt"), new ByteArrayInputStream("hello, world".getBytes())); + ServerAdapter server = new ServerAdapter(wstServer.getServer()); + server.installModule(contentProject); + repo.createNode("/content/test-root/folder", "sling:Folder"); repo.createNode("/content/test-root/folder/jcr:content", "nt:unstructured"); repo.createFile("/content/test-root/folder/jcr:content/some_file.txt", "dummy contents".getBytes()); @@ -435,15 +438,15 @@ public class ContentImportTest { // install bundle facet project.installFacet("sling.content", "1.0"); + project.createVltFilterWithRoots("/content/test-root"); + project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/hello.txt"), + new ByteArrayInputStream("hello, world".getBytes())); + wstServer.waitForServerToStart(); ServerAdapter server = new ServerAdapter(wstServer.getServer()); server.installModule(contentProject); - project.createVltFilterWithRoots("/content/test-root"); - project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/hello.txt"), - new ByteArrayInputStream("hello, world".getBytes())); - repo.createFile("/content/test-root/sling:file", "some_content".getBytes()); runImport(contentProject); Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SlingWstServer.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SlingWstServer.java?rev=1630976&r1=1630975&r2=1630976&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SlingWstServer.java (original) +++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SlingWstServer.java Fri Oct 10 20:25:47 2014 @@ -86,7 +86,6 @@ public class SlingWstServer extends Exte wc.setAttribute(ISlingLaunchpadServer.PROP_CONTEXT_PATH, config.getContextPath()); wc.setAttribute(ISlingLaunchpadServer.PROP_USERNAME, config.getUsername()); wc.setAttribute(ISlingLaunchpadServer.PROP_PASSWORD, config.getPassword()); - wc.setAttribute("auto-publish-setting", ISlingLaunchpadServer.PUBLISH_STATE_RESOURCE_CHANGE); wc.setAttribute("auto-publish-time", 0); server = wc.save(true, new NullProgressMonitor()); Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java?rev=1630976&r1=1630975&r2=1630976&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java (original) +++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java Fri Oct 10 20:25:47 2014 @@ -29,7 +29,6 @@ import java.util.Set; import org.apache.commons.io.IOUtils; import org.apache.jackrabbit.util.Text; -import org.apache.sling.ide.eclipse.core.ISlingLaunchpadServer; import org.apache.sling.ide.eclipse.core.ProjectUtil; import org.apache.sling.ide.eclipse.core.ResourceUtil; import org.apache.sling.ide.eclipse.core.ServerUtil; @@ -115,17 +114,6 @@ public class ImportRepositoryContentActi this.builder = serializationManager.newBuilder( repository, ProjectUtil.getSyncDirectoryFile(project)); - 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 - // make too many calls after the import, functionality is not affected - if (server.canPublish().isOK() && oldPublishState != ISlingLaunchpadServer.PUBLISH_STATE_NEVER) { - launchpad.setPublishState(ISlingLaunchpadServer.PUBLISH_STATE_NEVER, monitor); - } - SerializationKindManager skm; try { @@ -173,9 +161,6 @@ public class ImportRepositoryContentActi } catch (Exception e) { throw new InvocationTargetException(e); } finally { - if (oldPublishState != ISlingLaunchpadServer.PUBLISH_STATE_NEVER) { - launchpad.setPublishState(oldPublishState, monitor); - } if (builder!=null) { builder.destroy(); builder = null; @@ -433,9 +418,11 @@ public class ImportRepositoryContentActi createParents(destinationFolder.getParent()); destinationFolder.create(true, true, null /* TODO progress monitor */); - destinationFolder.setSessionProperty(ResourceUtil.QN_IGNORE_NEXT_CHANGE, Boolean.TRUE.toString()); } + destinationFolder.setSessionProperty(ResourceUtil.QN_IMPORT_MODIFICATION_TIMESTAMP, + destinationFolder.getModificationStamp()); + removeTouchedResource(destinationFolder); return destinationFolder; @@ -471,7 +458,8 @@ public class ImportRepositoryContentActi removeTouchedResource(destinationFile); - destinationFile.setSessionProperty(ResourceUtil.QN_IGNORE_NEXT_CHANGE, Boolean.TRUE.toString()); + destinationFile.setSessionProperty(ResourceUtil.QN_IMPORT_MODIFICATION_TIMESTAMP, + destinationFile.getModificationStamp()); } private void createParents(IContainer container) throws CoreException { Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ImportWizard.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ImportWizard.java?rev=1630976&r1=1630975&r2=1630976&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ImportWizard.java (original) +++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ImportWizard.java Fri Oct 10 20:25:47 2014 @@ -26,10 +26,15 @@ import org.apache.sling.ide.serializatio import org.apache.sling.ide.serialization.SerializationManager; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceRunnable; +import org.eclipse.core.resources.ResourcesPlugin; 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.OperationCanceledException; +import org.eclipse.core.runtime.Status; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; @@ -71,24 +76,42 @@ public class ImportWizard extends Wizard IResource resource = mainPage.getResource(); final IProject project = resource.getProject(); final IPath projectRelativePath = resource.getProjectRelativePath(); - IRunnableWithProgress runnable = new IRunnableWithProgress() { - @Override - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - - try { - new ImportRepositoryContentAction(server, projectRelativePath, project, serializationManager).run(monitor); - } catch (SerializationException e) { - throw new InvocationTargetException(e); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } finally { - serializationManager.destroy(); - } - } - }; try { - getContainer().run(true, true, runnable); + getContainer().run(true, true, new IRunnableWithProgress() { + + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + // wrap the import action in a IWorkspaceRunnable to make sure that changes are only + // published once at the end. This is especially important since the import action + // sets persistent properties on the modified resources to avoid them being published + // following this change ( see org.apache.sling.ide.core.ResourceUtil ) + try { + ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { + + @Override + public void run(IProgressMonitor monitor) throws CoreException { + try { + new ImportRepositoryContentAction(server, projectRelativePath, project, + serializationManager).run(monitor); + } catch (SerializationException e) { + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + "Import failed", e)); + } catch (InvocationTargetException e) { + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + "Import failed", e.getCause())); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } finally { + serializationManager.destroy(); + } + } + }, project, IWorkspace.AVOID_UPDATE, monitor); + } catch (CoreException e) { + throw new InvocationTargetException(e); + } + } + }); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); mainPage.setErrorMessage("Import error : " + cause.getMessage() @@ -96,7 +119,8 @@ public class ImportWizard extends Wizard Activator.getDefault().getPluginLogger().error("Repository import failed", cause); return false; } catch (OperationCanceledException e) { - System.out.println("Here"); + Thread.currentThread().interrupt(); + return false; } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java?rev=1630976&r1=1630975&r2=1630976&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java (original) +++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java Fri Oct 10 20:25:47 2014 @@ -389,7 +389,6 @@ public class SetupServerWizardPage exten wc.setAttribute(ISlingLaunchpadServer.PROP_INSTALL_LOCALLY, installToolingSupportBundle.getSelection()); wc.setAttribute(ISlingLaunchpadServer.PROP_USERNAME, newServerUsername.getText()); wc.setAttribute(ISlingLaunchpadServer.PROP_PASSWORD, newServerPassword.getText()); - wc.setAttribute("auto-publish-setting", ISlingLaunchpadServer.PUBLISH_STATE_RESOURCE_CHANGE); wc.setAttribute("auto-publish-time", 0); if (finalVersion != null) { wc.setAttribute(String.format(ISlingLaunchpadServer.PROP_BUNDLE_VERSION_FORMAT,