You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2017/03/16 09:49:31 UTC
svn commit: r1787148 - in /sling/trunk/tooling/ide: eclipse-core/
eclipse-core/META-INF/ eclipse-core/src/org/apache/sling/ide/eclipse/core/
eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/
eclipse-core/src/org/apache/sling/ide/eclipse/core...
Author: kwin
Date: Thu Mar 16 09:49:31 2017
New Revision: 1787148
URL: http://svn.apache.org/viewvc?rev=1787148&view=rev
Log:
SLING-6345 allow to maintain ignored files for the server sync in a dedicated workspace property page
Added:
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/Preferences.java (with props)
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/PreferencesInitializer.java (with props)
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/preferences/
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/preferences/impl/
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/MavenProjectConfiguratorPreferencesPage.java
- copied, changed from r1786643, sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/SlingIdePreferencePage.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/SlingIdePreferencePage.java (with props)
Removed:
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/SlingIdePreferencePage.java
Modified:
sling/trunk/tooling/ide/eclipse-core/META-INF/MANIFEST.MF
sling/trunk/tooling/ide/eclipse-core/plugin.xml
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.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/SlingLaunchpadBehaviour.java
sling/trunk/tooling/ide/eclipse-m2e-ui/plugin.xml
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ResourceChangeCommandFactoryTest.java
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyCommand.java
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyRepository.java
sling/trunk/tooling/ide/eclipse-ui/plugin.xml
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ExportWizard.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java
Modified: sling/trunk/tooling/ide/eclipse-core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/META-INF/MANIFEST.MF?rev=1787148&r1=1787147&r2=1787148&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/META-INF/MANIFEST.MF (original)
+++ sling/trunk/tooling/ide/eclipse-core/META-INF/MANIFEST.MF Thu Mar 16 09:49:31 2017
@@ -53,6 +53,7 @@ Export-Package: org.apache.sling.ide.ecl
org.apache.sling.ide.eclipse.core.facet,
org.apache.sling.ide.eclipse.core.internal,
org.apache.sling.ide.eclipse.core.launch,
+ org.apache.sling.ide.eclipse.core.preferences,
org.apache.sling.ide.eclipse.core.progress,
org.apache.sling.ide.eclipse.internal.validation;x-friends:="org.apache.sling.ide.eclipse-test"
Service-Component: OSGI-INF/TraceCommandExecutionEventsHandler.xml
Modified: sling/trunk/tooling/ide/eclipse-core/plugin.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/plugin.xml?rev=1787148&r1=1787147&r2=1787148&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/plugin.xml (original)
+++ sling/trunk/tooling/ide/eclipse-core/plugin.xml Thu Mar 16 09:49:31 2017
@@ -309,4 +309,9 @@
<scope name="project" class="org.eclipse.core.internal.resources.ProjectPreferences">
</scope>
</extension>
+
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.apache.sling.ide.eclipse.core.internal.PreferencesInitializer">
+ </initializer>
+ </extension>
</plugin>
Added: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/Preferences.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/Preferences.java?rev=1787148&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/Preferences.java (added)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/Preferences.java Thu Mar 16 09:49:31 2017
@@ -0,0 +1,46 @@
+/*
+ * 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.core;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.sling.ide.eclipse.core.internal.Activator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+
+/**
+ * Exposes all preferences bound to Eclipse's preference service with qualifier = Activator.PLUGIN_ID (i.e. bound to the core plugin symbolic name)
+ * @see IPreferencesService
+ */
+public class Preferences {
+
+ public static final String IGNORED_FILE_NAMES_FOR_SYNC = "exclusionList";
+ public static final String LIST_SEPARATOR = ";";
+
+ private final IPreferencesService preferenceService;
+
+ public Preferences() {
+ // this is a hierachical view on the different scopes
+ preferenceService = Platform.getPreferencesService();
+ }
+
+ public Set<String> getIgnoredFileNamesForSync() {
+ return new HashSet<String>(Arrays.asList(preferenceService.getString(Activator.PLUGIN_ID, IGNORED_FILE_NAMES_FOR_SYNC, null, null).split(LIST_SEPARATOR)));
+ }
+}
Propchange: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/Preferences.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java?rev=1787148&r1=1787147&r2=1787148&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java Thu Mar 16 09:49:31 2017
@@ -20,6 +20,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.sling.ide.artifacts.EmbeddedArtifactLocator;
+import org.apache.sling.ide.eclipse.core.Preferences;
import org.apache.sling.ide.eclipse.core.ServiceUtil;
import org.apache.sling.ide.eclipse.core.debug.PluginLoggerRegistrar;
import org.apache.sling.ide.eclipse.core.launch.SourceReferenceResolver;
@@ -31,6 +32,8 @@ import org.apache.sling.ide.transport.Ba
import org.apache.sling.ide.transport.CommandExecutionProperties;
import org.apache.sling.ide.transport.RepositoryFactory;
import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.event.Event;
@@ -65,6 +68,8 @@ public class Activator extends Plugin {
private ServiceRegistration<Logger> tracerRegistration;
+ private Preferences preferences;
+
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
@@ -186,4 +191,12 @@ public class Activator extends Plugin {
public SourceReferenceResolver getSourceReferenceResolver() {
return (SourceReferenceResolver) sourceReferenceLocator.getService();
}
+
+ public Preferences getPreferences() {
+ // Create the preferences lazily.
+ if (preferences == null) {
+ preferences = new Preferences();
+ }
+ return preferences;
+ }
}
Added: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/PreferencesInitializer.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/PreferencesInitializer.java?rev=1787148&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/PreferencesInitializer.java (added)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/PreferencesInitializer.java Thu Mar 16 09:49:31 2017
@@ -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.core.internal;
+
+import org.apache.sling.ide.eclipse.core.Preferences;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+
+public class PreferencesInitializer extends AbstractPreferenceInitializer {
+
+ @Override
+ public void initializeDefaultPreferences() {
+ IEclipsePreferences node = DefaultScope.INSTANCE.getNode(org.apache.sling.ide.eclipse.core.internal.Activator.PLUGIN_ID);
+ node.put(Preferences.IGNORED_FILE_NAMES_FOR_SYNC, ".svn;.DS_Store;.gitignore;.vlt;.vltignore");
+ }
+
+}
Propchange: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/PreferencesInitializer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
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=1787148&r1=1787147&r2=1787148&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 Thu Mar 16 09:49:31 2017
@@ -22,7 +22,6 @@ import java.io.InputStream;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -64,16 +63,13 @@ import org.eclipse.ui.statushandlers.Sta
*/
public class ResourceChangeCommandFactory {
- private final Set<String> ignoredFileNames = new HashSet<>();
- {
- ignoredFileNames.add(".vlt");
- ignoredFileNames.add(".vltignore");
- }
+ private final Set<String> ignoredFileNames;
private final SerializationManager serializationManager;
- public ResourceChangeCommandFactory(SerializationManager serializationManager) {
+ public ResourceChangeCommandFactory(SerializationManager serializationManager, Set<String> ignoredFileNames) {
this.serializationManager = serializationManager;
+ this.ignoredFileNames = ignoredFileNames;
}
public Command<?> newCommandForAddedOrUpdated(Repository repository, IResource addedOrUpdated) throws CoreException {
@@ -339,7 +335,7 @@ public class ResourceChangeCommandFactor
// don't use isRoot() to prevent infinite loop when the final path is '//'
while (serializationFilePath.segmentCount() != 0) {
serializationFilePath = serializationFilePath.removeLastSegments(1);
- IFolder folderWithPossibleSerializationFile = (IFolder) syncDirectory.findMember(serializationFilePath);
+ IFolder folderWithPossibleSerializationFile = syncDirectory.getFolder(serializationFilePath);
if (folderWithPossibleSerializationFile == null) {
logger.trace("No folder found at {0}, moving up to the next level", serializationFilePath);
continue;
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java?rev=1787148&r1=1787147&r2=1787148&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java Thu Mar 16 09:49:31 2017
@@ -196,7 +196,7 @@ public class SlingLaunchpadBehaviour ext
Logger logger = Activator.getDefault().getPluginLogger();
if (commandFactory == null) {
- commandFactory = new ResourceChangeCommandFactory(Activator.getDefault().getSerializationManager());
+ commandFactory = new ResourceChangeCommandFactory(Activator.getDefault().getSerializationManager(), Activator.getDefault().getPreferences().getIgnoredFileNamesForSync());
}
logger.trace(traceOperation(kind, deltaKind, module));
Modified: sling/trunk/tooling/ide/eclipse-m2e-ui/plugin.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/plugin.xml?rev=1787148&r1=1787147&r2=1787148&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/plugin.xml (original)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/plugin.xml Thu Mar 16 09:49:31 2017
@@ -109,7 +109,7 @@
</extension>
<extension point="org.eclipse.ui.keywords">
- <keyword id="org.apache.sling.ide.eclipse.m2e" label="%keyword.label"/>
+ <keyword id="org.apache.sling.ide.eclipse.m2e" label="maven project configurator sling ide bundle content-package content-packages"/>
</extension>
<extension point="org.eclipse.core.runtime.preferences">
@@ -119,8 +119,9 @@
<extension point="org.eclipse.ui.preferencePages">
<page id="org.apache.sling.ide.eclipse.m2e.SlingIdePreferencePage"
- class="org.apache.sling.ide.eclipse.m2e.internal.SlingIdePreferencePage"
- name="Sling IDE">
+ class="org.apache.sling.ide.eclipse.m2e.internal.MavenProjectConfiguratorPreferencesPage"
+ name="Maven Project Configurator"
+ category="org.apache.sling.ide.eclipse.ui.SlingIdePreferencePage">
<keywordReference id="org.apache.sling.ide.eclipse.m2e"/>
</page>
</extension>
Copied: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/MavenProjectConfiguratorPreferencesPage.java (from r1786643, sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/SlingIdePreferencePage.java)
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/MavenProjectConfiguratorPreferencesPage.java?p2=sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/MavenProjectConfiguratorPreferencesPage.java&p1=sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/SlingIdePreferencePage.java&r1=1786643&r2=1787148&rev=1787148&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/SlingIdePreferencePage.java (original)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/MavenProjectConfiguratorPreferencesPage.java Thu Mar 16 09:49:31 2017
@@ -28,13 +28,13 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-public class SlingIdePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+public class MavenProjectConfiguratorPreferencesPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
private BooleanFieldEditor enableProjectConfiguratorEditor;
private BooleanFieldEditor enableExtendedProjectConfigurationEditor;
private Group m2eProjectConfiguratorsForContentPackagesGroup;
- public SlingIdePreferencePage() {
+ public MavenProjectConfiguratorPreferencesPage() {
super(GRID);
}
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ResourceChangeCommandFactoryTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ResourceChangeCommandFactoryTest.java?rev=1787148&r1=1787147&r2=1787148&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ResourceChangeCommandFactoryTest.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ResourceChangeCommandFactoryTest.java Thu Mar 16 09:49:31 2017
@@ -19,12 +19,17 @@ package org.apache.sling.ide.test.impl;
import static java.util.Collections.singletonMap;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.sling.ide.eclipse.core.internal.ResourceChangeCommandFactory;
import org.apache.sling.ide.test.impl.helpers.ProjectAdapter;
@@ -65,10 +70,49 @@ public class ResourceChangeCommandFactor
// create filter.xml
project.createVltFilterWithRoots("/content");
- factory = new ResourceChangeCommandFactory(Activator.getDefault().getSerializationManager());
+ Set<String> ignoredFileNames = new HashSet<>();
+ ignoredFileNames.add(".gitignore");
+ factory = new ResourceChangeCommandFactory(Activator.getDefault().getSerializationManager(), ignoredFileNames);
spyRepo = new SpyRepository();
+ }
+ @Test
+ public void commandsForIgnoredFile() throws CoreException, IOException {
+ byte[] buffer = new byte[0];
+ try (InputStream inputStream = new ByteArrayInputStream(buffer)) {
+ // create a file at at /content/test-root/nested/.gitignore (the input stream does not matter here)
+ project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/nested/.gitignore"),
+ inputStream);
+ }
+ SpyCommand<?> command = (SpyCommand<?>) factory.newCommandForAddedOrUpdated(spyRepo,
+ contentProject.findMember("jcr_root/content/test-root/nested/.gitignore"));
+ assertNull(command);
+ command = (SpyCommand<?>) factory.newCommandForRemovedResources(spyRepo,
+ contentProject.findMember("jcr_root/content/test-root/nested/.gitignore"));
+ assertNull(command);
+ }
+
+ @Test
+ public void commandsForNotIgnoredFile() throws CoreException, IOException {
+ byte[] buffer = new byte[0];
+ try (InputStream inputStream = new ByteArrayInputStream(buffer)) {
+ // create a file at at /content/test-root/nested/gitignore (the input stream does not matter here)
+ project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/nested/gitignore"),
+ inputStream);
+ }
+ SpyCommand<?> command = (SpyCommand<?>) factory.newCommandForAddedOrUpdated(spyRepo,
+ contentProject.findMember("jcr_root/content/test-root/nested/gitignore"));
+ assertThat("command.path", command.getPath(), nullValue());
+ assertThat("command.resource.path", command.getResourceProxy().getPath(), equalTo("/content/test-root/nested/gitignore"));
+ assertThat("command.resource.properties", command.getResourceProxy().getProperties(),
+ equalTo(singletonMap("jcr:primaryType", (Object) "nt:file")));
+ assertThat("command.kind", command.getSpyKind(), equalTo(SpyCommand.Kind.ADD_OR_UPDATE));
+
+ command = (SpyCommand<?>) factory.newCommandForRemovedResources(spyRepo,
+ contentProject.findMember("jcr_root/content/test-root/nested/gitignore"));
+ assertThat("command.path", command.getPath(), equalTo("/content/test-root/nested/gitignore"));
+ assertThat("command.kind", command.getSpyKind(), equalTo(SpyCommand.Kind.DELETE));
}
@Test
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyCommand.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyCommand.java?rev=1787148&r1=1787147&r2=1787148&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyCommand.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyCommand.java Thu Mar 16 09:49:31 2017
@@ -35,7 +35,8 @@ import org.apache.sling.ide.transport.Re
public class SpyCommand<T> implements Command<T> {
public enum Kind {
- ADD_OR_UPDATE;
+ ADD_OR_UPDATE,
+ DELETE
}
private final ResourceProxy resourceProxy;
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyRepository.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyRepository.java?rev=1787148&r1=1787147&r2=1787148&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyRepository.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyRepository.java Thu Mar 16 09:49:31 2017
@@ -51,7 +51,7 @@ public class SpyRepository implements Re
@Override
public Command<Void> newDeleteNodeCommand(String path) {
- throw new UnsupportedOperationException("Not implemented");
+ return new SpyCommand<>(null, null, path, SpyCommand.Kind.DELETE);
}
@Override
Modified: sling/trunk/tooling/ide/eclipse-ui/plugin.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/plugin.xml?rev=1787148&r1=1787147&r2=1787148&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/plugin.xml (original)
+++ sling/trunk/tooling/ide/eclipse-ui/plugin.xml Thu Mar 16 09:49:31 2017
@@ -777,4 +777,16 @@
file="templates/jsp-templates.xml"
translations="templates/jsp-templates.properties"/>
</extension>
+
+ <extension point="org.eclipse.ui.keywords">
+ <keyword id="org.apache.sling.ide.eclipse" label="sling ide"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.preferencePages">
+ <page id="org.apache.sling.ide.eclipse.ui.SlingIdePreferencePage"
+ class="org.apache.sling.ide.eclipse.ui.SlingIdePreferencePage"
+ name="Sling IDE">
+ <keywordReference id="org.apache.sling.ide.eclipse"/>
+ </page>
+ </extension>
</plugin>
Added: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/SlingIdePreferencePage.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/SlingIdePreferencePage.java?rev=1787148&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/SlingIdePreferencePage.java (added)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/SlingIdePreferencePage.java Thu Mar 16 09:49:31 2017
@@ -0,0 +1,95 @@
+/*
+ * 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;
+
+import org.apache.sling.ide.eclipse.core.Preferences;
+import org.apache.sling.ide.eclipse.ui.internal.Activator;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.ListEditor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class SlingIdePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+ // a list with options to add/remove
+ private ListEditor ignoredFileNamesForSyncEditor;
+
+ public SlingIdePreferencePage() {
+ super(GRID);
+ }
+
+ private final static class PatternValidator implements IInputValidator {
+
+ @Override
+ public String isValid(String newText) {
+ // may not contain "/" or "\"
+ if (newText.matches(".*(\\\\|\\/).*")) {
+ return "Name must not contain '/' or '\'";
+ };
+ return null;
+ }
+
+ }
+ @Override
+ protected void createFieldEditors() {
+ ignoredFileNamesForSyncEditor = new ListEditor(Preferences.IGNORED_FILE_NAMES_FOR_SYNC, "Ignored file names for the server sync", getFieldEditorParent()) {
+
+ @Override
+ protected String createList(String[] items) {
+ StringBuffer path = new StringBuffer("");//$NON-NLS-1$
+ for (int i = 0; i < items.length; i++) {
+ path.append(items[i]);
+ path.append(Preferences.LIST_SEPARATOR);
+ }
+ return path.toString();
+ }
+
+ @Override
+ protected String getNewInputObject() {
+ InputDialog dialog = new InputDialog(getShell(), "Add file name", "Enter a file name to ignore during the server sync ...", "", new PatternValidator());
+ if (dialog.open() == Window.OK) {
+ return dialog.getValue();
+ } else {
+ return null;
+ }
+
+ }
+
+ @Override
+ protected String[] parseString(String stringList) {
+ return stringList.split(Preferences.LIST_SEPARATOR);
+ }
+
+ };
+ addField(ignoredFileNamesForSyncEditor);
+
+ }
+
+ @Override
+ protected IPreferenceStore doGetPreferenceStore() {
+ return Activator.getDefault().getPreferenceStore();
+ }
+
+ @Override
+ public void init(IWorkbench workbench) {
+ }
+
+}
Propchange: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/SlingIdePreferencePage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java?rev=1787148&r1=1787147&r2=1787148&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java Thu Mar 16 09:49:31 2017
@@ -17,13 +17,17 @@
package org.apache.sling.ide.eclipse.ui.internal;
import org.apache.sling.ide.artifacts.EmbeddedArtifactLocator;
+import org.apache.sling.ide.eclipse.core.Preferences;
import org.apache.sling.ide.eclipse.core.ServiceUtil;
import org.apache.sling.ide.eclipse.core.debug.PluginLoggerRegistrar;
import org.apache.sling.ide.filter.FilterLocator;
import org.apache.sling.ide.log.Logger;
import org.apache.sling.ide.osgi.OsgiClientFactory;
import org.apache.sling.ide.serialization.SerializationManager;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.event.EventAdmin;
@@ -42,6 +46,9 @@ public class Activator extends AbstractU
private ServiceTracker<Logger, Logger> tracer;
private ServiceRegistration<Logger> tracerRegistration;
+ private ScopedPreferenceStore preferenceStore;
+
+ private Preferences preferences;
public static Activator getDefault() {
@@ -113,4 +120,23 @@ public class Activator extends AbstractU
public Logger getPluginLogger() {
return (Logger) ServiceUtil.getNotNull(tracer);
}
+
+ @Override
+ public IPreferenceStore getPreferenceStore() {
+ // return a IPreference wrapper around the preferences being maintained for the core(!!) plugin
+ // Create the preference store lazily.
+ if (preferenceStore == null) {
+ // this leverages the default scope under the hood for the default values
+ preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, org.apache.sling.ide.eclipse.core.internal.Activator.PLUGIN_ID);
+ }
+ return preferenceStore;
+ }
+
+ public Preferences getPreferences() {
+ // Create the preferences lazily.
+ if (preferences == null) {
+ preferences = new Preferences();
+ }
+ return preferences;
+ }
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ExportWizard.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ExportWizard.java?rev=1787148&r1=1787147&r2=1787148&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ExportWizard.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ExportWizard.java Thu Mar 16 09:49:31 2017
@@ -62,7 +62,7 @@ public class ExportWizard extends Wizard
@Override
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
final ResourceChangeCommandFactory factory = new ResourceChangeCommandFactory(Activator
- .getDefault().getSerializationManager());
+ .getDefault().getSerializationManager(), Activator.getDefault().getPreferences().getIgnoredFileNamesForSync());
final Repository[] selectedServer = new Repository[1];
Display.getDefault().syncExec(new Runnable() {
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=1787148&r1=1787147&r2=1787148&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 Thu Mar 16 09:49:31 2017
@@ -185,7 +185,7 @@ public class ImportRepositoryContentActi
private void recordNotIgnoredResources() throws CoreException {
- final ResourceChangeCommandFactory rccf = new ResourceChangeCommandFactory(serializationManager);
+ final ResourceChangeCommandFactory rccf = new ResourceChangeCommandFactory(serializationManager, Activator.getDefault().getPreferences().getIgnoredFileNamesForSync());
IResource importStartingPoint = contentSyncRootDir.findMember(repositoryImportRoot);
if (importStartingPoint == null) {