From b3bd50424b499c4ca14188b5407df231de772c61 Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 25 Nov 2020 14:27:21 +0100 Subject: [PATCH 01/35] Deleted setPossibleWords(...) This method has been deleted in FeatureIDE since this commit https://github.com/FeatureIDE/FeatureIDE/commit/b679c392ba6bd29afb47d1b8071a1b337d90e697#diff-02b7a28d524fe3c717b03a9621030e760993f27c394403d3d837e36e4c4489fa Since there is no provision of a new method, it can be deleted. fixed #48 --- .../core/view/featurecontext/FeatureContextWizardPage.java | 1 - 1 file changed, 1 deletion(-) diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizardPage.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizardPage.java index 2207802..bd60fbc 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizardPage.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizardPage.java @@ -190,7 +190,6 @@ public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { txtContext.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); if (featureContext != null) txtContext.setText(featureContext.name); txtContext.setMargins(10, 5, 3, 5); - txtContext.setPossibleWords(Functional.toSet(FeatureUtils.extractFeatureNames(features))); if (featureContext != null) txtContext.setBackground(ColorPalette.toSwtColor(featureContext.highlighter)); txtContext.addModifyListener(new ModifyListener() { From 8a41e4e901c5cddc7a014d6a948452d2c120c84f Mon Sep 17 00:00:00 2001 From: Tobias Cerny Date: Wed, 25 Nov 2020 14:53:38 +0100 Subject: [PATCH 02/35] fixed #46 --- .../variantsync/core/VariantSyncComposer.java | 19 ++++++++++++- .../managers/ConfigurationProjectManager.java | 27 +++++++++++-------- .../managers/data/ConfigurationProject.java | 8 +++--- 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java index 60822db..260a6b0 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java @@ -2,11 +2,14 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Path; +import java.util.ArrayList; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.runtime.CoreException; import de.ovgu.featureide.core.builder.ComposerExtensionClass; import de.ovgu.featureide.fm.core.configuration.Configuration; @@ -15,7 +18,8 @@ public class VariantSyncComposer extends ComposerExtensionClass { @Override - public void performFullBuild(IFile config) { + public void performFullBuild(Path config) { +// public void performFullBuild(IFile config) { VariantSyncPlugin.getConfigurationProjectManager().reinitialize(); } @@ -90,4 +94,17 @@ public void copyNotComposedFiles(Configuration config, IFolder destination) { } + @Override + public void buildPartialFeatureProjectAssets(IFolder sourceFolder, ArrayList removedFeatures, + ArrayList mandatoryFeatures) throws IOException, CoreException { + // TODO Auto-generated method stub + + } + + @Override + public boolean supportsPartialFeatureProject() { + // TODO Auto-generated method stub + return false; + } + } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java index 8130787..31eec41 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java @@ -1,5 +1,7 @@ package de.tubs.variantsync.core.managers; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -8,6 +10,7 @@ import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; import de.ovgu.featureide.core.CorePlugin; import de.ovgu.featureide.core.IFeatureProject; @@ -115,21 +118,23 @@ private List findConfigurationProjects() { } private void findVariants(ConfigurationProject configurationProject) { - for (IFile file : configurationProject.getFeatureProject().getAllConfigurations()) { - String projectName = file.getName().substring(0, file.getName().lastIndexOf(".")); + for (Path path : configurationProject.getFeatureProject().getAllConfigurations()) { + String projectName = path.getFileName().toString().substring(0, path.getFileName().toString().lastIndexOf(".")); +// for (IFile file : configurationProject.getFeatureProject().getAllConfigurations()) { +// String projectName = file.getName().substring(0, file.getName().lastIndexOf(".")); IProject project = VariantSyncPlugin.getWorkspace().getProject(projectName); if (project.exists()) { configurationProject.addVariant(project); } else { - try { - IMarker m = file.createMarker("de.tubs.variantsync.marker.error"); - m.setAttribute(IMarker.MESSAGE, "Project " + projectName + " is missing in the workspace"); - m.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING); - m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH); - m.setAttribute(IMarker.LINE_NUMBER, 0); - } catch (CoreException e) { - LogOperations.logError("Marker cannot be created!", e); - } +// try { +// IMarker m = file.createMarker("de.tubs.variantsync.marker.error"); +// m.setAttribute(IMarker.MESSAGE, "Project " + projectName + " is missing in the workspace"); +// m.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING); +// m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH); +// m.setAttribute(IMarker.LINE_NUMBER, 0); +// } catch (CoreException e) { +// LogOperations.logError("Marker cannot be created!", e); +// } } } configurationProject.getMappingManager().load(); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java index cda6888..7442b46 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java @@ -75,12 +75,14 @@ public void addVariant(IProject project) { public Configuration getConfigurationForVariant(IProject project) { if (project != null) { - for (IFile configPath : configurationProject.getAllConfigurations()) { - String configFileName = configPath.getName(); + for (Path configPath : configurationProject.getAllConfigurations()) { +// for (IFile configPath : configurationProject.getAllConfigurations()) { + String configFileName = configPath.getFileName().toString(); String configName = configFileName.substring(0, configFileName.lastIndexOf('.')); System.out.println("[ConfigurationProject.getConfigurationForVariant] Check name equality Project(" + project.getName() + ") with Config(" + configName + ")"); if (configName.equals(project.getName())) { - ConfigurationManager configurationManager = ConfigurationManager.getInstance(Paths.get(configPath.getRawLocationURI())); +// ConfigurationManager configurationManager = ConfigurationManager.getInstance(Paths.get(configPath.getRawLocationURI())); + ConfigurationManager configurationManager = ConfigurationManager.getInstance(configPath); if (configurationManager != null) return configurationManager.getObject(); } } From 6a02b88ce3b9f36304ab7794fcaffadd3ed0a64c Mon Sep 17 00:00:00 2001 From: jeremiaheinle Date: Wed, 25 Nov 2020 15:11:48 +0100 Subject: [PATCH 03/35] bugfix issue-47 --- .../core/managers/persistence/CodeMappingFormat.java | 3 ++- .../core/managers/persistence/FeatureContextFormat.java | 4 ++-- .../core/managers/persistence/PatchFormat.java | 3 ++- .../tubs/variantsync/core/patch/DeltaFactoryManager.java | 9 +++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/CodeMappingFormat.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/CodeMappingFormat.java index 4b84212..a46ae90 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/CodeMappingFormat.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/CodeMappingFormat.java @@ -9,6 +9,7 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; +import de.ovgu.featureide.fm.core.io.APersistentFormat; import de.ovgu.featureide.fm.core.io.IPersistentFormat; import de.ovgu.featureide.fm.core.io.Problem; import de.ovgu.featureide.fm.core.io.UnsupportedModelException; @@ -35,7 +36,7 @@ public CodeMappingFormat(IProject project) { } @Override - public IPersistentFormat> getInstance() { + public APersistentFormat> getInstance() { return new CodeMappingFormat(null); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/FeatureContextFormat.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/FeatureContextFormat.java index f9ed654..878d512 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/FeatureContextFormat.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/FeatureContextFormat.java @@ -7,7 +7,7 @@ import org.w3c.dom.Element; import de.ovgu.featureide.fm.core.color.FeatureColor; -import de.ovgu.featureide.fm.core.io.IPersistentFormat; +import de.ovgu.featureide.fm.core.io.APersistentFormat; import de.ovgu.featureide.fm.core.io.Problem; import de.ovgu.featureide.fm.core.io.UnsupportedModelException; import de.ovgu.featureide.fm.core.io.xml.AXMLFormat; @@ -23,7 +23,7 @@ public class FeatureContextFormat extends AXMLFormat> { public static final String FILENAME = ".contexts.xml"; @Override - public IPersistentFormat> getInstance() { + public APersistentFormat> getInstance() { return new FeatureContextFormat(); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/PatchFormat.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/PatchFormat.java index 560fe9a..881d45a 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/PatchFormat.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/PatchFormat.java @@ -13,6 +13,7 @@ import de.ovgu.featureide.core.IFeatureProject; import de.ovgu.featureide.fm.core.ExtensionManager.NoSuchExtensionException; +import de.ovgu.featureide.fm.core.io.APersistentFormat; import de.ovgu.featureide.fm.core.io.IPersistentFormat; import de.ovgu.featureide.fm.core.io.Problem; import de.ovgu.featureide.fm.core.io.UnsupportedModelException; @@ -44,7 +45,7 @@ public PatchFormat(IFeatureProject project) { @Override - public IPersistentFormat>> getInstance() { + public APersistentFormat>> getInstance() { return new PatchFormat(null); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java index fdc2064..9e6de06 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java @@ -2,7 +2,8 @@ import org.eclipse.core.resources.IFile; -import de.ovgu.featureide.fm.core.CoreExtensionLoader; +//import de.ovgu.featureide.fm.core.CoreExtensionLoader; +import de.ovgu.featureide.fm.core.EclipseExtensionLoader; import de.ovgu.featureide.fm.core.ExtensionManager; import de.ovgu.featureide.fm.core.IExtensionLoader; import de.tubs.variantsync.core.patch.base.DefaultDeltaFactory; @@ -15,8 +16,8 @@ public class DeltaFactoryManager extends ExtensionManager { public DeltaFactoryManager() { IDeltaFactory[] y = new IDeltaFactory[]{getDefaultFactory()}; - IExtensionLoader x = new CoreExtensionLoader(y); - setExtensionLoaderInternal(x); + //IExtensionLoader x = new EclipseExtensionLoader(y); + //setExtensionLoader(x); addExtension(getDefaultFactory()); } @@ -25,7 +26,7 @@ public static DeltaFactoryManager getInstance() { } public static void setExtensionLoader(IExtensionLoader extensionLoader) { - instance.setExtensionLoaderInternal(extensionLoader); + instance.setExtensionLoader(extensionLoader); } /** From 826b307853114ee5be4e0b5ebffc89c5be4f4165 Mon Sep 17 00:00:00 2001 From: Tobias Cerny Date: Thu, 26 Nov 2020 13:34:09 +0100 Subject: [PATCH 04/35] added missing method initExtension() --- .../variantsync/core/patch/base/DefaultDeltaFactory.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java index 40d2587..6c0157d 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java @@ -324,6 +324,12 @@ public IMarkerHandler getMarkerHandler() { return new DefaultMarkerHandler(); } + @Override + public boolean initExtension() { + // TODO Auto-generated method stub + return false; + } + /* @Override public boolean initExtension() { From 250a2ca440489dc75288679c731d1d85bdbb8921 Mon Sep 17 00:00:00 2001 From: jeremiaheinle Date: Thu, 26 Nov 2020 15:31:51 +0100 Subject: [PATCH 05/35] DeltaFactoryManager update --- .../core/patch/DeltaFactoryManager.java | 31 +++++++++++++++++-- .../core/patch/base/DefaultDeltaFactory.java | 5 --- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java index 9e6de06..36bc765 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java @@ -1,11 +1,16 @@ package de.tubs.variantsync.core.patch; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + import org.eclipse.core.resources.IFile; //import de.ovgu.featureide.fm.core.CoreExtensionLoader; import de.ovgu.featureide.fm.core.EclipseExtensionLoader; import de.ovgu.featureide.fm.core.ExtensionManager; import de.ovgu.featureide.fm.core.IExtensionLoader; +import de.tubs.variantsync.core.VariantSyncPlugin; import de.tubs.variantsync.core.patch.base.DefaultDeltaFactory; import de.tubs.variantsync.core.patch.interfaces.IDeltaFactory; @@ -14,10 +19,13 @@ public class DeltaFactoryManager extends ExtensionManager { private static DeltaFactoryManager instance = new DeltaFactoryManager(); + private IExtensionLoader extensionLoader; + private final List extensions = new ArrayList<>(); + public DeltaFactoryManager() { IDeltaFactory[] y = new IDeltaFactory[]{getDefaultFactory()}; - //IExtensionLoader x = new EclipseExtensionLoader(y); - //setExtensionLoader(x); + IExtensionLoader x = new EclipseExtensionLoader(VariantSyncPlugin.PLUGIN_ID, IDeltaFactory.extensionPointID, IDeltaFactory.extensionID, IDeltaFactory.class); + setExtensionLoaderInternal(x); addExtension(getDefaultFactory()); } @@ -26,7 +34,7 @@ public static DeltaFactoryManager getInstance() { } public static void setExtensionLoader(IExtensionLoader extensionLoader) { - instance.setExtensionLoader(extensionLoader); + instance.setExtensionLoaderInternal(extensionLoader); } /** @@ -64,5 +72,22 @@ public IDeltaFactory getFactoryByFile(IFile file) throws NoSuchExtensionExceptio public static IDeltaFactory getDefaultFactory() { return DefaultDeltaFactory.getInstance(); } + + @Override + public synchronized List getExtensions() { + if (extensionLoader != null) { + synchronized (extensions) { + if (extensionLoader != null) { + extensionLoader.loadProviders(this); + extensionLoader = null; + } + } + } + return Collections.unmodifiableList(extensions); + } + + protected void setExtensionLoaderInternal(IExtensionLoader extensionLoader) { + this.extensionLoader = extensionLoader; + } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java index 6c0157d..4191db3 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java @@ -324,11 +324,6 @@ public IMarkerHandler getMarkerHandler() { return new DefaultMarkerHandler(); } - @Override - public boolean initExtension() { - // TODO Auto-generated method stub - return false; - } /* @Override From ef529c5b891ff9db543f69c9ccf7513bf2f1fa94 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 1 Dec 2020 16:29:13 +0100 Subject: [PATCH 06/35] updated travis and pom --- .travis.yml | 25 ++-- pom.xml | 400 ++++++++++++++++++++++++++-------------------------- 2 files changed, 210 insertions(+), 215 deletions(-) diff --git a/.travis.yml b/.travis.yml index c84b15b..4eb5b41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,11 @@ -sudo: false -language: java -dist: trusty -jdk: oraclejdk8 -cache: - directories: - - "$HOME/.m2" -install: true -script: -- mvn clean verify -- sed -i'' -e "s/\$VERSION/${TRAVIS_TAG:=0.0.0}/" descriptor.json -- sed -i'' -e "s/\$DATE/$(date +%Y-%m-%d)/" descriptor.json -notifications: - webhooks: https://fathomless-fjord-24024.herokuapp.com/notify +language: java +dist: bionic +jdk: oraclejdk8 +cache: + directories: + - "$HOME/.m2" +install: true +script: +- mvn clean verify +notifications: + webhooks: https://fathomless-fjord-24024.herokuapp.com/notify diff --git a/pom.xml b/pom.xml index c508173..174340a 100644 --- a/pom.xml +++ b/pom.xml @@ -1,211 +1,209 @@ - 4.0.0 - de.tubs.variantsync - de.tubs.variantsync - 0.0.3-SNAPSHOT - pom + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + de.tubs.variantsync + de.tubs.variantsync + 0.0.3-SNAPSHOT + pom - - 1.0.0 - 1.0.0 - UTF-8 - 1.8 - 1.8 - - + + 1.1.0 + 1.0.0 + UTF-8 + 1.8 + 1.8 + http://download.eclipse.org/releases/oxygen + + - - de.tubs.variantsync.core - de.tubs.variantsync.core.feature - de.tubs.variantsync.update - + + de.tubs.variantsync.core + de.tubs.variantsync.core.feature + de.tubs.variantsync.update + - - - - org.eclipse.tycho - tycho-maven-plugin - ${tycho-version} - true - + + + eclipse-release + ${eclipse-repo.url} + p2 + + + featureide + http://featureide.cs.ovgu.de/update/v3/ + p2 + + - - org.eclipse.tycho - target-platform-configuration - ${tycho-version} - - consider - - - win32 - win32 - x86 - - - linux - gtk - x86_64 - - - macosx - cocoa - x86_64 - - - - + + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho-version} + true + - - org.eclipse.tycho - tycho-packaging-plugin - ${tycho-version} - - - org.eclipse.tycho.extras - tycho-buildtimestamp-jgit - ${tycho-extras-version} - - - - jgit - - pom.xml - - ignore - - + + org.eclipse.tycho + target-platform-configuration + ${tycho-version} + + consider + + + win32 + win32 + x86 + + + linux + gtk + x86_64 + + + macosx + cocoa + x86_64 + + + + - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - - org.apache.maven.plugins - - - maven-resources-plugin - - - [2.4.3,) - - - resources - testResources - - - - - - - - - - org.eclipse.tycho - - - tycho-compiler-plugin - - - [0.23.1,) - - - compile - - - - - - - - - - org.eclipse.tycho - - - tycho-packaging-plugin - - - [0.23.1,) - - - build-qualifier - build-qualifier-aggregator - validate-id - validate-version - - - - - - - - - - - - - + + org.eclipse.tycho + tycho-packaging-plugin + ${tycho-version} + + + org.eclipse.tycho.extras + tycho-buildtimestamp-jgit + ${tycho-extras-version} + + + + jgit + + pom.xml + + ignore + + - - - oxygen - http://download.eclipse.org/releases/oxygen - p2 - - - featureide - - http://featureide.cs.ovgu.de/update/v3/ - p2 - - - - - + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + + org.apache.maven.plugins + + + maven-resources-plugin + + + [2.4.3,) + + + resources + testResources + + + + + + + + + + org.eclipse.tycho + + + tycho-compiler-plugin + + + [0.23.1,) + + + compile + + + + + + + + + + org.eclipse.tycho + + + tycho-packaging-plugin + + + [0.23.1,) + + + build-qualifier + build-qualifier-aggregator + validate-id + validate-version + + + + + + + + + + + + + \ No newline at end of file From c92109dcc760ae66381323403d9f9a627a3a63b7 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 1 Dec 2020 16:46:41 +0100 Subject: [PATCH 07/35] forgotten commit in issue-45 --- .../tubs/variantsync/core/patch/base/DefaultDeltaFactory.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java index 4191db3..581e402 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java @@ -325,10 +325,9 @@ public IMarkerHandler getMarkerHandler() { } - /* @Override public boolean initExtension() { return true; - }**/ + } } From 32487de20da8c4b430df553743b31004641a8c51 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 1 Dec 2020 17:15:16 +0100 Subject: [PATCH 08/35] Tests do not trigger has been fixed --- .../META-INF/MANIFEST.MF | 16 ++++----- de.tubs.variantsync.core-test/pom.xml | 15 ++++++++ de.tubs.variantsync.core/.idea/.gitignore | 8 +++++ de.tubs.variantsync.core/.idea/misc.xml | 6 ++++ de.tubs.variantsync.core/.idea/modules.xml | 8 +++++ de.tubs.variantsync.core/.idea/vcs.xml | 6 ++++ .../de.tubs.variantsync.core.iml | 34 +++++++++++++++++++ pom.xml | 33 ++++++++++++++++-- 8 files changed, 115 insertions(+), 11 deletions(-) create mode 100644 de.tubs.variantsync.core-test/pom.xml create mode 100644 de.tubs.variantsync.core/.idea/.gitignore create mode 100644 de.tubs.variantsync.core/.idea/misc.xml create mode 100644 de.tubs.variantsync.core/.idea/modules.xml create mode 100644 de.tubs.variantsync.core/.idea/vcs.xml create mode 100644 de.tubs.variantsync.core/de.tubs.variantsync.core.iml diff --git a/de.tubs.variantsync.core-test/META-INF/MANIFEST.MF b/de.tubs.variantsync.core-test/META-INF/MANIFEST.MF index 4fd9f8b..a44f9c9 100644 --- a/de.tubs.variantsync.core-test/META-INF/MANIFEST.MF +++ b/de.tubs.variantsync.core-test/META-INF/MANIFEST.MF @@ -1,8 +1,8 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Core-test -Bundle-SymbolicName: de.tubs.variantsync.core-test -Bundle-Version: 1.0.0.qualifier -Bundle-Vendor: TU Braunschweig -Fragment-Host: de.tubs.variantsync.core;bundle-version="0.0.1" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Core-test +Bundle-SymbolicName: de.tubs.variantsync.core-test +Bundle-Version: 0.0.3.qualifier +Bundle-Vendor: TU Braunschweig +Fragment-Host: de.tubs.variantsync.core;bundle-version="0.0.1" +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/de.tubs.variantsync.core-test/pom.xml b/de.tubs.variantsync.core-test/pom.xml new file mode 100644 index 0000000..10e8310 --- /dev/null +++ b/de.tubs.variantsync.core-test/pom.xml @@ -0,0 +1,15 @@ + + 4.0.0 + + + de.tubs.variantsync + de.tubs.variantsync + 0.0.3-SNAPSHOT + + + de.tubs.variantsync.core-test + eclipse-test-plugin + + de.tubs.variantsync.core + \ No newline at end of file diff --git a/de.tubs.variantsync.core/.idea/.gitignore b/de.tubs.variantsync.core/.idea/.gitignore new file mode 100644 index 0000000..73f69e0 --- /dev/null +++ b/de.tubs.variantsync.core/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/de.tubs.variantsync.core/.idea/misc.xml b/de.tubs.variantsync.core/.idea/misc.xml new file mode 100644 index 0000000..cefb937 --- /dev/null +++ b/de.tubs.variantsync.core/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/de.tubs.variantsync.core/.idea/modules.xml b/de.tubs.variantsync.core/.idea/modules.xml new file mode 100644 index 0000000..7aa072b --- /dev/null +++ b/de.tubs.variantsync.core/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/de.tubs.variantsync.core/.idea/vcs.xml b/de.tubs.variantsync.core/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/de.tubs.variantsync.core/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/de.tubs.variantsync.core/de.tubs.variantsync.core.iml b/de.tubs.variantsync.core/de.tubs.variantsync.core.iml new file mode 100644 index 0000000..653a069 --- /dev/null +++ b/de.tubs.variantsync.core/de.tubs.variantsync.core.iml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 174340a..689ca24 100644 --- a/pom.xml +++ b/pom.xml @@ -18,9 +18,13 @@ + de.tubs.variantsync.core de.tubs.variantsync.core.feature - de.tubs.variantsync.update + de.tubs.variantsync.update + + + de.tubs.variantsync.core-test @@ -38,6 +42,16 @@ + + + org.eclipse.tycho @@ -45,7 +59,16 @@ ${tycho-version} true - + + org.eclipse.tycho + tycho-surefire-plugin + ${tycho-version} + + true + + SYSTEM + + org.eclipse.tycho target-platform-configuration @@ -71,7 +94,6 @@ - org.eclipse.tycho tycho-packaging-plugin @@ -112,6 +134,11 @@ + + org.eclipse.tycho + tycho-p2-director-plugin + ${tycho.version} + org.eclipse.m2e lifecycle-mapping From 764be5afb074284ec7c8931ddb1bdf378c3854fc Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 1 Dec 2020 17:18:30 +0100 Subject: [PATCH 09/35] this branch fixed #42 --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 689ca24..c458f5f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,6 @@ 0.0.3-SNAPSHOT pom - 1.1.0 1.0.0 From 1d642143b9cf37bb3fda815bf7b98b7a77738458 Mon Sep 17 00:00:00 2001 From: jeremiaheinle Date: Thu, 3 Dec 2020 14:17:23 +0100 Subject: [PATCH 10/35] Issue initExtension & DeltaFactoryManager --- .../core/patch/DeltaFactoryManager.java | 44 ++++++++++++++++--- .../core/patch/base/DefaultDeltaFactory.java | 4 +- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java index 36bc765..03ffecc 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java @@ -10,6 +10,7 @@ import de.ovgu.featureide.fm.core.EclipseExtensionLoader; import de.ovgu.featureide.fm.core.ExtensionManager; import de.ovgu.featureide.fm.core.IExtensionLoader; +import de.ovgu.featureide.fm.core.ExtensionManager.NoSuchExtensionException; import de.tubs.variantsync.core.VariantSyncPlugin; import de.tubs.variantsync.core.patch.base.DefaultDeltaFactory; import de.tubs.variantsync.core.patch.interfaces.IDeltaFactory; @@ -76,12 +77,12 @@ public static IDeltaFactory getDefaultFactory() { @Override public synchronized List getExtensions() { if (extensionLoader != null) { - synchronized (extensions) { - if (extensionLoader != null) { - extensionLoader.loadProviders(this); - extensionLoader = null; - } - } + synchronized (extensions) { + if (extensionLoader != null) { + extensionLoader.loadProviders(this); + extensionLoader = null; + } + } } return Collections.unmodifiableList(extensions); } @@ -89,5 +90,36 @@ public synchronized List getExtensions() { protected void setExtensionLoaderInternal(IExtensionLoader extensionLoader) { this.extensionLoader = extensionLoader; } + + + + @Override + public synchronized boolean addExtension(IDeltaFactory extension) { + if (extension != null) { + for (final IDeltaFactory t : extensions) { + if (t.getId().equals(extension.getId())) { + return false; + } + } + if (extension.initExtension()) { + extensions.add(extension); + return true; + } + } + return false; +} + + + @Override + public IDeltaFactory getExtension(String id) throws NoSuchExtensionException { + java.util.Objects.requireNonNull(id, "ID must not be null!"); + + for (final IDeltaFactory extension : getExtensions()) { + if (id.equals(extension.getId())) { + return extension; + } + } + throw new NoSuchExtensionException("No extension found for ID " + id); +} } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java index 4191db3..d8b8462 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java @@ -325,10 +325,10 @@ public IMarkerHandler getMarkerHandler() { } - /* + @Override public boolean initExtension() { return true; - }**/ + } } From 4471f5c04b695f67b853ced1699082f9e7e3d648 Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 4 Dec 2020 09:59:43 +0100 Subject: [PATCH 11/35] updated travis services to run with bionic and increased tycho version in pom --- .travis.yml | 14 +++++++++----- pom.xml | 14 ++++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4eb5b41..c48987d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,15 @@ -language: java dist: bionic -jdk: oraclejdk8 + +language: java +#jdk: openjdk8 + +#-----start GUI testing stuff +services: + - xvfb +#-----end GUI testin stuff cache: directories: - "$HOME/.m2" install: true script: -- mvn clean verify -notifications: - webhooks: https://fathomless-fjord-24024.herokuapp.com/notify + - mvn clean verify -e diff --git a/pom.xml b/pom.xml index c458f5f..d6a58cd 100644 --- a/pom.xml +++ b/pom.xml @@ -6,13 +6,19 @@ 0.0.3-SNAPSHOT pom + + + org.eclipse.swt.org.eclipse.swt.win32.win32.x86_64.4.3.swt + org.eclipse.swt.win32.win32.x86_64 + 4.3 + + + - 1.1.0 + 2.1.0 1.0.0 UTF-8 - 1.8 - 1.8 - http://download.eclipse.org/releases/oxygen + https://download.eclipse.org/releases/2020-09/ From bfb65e7223fbcfc8e5697aed77e5b6c253ae548a Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 4 Dec 2020 10:47:59 +0100 Subject: [PATCH 12/35] deleted unnecessary depdency --- pom.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pom.xml b/pom.xml index d6a58cd..55ca479 100644 --- a/pom.xml +++ b/pom.xml @@ -6,14 +6,6 @@ 0.0.3-SNAPSHOT pom - - - org.eclipse.swt.org.eclipse.swt.win32.win32.x86_64.4.3.swt - org.eclipse.swt.win32.win32.x86_64 - 4.3 - - - 2.1.0 1.0.0 From 75ee471919cb7d11c7ea57e33234d345226978cb Mon Sep 17 00:00:00 2001 From: Tobias Cerny Date: Fri, 4 Dec 2020 15:45:44 +0100 Subject: [PATCH 13/35] Casted Path to IFile in order to keep the old code. --- .../managers/ConfigurationProjectManager.java | 24 +++++++++---------- .../managers/data/ConfigurationProject.java | 12 +++++----- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java index 31eec41..39010f2 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java @@ -17,6 +17,7 @@ import de.ovgu.featureide.fm.core.base.IFeature; import de.ovgu.featureide.fm.core.base.IFeatureModel; import de.ovgu.featureide.fm.core.base.event.FeatureIDEEvent; +import de.ovgu.featureide.fm.core.io.EclipseFileSystem; import de.tubs.variantsync.core.VariantSyncPlugin; import de.tubs.variantsync.core.managers.data.ConfigurationProject; import de.tubs.variantsync.core.utilities.LogOperations; @@ -119,22 +120,21 @@ private List findConfigurationProjects() { private void findVariants(ConfigurationProject configurationProject) { for (Path path : configurationProject.getFeatureProject().getAllConfigurations()) { - String projectName = path.getFileName().toString().substring(0, path.getFileName().toString().lastIndexOf(".")); -// for (IFile file : configurationProject.getFeatureProject().getAllConfigurations()) { -// String projectName = file.getName().substring(0, file.getName().lastIndexOf(".")); + IFile file = (IFile) EclipseFileSystem.getResource(path); + String projectName = file.getName().substring(0, file.getName().lastIndexOf(".")); IProject project = VariantSyncPlugin.getWorkspace().getProject(projectName); if (project.exists()) { configurationProject.addVariant(project); } else { -// try { -// IMarker m = file.createMarker("de.tubs.variantsync.marker.error"); -// m.setAttribute(IMarker.MESSAGE, "Project " + projectName + " is missing in the workspace"); -// m.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING); -// m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH); -// m.setAttribute(IMarker.LINE_NUMBER, 0); -// } catch (CoreException e) { -// LogOperations.logError("Marker cannot be created!", e); -// } + try { + IMarker m = file.createMarker("de.tubs.variantsync.marker.error"); + m.setAttribute(IMarker.MESSAGE, "Project " + projectName + " is missing in the workspace"); + m.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING); + m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH); + m.setAttribute(IMarker.LINE_NUMBER, 0); + } catch (CoreException e) { + LogOperations.logError("Marker cannot be created!", e); + } } } configurationProject.getMappingManager().load(); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java index 7442b46..2362346 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java @@ -11,6 +11,7 @@ import de.ovgu.featureide.core.IFeatureProject; import de.ovgu.featureide.fm.core.base.IFeature; import de.ovgu.featureide.fm.core.configuration.Configuration; +import de.ovgu.featureide.fm.core.io.EclipseFileSystem; import de.ovgu.featureide.fm.core.io.manager.ConfigurationManager; import de.tubs.variantsync.core.managers.AManager; import de.tubs.variantsync.core.managers.FeatureContextManager; @@ -75,15 +76,14 @@ public void addVariant(IProject project) { public Configuration getConfigurationForVariant(IProject project) { if (project != null) { - for (Path configPath : configurationProject.getAllConfigurations()) { -// for (IFile configPath : configurationProject.getAllConfigurations()) { - String configFileName = configPath.getFileName().toString(); + for (Path confPath : configurationProject.getAllConfigurations()) { + IFile configPath = (IFile) EclipseFileSystem.getResource(confPath); + String configFileName = configPath.getName(); String configName = configFileName.substring(0, configFileName.lastIndexOf('.')); System.out.println("[ConfigurationProject.getConfigurationForVariant] Check name equality Project(" + project.getName() + ") with Config(" + configName + ")"); if (configName.equals(project.getName())) { -// ConfigurationManager configurationManager = ConfigurationManager.getInstance(Paths.get(configPath.getRawLocationURI())); - ConfigurationManager configurationManager = ConfigurationManager.getInstance(configPath); - if (configurationManager != null) return configurationManager.getObject(); + ConfigurationManager configurationManager = ConfigurationManager.getInstance(Paths.get(configPath.getRawLocationURI())); + if (configurationManager != null) return configurationManager.getObject(); } } } From 08c1b7894afb4dfe835153a946b8ee9b2d7eaa5e Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 4 Dec 2020 20:25:45 +0100 Subject: [PATCH 14/35] Update .travis.yml --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c48987d..86dff67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,10 @@ dist: bionic language: java -#jdk: openjdk8 +jdk: + - oraclejdk11 + - openjdk10 + - openjdk11 #-----start GUI testing stuff services: From 9c7c2a34d5a00b2b3369a674ebd402aece1d6f47 Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 5 Dec 2020 11:04:49 +0100 Subject: [PATCH 15/35] win32 x86 no longer supported --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 55ca479..c79eefc 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ win32 win32 - x86 + x86_64 linux @@ -230,4 +230,4 @@ - \ No newline at end of file + From 9464e202e89c602d80618f553ba5a791052f2753 Mon Sep 17 00:00:00 2001 From: eric Date: Sun, 6 Dec 2020 11:37:07 +0100 Subject: [PATCH 16/35] works on my machine with tests and java >= 11 --- de.tubs.variantsync.core-test/META-INF/MANIFEST.MF | 1 + .../tubs/variantsync/patch/base/DiffUtilsTest.java | 3 ++- pom.xml | 13 ++----------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/de.tubs.variantsync.core-test/META-INF/MANIFEST.MF b/de.tubs.variantsync.core-test/META-INF/MANIFEST.MF index a44f9c9..cfe6828 100644 --- a/de.tubs.variantsync.core-test/META-INF/MANIFEST.MF +++ b/de.tubs.variantsync.core-test/META-INF/MANIFEST.MF @@ -6,3 +6,4 @@ Bundle-Version: 0.0.3.qualifier Bundle-Vendor: TU Braunschweig Fragment-Host: de.tubs.variantsync.core;bundle-version="0.0.1" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: javax.annotation;bundle-version="1.0.0" diff --git a/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java b/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java index c7ef77a..45a875e 100644 --- a/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java +++ b/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java @@ -54,6 +54,7 @@ public void setUp() throws Exception { public void testPatch1() throws DiffException { Patch patch = DiffUtils.diff(lines1, lines3, 1); assertTrue(patch.getDeltas().size() == 3); + } @Test @@ -62,4 +63,4 @@ public void testPatch2() throws DiffException { assertTrue(patch.getDeltas().size() == 1); } -} +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index c79eefc..0893581 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ 2.1.0 - 1.0.0 + 2.1.0 UTF-8 https://download.eclipse.org/releases/2020-09/ @@ -39,16 +39,6 @@ - - - org.eclipse.tycho @@ -71,6 +61,7 @@ target-platform-configuration ${tycho-version} + consider From 30f3c254170623278972b8fbceadb04987f3da3f Mon Sep 17 00:00:00 2001 From: Tobias Cerny <73832687+tcerny@users.noreply.github.com> Date: Tue, 8 Dec 2020 17:16:53 +0100 Subject: [PATCH 17/35] Update .gitignore --- .gitignore | 224 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 222 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 71a59e6..24a176e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,225 @@ + + +# Created by https://www.toptal.com/developers/gitignore/api/java,maven,intellij,visualstudiocode,eclipse +# Edit at https://www.toptal.com/developers/gitignore?templates=java,maven,intellij,visualstudiocode,eclipse + +### Eclipse ### +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders +.classpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ +.apt_generated_test/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +# Uncomment this line if you wish to ignore the project description file. +# Typically, this file would be tracked if it contains build/dependency configurations: +#.project + +### Eclipse Patch ### +# Spring Boot Tooling +.sts4-cache/ + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + +### Java ### +# Compiled class file *.class +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Maven ### target/ -bin/ -/.metadata/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# https://github.com/takari/maven-wrapper#usage-without-binary-jar +.mvn/wrapper/maven-wrapper.jar + +### VisualStudioCode ### +.vscode/* +!.vscode/tasks.json +!.vscode/launch.json +*.code-workspace + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# End of https://www.toptal.com/developers/gitignore/api/java,maven,intellij,visualstudiocode,eclipse From 003f7beb7437c49ac239d4a2accec20ede912fff Mon Sep 17 00:00:00 2001 From: jeremiaheinle Date: Tue, 8 Dec 2020 17:19:56 +0100 Subject: [PATCH 18/35] del .idea --- de.tubs.variantsync.core/.idea/.gitignore | 8 -------- de.tubs.variantsync.core/.idea/misc.xml | 6 ------ de.tubs.variantsync.core/.idea/modules.xml | 8 -------- de.tubs.variantsync.core/.idea/vcs.xml | 6 ------ 4 files changed, 28 deletions(-) delete mode 100644 de.tubs.variantsync.core/.idea/.gitignore delete mode 100644 de.tubs.variantsync.core/.idea/misc.xml delete mode 100644 de.tubs.variantsync.core/.idea/modules.xml delete mode 100644 de.tubs.variantsync.core/.idea/vcs.xml diff --git a/de.tubs.variantsync.core/.idea/.gitignore b/de.tubs.variantsync.core/.idea/.gitignore deleted file mode 100644 index 73f69e0..0000000 --- a/de.tubs.variantsync.core/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml -# Editor-based HTTP Client requests -/httpRequests/ diff --git a/de.tubs.variantsync.core/.idea/misc.xml b/de.tubs.variantsync.core/.idea/misc.xml deleted file mode 100644 index cefb937..0000000 --- a/de.tubs.variantsync.core/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/de.tubs.variantsync.core/.idea/modules.xml b/de.tubs.variantsync.core/.idea/modules.xml deleted file mode 100644 index 7aa072b..0000000 --- a/de.tubs.variantsync.core/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/de.tubs.variantsync.core/.idea/vcs.xml b/de.tubs.variantsync.core/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/de.tubs.variantsync.core/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 2c59bb0759dc4a17db4824d9f538e7bde5507b2c Mon Sep 17 00:00:00 2001 From: Tobias Cerny <73832687+tcerny@users.noreply.github.com> Date: Wed, 9 Dec 2020 18:13:10 +0100 Subject: [PATCH 19/35] Update .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 24a176e..7ed634f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ local.properties .settings/ .loadpath .recommenders -.classpath # External tool builders .externalToolBuilders/ From cbfe2a3cf2b3b665254c6ab6d6b802179d5c2fde Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 10 Dec 2020 15:47:00 +0100 Subject: [PATCH 20/35] adressed: Pauls review: remove openjdk10 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 86dff67..3009122 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ dist: bionic language: java jdk: - oraclejdk11 - - openjdk10 - openjdk11 #-----start GUI testing stuff From 02b4399e94925cbea7ba19cd021e9e846522bc85 Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 10 Dec 2020 15:49:05 +0100 Subject: [PATCH 21/35] adressed Pauls review: remove empy line --- .../test/de/tubs/variantsync/patch/base/DiffUtilsTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java b/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java index 45a875e..4160c92 100644 --- a/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java +++ b/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java @@ -54,7 +54,6 @@ public void setUp() throws Exception { public void testPatch1() throws DiffException { Patch patch = DiffUtils.diff(lines1, lines3, 1); assertTrue(patch.getDeltas().size() == 3); - } @Test From ae949ba945a915ec9d66cabaed5f9dfb6c687185 Mon Sep 17 00:00:00 2001 From: Tobias Cerny Date: Wed, 23 Dec 2020 15:04:21 +0100 Subject: [PATCH 22/35] update .gitignore --- .gitignore | 3 +- .../de.tubs.variantsync.core.iml | 34 ------------------- 2 files changed, 2 insertions(+), 35 deletions(-) delete mode 100644 de.tubs.variantsync.core/de.tubs.variantsync.core.iml diff --git a/.gitignore b/.gitignore index 7ed634f..e92a655 100644 --- a/.gitignore +++ b/.gitignore @@ -106,7 +106,8 @@ local.properties # .idea/modules.xml # .idea/*.iml # .idea/modules -# *.iml +*.iml +.idea/ # *.ipr # CMake diff --git a/de.tubs.variantsync.core/de.tubs.variantsync.core.iml b/de.tubs.variantsync.core/de.tubs.variantsync.core.iml deleted file mode 100644 index 653a069..0000000 --- a/de.tubs.variantsync.core/de.tubs.variantsync.core.iml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 7785e272c4b2154a4f45039ea14466ac303f4c7e Mon Sep 17 00:00:00 2001 From: Tobias Cerny Date: Wed, 23 Dec 2020 15:22:39 +0100 Subject: [PATCH 23/35] addressed Tobi's review - removed quoted lines in VariantSyncComposer.java - added optional brackets in ConfigurationProject.java --- .../variantsync/core/VariantSyncComposer.java | 56 ++++++------------- .../managers/data/ConfigurationProject.java | 20 +++---- 2 files changed, 28 insertions(+), 48 deletions(-) diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java index 260a6b0..71119e0 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java @@ -17,93 +17,73 @@ public class VariantSyncComposer extends ComposerExtensionClass { - @Override - public void performFullBuild(Path config) { -// public void performFullBuild(IFile config) { + @Override public void performFullBuild(Path config) { VariantSyncPlugin.getConfigurationProjectManager().reinitialize(); } - @Override - public void addCompiler(IProject project, String sourcePath, String configPath, String buildPath) { + @Override public void addCompiler(IProject project, String sourcePath, String configPath, String buildPath) { File featureContextFile = new File(project.getFile(FeatureContextFormat.FILENAME).getLocationURI()); try { featureContextFile.createNewFile(); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } - @Override - public boolean hasSourceFolder() { + @Override public boolean hasSourceFolder() { return false; } - @Override - public boolean hasFeatureFolder() { + @Override public boolean hasFeatureFolder() { return false; } - @Override - public boolean hasBuildFolder() { + @Override public boolean hasBuildFolder() { return false; } - @Override - public boolean createFolderForFeatures() { + @Override public boolean createFolderForFeatures() { return false; } - @Override - public boolean showContextFieldsAndMethods() { + @Override public boolean showContextFieldsAndMethods() { return false; } - @Override - public boolean hasMetaProductGeneration() { + @Override public boolean hasMetaProductGeneration() { return false; } - @Override - public Mechanism getGenerationMechanism() { + @Override public Mechanism getGenerationMechanism() { return null; } - @Override - public boolean supportsAndroid() { + @Override public boolean supportsAndroid() { return false; } - @Override - public boolean supportsMigration() { + @Override public boolean supportsMigration() { return false; } - @Override - public boolean clean() { + @Override public boolean clean() { return false; } - @Override - public void postCompile(IResourceDelta delta, IFile buildFile) { + @Override public void postCompile(IResourceDelta delta, IFile buildFile) { } - @Override - public void copyNotComposedFiles(Configuration config, IFolder destination) { + @Override public void copyNotComposedFiles(Configuration config, IFolder destination) { } - @Override - public void buildPartialFeatureProjectAssets(IFolder sourceFolder, ArrayList removedFeatures, - ArrayList mandatoryFeatures) throws IOException, CoreException { - // TODO Auto-generated method stub - + @Override public void buildPartialFeatureProjectAssets(IFolder sourceFolder, ArrayList removedFeatures, ArrayList mandatoryFeatures) + throws IOException, CoreException { + } - @Override - public boolean supportsPartialFeatureProject() { - // TODO Auto-generated method stub + @Override public boolean supportsPartialFeatureProject() { return false; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java index 2362346..e9c4319 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java @@ -22,9 +22,8 @@ import de.tubs.variantsync.core.utilities.event.VariantSyncEvent.EventType; /** - * * A class for managing all informations about the product line for one configuration project - * + * * @author Christopher Sontag * @since 1.1 */ @@ -80,10 +79,14 @@ public Configuration getConfigurationForVariant(IProject project) { IFile configPath = (IFile) EclipseFileSystem.getResource(confPath); String configFileName = configPath.getName(); String configName = configFileName.substring(0, configFileName.lastIndexOf('.')); - System.out.println("[ConfigurationProject.getConfigurationForVariant] Check name equality Project(" + project.getName() + ") with Config(" + configName + ")"); + System.out.println( + "[ConfigurationProject.getConfigurationForVariant] Check name equality Project(" + project.getName() + ") with Config(" + configName + + ")"); if (configName.equals(project.getName())) { ConfigurationManager configurationManager = ConfigurationManager.getInstance(Paths.get(configPath.getRawLocationURI())); - if (configurationManager != null) return configurationManager.getObject(); + if (configurationManager != null) { + return configurationManager.getObject(); + } } } } @@ -94,8 +97,7 @@ public Iterable getFeatures() { return configurationProject.getFeatureModel().getFeatures(); } - @Override - public void reset() { + @Override public void reset() { projects.clear(); } @@ -111,15 +113,13 @@ public PatchesManager getPatchesManager() { return patchesManager; } - @Override - public void save() { + @Override public void save() { featureContextManager.save(); mappingManager.save(); patchesManager.save(); } - @Override - public void load() { + @Override public void load() { featureContextManager.load(); mappingManager.load(); patchesManager.load(); From 0c9ddd74520a8f62a8e68941a402d6dd2271f012 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 24 Dec 2020 10:49:08 +0100 Subject: [PATCH 24/35] adressed Tobis review added openjdk8 to reproduce error. Removed ocralejdk --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3009122..6594a58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ dist: bionic language: java jdk: - - oraclejdk11 + - openjdk8 - openjdk11 #-----start GUI testing stuff From 3c8410cca47abfbc907d240ee5ff92a9478970c8 Mon Sep 17 00:00:00 2001 From: wurstbroteater Date: Sat, 16 Jan 2021 01:07:41 +0100 Subject: [PATCH 25/35] Adressing reviewer suggetions now in correct branch for #53 --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6594a58..51fdc6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,13 +2,12 @@ dist: bionic language: java jdk: - - openjdk8 - openjdk11 #-----start GUI testing stuff services: - xvfb -#-----end GUI testin stuff +#-----end GUI testing stuff cache: directories: - "$HOME/.m2" From a454db806017e243038d46086870aa3d248d084c Mon Sep 17 00:00:00 2001 From: wurstbroteater Date: Thu, 21 Jan 2021 12:14:55 +0100 Subject: [PATCH 26/35] Adressing reviewer suggetions for travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 51fdc6b..e909c4c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,10 +4,10 @@ language: java jdk: - openjdk11 -#-----start GUI testing stuff +#-----start GUI testing services: - xvfb -#-----end GUI testing stuff +#-----end GUI testing cache: directories: - "$HOME/.m2" From 95df99f8e17b40ad556f278ce353764044d014ee Mon Sep 17 00:00:00 2001 From: wurstbroteater Date: Thu, 21 Jan 2021 12:19:48 +0100 Subject: [PATCH 27/35] Adressing reviewer suggestion to remove commented import --- .../src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java | 1 - 1 file changed, 1 deletion(-) diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java index 03ffecc..d323d47 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java @@ -6,7 +6,6 @@ import org.eclipse.core.resources.IFile; -//import de.ovgu.featureide.fm.core.CoreExtensionLoader; import de.ovgu.featureide.fm.core.EclipseExtensionLoader; import de.ovgu.featureide.fm.core.ExtensionManager; import de.ovgu.featureide.fm.core.IExtensionLoader; From bb579366f8b386ba810b283a84da4007fa2cfb0f Mon Sep 17 00:00:00 2001 From: wurstbroteater Date: Thu, 21 Jan 2021 12:46:05 +0100 Subject: [PATCH 28/35] Fixed Code Style --- .../variantsync/patch/base/DiffUtilsTest.java | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 388 ++++++++++++++++++ .../variantsync/core/VariantSyncComposer.java | 50 ++- .../variantsync/core/VariantSyncPlugin.java | 30 +- .../exceptions/ProjectNotFoundException.java | 19 +- .../managers/ConfigurationProjectManager.java | 35 +- .../core/managers/FeatureContextManager.java | 11 +- .../core/managers/MappingManager.java | 7 +- .../core/managers/PatchesManager.java | 14 +- .../core/managers/data/CodeMapping.java | 5 + .../managers/data/ConfigurationProject.java | 26 +- .../core/managers/data/FeatureContext.java | 10 +- .../core/managers/data/SourceFile.java | 12 +- .../persistence/CodeMappingFormat.java | 11 +- .../persistence/FeatureContextFormat.java | 6 +- .../managers/persistence/PatchFormat.java | 12 +- .../core/monitor/CodeMappingHandler.java | 18 +- .../core/monitor/ResourceChangeHandler.java | 9 +- .../core/monitor/ResourceChangeVisitor.java | 96 +++-- .../core/nature/CreateVariantProject.java | 3 +- .../tubs/variantsync/core/nature/Variant.java | 54 +-- .../tubs/variantsync/core/patch/ADelta.java | 80 ++-- .../core/patch/AMarkerHandler.java | 3 +- .../tubs/variantsync/core/patch/APatch.java | 39 +- .../core/patch/DeltaFactoryManager.java | 55 ++- .../variantsync/core/patch/HistoryStore.java | 6 +- .../core/patch/base/DefaultDelta.java | 4 +- .../core/patch/base/DefaultDeltaFactory.java | 20 +- .../core/patch/base/DefaultMarkerHandler.java | 6 +- .../core/patch/interfaces/IDelta.java | 17 +- .../core/patch/interfaces/IDeltaFactory.java | 18 +- .../core/patch/interfaces/IPatch.java | 31 +- .../core/patch/interfaces/IPatchFactory.java | 2 +- .../syncronization/ResourceCompareInput.java | 74 ++-- .../SynchronizationHandler.java | 6 +- .../syncronization/TargetsCalculator.java | 32 +- .../core/utilities/AMarkerInformation.java | 13 +- .../core/utilities/FileHelper.java | 17 +- .../core/utilities/LogOperations.java | 27 +- .../core/utilities/MarkerUtils.java | 24 +- .../tubs/variantsync/core/utilities/Tree.java | 3 +- .../variantsync/core/utilities/TreeNode.java | 1 + .../utilities/VariantSyncProgressMonitor.java | 7 +- .../core/utilities/event/IEventListener.java | 21 +- .../core/utilities/event/IEventManager.java | 7 +- .../utilities/event/VariantSyncEvent.java | 23 +- .../view/context/ActiveContextHandler.java | 6 +- .../context/DynamicContextPopupItems.java | 9 +- .../context/SelectContextContribution.java | 6 +- .../core/view/editor/PartAdapter.java | 6 +- .../featurecontext/FeatureContextHandler.java | 9 +- .../FeatureContextManagerPage.java | 15 +- .../featurecontext/FeatureContextWizard.java | 6 +- .../FeatureContextWizardPage.java | 15 +- .../core/view/featurecontext/View.java | 21 +- .../ResourceChangesColumnLabelProvider.java | 15 +- .../view/resourcechanges/ResourcesTree.java | 6 +- .../core/view/resourcechanges/View.java | 6 +- .../core/view/sourcefocus/View.java | 28 +- .../core/view/targetfocus/View.java | 27 +- 60 files changed, 1089 insertions(+), 440 deletions(-) diff --git a/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java b/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java index 4160c92..c7ef77a 100644 --- a/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java +++ b/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java @@ -62,4 +62,4 @@ public void testPatch2() throws DiffException { assertTrue(patch.getDeltas().size() == 1); } -} \ No newline at end of file +} diff --git a/de.tubs.variantsync.core/.settings/org.eclipse.jdt.core.prefs b/de.tubs.variantsync.core/.settings/org.eclipse.jdt.core.prefs index 626ebb3..c048ac6 100644 --- a/de.tubs.variantsync.core/.settings/org.eclipse.jdt.core.prefs +++ b/de.tubs.variantsync.core/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,14 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull @@ -102,3 +112,381 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false +org.eclipse.jdt.core.formatter.align_with_spaces=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assertion_message=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_record_components=16 +org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 +org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch=0 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_record_constructor=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_record_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.indent_tag_description=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false +org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.text_block_indentation=0 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true +org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java index 71119e0..831503a 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java @@ -17,11 +17,13 @@ public class VariantSyncComposer extends ComposerExtensionClass { - @Override public void performFullBuild(Path config) { + @Override + public void performFullBuild(Path config) { VariantSyncPlugin.getConfigurationProjectManager().reinitialize(); } - @Override public void addCompiler(IProject project, String sourcePath, String configPath, String buildPath) { + @Override + public void addCompiler(IProject project, String sourcePath, String configPath, String buildPath) { File featureContextFile = new File(project.getFile(FeatureContextFormat.FILENAME).getLocationURI()); try { featureContextFile.createNewFile(); @@ -30,60 +32,74 @@ public class VariantSyncComposer extends ComposerExtensionClass { } } - @Override public boolean hasSourceFolder() { + @Override + public boolean hasSourceFolder() { return false; } - @Override public boolean hasFeatureFolder() { + @Override + public boolean hasFeatureFolder() { return false; } - @Override public boolean hasBuildFolder() { + @Override + public boolean hasBuildFolder() { return false; } - @Override public boolean createFolderForFeatures() { + @Override + public boolean createFolderForFeatures() { return false; } - @Override public boolean showContextFieldsAndMethods() { + @Override + public boolean showContextFieldsAndMethods() { return false; } - @Override public boolean hasMetaProductGeneration() { + @Override + public boolean hasMetaProductGeneration() { return false; } - @Override public Mechanism getGenerationMechanism() { + @Override + public Mechanism getGenerationMechanism() { return null; } - @Override public boolean supportsAndroid() { + @Override + public boolean supportsAndroid() { return false; } - @Override public boolean supportsMigration() { + @Override + public boolean supportsMigration() { return false; } - @Override public boolean clean() { + @Override + public boolean clean() { return false; } - @Override public void postCompile(IResourceDelta delta, IFile buildFile) { + @Override + public void postCompile(IResourceDelta delta, IFile buildFile) { } - @Override public void copyNotComposedFiles(Configuration config, IFolder destination) { + @Override + public void copyNotComposedFiles(Configuration config, IFolder destination) { } - @Override public void buildPartialFeatureProjectAssets(IFolder sourceFolder, ArrayList removedFeatures, ArrayList mandatoryFeatures) - throws IOException, CoreException { + @Override + public void buildPartialFeatureProjectAssets(IFolder sourceFolder, ArrayList removedFeatures, + ArrayList mandatoryFeatures) throws IOException, CoreException { } - @Override public boolean supportsPartialFeatureProject() { + @Override + public boolean supportsPartialFeatureProject() { return false; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncPlugin.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncPlugin.java index 158e6b7..0a3f8a2 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncPlugin.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncPlugin.java @@ -60,18 +60,21 @@ public class VariantSyncPlugin extends AbstractUIPlugin { /** * The constructor */ - public VariantSyncPlugin() {} + public VariantSyncPlugin() { + } /* * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework. BundleContext) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework. + * BundleContext) */ public void start(BundleContext ctxt) throws Exception { super.start(ctxt); plugin = this; - DeltaFactoryManager - .setExtensionLoader(new EclipseExtensionLoader<>(PLUGIN_ID, IDeltaFactory.extensionPointID, IDeltaFactory.extensionID, IDeltaFactory.class)); + DeltaFactoryManager.setExtensionLoader(new EclipseExtensionLoader<>(PLUGIN_ID, IDeltaFactory.extensionPointID, + IDeltaFactory.extensionID, IDeltaFactory.class)); configurationProjectManager.initalize(); @@ -87,7 +90,9 @@ public void run() { /* * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework. BundleContext) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework. + * BundleContext) */ public void stop(BundleContext ctxt) throws Exception { configurationProjectManager.terminate(); @@ -137,7 +142,8 @@ public static PatchesManager getActivePatchesManager() { } /** - * Returns an image descriptor for the image file at the given plug-in relative path. + * Returns an image descriptor for the image file at the given plug-in relative + * path. * * @param path the path * @return the image descriptor @@ -147,7 +153,8 @@ public ImageDescriptor getImageDescriptor(String path) { } /** - * Always good to have this static method as when dealing with IResources having a interface to get the editor is very handy + * Always good to have this static method as when dealing with IResources having + * a interface to get the editor is very handy * * @return */ @@ -160,9 +167,11 @@ public static ITextEditor getEditor() { } public static IFile getEditorInput() { - if (VariantSyncPlugin.getActiveWorkbenchWindow() == null) return null; + if (VariantSyncPlugin.getActiveWorkbenchWindow() == null) + return null; IEditorPart editorPart = VariantSyncPlugin.getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if (editorPart == null || !(editorPart instanceof IFileEditorInput)) return null; + if (editorPart == null || !(editorPart instanceof IFileEditorInput)) + return null; return ((IFileEditorInput) editorPart.getEditorInput()).getFile(); } @@ -191,7 +200,8 @@ public void listenForActiveClass() { } public static void addNature(IProject project) { - VariantSyncProgressMonitor progressMonitor = new VariantSyncProgressMonitor("Adding VariantSync nature to " + project.getName()); + VariantSyncProgressMonitor progressMonitor = new VariantSyncProgressMonitor( + "Adding VariantSync nature to " + project.getName()); try { IProjectDescription description = project.getDescription(); String[] natures = description.getNatureIds(); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/exceptions/ProjectNotFoundException.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/exceptions/ProjectNotFoundException.java index 32f8237..eb80f1e 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/exceptions/ProjectNotFoundException.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/exceptions/ProjectNotFoundException.java @@ -5,17 +5,19 @@ public class ProjectNotFoundException extends NoSuchElementException { private static final long serialVersionUID = 1L; - - public enum Type {CONFIGURATION, VARIANT}; - + + public enum Type { + CONFIGURATION, VARIANT + }; + private Type type; - + public ProjectNotFoundException(Type type) { super(""); this.type = type; - + } - + public ProjectNotFoundException(Type type, String message) { super(message); this.type = type; @@ -23,7 +25,8 @@ public ProjectNotFoundException(Type type, String message) { @Override public String toString() { - return "A " + (type==Type.CONFIGURATION?"configuration project":"variant") + " does not exist in the workspace. " + getMessage(); + return "A " + (type == Type.CONFIGURATION ? "configuration project" : "variant") + + " does not exist in the workspace. " + getMessage(); } - + } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java index 39010f2..7a089dc 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java @@ -26,7 +26,8 @@ import de.tubs.variantsync.core.utilities.event.VariantSyncEvent; import de.tubs.variantsync.core.utilities.event.VariantSyncEvent.EventType; -public class ConfigurationProjectManager extends AManager implements IEventListener, de.ovgu.featureide.fm.core.base.event.IEventListener { +public class ConfigurationProjectManager extends AManager + implements IEventListener, de.ovgu.featureide.fm.core.base.event.IEventListener { private static HashMap INSTANCES = new HashMap<>(); private static ConfigurationProject lastRequestedConfiguration = null; @@ -39,7 +40,8 @@ public void initalize() { } catch (CoreException e) { LogOperations.logError("A marker could not be deleted", e); } - if (project.getProjectName().equals(VariantSyncPlugin.getDefault().getPreferenceStore().getString("lastRequestedConfiguration"))) { + if (project.getProjectName().equals( + VariantSyncPlugin.getDefault().getPreferenceStore().getString("lastRequestedConfiguration"))) { lastConfiguration = getConfigurationProject(project); } else { getConfigurationProject(project); @@ -47,7 +49,8 @@ public void initalize() { } if (lastConfiguration != null && lastRequestedConfiguration != lastConfiguration) { lastRequestedConfiguration = lastConfiguration; - fireEvent(new VariantSyncEvent(this, EventType.CONFIGURATIONPROJECT_CHANGED, null, lastRequestedConfiguration)); + fireEvent(new VariantSyncEvent(this, EventType.CONFIGURATIONPROJECT_CHANGED, null, + lastRequestedConfiguration)); } for (ConfigurationProject configurationProject : INSTANCES.values()) { findVariants(configurationProject); @@ -82,7 +85,8 @@ public ConfigurationProject getConfigurationProject(IFeatureProject project) { ConfigurationProject configurationProject = INSTANCES.get(featureProject); if (lastRequestedConfiguration != configurationProject) { lastRequestedConfiguration = configurationProject; - fireEvent(new VariantSyncEvent(this, EventType.CONFIGURATIONPROJECT_CHANGED, null, lastRequestedConfiguration)); + fireEvent(new VariantSyncEvent(this, EventType.CONFIGURATIONPROJECT_CHANGED, null, + lastRequestedConfiguration)); } return configurationProject; } @@ -92,7 +96,8 @@ public ConfigurationProject getConfigurationProject(IFeatureProject project) { INSTANCES.put(project, configurationProject); if (lastRequestedConfiguration != configurationProject) { lastRequestedConfiguration = configurationProject; - fireEvent(new VariantSyncEvent(this, EventType.CONFIGURATIONPROJECT_CHANGED, null, lastRequestedConfiguration)); + fireEvent(new VariantSyncEvent(this, EventType.CONFIGURATIONPROJECT_CHANGED, null, + lastRequestedConfiguration)); } return configurationProject; } @@ -103,16 +108,16 @@ public ConfigurationProject getConfigurationProject(IFeatureProject project) { * Loads all contexts which are saved in a XML-file. */ private List findConfigurationProjects() { - //System.out.println("[ConfigurationProjectManager.findConfigurationProjects]"); + // System.out.println("[ConfigurationProjectManager.findConfigurationProjects]"); List projects = new ArrayList<>(); for (IFeatureProject project : CorePlugin.getFeatureProjects()) { - //System.out.print(" project " + project.getProjectName()); + // System.out.print(" project " + project.getProjectName()); if (project.getComposerID().equals("de.tubs.variantsync.core.composer")) { LogOperations.logInfo("Found configuration project with name: " + project.getProjectName()); projects.add(project); - //System.out.println(" is variant composing"); + // System.out.println(" is variant composing"); } else { - //System.out.println(" is NOT variant composing"); + // System.out.println(" is NOT variant composing"); } } return projects; @@ -142,8 +147,10 @@ private void findVariants(ConfigurationProject configurationProject) { public IFeatureProject getFeatureProject(IProject project) { for (IFeatureProject featureProject : INSTANCES.keySet()) { - if (project.getName().equals(featureProject.getProjectName())) return featureProject; - if (featureProject.getProject().exists() && INSTANCES.get(featureProject).getVariants().contains(project)) return featureProject; + if (project.getName().equals(featureProject.getProjectName())) + return featureProject; + if (featureProject.getProject().exists() && INSTANCES.get(featureProject).getVariants().contains(project)) + return featureProject; } return null; } @@ -164,7 +171,8 @@ public ConfigurationProject getConfigurationProject(IProject project) { * @return */ public ConfigurationProject getActiveConfigurationProject() { - if (VariantSyncPlugin.getEditorInput() == null) return lastRequestedConfiguration; + if (VariantSyncPlugin.getEditorInput() == null) + return lastRequestedConfiguration; return getConfigurationProject(VariantSyncPlugin.getEditorInput().getProject()); } @@ -177,7 +185,8 @@ public void propertyChange(FeatureIDEEvent event) { LogOperations.logInfo("Model Event" + event); if (event.getSource() instanceof IFeatureModel) { IFeatureModel model = (IFeatureModel) event.getSource(); - List featureExpressions = getActiveConfigurationProject().getFeatureContextManager().getContextsAsStrings(); + List featureExpressions = getActiveConfigurationProject().getFeatureContextManager() + .getContextsAsStrings(); for (IFeature feature : model.getFeatures()) { if (!featureExpressions.contains(feature.getName())) { getActiveConfigurationProject().getFeatureContextManager().addContext(feature.getName()); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/FeatureContextManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/FeatureContextManager.java index dcde3c0..55086c4 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/FeatureContextManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/FeatureContextManager.java @@ -88,7 +88,8 @@ public void importFeaturesFromModel() throws ProjectNotFoundException { fireEvent(new VariantSyncEvent(this, EventType.FEATURECONTEXT_ADDED, null, fe)); } } - } else throw new ProjectNotFoundException(Type.CONFIGURATION); + } else + throw new ProjectNotFoundException(Type.CONFIGURATION); } public FeatureContext getContext(String name) { @@ -108,8 +109,8 @@ public void reset() { @Override public void load() { List contexts = new ArrayList<>(); - FileHandler.load(Paths.get(configurationProject.getFeatureProject().getProject().getFile(FeatureContextFormat.FILENAME).getLocationURI()), contexts, - new FeatureContextFormat()); + FileHandler.load(Paths.get(configurationProject.getFeatureProject().getProject() + .getFile(FeatureContextFormat.FILENAME).getLocationURI()), contexts, new FeatureContextFormat()); if (contexts.isEmpty()) { try { importFeaturesFromModel(); @@ -124,8 +125,8 @@ public void load() { @Override public void save() { - FileHandler.save(Paths.get(configurationProject.getFeatureProject().getProject().getFile(FeatureContextFormat.FILENAME).getLocationURI()), - getContexts(), new FeatureContextFormat()); + FileHandler.save(Paths.get(configurationProject.getFeatureProject().getProject() + .getFile(FeatureContextFormat.FILENAME).getLocationURI()), getContexts(), new FeatureContextFormat()); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/MappingManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/MappingManager.java index 17c8fcb..3b441ac 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/MappingManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/MappingManager.java @@ -89,7 +89,8 @@ public void reset() { public void load() { for (IProject project : configurationProject.getVariants()) { List sourceFiles = new ArrayList<>(); - FileHandler.load(Paths.get(project.getFile(CodeMappingFormat.FILENAME).getLocationURI()), sourceFiles, new CodeMappingFormat(project)); + FileHandler.load(Paths.get(project.getFile(CodeMappingFormat.FILENAME).getLocationURI()), sourceFiles, + new CodeMappingFormat(project)); if (!sourceFiles.isEmpty()) { addCodeMapping(project, sourceFiles); } @@ -99,8 +100,8 @@ public void load() { @Override public void save() { for (IProject project : codeMappings.keySet()) { - FileHandler.save(Paths.get(project.getFile(CodeMappingFormat.FILENAME).getLocationURI()), codeMappings.get(project), - new CodeMappingFormat(project)); + FileHandler.save(Paths.get(project.getFile(CodeMappingFormat.FILENAME).getLocationURI()), + codeMappings.get(project), new CodeMappingFormat(project)); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/PatchesManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/PatchesManager.java index 07c1cd6..c363fa2 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/PatchesManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/PatchesManager.java @@ -27,7 +27,8 @@ public PatchesManager(ConfigurationProject configurationProject) { } public IPatch getActualContextPatch() { - if (actualPatch == null) return null; + if (actualPatch == null) + return null; return this.actualPatch; } @@ -50,7 +51,8 @@ public void setPatches(List> patches) { public void closeActualPatch() { if (actualPatch != null) { actualPatch.setEndTime(System.currentTimeMillis()); - if (!actualPatch.isEmpty() && !patches.contains(actualPatch)) patches.add(actualPatch); + if (!actualPatch.isEmpty() && !patches.contains(actualPatch)) + patches.add(actualPatch); actualPatch = null; fireEvent(new VariantSyncEvent(this, EventType.PATCH_CLOSED, null, null)); } @@ -64,7 +66,8 @@ public void reset() { public void load() { if (configurationProject.getFeatureProject() != null) { List> patches = new ArrayList<>(); - FileHandler.load(Paths.get(configurationProject.getFeatureProject().getProject().getFile(PatchFormat.FILENAME).getLocationURI()), patches, + FileHandler.load(Paths.get(configurationProject.getFeatureProject().getProject() + .getFile(PatchFormat.FILENAME).getLocationURI()), patches, new PatchFormat(configurationProject.getFeatureProject())); if (!patches.isEmpty()) { setPatches(patches); @@ -86,8 +89,9 @@ public void propertyChange(VariantSyncEvent event) { @Override public void save() { - FileHandler.save(Paths.get(configurationProject.getFeatureProject().getProject().getFile(PatchFormat.FILENAME).getLocationURI()), patches, - new PatchFormat(configurationProject.getFeatureProject())); + FileHandler.save(Paths.get( + configurationProject.getFeatureProject().getProject().getFile(PatchFormat.FILENAME).getLocationURI()), + patches, new PatchFormat(configurationProject.getFeatureProject())); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/CodeMapping.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/CodeMapping.java index 7679065..3b1f058 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/CodeMapping.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/CodeMapping.java @@ -9,6 +9,7 @@ public class CodeMapping { /** * Constructor + * * @param code * @param variantSyncMarker */ @@ -19,6 +20,7 @@ public CodeMapping(String code, IVariantSyncMarker variantSyncMarker) { /** * Returns mapped code + * * @return code */ public String getCode() { @@ -27,6 +29,7 @@ public String getCode() { /** * Sets mapped code + * * @param code */ public void setCode(String code) { @@ -35,6 +38,7 @@ public void setCode(String code) { /** * Returns marker information + * * @return variantSyncMarker */ public IVariantSyncMarker getMarkerInformation() { @@ -43,6 +47,7 @@ public IVariantSyncMarker getMarkerInformation() { /** * Sets marker information + * * @param variantSyncMarker */ public void setMarkerInformation(IVariantSyncMarker variantSyncMarker) { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java index e9c4319..e94eb86 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java @@ -22,7 +22,8 @@ import de.tubs.variantsync.core.utilities.event.VariantSyncEvent.EventType; /** - * A class for managing all informations about the product line for one configuration project + * A class for managing all informations about the product line for one + * configuration project * * @author Christopher Sontag * @since 1.1 @@ -38,7 +39,8 @@ public class ConfigurationProject extends AManager implements ISaveableManager { private List projects = new ArrayList<>(); public IFeatureProject getFeatureProject() { - return configurationProject != null ? configurationProject.getProject().exists() ? configurationProject : null : null; + return configurationProject != null ? configurationProject.getProject().exists() ? configurationProject : null + : null; } public void setFeatureProject(IFeatureProject configurationProject) { @@ -60,7 +62,8 @@ public List getVariants() { public IProject getVariant(String name) { for (IProject project : this.projects) { - if (project.getName().equals(name)) return project; + if (project.getName().equals(name)) + return project; } return null; } @@ -79,11 +82,11 @@ public Configuration getConfigurationForVariant(IProject project) { IFile configPath = (IFile) EclipseFileSystem.getResource(confPath); String configFileName = configPath.getName(); String configName = configFileName.substring(0, configFileName.lastIndexOf('.')); - System.out.println( - "[ConfigurationProject.getConfigurationForVariant] Check name equality Project(" + project.getName() + ") with Config(" + configName - + ")"); + System.out.println("[ConfigurationProject.getConfigurationForVariant] Check name equality Project(" + + project.getName() + ") with Config(" + configName + ")"); if (configName.equals(project.getName())) { - ConfigurationManager configurationManager = ConfigurationManager.getInstance(Paths.get(configPath.getRawLocationURI())); + ConfigurationManager configurationManager = ConfigurationManager + .getInstance(Paths.get(configPath.getRawLocationURI())); if (configurationManager != null) { return configurationManager.getObject(); } @@ -97,7 +100,8 @@ public Iterable getFeatures() { return configurationProject.getFeatureModel().getFeatures(); } - @Override public void reset() { + @Override + public void reset() { projects.clear(); } @@ -113,13 +117,15 @@ public PatchesManager getPatchesManager() { return patchesManager; } - @Override public void save() { + @Override + public void save() { featureContextManager.save(); mappingManager.save(); patchesManager.save(); } - @Override public void load() { + @Override + public void load() { featureContextManager.load(); mappingManager.load(); patchesManager.load(); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/FeatureContext.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/FeatureContext.java index 331103e..d429591 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/FeatureContext.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/FeatureContext.java @@ -3,15 +3,15 @@ import de.ovgu.featureide.fm.core.color.FeatureColor; public class FeatureContext { - + public String name; public FeatureColor highlighter; - + public FeatureContext() { this.name = ""; this.highlighter = FeatureColor.NO_COLOR; } - + public FeatureContext(String name) { super(); this.name = name; @@ -55,7 +55,5 @@ public boolean equals(Object obj) { return false; return true; } - - - + } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/SourceFile.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/SourceFile.java index cf290aa..4f0fa05 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/SourceFile.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/SourceFile.java @@ -9,11 +9,11 @@ public class SourceFile { private IFile resource; List mappings = new ArrayList<>(); - + public SourceFile(IFile res) { this.resource = res; } - + public SourceFile(IFile res, List mappings) { this.resource = res; this.mappings = mappings; @@ -22,7 +22,7 @@ public SourceFile(IFile res, List mappings) { public IFile getFile() { return resource; } - + public void setFile(IFile res) { this.resource = res; } @@ -30,13 +30,13 @@ public void setFile(IFile res) { public List getMappings() { return mappings; } - + public void addMapping(CodeMapping mapping) { this.mappings.add(mapping); } - + public void setMapping(List mappings) { this.mappings = mappings; } - + } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/CodeMappingFormat.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/CodeMappingFormat.java index a46ae90..73f0ace 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/CodeMappingFormat.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/CodeMappingFormat.java @@ -25,7 +25,8 @@ public class CodeMappingFormat extends AXMLFormat> { private static final String MAPPINGS = "Mappings"; private static final String SOURCEFILE = "SourceFile"; private static final String CODEMAPPINGS = "CodeMapping"; - private static final Pattern CONTENT_REGEX = Pattern.compile("\\A\\s*(<[?]xml\\s.*[?]>\\s*)?<" + MAPPINGS + "[\\s>]"); + private static final Pattern CONTENT_REGEX = Pattern + .compile("\\A\\s*(<[?]xml\\s.*[?]>\\s*)?<" + MAPPINGS + "[\\s>]"); public static final String FILENAME = ".mapping.xml"; @@ -63,10 +64,12 @@ public String getId() { protected void readDocument(Document doc, List warnings) throws UnsupportedModelException { object.clear(); for (final Element eSF : getElements(doc.getDocumentElement().getChildNodes())) { - SourceFile sourceFile = new SourceFile(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(eSF.getAttribute("path")))); + SourceFile sourceFile = new SourceFile( + ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(eSF.getAttribute("path")))); for (final Element eCM : getElements(eSF.getChildNodes())) { - IVariantSyncMarker variantSyncMarker = new AMarkerInformation(Integer.parseInt(eCM.getAttribute("offset")), - Integer.parseInt(eCM.getAttribute("length")), Boolean.parseBoolean(eCM.getAttribute("isLine"))); + IVariantSyncMarker variantSyncMarker = new AMarkerInformation( + Integer.parseInt(eCM.getAttribute("offset")), Integer.parseInt(eCM.getAttribute("length")), + Boolean.parseBoolean(eCM.getAttribute("isLine"))); variantSyncMarker.setContext(eCM.getAttribute("context")); CodeMapping codeMapping = new CodeMapping(eCM.getTextContent(), variantSyncMarker); sourceFile.addMapping(codeMapping); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/FeatureContextFormat.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/FeatureContextFormat.java index 878d512..411e738 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/FeatureContextFormat.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/FeatureContextFormat.java @@ -18,7 +18,8 @@ public class FeatureContextFormat extends AXMLFormat> { private static final String ID = "FeatureContexts"; private static final String FEATURE_CONTEXTS = "contexts"; private static final String FEATURE_CONTEXT = "context"; - private static final Pattern CONTENT_REGEX = Pattern.compile("\\A\\s*(<[?]xml\\s.*[?]>\\s*)?<" + FEATURE_CONTEXTS + "[\\s>]"); + private static final Pattern CONTENT_REGEX = Pattern + .compile("\\A\\s*(<[?]xml\\s.*[?]>\\s*)?<" + FEATURE_CONTEXTS + "[\\s>]"); public static final String FILENAME = ".contexts.xml"; @@ -46,7 +47,8 @@ public String getId() { protected void readDocument(Document doc, List warnings) throws UnsupportedModelException { object.clear(); for (final Element e : getElements(doc.getDocumentElement().getChildNodes())) { - FeatureContext fe = new FeatureContext(e.getAttribute("name"), FeatureColor.getColor(e.getAttribute("highlighter"))); + FeatureContext fe = new FeatureContext(e.getAttribute("name"), + FeatureColor.getColor(e.getAttribute("highlighter"))); object.add(fe); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/PatchFormat.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/PatchFormat.java index 881d45a..b98e149 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/PatchFormat.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/PatchFormat.java @@ -33,7 +33,8 @@ public class PatchFormat extends AXMLFormat>> { private static final String PATCHES = "Patches"; private static final String PATCH = "Patch"; private static final String DELTA = "Delta"; - private static final Pattern CONTENT_REGEX = Pattern.compile("\\A\\s*(<[?]xml\\s.*[?]>\\s*)?<" + PATCHES + "[\\s>]"); + private static final Pattern CONTENT_REGEX = Pattern + .compile("\\A\\s*(<[?]xml\\s.*[?]>\\s*)?<" + PATCHES + "[\\s>]"); public static final String FILENAME = ".patches.xml"; @@ -43,12 +44,11 @@ public PatchFormat(IFeatureProject project) { this.project = project; } - @Override public APersistentFormat>> getInstance() { return new PatchFormat(null); } - + public IPersistentFormat>> getInstance(IFeatureProject project) { return new PatchFormat(project); } @@ -87,7 +87,8 @@ protected void readDocument(Document doc, List warnings) throws Unsuppo try { deltaFactory = DeltaFactoryManager.getFactoryById(eDelta.getAttribute("factoryId")); } catch (NoSuchExtensionException e) { - LogOperations.logInfo("Could not find extension point for factoryId: " + eDelta.getAttribute("factoryId")); + LogOperations.logInfo( + "Could not find extension point for factoryId: " + eDelta.getAttribute("factoryId")); continue; } @@ -105,7 +106,8 @@ protected void readDocument(Document doc, List warnings) throws Unsuppo delta.setType(DELTATYPE.valueOf(eDelta.getAttribute("type"))); for (final Element eSyncronizedProject : getElements(eDelta.getElementsByTagName("Project"))) { - delta.addSynchronizedProject(ResourcesPlugin.getWorkspace().getRoot().getProject(eSyncronizedProject.getAttribute("name"))); + delta.addSynchronizedProject(ResourcesPlugin.getWorkspace().getRoot() + .getProject(eSyncronizedProject.getAttribute("name"))); } for (final Element eProperty : getElements(eDelta.getElementsByTagName("Property"))) { delta.addProperty(eProperty.getAttribute("key"), eProperty.getAttribute("value")); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/CodeMappingHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/CodeMappingHandler.java index b440af7..5d895c3 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/CodeMappingHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/CodeMappingHandler.java @@ -32,10 +32,12 @@ public static void addCodeMappingsForDeltas(List> deltas) { // Get factory and marker handler for delta IDeltaFactory deltaFactory = DeltaFactoryManager.getFactoryById(delta.getFactoryId()); IMarkerHandler markerHandler = deltaFactory.getMarkerHandler(); - List variantSyncMarkers = markerHandler.getMarkersForDelta(delta.getResource(), delta); + List variantSyncMarkers = markerHandler.getMarkersForDelta(delta.getResource(), + delta); // Get current context - ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager().getActiveConfigurationProject(); + ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager() + .getActiveConfigurationProject(); MappingManager mappingManager = configurationProject.getMappingManager(); if (configurationProject != null) { // Get file with current mappings @@ -72,9 +74,11 @@ public static void addCodeMappingsForDeltas(List> deltas) { public static void addCodeMappings(IFile file, String feature, int offset, int length, String content) { try { IDeltaFactory deltaFactory = DeltaFactoryManager.getInstance().getFactoryByFile(file); - List variantSyncMarkers = deltaFactory.getMarkerHandler().getMarkers(file, offset, length); + List variantSyncMarkers = deltaFactory.getMarkerHandler().getMarkers(file, offset, + length); - ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager().getActiveConfigurationProject(); + ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager() + .getActiveConfigurationProject(); MappingManager mappingManager = configurationProject.getMappingManager(); if (configurationProject != null) { SourceFile sourceFile = mappingManager.getMapping(file); @@ -109,7 +113,8 @@ public static CodeMapping getCodeMapping(SourceFile sourceFile, IVariantSyncMark } /** - * Returns true, if a marker information exists at the given line in the given file + * Returns true, if a marker information exists at the given line in the given + * file * * @param sourceFile * @param line @@ -126,7 +131,8 @@ public static boolean contains(SourceFile sourceFile, int line) { } /** - * Removes a given marker information in the given file and returns true, if a mapping was removed + * Removes a given marker information in the given file and returns true, if a + * mapping was removed * * @param sourceFile * @param variantSyncMarker diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeHandler.java index f1c1176..32e0056 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeHandler.java @@ -13,7 +13,8 @@ import de.tubs.variantsync.core.utilities.LogOperations; /** - * Listener which notifies resource changes in workspace that have already happened. + * Listener which notifies resource changes in workspace that have already + * happened. * * @author Tristan Pfofe (tristan.pfofe@ckc.de) * @author Christopher Sontag @@ -23,7 +24,8 @@ public class ResourceChangeHandler implements IResourceChangeListener, ISaveParticipant { /** - * Notifies ResourceDeltaListener that some resource changes have already happened. + * Notifies ResourceDeltaListener that some resource changes have already + * happened. */ @Override public void resourceChanged(IResourceChangeEvent event) { @@ -37,7 +39,8 @@ public void resourceChanged(IResourceChangeEvent event) { } /** - * Ensures that resource monitoring is active even if variantsync plugin is not active in eclipse. + * Ensures that resource monitoring is active even if variantsync plugin is not + * active in eclipse. * * @throws CoreException resources could not be monitored */ diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeVisitor.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeVisitor.java index 554ffe0..65464e5 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeVisitor.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeVisitor.java @@ -26,8 +26,11 @@ import de.tubs.variantsync.core.utilities.event.VariantSyncEvent.EventType; /** - * Visits given resource delta and reacts on added, removed or changed resource deltas. "A resource delta represents changes in the state of a resource tree - * between two discrete points in time" - @see org.eclipse.core.resources.IResourceDelta. A resource tree represents a project of workspace. + * Visits given resource delta and reacts on added, removed or changed resource + * deltas. "A resource delta represents changes in the state of a resource tree + * between two discrete points in time" - @see + * org.eclipse.core.resources.IResourceDelta. A resource tree represents a + * project of workspace. * * @author Tristan Pfofe (tristan.pfofe@ckc.de) * @author Christopher Sontag @@ -38,7 +41,8 @@ class ResourceChangeVisitor implements IResourceDeltaVisitor { /** - * Called from ResourceChangeListener if a resource change have happened. Filters changed resource and handle change event. + * Called from ResourceChangeListener if a resource change have happened. + * Filters changed resource and handle change event. */ @Override public boolean visit(IResourceDelta delta) throws CoreException { @@ -54,7 +58,8 @@ public boolean visit(IResourceDelta delta) throws CoreException { } /** - * Triggers action depending on kind of delta. Possible actions: add, remove or change file in admin folder. + * Triggers action depending on kind of delta. Possible actions: add, remove or + * change file in admin folder. * * @param type kind of delta */ @@ -77,31 +82,36 @@ private void analyseDeltaType(IResourceDelta delta) { /** * Adds patch file to admin folder. * - * @param res changed resource + * @param res changed resource * @param delta resource delta * @param flag */ @SuppressWarnings("unchecked") private void handleAddedResource(IResourceDelta delta) { - if (delta.getResource().getType() == IResource.FILE - && ((delta.getFlags() & IResourceDelta.MARKERS) == 0 || (delta.getFlags() & IResourceDelta.MOVED_FROM) != 0)) { + if (delta.getResource().getType() == IResource.FILE && ((delta.getFlags() & IResourceDelta.MARKERS) == 0 + || (delta.getFlags() & IResourceDelta.MOVED_FROM) != 0)) { IFile file = (IFile) delta.getResource(); - ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager().getConfigurationProject(file.getProject()); + ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager() + .getConfigurationProject(file.getProject()); try { - if (configurationProject.getMappingManager().isActive() && !configurationProject.getFeatureContextManager().isDefault()) { + if (configurationProject.getMappingManager().isActive() + && !configurationProject.getFeatureContextManager().isDefault()) { IDeltaFactory factory = DeltaFactoryManager.getInstance().getFactoryByFile(file); IPatch patch; if (configurationProject.getPatchesManager().getActualContextPatch() == null) { IPatchFactory patchFactory = new DefaultPatchFactory(); patch = patchFactory.createPatch(configurationProject.getFeatureContextManager().getActual()); - VariantSyncPlugin.getDefault().fireEvent(new VariantSyncEvent(file, EventType.PATCH_ADDED, null, patch)); + VariantSyncPlugin.getDefault() + .fireEvent(new VariantSyncEvent(file, EventType.PATCH_ADDED, null, patch)); } else { patch = configurationProject.getPatchesManager().getActualContextPatch(); } - List> deltas = factory.createDeltas(file, file.getModificationStamp(), IDelta.DELTATYPE(delta.getKind())); + List> deltas = factory.createDeltas(file, file.getModificationStamp(), + IDelta.DELTATYPE(delta.getKind())); patch.addDeltas(deltas); configurationProject.getPatchesManager().setActualContextPatch(patch); - VariantSyncPlugin.getDefault().fireEvent(new VariantSyncEvent(file, EventType.PATCH_CHANGED, null, patch)); + VariantSyncPlugin.getDefault() + .fireEvent(new VariantSyncEvent(file, EventType.PATCH_CHANGED, null, patch)); CodeMappingHandler.addCodeMappingsForDeltas(deltas); } } catch (DiffException ex) { @@ -110,36 +120,42 @@ private void handleAddedResource(IResourceDelta delta) { LogOperations.logError("PatchFactory Extension does not exist!", ex); } } - LogOperations.logInfo(String.format("Resource %s was added with flag %s", delta.getResource().getFullPath(), getFlagText(delta.getFlags()))); + LogOperations.logInfo(String.format("Resource %s was added with flag %s", delta.getResource().getFullPath(), + getFlagText(delta.getFlags()))); } /** * Removes patch file from admin folder. * - * @param res changed resource + * @param res changed resource * @param delta resource delta */ @SuppressWarnings("unchecked") private void handleRemovedResource(IResourceDelta delta) { - if (delta.getResource().getType() == IResource.FILE - && ((delta.getFlags() & IResourceDelta.MARKERS) != 0 || (delta.getFlags() & IResourceDelta.MOVED_FROM) != 0)) { + if (delta.getResource().getType() == IResource.FILE && ((delta.getFlags() & IResourceDelta.MARKERS) != 0 + || (delta.getFlags() & IResourceDelta.MOVED_FROM) != 0)) { IFile file = (IFile) delta.getResource(); - ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager().getConfigurationProject(file.getProject()); + ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager() + .getConfigurationProject(file.getProject()); try { - if (configurationProject.getMappingManager().isActive() && !configurationProject.getFeatureContextManager().isDefault()) { + if (configurationProject.getMappingManager().isActive() + && !configurationProject.getFeatureContextManager().isDefault()) { IDeltaFactory factory = DeltaFactoryManager.getInstance().getFactoryByFile(file); IPatch patch; if (configurationProject.getPatchesManager().getActualContextPatch() == null) { IPatchFactory patchFactory = new DefaultPatchFactory(); patch = patchFactory.createPatch(configurationProject.getFeatureContextManager().getActual()); - VariantSyncPlugin.getDefault().fireEvent(new VariantSyncEvent(file, EventType.PATCH_ADDED, null, patch)); + VariantSyncPlugin.getDefault() + .fireEvent(new VariantSyncEvent(file, EventType.PATCH_ADDED, null, patch)); } else { patch = configurationProject.getPatchesManager().getActualContextPatch(); } - List> deltas = factory.createDeltas(file, file.getModificationStamp(), IDelta.DELTATYPE(delta.getKind())); + List> deltas = factory.createDeltas(file, file.getModificationStamp(), + IDelta.DELTATYPE(delta.getKind())); patch.addDeltas(deltas); configurationProject.getPatchesManager().setActualContextPatch(patch); - VariantSyncPlugin.getDefault().fireEvent(new VariantSyncEvent(file, EventType.PATCH_CHANGED, null, patch)); + VariantSyncPlugin.getDefault() + .fireEvent(new VariantSyncEvent(file, EventType.PATCH_CHANGED, null, patch)); CodeMappingHandler.addCodeMappingsForDeltas(deltas); } } catch (DiffException ex) { @@ -148,13 +164,14 @@ private void handleRemovedResource(IResourceDelta delta) { LogOperations.logError("PatchFactory Extension does not exist!", ex); } } - LogOperations.logInfo(String.format("Resource %s was removed with flag %s", delta.getResource().getFullPath(), getFlagText(delta.getFlags()))); + LogOperations.logInfo(String.format("Resource %s was removed with flag %s", delta.getResource().getFullPath(), + getFlagText(delta.getFlags()))); } /** * Creates patch for changed resource. * - * @param res changed resource + * @param res changed resource * @param delta resource delta */ @SuppressWarnings("unchecked") @@ -167,22 +184,28 @@ private void handleChangedResource(IResourceDelta delta) { if (states.length > 0) { long t = states[0].getModificationTime(); - ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager().getConfigurationProject(file.getProject()); + ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager() + .getConfigurationProject(file.getProject()); try { - if (configurationProject.getMappingManager().isActive() && !configurationProject.getFeatureContextManager().isDefault()) { + if (configurationProject.getMappingManager().isActive() + && !configurationProject.getFeatureContextManager().isDefault()) { IDeltaFactory factory = DeltaFactoryManager.getInstance().getFactoryByFile(file); IPatch patch; if (configurationProject.getPatchesManager().getActualContextPatch() == null) { IPatchFactory patchFactory = new DefaultPatchFactory(); - patch = patchFactory.createPatch(configurationProject.getFeatureContextManager().getActual()); - VariantSyncPlugin.getDefault().fireEvent(new VariantSyncEvent(file, EventType.PATCH_ADDED, null, patch)); + patch = patchFactory + .createPatch(configurationProject.getFeatureContextManager().getActual()); + VariantSyncPlugin.getDefault() + .fireEvent(new VariantSyncEvent(file, EventType.PATCH_ADDED, null, patch)); } else { patch = configurationProject.getPatchesManager().getActualContextPatch(); } - List> deltas = factory.createDeltas(file, states[0], t, IDelta.DELTATYPE(delta.getKind())); + List> deltas = factory.createDeltas(file, states[0], t, + IDelta.DELTATYPE(delta.getKind())); patch.addDeltas(deltas); configurationProject.getPatchesManager().setActualContextPatch(patch); - VariantSyncPlugin.getDefault().fireEvent(new VariantSyncEvent(file, EventType.PATCH_CHANGED, null, patch)); + VariantSyncPlugin.getDefault() + .fireEvent(new VariantSyncEvent(file, EventType.PATCH_CHANGED, null, patch)); CodeMappingHandler.addCodeMappingsForDeltas(deltas); } } catch (DiffException ex) { @@ -194,16 +217,23 @@ private void handleChangedResource(IResourceDelta delta) { } catch (CoreException e) { LogOperations.logError("File states could not be retrieved.", e); } - LogOperations.logInfo(String.format("Resource %s was changed with flag %s", delta.getResource().getFullPath(), getFlagText(delta.getFlags()))); + LogOperations.logInfo(String.format("Resource %s was changed with flag %s", + delta.getResource().getFullPath(), getFlagText(delta.getFlags()))); } } /** - * Checks if resource does not fulfill any following criteria:
  • project has nature support
  • project is open
  • resource still - * exists
  • resource is a file
  • resource starts not with \".\"
+ * Checks if resource does not fulfill any following criteria:
+ *
    + *
  • project has nature support
  • + *
  • project is open
  • + *
  • resource still exists
  • + *
  • resource is a file
  • + *
  • resource starts not with \".\"
  • + *
* * @param project project resource belongs to - * @param res resource to check + * @param res resource to check * @return true if any criteria was fulfilled * @throws CoreException */ diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/CreateVariantProject.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/CreateVariantProject.java index aaeb1e0..395b9c6 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/CreateVariantProject.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/CreateVariantProject.java @@ -72,7 +72,8 @@ private IProject createJavaProjectWithVariantNature(String projectName) { IJavaProject javaProject = JavaCore.create(project); // set build path - IClasspathEntry[] buildPath = { JavaCore.newSourceEntry(project.getFullPath().append("src")), JavaRuntime.getDefaultJREContainerEntry() }; + IClasspathEntry[] buildPath = { JavaCore.newSourceEntry(project.getFullPath().append("src")), + JavaRuntime.getDefaultJREContainerEntry() }; progressMonitor.setSubTaskName("Setting build paths of project"); javaProject.setRawClasspath(buildPath, project.getFullPath().append("bin"), progressMonitor); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/Variant.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/Variant.java index 5933f1a..ebc9e51 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/Variant.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/Variant.java @@ -9,32 +9,32 @@ public class Variant implements IProjectNature { public static final String NATURE_ID = "de.tubs.variantsync.core.variant"; private IProject project; - @Override - public void configure() throws CoreException { - // only called once the nature has been set - - //TODO: Create .variantHistory file - - // configure the project... - } - - @Override - public void deconfigure() throws CoreException { - // only called once the nature has been set - - //This should !not! delete the .variantHistory file - - // reset the project configuration... - } - - @Override - public IProject getProject() { - return project; - } - - @Override - public void setProject(IProject project) { - this.project = project; - } + @Override + public void configure() throws CoreException { + // only called once the nature has been set + + // TODO: Create .variantHistory file + + // configure the project... + } + + @Override + public void deconfigure() throws CoreException { + // only called once the nature has been set + + // This should !not! delete the .variantHistory file + + // reset the project configuration... + } + + @Override + public IProject getProject() { + return project; + } + + @Override + public void setProject(IProject project) { + this.project = project; + } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/ADelta.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/ADelta.java index 12c5be3..71eee16 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/ADelta.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/ADelta.java @@ -12,8 +12,9 @@ import de.tubs.variantsync.core.patch.interfaces.IPatch; /** - * This abstract class defines all fundamental methods of deltas.
Classes extending this interface should implement also {@link #clone()} and - * {@link #equals(Object)} + * This abstract class defines all fundamental methods of deltas.
+ * Classes extending this interface should implement also {@link #clone()} + * and {@link #equals(Object)} * * @author Christopher Sontag * @version 1.0 @@ -89,7 +90,8 @@ public boolean isSynchronizedProject(IProject project) { @Override public boolean isSynchronizedProject(String projectName) { for (IProject project : syncronizedProjects) { - if (project.getName().equals(projectName)) return true; + if (project.getName().equals(projectName)) + return true; } return false; } @@ -209,45 +211,67 @@ public String getFactoryId() { @Override public String toString() { - return String.format("ADelta [resource=%s, revised=%s, type=%s, timestamp=%s, context=%s, factoryId=%s]", resource, revised, type, timestamp, context, - factoryId); + return String.format("ADelta [resource=%s, revised=%s, type=%s, timestamp=%s, context=%s, factoryId=%s]", + resource, revised, type, timestamp, context, factoryId); } @Override public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; ADelta other = (ADelta) obj; if (factoryId == null) { - if (other.factoryId != null) return false; - } else if (!factoryId.equals(other.factoryId)) return false; + if (other.factoryId != null) + return false; + } else if (!factoryId.equals(other.factoryId)) + return false; if (context == null) { - if (other.context != null) return false; - } else if (!context.equals(other.context)) return false; + if (other.context != null) + return false; + } else if (!context.equals(other.context)) + return false; if (original == null) { - if (other.original != null) return false; - } else if (!original.equals(other.original)) return false; + if (other.original != null) + return false; + } else if (!original.equals(other.original)) + return false; if (parent == null) { - if (other.parent != null) return false; - } //else if (!parent.equals(other.parent)) return false; + if (other.parent != null) + return false; + } // else if (!parent.equals(other.parent)) return false; if (project == null) { - if (other.project != null) return false; - } else if (!project.equals(other.project)) return false; + if (other.project != null) + return false; + } else if (!project.equals(other.project)) + return false; if (properties == null) { - if (other.properties != null) return false; - } else if (!properties.equals(other.properties)) return false; + if (other.properties != null) + return false; + } else if (!properties.equals(other.properties)) + return false; if (resource == null) { - if (other.resource != null) return false; - } else if (!resource.equals(other.resource)) return false; + if (other.resource != null) + return false; + } else if (!resource.equals(other.resource)) + return false; if (revised == null) { - if (other.revised != null) return false; - } else if (!revised.equals(other.revised)) return false; + if (other.revised != null) + return false; + } else if (!revised.equals(other.revised)) + return false; if (syncronizedProjects == null) { - if (other.syncronizedProjects != null) return false; - } else if (!syncronizedProjects.equals(other.syncronizedProjects)) return false; - if (timestamp != other.timestamp) return false; - if (type != other.type) return false; + if (other.syncronizedProjects != null) + return false; + } else if (!syncronizedProjects.equals(other.syncronizedProjects)) + return false; + if (timestamp != other.timestamp) + return false; + if (type != other.type) + return false; return true; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/AMarkerHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/AMarkerHandler.java index d69f252..0c149b3 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/AMarkerHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/AMarkerHandler.java @@ -24,6 +24,7 @@ public List getMarkersForDelta(IFile file, IDelta delta) public abstract List getMarkers(IFile file, int offset, int length); @Override - public abstract boolean updateMarkerForDelta(SourceFile sourceFile, IDelta delta, List variantSyncMarkers); + public abstract boolean updateMarkerForDelta(SourceFile sourceFile, IDelta delta, + List variantSyncMarkers); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/APatch.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/APatch.java index b5ac0f3..df2a173 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/APatch.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/APatch.java @@ -16,16 +16,20 @@ public class APatch implements IPatch { @Override public void addDelta(IDelta delta) { - if (delta.getPatch() == null) delta.setPatch(this); - if (delta.getContext() == "") delta.setContext(feature); + if (delta.getPatch() == null) + delta.setPatch(this); + if (delta.getContext() == "") + delta.setContext(feature); deltas.add(delta); } @Override public void addDeltas(List> deltas) { for (IDelta delta : deltas) { - if (delta.getPatch() == null) delta.setPatch(this); - if (delta.getContext() == "") delta.setContext(feature); + if (delta.getPatch() == null) + delta.setPatch(this); + if (delta.getContext() == "") + delta.setContext(feature); } this.deltas.addAll(deltas); } @@ -91,18 +95,27 @@ public void setContext(String feature) { @Override public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; APatch other = (APatch) obj; if (deltas == null) { - if (other.deltas != null) return false; - } else if (!deltas.equals(other.deltas)) return false; - if (endTime != other.endTime) return false; + if (other.deltas != null) + return false; + } else if (!deltas.equals(other.deltas)) + return false; + if (endTime != other.endTime) + return false; if (feature == null) { - if (other.feature != null) return false; - } else if (!feature.equals(other.feature)) return false; - if (startTime != other.startTime) return false; + if (other.feature != null) + return false; + } else if (!feature.equals(other.feature)) + return false; + if (startTime != other.startTime) + return false; return true; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java index d323d47..cf26096 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java @@ -21,10 +21,11 @@ public class DeltaFactoryManager extends ExtensionManager { private IExtensionLoader extensionLoader; private final List extensions = new ArrayList<>(); - + public DeltaFactoryManager() { - IDeltaFactory[] y = new IDeltaFactory[]{getDefaultFactory()}; - IExtensionLoader x = new EclipseExtensionLoader(VariantSyncPlugin.PLUGIN_ID, IDeltaFactory.extensionPointID, IDeltaFactory.extensionID, IDeltaFactory.class); + IDeltaFactory[] y = new IDeltaFactory[] { getDefaultFactory() }; + IExtensionLoader x = new EclipseExtensionLoader(VariantSyncPlugin.PLUGIN_ID, + IDeltaFactory.extensionPointID, IDeltaFactory.extensionID, IDeltaFactory.class); setExtensionLoaderInternal(x); addExtension(getDefaultFactory()); } @@ -49,7 +50,8 @@ public static IDeltaFactory getFactoryById(String id) throws NoSuchExtensionExce } /** - * Returns the specific factory for the given file. If no factory supports the file then the default factory is returned + * Returns the specific factory for the given file. If no factory supports the + * file then the default factory is returned * * @param file * @return factory which supports the file @@ -72,7 +74,7 @@ public IDeltaFactory getFactoryByFile(IFile file) throws NoSuchExtensionExceptio public static IDeltaFactory getDefaultFactory() { return DefaultDeltaFactory.getInstance(); } - + @Override public synchronized List getExtensions() { if (extensionLoader != null) { @@ -84,41 +86,38 @@ public synchronized List getExtensions() { } } return Collections.unmodifiableList(extensions); - } - + } + protected void setExtensionLoaderInternal(IExtensionLoader extensionLoader) { this.extensionLoader = extensionLoader; - } - - - + } + @Override public synchronized boolean addExtension(IDeltaFactory extension) { - if (extension != null) { - for (final IDeltaFactory t : extensions) { - if (t.getId().equals(extension.getId())) { - return false; + if (extension != null) { + for (final IDeltaFactory t : extensions) { + if (t.getId().equals(extension.getId())) { + return false; + } + } + if (extension.initExtension()) { + extensions.add(extension); + return true; } } - if (extension.initExtension()) { - extensions.add(extension); - return true; - } + return false; } - return false; -} - - + @Override public IDeltaFactory getExtension(String id) throws NoSuchExtensionException { java.util.Objects.requireNonNull(id, "ID must not be null!"); - for (final IDeltaFactory extension : getExtensions()) { - if (id.equals(extension.getId())) { - return extension; + for (final IDeltaFactory extension : getExtensions()) { + if (id.equals(extension.getId())) { + return extension; + } } + throw new NoSuchExtensionException("No extension found for ID " + id); } - throw new NoSuchExtensionException("No extension found for ID " + id); -} } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/HistoryStore.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/HistoryStore.java index ab5f99b..7eb2eb4 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/HistoryStore.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/HistoryStore.java @@ -15,7 +15,8 @@ public class HistoryStore { public void addHistory(IFile file, List content, long timestamp) { IProject project = file.getProject(); - IFile historyFile = project.getFolder(historyFolder).getFolder(file.getProjectRelativePath().toOSString().replace(".", "_").replace("/", "_")) + IFile historyFile = project.getFolder(historyFolder) + .getFolder(file.getProjectRelativePath().toOSString().replace(".", "_").replace("/", "_")) .getFile(timestamp + ".java"); FileHelper.setFileLines(historyFile, content); } @@ -37,7 +38,8 @@ public boolean exists(IFile file, long timestamp) { public IFile getState(IFile file, long timestamp) { IProject project = file.getProject(); - return project.getFolder(historyFolder).getFolder(file.getProjectRelativePath().toOSString().replace(".", "_").replace("/", "_")) + return project.getFolder(historyFolder) + .getFolder(file.getProjectRelativePath().toOSString().replace(".", "_").replace("/", "_")) .getFile(timestamp + ".txt"); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDelta.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDelta.java index e5b79bd..fc62171 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDelta.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDelta.java @@ -101,8 +101,8 @@ public void setRevisedFromString(String revised) { @Override public String getRepresentation() { - return "--- (" + this.original.getPosition() + ") " + this.original.getLines() + "\n" + "+++ (" + this.revised.getPosition() + ") " - + this.revised.getLines(); + return "--- (" + this.original.getPosition() + ") " + this.original.getLines() + "\n" + "+++ (" + + this.revised.getPosition() + ") " + this.revised.getLines(); } @Override diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java index d8b8462..dc63f9f 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java @@ -62,9 +62,11 @@ public List>> createDeltas(IFile res, long timestamp, DELTA } @Override - public List>> createDeltas(IFile res, IFileState oldState, long timestamp, DELTATYPE kind) throws DiffException { + public List>> createDeltas(IFile res, IFileState oldState, long timestamp, DELTATYPE kind) + throws DiffException { // Check for null arguments - if (res == null || oldState == null || kind == null) return null; + if (res == null || oldState == null || kind == null) + return null; // Get the current mappings List currentFilelines = null; @@ -116,7 +118,8 @@ public List>> createDeltas(IFile res, IFileState oldState, @Override public IDelta> createDeltas(IFile res, IDelta originalDelta) { - if (res == null) return null; + if (res == null) + return null; if (originalDelta instanceof DefaultDelta) { DefaultDelta defaultDelta = (DefaultDelta) originalDelta; IDelta> delta = new DefaultDelta(res, getId()); @@ -133,7 +136,8 @@ public IDelta> createDeltas(IFile res, IDelta originalDelta) { @Override public List>> createDeltas(IFile original, IFile revised) throws DiffException { // Check for null arguments - if (original == null || revised == null) return null; + if (original == null || revised == null) + return null; // Get the current mappings List currentFilelines = FileHelper.getFileLines(original); @@ -275,7 +279,8 @@ public boolean verifyDelta(IFile res, IDelta> patch) { Chunk chunkOriginal = patch.getOriginal(); Chunk chunkRevised = patch.getRevised(); - if (chunkOriginal == null || chunkRevised == null) return false; + if (chunkOriginal == null || chunkRevised == null) + return false; Delta delta = null; switch (patch.getType()) { @@ -303,7 +308,8 @@ public boolean verifyDelta(IFile res, IDelta> patch) { } catch (PatchFailedException e) { return false; } catch (IndexOutOfBoundsException e) { - LogOperations.logDebug("An IndexOutOfBoundsException occured. The file used for comparision has fewer lines than what was changed by the delta."); + LogOperations.logDebug( + "An IndexOutOfBoundsException occured. The file used for comparision has fewer lines than what was changed by the delta."); return false; } return true; @@ -324,8 +330,6 @@ public IMarkerHandler getMarkerHandler() { return new DefaultMarkerHandler(); } - - @Override public boolean initExtension() { return true; diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultMarkerHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultMarkerHandler.java index 7dcb535..243fd79 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultMarkerHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultMarkerHandler.java @@ -25,7 +25,8 @@ public List getMarkersForDeltas(IFile file, List variantSyncMarkers = new ArrayList<>(); for (IDelta> delta : deltas) { Chunk revised = delta.getRevised(); - IVariantSyncMarker variantSyncMarker = new AMarkerInformation(revised.getPosition() - 1, revised.getLines().size() - 1, true); + IVariantSyncMarker variantSyncMarker = new AMarkerInformation(revised.getPosition() - 1, + revised.getLines().size() - 1, true); variantSyncMarker.setContext(delta.getContext()); variantSyncMarkers.add(variantSyncMarker); } @@ -38,7 +39,8 @@ public List getMarkers(IFile file, int offset, int length) { } @Override - public boolean updateMarkerForDelta(SourceFile sourceFile, IDelta> delta, List variantSyncMarkers) { + public boolean updateMarkerForDelta(SourceFile sourceFile, IDelta> delta, + List variantSyncMarkers) { for (CodeMapping codeMapping : sourceFile.getMappings()) { IVariantSyncMarker cmMarkerInformation = codeMapping.getMarkerInformation(); IMarker marker = MarkerUtils.getMarker(delta.getResource(), cmMarkerInformation.getMarkerId()); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDelta.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDelta.java index ee760ea..2eac777 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDelta.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDelta.java @@ -9,8 +9,9 @@ import de.tubs.variantsync.core.patch.ADelta; /** - * This interface defines delta.
Classes implementing this interface should implement also {@link #clone()} and {@link #equals(Object)}. For - * implementations see also {@link ADelta} + * This interface defines delta.
+ * Classes implementing this interface should implement also {@link #clone()} + * and {@link #equals(Object)}. For implementations see also {@link ADelta} * * @author Christopher Sontag * @version 1.0 @@ -40,7 +41,8 @@ public enum DELTATYPE { T getOriginal(); /** - * Returns original as string. Do not use this method outside of saving or loading! + * Returns original as string. Do not use this method outside of saving or + * loading! * * @return */ @@ -54,7 +56,8 @@ public enum DELTATYPE { void setOriginal(T original); /** - * Sets original from string. Do not use this method outside of saving or loading! + * Sets original from string. Do not use this method outside of saving or + * loading! * * @param original */ @@ -68,7 +71,8 @@ public enum DELTATYPE { T getRevised(); /** - * Returns revised as string. Do not use this method outside of saving or loading! + * Returns revised as string. Do not use this method outside of saving or + * loading! * * @return */ @@ -82,7 +86,8 @@ public enum DELTATYPE { void setRevised(T revised); /** - * Sets revised from string. Do not use this method outside of saving or loading! + * Sets revised from string. Do not use this method outside of saving or + * loading! * * @param revised */ diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDeltaFactory.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDeltaFactory.java index 6651ab8..1bd9e56 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDeltaFactory.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDeltaFactory.java @@ -36,9 +36,9 @@ public interface IDeltaFactory extends IExtension { /** * Creates a delta object for a resource * - * @param res - resource + * @param res - resource * @param timestamp - timestamp - * @param kind - type of change + * @param kind - type of change * @return patch object */ List> createDeltas(IFile file, long timestamp, DELTATYPE kind) throws DiffException; @@ -46,9 +46,9 @@ public interface IDeltaFactory extends IExtension { /** * Creates patch object from a changed resource. * - * @param res - resource + * @param res - resource * @param oldState - last history state - * @param kind - type of change + * @param kind - type of change * @return patch object */ List> createDeltas(IFile file, IFileState oldState, long timestamp, DELTATYPE kind) throws DiffException; @@ -56,7 +56,7 @@ public interface IDeltaFactory extends IExtension { /** * Creates a delta copy with different resource. * - * @param res - new file pointer + * @param res - new file pointer * @param originalDelta - delta to copy * @return delta copy with new file pointer */ @@ -65,7 +65,7 @@ public interface IDeltaFactory extends IExtension { /** * Creates a delta copy with different resource. * - * @param res - new file pointer + * @param res - new file pointer * @param originalDelta - delta to copy * @return delta copy with new file pointer */ @@ -74,7 +74,7 @@ public interface IDeltaFactory extends IExtension { /** * Patches a resource with a given patch. * - * @param res - resource + * @param res - resource * @param patch - patch * @return patched temp resource */ @@ -83,7 +83,7 @@ public interface IDeltaFactory extends IExtension { /** * Unpatches a revised resource for a given patch. * - * @param res - the resource + * @param res - the resource * @param patch - patch * @return original resource */ @@ -92,7 +92,7 @@ public interface IDeltaFactory extends IExtension { /** * Verifies that the given patch can be applied to the given resource * - * @param res - the resource + * @param res - the resource * @param delta - the patch to verify * @return true if the patch can be applied */ diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatch.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatch.java index bdcb3c3..8c9fec9 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatch.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatch.java @@ -14,75 +14,82 @@ public interface IPatch { /** * Add the given delta to this patch + * * @param delta - the given delta */ void addDelta(IDelta delta); - + /** * Add the given deltas to this patch + * * @param deltas - the given deltas */ void addDeltas(List> deltas); - + /** * Returns the list of all deltas + * * @return the deltas */ List> getDeltas(); - + /** * Removes the given delta from this patch + * * @param delta * @return true when the element has exist and is now removed */ boolean removeDelta(IDelta delta); - + /** * Returns the number of elements + * * @return the number of elements */ int size(); - + /** * Returns whether the list of deltas is empty + * * @return true if the list is empty */ boolean isEmpty(); - + /** * Returns the timestamp from the start of this patch + * * @return timestamp */ long getStartTime(); - + /** * * @param timestamp */ void setStartTime(long timestamp); - + /** * * @return */ long getEndTime(); - + /** * * @param timestamp */ void setEndTime(long timestamp); - + /** * * @return */ String getContext(); - + /** * * @param context */ void setContext(String context); - + } \ No newline at end of file diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatchFactory.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatchFactory.java index 6a4962f..322b800 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatchFactory.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatchFactory.java @@ -22,7 +22,7 @@ public interface IPatchFactory { /** * Patches a resource with a given patch. * - * @param res - resource + * @param res - resource * @param patch - patch * @return patched temp resource */ diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/ResourceCompareInput.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/ResourceCompareInput.java index 0cceaab..257754b 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/ResourceCompareInput.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/ResourceCompareInput.java @@ -54,7 +54,8 @@ public class ResourceCompareInput extends CompareEditorInput { /* * Creates an compare editor input for the given selection. */ - public ResourceCompareInput(CompareConfiguration config, IFile fAncestorResource, IFile fLeftResource, IFile fRightResource) { + public ResourceCompareInput(CompareConfiguration config, IFile fAncestorResource, IFile fLeftResource, + IFile fRightResource) { super(config); this.fAncestorResource = fAncestorResource; this.fLeftResource = fLeftResource; @@ -75,7 +76,8 @@ public String toString() { private ITypedElement fLastId; private String fLastName; - public MyDiffNode(IDiffContainer parent, int description, ITypedElement ancestor, ITypedElement left, ITypedElement right) { + public MyDiffNode(IDiffContainer parent, int description, ITypedElement ancestor, ITypedElement left, + ITypedElement right) { super(parent, description, ancestor, left, right); } @@ -83,7 +85,8 @@ public void fireChange() { super.fireChange(); setDirty(true); fDirty = true; - if (fDiffViewer != null) fDiffViewer.refresh(this); + if (fDiffViewer != null) + fDiffViewer.refresh(this); } void clearDirty() { @@ -91,14 +94,17 @@ void clearDirty() { } public String getName() { - if (fLastName == null) fLastName = super.getName(); - if (fDirty) return '<' + fLastName + '>'; + if (fLastName == null) + fLastName = super.getName(); + if (fDirty) + return '<' + fLastName + '>'; return fLastName; } public ITypedElement getId() { ITypedElement id = super.getId(); - if (id == null) return fLastId; + if (id == null) + return fLastId; fLastId = id; return id; } @@ -112,7 +118,8 @@ static class FilteredBufferedResourceNode extends BufferedResourceNode { protected IStructureComparator createChild(IResource child) { String name = child.getName(); - if (CompareUIPlugin.getDefault().filter(name, child instanceof IContainer, false)) return null; + if (CompareUIPlugin.getDefault().filter(name, child instanceof IContainer, false)) + return null; return new FilteredBufferedResourceNode(child); } } @@ -140,8 +147,10 @@ public void run() { Object element = ss.getFirstElement(); if (element instanceof MyDiffNode) { ITypedElement te = ((MyDiffNode) element).getId(); - if (te != null) enable = !ITypedElement.FOLDER_TYPE.equals(te.getType()); - } else enable = true; + if (te != null) + enable = !ITypedElement.FOLDER_TYPE.equals(te.getType()); + } else + enable = true; } } fOpenAction.setEnabled(enable); @@ -160,14 +169,16 @@ public void run() { public boolean isEnabled(ISelection s) { IResource[] selection = Utilities.getResources(s); - if (selection.length < 2 || selection.length > 3) return false; + if (selection.length < 2 || selection.length > 3) + return false; boolean threeWay = selection.length == 3; if (threeWay) // It only makes sense if they're all mutually comparable. // If not, the user should compare two of them. - return comparable(selection[0], selection[1]) && comparable(selection[0], selection[2]) && comparable(selection[1], selection[2]); + return comparable(selection[0], selection[1]) && comparable(selection[0], selection[2]) + && comparable(selection[1], selection[2]); return comparable(selection[0], selection[1]); } @@ -203,7 +214,8 @@ private boolean comparable(IResource c1, IResource c2) { */ private boolean hasStructure(IResource input) { - if (input instanceof IContainer) return true; + if (input instanceof IContainer) + return true; if (input instanceof IFile) { IFile file = (IFile) input; @@ -218,12 +230,14 @@ private boolean hasStructure(IResource input) { } /* - * Creates a IStructureComparator for the given input. Returns null if no IStructureComparator can be found for the - * IResource. + * Creates a IStructureComparator for the given input. Returns + * null if no IStructureComparator can be found for + * the IResource. */ private IStructureComparator getStructure(IResource input) { - if (input instanceof IContainer) return new FilteredBufferedResourceNode(input); + if (input instanceof IContainer) + return new FilteredBufferedResourceNode(input); if (input instanceof IFile) { IStructureComparator rn = new FilteredBufferedResourceNode(input); @@ -246,7 +260,8 @@ public Object prepareInput(IProgressMonitor pm) throws InvocationTargetException // with the file system appear as empty fLeftResource.refreshLocal(IResource.DEPTH_INFINITE, pm); fRightResource.refreshLocal(IResource.DEPTH_INFINITE, pm); - if (fThreeWay && fAncestorResource != null) fAncestorResource.refreshLocal(IResource.DEPTH_INFINITE, pm); + if (fThreeWay && fAncestorResource != null) + fAncestorResource.refreshLocal(IResource.DEPTH_INFINITE, pm); // end fix pm.beginTask(Utilities.getString("ResourceCompare.taskName"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ @@ -268,7 +283,8 @@ public Object prepareInput(IProgressMonitor pm) throws InvocationTargetException Differencer d = new Differencer() { protected Object visit(Object parent, int description, Object ancestor, Object left, Object right) { - return new MyDiffNode((IDiffContainer) parent, description, (ITypedElement) ancestor, (ITypedElement) left, (ITypedElement) right); + return new MyDiffNode((IDiffContainer) parent, description, (ITypedElement) ancestor, + (ITypedElement) left, (ITypedElement) right); } }; @@ -301,9 +317,11 @@ public String getToolTipText() { private String buildLabel(IResource r) { // for a linked resource in a hidden project use its local file system // location - if (r.isLinked() && r.getProject().isHidden()) return r.getLocation().toString(); + if (r.isLinked() && r.getProject().isHidden()) + return r.getLocation().toString(); String n = r.getFullPath().toString(); - if (n.charAt(0) == IPath.SEPARATOR) return n.substring(1); + if (n.charAt(0) == IPath.SEPARATOR) + return n.substring(1); return n; } @@ -313,7 +331,8 @@ public void saveChanges(IProgressMonitor pm) throws CoreException { try { commit(pm, (DiffNode) fRoot); } finally { - if (fDiffViewer != null) fDiffViewer.refresh(); + if (fDiffViewer != null) + fDiffViewer.refresh(); setDirty(false); } } @@ -324,25 +343,30 @@ public void saveChanges(IProgressMonitor pm) throws CoreException { */ private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException { - if (node instanceof MyDiffNode) ((MyDiffNode) node).clearDirty(); + if (node instanceof MyDiffNode) + ((MyDiffNode) node).clearDirty(); ITypedElement left = node.getLeft(); - if (left instanceof BufferedResourceNode) ((BufferedResourceNode) left).commit(pm); + if (left instanceof BufferedResourceNode) + ((BufferedResourceNode) left).commit(pm); ITypedElement right = node.getRight(); - if (right instanceof BufferedResourceNode) ((BufferedResourceNode) right).commit(pm); + if (right instanceof BufferedResourceNode) + ((BufferedResourceNode) right).commit(pm); IDiffElement[] children = node.getChildren(); if (children != null) { for (int i = 0; i < children.length; i++) { IDiffElement element = children[i]; - if (element instanceof DiffNode) commit(pm, (DiffNode) element); + if (element instanceof DiffNode) + commit(pm, (DiffNode) element); } } } private static String normalizeCase(String s) { - if (NORMALIZE_CASE && s != null) return s.toUpperCase(); + if (NORMALIZE_CASE && s != null) + return s.toUpperCase(); return s; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/SynchronizationHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/SynchronizationHandler.java index 8dd0262..31be470 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/SynchronizationHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/SynchronizationHandler.java @@ -28,7 +28,8 @@ public class SynchronizationHandler { /** - * Synchronizes the given delta in the given project. Returns true if the delta is successfully applied. + * Synchronizes the given delta in the given project. Returns true if the delta + * is successfully applied. * * @param project * @param delta @@ -70,7 +71,8 @@ public static boolean handleSynchronization(IProject project, IDelta delta) { String originalTmpName = String.valueOf(System.currentTimeMillis()); // fileRight.copy(fileRight.getProject().getFolder(".tmp").getFile(originalTmpName + ".txt").getFullPath(), true, null); - if (!fileRight.getProject().getFolder(".tmp").exists()) fileRight.getProject().getFolder(".tmp").create(true, false, null); + if (!fileRight.getProject().getFolder(".tmp").exists()) + fileRight.getProject().getFolder(".tmp").create(true, false, null); IFile fileOriginal = fileRight.getProject().getFolder(".tmp").getFile(originalTmpName + ".txt"); fileOriginal.create(fileRight.getContents(), true, null); CompareEditorInput rci = new ResourceCompareInput(compconf, fileBase, fileLeft, fileRight); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/TargetsCalculator.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/TargetsCalculator.java index cf5e152..4450905 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/TargetsCalculator.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/TargetsCalculator.java @@ -34,8 +34,10 @@ public List getTargetsWithoutConflict(IDelta delta) { ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); for (IProject project : configurationProject.getVariants()) { Configuration config = configurationProject.getConfigurationForVariant(project); - if (config == null || !config.getSelectedFeatureNames().contains(delta.getContext())) continue; - if (project != delta.getProject() && isTargetWithoutConflict(project, delta) && !delta.getSynchronizedProjects().contains(project)) + if (config == null || !config.getSelectedFeatureNames().contains(delta.getContext())) + continue; + if (project != delta.getProject() && isTargetWithoutConflict(project, delta) + && !delta.getSynchronizedProjects().contains(project)) targets.add(project); } return targets; @@ -52,15 +54,18 @@ public List getTargetsWithConflict(IDelta delta) { ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); for (IProject project : configurationProject.getVariants()) { Configuration config = configurationProject.getConfigurationForVariant(project); - if (config == null || !config.getSelectedFeatureNames().contains(delta.getContext())) continue; - if (project != delta.getProject() && isTargetWithConflict(project, delta) && !delta.getSynchronizedProjects().contains(project)) + if (config == null || !config.getSelectedFeatureNames().contains(delta.getContext())) + continue; + if (project != delta.getProject() && isTargetWithConflict(project, delta) + && !delta.getSynchronizedProjects().contains(project)) targets.add(project); } return targets; } /** - * Returns all target projects which have feature context selected in their configuration + * Returns all target projects which have feature context selected in their + * configuration * * @param deltas * @return @@ -73,8 +78,9 @@ public List getTargetsForFeatureContext(List> deltas) { Configuration config = configurationProject.getConfigurationForVariant(project); if (config != null) { for (IDelta delta : deltas) { - if (config.getSelectedFeatureNames().contains(delta.getContext()) && !targets.contains(project) && (!delta.getProject().equals(project)) - && !delta.getSynchronizedProjects().contains(project)) { + if (config.getSelectedFeatureNames().contains(delta.getContext()) && !targets.contains(project) + && (!delta.getProject().equals(project)) + && !delta.getSynchronizedProjects().contains(project)) { targets.add(project); } } @@ -85,7 +91,8 @@ public List getTargetsForFeatureContext(List> deltas) { } /** - * Checks whether the given delta can be applied to the given project without conflicts. + * Checks whether the given delta can be applied to the given project without + * conflicts. * * @param project * @param delta @@ -110,13 +117,16 @@ public boolean isTargetWithoutConflict(IProject project, IDelta delta) { } catch (NoSuchExtensionException e) { LogOperations.logError("PatchFactory not found", e); } - if (factory == null) return false; - if (factory.verifyDelta(file, delta)) return true; + if (factory == null) + return false; + if (factory.verifyDelta(file, delta)) + return true; return false; } /** - * Checks whether the given delta can be applied to the given project with conflicts. + * Checks whether the given delta can be applied to the given project with + * conflicts. * * @param project * @param delta diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/AMarkerInformation.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/AMarkerInformation.java index 890aea2..e432abc 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/AMarkerInformation.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/AMarkerInformation.java @@ -21,9 +21,9 @@ public class AMarkerInformation implements IVariantSyncMarker { * Constructor * * @param markerId - marker id - * @param offset - offset - * @param length - length - * @param line - if true, the offset and length are interpreted as mappings + * @param offset - offset + * @param length - length + * @param line - if true, the offset and length are interpreted as mappings */ public AMarkerInformation(long markerId, int offset, int length, boolean line) { this.markerId = markerId; @@ -37,7 +37,7 @@ public AMarkerInformation(long markerId, int offset, int length, boolean line) { * * @param offset - offset * @param length - length - * @param line - if true, the offset and length are interpreted as mappings + * @param line - if true, the offset and length are interpreted as mappings */ public AMarkerInformation(int offset, int length, boolean line) { this.markerId = UUID.randomUUID().getMostSignificantBits(); @@ -50,7 +50,7 @@ public AMarkerInformation(int offset, int length, boolean line) { * Constructor * * @param markerId - marker id - * @param line - line + * @param line - line */ public AMarkerInformation(long markerId, int line) { this.markerId = markerId; @@ -173,7 +173,8 @@ public void setLine(boolean isLine) { @Override public String toString() { - return String.format("AMarkerInformation [markerId=%s, offset=%s, length=%s, expression=%s, isLine=%s]", markerId, offset, length, expression, isLine); + return String.format("AMarkerInformation [markerId=%s, offset=%s, length=%s, expression=%s, isLine=%s]", + markerId, offset, length, expression, isLine); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/FileHelper.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/FileHelper.java index dc20e44..d9a1110 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/FileHelper.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/FileHelper.java @@ -19,7 +19,8 @@ import org.eclipse.core.runtime.CoreException; /** - * Class to retrieve file content when the workspace is busy. This class also enables to retrieve history states. + * Class to retrieve file content when the workspace is busy. This class also + * enables to retrieve history states. * * @author Christopher Sontag */ @@ -87,9 +88,10 @@ public static void setFileLines(IFile res, List lines) { } /** - * Reads content from file using buffered reader. Adds each line in file to List. + * Reads content from file using buffered reader. Adds each line in file to + * List. * - * @param in buffered Reader for file + * @param in buffered Reader for file * @param charset * @return list with file content */ @@ -97,7 +99,8 @@ private static List readFile(InputStream in, String charset) { List fileContent = new LinkedList(); String line = ""; BufferedReader reader = null; - if (charset == null) charset = (String) "UTF-8"; + if (charset == null) + charset = (String) "UTF-8"; try { reader = new BufferedReader(new InputStreamReader(in, charset)); while ((line = reader.readLine()) != null) { @@ -116,7 +119,8 @@ private static List readFile(InputStream in, String charset) { } /** - * Writes content to a IFile resource using a buffered writer. Each line is one item in lines + * Writes content to a IFile resource using a buffered writer. Each line is one + * item in lines * * @param res * @param lines @@ -127,7 +131,8 @@ public static void writeFile(IFile res, List lines) { file.delete(); } File parentDir = file.getParentFile(); - if (!parentDir.exists()) parentDir.mkdirs(); + if (!parentDir.exists()) + parentDir.mkdirs(); PrintWriter out = null; try { file.createNewFile(); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/LogOperations.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/LogOperations.java index cb40bfe..3ec8ca8 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/LogOperations.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/LogOperations.java @@ -15,7 +15,8 @@ */ public class LogOperations { - private LogOperations() {} + private LogOperations() { + } /** * Logs specified information. @@ -40,7 +41,7 @@ public static void logDebug(String message) { /** * Logs specified error. * - * @param message human-readable message, localized to the current locale + * @param message human-readable message, localized to the current locale * @param exception low-level exception, or null if not applicable */ public static void logError(String message, Throwable exception) { @@ -50,11 +51,12 @@ public static void logError(String message, Throwable exception) { /** * Logs specified information. * - * @param severity the severity; one of the following: IStatus.OK, IStatus.ERROR, IStatus.INFO, or - * IStatus.WARNING - * @param pluginId unique identifier of the relevant plug-in - * @param code plug-in-specific status code, or OK - * @param message human-readable message, localized to the current locale + * @param severity the severity; one of the following: IStatus.OK, + * IStatus.ERROR, IStatus.INFO, or + * IStatus.WARNING + * @param pluginId unique identifier of the relevant plug-in + * @param code plug-in-specific status code, or OK + * @param message human-readable message, localized to the current locale * @param exception low-level exception, or null if not applicable */ public static void log(int severity, int code, String message, Throwable exception) { @@ -64,11 +66,12 @@ public static void log(int severity, int code, String message, Throwable excepti /** * Creates status object representing specified information. * - * @param severity the severity; one of the following: IStatus.OK, IStatus.ERROR, IStatus.INFO, or - * IStatus.WARNING - * @param pluginId unique identifier of the relevant plug-in - * @param code plug-in-specific status code, or OK - * @param message human-readable message, localized to the current locale + * @param severity the severity; one of the following: IStatus.OK, + * IStatus.ERROR, IStatus.INFO, or + * IStatus.WARNING + * @param pluginId unique identifier of the relevant plug-in + * @param code plug-in-specific status code, or OK + * @param message human-readable message, localized to the current locale * @param exception low-level exception, or null if not applicable. * @return the status object (not null) */ diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/MarkerUtils.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/MarkerUtils.java index 13c7009..f583a02 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/MarkerUtils.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/MarkerUtils.java @@ -26,11 +26,12 @@ */ public class MarkerUtils { - private static List annotationMarkers = Arrays.asList("de.tubs.variantsync.marker.highlighter.red", "de.tubs.variantsync.marker.highlighter.orange", - "de.tubs.variantsync.marker.highlighter.yellow", "de.tubs.variantsync.marker.highlighter.darkgreen", - "de.tubs.variantsync.marker.highlighter.lightgreen", "de.tubs.variantsync.marker.highlighter.cyan", - "de.tubs.variantsync.marker.highlighter.lightgrey", "de.tubs.variantsync.marker.highlighter.blue", - "de.tubs.variantsync.marker.highlighter.margenta", "de.tubs.variantsync.marker.highlighter.pink"); + private static List annotationMarkers = Arrays.asList("de.tubs.variantsync.marker.highlighter.red", + "de.tubs.variantsync.marker.highlighter.orange", "de.tubs.variantsync.marker.highlighter.yellow", + "de.tubs.variantsync.marker.highlighter.darkgreen", "de.tubs.variantsync.marker.highlighter.lightgreen", + "de.tubs.variantsync.marker.highlighter.cyan", "de.tubs.variantsync.marker.highlighter.lightgrey", + "de.tubs.variantsync.marker.highlighter.blue", "de.tubs.variantsync.marker.highlighter.margenta", + "de.tubs.variantsync.marker.highlighter.pink"); /** * Removes all markers for all projects in the list @@ -93,7 +94,8 @@ public static List getMarkers(IResource res) { try { returnList.addAll(Arrays.asList(res.findMarkers(marker, true, IResource.DEPTH_INFINITE))); } catch (CoreException e) { - LogOperations.logError("File does not exists or can not be accessed because the project is closed", e); + LogOperations.logError("File does not exists or can not be accessed because the project is closed", + e); } } } @@ -128,8 +130,8 @@ private static String getMarker(FeatureColor color) { * Adds a marker to the resource * * @param res - * @param start - Starting line - * @param end - Ending line + * @param start - Starting line + * @param end - Ending line * @param context * @param color */ @@ -163,7 +165,8 @@ public static void setMarker(IFile file, List markers) { try { IDocument document = null; try { - document = (IDocument) VariantSyncPlugin.getEditor().getDocumentProvider().getDocument(VariantSyncPlugin.getEditor().getEditorInput()); + document = (IDocument) VariantSyncPlugin.getEditor().getDocumentProvider() + .getDocument(VariantSyncPlugin.getEditor().getEditorInput()); } catch (NullPointerException e) { LogOperations.logError("Marker line is not available in the document", e); } @@ -173,7 +176,8 @@ public static void setMarker(IFile file, List markers) { int start = regionStart.getOffset(); int end = regionStart.getOffset() + regionEnd.getLength(); - markerId = addMarker(file, start, end, configurationProject.getFeatureContextManager().getContext(mi.getContext())); + markerId = addMarker(file, start, end, + configurationProject.getFeatureContextManager().getContext(mi.getContext())); } catch (BadLocationException e) { e.printStackTrace(); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/Tree.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/Tree.java index fbdd51b..d86c17b 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/Tree.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/Tree.java @@ -69,7 +69,8 @@ private TreeNode auxiliaryFind(TreeNode currentNode, Object dataToFind) { TreeNode returnNode = null; int i = 0; - if (currentNode == null || dataToFind == null) return null; + if (currentNode == null || dataToFind == null) + return null; if (currentNode.getData() != null) { if (currentNode.getData().equals(dataToFind)) { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/TreeNode.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/TreeNode.java index 86c56b2..428eaff 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/TreeNode.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/TreeNode.java @@ -106,6 +106,7 @@ public boolean equals(Object obj) { /* * (non-Javadoc) + * * @see java.lang.Object#hashCode() */ @Override diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/VariantSyncProgressMonitor.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/VariantSyncProgressMonitor.java index a106000..26633bb 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/VariantSyncProgressMonitor.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/VariantSyncProgressMonitor.java @@ -4,18 +4,19 @@ /** * A progress monitor to keep track of probably time intensive jobs + * * @author Christopher Sontag * @since 1.1 */ public class VariantSyncProgressMonitor implements IProgressMonitor { private static final String PREFIX = "VariantSync "; - + private boolean isCanceled = false; private String taskName = ""; private String subTaskName = ""; public double worked = 0; - + public VariantSyncProgressMonitor(String taskName) { super(); this.taskName = taskName; @@ -84,7 +85,5 @@ public void setWorked(double worked) { public String getTaskName() { return taskName; } - - } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventListener.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventListener.java index fed7509..75f1f0f 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventListener.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventListener.java @@ -1,16 +1,15 @@ package de.tubs.variantsync.core.utilities.event; /** - * Interface for components listening to events fired by other components. - *
- * Some classes of FeatureIDE use the observer-pattern, to notify listening clients. - * For instance, a feature model fires a "model data changed" event when the model is - * changed. Listening clients, e.g., the diagram editor can react on this event. - *
+ * Interface for components listening to events fired by other components.
+ * Some classes of FeatureIDE use the observer-pattern, to notify listening + * clients. For instance, a feature model fires a "model data changed" event + * when the model is changed. Listening clients, e.g., the diagram editor can + * react on this event.
*
* The follow sketch outlines the observer-pattern usage in FeatureIDE, taken - * {@link de.ovgu.featureide.fm.ui.editors.FeatureDiagramEditor} and {@link FeatureModel} as example. - *
+ * {@link de.ovgu.featureide.fm.ui.editors.FeatureDiagramEditor} and
+ * {@link FeatureModel} as example. 
  * IEventListener  <--- propertyChange is called ---------
  *       |                                               |
  *       |                                               |
@@ -18,9 +17,9 @@
  *       |                                               |
  *       V                                               |       										  
  *  Receiver -- register  as listener ---> Sender
- * 
- *
- * Please note that events fired and received over this interface are from type {@link VariantSyncEvent}. + *

+ * Please note that events fired and received over this interface are from type + * {@link VariantSyncEvent}. * * @author Sebastian Krieter */ diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventManager.java index 6d36295..065fba3 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventManager.java @@ -3,16 +3,17 @@ import de.ovgu.featureide.fm.core.base.event.FeatureIDEEvent; /** - * Broadcasts {@link FeatureIDEEvent Events} to the corresponding {@link IEventListener IFeatureModelListeners}. + * Broadcasts {@link FeatureIDEEvent Events} to the corresponding + * {@link IEventListener IFeatureModelListeners}. * * @author Sebastian Krieter */ public interface IEventManager { - + void addListener(IEventListener listener); void fireEvent(VariantSyncEvent event); void removeListener(IEventListener listener); - + } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/VariantSyncEvent.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/VariantSyncEvent.java index be11ea7..075d981 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/VariantSyncEvent.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/VariantSyncEvent.java @@ -21,13 +21,13 @@ package de.tubs.variantsync.core.utilities.event; /** - * Event triggered by changes to a feature model or its elements. - *
+ * Event triggered by changes to a feature model or its elements.
*
* Each event contains the following information: *
    *
  • an event type which determine the kind of event
  • - *
  • the sender (source) of this event, i.e., which object fired this event
  • + *
  • the sender (source) of this event, i.e., which object fired this + * event
  • *
  • the old value (if available), and the new value
  • *
*
@@ -35,7 +35,8 @@ * This events are intended to be processed by {@link IEventListener} instances. *
*
- * For usage to fire VariantSyncEvents, see {@link ConfigurationProject#fireEvent(VariantSyncEvent)}. + * For usage to fire VariantSyncEvents, see + * {@link ConfigurationProject#fireEvent(VariantSyncEvent)}. * * @author Sebastian Krieter * @author Marcus Pinnecke @@ -89,7 +90,7 @@ public enum EventType { */ CONFIGURATIONPROJECT_SET, /** - * The configuration project has changed + * The configuration project has changed */ CONFIGURATIONPROJECT_CHANGED, /** @@ -99,24 +100,24 @@ public enum EventType { /** * A variant was removed */ - VARIANT_REMOVED, + VARIANT_REMOVED, /** * Call after all projects are initalized */ INITALIZED } - + static VariantSyncEvent[] defaultEvents = new VariantSyncEvent[EventType.values().length]; static { for (EventType e : EventType.values()) { defaultEvents[e.ordinal()] = new VariantSyncEvent(e); } } - + public static VariantSyncEvent getDefault(final EventType e) { return defaultEvents[e.ordinal()]; } - + private final Object source; private final EventType eventType; private final Object oldValue; @@ -125,7 +126,7 @@ public static VariantSyncEvent getDefault(final EventType e) { private VariantSyncEvent(EventType e) { this(null, e); } - + public VariantSyncEvent(Object source, EventType eventType) { this(source, eventType, null, null); } @@ -158,5 +159,5 @@ public String toString() { return "VariantSyncEvent [source=" + source + ", eventType=" + eventType + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; } - + } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/ActiveContextHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/ActiveContextHandler.java index cbcc2e5..494076c 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/ActiveContextHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/ActiveContextHandler.java @@ -29,8 +29,10 @@ public boolean isEnabled() { public Object execute(ExecutionEvent event) throws ExecutionException { boolean oldValue = active; VariantSyncPlugin.getActiveMappingManager().setActive(!oldValue); - if (!oldValue) updateElement.setIcon(VariantSyncPlugin.getDefault().getImageDescriptor("icons/nav_stop.gif")); - else updateElement.setIcon(VariantSyncPlugin.getDefault().getImageDescriptor("icons/nav_go.gif")); + if (!oldValue) + updateElement.setIcon(VariantSyncPlugin.getDefault().getImageDescriptor("icons/nav_stop.gif")); + else + updateElement.setIcon(VariantSyncPlugin.getDefault().getImageDescriptor("icons/nav_go.gif")); active = !oldValue; return null; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/DynamicContextPopupItems.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/DynamicContextPopupItems.java index 9d9fcb8..19624a6 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/DynamicContextPopupItems.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/DynamicContextPopupItems.java @@ -31,8 +31,10 @@ */ public class DynamicContextPopupItems extends ContributionItem implements IEventListener { - public static Image base = VariantSyncPlugin.imageDescriptorFromPlugin(VariantSyncPlugin.PLUGIN_ID, "icons/public_co.gif").createImage(); - public static Image composed = VariantSyncPlugin.imageDescriptorFromPlugin(VariantSyncPlugin.PLUGIN_ID, "icons/protected_co.gif").createImage(); + public static Image base = VariantSyncPlugin + .imageDescriptorFromPlugin(VariantSyncPlugin.PLUGIN_ID, "icons/public_co.gif").createImage(); + public static Image composed = VariantSyncPlugin + .imageDescriptorFromPlugin(VariantSyncPlugin.PLUGIN_ID, "icons/protected_co.gif").createImage(); @Override public void fill(final Menu menu, int index) { @@ -56,7 +58,8 @@ public void widgetSelected(SelectionEvent e) { } private void handleSelection(FeatureContext fe) { - IEditorPart editorPart = VariantSyncPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); + IEditorPart editorPart = VariantSyncPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow() + .getActivePage().getActiveEditor(); if (editorPart instanceof AbstractTextEditor) { int offset = 0; int length = 0; diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/SelectContextContribution.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/SelectContextContribution.java index b1aae06..6494bfe 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/SelectContextContribution.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/SelectContextContribution.java @@ -18,11 +18,13 @@ import de.tubs.variantsync.core.utilities.event.VariantSyncEvent; /** - * Contributes the combobox in the menu bar for selecting the current feature context + * Contributes the combobox in the menu bar for selecting the current feature + * context * * @author Christopher Sontag */ -public class SelectContextContribution extends WorkbenchWindowControlContribution implements SelectionListener, IEventListener { +public class SelectContextContribution extends WorkbenchWindowControlContribution + implements SelectionListener, IEventListener { private CCombo selContext; diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/editor/PartAdapter.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/editor/PartAdapter.java index f754973..5b7ae21 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/editor/PartAdapter.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/editor/PartAdapter.java @@ -26,7 +26,8 @@ import de.tubs.variantsync.core.utilities.event.VariantSyncEvent; /** - * PartAdapter for the editor. Creates and updates the markers of the current file of the editor + * PartAdapter for the editor. Creates and updates the markers of the current + * file of the editor * * @author Tristan Pfofe (tristan.pfofe@ckc.de) * @author Christopher Sontag @@ -129,7 +130,8 @@ public IStatus runInUIThread(IProgressMonitor monitor) { markers.add(codeMapping.getMarkerInformation()); } } - if (!markers.isEmpty()) MarkerUtils.setMarker(currentFile, markers); + if (!markers.isEmpty()) + MarkerUtils.setMarker(currentFile, markers); } return Status.OK_STATUS; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextHandler.java index 7080953..7f5c1a8 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextHandler.java @@ -17,10 +17,12 @@ public class FeatureContextHandler implements IHandler { @Override - public void addHandlerListener(IHandlerListener handlerListener) {} + public void addHandlerListener(IHandlerListener handlerListener) { + } @Override - public void dispose() {} + public void dispose() { + } @Override public Object execute(ExecutionEvent event) throws ExecutionException { @@ -44,6 +46,7 @@ public boolean isHandled() { } @Override - public void removeHandlerListener(IHandlerListener handlerListener) {} + public void removeHandlerListener(IHandlerListener handlerListener) { + } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextManagerPage.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextManagerPage.java index 9be1d43..7a2a6e2 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextManagerPage.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextManagerPage.java @@ -59,7 +59,8 @@ public void handleEvent(Event event) { Table table = (Table) event.widget; int columnCount = table.getColumnCount(); - if (columnCount == 0) return; + if (columnCount == 0) + return; Rectangle area = table.getClientArea(); int totalAreaWdith = area.width; int lineWidth = table.getGridLineWidth(); @@ -103,7 +104,8 @@ public void widgetSelected(SelectionEvent e) { } @Override - public void widgetDefaultSelected(SelectionEvent e) {} + public void widgetDefaultSelected(SelectionEvent e) { + } }); button = new Button(buttonComposite, SWT.NULL); button.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ETOOL_CLEAR)); @@ -115,7 +117,8 @@ public void widgetSelected(SelectionEvent e) { } @Override - public void widgetDefaultSelected(SelectionEvent e) {} + public void widgetDefaultSelected(SelectionEvent e) { + } }); button = new Button(buttonComposite, SWT.NULL); button.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ETOOL_DELETE)); @@ -127,7 +130,8 @@ public void widgetSelected(SelectionEvent e) { } @Override - public void widgetDefaultSelected(SelectionEvent e) {} + public void widgetDefaultSelected(SelectionEvent e) { + } }); updateFeatureContextList(); @@ -138,7 +142,8 @@ public void widgetDefaultSelected(SelectionEvent e) {} private void editFeatureContext() { final TableItem[] selection = tabContexts.getSelection(); if (selection.length == 1) { - WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), new FeatureContextWizard((FeatureContext) selection[0].getData())); + WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), + new FeatureContextWizard((FeatureContext) selection[0].getData())); dialog.create(); if (dialog.open() == Window.OK) { this.updateFeatureContextList(); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizard.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizard.java index 85cc616..035b72b 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizard.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizard.java @@ -29,14 +29,14 @@ public class FeatureContextWizard extends Wizard { public FeatureContextWizard(FeatureContext context) { super(); setWindowTitle("Feature ConfigurationProject Wizard"); - + { ConfigurationProject activeConfigurationProject = VariantSyncPlugin.getActiveConfigurationProject(); - + if (activeConfigurationProject == null) { throw new ProjectNotFoundException(ProjectNotFoundException.Type.CONFIGURATION); } - + IFeatureProject featureProject = activeConfigurationProject.getFeatureProject(); IFeatureModel featuremodel = featureProject.getFeatureModel(); this.features = featuremodel.getFeatures(); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizardPage.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizardPage.java index bd60fbc..30563bb 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizardPage.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizardPage.java @@ -115,7 +115,8 @@ public void modifyText(ModifyEvent e) { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { - return ((IFeature) element).getName().toLowerCase(Locale.ENGLISH).contains(txtSearch.getText().toLowerCase(Locale.ENGLISH)); + return ((IFeature) element).getName().toLowerCase(Locale.ENGLISH) + .contains(txtSearch.getText().toLowerCase(Locale.ENGLISH)); } }; tabFeatures.addFilter(searchFilter); @@ -188,9 +189,11 @@ public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { txtContext = new SimpleSyntaxHighlightEditor(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.BORDER, Operator.NAMES); txtContext.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - if (featureContext != null) txtContext.setText(featureContext.name); + if (featureContext != null) + txtContext.setText(featureContext.name); txtContext.setMargins(10, 5, 3, 5); - if (featureContext != null) txtContext.setBackground(ColorPalette.toSwtColor(featureContext.highlighter)); + if (featureContext != null) + txtContext.setBackground(ColorPalette.toSwtColor(featureContext.highlighter)); txtContext.addModifyListener(new ModifyListener() { @@ -208,7 +211,8 @@ public void modifyText(ModifyEvent e) { colors.add(color.getColorName()); } cbColors.setItems(colors.toArray(new String[] {})); - if (featureContext != null) cbColors.select(featureContext.highlighter.ordinal()); + if (featureContext != null) + cbColors.select(featureContext.highlighter.ordinal()); cbColors.addSelectionListener(new SelectionListener() { @@ -218,7 +222,8 @@ public void widgetSelected(SelectionEvent e) { } @Override - public void widgetDefaultSelected(SelectionEvent e) {} + public void widgetDefaultSelected(SelectionEvent e) { + } }); setControl(composite); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/View.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/View.java index d83fcac..7127f9d 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/View.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/View.java @@ -58,10 +58,12 @@ public void partBroughtToTop(IWorkbenchPart part) { } @Override - public void partClosed(IWorkbenchPart part) {} + public void partClosed(IWorkbenchPart part) { + } @Override - public void partDeactivated(IWorkbenchPart part) {} + public void partDeactivated(IWorkbenchPart part) { + } @Override public void partOpened(IWorkbenchPart part) { @@ -92,7 +94,8 @@ public void handleEvent(Event event) { Table table = (Table) event.widget; int columnCount = table.getColumnCount(); - if (columnCount == 0) return; + if (columnCount == 0) + return; Rectangle area = table.getClientArea(); int totalAreaWdith = area.width; int lineWidth = table.getGridLineWidth(); @@ -132,7 +135,8 @@ public void run() { createFeatureExpression(); } }; - addExpression.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_ADD)); + addExpression.setImageDescriptor( + PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_ADD)); toolBarManager.add(addExpression); IAction editExpression = new Action("", Action.AS_PUSH_BUTTON) { @@ -142,7 +146,8 @@ public void run() { editFeatureExpression(); } }; - editExpression.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_CLEAR)); + editExpression.setImageDescriptor( + PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_CLEAR)); toolBarManager.add(editExpression); IAction removeExpression = new Action("", Action.AS_PUSH_BUTTON) { @@ -152,7 +157,8 @@ public void run() { deleteFeatureExpression(); } }; - removeExpression.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_DELETE)); + removeExpression.setImageDescriptor( + PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_DELETE)); toolBarManager.add(removeExpression); } @@ -167,7 +173,8 @@ private void editFeatureExpression() { if (!featureExpressionTable.isDisposed()) { final TableItem[] selection = featureExpressionTable.getSelection(); if (selection.length == 1) { - WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), new FeatureContextWizard((FeatureContext) selection[0].getData())); + WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), + new FeatureContextWizard((FeatureContext) selection[0].getData())); dialog.create(); if (dialog.open() == Window.OK) { this.updateFeatureExpressionList(); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourceChangesColumnLabelProvider.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourceChangesColumnLabelProvider.java index 2b55245..91a5fd9 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourceChangesColumnLabelProvider.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourceChangesColumnLabelProvider.java @@ -48,11 +48,13 @@ public void update(ViewerCell cell) { break; case CHANGED: cell.setText("CHANGED"); - cell.setImage(VariantSyncPlugin.getDefault().getImageDescriptor("icons/change_obj.gif").createImage()); + cell.setImage( + VariantSyncPlugin.getDefault().getImageDescriptor("icons/change_obj.gif").createImage()); break; case REMOVED: cell.setText("REMOVED"); - cell.setImage(VariantSyncPlugin.getDefault().getImageDescriptor("icons/delete_obj.gif").createImage()); + cell.setImage( + VariantSyncPlugin.getDefault().getImageDescriptor("icons/delete_obj.gif").createImage()); break; default: break; @@ -75,7 +77,8 @@ public void update(ViewerCell cell) { for (IProject project : ((IDelta) o).getSynchronizedProjects()) { projects += project.getName() + ", "; } - projects = projects.lastIndexOf(",") == -1 ? projects : projects.substring(0, projects.lastIndexOf(",")); + projects = projects.lastIndexOf(",") == -1 ? projects + : projects.substring(0, projects.lastIndexOf(",")); cell.setText(projects); } break; @@ -85,7 +88,8 @@ public void update(ViewerCell cell) { for (IProject project : targetsCalculator.getTargetsWithConflict(((IDelta) o))) { projects += project.getName() + ", "; } - projects = projects.lastIndexOf(",") == -1 ? projects : projects.substring(0, projects.lastIndexOf(",")); + projects = projects.lastIndexOf(",") == -1 ? projects + : projects.substring(0, projects.lastIndexOf(",")); cell.setText(projects); } break; @@ -95,7 +99,8 @@ public void update(ViewerCell cell) { for (IProject project : targetsCalculator.getTargetsWithoutConflict(((IDelta) o))) { projects += project.getName() + ", "; } - projects = projects.lastIndexOf(",") == -1 ? projects : projects.substring(0, projects.lastIndexOf(",")); + projects = projects.lastIndexOf(",") == -1 ? projects + : projects.substring(0, projects.lastIndexOf(",")); cell.setText(projects); } break; diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourcesTree.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourcesTree.java index 0e26298..b893e7f 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourcesTree.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourcesTree.java @@ -13,12 +13,12 @@ * @author Christopher Sontag */ public class ResourcesTree { - + public static Tree construct(List> patches) { Tree tree = new Tree(); TreeNode root = new TreeNode(); tree.setRoot(root); - + for (IPatch patch : patches) { for (IDelta delta : patch.getDeltas()) { TreeNode featureNode = tree.find(delta.getContext()); @@ -38,7 +38,7 @@ public static Tree construct(List> patches) { } } } - + return tree; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/View.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/View.java index 3ac6456..685552e 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/View.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/View.java @@ -107,9 +107,11 @@ public void run() { PatchesManager patchesManager = configurationProject.getPatchesManager(); List> patches = patchesManager.getPatches(); IPatch actualPatch = patchesManager.getActualContextPatch(); - if (actualPatch != null && !patches.contains(actualPatch)) patches.add(actualPatch); + if (actualPatch != null && !patches.contains(actualPatch)) + patches.add(actualPatch); - if (patches != null && !patches.isEmpty()) tvResourceChanges.setInput(ResourcesTree.construct(patches)); + if (patches != null && !patches.isEmpty()) + tvResourceChanges.setInput(ResourcesTree.construct(patches)); tvResourceChanges.expandToLevel(3); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/View.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/View.java index 8cc1054..ccf20a6 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/View.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/View.java @@ -56,17 +56,17 @@ public class View extends ViewPart implements SelectionListener, ISelectionChang private static class ComboBoxSelectionDispatcher implements Runnable { private Combo combobox; public int selectionIndex = -1; - + public ComboBoxSelectionDispatcher(Combo combobox) { this.combobox = combobox; } - + @Override public void run() { selectionIndex = combobox.getSelectionIndex(); } } - + public static final String ID = VariantSyncPlugin.PLUGIN_ID + ".views.sourcefocus"; private Combo cbFeature; @@ -109,7 +109,9 @@ public void createPartControl(Composite parent) { gridData.grabExcessHorizontalSpace = true; cbFeature.setLayoutData(gridData); ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); - if (configurationProject != null) cbFeature.setItems(configurationProject.getFeatureContextManager().getContextsAsStrings().toArray(new String[] {})); + if (configurationProject != null) + cbFeature.setItems( + configurationProject.getFeatureContextManager().getContextsAsStrings().toArray(new String[] {})); cbFeature.select(0); cbFeature.addSelectionListener(this); @@ -270,7 +272,8 @@ public void run() { PatchesManager patchesManager = configurationProject.getPatchesManager(); List> patches = patchesManager.getPatches(); IPatch actualPatch = patchesManager.getActualContextPatch(); - if (actualPatch != null && !patches.contains(actualPatch)) patches.add(actualPatch); + if (actualPatch != null && !patches.contains(actualPatch)) + patches.add(actualPatch); if (patches != null && !patches.isEmpty() && !tvChanges.getControl().isDisposed()) { tvChanges.setInput(ProjectTree.construct(feature, patches)); @@ -289,7 +292,8 @@ public void selectionChanged(SelectionChangedEvent event) { ITreeSelection selection = tvChanges.getStructuredSelection(); if (selection.size() == 1) { Object o = selection.getFirstElement(); - if (o instanceof TreeNode) o = ((TreeNode) o).getData(); + if (o instanceof TreeNode) + o = ((TreeNode) o).getData(); if (o instanceof IDelta) { IDelta delta = ((IDelta) o); lastSelections.add(delta); @@ -301,10 +305,12 @@ public void selectionChanged(SelectionChangedEvent event) { IPath res = null; String ret = ""; for (Object o : selection.toList()) { - if (o instanceof TreeNode) o = ((TreeNode) o).getData(); + if (o instanceof TreeNode) + o = ((TreeNode) o).getData(); if (o instanceof IDelta) { IDelta delta = ((IDelta) o); - if (res == null) res = delta.getResource().getProjectRelativePath(); + if (res == null) + res = delta.getResource().getProjectRelativePath(); if (!res.equals(delta.getResource().getProjectRelativePath())) { lbChange.setDocument(new Document("No multiple resources supported")); return; @@ -322,7 +328,8 @@ private void updateTargets() { List targets = targetsCalculator.getTargetsForFeatureContext(lastSelections); if (targets != null && !targetsList.isDisposed()) { targetsList.setItems(getProjectNames(targets).toArray(new String[] {})); - if (!targets.isEmpty()) btnSync.setEnabled(true); + if (!targets.isEmpty()) + btnSync.setEnabled(true); } } @@ -348,7 +355,8 @@ public void propertyChange(VariantSyncEvent event) { case FEATURECONTEXT_REMOVED: ComboBoxSelectionDispatcher dispatcher = new ComboBoxSelectionDispatcher(cbFeature); Display.getDefault().syncExec(dispatcher); - cbFeature.setItems(VariantSyncPlugin.getActiveFeatureContextManager().getContextsAsStrings().toArray(new String[] {})); + cbFeature.setItems( + VariantSyncPlugin.getActiveFeatureContextManager().getContextsAsStrings().toArray(new String[] {})); cbFeature.select(dispatcher.selectionIndex); default: break; diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/View.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/View.java index 94b15c6..1e3b25e 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/View.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/View.java @@ -94,7 +94,8 @@ public void createPartControl(Composite parent) { gridData.grabExcessHorizontalSpace = true; cbVariant.setLayoutData(gridData); ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); - if (configurationProject != null) cbVariant.setItems(configurationProject.getVariantNames().toArray(new String[] {})); + if (configurationProject != null) + cbVariant.setItems(configurationProject.getVariantNames().toArray(new String[] {})); cbVariant.addSelectionListener(this); tvChanges = new TreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); @@ -210,17 +211,21 @@ public void run() { PatchesManager patchesManager = configurationProject.getPatchesManager(); List> patches = patchesManager.getPatches(); IPatch actualPatch = patchesManager.getActualContextPatch(); - if (actualPatch != null && !patches.contains(actualPatch)) patches.add(actualPatch); + if (actualPatch != null && !patches.contains(actualPatch)) + patches.add(actualPatch); - Configuration config = configurationProject.getConfigurationForVariant(configurationProject.getVariant(project)); + Configuration config = configurationProject + .getConfigurationForVariant(configurationProject.getVariant(project)); if (config != null) { Set selectedFeatures = config.getSelectedFeatureNames(); List> checkedPatches = new ArrayList<>(); for (IPatch patch : patches) { - if (selectedFeatures.contains(patch.getContext())) checkedPatches.add(patch); + if (selectedFeatures.contains(patch.getContext())) + checkedPatches.add(patch); } - if (patches != null && !patches.isEmpty()) tvChanges.setInput(FeatureTree.construct(project, checkedPatches)); + if (patches != null && !patches.isEmpty()) + tvChanges.setInput(FeatureTree.construct(project, checkedPatches)); tvChanges.expandToLevel(3); } } @@ -237,7 +242,8 @@ public void selectionChanged(SelectionChangedEvent event) { // Only one element selected if (selection.size() == 1) { Object o = selection.getFirstElement(); - if (o instanceof TreeNode) o = ((TreeNode) o).getData(); + if (o instanceof TreeNode) + o = ((TreeNode) o).getData(); if (o instanceof IDelta) { IDelta delta = ((IDelta) o); lastSelections.add(delta); @@ -251,10 +257,12 @@ public void selectionChanged(SelectionChangedEvent event) { IPath res = null; String ret = ""; for (Object o : selection.toList()) { - if (o instanceof TreeNode) o = ((TreeNode) o).getData(); + if (o instanceof TreeNode) + o = ((TreeNode) o).getData(); if (o instanceof IDelta) { IDelta delta = ((IDelta) o); - if (res == null) res = delta.getResource().getProjectRelativePath(); + if (res == null) + res = delta.getResource().getProjectRelativePath(); if (!res.equals(delta.getResource().getProjectRelativePath())) { lbChange.setDocument(new Document("No multiple resources supported")); return; @@ -281,7 +289,8 @@ public void propertyChange(VariantSyncEvent event) { case VARIANT_ADDED: case VARIANT_REMOVED: int oldSelection = cbVariant.getSelectionIndex(); - cbVariant.setItems(VariantSyncPlugin.getActiveFeatureContextManager().getContextsAsStrings().toArray(new String[] {})); + cbVariant.setItems( + VariantSyncPlugin.getActiveFeatureContextManager().getContextsAsStrings().toArray(new String[] {})); cbVariant.select(oldSelection); default: break; From bb7368b8faa5e0918b751a2afc309b27135ce458 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 21 Jan 2021 13:40:44 +0100 Subject: [PATCH 29/35] added build status to readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aa84791..15d3339 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# VariantSync +# VariantSync [![Build Status](https://travis-ci.org/tthuem/VariantSync.svg?branch=seproj_ulm_2020)](https://travis-ci.org/tthuem/VariantSync) === Automating the Synchronization of Software Variants === VariantSync is a tool to develop variants separately as in clone-and-own and to automate change propagation by using domain knowledge of developers. VariantSync detects and logs changes during development, tags these changes to feature expressions and automates the synchronization From 38d929696d5f529ce863a40aba02b3af20febb36 Mon Sep 17 00:00:00 2001 From: Tobias Cerny <73832687+tcerny@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:38:57 +0100 Subject: [PATCH 30/35] Delete de.tubs.variantsync.core-test/.settings directory --- .../.settings/org.eclipse.jdt.core.prefs | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 de.tubs.variantsync.core-test/.settings/org.eclipse.jdt.core.prefs diff --git a/de.tubs.variantsync.core-test/.settings/org.eclipse.jdt.core.prefs b/de.tubs.variantsync.core-test/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 0c68a61..0000000 --- a/de.tubs.variantsync.core-test/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 From 0159db8799fd02dfbff96f454a41fed910101fec Mon Sep 17 00:00:00 2001 From: Tobias Cerny <73832687+tcerny@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:39:37 +0100 Subject: [PATCH 31/35] Delete de.tubs.variantsync.core/.settings directory --- .../org.eclipse.core.resources.prefs | 2 - .../.settings/org.eclipse.jdt.core.prefs | 492 ------------------ .../.settings/org.eclipse.m2e.core.prefs | 4 - 3 files changed, 498 deletions(-) delete mode 100644 de.tubs.variantsync.core/.settings/org.eclipse.core.resources.prefs delete mode 100644 de.tubs.variantsync.core/.settings/org.eclipse.jdt.core.prefs delete mode 100644 de.tubs.variantsync.core/.settings/org.eclipse.m2e.core.prefs diff --git a/de.tubs.variantsync.core/.settings/org.eclipse.core.resources.prefs b/de.tubs.variantsync.core/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0..0000000 --- a/de.tubs.variantsync.core/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/de.tubs.variantsync.core/.settings/org.eclipse.jdt.core.prefs b/de.tubs.variantsync.core/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c048ac6..0000000 --- a/de.tubs.variantsync.core/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,492 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullable.secondary= -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=info -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled -org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.8 -org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false -org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false -org.eclipse.jdt.core.formatter.align_with_spaces=false -org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assertion_message=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 -org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 -org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_record_components=16 -org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0 -org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 -org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 -org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 -org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch=0 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_record_constructor=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_record_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true -org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=false -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=false -org.eclipse.jdt.core.formatter.comment.indent_tag_description=false -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert -org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert -org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=true -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never -org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never -org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never -org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never -org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never -org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never -org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never -org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line=one_line_never -org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line=one_line_never -org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false -org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false -org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false -org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never -org.eclipse.jdt.core.formatter.lineSplit=120 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0 -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=tab -org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.text_block_indentation=0 -org.eclipse.jdt.core.formatter.use_on_off_tags=false -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true -org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator=true -org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true -org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true -org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true -org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true -org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true -org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true -org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true -org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true -org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/de.tubs.variantsync.core/.settings/org.eclipse.m2e.core.prefs b/de.tubs.variantsync.core/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f..0000000 --- a/de.tubs.variantsync.core/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 From 00950e6f3976175b41d4a078df62771dcc052525 Mon Sep 17 00:00:00 2001 From: Tobias Cerny Date: Thu, 28 Jan 2021 16:53:50 +0100 Subject: [PATCH 32/35] fixed code style and added all optional brackets --- .../variantsync/patch/base/DiffUtilsTest.java | 4 +- de.tubs.variantsync.core.feature/pom.xml | 3 +- .../variantsync/core/VariantSyncComposer.java | 8 +- .../variantsync/core/VariantSyncPlugin.java | 62 +++--- .../exceptions/ProjectNotFoundException.java | 5 +- .../variantsync/core/managers/AManager.java | 2 +- .../managers/ConfigurationProjectManager.java | 77 ++++---- .../core/managers/FeatureContextManager.java | 45 ++--- .../core/managers/MappingManager.java | 29 ++- .../core/managers/PatchesManager.java | 25 +-- .../core/managers/data/CodeMapping.java | 10 +- .../managers/data/ConfigurationProject.java | 38 ++-- .../core/managers/data/FeatureContext.java | 30 +-- .../core/managers/data/SourceFile.java | 8 +- .../persistence/CodeMappingFormat.java | 21 +-- .../persistence/FeatureContextFormat.java | 8 +- .../managers/persistence/PatchFormat.java | 45 +++-- .../core/monitor/CodeMappingHandler.java | 62 +++--- .../core/monitor/ResourceChangeHandler.java | 17 +- .../core/monitor/ResourceChangeVisitor.java | 155 +++++++-------- .../core/nature/AddVariantNature.java | 12 +- .../core/nature/CreateVariantProject.java | 25 ++- .../tubs/variantsync/core/patch/ADelta.java | 88 +++++---- .../core/patch/AMarkerHandler.java | 3 +- .../tubs/variantsync/core/patch/APatch.java | 45 +++-- .../core/patch/DeltaFactoryManager.java | 18 +- .../variantsync/core/patch/HistoryStore.java | 10 +- .../core/patch/base/DefaultDelta.java | 57 +++--- .../core/patch/base/DefaultDeltaFactory.java | 84 +++++---- .../core/patch/base/DefaultMarkerHandler.java | 24 ++- .../core/patch/base/DefaultPatchFactory.java | 10 +- .../core/patch/interfaces/IDelta.java | 47 +++-- .../core/patch/interfaces/IDeltaFactory.java | 38 ++-- .../core/patch/interfaces/IPatch.java | 28 +-- .../core/patch/interfaces/IPatchFactory.java | 8 +- .../syncronization/ResourceCompareInput.java | 176 ++++++++++-------- .../SynchronizationHandler.java | 44 ++--- .../syncronization/TargetsCalculator.java | 76 ++++---- .../compare/DeltaCompareViewer.java | 11 +- .../compare/DeltaCompareViewerPage.java | 24 +-- .../core/utilities/AMarkerInformation.java | 63 +++---- .../core/utilities/FileHelper.java | 51 +++-- .../core/utilities/IVariantSyncMarker.java | 20 +- .../core/utilities/LogOperations.java | 39 ++-- .../core/utilities/MarkerUtils.java | 83 ++++----- .../core/utilities/PerspectiveFactory.java | 2 +- .../tubs/variantsync/core/utilities/Tree.java | 15 +- .../variantsync/core/utilities/TreeNode.java | 18 +- .../utilities/VariantSyncProgressMonitor.java | 8 +- .../core/utilities/event/IEventListener.java | 29 +-- .../core/utilities/event/IEventManager.java | 5 +- .../utilities/event/VariantSyncEvent.java | 36 ++-- .../view/context/ActiveContextHandler.java | 9 +- .../context/DynamicContextPopupItems.java | 24 ++- .../context/SelectContextContribution.java | 23 ++- .../core/view/editor/PartAdapter.java | 20 +- .../featurecontext/FeatureContextHandler.java | 17 +- .../featurecontext/FeatureContextManager.java | 5 +- .../FeatureContextManagerPage.java | 53 +++--- .../featurecontext/FeatureContextWizard.java | 17 +- .../FeatureContextWizardPage.java | 42 ++--- .../core/view/featurecontext/View.java | 71 ++++--- .../ResourceChangesColumnLabelProvider.java | 35 ++-- .../ResourceChangesTreeContentProvider.java | 4 +- .../view/resourcechanges/ResourcesTree.java | 10 +- .../core/view/resourcechanges/View.java | 21 ++- .../core/view/sourcefocus/ProjectTree.java | 10 +- .../SourceFocusTreeContentProvider.java | 4 +- .../core/view/sourcefocus/View.java | 84 +++++---- .../core/view/targetfocus/FeatureTree.java | 10 +- .../TargetFocusTreeContentProvider.java | 4 +- .../core/view/targetfocus/View.java | 74 ++++---- de.tubs.variantsync.update/category.xml | 32 +++- de.tubs.variantsync.update/pom.xml | 3 +- 74 files changed, 1200 insertions(+), 1223 deletions(-) diff --git a/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java b/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java index c7ef77a..dc7d281 100644 --- a/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java +++ b/de.tubs.variantsync.core-test/test/de/tubs/variantsync/patch/base/DiffUtilsTest.java @@ -52,13 +52,13 @@ public void setUp() throws Exception { @Test public void testPatch1() throws DiffException { - Patch patch = DiffUtils.diff(lines1, lines3, 1); + final Patch patch = DiffUtils.diff(lines1, lines3, 1); assertTrue(patch.getDeltas().size() == 3); } @Test public void testPatch2() throws DiffException { - Patch patch = DiffUtils.diff(lines1, lines4, 1); + final Patch patch = DiffUtils.diff(lines1, lines4, 1); assertTrue(patch.getDeltas().size() == 1); } diff --git a/de.tubs.variantsync.core.feature/pom.xml b/de.tubs.variantsync.core.feature/pom.xml index 693ad80..9cbace3 100644 --- a/de.tubs.variantsync.core.feature/pom.xml +++ b/de.tubs.variantsync.core.feature/pom.xml @@ -1,4 +1,5 @@ - 4.0.0 diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java index 831503a..d98d9d6 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java @@ -24,10 +24,10 @@ public void performFullBuild(Path config) { @Override public void addCompiler(IProject project, String sourcePath, String configPath, String buildPath) { - File featureContextFile = new File(project.getFile(FeatureContextFormat.FILENAME).getLocationURI()); + final File featureContextFile = new File(project.getFile(FeatureContextFormat.FILENAME).getLocationURI()); try { featureContextFile.createNewFile(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } @@ -93,8 +93,8 @@ public void copyNotComposedFiles(Configuration config, IFolder destination) { } @Override - public void buildPartialFeatureProjectAssets(IFolder sourceFolder, ArrayList removedFeatures, - ArrayList mandatoryFeatures) throws IOException, CoreException { + public void buildPartialFeatureProjectAssets(IFolder sourceFolder, ArrayList removedFeatures, ArrayList mandatoryFeatures) + throws IOException, CoreException { } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncPlugin.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncPlugin.java index 0a3f8a2..b225291 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncPlugin.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncPlugin.java @@ -40,7 +40,7 @@ /** * The activator class controls the plug-in life cycle - * + * * @author Christopher Sontag (c.sontag@tu-bs.de) * @version 1.0 * @since 1.0.0.0 @@ -55,26 +55,24 @@ public class VariantSyncPlugin extends AbstractUIPlugin { private static ResourceChangeHandler listener = new ResourceChangeHandler(); private static ConfigurationProjectManager configurationProjectManager = new ConfigurationProjectManager(); - private List listeners = new ArrayList<>(); + private final List listeners = new ArrayList<>(); /** * The constructor */ - public VariantSyncPlugin() { - } + public VariantSyncPlugin() {} /* * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework. - * BundleContext) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework. BundleContext) */ + @Override public void start(BundleContext ctxt) throws Exception { super.start(ctxt); plugin = this; - DeltaFactoryManager.setExtensionLoader(new EclipseExtensionLoader<>(PLUGIN_ID, IDeltaFactory.extensionPointID, - IDeltaFactory.extensionID, IDeltaFactory.class)); + DeltaFactoryManager + .setExtensionLoader(new EclipseExtensionLoader<>(PLUGIN_ID, IDeltaFactory.extensionPointID, IDeltaFactory.extensionID, IDeltaFactory.class)); configurationProjectManager.initalize(); @@ -90,10 +88,9 @@ public void run() { /* * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework. - * BundleContext) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework. BundleContext) */ + @Override public void stop(BundleContext ctxt) throws Exception { configurationProjectManager.terminate(); plugin = null; @@ -142,9 +139,8 @@ public static PatchesManager getActivePatchesManager() { } /** - * Returns an image descriptor for the image file at the given plug-in relative - * path. - * + * Returns an image descriptor for the image file at the given plug-in relative path. + * * @param path the path * @return the image descriptor */ @@ -153,8 +149,7 @@ public ImageDescriptor getImageDescriptor(String path) { } /** - * Always good to have this static method as when dealing with IResources having - * a interface to get the editor is very handy + * Always good to have this static method as when dealing with IResources having a interface to get the editor is very handy * * @return */ @@ -167,11 +162,13 @@ public static ITextEditor getEditor() { } public static IFile getEditorInput() { - if (VariantSyncPlugin.getActiveWorkbenchWindow() == null) + if (VariantSyncPlugin.getActiveWorkbenchWindow() == null) { return null; - IEditorPart editorPart = VariantSyncPlugin.getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if (editorPart == null || !(editorPart instanceof IFileEditorInput)) + } + final IEditorPart editorPart = VariantSyncPlugin.getActiveWorkbenchWindow().getActivePage().getActiveEditor(); + if ((editorPart == null) || !(editorPart instanceof IFileEditorInput)) { return null; + } return ((IFileEditorInput) editorPart.getEditorInput()).getFile(); } @@ -179,7 +176,7 @@ public static void addResourceChangeListener() { ResourcesPlugin.getWorkspace().addResourceChangeListener(listener); try { listener.registerSaveParticipant(); - } catch (CoreException e) { + } catch (final CoreException e) { e.printStackTrace(); } } @@ -192,21 +189,20 @@ public static void removeResourceChangeListener() { * Listen whether the active file in the java editor changes. */ public void listenForActiveClass() { - IWorkbench wb = PlatformUI.getWorkbench(); - IWorkbenchWindow ww = wb.getActiveWorkbenchWindow(); + final IWorkbench wb = PlatformUI.getWorkbench(); + final IWorkbenchWindow ww = wb.getActiveWorkbenchWindow(); - PartAdapter adapter = new PartAdapter(); + final PartAdapter adapter = new PartAdapter(); ww.getPartService().addPartListener(adapter); } public static void addNature(IProject project) { - VariantSyncProgressMonitor progressMonitor = new VariantSyncProgressMonitor( - "Adding VariantSync nature to " + project.getName()); + final VariantSyncProgressMonitor progressMonitor = new VariantSyncProgressMonitor("Adding VariantSync nature to " + project.getName()); try { - IProjectDescription description = project.getDescription(); - String[] natures = description.getNatureIds(); + final IProjectDescription description = project.getDescription(); + final String[] natures = description.getNatureIds(); - String[] newNatures = new String[natures.length + 1]; + final String[] newNatures = new String[natures.length + 1]; System.arraycopy(natures, 0, newNatures, 1, natures.length); newNatures[0] = Variant.NATURE_ID; @@ -216,24 +212,24 @@ public static void addNature(IProject project) { project.setDescription(description, progressMonitor); progressMonitor.setSubTaskName("Refresh resources"); project.refreshLocal(IResource.DEPTH_INFINITE, progressMonitor); - } catch (CoreException e) { + } catch (final CoreException e) { LogOperations.logError("", e); } } public void addListener(IEventListener listener) { - this.listeners.add(listener); + listeners.add(listener); } public void fireEvent(VariantSyncEvent event) { System.out.println(event); - for (IEventListener listener : listeners) { + for (final IEventListener listener : listeners) { listener.propertyChange(event); } } public void removeListener(IEventListener listener) { - this.listeners.remove(listener); + listeners.remove(listener); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/exceptions/ProjectNotFoundException.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/exceptions/ProjectNotFoundException.java index eb80f1e..b80263f 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/exceptions/ProjectNotFoundException.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/exceptions/ProjectNotFoundException.java @@ -10,7 +10,7 @@ public enum Type { CONFIGURATION, VARIANT }; - private Type type; + private final Type type; public ProjectNotFoundException(Type type) { super(""); @@ -25,8 +25,7 @@ public ProjectNotFoundException(Type type, String message) { @Override public String toString() { - return "A " + (type == Type.CONFIGURATION ? "configuration project" : "variant") - + " does not exist in the workspace. " + getMessage(); + return "A " + (type == Type.CONFIGURATION ? "configuration project" : "variant") + " does not exist in the workspace. " + getMessage(); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/AManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/AManager.java index 836ee5b..1483916 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/AManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/AManager.java @@ -7,7 +7,7 @@ public abstract class AManager { /** * Wrapper for {@link VariantSyncPlugin#fireEvent(VariantSyncEvent)} - * + * * @param variantSyncEvent */ protected void fireEvent(VariantSyncEvent variantSyncEvent) { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java index 7a089dc..45d0285 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/ConfigurationProjectManager.java @@ -1,7 +1,6 @@ package de.tubs.variantsync.core.managers; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -10,7 +9,6 @@ import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; import de.ovgu.featureide.core.CorePlugin; import de.ovgu.featureide.core.IFeatureProject; @@ -26,33 +24,30 @@ import de.tubs.variantsync.core.utilities.event.VariantSyncEvent; import de.tubs.variantsync.core.utilities.event.VariantSyncEvent.EventType; -public class ConfigurationProjectManager extends AManager - implements IEventListener, de.ovgu.featureide.fm.core.base.event.IEventListener { +public class ConfigurationProjectManager extends AManager implements IEventListener, de.ovgu.featureide.fm.core.base.event.IEventListener { private static HashMap INSTANCES = new HashMap<>(); private static ConfigurationProject lastRequestedConfiguration = null; public void initalize() { ConfigurationProject lastConfiguration = null; - for (IFeatureProject project : findConfigurationProjects()) { + for (final IFeatureProject project : findConfigurationProjects()) { try { MarkerUtils.cleanProject(project.getProject()); - } catch (CoreException e) { + } catch (final CoreException e) { LogOperations.logError("A marker could not be deleted", e); } - if (project.getProjectName().equals( - VariantSyncPlugin.getDefault().getPreferenceStore().getString("lastRequestedConfiguration"))) { + if (project.getProjectName().equals(VariantSyncPlugin.getDefault().getPreferenceStore().getString("lastRequestedConfiguration"))) { lastConfiguration = getConfigurationProject(project); } else { getConfigurationProject(project); } } - if (lastConfiguration != null && lastRequestedConfiguration != lastConfiguration) { + if ((lastConfiguration != null) && (lastRequestedConfiguration != lastConfiguration)) { lastRequestedConfiguration = lastConfiguration; - fireEvent(new VariantSyncEvent(this, EventType.CONFIGURATIONPROJECT_CHANGED, null, - lastRequestedConfiguration)); + fireEvent(new VariantSyncEvent(this, EventType.CONFIGURATIONPROJECT_CHANGED, null, lastRequestedConfiguration)); } - for (ConfigurationProject configurationProject : INSTANCES.values()) { + for (final ConfigurationProject configurationProject : INSTANCES.values()) { findVariants(configurationProject); configurationProject.load(); } @@ -66,13 +61,13 @@ public void reinitialize() { } public void terminate() { - if (lastRequestedConfiguration != null && lastRequestedConfiguration.getFeatureProject() != null) { + if ((lastRequestedConfiguration != null) && (lastRequestedConfiguration.getFeatureProject() != null)) { VariantSyncPlugin.getDefault().getPreferenceStore().setValue("lastRequestedConfiguration", lastRequestedConfiguration.getFeatureProject().getProjectName()); } - for (ConfigurationProject configurationProject : INSTANCES.values()) { - if (configurationProject != null && configurationProject.getFeatureProject().getProject().exists()) { + for (final ConfigurationProject configurationProject : INSTANCES.values()) { + if ((configurationProject != null) && configurationProject.getFeatureProject().getProject().exists()) { configurationProject.save(); } } @@ -80,24 +75,22 @@ public void terminate() { public ConfigurationProject getConfigurationProject(IFeatureProject project) { if (project != null) { - for (IFeatureProject featureProject : INSTANCES.keySet()) { + for (final IFeatureProject featureProject : INSTANCES.keySet()) { if (featureProject.getProjectName().equals(project.getProjectName())) { - ConfigurationProject configurationProject = INSTANCES.get(featureProject); + final ConfigurationProject configurationProject = INSTANCES.get(featureProject); if (lastRequestedConfiguration != configurationProject) { lastRequestedConfiguration = configurationProject; - fireEvent(new VariantSyncEvent(this, EventType.CONFIGURATIONPROJECT_CHANGED, null, - lastRequestedConfiguration)); + fireEvent(new VariantSyncEvent(this, EventType.CONFIGURATIONPROJECT_CHANGED, null, lastRequestedConfiguration)); } return configurationProject; } } - ConfigurationProject configurationProject = new ConfigurationProject(); + final ConfigurationProject configurationProject = new ConfigurationProject(); configurationProject.setFeatureProject(project); INSTANCES.put(project, configurationProject); if (lastRequestedConfiguration != configurationProject) { lastRequestedConfiguration = configurationProject; - fireEvent(new VariantSyncEvent(this, EventType.CONFIGURATIONPROJECT_CHANGED, null, - lastRequestedConfiguration)); + fireEvent(new VariantSyncEvent(this, EventType.CONFIGURATIONPROJECT_CHANGED, null, lastRequestedConfiguration)); } return configurationProject; } @@ -109,8 +102,8 @@ public ConfigurationProject getConfigurationProject(IFeatureProject project) { */ private List findConfigurationProjects() { // System.out.println("[ConfigurationProjectManager.findConfigurationProjects]"); - List projects = new ArrayList<>(); - for (IFeatureProject project : CorePlugin.getFeatureProjects()) { + final List projects = new ArrayList<>(); + for (final IFeatureProject project : CorePlugin.getFeatureProjects()) { // System.out.print(" project " + project.getProjectName()); if (project.getComposerID().equals("de.tubs.variantsync.core.composer")) { LogOperations.logInfo("Found configuration project with name: " + project.getProjectName()); @@ -124,20 +117,20 @@ private List findConfigurationProjects() { } private void findVariants(ConfigurationProject configurationProject) { - for (Path path : configurationProject.getFeatureProject().getAllConfigurations()) { - IFile file = (IFile) EclipseFileSystem.getResource(path); - String projectName = file.getName().substring(0, file.getName().lastIndexOf(".")); - IProject project = VariantSyncPlugin.getWorkspace().getProject(projectName); + for (final Path path : configurationProject.getFeatureProject().getAllConfigurations()) { + final IFile file = (IFile) EclipseFileSystem.getResource(path); + final String projectName = file.getName().substring(0, file.getName().lastIndexOf(".")); + final IProject project = VariantSyncPlugin.getWorkspace().getProject(projectName); if (project.exists()) { configurationProject.addVariant(project); } else { try { - IMarker m = file.createMarker("de.tubs.variantsync.marker.error"); + final IMarker m = file.createMarker("de.tubs.variantsync.marker.error"); m.setAttribute(IMarker.MESSAGE, "Project " + projectName + " is missing in the workspace"); m.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING); m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH); m.setAttribute(IMarker.LINE_NUMBER, 0); - } catch (CoreException e) { + } catch (final CoreException e) { LogOperations.logError("Marker cannot be created!", e); } } @@ -146,18 +139,20 @@ private void findVariants(ConfigurationProject configurationProject) { } public IFeatureProject getFeatureProject(IProject project) { - for (IFeatureProject featureProject : INSTANCES.keySet()) { - if (project.getName().equals(featureProject.getProjectName())) + for (final IFeatureProject featureProject : INSTANCES.keySet()) { + if (project.getName().equals(featureProject.getProjectName())) { return featureProject; - if (featureProject.getProject().exists() && INSTANCES.get(featureProject).getVariants().contains(project)) + } + if (featureProject.getProject().exists() && INSTANCES.get(featureProject).getVariants().contains(project)) { return featureProject; + } } return null; } public ConfigurationProject getConfigurationProject(IProject project) { if (project != null) { - IFeatureProject featureProject = getFeatureProject(project); + final IFeatureProject featureProject = getFeatureProject(project); if (featureProject != null) { return getConfigurationProject(featureProject); } @@ -167,12 +162,13 @@ public ConfigurationProject getConfigurationProject(IProject project) { /** * Returns the configuration project for the active editor - * + * * @return */ public ConfigurationProject getActiveConfigurationProject() { - if (VariantSyncPlugin.getEditorInput() == null) + if (VariantSyncPlugin.getEditorInput() == null) { return lastRequestedConfiguration; + } return getConfigurationProject(VariantSyncPlugin.getEditorInput().getProject()); } @@ -184,10 +180,9 @@ public void propertyChange(FeatureIDEEvent event) { case MODEL_DATA_SAVED: LogOperations.logInfo("Model Event" + event); if (event.getSource() instanceof IFeatureModel) { - IFeatureModel model = (IFeatureModel) event.getSource(); - List featureExpressions = getActiveConfigurationProject().getFeatureContextManager() - .getContextsAsStrings(); - for (IFeature feature : model.getFeatures()) { + final IFeatureModel model = (IFeatureModel) event.getSource(); + final List featureExpressions = getActiveConfigurationProject().getFeatureContextManager().getContextsAsStrings(); + for (final IFeature feature : model.getFeatures()) { if (!featureExpressions.contains(feature.getName())) { getActiveConfigurationProject().getFeatureContextManager().addContext(feature.getName()); } @@ -206,7 +201,7 @@ public void propertyChange(VariantSyncEvent event) { switch (event.getEventType()) { case CONFIGURATIONPROJECT_SET: if (event.getSource() instanceof ConfigurationProject) { - ConfigurationProject context = (ConfigurationProject) event.getSource(); + final ConfigurationProject context = (ConfigurationProject) event.getSource(); if (context.getFeatureProject() != null) { context.getFeatureProject().getFeatureModelManager().addListener(this); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/FeatureContextManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/FeatureContextManager.java index 55086c4..d0f039d 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/FeatureContextManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/FeatureContextManager.java @@ -6,7 +6,7 @@ import de.ovgu.featureide.fm.core.base.IFeature; import de.ovgu.featureide.fm.core.color.FeatureColor; -import de.ovgu.featureide.fm.core.io.manager.FileHandler; +import de.ovgu.featureide.fm.core.io.manager.SimpleFileHandler; import de.tubs.variantsync.core.exceptions.ProjectNotFoundException; import de.tubs.variantsync.core.exceptions.ProjectNotFoundException.Type; import de.tubs.variantsync.core.managers.data.ConfigurationProject; @@ -24,7 +24,7 @@ public class FeatureContextManager extends AManager implements ISaveableManager private List featureContexts = new ArrayList<>(); - private ConfigurationProject configurationProject; + private final ConfigurationProject configurationProject; public FeatureContextManager(ConfigurationProject configurationProject) { this.configurationProject = configurationProject; @@ -39,14 +39,14 @@ public String getActual() { } public void setActual(String actualContext) { - String oldContext = this.actualContext; + final String oldContext = this.actualContext; this.actualContext = actualContext; fireEvent(new VariantSyncEvent(this, EventType.CONTEXT_CHANGED, oldContext, actualContext)); } public void setDefault() { - String oldContext = this.actualContext; - this.actualContext = DEFAULT_CONTEXT_NAME; + final String oldContext = actualContext; + actualContext = DEFAULT_CONTEXT_NAME; fireEvent(new VariantSyncEvent(this, EventType.CONTEXT_CHANGED, oldContext, actualContext)); } @@ -55,45 +55,46 @@ public List getContexts() { } public List getContextsAsStrings() { - List contexts = new ArrayList<>(); - for (FeatureContext fe : this.featureContexts) { + final List contexts = new ArrayList<>(); + for (final FeatureContext fe : featureContexts) { contexts.add(fe.name); } return contexts; } public void setContext(List contexts) { - this.featureContexts = contexts; + featureContexts = contexts; fireEvent(new VariantSyncEvent(this, EventType.FEATURECONTEXT_CHANGED, null, contexts)); } public void addContext(String context) { - FeatureContext fe = new FeatureContext(context, FeatureColor.Yellow); - this.featureContexts.add(fe); + final FeatureContext fe = new FeatureContext(context, FeatureColor.Yellow); + featureContexts.add(fe); fireEvent(new VariantSyncEvent(this, EventType.FEATURECONTEXT_ADDED, null, fe)); } public void addContext(String context, FeatureColor color) { - FeatureContext fe = new FeatureContext(context, color); - this.featureContexts.add(fe); + final FeatureContext fe = new FeatureContext(context, color); + featureContexts.add(fe); fireEvent(new VariantSyncEvent(this, EventType.FEATURECONTEXT_ADDED, null, fe)); } public void importFeaturesFromModel() throws ProjectNotFoundException { if (configurationProject != null) { - for (IFeature feature : configurationProject.getFeatures()) { - FeatureContext fe = new FeatureContext(feature.getName()); + for (final IFeature feature : configurationProject.getFeatures()) { + final FeatureContext fe = new FeatureContext(feature.getName()); if (!featureContexts.contains(fe)) { featureContexts.add(fe); fireEvent(new VariantSyncEvent(this, EventType.FEATURECONTEXT_ADDED, null, fe)); } } - } else + } else { throw new ProjectNotFoundException(Type.CONFIGURATION); + } } public FeatureContext getContext(String name) { - for (FeatureContext fe : getContexts()) { + for (final FeatureContext fe : getContexts()) { if (fe.name.equals(name)) { return fe; } @@ -108,14 +109,14 @@ public void reset() { @Override public void load() { - List contexts = new ArrayList<>(); - FileHandler.load(Paths.get(configurationProject.getFeatureProject().getProject() - .getFile(FeatureContextFormat.FILENAME).getLocationURI()), contexts, new FeatureContextFormat()); + final List contexts = new ArrayList<>(); + SimpleFileHandler.load(Paths.get(configurationProject.getFeatureProject().getProject().getFile(FeatureContextFormat.FILENAME).getLocationURI()), + contexts, new FeatureContextFormat()); if (contexts.isEmpty()) { try { importFeaturesFromModel(); LogOperations.logInfo("Loaded feature expressions from feature model"); - } catch (ProjectNotFoundException e) { + } catch (final ProjectNotFoundException e) { LogOperations.logError("Cant read feature model", e); } } else { @@ -125,8 +126,8 @@ public void load() { @Override public void save() { - FileHandler.save(Paths.get(configurationProject.getFeatureProject().getProject() - .getFile(FeatureContextFormat.FILENAME).getLocationURI()), getContexts(), new FeatureContextFormat()); + SimpleFileHandler.save(Paths.get(configurationProject.getFeatureProject().getProject().getFile(FeatureContextFormat.FILENAME).getLocationURI()), + getContexts(), new FeatureContextFormat()); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/MappingManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/MappingManager.java index 3b441ac..666ade0 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/MappingManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/MappingManager.java @@ -8,7 +8,7 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; -import de.ovgu.featureide.fm.core.io.manager.FileHandler; +import de.ovgu.featureide.fm.core.io.manager.SimpleFileHandler; import de.tubs.variantsync.core.VariantSyncPlugin; import de.tubs.variantsync.core.managers.data.ConfigurationProject; import de.tubs.variantsync.core.managers.data.SourceFile; @@ -19,7 +19,7 @@ public class MappingManager extends AManager implements ISaveableManager { private HashMap> codeMappings = new HashMap<>(); - private ConfigurationProject configurationProject; + private final ConfigurationProject configurationProject; public MappingManager(ConfigurationProject configurationProject) { this.configurationProject = configurationProject; @@ -28,11 +28,11 @@ public MappingManager(ConfigurationProject configurationProject) { private boolean isActive; public boolean isActive() { - return this.isActive; + return isActive; } public void setActive(boolean status) { - this.isActive = status; + isActive = status; if (isActive) { fireEvent(new VariantSyncEvent(this, EventType.CONTEXT_RECORDING_START, null, VariantSyncPlugin.getConfigurationProjectManager().getActiveConfigurationProject())); @@ -43,8 +43,8 @@ public void setActive(boolean status) { } public SourceFile getMapping(IFile file) { - if (file != null && codeMappings.containsKey(file.getProject())) { - for (SourceFile sourceFile : codeMappings.get(file.getProject())) { + if ((file != null) && codeMappings.containsKey(file.getProject())) { + for (final SourceFile sourceFile : codeMappings.get(file.getProject())) { if (sourceFile.getFile().getFullPath().equals(file.getFullPath())) { return sourceFile; } @@ -62,12 +62,12 @@ public void setCodeMappings(HashMap> codeMappings) { } public void addCodeMapping(IProject project, List files) { - this.codeMappings.put(project, files); + codeMappings.put(project, files); } public void addCodeMapping(IFile file, SourceFile sourceFile) { List sourceFiles = codeMappings.get(file.getProject()); - if (sourceFiles == null || sourceFiles.isEmpty()) { + if ((sourceFiles == null) || sourceFiles.isEmpty()) { sourceFiles = new ArrayList<>(); addCodeMapping(file.getProject(), sourceFiles); } @@ -87,10 +87,9 @@ public void reset() { @Override public void load() { - for (IProject project : configurationProject.getVariants()) { - List sourceFiles = new ArrayList<>(); - FileHandler.load(Paths.get(project.getFile(CodeMappingFormat.FILENAME).getLocationURI()), sourceFiles, - new CodeMappingFormat(project)); + for (final IProject project : configurationProject.getVariants()) { + final List sourceFiles = new ArrayList<>(); + SimpleFileHandler.load(Paths.get(project.getFile(CodeMappingFormat.FILENAME).getLocationURI()), sourceFiles, new CodeMappingFormat(project)); if (!sourceFiles.isEmpty()) { addCodeMapping(project, sourceFiles); } @@ -99,9 +98,9 @@ public void load() { @Override public void save() { - for (IProject project : codeMappings.keySet()) { - FileHandler.save(Paths.get(project.getFile(CodeMappingFormat.FILENAME).getLocationURI()), - codeMappings.get(project), new CodeMappingFormat(project)); + for (final IProject project : codeMappings.keySet()) { + SimpleFileHandler.save(Paths.get(project.getFile(CodeMappingFormat.FILENAME).getLocationURI()), codeMappings.get(project), + new CodeMappingFormat(project)); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/PatchesManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/PatchesManager.java index c363fa2..edd7076 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/PatchesManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/PatchesManager.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; -import de.ovgu.featureide.fm.core.io.manager.FileHandler; +import de.ovgu.featureide.fm.core.io.manager.SimpleFileHandler; import de.tubs.variantsync.core.VariantSyncPlugin; import de.tubs.variantsync.core.managers.data.ConfigurationProject; import de.tubs.variantsync.core.managers.persistence.PatchFormat; @@ -19,7 +19,7 @@ public class PatchesManager extends AManager implements ISaveableManager, IEvent private List> patches = new ArrayList>(); - private ConfigurationProject configurationProject; + private final ConfigurationProject configurationProject; public PatchesManager(ConfigurationProject configurationProject) { VariantSyncPlugin.getDefault().addListener(this); @@ -27,13 +27,14 @@ public PatchesManager(ConfigurationProject configurationProject) { } public IPatch getActualContextPatch() { - if (actualPatch == null) + if (actualPatch == null) { return null; - return this.actualPatch; + } + return actualPatch; } public void setActualContextPatch(IPatch patch) { - this.actualPatch = patch; + actualPatch = patch; } public List> getPatches() { @@ -51,13 +52,15 @@ public void setPatches(List> patches) { public void closeActualPatch() { if (actualPatch != null) { actualPatch.setEndTime(System.currentTimeMillis()); - if (!actualPatch.isEmpty() && !patches.contains(actualPatch)) + if (!actualPatch.isEmpty() && !patches.contains(actualPatch)) { patches.add(actualPatch); + } actualPatch = null; fireEvent(new VariantSyncEvent(this, EventType.PATCH_CLOSED, null, null)); } } + @Override public void reset() { patches.clear(); } @@ -65,9 +68,8 @@ public void reset() { @Override public void load() { if (configurationProject.getFeatureProject() != null) { - List> patches = new ArrayList<>(); - FileHandler.load(Paths.get(configurationProject.getFeatureProject().getProject() - .getFile(PatchFormat.FILENAME).getLocationURI()), patches, + final List> patches = new ArrayList<>(); + SimpleFileHandler.load(Paths.get(configurationProject.getFeatureProject().getProject().getFile(PatchFormat.FILENAME).getLocationURI()), patches, new PatchFormat(configurationProject.getFeatureProject())); if (!patches.isEmpty()) { setPatches(patches); @@ -89,9 +91,8 @@ public void propertyChange(VariantSyncEvent event) { @Override public void save() { - FileHandler.save(Paths.get( - configurationProject.getFeatureProject().getProject().getFile(PatchFormat.FILENAME).getLocationURI()), - patches, new PatchFormat(configurationProject.getFeatureProject())); + SimpleFileHandler.save(Paths.get(configurationProject.getFeatureProject().getProject().getFile(PatchFormat.FILENAME).getLocationURI()), patches, + new PatchFormat(configurationProject.getFeatureProject())); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/CodeMapping.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/CodeMapping.java index 3b1f058..a059e37 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/CodeMapping.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/CodeMapping.java @@ -9,7 +9,7 @@ public class CodeMapping { /** * Constructor - * + * * @param code * @param variantSyncMarker */ @@ -20,7 +20,7 @@ public CodeMapping(String code, IVariantSyncMarker variantSyncMarker) { /** * Returns mapped code - * + * * @return code */ public String getCode() { @@ -29,7 +29,7 @@ public String getCode() { /** * Sets mapped code - * + * * @param code */ public void setCode(String code) { @@ -38,7 +38,7 @@ public void setCode(String code) { /** * Returns marker information - * + * * @return variantSyncMarker */ public IVariantSyncMarker getMarkerInformation() { @@ -47,7 +47,7 @@ public IVariantSyncMarker getMarkerInformation() { /** * Sets marker information - * + * * @param variantSyncMarker */ public void setMarkerInformation(IVariantSyncMarker variantSyncMarker) { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java index e94eb86..200b3b1 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java @@ -22,8 +22,7 @@ import de.tubs.variantsync.core.utilities.event.VariantSyncEvent.EventType; /** - * A class for managing all informations about the product line for one - * configuration project + * A class for managing all informations about the product line for one configuration project * * @author Christopher Sontag * @since 1.1 @@ -32,15 +31,14 @@ public class ConfigurationProject extends AManager implements ISaveableManager { private IFeatureProject configurationProject = null; - private FeatureContextManager featureContextManager = new FeatureContextManager(this); - private MappingManager mappingManager = new MappingManager(this); - private PatchesManager patchesManager = new PatchesManager(this); + private final FeatureContextManager featureContextManager = new FeatureContextManager(this); + private final MappingManager mappingManager = new MappingManager(this); + private final PatchesManager patchesManager = new PatchesManager(this); private List projects = new ArrayList<>(); public IFeatureProject getFeatureProject() { - return configurationProject != null ? configurationProject.getProject().exists() ? configurationProject : null - : null; + return configurationProject != null ? configurationProject.getProject().exists() ? configurationProject : null : null; } public void setFeatureProject(IFeatureProject configurationProject) { @@ -49,8 +47,8 @@ public void setFeatureProject(IFeatureProject configurationProject) { } public List getVariantNames() { - List projectNames = new ArrayList<>(); - for (IProject project : this.projects) { + final List projectNames = new ArrayList<>(); + for (final IProject project : projects) { projectNames.add(project.getName()); } return projectNames; @@ -61,9 +59,10 @@ public List getVariants() { } public IProject getVariant(String name) { - for (IProject project : this.projects) { - if (project.getName().equals(name)) + for (final IProject project : projects) { + if (project.getName().equals(name)) { return project; + } } return null; } @@ -73,20 +72,19 @@ public void setVariants(List projects) { } public void addVariant(IProject project) { - this.projects.add(project); + projects.add(project); } public Configuration getConfigurationForVariant(IProject project) { if (project != null) { - for (Path confPath : configurationProject.getAllConfigurations()) { - IFile configPath = (IFile) EclipseFileSystem.getResource(confPath); - String configFileName = configPath.getName(); - String configName = configFileName.substring(0, configFileName.lastIndexOf('.')); - System.out.println("[ConfigurationProject.getConfigurationForVariant] Check name equality Project(" - + project.getName() + ") with Config(" + configName + ")"); + for (final Path confPath : configurationProject.getAllConfigurations()) { + final IFile configPath = (IFile) EclipseFileSystem.getResource(confPath); + final String configFileName = configPath.getName(); + final String configName = configFileName.substring(0, configFileName.lastIndexOf('.')); + System.out.println("[ConfigurationProject.getConfigurationForVariant] Check name equality Project(" + project.getName() + ") with Config(" + + configName + ")"); if (configName.equals(project.getName())) { - ConfigurationManager configurationManager = ConfigurationManager - .getInstance(Paths.get(configPath.getRawLocationURI())); + final ConfigurationManager configurationManager = ConfigurationManager.getInstance(Paths.get(configPath.getRawLocationURI())); if (configurationManager != null) { return configurationManager.getObject(); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/FeatureContext.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/FeatureContext.java index d429591..7bb7cc9 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/FeatureContext.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/FeatureContext.java @@ -8,14 +8,14 @@ public class FeatureContext { public FeatureColor highlighter; public FeatureContext() { - this.name = ""; - this.highlighter = FeatureColor.NO_COLOR; + name = ""; + highlighter = FeatureColor.NO_COLOR; } public FeatureContext(String name) { super(); this.name = name; - this.highlighter = FeatureColor.Yellow; + highlighter = FeatureColor.Yellow; } public FeatureContext(String name, FeatureColor highlighter) { @@ -32,27 +32,33 @@ public boolean isComposed() { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((highlighter == null) ? 0 : highlighter.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = (prime * result) + ((highlighter == null) ? 0 : highlighter.hashCode()); + result = (prime * result) + ((name == null) ? 0 : name.hashCode()); return result; } @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; - FeatureContext other = (FeatureContext) obj; - if (highlighter != other.highlighter) + } + final FeatureContext other = (FeatureContext) obj; + if (highlighter != other.highlighter) { return false; + } if (name == null) { - if (other.name != null) + if (other.name != null) { return false; - } else if (!name.equals(other.name)) + } + } else if (!name.equals(other.name)) { return false; + } return true; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/SourceFile.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/SourceFile.java index 4f0fa05..8d31101 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/SourceFile.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/SourceFile.java @@ -11,11 +11,11 @@ public class SourceFile { List mappings = new ArrayList<>(); public SourceFile(IFile res) { - this.resource = res; + resource = res; } public SourceFile(IFile res, List mappings) { - this.resource = res; + resource = res; this.mappings = mappings; } @@ -24,7 +24,7 @@ public IFile getFile() { } public void setFile(IFile res) { - this.resource = res; + resource = res; } public List getMappings() { @@ -32,7 +32,7 @@ public List getMappings() { } public void addMapping(CodeMapping mapping) { - this.mappings.add(mapping); + mappings.add(mapping); } public void setMapping(List mappings) { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/CodeMappingFormat.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/CodeMappingFormat.java index 73f0ace..ea80e0a 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/CodeMappingFormat.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/CodeMappingFormat.java @@ -25,8 +25,7 @@ public class CodeMappingFormat extends AXMLFormat> { private static final String MAPPINGS = "Mappings"; private static final String SOURCEFILE = "SourceFile"; private static final String CODEMAPPINGS = "CodeMapping"; - private static final Pattern CONTENT_REGEX = Pattern - .compile("\\A\\s*(<[?]xml\\s.*[?]>\\s*)?<" + MAPPINGS + "[\\s>]"); + private static final Pattern CONTENT_REGEX = Pattern.compile("\\A\\s*(<[?]xml\\s.*[?]>\\s*)?<" + MAPPINGS + "[\\s>]"); public static final String FILENAME = ".mapping.xml"; @@ -64,14 +63,12 @@ public String getId() { protected void readDocument(Document doc, List warnings) throws UnsupportedModelException { object.clear(); for (final Element eSF : getElements(doc.getDocumentElement().getChildNodes())) { - SourceFile sourceFile = new SourceFile( - ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(eSF.getAttribute("path")))); + final SourceFile sourceFile = new SourceFile(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(eSF.getAttribute("path")))); for (final Element eCM : getElements(eSF.getChildNodes())) { - IVariantSyncMarker variantSyncMarker = new AMarkerInformation( - Integer.parseInt(eCM.getAttribute("offset")), Integer.parseInt(eCM.getAttribute("length")), - Boolean.parseBoolean(eCM.getAttribute("isLine"))); + final IVariantSyncMarker variantSyncMarker = new AMarkerInformation(Integer.parseInt(eCM.getAttribute("offset")), + Integer.parseInt(eCM.getAttribute("length")), Boolean.parseBoolean(eCM.getAttribute("isLine"))); variantSyncMarker.setContext(eCM.getAttribute("context")); - CodeMapping codeMapping = new CodeMapping(eCM.getTextContent(), variantSyncMarker); + final CodeMapping codeMapping = new CodeMapping(eCM.getTextContent(), variantSyncMarker); sourceFile.addMapping(codeMapping); } object.add(sourceFile); @@ -82,12 +79,12 @@ protected void readDocument(Document doc, List warnings) throws Unsuppo protected void writeDocument(Document doc) { final Element root = doc.createElement(MAPPINGS); - for (SourceFile sf : object) { - Element file = doc.createElement(SOURCEFILE); + for (final SourceFile sf : object) { + final Element file = doc.createElement(SOURCEFILE); file.setAttribute("path", String.valueOf(sf.getFile().getFullPath())); - for (CodeMapping cm : sf.getMappings()) { - Element line = doc.createElement(CODEMAPPINGS); + for (final CodeMapping cm : sf.getMappings()) { + final Element line = doc.createElement(CODEMAPPINGS); line.setAttribute("context", cm.getMarkerInformation().getContext()); line.setAttribute("offset", String.valueOf(cm.getMarkerInformation().getOffset())); line.setAttribute("length", String.valueOf(cm.getMarkerInformation().getLength())); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/FeatureContextFormat.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/FeatureContextFormat.java index 411e738..b5013c0 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/FeatureContextFormat.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/FeatureContextFormat.java @@ -18,8 +18,7 @@ public class FeatureContextFormat extends AXMLFormat> { private static final String ID = "FeatureContexts"; private static final String FEATURE_CONTEXTS = "contexts"; private static final String FEATURE_CONTEXT = "context"; - private static final Pattern CONTENT_REGEX = Pattern - .compile("\\A\\s*(<[?]xml\\s.*[?]>\\s*)?<" + FEATURE_CONTEXTS + "[\\s>]"); + private static final Pattern CONTENT_REGEX = Pattern.compile("\\A\\s*(<[?]xml\\s.*[?]>\\s*)?<" + FEATURE_CONTEXTS + "[\\s>]"); public static final String FILENAME = ".contexts.xml"; @@ -47,8 +46,7 @@ public String getId() { protected void readDocument(Document doc, List warnings) throws UnsupportedModelException { object.clear(); for (final Element e : getElements(doc.getDocumentElement().getChildNodes())) { - FeatureContext fe = new FeatureContext(e.getAttribute("name"), - FeatureColor.getColor(e.getAttribute("highlighter"))); + final FeatureContext fe = new FeatureContext(e.getAttribute("name"), FeatureColor.getColor(e.getAttribute("highlighter"))); object.add(fe); } @@ -59,7 +57,7 @@ protected void writeDocument(Document doc) { final Element root = doc.createElement(FEATURE_CONTEXTS); Element e; - for (FeatureContext fe : object) { + for (final FeatureContext fe : object) { e = doc.createElement(FEATURE_CONTEXT); e.setAttribute("name", fe.name); e.setAttribute("highlighter", fe.highlighter.getColorName()); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/PatchFormat.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/PatchFormat.java index b98e149..9609a27 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/PatchFormat.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/persistence/PatchFormat.java @@ -33,8 +33,7 @@ public class PatchFormat extends AXMLFormat>> { private static final String PATCHES = "Patches"; private static final String PATCH = "Patch"; private static final String DELTA = "Delta"; - private static final Pattern CONTENT_REGEX = Pattern - .compile("\\A\\s*(<[?]xml\\s.*[?]>\\s*)?<" + PATCHES + "[\\s>]"); + private static final Pattern CONTENT_REGEX = Pattern.compile("\\A\\s*(<[?]xml\\s.*[?]>\\s*)?<" + PATCHES + "[\\s>]"); public static final String FILENAME = ".patches.xml"; @@ -73,10 +72,10 @@ public String getId() { protected void readDocument(Document doc, List warnings) throws UnsupportedModelException { object.clear(); if (doc.getDocumentElement().getChildNodes().getLength() != 0) { - IPatchFactory patchFactory = new DefaultPatchFactory(); + final IPatchFactory patchFactory = new DefaultPatchFactory(); for (final Element ePatch : getElements(doc.getDocumentElement().getChildNodes())) { - IPatch patch = patchFactory.createPatch(ePatch.getAttribute("context")); + final IPatch patch = patchFactory.createPatch(ePatch.getAttribute("context")); patch.setStartTime(Long.valueOf(ePatch.getAttribute("start"))); patch.setEndTime(Long.valueOf(ePatch.getAttribute("end"))); @@ -86,9 +85,8 @@ protected void readDocument(Document doc, List warnings) throws Unsuppo IDeltaFactory deltaFactory; try { deltaFactory = DeltaFactoryManager.getFactoryById(eDelta.getAttribute("factoryId")); - } catch (NoSuchExtensionException e) { - LogOperations.logInfo( - "Could not find extension point for factoryId: " + eDelta.getAttribute("factoryId")); + } catch (final NoSuchExtensionException e) { + LogOperations.logInfo("Could not find extension point for factoryId: " + eDelta.getAttribute("factoryId")); continue; } @@ -100,14 +98,13 @@ protected void readDocument(Document doc, List warnings) throws Unsuppo System.out.println(res); } - IDelta delta = deltaFactory.createDelta(res); + final IDelta delta = deltaFactory.createDelta(res); delta.setContext(eDelta.getAttribute("context")); delta.setTimestamp(Long.valueOf(eDelta.getAttribute("timestamp"))); delta.setType(DELTATYPE.valueOf(eDelta.getAttribute("type"))); for (final Element eSyncronizedProject : getElements(eDelta.getElementsByTagName("Project"))) { - delta.addSynchronizedProject(ResourcesPlugin.getWorkspace().getRoot() - .getProject(eSyncronizedProject.getAttribute("name"))); + delta.addSynchronizedProject(ResourcesPlugin.getWorkspace().getRoot().getProject(eSyncronizedProject.getAttribute("name"))); } for (final Element eProperty : getElements(eDelta.getElementsByTagName("Property"))) { delta.addProperty(eProperty.getAttribute("key"), eProperty.getAttribute("value")); @@ -129,44 +126,44 @@ protected void readDocument(Document doc, List warnings) throws Unsuppo protected void writeDocument(Document doc) { final Element root = doc.createElement(PATCHES); - for (IPatch patch : object) { - Element ePatch = doc.createElement(PATCH); + for (final IPatch patch : object) { + final Element ePatch = doc.createElement(PATCH); ePatch.setAttribute("start", String.valueOf(patch.getStartTime())); ePatch.setAttribute("end", String.valueOf(patch.getEndTime())); ePatch.setAttribute("context", patch.getContext()); if (patch.getDeltas().get(0) instanceof IDelta) { - for (IDelta delta : patch.getDeltas()) { - Element eDelta = doc.createElement(DELTA); + for (final IDelta delta : patch.getDeltas()) { + final Element eDelta = doc.createElement(DELTA); eDelta.setAttribute("context", delta.getContext()); eDelta.setAttribute("res", delta.getResource().getFullPath().toOSString()); eDelta.setAttribute("timestamp", String.valueOf(delta.getTimestamp())); eDelta.setAttribute("type", String.valueOf(delta.getType())); eDelta.setAttribute("factoryId", delta.getFactoryId()); - Element eSynchronizedProject = doc.createElement("SynchronizedProjects"); - List projects = delta.getSynchronizedProjects(); - for (IProject project : projects) { - Element eProperty = doc.createElement("Project"); + final Element eSynchronizedProject = doc.createElement("SynchronizedProjects"); + final List projects = delta.getSynchronizedProjects(); + for (final IProject project : projects) { + final Element eProperty = doc.createElement("Project"); eProperty.setAttribute("name", project.getName()); eSynchronizedProject.appendChild(eProperty); } eDelta.appendChild(eSynchronizedProject); - Element eProperties = doc.createElement("Properties"); - HashMap properties = delta.getProperties(); - for (String key : properties.keySet()) { - Element eProperty = doc.createElement("Property"); + final Element eProperties = doc.createElement("Properties"); + final HashMap properties = delta.getProperties(); + for (final String key : properties.keySet()) { + final Element eProperty = doc.createElement("Property"); eProperty.setAttribute("key", key); eProperty.setAttribute("value", properties.get(key)); eProperties.appendChild(eProperty); } eDelta.appendChild(eProperties); - Element eOriginal = doc.createElement("Original"); + final Element eOriginal = doc.createElement("Original"); eOriginal.setTextContent(delta.getOriginalAsString()); eDelta.appendChild(eOriginal); - Element eRevised = doc.createElement("Revised"); + final Element eRevised = doc.createElement("Revised"); eRevised.setTextContent(delta.getRevisedAsString()); eDelta.appendChild(eRevised); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/CodeMappingHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/CodeMappingHandler.java index 5d895c3..8b65bf8 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/CodeMappingHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/CodeMappingHandler.java @@ -23,22 +23,20 @@ public class CodeMappingHandler { /** * Creates mappings for given deltas - * + * * @param deltas */ public static void addCodeMappingsForDeltas(List> deltas) { - for (IDelta delta : deltas) { + for (final IDelta delta : deltas) { try { // Get factory and marker handler for delta - IDeltaFactory deltaFactory = DeltaFactoryManager.getFactoryById(delta.getFactoryId()); - IMarkerHandler markerHandler = deltaFactory.getMarkerHandler(); - List variantSyncMarkers = markerHandler.getMarkersForDelta(delta.getResource(), - delta); + final IDeltaFactory deltaFactory = DeltaFactoryManager.getFactoryById(delta.getFactoryId()); + final IMarkerHandler markerHandler = deltaFactory.getMarkerHandler(); + final List variantSyncMarkers = markerHandler.getMarkersForDelta(delta.getResource(), delta); // Get current context - ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager() - .getActiveConfigurationProject(); - MappingManager mappingManager = configurationProject.getMappingManager(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager().getActiveConfigurationProject(); + final MappingManager mappingManager = configurationProject.getMappingManager(); if (configurationProject != null) { // Get file with current mappings SourceFile sourceFile = mappingManager.getMapping(delta.getResource()); @@ -50,13 +48,13 @@ public static void addCodeMappingsForDeltas(List> deltas) { markerHandler.updateMarkerForDelta(sourceFile, delta, variantSyncMarkers); // Add new code mapping - for (IVariantSyncMarker variantSyncMarker : variantSyncMarkers) { + for (final IVariantSyncMarker variantSyncMarker : variantSyncMarkers) { variantSyncMarker.setContext(delta.getContext()); sourceFile.addMapping(new CodeMapping(delta.getRevisedAsString(), variantSyncMarker)); } mappingManager.addCodeMapping(delta.getResource(), sourceFile); } - } catch (NoSuchExtensionException e) { + } catch (final NoSuchExtensionException e) { LogOperations.logError("Could not map the delta to a context", e); } } @@ -64,7 +62,7 @@ public static void addCodeMappingsForDeltas(List> deltas) { /** * Adds manually created mappings - * + * * @param file * @param context * @param offset @@ -73,38 +71,36 @@ public static void addCodeMappingsForDeltas(List> deltas) { */ public static void addCodeMappings(IFile file, String feature, int offset, int length, String content) { try { - IDeltaFactory deltaFactory = DeltaFactoryManager.getInstance().getFactoryByFile(file); - List variantSyncMarkers = deltaFactory.getMarkerHandler().getMarkers(file, offset, - length); + final IDeltaFactory deltaFactory = DeltaFactoryManager.getInstance().getFactoryByFile(file); + final List variantSyncMarkers = deltaFactory.getMarkerHandler().getMarkers(file, offset, length); - ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager() - .getActiveConfigurationProject(); - MappingManager mappingManager = configurationProject.getMappingManager(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager().getActiveConfigurationProject(); + final MappingManager mappingManager = configurationProject.getMappingManager(); if (configurationProject != null) { SourceFile sourceFile = mappingManager.getMapping(file); if (sourceFile == null) { sourceFile = new SourceFile(file); } - for (IVariantSyncMarker variantSyncMarker : variantSyncMarkers) { + for (final IVariantSyncMarker variantSyncMarker : variantSyncMarkers) { variantSyncMarker.setContext(feature); sourceFile.addMapping(new CodeMapping(content, variantSyncMarker)); } mappingManager.addCodeMapping(file, sourceFile); } - } catch (NoSuchExtensionException e) { + } catch (final NoSuchExtensionException e) { e.printStackTrace(); } } /** * Returns the mapping for a given source and marker - * + * * @param sourceFile * @param variantSyncMarker * @return */ public static CodeMapping getCodeMapping(SourceFile sourceFile, IVariantSyncMarker variantSyncMarker) { - for (CodeMapping mapping : sourceFile.getMappings()) { + for (final CodeMapping mapping : sourceFile.getMappings()) { if (!mapping.getMarkerInformation().equals(variantSyncMarker)) { return mapping; } @@ -113,17 +109,16 @@ public static CodeMapping getCodeMapping(SourceFile sourceFile, IVariantSyncMark } /** - * Returns true, if a marker information exists at the given line in the given - * file - * + * Returns true, if a marker information exists at the given line in the given file + * * @param sourceFile * @param line * @return */ public static boolean contains(SourceFile sourceFile, int line) { - for (CodeMapping mapping : sourceFile.getMappings()) { - IVariantSyncMarker variantSyncMarker = mapping.getMarkerInformation(); - if (variantSyncMarker.isLine() && variantSyncMarker.getOffset() == line) { + for (final CodeMapping mapping : sourceFile.getMappings()) { + final IVariantSyncMarker variantSyncMarker = mapping.getMarkerInformation(); + if (variantSyncMarker.isLine() && (variantSyncMarker.getOffset() == line)) { return true; } } @@ -131,17 +126,16 @@ public static boolean contains(SourceFile sourceFile, int line) { } /** - * Removes a given marker information in the given file and returns true, if a - * mapping was removed - * + * Removes a given marker information in the given file and returns true, if a mapping was removed + * * @param sourceFile * @param variantSyncMarker * @return */ public static boolean remove(SourceFile sourceFile, IVariantSyncMarker variantSyncMarker) { - List mappings = new ArrayList<>(); - List oldMappings = sourceFile.getMappings(); - for (CodeMapping mapping : oldMappings) { + final List mappings = new ArrayList<>(); + final List oldMappings = sourceFile.getMappings(); + for (final CodeMapping mapping : oldMappings) { if (!mapping.getMarkerInformation().equals(variantSyncMarker)) { mappings.add(mapping); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeHandler.java index 32e0056..0c7236f 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeHandler.java @@ -13,8 +13,7 @@ import de.tubs.variantsync.core.utilities.LogOperations; /** - * Listener which notifies resource changes in workspace that have already - * happened. + * Listener which notifies resource changes in workspace that have already happened. * * @author Tristan Pfofe (tristan.pfofe@ckc.de) * @author Christopher Sontag @@ -24,33 +23,31 @@ public class ResourceChangeHandler implements IResourceChangeListener, ISaveParticipant { /** - * Notifies ResourceDeltaListener that some resource changes have already - * happened. + * Notifies ResourceDeltaListener that some resource changes have already happened. */ @Override public void resourceChanged(IResourceChangeEvent event) { if (event.getType() == IResourceChangeEvent.POST_CHANGE) { try { event.getDelta().accept(new ResourceChangeVisitor()); - } catch (CoreException e) { + } catch (final CoreException e) { LogOperations.logError("ResourceChangeVisitor could not be set.", e); } } } /** - * Ensures that resource monitoring is active even if variantsync plugin is not - * active in eclipse. - * + * Ensures that resource monitoring is active even if variantsync plugin is not active in eclipse. + * * @throws CoreException resources could not be monitored */ public void registerSaveParticipant() throws CoreException { - IWorkspace ws = ResourcesPlugin.getWorkspace(); + final IWorkspace ws = ResourcesPlugin.getWorkspace(); // Registers the given plug-in's workspace save participant, and returns // an object describing the workspace state at the time of the last save // in which the bundle participated. - ISavedState ss = ws.addSaveParticipant(VariantSyncPlugin.PLUGIN_ID, this); + final ISavedState ss = ws.addSaveParticipant(VariantSyncPlugin.PLUGIN_ID, this); if (ss != null) { // used to receive notification of changes that might have happened diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeVisitor.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeVisitor.java index 65464e5..1e9b29e 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeVisitor.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/monitor/ResourceChangeVisitor.java @@ -26,11 +26,8 @@ import de.tubs.variantsync.core.utilities.event.VariantSyncEvent.EventType; /** - * Visits given resource delta and reacts on added, removed or changed resource - * deltas. "A resource delta represents changes in the state of a resource tree - * between two discrete points in time" - @see - * org.eclipse.core.resources.IResourceDelta. A resource tree represents a - * project of workspace. + * Visits given resource delta and reacts on added, removed or changed resource deltas. "A resource delta represents changes in the state of a resource tree + * between two discrete points in time" - @see org.eclipse.core.resources.IResourceDelta. A resource tree represents a project of workspace. * * @author Tristan Pfofe (tristan.pfofe@ckc.de) * @author Christopher Sontag @@ -41,13 +38,12 @@ class ResourceChangeVisitor implements IResourceDeltaVisitor { /** - * Called from ResourceChangeListener if a resource change have happened. - * Filters changed resource and handle change event. + * Called from ResourceChangeListener if a resource change have happened. Filters changed resource and handle change event. */ @Override public boolean visit(IResourceDelta delta) throws CoreException { - IResource res = delta.getResource(); - IProject project = res.getProject(); + final IResource res = delta.getResource(); + final IProject project = res.getProject(); if (!filterResource(project, res)) { return false; @@ -58,9 +54,8 @@ public boolean visit(IResourceDelta delta) throws CoreException { } /** - * Triggers action depending on kind of delta. Possible actions: add, remove or - * change file in admin folder. - * + * Triggers action depending on kind of delta. Possible actions: add, remove or change file in admin folder. + * * @param type kind of delta */ private void analyseDeltaType(IResourceDelta delta) { @@ -81,176 +76,152 @@ private void analyseDeltaType(IResourceDelta delta) { /** * Adds patch file to admin folder. - * - * @param res changed resource + * + * @param res changed resource * @param delta resource delta * @param flag */ @SuppressWarnings("unchecked") private void handleAddedResource(IResourceDelta delta) { - if (delta.getResource().getType() == IResource.FILE && ((delta.getFlags() & IResourceDelta.MARKERS) == 0 - || (delta.getFlags() & IResourceDelta.MOVED_FROM) != 0)) { - IFile file = (IFile) delta.getResource(); - ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager() - .getConfigurationProject(file.getProject()); + if ((delta.getResource().getType() == IResource.FILE) + && (((delta.getFlags() & IResourceDelta.MARKERS) == 0) || ((delta.getFlags() & IResourceDelta.MOVED_FROM) != 0))) { + final IFile file = (IFile) delta.getResource(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager().getConfigurationProject(file.getProject()); try { - if (configurationProject.getMappingManager().isActive() - && !configurationProject.getFeatureContextManager().isDefault()) { - IDeltaFactory factory = DeltaFactoryManager.getInstance().getFactoryByFile(file); + if (configurationProject.getMappingManager().isActive() && !configurationProject.getFeatureContextManager().isDefault()) { + final IDeltaFactory factory = DeltaFactoryManager.getInstance().getFactoryByFile(file); IPatch patch; if (configurationProject.getPatchesManager().getActualContextPatch() == null) { - IPatchFactory patchFactory = new DefaultPatchFactory(); + final IPatchFactory patchFactory = new DefaultPatchFactory(); patch = patchFactory.createPatch(configurationProject.getFeatureContextManager().getActual()); - VariantSyncPlugin.getDefault() - .fireEvent(new VariantSyncEvent(file, EventType.PATCH_ADDED, null, patch)); + VariantSyncPlugin.getDefault().fireEvent(new VariantSyncEvent(file, EventType.PATCH_ADDED, null, patch)); } else { patch = configurationProject.getPatchesManager().getActualContextPatch(); } - List> deltas = factory.createDeltas(file, file.getModificationStamp(), - IDelta.DELTATYPE(delta.getKind())); + final List> deltas = factory.createDeltas(file, file.getModificationStamp(), IDelta.DELTATYPE(delta.getKind())); patch.addDeltas(deltas); configurationProject.getPatchesManager().setActualContextPatch(patch); - VariantSyncPlugin.getDefault() - .fireEvent(new VariantSyncEvent(file, EventType.PATCH_CHANGED, null, patch)); + VariantSyncPlugin.getDefault().fireEvent(new VariantSyncEvent(file, EventType.PATCH_CHANGED, null, patch)); CodeMappingHandler.addCodeMappingsForDeltas(deltas); } - } catch (DiffException ex) { + } catch (final DiffException ex) { LogOperations.logError("Patch could not be created", ex); - } catch (NoSuchExtensionException ex) { + } catch (final NoSuchExtensionException ex) { LogOperations.logError("PatchFactory Extension does not exist!", ex); } } - LogOperations.logInfo(String.format("Resource %s was added with flag %s", delta.getResource().getFullPath(), - getFlagText(delta.getFlags()))); + LogOperations.logInfo(String.format("Resource %s was added with flag %s", delta.getResource().getFullPath(), getFlagText(delta.getFlags()))); } /** * Removes patch file from admin folder. - * - * @param res changed resource + * + * @param res changed resource * @param delta resource delta */ @SuppressWarnings("unchecked") private void handleRemovedResource(IResourceDelta delta) { - if (delta.getResource().getType() == IResource.FILE && ((delta.getFlags() & IResourceDelta.MARKERS) != 0 - || (delta.getFlags() & IResourceDelta.MOVED_FROM) != 0)) { - IFile file = (IFile) delta.getResource(); - ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager() - .getConfigurationProject(file.getProject()); + if ((delta.getResource().getType() == IResource.FILE) + && (((delta.getFlags() & IResourceDelta.MARKERS) != 0) || ((delta.getFlags() & IResourceDelta.MOVED_FROM) != 0))) { + final IFile file = (IFile) delta.getResource(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager().getConfigurationProject(file.getProject()); try { - if (configurationProject.getMappingManager().isActive() - && !configurationProject.getFeatureContextManager().isDefault()) { - IDeltaFactory factory = DeltaFactoryManager.getInstance().getFactoryByFile(file); + if (configurationProject.getMappingManager().isActive() && !configurationProject.getFeatureContextManager().isDefault()) { + final IDeltaFactory factory = DeltaFactoryManager.getInstance().getFactoryByFile(file); IPatch patch; if (configurationProject.getPatchesManager().getActualContextPatch() == null) { - IPatchFactory patchFactory = new DefaultPatchFactory(); + final IPatchFactory patchFactory = new DefaultPatchFactory(); patch = patchFactory.createPatch(configurationProject.getFeatureContextManager().getActual()); - VariantSyncPlugin.getDefault() - .fireEvent(new VariantSyncEvent(file, EventType.PATCH_ADDED, null, patch)); + VariantSyncPlugin.getDefault().fireEvent(new VariantSyncEvent(file, EventType.PATCH_ADDED, null, patch)); } else { patch = configurationProject.getPatchesManager().getActualContextPatch(); } - List> deltas = factory.createDeltas(file, file.getModificationStamp(), - IDelta.DELTATYPE(delta.getKind())); + final List> deltas = factory.createDeltas(file, file.getModificationStamp(), IDelta.DELTATYPE(delta.getKind())); patch.addDeltas(deltas); configurationProject.getPatchesManager().setActualContextPatch(patch); - VariantSyncPlugin.getDefault() - .fireEvent(new VariantSyncEvent(file, EventType.PATCH_CHANGED, null, patch)); + VariantSyncPlugin.getDefault().fireEvent(new VariantSyncEvent(file, EventType.PATCH_CHANGED, null, patch)); CodeMappingHandler.addCodeMappingsForDeltas(deltas); } - } catch (DiffException ex) { + } catch (final DiffException ex) { LogOperations.logError("Patch could not be created", ex); - } catch (NoSuchExtensionException ex) { + } catch (final NoSuchExtensionException ex) { LogOperations.logError("PatchFactory Extension does not exist!", ex); } } - LogOperations.logInfo(String.format("Resource %s was removed with flag %s", delta.getResource().getFullPath(), - getFlagText(delta.getFlags()))); + LogOperations.logInfo(String.format("Resource %s was removed with flag %s", delta.getResource().getFullPath(), getFlagText(delta.getFlags()))); } /** * Creates patch for changed resource. - * - * @param res changed resource + * + * @param res changed resource * @param delta resource delta */ @SuppressWarnings("unchecked") private void handleChangedResource(IResourceDelta delta) { - if (delta.getResource().getType() == IResource.FILE && (delta.getFlags() & IResourceDelta.CONTENT) != 0) { - IFile file = (IFile) delta.getResource(); + if ((delta.getResource().getType() == IResource.FILE) && ((delta.getFlags() & IResourceDelta.CONTENT) != 0)) { + final IFile file = (IFile) delta.getResource(); final IFileState[] states; try { states = file.getHistory(null); if (states.length > 0) { - long t = states[0].getModificationTime(); + final long t = states[0].getModificationTime(); - ConfigurationProject configurationProject = VariantSyncPlugin.getConfigurationProjectManager() - .getConfigurationProject(file.getProject()); + final ConfigurationProject configurationProject = + VariantSyncPlugin.getConfigurationProjectManager().getConfigurationProject(file.getProject()); try { - if (configurationProject.getMappingManager().isActive() - && !configurationProject.getFeatureContextManager().isDefault()) { - IDeltaFactory factory = DeltaFactoryManager.getInstance().getFactoryByFile(file); + if (configurationProject.getMappingManager().isActive() && !configurationProject.getFeatureContextManager().isDefault()) { + final IDeltaFactory factory = DeltaFactoryManager.getInstance().getFactoryByFile(file); IPatch patch; if (configurationProject.getPatchesManager().getActualContextPatch() == null) { - IPatchFactory patchFactory = new DefaultPatchFactory(); - patch = patchFactory - .createPatch(configurationProject.getFeatureContextManager().getActual()); - VariantSyncPlugin.getDefault() - .fireEvent(new VariantSyncEvent(file, EventType.PATCH_ADDED, null, patch)); + final IPatchFactory patchFactory = new DefaultPatchFactory(); + patch = patchFactory.createPatch(configurationProject.getFeatureContextManager().getActual()); + VariantSyncPlugin.getDefault().fireEvent(new VariantSyncEvent(file, EventType.PATCH_ADDED, null, patch)); } else { patch = configurationProject.getPatchesManager().getActualContextPatch(); } - List> deltas = factory.createDeltas(file, states[0], t, - IDelta.DELTATYPE(delta.getKind())); + final List> deltas = factory.createDeltas(file, states[0], t, IDelta.DELTATYPE(delta.getKind())); patch.addDeltas(deltas); configurationProject.getPatchesManager().setActualContextPatch(patch); - VariantSyncPlugin.getDefault() - .fireEvent(new VariantSyncEvent(file, EventType.PATCH_CHANGED, null, patch)); + VariantSyncPlugin.getDefault().fireEvent(new VariantSyncEvent(file, EventType.PATCH_CHANGED, null, patch)); CodeMappingHandler.addCodeMappingsForDeltas(deltas); } - } catch (DiffException ex) { + } catch (final DiffException ex) { LogOperations.logError("Patch could not be created", ex); - } catch (NoSuchExtensionException ex) { + } catch (final NoSuchExtensionException ex) { LogOperations.logError("PatchFactory Extension does not exist!", ex); } } - } catch (CoreException e) { + } catch (final CoreException e) { LogOperations.logError("File states could not be retrieved.", e); } - LogOperations.logInfo(String.format("Resource %s was changed with flag %s", - delta.getResource().getFullPath(), getFlagText(delta.getFlags()))); + LogOperations.logInfo(String.format("Resource %s was changed with flag %s", delta.getResource().getFullPath(), getFlagText(delta.getFlags()))); } } /** - * Checks if resource does not fulfill any following criteria:
- *
    - *
  • project has nature support
  • - *
  • project is open
  • - *
  • resource still exists
  • - *
  • resource is a file
  • - *
  • resource starts not with \".\"
  • - *
- * + * Checks if resource does not fulfill any following criteria:
  • project has nature support
  • project is open
  • resource still + * exists
  • resource is a file
  • resource starts not with \".\"
+ * * @param project project resource belongs to - * @param res resource to check + * @param res resource to check * @return true if any criteria was fulfilled * @throws CoreException */ private boolean filterResource(IProject project, IResource res) throws CoreException { - if (project != null && project.isOpen() && !project.hasNature(Variant.NATURE_ID)) { + if ((project != null) && project.isOpen() && !project.hasNature(Variant.NATURE_ID)) { return false; } - if (project != null && !project.isOpen()) { + if ((project != null) && !project.isOpen()) { return false; } - String name = res.getName(); + final String name = res.getName(); return !(res.isDerived() || name.startsWith(".")); } /** * Adds debug messages. - * + * * @param flag * @return debug message */ diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/AddVariantNature.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/AddVariantNature.java index a7991cd..70e41df 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/AddVariantNature.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/AddVariantNature.java @@ -18,18 +18,18 @@ public class AddVariantNature extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { - ISelection currentSelection = HandlerUtil.getCurrentSelection(event); + final ISelection currentSelection = HandlerUtil.getCurrentSelection(event); if (currentSelection instanceof IStructuredSelection) { - for (Object firstElement : ((IStructuredSelection) currentSelection).toArray()) { + for (final Object firstElement : ((IStructuredSelection) currentSelection).toArray()) { // Get an IResource as an adapter from the current selection - IAdapterManager adapterManager = Platform.getAdapterManager(); - IResource resourceAdapter = adapterManager.getAdapter(firstElement, IResource.class); + final IAdapterManager adapterManager = Platform.getAdapterManager(); + final IResource resourceAdapter = adapterManager.getAdapter(firstElement, IResource.class); if (resourceAdapter != null) { - IResource resource = resourceAdapter; - IProject project = resource.getProject(); + final IResource resource = resourceAdapter; + final IProject project = resource.getProject(); VariantSyncPlugin.addNature(project); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/CreateVariantProject.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/CreateVariantProject.java index 395b9c6..3f1c619 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/CreateVariantProject.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/nature/CreateVariantProject.java @@ -27,17 +27,17 @@ public class CreateVariantProject extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { - ISelection currentSelection = HandlerUtil.getCurrentSelection(event); + final ISelection currentSelection = HandlerUtil.getCurrentSelection(event); if (currentSelection instanceof IStructuredSelection) { - Object firstElement = ((IStructuredSelection) currentSelection).getFirstElement(); + final Object firstElement = ((IStructuredSelection) currentSelection).getFirstElement(); // Get an IResource as an adapter from the current selection - IAdapterManager adapterManager = Platform.getAdapterManager(); - IResource resourceAdapter = adapterManager.getAdapter(firstElement, IResource.class); + final IAdapterManager adapterManager = Platform.getAdapterManager(); + final IResource resourceAdapter = adapterManager.getAdapter(firstElement, IResource.class); if (resourceAdapter != null) { - IResource resource = resourceAdapter; + final IResource resource = resourceAdapter; String projectName = resource.getName(); projectName = projectName.substring(0, projectName.lastIndexOf(".")); @@ -53,27 +53,26 @@ public Object execute(ExecutionEvent event) throws ExecutionException { } private IProject createJavaProjectWithVariantNature(String projectName) { - VariantSyncProgressMonitor progressMonitor = new VariantSyncProgressMonitor("Create Project " + projectName); + final VariantSyncProgressMonitor progressMonitor = new VariantSyncProgressMonitor("Create Project " + projectName); // create project - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IProject project = root.getProject(projectName); + final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + final IProject project = root.getProject(projectName); try { progressMonitor.setSubTaskName("Create and open project"); project.create(progressMonitor); project.open(progressMonitor); // set natures - IProjectDescription description = project.getDescription(); + final IProjectDescription description = project.getDescription(); description.setNatureIds(new String[] { Variant.NATURE_ID, JavaCore.NATURE_ID }); // create java project progressMonitor.setSubTaskName("Setting needed natures"); project.setDescription(description, progressMonitor); - IJavaProject javaProject = JavaCore.create(project); + final IJavaProject javaProject = JavaCore.create(project); // set build path - IClasspathEntry[] buildPath = { JavaCore.newSourceEntry(project.getFullPath().append("src")), - JavaRuntime.getDefaultJREContainerEntry() }; + final IClasspathEntry[] buildPath = { JavaCore.newSourceEntry(project.getFullPath().append("src")), JavaRuntime.getDefaultJREContainerEntry() }; progressMonitor.setSubTaskName("Setting build paths of project"); javaProject.setRawClasspath(buildPath, project.getFullPath().append("bin"), progressMonitor); @@ -92,7 +91,7 @@ private IProject createJavaProjectWithVariantNature(String projectName) { folder.create(true, true, progressMonitor); } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } return project; diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/ADelta.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/ADelta.java index 71eee16..67c0d0a 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/ADelta.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/ADelta.java @@ -12,10 +12,9 @@ import de.tubs.variantsync.core.patch.interfaces.IPatch; /** - * This abstract class defines all fundamental methods of deltas.
- * Classes extending this interface should implement also {@link #clone()} - * and {@link #equals(Object)} - * + * This abstract class defines all fundamental methods of deltas.
Classes extending this interface should implement also {@link #clone()} and + * {@link #equals(Object)} + * * @author Christopher Sontag * @version 1.0 * @since 05.09.2017 @@ -41,7 +40,7 @@ public ADelta(IFile res, String factoryId) { public ADelta(IFile res, long timestamp, String factoryId) { this.resource = res; - if (res != null && res.getLocalTimeStamp() != IResource.NULL_STAMP) { + if ((res != null) && (res.getLocalTimeStamp() != IResource.NULL_STAMP)) { timestamp = res.getLocalTimeStamp(); } this.timestamp = timestamp; @@ -51,7 +50,7 @@ public ADelta(IFile res, long timestamp, String factoryId) { /** * Creates a new instance with the same field for field attributes - * + * * @param delta - old delta */ public ADelta(ADelta delta) { @@ -89,9 +88,10 @@ public boolean isSynchronizedProject(IProject project) { @Override public boolean isSynchronizedProject(String projectName) { - for (IProject project : syncronizedProjects) { - if (project.getName().equals(projectName)) + for (final IProject project : syncronizedProjects) { + if (project.getName().equals(projectName)) { return true; + } } return false; } @@ -211,67 +211,89 @@ public String getFactoryId() { @Override public String toString() { - return String.format("ADelta [resource=%s, revised=%s, type=%s, timestamp=%s, context=%s, factoryId=%s]", - resource, revised, type, timestamp, context, factoryId); + return String.format("ADelta [resource=%s, revised=%s, type=%s, timestamp=%s, context=%s, factoryId=%s]", resource, revised, type, timestamp, context, + factoryId); } @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; - ADelta other = (ADelta) obj; + } + final ADelta other = (ADelta) obj; if (factoryId == null) { - if (other.factoryId != null) + if (other.factoryId != null) { return false; - } else if (!factoryId.equals(other.factoryId)) + } + } else if (!factoryId.equals(other.factoryId)) { return false; + } if (context == null) { - if (other.context != null) + if (other.context != null) { return false; - } else if (!context.equals(other.context)) + } + } else if (!context.equals(other.context)) { return false; + } if (original == null) { - if (other.original != null) + if (other.original != null) { return false; - } else if (!original.equals(other.original)) + } + } else if (!original.equals(other.original)) { return false; + } if (parent == null) { - if (other.parent != null) + if (other.parent != null) { return false; + } } // else if (!parent.equals(other.parent)) return false; if (project == null) { - if (other.project != null) + if (other.project != null) { return false; - } else if (!project.equals(other.project)) + } + } else if (!project.equals(other.project)) { return false; + } if (properties == null) { - if (other.properties != null) + if (other.properties != null) { return false; - } else if (!properties.equals(other.properties)) + } + } else if (!properties.equals(other.properties)) { return false; + } if (resource == null) { - if (other.resource != null) + if (other.resource != null) { return false; - } else if (!resource.equals(other.resource)) + } + } else if (!resource.equals(other.resource)) { return false; + } if (revised == null) { - if (other.revised != null) + if (other.revised != null) { return false; - } else if (!revised.equals(other.revised)) + } + } else if (!revised.equals(other.revised)) { return false; + } if (syncronizedProjects == null) { - if (other.syncronizedProjects != null) + if (other.syncronizedProjects != null) { return false; - } else if (!syncronizedProjects.equals(other.syncronizedProjects)) + } + } else if (!syncronizedProjects.equals(other.syncronizedProjects)) { return false; - if (timestamp != other.timestamp) + } + if (timestamp != other.timestamp) { return false; - if (type != other.type) + } + if (type != other.type) { return false; + } return true; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/AMarkerHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/AMarkerHandler.java index 0c149b3..d69f252 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/AMarkerHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/AMarkerHandler.java @@ -24,7 +24,6 @@ public List getMarkersForDelta(IFile file, IDelta delta) public abstract List getMarkers(IFile file, int offset, int length); @Override - public abstract boolean updateMarkerForDelta(SourceFile sourceFile, IDelta delta, - List variantSyncMarkers); + public abstract boolean updateMarkerForDelta(SourceFile sourceFile, IDelta delta, List variantSyncMarkers); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/APatch.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/APatch.java index df2a173..71102f4 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/APatch.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/APatch.java @@ -8,7 +8,7 @@ public class APatch implements IPatch { - private List> deltas = new ArrayList<>(); + private final List> deltas = new ArrayList<>(); private long startTime, endTime; private String feature; @@ -16,20 +16,24 @@ public class APatch implements IPatch { @Override public void addDelta(IDelta delta) { - if (delta.getPatch() == null) + if (delta.getPatch() == null) { delta.setPatch(this); - if (delta.getContext() == "") + } + if (delta.getContext() == "") { delta.setContext(feature); + } deltas.add(delta); } @Override public void addDeltas(List> deltas) { - for (IDelta delta : deltas) { - if (delta.getPatch() == null) + for (final IDelta delta : deltas) { + if (delta.getPatch() == null) { delta.setPatch(this); - if (delta.getContext() == "") + } + if (delta.getContext() == "") { delta.setContext(feature); + } } this.deltas.addAll(deltas); } @@ -95,27 +99,36 @@ public void setContext(String feature) { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; - APatch other = (APatch) obj; + } + final APatch other = (APatch) obj; if (deltas == null) { - if (other.deltas != null) + if (other.deltas != null) { return false; - } else if (!deltas.equals(other.deltas)) + } + } else if (!deltas.equals(other.deltas)) { return false; - if (endTime != other.endTime) + } + if (endTime != other.endTime) { return false; + } if (feature == null) { - if (other.feature != null) + if (other.feature != null) { return false; - } else if (!feature.equals(other.feature)) + } + } else if (!feature.equals(other.feature)) { return false; - if (startTime != other.startTime) + } + if (startTime != other.startTime) { return false; + } return true; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java index cf26096..8a719d6 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java @@ -9,7 +9,6 @@ import de.ovgu.featureide.fm.core.EclipseExtensionLoader; import de.ovgu.featureide.fm.core.ExtensionManager; import de.ovgu.featureide.fm.core.IExtensionLoader; -import de.ovgu.featureide.fm.core.ExtensionManager.NoSuchExtensionException; import de.tubs.variantsync.core.VariantSyncPlugin; import de.tubs.variantsync.core.patch.base.DefaultDeltaFactory; import de.tubs.variantsync.core.patch.interfaces.IDeltaFactory; @@ -23,9 +22,9 @@ public class DeltaFactoryManager extends ExtensionManager { private final List extensions = new ArrayList<>(); public DeltaFactoryManager() { - IDeltaFactory[] y = new IDeltaFactory[] { getDefaultFactory() }; - IExtensionLoader x = new EclipseExtensionLoader(VariantSyncPlugin.PLUGIN_ID, - IDeltaFactory.extensionPointID, IDeltaFactory.extensionID, IDeltaFactory.class); + final IDeltaFactory[] y = new IDeltaFactory[] { getDefaultFactory() }; + final IExtensionLoader x = new EclipseExtensionLoader(VariantSyncPlugin.PLUGIN_ID, IDeltaFactory.extensionPointID, + IDeltaFactory.extensionID, IDeltaFactory.class); setExtensionLoaderInternal(x); addExtension(getDefaultFactory()); } @@ -40,7 +39,7 @@ public static void setExtensionLoader(IExtensionLoader extensionL /** * Returns the factory for a given id - * + * * @param id * @return factory which has the given id * @throws NoSuchExtensionException @@ -50,15 +49,14 @@ public static IDeltaFactory getFactoryById(String id) throws NoSuchExtensionExce } /** - * Returns the specific factory for the given file. If no factory supports the - * file then the default factory is returned - * + * Returns the specific factory for the given file. If no factory supports the file then the default factory is returned + * * @param file * @return factory which supports the file * @throws NoSuchExtensionException */ public IDeltaFactory getFactoryByFile(IFile file) throws NoSuchExtensionException { - for (IDeltaFactory factory : instance.getExtensions()) { + for (final IDeltaFactory factory : instance.getExtensions()) { if (factory.isSupported(file)) { return factory; } @@ -68,7 +66,7 @@ public IDeltaFactory getFactoryByFile(IFile file) throws NoSuchExtensionExceptio /** * Returns the default factory (line-based diffs) - * + * * @return factory for line-based diffs */ public static IDeltaFactory getDefaultFactory() { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/HistoryStore.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/HistoryStore.java index 7eb2eb4..6fee09f 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/HistoryStore.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/HistoryStore.java @@ -14,9 +14,8 @@ public class HistoryStore { public static final String historyFolder = ".history"; public void addHistory(IFile file, List content, long timestamp) { - IProject project = file.getProject(); - IFile historyFile = project.getFolder(historyFolder) - .getFolder(file.getProjectRelativePath().toOSString().replace(".", "_").replace("/", "_")) + final IProject project = file.getProject(); + final IFile historyFile = project.getFolder(historyFolder).getFolder(file.getProjectRelativePath().toOSString().replace(".", "_").replace("/", "_")) .getFile(timestamp + ".java"); FileHelper.setFileLines(historyFile, content); } @@ -37,9 +36,8 @@ public boolean exists(IFile file, long timestamp) { } public IFile getState(IFile file, long timestamp) { - IProject project = file.getProject(); - return project.getFolder(historyFolder) - .getFolder(file.getProjectRelativePath().toOSString().replace(".", "_").replace("/", "_")) + final IProject project = file.getProject(); + return project.getFolder(historyFolder).getFolder(file.getProjectRelativePath().toOSString().replace(".", "_").replace("/", "_")) .getFile(timestamp + ".txt"); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDelta.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDelta.java index fc62171..7e1c752 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDelta.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDelta.java @@ -24,19 +24,19 @@ public String getOriginalAsString() { String ret = String.valueOf(original.getPosition()); ret = ret + ":;:"; - for (String line : (List) original.getLines()) { + for (final String line : original.getLines()) { ret = ret + line + "#:#"; } ret = ret.substring(0, ret.lastIndexOf("#:#")); ret = ret + ":;:"; - for (String bLine : original.getBefore()) { + for (final String bLine : original.getBefore()) { ret = ret + bLine + "#:#"; } ret = ret.substring(0, ret.lastIndexOf("#:#")); ret = ret + ":;:"; - for (String aLine : original.getAfter()) { + for (final String aLine : original.getAfter()) { ret = ret + aLine + "#:#"; } ret = ret.substring(0, ret.lastIndexOf("#:#")); @@ -46,11 +46,11 @@ public String getOriginalAsString() { @Override public void setOriginalFromString(String original) { - List elements = Arrays.asList(original.split(":;:")); - int pos = Integer.valueOf(elements.get(0)); - List lines = Arrays.asList(elements.get(1).split("#:#")); - List before = Arrays.asList(elements.get(2).split("#:#")); - List after = Arrays.asList(elements.get(3).split("#:#")); + final List elements = Arrays.asList(original.split(":;:")); + final int pos = Integer.valueOf(elements.get(0)); + final List lines = Arrays.asList(elements.get(1).split("#:#")); + final List before = Arrays.asList(elements.get(2).split("#:#")); + final List after = Arrays.asList(elements.get(3).split("#:#")); this.original = new Chunk(pos, lines); this.original.setBefore(before); this.original.setAfter(after); @@ -61,26 +61,26 @@ public String getRevisedAsString() { String ret = String.valueOf(revised.getPosition()); ret = ret + ":;:"; - for (String line : (List) revised.getLines()) { + for (final String line : revised.getLines()) { ret = ret + line + "#:#"; } - if (!((List) revised.getLines()).isEmpty()) { + if (!revised.getLines().isEmpty()) { ret = ret.substring(0, ret.lastIndexOf("#:#")); } ret = ret + ":;:"; - for (String bLine : revised.getBefore()) { + for (final String bLine : revised.getBefore()) { ret = ret + bLine + "#:#"; } - if (!((List) revised.getBefore()).isEmpty()) { + if (!revised.getBefore().isEmpty()) { ret = ret.substring(0, ret.lastIndexOf("#:#")); } ret = ret + ":;:"; - for (String aLine : revised.getAfter()) { + for (final String aLine : revised.getAfter()) { ret = ret + aLine + "#:#"; } - if (!((List) revised.getAfter()).isEmpty()) { + if (!revised.getAfter().isEmpty()) { ret = ret.substring(0, ret.lastIndexOf("#:#")); } @@ -89,11 +89,11 @@ public String getRevisedAsString() { @Override public void setRevisedFromString(String revised) { - List elements = Arrays.asList(revised.split(":;:")); - int pos = Integer.valueOf(elements.get(0)); - List lines = Arrays.asList(elements.get(1).split("#:#")); - List before = Arrays.asList(elements.get(2).split("#:#")); - List after = Arrays.asList(elements.get(3).split("#:#")); + final List elements = Arrays.asList(revised.split(":;:")); + final int pos = Integer.valueOf(elements.get(0)); + final List lines = Arrays.asList(elements.get(1).split("#:#")); + final List before = Arrays.asList(elements.get(2).split("#:#")); + final List after = Arrays.asList(elements.get(3).split("#:#")); this.revised = new Chunk(pos, lines); this.revised.setBefore(before); this.revised.setAfter(after); @@ -101,20 +101,19 @@ public void setRevisedFromString(String revised) { @Override public String getRepresentation() { - return "--- (" + this.original.getPosition() + ") " + this.original.getLines() + "\n" + "+++ (" - + this.revised.getPosition() + ") " + this.revised.getLines(); + return "--- (" + original.getPosition() + ") " + original.getLines() + "\n" + "+++ (" + revised.getPosition() + ") " + revised.getLines(); } @Override protected Object clone() { - DefaultDelta defaultDelta = new DefaultDelta(this.resource, this.timestamp, this.factoryId); - defaultDelta.setContext(this.context); - defaultDelta.setOriginal(this.original); - defaultDelta.setPatch(this.parent); - defaultDelta.setProject(this.project); - defaultDelta.setRevised(this.revised); - defaultDelta.setSynchronizedProjects(this.syncronizedProjects); - defaultDelta.setType(this.type); + final DefaultDelta defaultDelta = new DefaultDelta(resource, timestamp, factoryId); + defaultDelta.setContext(context); + defaultDelta.setOriginal(original); + defaultDelta.setPatch(parent); + defaultDelta.setProject(project); + defaultDelta.setRevised(revised); + defaultDelta.setSynchronizedProjects(syncronizedProjects); + defaultDelta.setType(type); return defaultDelta; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java index dc63f9f..26bd0a1 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultDeltaFactory.java @@ -26,7 +26,7 @@ /** * DefaultDeltaFactory - * + * * @author Christopher Sontag * @since 18.08.2017 */ @@ -34,7 +34,7 @@ public class DefaultDeltaFactory implements IDeltaFactory> { private static IDeltaFactory instance = new DefaultDeltaFactory(); - private HistoryStore historyStore = new HistoryStore(); + private final HistoryStore historyStore = new HistoryStore(); @Override public String getId() { @@ -57,27 +57,27 @@ public String toString() { @Override public List>> createDeltas(IFile res, long timestamp, DELTATYPE kind) throws DiffException { - IFileState state = FileHelper.getLatestHistory((IFile) res); + final IFileState state = FileHelper.getLatestHistory(res); return createDeltas(res, state, timestamp, kind); } @Override - public List>> createDeltas(IFile res, IFileState oldState, long timestamp, DELTATYPE kind) - throws DiffException { + public List>> createDeltas(IFile res, IFileState oldState, long timestamp, DELTATYPE kind) throws DiffException { // Check for null arguments - if (res == null || oldState == null || kind == null) + if ((res == null) || (oldState == null) || (kind == null)) { return null; + } // Get the current mappings List currentFilelines = null; if (res.exists() && !kind.equals(DELTATYPE.REMOVED)) { - currentFilelines = FileHelper.getFileLines((IFile) res); + currentFilelines = FileHelper.getFileLines(res); } else { currentFilelines = new ArrayList<>(); } // Get the history mappings - List historyFilelines = FileHelper.getFileLines(oldState); + final List historyFilelines = FileHelper.getFileLines(oldState); // DiffUtils are 0-based, Eclipse instead 1-based currentFilelines.add(0, ""); @@ -87,17 +87,17 @@ public List>> createDeltas(IFile res, IFileState oldState, Patch patch; try { patch = DiffUtils.diff(new ArrayList(historyFilelines), new ArrayList(currentFilelines), 2); - } catch (com.github.difflib.algorithm.DiffException e) { + } catch (final com.github.difflib.algorithm.DiffException e) { throw new DiffException(e.getMessage()); } // If a patch was created wrap it in Delta - if (!patch.getDeltas().isEmpty() && patch.getDeltas().size() > 0) { + if (!patch.getDeltas().isEmpty() && (patch.getDeltas().size() > 0)) { - List>> deltas = new ArrayList<>(); - for (Delta originalDelta : patch.getDeltas()) { + final List>> deltas = new ArrayList<>(); + for (final Delta originalDelta : patch.getDeltas()) { - IDelta> delta = new DefaultDelta(res, getId()); + final IDelta> delta = new DefaultDelta(res, getId()); delta.setType(kind); delta.setOriginal(originalDelta.getOriginal()); delta.setRevised(originalDelta.getRevised()); @@ -118,11 +118,12 @@ public List>> createDeltas(IFile res, IFileState oldState, @Override public IDelta> createDeltas(IFile res, IDelta originalDelta) { - if (res == null) + if (res == null) { return null; + } if (originalDelta instanceof DefaultDelta) { - DefaultDelta defaultDelta = (DefaultDelta) originalDelta; - IDelta> delta = new DefaultDelta(res, getId()); + final DefaultDelta defaultDelta = (DefaultDelta) originalDelta; + final IDelta> delta = new DefaultDelta(res, getId()); delta.setType(defaultDelta.getType()); delta.setOriginal(defaultDelta.getOriginal()); delta.setRevised(defaultDelta.getRevised()); @@ -136,14 +137,15 @@ public IDelta> createDeltas(IFile res, IDelta originalDelta) { @Override public List>> createDeltas(IFile original, IFile revised) throws DiffException { // Check for null arguments - if (original == null || revised == null) + if ((original == null) || (revised == null)) { return null; + } // Get the current mappings - List currentFilelines = FileHelper.getFileLines(original); + final List currentFilelines = FileHelper.getFileLines(original); // Get the history mappings - List historyFilelines = FileHelper.getFileLines(revised); + final List historyFilelines = FileHelper.getFileLines(revised); // DiffUtils are 0-based, Eclipse instead 1-based currentFilelines.add(0, ""); @@ -153,17 +155,17 @@ public List>> createDeltas(IFile original, IFile revised) t Patch patch; try { patch = DiffUtils.diff(new ArrayList(historyFilelines), new ArrayList(currentFilelines), 2); - } catch (com.github.difflib.algorithm.DiffException e) { + } catch (final com.github.difflib.algorithm.DiffException e) { throw new DiffException(e.getMessage()); } // If a patch was created wrap it in Delta - if (!patch.getDeltas().isEmpty() && patch.getDeltas().size() > 0) { + if (!patch.getDeltas().isEmpty() && (patch.getDeltas().size() > 0)) { - List>> deltas = new ArrayList<>(); - for (Delta originalDelta : patch.getDeltas()) { + final List>> deltas = new ArrayList<>(); + for (final Delta originalDelta : patch.getDeltas()) { - IDelta> delta = new DefaultDelta(original, getId()); + final IDelta> delta = new DefaultDelta(original, getId()); delta.setType(DELTATYPE.CHANGED); delta.setOriginal(originalDelta.getOriginal()); delta.setRevised(originalDelta.getRevised()); @@ -185,10 +187,10 @@ public List>> createDeltas(IFile original, IFile revised) t @Override public IFile applyDelta(IFile res, IDelta> patch) { try { - Patch p = new Patch(); + final Patch p = new Patch(); - Chunk chunkOriginal = patch.getOriginal(); - Chunk chunkRevised = patch.getRevised(); + final Chunk chunkOriginal = patch.getOriginal(); + final Chunk chunkRevised = patch.getRevised(); Delta delta = null; switch (patch.getType()) { @@ -210,7 +212,7 @@ public IFile applyDelta(IFile res, IDelta> patch) { } p.addDelta(delta); - List linesOld = FileHelper.getFileLines(res); + final List linesOld = FileHelper.getFileLines(res); List linesNew; // DiffUtils are 0-based, Eclipse instead 1-based @@ -225,7 +227,7 @@ public IFile applyDelta(IFile res, IDelta> patch) { FileHelper.setFileLines(res, linesNew); } - } catch (PatchFailedException e) { + } catch (final PatchFailedException e) { LogOperations.logError("Error when patching file", e); } return res; @@ -233,10 +235,10 @@ public IFile applyDelta(IFile res, IDelta> patch) { @Override public IFile reverseDelta(IFile res, IDelta> patch) { - Patch p = new Patch(); + final Patch p = new Patch(); - Chunk chunkOriginal = patch.getOriginal(); - Chunk chunkRevised = patch.getRevised(); + final Chunk chunkOriginal = patch.getOriginal(); + final Chunk chunkRevised = patch.getRevised(); Delta delta = null; switch (patch.getType()) { @@ -258,7 +260,7 @@ public IFile reverseDelta(IFile res, IDelta> patch) { } p.addDelta(delta); - List linesNew = FileHelper.getFileLines(res); + final List linesNew = FileHelper.getFileLines(res); linesNew.add(0, ""); List linesOld; @@ -276,11 +278,12 @@ public IFile reverseDelta(IFile res, IDelta> patch) { @Override public boolean verifyDelta(IFile res, IDelta> patch) { - Chunk chunkOriginal = patch.getOriginal(); - Chunk chunkRevised = patch.getRevised(); + final Chunk chunkOriginal = patch.getOriginal(); + final Chunk chunkRevised = patch.getRevised(); - if (chunkOriginal == null || chunkRevised == null) + if ((chunkOriginal == null) || (chunkRevised == null)) { return false; + } Delta delta = null; switch (patch.getType()) { @@ -301,15 +304,14 @@ public boolean verifyDelta(IFile res, IDelta> patch) { return false; } - List lines = FileHelper.getFileLines(res); + final List lines = FileHelper.getFileLines(res); lines.add(0, ""); try { delta.verify(lines); - } catch (PatchFailedException e) { + } catch (final PatchFailedException e) { return false; - } catch (IndexOutOfBoundsException e) { - LogOperations.logDebug( - "An IndexOutOfBoundsException occured. The file used for comparision has fewer lines than what was changed by the delta."); + } catch (final IndexOutOfBoundsException e) { + LogOperations.logDebug("An IndexOutOfBoundsException occured. The file used for comparision has fewer lines than what was changed by the delta."); return false; } return true; diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultMarkerHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultMarkerHandler.java index 243fd79..db46718 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultMarkerHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultMarkerHandler.java @@ -22,11 +22,10 @@ public class DefaultMarkerHandler extends AMarkerHandler> { @SuppressWarnings("rawtypes") @Override public List getMarkersForDeltas(IFile file, List>> deltas) { - List variantSyncMarkers = new ArrayList<>(); - for (IDelta> delta : deltas) { - Chunk revised = delta.getRevised(); - IVariantSyncMarker variantSyncMarker = new AMarkerInformation(revised.getPosition() - 1, - revised.getLines().size() - 1, true); + final List variantSyncMarkers = new ArrayList<>(); + for (final IDelta> delta : deltas) { + final Chunk revised = delta.getRevised(); + final IVariantSyncMarker variantSyncMarker = new AMarkerInformation(revised.getPosition() - 1, revised.getLines().size() - 1, true); variantSyncMarker.setContext(delta.getContext()); variantSyncMarkers.add(variantSyncMarker); } @@ -39,14 +38,13 @@ public List getMarkers(IFile file, int offset, int length) { } @Override - public boolean updateMarkerForDelta(SourceFile sourceFile, IDelta> delta, - List variantSyncMarkers) { - for (CodeMapping codeMapping : sourceFile.getMappings()) { - IVariantSyncMarker cmMarkerInformation = codeMapping.getMarkerInformation(); - IMarker marker = MarkerUtils.getMarker(delta.getResource(), cmMarkerInformation.getMarkerId()); - - int offset = marker.getAttribute(IMarker.CHAR_START, -1); - int length = marker.getAttribute(IMarker.CHAR_END, -1); + public boolean updateMarkerForDelta(SourceFile sourceFile, IDelta> delta, List variantSyncMarkers) { + for (final CodeMapping codeMapping : sourceFile.getMappings()) { + final IVariantSyncMarker cmMarkerInformation = codeMapping.getMarkerInformation(); + final IMarker marker = MarkerUtils.getMarker(delta.getResource(), cmMarkerInformation.getMarkerId()); + + final int offset = marker.getAttribute(IMarker.CHAR_START, -1); + final int length = marker.getAttribute(IMarker.CHAR_END, -1); if (offset != -1) { cmMarkerInformation.setOffset(offset); cmMarkerInformation.setLength(length - offset); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultPatchFactory.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultPatchFactory.java index 6c38e74..45b23db 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultPatchFactory.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/base/DefaultPatchFactory.java @@ -15,7 +15,7 @@ public class DefaultPatchFactory implements IPatchFactory { @Override public IPatch> createPatch(String context) { - IPatch> patch = new APatch>(); + final IPatch> patch = new APatch>(); patch.setContext(context); patch.setStartTime(System.currentTimeMillis()); return patch; @@ -23,7 +23,7 @@ public IPatch> createPatch(String context) { @Override public IPatch> createPatch() { - IPatch> patch = new APatch>(); + final IPatch> patch = new APatch>(); return patch; } @@ -31,11 +31,11 @@ public IPatch> createPatch() { @Override public IFile applyDelta(IFile file, IPatch patch) { IFile newFile = file; - for (IDelta delta : patch.getDeltas()) { + for (final IDelta delta : patch.getDeltas()) { try { - IDeltaFactory factory = DeltaFactoryManager.getFactoryById(delta.getFactoryId()); + final IDeltaFactory factory = DeltaFactoryManager.getFactoryById(delta.getFactoryId()); newFile = factory.applyDelta(newFile, delta); - } catch (NoSuchExtensionException e) { + } catch (final NoSuchExtensionException e) { LogOperations.logError("Could not find extension with id: " + delta.getFactoryId(), e); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDelta.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDelta.java index 2eac777..b3dbc29 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDelta.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDelta.java @@ -9,10 +9,9 @@ import de.tubs.variantsync.core.patch.ADelta; /** - * This interface defines delta.
- * Classes implementing this interface should implement also {@link #clone()} - * and {@link #equals(Object)}. For implementations see also {@link ADelta} - * + * This interface defines delta.
Classes implementing this interface should implement also {@link #clone()} and {@link #equals(Object)}. For + * implementations see also {@link ADelta} + * * @author Christopher Sontag * @version 1.0 * @since 18.08.2017 @@ -35,88 +34,84 @@ public enum DELTATYPE { /** * Returns original delta - * + * * @return T - original delta */ T getOriginal(); /** - * Returns original as string. Do not use this method outside of saving or - * loading! - * + * Returns original as string. Do not use this method outside of saving or loading! + * * @return */ String getOriginalAsString(); /** * Sets orginal delta - * + * * @param original - original delta */ void setOriginal(T original); /** - * Sets original from string. Do not use this method outside of saving or - * loading! - * + * Sets original from string. Do not use this method outside of saving or loading! + * * @param original */ void setOriginalFromString(String original); /** * Returns revised delta - * + * * @return T - revised delta */ T getRevised(); /** - * Returns revised as string. Do not use this method outside of saving or - * loading! - * + * Returns revised as string. Do not use this method outside of saving or loading! + * * @return */ String getRevisedAsString(); /** * Sets revised delta - * + * * @param revised - revised delta */ void setRevised(T revised); /** - * Sets revised from string. Do not use this method outside of saving or - * loading! - * + * Sets revised from string. Do not use this method outside of saving or loading! + * * @param revised */ void setRevisedFromString(String revised); /** * Returns delta type - * + * * @return TYPE - type */ DELTATYPE getType(); /** * Sets type of delta - * + * * @param type - type */ void setType(DELTATYPE type); /** * Returns feature - * + * * @return FeatureContext - feature context */ String getContext(); /** * Sets feature expression of delta - * + * * @param feature - FeatureContext */ void setContext(String feature); @@ -137,7 +132,7 @@ public enum DELTATYPE { String getFactoryId(); /** - * + * * @return */ boolean isSynchronizedProject(IProject project); @@ -151,7 +146,7 @@ public enum DELTATYPE { void setSynchronizedProjects(List projects); /** - * + * * @return */ long getTimestamp(); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDeltaFactory.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDeltaFactory.java index 1bd9e56..a22e813 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDeltaFactory.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IDeltaFactory.java @@ -27,7 +27,7 @@ public interface IDeltaFactory extends IExtension { /** * Creates a empty delta object - * + * * @param res * @return */ @@ -35,28 +35,28 @@ public interface IDeltaFactory extends IExtension { /** * Creates a delta object for a resource - * - * @param res - resource + * + * @param res - resource * @param timestamp - timestamp - * @param kind - type of change + * @param kind - type of change * @return patch object */ List> createDeltas(IFile file, long timestamp, DELTATYPE kind) throws DiffException; /** * Creates patch object from a changed resource. - * - * @param res - resource + * + * @param res - resource * @param oldState - last history state - * @param kind - type of change + * @param kind - type of change * @return patch object */ List> createDeltas(IFile file, IFileState oldState, long timestamp, DELTATYPE kind) throws DiffException; /** * Creates a delta copy with different resource. - * - * @param res - new file pointer + * + * @param res - new file pointer * @param originalDelta - delta to copy * @return delta copy with new file pointer */ @@ -64,8 +64,8 @@ public interface IDeltaFactory extends IExtension { /** * Creates a delta copy with different resource. - * - * @param res - new file pointer + * + * @param res - new file pointer * @param originalDelta - delta to copy * @return delta copy with new file pointer */ @@ -73,8 +73,8 @@ public interface IDeltaFactory extends IExtension { /** * Patches a resource with a given patch. - * - * @param res - resource + * + * @param res - resource * @param patch - patch * @return patched temp resource */ @@ -82,8 +82,8 @@ public interface IDeltaFactory extends IExtension { /** * Unpatches a revised resource for a given patch. - * - * @param res - the resource + * + * @param res - the resource * @param patch - patch * @return original resource */ @@ -91,8 +91,8 @@ public interface IDeltaFactory extends IExtension { /** * Verifies that the given patch can be applied to the given resource - * - * @param res - the resource + * + * @param res - the resource * @param delta - the patch to verify * @return true if the patch can be applied */ @@ -100,7 +100,7 @@ public interface IDeltaFactory extends IExtension { /** * Checks whether the file is supported - * + * * @param file * @return true if the file is supported */ @@ -108,7 +108,7 @@ public interface IDeltaFactory extends IExtension { /** * Returns the marker handler for deltas of this type - * + * * @return */ IMarkerHandler getMarkerHandler(); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatch.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatch.java index 8c9fec9..7ac971a 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatch.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatch.java @@ -4,7 +4,7 @@ /** * Class containing a number of deltas for a given file - * + * * @author Christopher Sontag * @version 1.0 * @since 18.08.2017 @@ -14,28 +14,28 @@ public interface IPatch { /** * Add the given delta to this patch - * + * * @param delta - the given delta */ void addDelta(IDelta delta); /** * Add the given deltas to this patch - * + * * @param deltas - the given deltas */ void addDeltas(List> deltas); /** * Returns the list of all deltas - * + * * @return the deltas */ List> getDeltas(); /** * Removes the given delta from this patch - * + * * @param delta * @return true when the element has exist and is now removed */ @@ -43,53 +43,53 @@ public interface IPatch { /** * Returns the number of elements - * + * * @return the number of elements */ int size(); /** * Returns whether the list of deltas is empty - * + * * @return true if the list is empty */ boolean isEmpty(); /** * Returns the timestamp from the start of this patch - * + * * @return timestamp */ long getStartTime(); /** - * + * * @param timestamp */ void setStartTime(long timestamp); /** - * + * * @return */ long getEndTime(); /** - * + * * @param timestamp */ void setEndTime(long timestamp); /** - * + * * @return */ String getContext(); /** - * + * * @param context */ void setContext(String context); -} \ No newline at end of file +} diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatchFactory.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatchFactory.java index 322b800..74c6b6a 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatchFactory.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/interfaces/IPatchFactory.java @@ -6,7 +6,7 @@ public interface IPatchFactory { /** * Create a new patch under the given context - * + * * @param context * @return */ @@ -14,15 +14,15 @@ public interface IPatchFactory { /** * NOTE: Use this only for calculations otherwise it could lead to misbehavior - * + * * @return {@link IPatch} */ IPatch> createPatch(); /** * Patches a resource with a given patch. - * - * @param res - resource + * + * @param res - resource * @param patch - patch * @return patched temp resource */ diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/ResourceCompareInput.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/ResourceCompareInput.java index 257754b..605d2c0 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/ResourceCompareInput.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/ResourceCompareInput.java @@ -31,31 +31,30 @@ /** * Resource compare input for the manual merge dialog - * + * * TODO Enable difference highlighting and feature context background - * + * * @author Christopher Sontag */ public class ResourceCompareInput extends CompareEditorInput { private static final boolean NORMALIZE_CASE = true; - private boolean fThreeWay = true; + private final boolean fThreeWay = true; private Object fRoot; - private IStructureComparator fAncestor; - private IStructureComparator fLeft; - private IStructureComparator fRight; - private IFile fAncestorResource; - private IFile fLeftResource; - private IFile fRightResource; + private final IStructureComparator fAncestor; + private final IStructureComparator fLeft; + private final IStructureComparator fRight; + private final IFile fAncestorResource; + private final IFile fLeftResource; + private final IFile fRightResource; private DiffTreeViewer fDiffViewer; private Action fOpenAction; /* * Creates an compare editor input for the given selection. */ - public ResourceCompareInput(CompareConfiguration config, IFile fAncestorResource, IFile fLeftResource, - IFile fRightResource) { + public ResourceCompareInput(CompareConfiguration config, IFile fAncestorResource, IFile fLeftResource, IFile fRightResource) { super(config); this.fAncestorResource = fAncestorResource; this.fLeftResource = fLeftResource; @@ -76,35 +75,41 @@ public String toString() { private ITypedElement fLastId; private String fLastName; - public MyDiffNode(IDiffContainer parent, int description, ITypedElement ancestor, ITypedElement left, - ITypedElement right) { + public MyDiffNode(IDiffContainer parent, int description, ITypedElement ancestor, ITypedElement left, ITypedElement right) { super(parent, description, ancestor, left, right); } + @Override public void fireChange() { super.fireChange(); setDirty(true); fDirty = true; - if (fDiffViewer != null) + if (fDiffViewer != null) { fDiffViewer.refresh(this); + } } void clearDirty() { fDirty = false; } + @Override public String getName() { - if (fLastName == null) + if (fLastName == null) { fLastName = super.getName(); - if (fDirty) + } + if (fDirty) { return '<' + fLastName + '>'; + } return fLastName; } + @Override public ITypedElement getId() { - ITypedElement id = super.getId(); - if (id == null) + final ITypedElement id = super.getId(); + if (id == null) { return fLastId; + } fLastId = id; return id; } @@ -116,22 +121,27 @@ static class FilteredBufferedResourceNode extends BufferedResourceNode { super(resource); } + @Override protected IStructureComparator createChild(IResource child) { - String name = child.getName(); - if (CompareUIPlugin.getDefault().filter(name, child instanceof IContainer, false)) + final String name = child.getName(); + if (CompareUIPlugin.getDefault().filter(name, child instanceof IContainer, false)) { return null; + } return new FilteredBufferedResourceNode(child); } } + @Override public Viewer createDiffViewer(Composite parent) { fDiffViewer = new DiffTreeViewer(parent, getCompareConfiguration()) { + @Override protected void fillContextMenu(IMenuManager manager) { if (fOpenAction == null) { fOpenAction = new Action() { + @Override public void run() { handleOpen(null); } @@ -140,17 +150,19 @@ public void run() { } boolean enable = false; - ISelection selection = getSelection(); + final ISelection selection = getSelection(); if (selection instanceof IStructuredSelection) { - IStructuredSelection ss = (IStructuredSelection) selection; + final IStructuredSelection ss = (IStructuredSelection) selection; if (ss.size() == 1) { - Object element = ss.getFirstElement(); + final Object element = ss.getFirstElement(); if (element instanceof MyDiffNode) { - ITypedElement te = ((MyDiffNode) element).getId(); - if (te != null) + final ITypedElement te = ((MyDiffNode) element).getId(); + if (te != null) { enable = !ITypedElement.FOLDER_TYPE.equals(te.getType()); - } else + } + } else { enable = true; + } } } fOpenAction.setEnabled(enable); @@ -168,17 +180,18 @@ public void run() { */ public boolean isEnabled(ISelection s) { - IResource[] selection = Utilities.getResources(s); - if (selection.length < 2 || selection.length > 3) + final IResource[] selection = Utilities.getResources(s); + if ((selection.length < 2) || (selection.length > 3)) { return false; + } - boolean threeWay = selection.length == 3; + final boolean threeWay = selection.length == 3; - if (threeWay) + if (threeWay) { // It only makes sense if they're all mutually comparable. // If not, the user should compare two of them. - return comparable(selection[0], selection[1]) && comparable(selection[0], selection[2]) - && comparable(selection[1], selection[2]); + return comparable(selection[0], selection[1]) && comparable(selection[0], selection[2]) && comparable(selection[1], selection[2]); + } return comparable(selection[0], selection[1]); } @@ -187,7 +200,7 @@ public boolean isEnabled(ISelection s) { * Initializes the images in the compare configuration. */ void initializeCompareConfiguration() { - CompareConfiguration cc = getCompareConfiguration(); + final CompareConfiguration cc = getCompareConfiguration(); if (fLeftResource != null) { cc.setLeftLabel(buildLabel(fLeftResource)); cc.setLeftImage(CompareUIPlugin.getImage(fLeftResource)); @@ -196,7 +209,7 @@ void initializeCompareConfiguration() { cc.setRightLabel(buildLabel(fRightResource)); cc.setRightImage(CompareUIPlugin.getImage(fRightResource)); } - if (fThreeWay && fAncestorResource != null) { + if (fThreeWay && (fAncestorResource != null)) { cc.setAncestorLabel(buildLabel(fAncestorResource)); cc.setAncestorImage(CompareUIPlugin.getImage(fAncestorResource)); } @@ -214,11 +227,12 @@ private boolean comparable(IResource c1, IResource c2) { */ private boolean hasStructure(IResource input) { - if (input instanceof IContainer) + if (input instanceof IContainer) { return true; + } if (input instanceof IFile) { - IFile file = (IFile) input; + final IFile file = (IFile) input; String type = file.getFileExtension(); if (type != null) { type = normalizeCase(type); @@ -230,21 +244,22 @@ private boolean hasStructure(IResource input) { } /* - * Creates a IStructureComparator for the given input. Returns - * null if no IStructureComparator can be found for - * the IResource. + * Creates a IStructureComparator for the given input. Returns null if no IStructureComparator can be found for the + * IResource. */ private IStructureComparator getStructure(IResource input) { - if (input instanceof IContainer) + if (input instanceof IContainer) { return new FilteredBufferedResourceNode(input); + } if (input instanceof IFile) { - IStructureComparator rn = new FilteredBufferedResourceNode(input); - IFile file = (IFile) input; - String type = normalizeCase(file.getFileExtension()); - if ("JAR".equals(type) || "ZIP".equals(type)) //$NON-NLS-2$ //$NON-NLS-1$ + final IStructureComparator rn = new FilteredBufferedResourceNode(input); + final IFile file = (IFile) input; + final String type = normalizeCase(file.getFileExtension()); + if ("JAR".equals(type) || "ZIP".equals(type)) { return new ZipFileStructureCreator().getStructure(rn); + } return rn; } return null; @@ -253,6 +268,7 @@ private IStructureComparator getStructure(IResource input) { /* * Performs a two-way or three-way diff on the current selection. */ + @Override public Object prepareInput(IProgressMonitor pm) throws InvocationTargetException { try { @@ -260,54 +276,56 @@ public Object prepareInput(IProgressMonitor pm) throws InvocationTargetException // with the file system appear as empty fLeftResource.refreshLocal(IResource.DEPTH_INFINITE, pm); fRightResource.refreshLocal(IResource.DEPTH_INFINITE, pm); - if (fThreeWay && fAncestorResource != null) + if (fThreeWay && (fAncestorResource != null)) { fAncestorResource.refreshLocal(IResource.DEPTH_INFINITE, pm); - // end fix + // end fix + } pm.beginTask(Utilities.getString("ResourceCompare.taskName"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ - String leftLabel = fLeftResource.getName(); - String rightLabel = fRightResource.getName(); + final String leftLabel = fLeftResource.getName(); + final String rightLabel = fRightResource.getName(); String title; if (fThreeWay) { - String format = Utilities.getString("ResourceCompare.threeWay.title"); //$NON-NLS-1$ - String ancestorLabel = fAncestorResource.getName(); + final String format = Utilities.getString("ResourceCompare.threeWay.title"); //$NON-NLS-1$ + final String ancestorLabel = fAncestorResource.getName(); title = MessageFormat.format(format, new String[] { ancestorLabel, leftLabel, rightLabel }); } else { - String format = Utilities.getString("ResourceCompare.twoWay.title"); //$NON-NLS-1$ + final String format = Utilities.getString("ResourceCompare.twoWay.title"); //$NON-NLS-1$ title = MessageFormat.format(format, new String[] { leftLabel, rightLabel }); } setTitle(title); - Differencer d = new Differencer() { + final Differencer d = new Differencer() { + @Override protected Object visit(Object parent, int description, Object ancestor, Object left, Object right) { - return new MyDiffNode((IDiffContainer) parent, description, (ITypedElement) ancestor, - (ITypedElement) left, (ITypedElement) right); + return new MyDiffNode((IDiffContainer) parent, description, (ITypedElement) ancestor, (ITypedElement) left, (ITypedElement) right); } }; fRoot = d.findDifferences(fThreeWay, pm, null, fAncestor, fLeft, fRight); return fRoot; - } catch (CoreException ex) { + } catch (final CoreException ex) { throw new InvocationTargetException(ex); } finally { pm.done(); } } + @Override public String getToolTipText() { - if (fLeftResource != null && fRightResource != null) { - String leftLabel = fLeftResource.getFullPath().makeRelative().toString(); - String rightLabel = fRightResource.getFullPath().makeRelative().toString(); + if ((fLeftResource != null) && (fRightResource != null)) { + final String leftLabel = fLeftResource.getFullPath().makeRelative().toString(); + final String rightLabel = fRightResource.getFullPath().makeRelative().toString(); if (fThreeWay) { - String format = Utilities.getString("ResourceCompare.threeWay.tooltip"); //$NON-NLS-1$ - String ancestorLabel = fAncestorResource.getFullPath().makeRelative().toString(); + final String format = Utilities.getString("ResourceCompare.threeWay.tooltip"); //$NON-NLS-1$ + final String ancestorLabel = fAncestorResource.getFullPath().makeRelative().toString(); return MessageFormat.format(format, new String[] { ancestorLabel, leftLabel, rightLabel }); } - String format = Utilities.getString("ResourceCompare.twoWay.tooltip"); //$NON-NLS-1$ + final String format = Utilities.getString("ResourceCompare.twoWay.tooltip"); //$NON-NLS-1$ return MessageFormat.format(format, new String[] { leftLabel, rightLabel }); } // fall back @@ -317,22 +335,26 @@ public String getToolTipText() { private String buildLabel(IResource r) { // for a linked resource in a hidden project use its local file system // location - if (r.isLinked() && r.getProject().isHidden()) + if (r.isLinked() && r.getProject().isHidden()) { return r.getLocation().toString(); - String n = r.getFullPath().toString(); - if (n.charAt(0) == IPath.SEPARATOR) + } + final String n = r.getFullPath().toString(); + if (n.charAt(0) == IPath.SEPARATOR) { return n.substring(1); + } return n; } + @Override public void saveChanges(IProgressMonitor pm) throws CoreException { super.saveChanges(pm); if (fRoot instanceof DiffNode) { try { commit(pm, (DiffNode) fRoot); } finally { - if (fDiffViewer != null) + if (fDiffViewer != null) { fDiffViewer.refresh(); + } setDirty(false); } } @@ -343,33 +365,39 @@ public void saveChanges(IProgressMonitor pm) throws CoreException { */ private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException { - if (node instanceof MyDiffNode) + if (node instanceof MyDiffNode) { ((MyDiffNode) node).clearDirty(); + } - ITypedElement left = node.getLeft(); - if (left instanceof BufferedResourceNode) + final ITypedElement left = node.getLeft(); + if (left instanceof BufferedResourceNode) { ((BufferedResourceNode) left).commit(pm); + } - ITypedElement right = node.getRight(); - if (right instanceof BufferedResourceNode) + final ITypedElement right = node.getRight(); + if (right instanceof BufferedResourceNode) { ((BufferedResourceNode) right).commit(pm); + } - IDiffElement[] children = node.getChildren(); + final IDiffElement[] children = node.getChildren(); if (children != null) { for (int i = 0; i < children.length; i++) { - IDiffElement element = children[i]; - if (element instanceof DiffNode) + final IDiffElement element = children[i]; + if (element instanceof DiffNode) { commit(pm, (DiffNode) element); + } } } } private static String normalizeCase(String s) { - if (NORMALIZE_CASE && s != null) + if (NORMALIZE_CASE && (s != null)) { return s.toUpperCase(); + } return s; } + @Override public boolean canRunAsJob() { return true; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/SynchronizationHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/SynchronizationHandler.java index 31be470..baae4ed 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/SynchronizationHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/SynchronizationHandler.java @@ -20,17 +20,16 @@ import de.tubs.variantsync.core.utilities.LogOperations; /** - * + * * This class handles the synchronization between variants - * + * * @author Christopher Sontag */ public class SynchronizationHandler { /** - * Synchronizes the given delta in the given project. Returns true if the delta - * is successfully applied. - * + * Synchronizes the given delta in the given project. Returns true if the delta is successfully applied. + * * @param project * @param delta * @return @@ -38,19 +37,19 @@ public class SynchronizationHandler { @SuppressWarnings({ "unchecked", "rawtypes" }) public static boolean handleSynchronization(IProject project, IDelta delta) { VariantSyncPlugin.removeResourceChangeListener(); - IFile fileRight = project.getFile(delta.getResource().getProjectRelativePath()); - IFile fileLeft = delta.getProject().getFile(delta.getResource().getProjectRelativePath()); + final IFile fileRight = project.getFile(delta.getResource().getProjectRelativePath()); + final IFile fileLeft = delta.getProject().getFile(delta.getResource().getProjectRelativePath()); try { - IDeltaFactory factory = DeltaFactoryManager.getFactoryById(delta.getFactoryId()); + final IDeltaFactory factory = DeltaFactoryManager.getFactoryById(delta.getFactoryId()); // If delta is synchronisable if (factory.verifyDelta(fileRight, delta)) { - IFile newFile = factory.applyDelta(fileRight, delta); + final IFile newFile = factory.applyDelta(fileRight, delta); if (!newFile.getContents().toString().equals(fileRight.getContents().toString())) { delta.addSynchronizedProject(project); - IDelta newDelta = factory.createDeltas(newFile, delta); + final IDelta newDelta = factory.createDeltas(newFile, delta); CodeMappingHandler.addCodeMappingsForDeltas(Arrays.asList(newDelta)); VariantSyncPlugin.addResourceChangeListener(); @@ -59,23 +58,24 @@ public static boolean handleSynchronization(IProject project, IDelta delta) { // if manual merge is needed } else { // Editor - org.eclipse.compare.CompareConfiguration compconf = new org.eclipse.compare.CompareConfiguration(); + final org.eclipse.compare.CompareConfiguration compconf = new org.eclipse.compare.CompareConfiguration(); compconf.setLeftLabel(delta.getProject().getName()); compconf.setRightLabel(project.getName()); compconf.setAncestorLabel("Ancestor"); compconf.setLeftEditable(false); compconf.setRightEditable(true); - HistoryStore historyStore = new HistoryStore(); - IFile fileBase = historyStore.getState(fileLeft, delta.getTimestamp()); + final HistoryStore historyStore = new HistoryStore(); + final IFile fileBase = historyStore.getState(fileLeft, delta.getTimestamp()); - String originalTmpName = String.valueOf(System.currentTimeMillis()); + final String originalTmpName = String.valueOf(System.currentTimeMillis()); // fileRight.copy(fileRight.getProject().getFolder(".tmp").getFile(originalTmpName + ".txt").getFullPath(), true, null); - if (!fileRight.getProject().getFolder(".tmp").exists()) + if (!fileRight.getProject().getFolder(".tmp").exists()) { fileRight.getProject().getFolder(".tmp").create(true, false, null); - IFile fileOriginal = fileRight.getProject().getFolder(".tmp").getFile(originalTmpName + ".txt"); + } + final IFile fileOriginal = fileRight.getProject().getFolder(".tmp").getFile(originalTmpName + ".txt"); fileOriginal.create(fileRight.getContents(), true, null); - CompareEditorInput rci = new ResourceCompareInput(compconf, fileBase, fileLeft, fileRight); + final CompareEditorInput rci = new ResourceCompareInput(compconf, fileBase, fileLeft, fileRight); rci.setDirty(true); CompareUI.openCompareDialog(rci); @@ -83,20 +83,20 @@ public static boolean handleSynchronization(IProject project, IDelta delta) { VariantSyncPlugin.addResourceChangeListener(); try { - List> deltas = factory.createDeltas(fileRight, fileOriginal); - for (IDelta deltaFile : deltas) { + final List> deltas = factory.createDeltas(fileRight, fileOriginal); + for (final IDelta deltaFile : deltas) { deltaFile.setContext(delta.getContext()); } CodeMappingHandler.addCodeMappingsForDeltas(deltas); - } catch (DiffException e) { + } catch (final DiffException e) { return false; } return rci.okPressed(); } - } catch (NoSuchExtensionException e) { + } catch (final NoSuchExtensionException e) { LogOperations.logError("DeltaFactory not found", e); - } catch (CoreException e) { + } catch (final CoreException e) { LogOperations.logError("File could not be read", e); } VariantSyncPlugin.addResourceChangeListener(); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/TargetsCalculator.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/TargetsCalculator.java index 4450905..89773d7 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/TargetsCalculator.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/TargetsCalculator.java @@ -18,69 +18,69 @@ /** * Calculates all target projects for given deltas. - * + * * @author Christopher Sontag */ public class TargetsCalculator { /** * Returns target projects without conflicts. - * + * * @param delta * @return */ public List getTargetsWithoutConflict(IDelta delta) { - List targets = new ArrayList<>(); - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); - for (IProject project : configurationProject.getVariants()) { - Configuration config = configurationProject.getConfigurationForVariant(project); - if (config == null || !config.getSelectedFeatureNames().contains(delta.getContext())) + final List targets = new ArrayList<>(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + for (final IProject project : configurationProject.getVariants()) { + final Configuration config = configurationProject.getConfigurationForVariant(project); + if ((config == null) || !config.getSelectedFeatureNames().contains(delta.getContext())) { continue; - if (project != delta.getProject() && isTargetWithoutConflict(project, delta) - && !delta.getSynchronizedProjects().contains(project)) + } + if ((project != delta.getProject()) && isTargetWithoutConflict(project, delta) && !delta.getSynchronizedProjects().contains(project)) { targets.add(project); + } } return targets; } /** * Returns target projects with conflicts. - * + * * @param delta * @return */ public List getTargetsWithConflict(IDelta delta) { - List targets = new ArrayList<>(); - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); - for (IProject project : configurationProject.getVariants()) { - Configuration config = configurationProject.getConfigurationForVariant(project); - if (config == null || !config.getSelectedFeatureNames().contains(delta.getContext())) + final List targets = new ArrayList<>(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + for (final IProject project : configurationProject.getVariants()) { + final Configuration config = configurationProject.getConfigurationForVariant(project); + if ((config == null) || !config.getSelectedFeatureNames().contains(delta.getContext())) { continue; - if (project != delta.getProject() && isTargetWithConflict(project, delta) - && !delta.getSynchronizedProjects().contains(project)) + } + if ((project != delta.getProject()) && isTargetWithConflict(project, delta) && !delta.getSynchronizedProjects().contains(project)) { targets.add(project); + } } return targets; } /** - * Returns all target projects which have feature context selected in their - * configuration - * + * Returns all target projects which have feature context selected in their configuration + * * @param deltas * @return */ public List getTargetsForFeatureContext(List> deltas) { - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); - List targets = new ArrayList<>(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + final List targets = new ArrayList<>(); if (configurationProject != null) { - for (IProject project : configurationProject.getVariants()) { - Configuration config = configurationProject.getConfigurationForVariant(project); + for (final IProject project : configurationProject.getVariants()) { + final Configuration config = configurationProject.getConfigurationForVariant(project); if (config != null) { - for (IDelta delta : deltas) { - if (config.getSelectedFeatureNames().contains(delta.getContext()) && !targets.contains(project) - && (!delta.getProject().equals(project)) - && !delta.getSynchronizedProjects().contains(project)) { + for (final IDelta delta : deltas) { + if (config.getSelectedFeatureNames().contains(delta.getContext()) && !targets.contains(project) && (!delta.getProject().equals(project)) + && !delta.getSynchronizedProjects().contains(project)) { targets.add(project); } } @@ -91,16 +91,15 @@ public List getTargetsForFeatureContext(List> deltas) { } /** - * Checks whether the given delta can be applied to the given project without - * conflicts. - * + * Checks whether the given delta can be applied to the given project without conflicts. + * * @param project * @param delta * @return true, if delta can be applied without problems */ @SuppressWarnings({ "unchecked", "rawtypes" }) public boolean isTargetWithoutConflict(IProject project, IDelta delta) { - IFile file = project.getFile(delta.getResource().getProjectRelativePath()); + final IFile file = project.getFile(delta.getResource().getProjectRelativePath()); if (!file.exists() && delta.getType().equals(DELTATYPE.ADDED)) { return true; } @@ -114,20 +113,21 @@ public boolean isTargetWithoutConflict(IProject project, IDelta delta) { IDeltaFactory factory = null; try { factory = DeltaFactoryManager.getFactoryById(delta.getFactoryId()); - } catch (NoSuchExtensionException e) { + } catch (final NoSuchExtensionException e) { LogOperations.logError("PatchFactory not found", e); } - if (factory == null) + if (factory == null) { return false; - if (factory.verifyDelta(file, delta)) + } + if (factory.verifyDelta(file, delta)) { return true; + } return false; } /** - * Checks whether the given delta can be applied to the given project with - * conflicts. - * + * Checks whether the given delta can be applied to the given project with conflicts. + * * @param project * @param delta * @return true, if delta can be applied only with problems diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/compare/DeltaCompareViewer.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/compare/DeltaCompareViewer.java index 990eec8..3e4465d 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/compare/DeltaCompareViewer.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/compare/DeltaCompareViewer.java @@ -11,16 +11,16 @@ /** * Wizard for synchronization of manual deltas - * + * * @author Christopher Sontag */ @Deprecated public class DeltaCompareViewer extends Wizard { public static final String ID = VariantSyncPlugin.PLUGIN_ID + ".views.synchronization.compare"; - private DeltaCompareViewerPage page; - private IFile file; - private IDelta delta; + private final DeltaCompareViewerPage page; + private final IFile file; + private final IDelta delta; public DeltaCompareViewer(IFile file, IDelta delta) { super(); @@ -30,13 +30,14 @@ public DeltaCompareViewer(IFile file, IDelta delta) { page = new DeltaCompareViewerPage(file, delta); } + @Override public void addPages() { addPage(page); } @Override public boolean performFinish() { - List lines = page.getSourceCode(); + final List lines = page.getSourceCode(); FileHelper.setFileLines(file, lines); return true; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/compare/DeltaCompareViewerPage.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/compare/DeltaCompareViewerPage.java index 6de6991..8d59169 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/compare/DeltaCompareViewerPage.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/syncronization/compare/DeltaCompareViewerPage.java @@ -23,14 +23,14 @@ /** * Creates a page for editing a file with showing a delta on the right - * + * * @author Christopher Sontag */ @Deprecated public class DeltaCompareViewerPage extends WizardPage { - private IFile file; - private IDelta delta; + private final IFile file; + private final IDelta delta; private SourceViewer sourceViewer; protected DeltaCompareViewerPage(IFile file, IDelta delta) { @@ -46,32 +46,32 @@ protected DeltaCompareViewerPage(IFile file, IDelta delta) { public void createControl(Composite parent) { parent.setLayout(new FillLayout()); - Composite composite = new Composite(parent, SWT.FILL); - GridLayout gridLayout = new GridLayout(2, false); + final Composite composite = new Composite(parent, SWT.FILL); + final GridLayout gridLayout = new GridLayout(2, false); composite.setLayout(gridLayout); - Label codeLabel = new Label(composite, SWT.NONE); + final Label codeLabel = new Label(composite, SWT.NONE); codeLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); codeLabel.setText("Code:"); - Label deltaLabel = new Label(composite, SWT.NONE); + final Label deltaLabel = new Label(composite, SWT.NONE); deltaLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); deltaLabel.setText("Delta:"); - CompositeRuler ruler = new CompositeRuler(); - LineNumberRulerColumn lineNumber = new LineNumberRulerColumn(); + final CompositeRuler ruler = new CompositeRuler(); + final LineNumberRulerColumn lineNumber = new LineNumberRulerColumn(); ruler.addDecorator(0, lineNumber); sourceViewer = new SourceViewer(composite, ruler, SWT.V_SCROLL | SWT.MULTI | SWT.FLAT); sourceViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); sourceViewer.setDocument(new Document(getStringFromList(FileHelper.getFileLines(file)))); - Text deltaText = new Text(composite, SWT.V_SCROLL | SWT.MULTI | SWT.FLAT); + final Text deltaText = new Text(composite, SWT.V_SCROLL | SWT.MULTI | SWT.FLAT); deltaText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); deltaText.setText(delta.getRepresentation()); setControl(composite); - PlatformUI.getWorkbench().getHelpSystem().setHelp(this.getControl(), "VariantSync.DeltaCompareViewer"); + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), "VariantSync.DeltaCompareViewer"); } public List getSourceCode() { @@ -80,7 +80,7 @@ public List getSourceCode() { private String getStringFromList(List entries) { String str = ""; - for (String el : entries) { + for (final String el : entries) { str += el + "\n"; } return str; diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/AMarkerInformation.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/AMarkerInformation.java index e432abc..744eaa0 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/AMarkerInformation.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/AMarkerInformation.java @@ -4,7 +4,7 @@ /** * Contains all marker relevant informations - * + * * @author Tristan Pfofe * @author Christopher Sontag * @since 17.06.2016 @@ -19,61 +19,61 @@ public class AMarkerInformation implements IVariantSyncMarker { /** * Constructor - * + * * @param markerId - marker id - * @param offset - offset - * @param length - length - * @param line - if true, the offset and length are interpreted as mappings + * @param offset - offset + * @param length - length + * @param line - if true, the offset and length are interpreted as mappings */ public AMarkerInformation(long markerId, int offset, int length, boolean line) { this.markerId = markerId; this.offset = offset; this.length = length; - this.isLine = line; + isLine = line; } /** * Constructor - * + * * @param offset - offset * @param length - length - * @param line - if true, the offset and length are interpreted as mappings + * @param line - if true, the offset and length are interpreted as mappings */ public AMarkerInformation(int offset, int length, boolean line) { - this.markerId = UUID.randomUUID().getMostSignificantBits(); + markerId = UUID.randomUUID().getMostSignificantBits(); this.offset = offset; this.length = length; - this.isLine = line; + isLine = line; } /** * Constructor - * + * * @param markerId - marker id - * @param line - line + * @param line - line */ public AMarkerInformation(long markerId, int line) { this.markerId = markerId; - this.offset = line; - this.length = 1; - this.isLine = true; + offset = line; + length = 1; + isLine = true; } /** * Constructor - * + * * @param line - line */ public AMarkerInformation(int line) { - this.markerId = UUID.randomUUID().getMostSignificantBits(); - this.offset = line; - this.length = 1; - this.isLine = true; + markerId = UUID.randomUUID().getMostSignificantBits(); + offset = line; + length = 1; + isLine = true; } /** * Returns marker id. - * + * * @return markerId */ @Override @@ -83,7 +83,7 @@ public long getMarkerId() { /** * Returns offset. - * + * * @return offset */ @Override @@ -93,7 +93,7 @@ public int getOffset() { /** * Sets offset. - * + * * @param offset */ @Override @@ -103,7 +103,7 @@ public void setOffset(int offset) { /** * Returns length. - * + * * @return length */ @Override @@ -113,7 +113,7 @@ public int getLength() { /** * Sets length. - * + * * @param length */ @Override @@ -123,7 +123,7 @@ public void setLength(int length) { /** * Sets marker id. - * + * * @param markerId - id of marker */ @Override @@ -133,7 +133,7 @@ public void setMarkerId(long markerId) { /** * Returns feature expression. - * + * * @return feature expression */ @Override @@ -143,7 +143,7 @@ public String getContext() { /** * Sets feature expression. - * + * * @param expression - feature expression */ @Override @@ -153,7 +153,7 @@ public void setContext(String expression) { /** * Returns whether offset and length should be interpreted as mappings - * + * * @return true, if offset and length should be interpreted as mappings */ @Override @@ -163,7 +163,7 @@ public boolean isLine() { /** * Sets whether the complete line is annotated - * + * * @param true, if the complete line is annotated */ @Override @@ -173,8 +173,7 @@ public void setLine(boolean isLine) { @Override public String toString() { - return String.format("AMarkerInformation [markerId=%s, offset=%s, length=%s, expression=%s, isLine=%s]", - markerId, offset, length, expression, isLine); + return String.format("AMarkerInformation [markerId=%s, offset=%s, length=%s, expression=%s, isLine=%s]", markerId, offset, length, expression, isLine); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/FileHelper.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/FileHelper.java index d9a1110..b437994 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/FileHelper.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/FileHelper.java @@ -19,16 +19,15 @@ import org.eclipse.core.runtime.CoreException; /** - * Class to retrieve file content when the workspace is busy. This class also - * enables to retrieve history states. - * + * Class to retrieve file content when the workspace is busy. This class also enables to retrieve history states. + * * @author Christopher Sontag */ public class FileHelper { /** * Returns the latest history of an IFile resource - * + * * @param res * @return */ @@ -36,7 +35,7 @@ public static IFileState getLatestHistory(IFile res) { IFileState[] states = null; try { states = res.getHistory(null); - } catch (CoreException e) { + } catch (final CoreException e) { LogOperations.logError("File states could not be retrieved.", e); } if (states.length > 0) { @@ -47,7 +46,7 @@ public static IFileState getLatestHistory(IFile res) { /** * Returns all lines of an IFile resource as an list of strings - * + * * @param res * @return */ @@ -55,7 +54,7 @@ public static List getFileLines(IFile res) { List currentFilelines = new ArrayList<>(); try { currentFilelines = readFile(res.getContents(), res.getCharset()); - } catch (CoreException e) { + } catch (final CoreException e) { LogOperations.logError("File could not be accessed.", e); } return currentFilelines; @@ -63,7 +62,7 @@ public static List getFileLines(IFile res) { /** * Returns all lines of an IFile history state resource as an list of strings - * + * * @param state * @return */ @@ -71,7 +70,7 @@ public static List getFileLines(IFileState state) { List currentFilelines = new ArrayList<>(); try { currentFilelines = readFile(state.getContents(), state.getCharset()); - } catch (CoreException e) { + } catch (final CoreException e) { LogOperations.logError("History can not be accessed.", e); } return currentFilelines; @@ -79,7 +78,7 @@ public static List getFileLines(IFileState state) { /** * Overwrites the IFile resource with the given lines - * + * * @param res * @param lines */ @@ -88,25 +87,25 @@ public static void setFileLines(IFile res, List lines) { } /** - * Reads content from file using buffered reader. Adds each line in file to - * List. + * Reads content from file using buffered reader. Adds each line in file to List. * - * @param in buffered Reader for file + * @param in buffered Reader for file * @param charset * @return list with file content */ private static List readFile(InputStream in, String charset) { - List fileContent = new LinkedList(); + final List fileContent = new LinkedList(); String line = ""; BufferedReader reader = null; - if (charset == null) - charset = (String) "UTF-8"; + if (charset == null) { + charset = "UTF-8"; + } try { reader = new BufferedReader(new InputStreamReader(in, charset)); while ((line = reader.readLine()) != null) { fileContent.add(line); } - } catch (IOException e) { + } catch (final IOException e) { LogOperations.logError("BufferedReader could not be opened.", e); } finally { try { @@ -119,28 +118,28 @@ private static List readFile(InputStream in, String charset) { } /** - * Writes content to a IFile resource using a buffered writer. Each line is one - * item in lines - * + * Writes content to a IFile resource using a buffered writer. Each line is one item in lines + * * @param res * @param lines */ public static void writeFile(IFile res, List lines) { - File file = new File(res.getRawLocationURI()); + final File file = new File(res.getRawLocationURI()); if (file.exists()) { file.delete(); } - File parentDir = file.getParentFile(); - if (!parentDir.exists()) + final File parentDir = file.getParentFile(); + if (!parentDir.exists()) { parentDir.mkdirs(); + } PrintWriter out = null; try { file.createNewFile(); out = new PrintWriter(new BufferedWriter(new FileWriter(file))); - for (String line : lines) { + for (final String line : lines) { out.println(line); } - } catch (IOException e) { + } catch (final IOException e) { LogOperations.logError("File can not be created.", e); } finally { if (out != null) { @@ -149,7 +148,7 @@ public static void writeFile(IFile res, List lines) { } try { ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null); - } catch (CoreException e) { + } catch (final CoreException e) { LogOperations.logInfo("Refresh could not be made because the workspace is locked up."); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/IVariantSyncMarker.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/IVariantSyncMarker.java index 417d2dd..df1902e 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/IVariantSyncMarker.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/IVariantSyncMarker.java @@ -4,70 +4,70 @@ public interface IVariantSyncMarker { /** * Returns marker id. - * + * * @return markerId */ long getMarkerId(); /** * Sets marker id. - * + * * @param markerId - id of marker */ void setMarkerId(long markerId); /** * Returns offset. - * + * * @return offset */ int getOffset(); /** * Sets offset. - * + * * @param offset */ void setOffset(int offset); /** * Returns length. - * + * * @return length */ int getLength(); /** * Sets length. - * + * * @param length */ void setLength(int length); /** * Returns feature context. - * + * * @return feature context */ String getContext(); /** * Sets feature expression. - * + * * @param context - feature context */ void setContext(String context); /** * Returns whether the complete line is annotated - * + * * @return true, if the complete line is annotated */ boolean isLine(); /** * Sets whether the complete line is annotated - * + * * @param true, if the complete line is annotated */ void setLine(boolean isLine); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/LogOperations.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/LogOperations.java index 3ec8ca8..8c3f88f 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/LogOperations.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/LogOperations.java @@ -15,12 +15,11 @@ */ public class LogOperations { - private LogOperations() { - } + private LogOperations() {} /** * Logs specified information. - * + * * @param message human-readable message, localized to the current locale */ public static void logInfo(String message) { @@ -29,7 +28,7 @@ public static void logInfo(String message) { /** * Logs specified information. - * + * * @param message human-readable message, localized to the current locale */ public static void logDebug(String message) { @@ -40,8 +39,8 @@ public static void logDebug(String message) { /** * Logs specified error. - * - * @param message human-readable message, localized to the current locale + * + * @param message human-readable message, localized to the current locale * @param exception low-level exception, or null if not applicable */ public static void logError(String message, Throwable exception) { @@ -50,13 +49,12 @@ public static void logError(String message, Throwable exception) { /** * Logs specified information. - * - * @param severity the severity; one of the following: IStatus.OK, - * IStatus.ERROR, IStatus.INFO, or - * IStatus.WARNING - * @param pluginId unique identifier of the relevant plug-in - * @param code plug-in-specific status code, or OK - * @param message human-readable message, localized to the current locale + * + * @param severity the severity; one of the following: IStatus.OK, IStatus.ERROR, IStatus.INFO, or + * IStatus.WARNING + * @param pluginId unique identifier of the relevant plug-in + * @param code plug-in-specific status code, or OK + * @param message human-readable message, localized to the current locale * @param exception low-level exception, or null if not applicable */ public static void log(int severity, int code, String message, Throwable exception) { @@ -65,13 +63,12 @@ public static void log(int severity, int code, String message, Throwable excepti /** * Creates status object representing specified information. - * - * @param severity the severity; one of the following: IStatus.OK, - * IStatus.ERROR, IStatus.INFO, or - * IStatus.WARNING - * @param pluginId unique identifier of the relevant plug-in - * @param code plug-in-specific status code, or OK - * @param message human-readable message, localized to the current locale + * + * @param severity the severity; one of the following: IStatus.OK, IStatus.ERROR, IStatus.INFO, or + * IStatus.WARNING + * @param pluginId unique identifier of the relevant plug-in + * @param code plug-in-specific status code, or OK + * @param message human-readable message, localized to the current locale * @param exception low-level exception, or null if not applicable. * @return the status object (not null) */ @@ -81,7 +78,7 @@ public static IStatus createStatus(int severity, int code, String message, Throw /** * Logs given status. - * + * * @param status status to log */ public static void log(IStatus status) { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/MarkerUtils.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/MarkerUtils.java index f583a02..2358fb9 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/MarkerUtils.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/MarkerUtils.java @@ -20,42 +20,42 @@ /** * Utilities for creating specialized VariantSync eclipse resource markers - * + * * @author Christopher Sontag * @since 15.08.2017 */ public class MarkerUtils { - private static List annotationMarkers = Arrays.asList("de.tubs.variantsync.marker.highlighter.red", - "de.tubs.variantsync.marker.highlighter.orange", "de.tubs.variantsync.marker.highlighter.yellow", - "de.tubs.variantsync.marker.highlighter.darkgreen", "de.tubs.variantsync.marker.highlighter.lightgreen", - "de.tubs.variantsync.marker.highlighter.cyan", "de.tubs.variantsync.marker.highlighter.lightgrey", - "de.tubs.variantsync.marker.highlighter.blue", "de.tubs.variantsync.marker.highlighter.margenta", - "de.tubs.variantsync.marker.highlighter.pink"); + private static List annotationMarkers = Arrays.asList("de.tubs.variantsync.marker.highlighter.red", "de.tubs.variantsync.marker.highlighter.orange", + "de.tubs.variantsync.marker.highlighter.yellow", "de.tubs.variantsync.marker.highlighter.darkgreen", + "de.tubs.variantsync.marker.highlighter.lightgreen", "de.tubs.variantsync.marker.highlighter.cyan", + "de.tubs.variantsync.marker.highlighter.lightgrey", "de.tubs.variantsync.marker.highlighter.blue", + "de.tubs.variantsync.marker.highlighter.margenta", "de.tubs.variantsync.marker.highlighter.pink"); /** * Removes all markers for all projects in the list - * + * * @param projectList * @throws CoreException */ public static void cleanProjects(List projectList) throws CoreException { - for (IProject p : projectList) + for (final IProject p : projectList) { cleanProject(p); + } } /** * Removes all markers for the project - * + * * @param project * @throws CoreException */ public static void cleanProject(IProject project) throws CoreException { - List markers = getMarkers(project); - for (IMarker marker : markers) { + final List markers = getMarkers(project); + for (final IMarker marker : markers) { try { marker.delete(); - } catch (CoreException e) { + } catch (final CoreException e) { throw e; } } @@ -63,17 +63,17 @@ public static void cleanProject(IProject project) throws CoreException { /** * Removes all markers from the given resource - * + * * @param res * @throws CoreException */ public static void cleanResource(IResource res) throws CoreException { - if (res != null && res.exists()) { - List markers = Arrays.asList(res.findMarkers(IMarker.MARKER, true, IResource.DEPTH_INFINITE)); - for (IMarker marker : markers) { + if ((res != null) && res.exists()) { + final List markers = Arrays.asList(res.findMarkers(IMarker.MARKER, true, IResource.DEPTH_INFINITE)); + for (final IMarker marker : markers) { try { marker.delete(); - } catch (CoreException e) { + } catch (final CoreException e) { e.printStackTrace(); } } @@ -82,20 +82,19 @@ public static void cleanResource(IResource res) throws CoreException { /** * Returns all markers for the given resource - * + * * @param res * @return List - All markers of the resource with DEPTH_INFINITE * @throws CoreException */ public static List getMarkers(IResource res) { - List returnList = new ArrayList(); + final List returnList = new ArrayList(); if (res != null) { - for (String marker : annotationMarkers) { + for (final String marker : annotationMarkers) { try { returnList.addAll(Arrays.asList(res.findMarkers(marker, true, IResource.DEPTH_INFINITE))); - } catch (CoreException e) { - LogOperations.logError("File does not exists or can not be accessed because the project is closed", - e); + } catch (final CoreException e) { + LogOperations.logError("File does not exists or can not be accessed because the project is closed", e); } } } @@ -104,7 +103,7 @@ public static List getMarkers(IResource res) { /** * Wrapper for res.getMarker(id) - * + * * @param res * @param id * @return marker with id @@ -115,7 +114,7 @@ public static IMarker getMarker(IResource res, long id) { /** * Returns the id of a code highlighting annotation - * + * * @param color * @return String - The id of the annotation highlighter */ @@ -128,10 +127,10 @@ private static String getMarker(FeatureColor color) { /** * Adds a marker to the resource - * + * * @param res - * @param start - Starting line - * @param end - Ending line + * @param start - Starting line + * @param end - Ending line * @param context * @param color */ @@ -145,7 +144,7 @@ private static long addMarker(IResource res, int posStart, int posEnd, FeatureCo marker.setAttribute(IMarker.CHAR_END, posEnd); return marker.getId(); } - } catch (CoreException e) { + } catch (final CoreException e) { LogOperations.logError("Marker can not be created", e); } return -1; @@ -153,32 +152,30 @@ private static long addMarker(IResource res, int posStart, int posEnd, FeatureCo /** * Adds the given markers to the given file - * + * * @param file * @param markers */ public static void setMarker(IFile file, List markers) { - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); - for (IVariantSyncMarker mi : markers) { + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + for (final IVariantSyncMarker mi : markers) { long markerId = -1; if (mi.isLine()) { try { IDocument document = null; try { - document = (IDocument) VariantSyncPlugin.getEditor().getDocumentProvider() - .getDocument(VariantSyncPlugin.getEditor().getEditorInput()); - } catch (NullPointerException e) { + document = VariantSyncPlugin.getEditor().getDocumentProvider().getDocument(VariantSyncPlugin.getEditor().getEditorInput()); + } catch (final NullPointerException e) { LogOperations.logError("Marker line is not available in the document", e); } - IRegion regionStart = document.getLineInformation(mi.getOffset()); - IRegion regionEnd = document.getLineInformation(mi.getOffset() + mi.getLength()); - int start = regionStart.getOffset(); - int end = regionStart.getOffset() + regionEnd.getLength(); + final IRegion regionStart = document.getLineInformation(mi.getOffset()); + final IRegion regionEnd = document.getLineInformation(mi.getOffset() + mi.getLength()); + final int start = regionStart.getOffset(); + final int end = regionStart.getOffset() + regionEnd.getLength(); - markerId = addMarker(file, start, end, - configurationProject.getFeatureContextManager().getContext(mi.getContext())); - } catch (BadLocationException e) { + markerId = addMarker(file, start, end, configurationProject.getFeatureContextManager().getContext(mi.getContext())); + } catch (final BadLocationException e) { e.printStackTrace(); } } else { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/PerspectiveFactory.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/PerspectiveFactory.java index efdebf4..08df5c3 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/PerspectiveFactory.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/PerspectiveFactory.java @@ -14,7 +14,7 @@ /** * Provides the variantsync perspective settings - * + * * @author Christopher Sontag */ public class PerspectiveFactory implements IPerspectiveFactory { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/Tree.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/Tree.java index d86c17b..8c0117e 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/Tree.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/Tree.java @@ -2,7 +2,7 @@ /** * Utility class for building treeviewer trees, see also {@link TreeNode} - * + * * @author Christopher Sontag */ public class Tree { @@ -14,7 +14,7 @@ public Tree() { } public TreeNode getRoot() { - return this.root; + return root; } public void setRoot(TreeNode root) { @@ -34,7 +34,7 @@ public int getNumberOfNodes() { private int auxiliaryGetNumberOfNodes(TreeNode node) { int numberOfNodes = node.getNumberOfChildren(); - for (TreeNode child : node.getChildren()) { + for (final TreeNode child : node.getChildren()) { numberOfNodes += auxiliaryGetNumberOfNodes(child); } @@ -48,7 +48,7 @@ public boolean exists(Object dataToFind) { public TreeNode find(Object dataToFind) { TreeNode returnNode = null; - if (root != null && dataToFind != null) { + if ((root != null) && (dataToFind != null)) { returnNode = auxiliaryFind(root, dataToFind); } @@ -69,8 +69,9 @@ private TreeNode auxiliaryFind(TreeNode currentNode, Object dataToFind) { TreeNode returnNode = null; int i = 0; - if (currentNode == null || dataToFind == null) + if ((currentNode == null) || (dataToFind == null)) { return null; + } if (currentNode.getData() != null) { if (currentNode.getData().equals(dataToFind)) { @@ -80,7 +81,7 @@ private TreeNode auxiliaryFind(TreeNode currentNode, Object dataToFind) { if (currentNode.hasChildren()) { i = 0; - while (returnNode == null && i < currentNode.getNumberOfChildren()) { + while ((returnNode == null) && (i < currentNode.getNumberOfChildren())) { returnNode = auxiliaryFind(currentNode.getChildAt(i), dataToFind); i++; } @@ -99,7 +100,7 @@ public String toString() { int i = 0; TreeNode currentNode = root; String ret = root.toString() + "\n"; - while (currentNode == null && i < currentNode.getNumberOfChildren()) { + while ((currentNode == null) && (i < currentNode.getNumberOfChildren())) { currentNode = currentNode.getChildAt(i); ret = ret + currentNode.toString() + "\n"; i++; diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/TreeNode.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/TreeNode.java index 428eaff..b8de6e1 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/TreeNode.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/TreeNode.java @@ -5,7 +5,7 @@ /** * Utility class for building treeviewer trees, see also {@link Tree} - * + * * @author Christopher Sontag */ public class TreeNode { @@ -25,11 +25,11 @@ public TreeNode(Object data) { } public TreeNode getParent() { - return this.parent; + return parent; } public List getChildren() { - return this.children; + return children; } public int getNumberOfChildren() { @@ -41,7 +41,7 @@ public boolean hasChildren() { } public void setChildren(List children) { - for (TreeNode child : children) { + for (final TreeNode child : children) { child.parent = this; } @@ -59,7 +59,7 @@ public void addChildAt(int index, TreeNode child) throws IndexOutOfBoundsExcepti } public void removeChildren() { - this.children = new ArrayList(); + children = new ArrayList(); } public void removeChildAt(int index) throws IndexOutOfBoundsException { @@ -71,13 +71,14 @@ public TreeNode getChildAt(int index) throws IndexOutOfBoundsException { } public Object getData() { - return this.data; + return data; } public void setData(Object data) { this.data = data; } + @Override public String toString() { return getData() != null ? getData().toString() : ""; } @@ -93,7 +94,7 @@ public boolean equals(Object obj) { if (getClass() != obj.getClass()) { return false; } - TreeNode other = (TreeNode) obj; + final TreeNode other = (TreeNode) obj; if (data == null) { if (other.data != null) { return false; @@ -106,14 +107,13 @@ public boolean equals(Object obj) { /* * (non-Javadoc) - * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((data == null) ? 0 : data.hashCode()); + result = (prime * result) + ((data == null) ? 0 : data.hashCode()); return result; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/VariantSyncProgressMonitor.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/VariantSyncProgressMonitor.java index 26633bb..d7afe61 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/VariantSyncProgressMonitor.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/VariantSyncProgressMonitor.java @@ -4,7 +4,7 @@ /** * A progress monitor to keep track of probably time intensive jobs - * + * * @author Christopher Sontag * @since 1.1 */ @@ -29,12 +29,10 @@ public VariantSyncProgressMonitor(String taskName, String subTaskName) { } @Override - public void beginTask(String name, int totalWork) { - } + public void beginTask(String name, int totalWork) {} @Override - public void done() { - } + public void done() {} @Override public void internalWorked(double work) { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventListener.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventListener.java index 75f1f0f..379b63b 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventListener.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventListener.java @@ -1,33 +1,20 @@ package de.tubs.variantsync.core.utilities.event; /** - * Interface for components listening to events fired by other components.
- * Some classes of FeatureIDE use the observer-pattern, to notify listening - * clients. For instance, a feature model fires a "model data changed" event - * when the model is changed. Listening clients, e.g., the diagram editor can - * react on this event.
- *
- * The follow sketch outlines the observer-pattern usage in FeatureIDE, taken - * {@link de.ovgu.featureide.fm.ui.editors.FeatureDiagramEditor} and - * {@link FeatureModel} as example.
- * IEventListener  <--- propertyChange is called ---------
- *       |                                               |
- *       |                                               |
- *  implements                                      fires event
- *       |                                               |
- *       V                                               |       										  
- *  Receiver -- register  as listener ---> Sender
- * 

- * Please note that events fired and received over this interface are from type - * {@link VariantSyncEvent}. - * + * Interface for components listening to events fired by other components.
Some classes of FeatureIDE use the observer-pattern, to notify listening + * clients. For instance, a feature model fires a "model data changed" event when the model is changed. Listening clients, e.g., the diagram editor can react on + * this event.

The follow sketch outlines the observer-pattern usage in FeatureIDE, taken + * {@link de.ovgu.featureide.fm.ui.editors.FeatureDiagramEditor} and {@link FeatureModel} as example.
 IEventListener <--- propertyChange is called
+ * --------- | | | | implements fires event | | V | Receiver -- register as listener ---> Sender 

Please note that events fired and received + * over this interface are from type {@link VariantSyncEvent}. + * * @author Sebastian Krieter */ public interface IEventListener { /** * This method is called whenever the - * + * * @param event */ void propertyChange(VariantSyncEvent event); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventManager.java index 065fba3..6ab09f0 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/IEventManager.java @@ -3,9 +3,8 @@ import de.ovgu.featureide.fm.core.base.event.FeatureIDEEvent; /** - * Broadcasts {@link FeatureIDEEvent Events} to the corresponding - * {@link IEventListener IFeatureModelListeners}. - * + * Broadcasts {@link FeatureIDEEvent Events} to the corresponding {@link IEventListener IFeatureModelListeners}. + * * @author Sebastian Krieter */ public interface IEventManager { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/VariantSyncEvent.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/VariantSyncEvent.java index 075d981..57832df 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/VariantSyncEvent.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/utilities/event/VariantSyncEvent.java @@ -2,17 +2,17 @@ * Copyright (C) 2005-2017 FeatureIDE team, University of Magdeburg, Germany * * This file is part of FeatureIDE. - * + * * FeatureIDE is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * FeatureIDE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with FeatureIDE. If not, see . * @@ -21,23 +21,11 @@ package de.tubs.variantsync.core.utilities.event; /** - * Event triggered by changes to a feature model or its elements.
- *
- * Each event contains the following information: - *
    - *
  • an event type which determine the kind of event
  • - *
  • the sender (source) of this event, i.e., which object fired this - * event
  • - *
  • the old value (if available), and the new value
  • - *
- *
- *
- * This events are intended to be processed by {@link IEventListener} instances. - *
- *
- * For usage to fire VariantSyncEvents, see - * {@link ConfigurationProject#fireEvent(VariantSyncEvent)}. - * + * Event triggered by changes to a feature model or its elements.

Each event contains the following information:
  • an event type which + * determine the kind of event
  • the sender (source) of this event, i.e., which object fired this event
  • the old value (if available), and the + * new value


This events are intended to be processed by {@link IEventListener} instances.

For usage to fire + * VariantSyncEvents, see {@link ConfigurationProject#fireEvent(VariantSyncEvent)}. + * * @author Sebastian Krieter * @author Marcus Pinnecke * @author Christopher Sontag @@ -45,8 +33,7 @@ public class VariantSyncEvent { /** - * Typing of the event instance. This type have to be used in order to - * distinguish of the event kind. + * Typing of the event instance. This type have to be used in order to distinguish of the event kind. */ public enum EventType { /** @@ -109,7 +96,7 @@ public enum EventType { static VariantSyncEvent[] defaultEvents = new VariantSyncEvent[EventType.values().length]; static { - for (EventType e : EventType.values()) { + for (final EventType e : EventType.values()) { defaultEvents[e.ordinal()] = new VariantSyncEvent(e); } } @@ -156,8 +143,7 @@ public Object getNewValue() { @Override public String toString() { - return "VariantSyncEvent [source=" + source + ", eventType=" + eventType + ", oldValue=" + oldValue - + ", newValue=" + newValue + "]"; + return "VariantSyncEvent [source=" + source + ", eventType=" + eventType + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/ActiveContextHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/ActiveContextHandler.java index 494076c..baf9ae4 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/ActiveContextHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/ActiveContextHandler.java @@ -12,7 +12,7 @@ /** * Contributes the start and stop button to the menu bar - * + * * @author Christopher Sontag */ public class ActiveContextHandler extends AbstractHandler implements IElementUpdater { @@ -27,12 +27,13 @@ public boolean isEnabled() { @Override public Object execute(ExecutionEvent event) throws ExecutionException { - boolean oldValue = active; + final boolean oldValue = active; VariantSyncPlugin.getActiveMappingManager().setActive(!oldValue); - if (!oldValue) + if (!oldValue) { updateElement.setIcon(VariantSyncPlugin.getDefault().getImageDescriptor("icons/nav_stop.gif")); - else + } else { updateElement.setIcon(VariantSyncPlugin.getDefault().getImageDescriptor("icons/nav_go.gif")); + } active = !oldValue; return null; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/DynamicContextPopupItems.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/DynamicContextPopupItems.java index 19624a6..7b54779 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/DynamicContextPopupItems.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/DynamicContextPopupItems.java @@ -26,27 +26,26 @@ /** * Manual mapping action available in the editor - * + * * @author Christopher Sontag */ public class DynamicContextPopupItems extends ContributionItem implements IEventListener { - public static Image base = VariantSyncPlugin - .imageDescriptorFromPlugin(VariantSyncPlugin.PLUGIN_ID, "icons/public_co.gif").createImage(); - public static Image composed = VariantSyncPlugin - .imageDescriptorFromPlugin(VariantSyncPlugin.PLUGIN_ID, "icons/protected_co.gif").createImage(); + public static Image base = VariantSyncPlugin.imageDescriptorFromPlugin(VariantSyncPlugin.PLUGIN_ID, "icons/public_co.gif").createImage(); + public static Image composed = VariantSyncPlugin.imageDescriptorFromPlugin(VariantSyncPlugin.PLUGIN_ID, "icons/protected_co.gif").createImage(); @Override public void fill(final Menu menu, int index) { - List features = VariantSyncPlugin.getActiveFeatureContextManager().getContexts(); + final List features = VariantSyncPlugin.getActiveFeatureContextManager().getContexts(); for (final FeatureContext fe : features) { - MenuItem menuItem = new MenuItem(menu, SWT.PUSH, index); + final MenuItem menuItem = new MenuItem(menu, SWT.PUSH, index); menuItem.setText(fe.name); menuItem.setImage(fe.isComposed() ? composed : base); if (!fe.name.contains(FeatureContextManager.DEFAULT_CONTEXT_NAME)) { menuItem.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { handleSelection(fe); } @@ -58,23 +57,22 @@ public void widgetSelected(SelectionEvent e) { } private void handleSelection(FeatureContext fe) { - IEditorPart editorPart = VariantSyncPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow() - .getActivePage().getActiveEditor(); + final IEditorPart editorPart = VariantSyncPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); if (editorPart instanceof AbstractTextEditor) { int offset = 0; int length = 0; String selectedText = null; - IEditorSite iEditorSite = editorPart.getEditorSite(); + final IEditorSite iEditorSite = editorPart.getEditorSite(); if (iEditorSite != null) { - ISelectionProvider selectionProvider = iEditorSite.getSelectionProvider(); + final ISelectionProvider selectionProvider = iEditorSite.getSelectionProvider(); if (selectionProvider != null) { - ISelection iSelection = selectionProvider.getSelection(); + final ISelection iSelection = selectionProvider.getSelection(); if (!iSelection.isEmpty()) { selectedText = ((ITextSelection) iSelection).getText(); offset = ((ITextSelection) iSelection).getOffset(); length = ((ITextSelection) iSelection).getLength(); - IFile file = (IFile) editorPart.getEditorInput().getAdapter(IFile.class); + final IFile file = editorPart.getEditorInput().getAdapter(IFile.class); if (length > 0) { // Add mapping to file diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/SelectContextContribution.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/SelectContextContribution.java index 6494bfe..640ee7a 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/SelectContextContribution.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/context/SelectContextContribution.java @@ -18,13 +18,11 @@ import de.tubs.variantsync.core.utilities.event.VariantSyncEvent; /** - * Contributes the combobox in the menu bar for selecting the current feature - * context - * + * Contributes the combobox in the menu bar for selecting the current feature context + * * @author Christopher Sontag */ -public class SelectContextContribution extends WorkbenchWindowControlContribution - implements SelectionListener, IEventListener { +public class SelectContextContribution extends WorkbenchWindowControlContribution implements SelectionListener, IEventListener { private CCombo selContext; @@ -42,11 +40,11 @@ protected Control createControl(Composite parent) { // Should solve Eclipse Bug 471313 and can be only used with FillLayout parent.getParent().setRedraw(true); - Composite composite = new Composite(parent, SWT.FILL); + final Composite composite = new Composite(parent, SWT.FILL); composite.setLayout(new FillLayout()); selContext = new CCombo(composite, SWT.FLAT | SWT.BORDER | SWT.FILL); - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); if (configurationProject != null) { selContext.setText(configurationProject.getFeatureContextManager().getActual()); } else { @@ -67,19 +65,20 @@ public boolean isDynamic() { private void updateCCombo() { Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); if (configurationProject != null) { try { - FeatureContextManager featureContextManager = configurationProject.getFeatureContextManager(); - int curSel = selContext.getSelectionIndex(); + final FeatureContextManager featureContextManager = configurationProject.getFeatureContextManager(); + final int curSel = selContext.getSelectionIndex(); selContext.setItems(featureContextManager.getContextsAsStrings().toArray(new String[] {})); if (curSel != -1) { selContext.select(curSel); } else { selContext.setText(featureContextManager.getActual()); } - } catch (Exception e) { + } catch (final Exception e) { LogOperations.logError("Cannot update selection combo box in toolbar", e); } } @@ -89,7 +88,7 @@ public void run() { @Override public void widgetSelected(SelectionEvent e) { - String context = selContext.getItem(selContext.getSelectionIndex()); + final String context = selContext.getItem(selContext.getSelectionIndex()); VariantSyncPlugin.getActiveFeatureContextManager().setActual(context); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/editor/PartAdapter.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/editor/PartAdapter.java index 5b7ae21..3a3656a 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/editor/PartAdapter.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/editor/PartAdapter.java @@ -26,9 +26,8 @@ import de.tubs.variantsync.core.utilities.event.VariantSyncEvent; /** - * PartAdapter for the editor. Creates and updates the markers of the current - * file of the editor - * + * PartAdapter for the editor. Creates and updates the markers of the current file of the editor + * * @author Tristan Pfofe (tristan.pfofe@ckc.de) * @author Christopher Sontag * @version 1.1 @@ -85,7 +84,7 @@ public void partOpened(IWorkbenchPart part) { private void updateEditorMarkers() { if (currentFile != null) { - MarkerUpdateJob job = new MarkerUpdateJob(); + final MarkerUpdateJob job = new MarkerUpdateJob(); job.schedule(); } } @@ -117,21 +116,22 @@ public MarkerUpdateJob() { public IStatus runInUIThread(IProgressMonitor monitor) { try { MarkerUtils.cleanResource(currentFile); - } catch (CoreException e) { + } catch (final CoreException e) { LogOperations.logError("Cannot clear all markers from: " + currentFile.getFullPath(), e); } - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); if (configurationProject != null) { - List markers = new ArrayList<>(); - SourceFile sourceFile = configurationProject.getMappingManager().getMapping(currentFile); + final List markers = new ArrayList<>(); + final SourceFile sourceFile = configurationProject.getMappingManager().getMapping(currentFile); if (sourceFile != null) { - for (CodeMapping codeMapping : sourceFile.getMappings()) { + for (final CodeMapping codeMapping : sourceFile.getMappings()) { markers.add(codeMapping.getMarkerInformation()); } } - if (!markers.isEmpty()) + if (!markers.isEmpty()) { MarkerUtils.setMarker(currentFile, markers); + } } return Status.OK_STATUS; } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextHandler.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextHandler.java index 7f5c1a8..d6f50f7 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextHandler.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextHandler.java @@ -4,32 +4,30 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.IHandler; import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardDialog; import de.tubs.variantsync.core.VariantSyncPlugin; /** * CommandHandler for the feature context manager - * + * * @author Christopher Sontag */ public class FeatureContextHandler implements IHandler { @Override - public void addHandlerListener(IHandlerListener handlerListener) { - } + public void addHandlerListener(IHandlerListener handlerListener) {} @Override - public void dispose() { - } + public void dispose() {} @Override public Object execute(ExecutionEvent event) throws ExecutionException { - WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), new FeatureContextManager()); + final WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), new FeatureContextManager()); dialog.create(); - if (dialog.open() == Dialog.CANCEL) { + if (dialog.open() == Window.CANCEL) { return null; } return null; @@ -46,7 +44,6 @@ public boolean isHandled() { } @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - } + public void removeHandlerListener(IHandlerListener handlerListener) {} } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextManager.java index f5c211e..4900fc4 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextManager.java @@ -9,7 +9,7 @@ /** * Wizard for managing feature contexts - * + * * @author Christopher Sontag */ public class FeatureContextManager extends Wizard { @@ -21,9 +21,10 @@ public class FeatureContextManager extends Wizard { public FeatureContextManager() { super(); setWindowTitle("Feature Contexts Manager"); - this.expressions = VariantSyncPlugin.getActiveFeatureContextManager().getContexts(); + expressions = VariantSyncPlugin.getActiveFeatureContextManager().getContexts(); } + @Override public void addPages() { addPage(new FeatureContextManagerPage(expressions)); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextManagerPage.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextManagerPage.java index 7a2a6e2..5c5f503 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextManagerPage.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextManagerPage.java @@ -27,7 +27,7 @@ /** * Page for {@link FeatureContextManager}. - * + * * @author Christopher Sontag */ public class FeatureContextManagerPage extends WizardPage { @@ -57,21 +57,22 @@ public void createControl(Composite parent) { @Override public void handleEvent(Event event) { - Table table = (Table) event.widget; - int columnCount = table.getColumnCount(); - if (columnCount == 0) + final Table table = (Table) event.widget; + final int columnCount = table.getColumnCount(); + if (columnCount == 0) { return; - Rectangle area = table.getClientArea(); - int totalAreaWdith = area.width; - int lineWidth = table.getGridLineWidth(); - int totalGridLineWidth = (columnCount - 1) * lineWidth; + } + final Rectangle area = table.getClientArea(); + final int totalAreaWdith = area.width; + final int lineWidth = table.getGridLineWidth(); + final int totalGridLineWidth = (columnCount - 1) * lineWidth; int totalColumnWidth = 0; - for (TableColumn column : table.getColumns()) { + for (final TableColumn column : table.getColumns()) { totalColumnWidth = totalColumnWidth + column.getWidth(); } - int diff = totalAreaWdith - (totalColumnWidth + totalGridLineWidth); + final int diff = totalAreaWdith - (totalColumnWidth + totalGridLineWidth); - TableColumn lastCol = table.getColumns()[columnCount - 1]; + final TableColumn lastCol = table.getColumns()[columnCount - 1]; // check diff is valid or not. setting negetive width doesnt make sense. lastCol.setWidth(diff + lastCol.getWidth()); @@ -79,7 +80,7 @@ public void handleEvent(Event event) { } }); - TableColumn tcContexts = new TableColumn(tabContexts, SWT.NONE); + final TableColumn tcContexts = new TableColumn(tabContexts, SWT.NONE); tcContexts.setText("Name"); tcContexts.setWidth(600); tcContexts.setResizable(true); @@ -104,8 +105,7 @@ public void widgetSelected(SelectionEvent e) { } @Override - public void widgetDefaultSelected(SelectionEvent e) { - } + public void widgetDefaultSelected(SelectionEvent e) {} }); button = new Button(buttonComposite, SWT.NULL); button.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ETOOL_CLEAR)); @@ -117,8 +117,7 @@ public void widgetSelected(SelectionEvent e) { } @Override - public void widgetDefaultSelected(SelectionEvent e) { - } + public void widgetDefaultSelected(SelectionEvent e) {} }); button = new Button(buttonComposite, SWT.NULL); button.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ETOOL_DELETE)); @@ -130,23 +129,21 @@ public void widgetSelected(SelectionEvent e) { } @Override - public void widgetDefaultSelected(SelectionEvent e) { - } + public void widgetDefaultSelected(SelectionEvent e) {} }); updateFeatureContextList(); setControl(composite); - PlatformUI.getWorkbench().getHelpSystem().setHelp(this.getControl(), "VariantSync.FeatureContextManager"); + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), "VariantSync.FeatureContextManager"); } private void editFeatureContext() { final TableItem[] selection = tabContexts.getSelection(); if (selection.length == 1) { - WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), - new FeatureContextWizard((FeatureContext) selection[0].getData())); + final WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), new FeatureContextWizard((FeatureContext) selection[0].getData())); dialog.create(); if (dialog.open() == Window.OK) { - this.updateFeatureContextList(); + updateFeatureContextList(); } } } @@ -154,10 +151,10 @@ private void editFeatureContext() { private void deleteFeatureContext() { final TableItem[] selection = tabContexts.getSelection(); if (selection.length > 0) { - for (TableItem ti : selection) { - contexts.remove((FeatureContext) ti.getData()); + for (final TableItem ti : selection) { + contexts.remove(ti.getData()); } - this.updateFeatureContextList(); + updateFeatureContextList(); } } @@ -165,7 +162,7 @@ private void updateFeatureContextList() { TableItem tableItem = null; tabContexts.removeAll(); if (!contexts.isEmpty()) { - for (FeatureContext fe : contexts) { + for (final FeatureContext fe : contexts) { tableItem = new TableItem(tabContexts, NONE); tableItem.setText(fe.name); tableItem.setBackground(ColorPalette.toSwtColor(fe.highlighter)); @@ -175,10 +172,10 @@ private void updateFeatureContextList() { } private void createFeatureContext() { - WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), new FeatureContextWizard(null)); + final WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), new FeatureContextWizard(null)); dialog.create(); if (dialog.open() == Window.OK) { - this.updateFeatureContextList(); + updateFeatureContextList(); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizard.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizard.java index 035b72b..3013b78 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizard.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizard.java @@ -14,7 +14,7 @@ /** * Wizard for creating or editing feature contexts - * + * * @author Christopher Sontag */ public class FeatureContextWizard extends Wizard { @@ -31,19 +31,20 @@ public FeatureContextWizard(FeatureContext context) { setWindowTitle("Feature ConfigurationProject Wizard"); { - ConfigurationProject activeConfigurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + final ConfigurationProject activeConfigurationProject = VariantSyncPlugin.getActiveConfigurationProject(); if (activeConfigurationProject == null) { throw new ProjectNotFoundException(ProjectNotFoundException.Type.CONFIGURATION); } - IFeatureProject featureProject = activeConfigurationProject.getFeatureProject(); - IFeatureModel featuremodel = featureProject.getFeatureModel(); - this.features = featuremodel.getFeatures(); + final IFeatureProject featureProject = activeConfigurationProject.getFeatureProject(); + final IFeatureModel featuremodel = featureProject.getFeatureModel(); + features = featuremodel.getFeatures(); } - this.featureContext = context; + featureContext = context; } + @Override public void addPages() { page = new FeatureContextWizardPage(features, featureContext); addPage(page); @@ -51,8 +52,8 @@ public void addPages() { @Override public boolean performFinish() { - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); - List contexts = configurationProject.getFeatureContextManager().getContexts(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + final List contexts = configurationProject.getFeatureContextManager().getContexts(); if (featureContext != null) { contexts.remove(featureContext); } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizardPage.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizardPage.java index 30563bb..f4b4e98 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizardPage.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/FeatureContextWizardPage.java @@ -31,17 +31,15 @@ import org.eclipse.swt.widgets.TableItem; import de.ovgu.featureide.fm.core.Operator; -import de.ovgu.featureide.fm.core.base.FeatureUtils; import de.ovgu.featureide.fm.core.base.IFeature; import de.ovgu.featureide.fm.core.color.ColorPalette; import de.ovgu.featureide.fm.core.color.FeatureColor; -import de.ovgu.featureide.fm.core.functional.Functional; import de.ovgu.featureide.fm.ui.editors.SimpleSyntaxHighlightEditor; import de.tubs.variantsync.core.managers.data.FeatureContext; /** * Page for {@link FeatureContextManager}. - * + * * @author Christopher Sontag */ public class FeatureContextWizardPage extends WizardPage { @@ -72,10 +70,10 @@ public void createControl(Composite parent) { composite.setLayout(new GridLayout(1, false)); // Features Group - Group grFeatures = new Group(composite, SWT.NONE); + final Group grFeatures = new Group(composite, SWT.NONE); grFeatures.setText("Features"); grFeatures.setLayoutData(new GridData(SWT.FILL, SWT.WRAP, true, false)); - GridLayout grFeaturesLayout = new GridLayout(); + final GridLayout grFeaturesLayout = new GridLayout(); grFeaturesLayout.numColumns = 1; grFeatures.setLayout(grFeaturesLayout); @@ -94,7 +92,7 @@ public void createControl(Composite parent) { tabFeatures.setInput(features); // Feature Table Column - TableViewerColumn tcFeatures = new TableViewerColumn(tabFeatures, SWT.NONE); + final TableViewerColumn tcFeatures = new TableViewerColumn(tabFeatures, SWT.NONE); tcFeatures.getColumn().setWidth(600); tcFeatures.getColumn().setText("Name"); tcFeatures.setLabelProvider(new CellLabelProvider() { @@ -111,12 +109,11 @@ public void update(ViewerCell cell) { @Override public void modifyText(ModifyEvent e) { if (!FILTERTEXT.equalsIgnoreCase(txtSearch.getText())) { - ViewerFilter searchFilter = new ViewerFilter() { + final ViewerFilter searchFilter = new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { - return ((IFeature) element).getName().toLowerCase(Locale.ENGLISH) - .contains(txtSearch.getText().toLowerCase(Locale.ENGLISH)); + return ((IFeature) element).getName().toLowerCase(Locale.ENGLISH).contains(txtSearch.getText().toLowerCase(Locale.ENGLISH)); } }; tabFeatures.addFilter(searchFilter); @@ -147,13 +144,13 @@ public void handleEvent(Event event) { @Override public void handleEvent(Event event) { - TableItem[] selectedItem = tabFeatures.getTable().getSelection(); + final TableItem[] selectedItem = tabFeatures.getTable().getSelection(); if (selectedItem.length > 0) { String featureName = selectedItem[0].getText(); if (featureName.matches(".*?\\s+.*")) { featureName = "\"" + featureName + "\""; } else { - for (String op : Operator.NAMES) { + for (final String op : Operator.NAMES) { if (featureName.equalsIgnoreCase(op)) { featureName = "\"" + featureName + "\""; break; @@ -166,19 +163,20 @@ public void handleEvent(Event event) { }); // Operator Buttons - Group grButton = new Group(composite, SWT.NONE); + final Group grButton = new Group(composite, SWT.NONE); grButton.setText(OPERATORS); grButton.setLayoutData(new GridData(SWT.FILL, SWT.WRAP, true, false)); - GridLayout grButtonsLayout = new GridLayout(); + final GridLayout grButtonsLayout = new GridLayout(); grButtonsLayout.numColumns = 7; grButton.setLayout(grButtonsLayout); for (int i = 0; i < Operator.NAMES.length; i++) { - Button button = new Button(grButton, SWT.PUSH); + final Button button = new Button(grButton, SWT.PUSH); button.setText(Operator.NAMES[i]); button.setLayoutData(new GridData(SWT.WRAP, SWT.WRAP, false, false)); button.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() { + @Override public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { txtContext.copyIn(button.getText().toLowerCase(Locale.ENGLISH)); } @@ -189,11 +187,13 @@ public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { txtContext = new SimpleSyntaxHighlightEditor(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.BORDER, Operator.NAMES); txtContext.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - if (featureContext != null) + if (featureContext != null) { txtContext.setText(featureContext.name); + } txtContext.setMargins(10, 5, 3, 5); - if (featureContext != null) + if (featureContext != null) { txtContext.setBackground(ColorPalette.toSwtColor(featureContext.highlighter)); + } txtContext.addModifyListener(new ModifyListener() { @@ -206,13 +206,14 @@ public void modifyText(ModifyEvent e) { // Color Selector cbColors = new Combo(composite, SWT.READ_ONLY); cbColors.setLayoutData(new GridData(SWT.FILL, SWT.WRAP, true, false)); - List colors = new ArrayList<>(); - for (FeatureColor color : FeatureColor.values()) { + final List colors = new ArrayList<>(); + for (final FeatureColor color : FeatureColor.values()) { colors.add(color.getColorName()); } cbColors.setItems(colors.toArray(new String[] {})); - if (featureContext != null) + if (featureContext != null) { cbColors.select(featureContext.highlighter.ordinal()); + } cbColors.addSelectionListener(new SelectionListener() { @@ -222,8 +223,7 @@ public void widgetSelected(SelectionEvent e) { } @Override - public void widgetDefaultSelected(SelectionEvent e) { - } + public void widgetDefaultSelected(SelectionEvent e) {} }); setControl(composite); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/View.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/View.java index 7127f9d..ad07718 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/View.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/featurecontext/View.java @@ -32,9 +32,9 @@ import de.tubs.variantsync.core.utilities.event.VariantSyncEvent; /** - * + * * Feature context view - * + * * @author Christopher Sontag */ public class View extends ViewPart implements IEventListener { @@ -45,7 +45,7 @@ public class View extends ViewPart implements IEventListener { private Table featureExpressionTable; - private IPartListener editorListener = new IPartListener() { + private final IPartListener editorListener = new IPartListener() { @Override public void partActivated(IWorkbenchPart part) { @@ -58,12 +58,10 @@ public void partBroughtToTop(IWorkbenchPart part) { } @Override - public void partClosed(IWorkbenchPart part) { - } + public void partClosed(IWorkbenchPart part) {} @Override - public void partDeactivated(IWorkbenchPart part) { - } + public void partDeactivated(IWorkbenchPart part) {} @Override public void partOpened(IWorkbenchPart part) { @@ -92,21 +90,22 @@ public void createPartControl(Composite parent) { @Override public void handleEvent(Event event) { - Table table = (Table) event.widget; - int columnCount = table.getColumnCount(); - if (columnCount == 0) + final Table table = (Table) event.widget; + final int columnCount = table.getColumnCount(); + if (columnCount == 0) { return; - Rectangle area = table.getClientArea(); - int totalAreaWdith = area.width; - int lineWidth = table.getGridLineWidth(); - int totalGridLineWidth = (columnCount - 1) * lineWidth; + } + final Rectangle area = table.getClientArea(); + final int totalAreaWdith = area.width; + final int lineWidth = table.getGridLineWidth(); + final int totalGridLineWidth = (columnCount - 1) * lineWidth; int totalColumnWidth = 0; - for (TableColumn column : table.getColumns()) { + for (final TableColumn column : table.getColumns()) { totalColumnWidth = totalColumnWidth + column.getWidth(); } - int diff = totalAreaWdith - (totalColumnWidth + totalGridLineWidth); + final int diff = totalAreaWdith - (totalColumnWidth + totalGridLineWidth); - TableColumn lastCol = table.getColumns()[columnCount - 1]; + final TableColumn lastCol = table.getColumns()[columnCount - 1]; // check diff is valid or not. setting negetive width doesnt make sense. lastCol.setWidth(diff + lastCol.getWidth()); @@ -114,51 +113,48 @@ public void handleEvent(Event event) { } }); - TableColumn featureExpressionTableColumn = new TableColumn(featureExpressionTable, SWT.NONE); + final TableColumn featureExpressionTableColumn = new TableColumn(featureExpressionTable, SWT.NONE); featureExpressionTableColumn.setText("Name"); featureExpressionTableColumn.setWidth(280); featureExpressionTableColumn.setResizable(true); PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "VariantSync.FeatureExpressionManager"); - IWorkbenchPage page = getSite().getPage(); + final IWorkbenchPage page = getSite().getPage(); page.addPartListener(editorListener); fillLocalToolBar(getViewSite().getActionBars().getToolBarManager()); } private void fillLocalToolBar(IToolBarManager toolBarManager) { - IAction addExpression = new Action("", Action.AS_PUSH_BUTTON) { + final IAction addExpression = new Action("", IAction.AS_PUSH_BUTTON) { @Override public void run() { createFeatureExpression(); } }; - addExpression.setImageDescriptor( - PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_ADD)); + addExpression.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_ADD)); toolBarManager.add(addExpression); - IAction editExpression = new Action("", Action.AS_PUSH_BUTTON) { + final IAction editExpression = new Action("", IAction.AS_PUSH_BUTTON) { @Override public void run() { editFeatureExpression(); } }; - editExpression.setImageDescriptor( - PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_CLEAR)); + editExpression.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_CLEAR)); toolBarManager.add(editExpression); - IAction removeExpression = new Action("", Action.AS_PUSH_BUTTON) { + final IAction removeExpression = new Action("", IAction.AS_PUSH_BUTTON) { @Override public void run() { deleteFeatureExpression(); } }; - removeExpression.setImageDescriptor( - PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_DELETE)); + removeExpression.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_DELETE)); toolBarManager.add(removeExpression); } @@ -173,11 +169,10 @@ private void editFeatureExpression() { if (!featureExpressionTable.isDisposed()) { final TableItem[] selection = featureExpressionTable.getSelection(); if (selection.length == 1) { - WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), - new FeatureContextWizard((FeatureContext) selection[0].getData())); + final WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), new FeatureContextWizard((FeatureContext) selection[0].getData())); dialog.create(); if (dialog.open() == Window.OK) { - this.updateFeatureExpressionList(); + updateFeatureExpressionList(); } } } @@ -187,10 +182,10 @@ private void deleteFeatureExpression() { if (!featureExpressionTable.isDisposed()) { final TableItem[] selection = featureExpressionTable.getSelection(); if (selection.length > 0) { - for (TableItem ti : selection) { - expressions.remove((FeatureContext) ti.getData()); + for (final TableItem ti : selection) { + expressions.remove(ti.getData()); } - this.updateFeatureExpressionList(); + updateFeatureExpressionList(); } } } @@ -199,11 +194,11 @@ private void updateFeatureExpressionList() { TableItem tableItem = null; if (!featureExpressionTable.isDisposed() && featureExpressionTable.isVisible()) { featureExpressionTable.removeAll(); - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); if (configurationProject != null) { expressions = configurationProject.getFeatureContextManager().getContexts(); if (!expressions.isEmpty()) { - for (FeatureContext fe : expressions) { + for (final FeatureContext fe : expressions) { tableItem = new TableItem(featureExpressionTable, SWT.NONE); tableItem.setText(fe.name); tableItem.setBackground(ColorPalette.toSwtColor(fe.highlighter)); @@ -215,10 +210,10 @@ private void updateFeatureExpressionList() { } private void createFeatureExpression() { - WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), new FeatureContextWizard(null)); + final WizardDialog dialog = new WizardDialog(VariantSyncPlugin.getShell(), new FeatureContextWizard(null)); dialog.create(); if (dialog.open() == Window.OK) { - this.updateFeatureExpressionList(); + updateFeatureExpressionList(); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourceChangesColumnLabelProvider.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourceChangesColumnLabelProvider.java index 91a5fd9..059e9a7 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourceChangesColumnLabelProvider.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourceChangesColumnLabelProvider.java @@ -13,9 +13,9 @@ import de.tubs.variantsync.core.utilities.TreeNode; /** - * + * * LabelProvider for {@link ResourcesTree} - * + * * @author Christopher Sontag */ public class ResourceChangesColumnLabelProvider extends CellLabelProvider { @@ -24,8 +24,8 @@ public enum TYPE { DELTATYPE, SOURCE, TARGETSWITHOUTCONFLICT, TARGETSWITHCONFLICT, TIMESTAMP, TARGETSSYNCHRONIZED } - private TYPE type; - private TargetsCalculator targetsCalculator = new TargetsCalculator(); + private final TYPE type; + private final TargetsCalculator targetsCalculator = new TargetsCalculator(); public ResourceChangesColumnLabelProvider(TYPE type) { this.type = type; @@ -48,13 +48,11 @@ public void update(ViewerCell cell) { break; case CHANGED: cell.setText("CHANGED"); - cell.setImage( - VariantSyncPlugin.getDefault().getImageDescriptor("icons/change_obj.gif").createImage()); + cell.setImage(VariantSyncPlugin.getDefault().getImageDescriptor("icons/change_obj.gif").createImage()); break; case REMOVED: cell.setText("REMOVED"); - cell.setImage( - VariantSyncPlugin.getDefault().getImageDescriptor("icons/delete_obj.gif").createImage()); + cell.setImage(VariantSyncPlugin.getDefault().getImageDescriptor("icons/delete_obj.gif").createImage()); break; default: break; @@ -65,7 +63,7 @@ public void update(ViewerCell cell) { break; case SOURCE: if (o instanceof IDelta) { - IProject project = ((IDelta) o).getProject(); + final IProject project = ((IDelta) o).getProject(); if (project != null) { cell.setText(project.getName()); } @@ -74,40 +72,37 @@ public void update(ViewerCell cell) { case TARGETSSYNCHRONIZED: if (o instanceof IDelta) { String projects = ""; - for (IProject project : ((IDelta) o).getSynchronizedProjects()) { + for (final IProject project : ((IDelta) o).getSynchronizedProjects()) { projects += project.getName() + ", "; } - projects = projects.lastIndexOf(",") == -1 ? projects - : projects.substring(0, projects.lastIndexOf(",")); + projects = projects.lastIndexOf(",") == -1 ? projects : projects.substring(0, projects.lastIndexOf(",")); cell.setText(projects); } break; case TARGETSWITHCONFLICT: if (o instanceof IDelta) { String projects = ""; - for (IProject project : targetsCalculator.getTargetsWithConflict(((IDelta) o))) { + for (final IProject project : targetsCalculator.getTargetsWithConflict(((IDelta) o))) { projects += project.getName() + ", "; } - projects = projects.lastIndexOf(",") == -1 ? projects - : projects.substring(0, projects.lastIndexOf(",")); + projects = projects.lastIndexOf(",") == -1 ? projects : projects.substring(0, projects.lastIndexOf(",")); cell.setText(projects); } break; case TARGETSWITHOUTCONFLICT: if (o instanceof IDelta) { String projects = ""; - for (IProject project : targetsCalculator.getTargetsWithoutConflict(((IDelta) o))) { + for (final IProject project : targetsCalculator.getTargetsWithoutConflict(((IDelta) o))) { projects += project.getName() + ", "; } - projects = projects.lastIndexOf(",") == -1 ? projects - : projects.substring(0, projects.lastIndexOf(",")); + projects = projects.lastIndexOf(",") == -1 ? projects : projects.substring(0, projects.lastIndexOf(",")); cell.setText(projects); } break; case TIMESTAMP: if (o instanceof IDelta) { - Timestamp stamp = new Timestamp(((IDelta) o).getTimestamp()); - Date date = new Date(stamp.getTime()); + final Timestamp stamp = new Timestamp(((IDelta) o).getTimestamp()); + final Date date = new Date(stamp.getTime()); cell.setText(date.toString()); } break; diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourceChangesTreeContentProvider.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourceChangesTreeContentProvider.java index 8d0310d..8a6a0df 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourceChangesTreeContentProvider.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourceChangesTreeContentProvider.java @@ -6,9 +6,9 @@ import de.tubs.variantsync.core.utilities.TreeNode; /** - * + * * ContentProvider for {@link ResourcesTree} - * + * * @author Christopher Sontag */ public class ResourceChangesTreeContentProvider implements ITreeContentProvider { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourcesTree.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourcesTree.java index b893e7f..53a9098 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourcesTree.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/ResourcesTree.java @@ -9,18 +9,18 @@ /** * Wraps the patches to a tree format - * + * * @author Christopher Sontag */ public class ResourcesTree { public static Tree construct(List> patches) { - Tree tree = new Tree(); - TreeNode root = new TreeNode(); + final Tree tree = new Tree(); + final TreeNode root = new TreeNode(); tree.setRoot(root); - for (IPatch patch : patches) { - for (IDelta delta : patch.getDeltas()) { + for (final IPatch patch : patches) { + for (final IDelta delta : patch.getDeltas()) { TreeNode featureNode = tree.find(delta.getContext()); if (featureNode == null) { featureNode = new TreeNode(delta.getContext()); diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/View.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/View.java index 685552e..e54ea43 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/View.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/resourcechanges/View.java @@ -22,9 +22,9 @@ import de.tubs.variantsync.core.view.resourcechanges.ResourceChangesColumnLabelProvider.TYPE; /** - * + * * Resource changes view - * + * * @author Christopher Sontag */ public class View extends ViewPart implements IEventListener { @@ -51,7 +51,7 @@ protected void setupTreeViewer(final Tree tree) { tree.setLinesVisible(true); tree.setHeaderVisible(true); - TableLayout layout = new TableLayout(); + final TableLayout layout = new TableLayout(); tree.setLayout(layout); tree.setHeaderVisible(true); @@ -101,17 +101,20 @@ protected void setupTreeViewer(final Tree tree) { protected void updateTreeViewer() { Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); if (configurationProject != null) { - PatchesManager patchesManager = configurationProject.getPatchesManager(); - List> patches = patchesManager.getPatches(); - IPatch actualPatch = patchesManager.getActualContextPatch(); - if (actualPatch != null && !patches.contains(actualPatch)) + final PatchesManager patchesManager = configurationProject.getPatchesManager(); + final List> patches = patchesManager.getPatches(); + final IPatch actualPatch = patchesManager.getActualContextPatch(); + if ((actualPatch != null) && !patches.contains(actualPatch)) { patches.add(actualPatch); + } - if (patches != null && !patches.isEmpty()) + if ((patches != null) && !patches.isEmpty()) { tvResourceChanges.setInput(ResourcesTree.construct(patches)); + } tvResourceChanges.expandToLevel(3); } } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/ProjectTree.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/ProjectTree.java index fc89ff1..d59287f 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/ProjectTree.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/ProjectTree.java @@ -9,18 +9,18 @@ /** * Wraps the patches to a tree format - * + * * @author Christopher Sontag */ public class ProjectTree { public static Tree construct(String feature, List> patches) { - Tree tree = new Tree(); - TreeNode root = new TreeNode(feature); + final Tree tree = new Tree(); + final TreeNode root = new TreeNode(feature); tree.setRoot(root); - for (IPatch patch : patches) { - for (IDelta delta : patch.getDeltas()) { + for (final IPatch patch : patches) { + for (final IDelta delta : patch.getDeltas()) { if (delta.getContext().equals(feature)) { TreeNode projectNode = tree.find(delta.getProject().getName()); if (projectNode == null) { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/SourceFocusTreeContentProvider.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/SourceFocusTreeContentProvider.java index ba2961c..c45caef 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/SourceFocusTreeContentProvider.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/SourceFocusTreeContentProvider.java @@ -6,9 +6,9 @@ import de.tubs.variantsync.core.utilities.TreeNode; /** - * + * * ContentProvider for {@link ProjectTree} - * + * * @author Christopher Sontag */ public class SourceFocusTreeContentProvider implements ITreeContentProvider { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/View.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/View.java index ccf20a6..dc3f27e 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/View.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/sourcefocus/View.java @@ -46,15 +46,16 @@ import de.tubs.variantsync.core.view.resourcechanges.ResourceChangesColumnLabelProvider.TYPE; /** - * + * * Source-focused view - * + * * @author Christopher Sontag */ public class View extends ViewPart implements SelectionListener, ISelectionChangedListener, IEventListener { private static class ComboBoxSelectionDispatcher implements Runnable { - private Combo combobox; + + private final Combo combobox; public int selectionIndex = -1; public ComboBoxSelectionDispatcher(Combo combobox) { @@ -74,9 +75,9 @@ public void run() { private SourceViewer lbChange; private Button btnSync; private org.eclipse.swt.widgets.List targetsList; - private TargetsCalculator targetsCalculator = new TargetsCalculator(); + private final TargetsCalculator targetsCalculator = new TargetsCalculator(); private String feature = ""; - private List> lastSelections = new ArrayList<>(); + private final List> lastSelections = new ArrayList<>(); public View() { VariantSyncPlugin.getDefault().addListener(this); @@ -86,7 +87,7 @@ public View() { public void createPartControl(Composite parent) { parent.setLayout(new GridLayout(4, false)); - Composite selectFeature = new Composite(parent, SWT.NONE); + final Composite selectFeature = new Composite(parent, SWT.NONE); selectFeature.setLayout(new GridLayout(4, false)); GridData gridData = new GridData(); gridData.horizontalAlignment = SWT.FILL; @@ -94,7 +95,7 @@ public void createPartControl(Composite parent) { gridData.grabExcessHorizontalSpace = false; selectFeature.setLayoutData(gridData); - Label lblFeatureExpression = new Label(selectFeature, SWT.NONE); + final Label lblFeatureExpression = new Label(selectFeature, SWT.NONE); lblFeatureExpression.setText("Feature Expression: "); gridData = new GridData(); gridData.horizontalAlignment = SWT.LEFT; @@ -108,10 +109,10 @@ public void createPartControl(Composite parent) { gridData.horizontalSpan = 2; gridData.grabExcessHorizontalSpace = true; cbFeature.setLayoutData(gridData); - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); - if (configurationProject != null) - cbFeature.setItems( - configurationProject.getFeatureContextManager().getContextsAsStrings().toArray(new String[] {})); + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + if (configurationProject != null) { + cbFeature.setItems(configurationProject.getFeatureContextManager().getContextsAsStrings().toArray(new String[] {})); + } cbFeature.select(0); cbFeature.addSelectionListener(this); @@ -128,8 +129,8 @@ public void createPartControl(Composite parent) { tvChanges.getTree().setLayoutData(gridData); setupTreeViewer(tvChanges.getTree()); - CompositeRuler ruler = new CompositeRuler(); - LineNumberRulerColumn lineNumber = new LineNumberRulerColumn(); + final CompositeRuler ruler = new CompositeRuler(); + final LineNumberRulerColumn lineNumber = new LineNumberRulerColumn(); ruler.addDecorator(0, lineNumber); lbChange = new SourceViewer(parent, ruler, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FLAT); @@ -144,7 +145,7 @@ public void createPartControl(Composite parent) { lbChange.getControl().setLayoutData(gridData); lbChange.setEditable(false); - Composite targets = new Composite(parent, SWT.NONE); + final Composite targets = new Composite(parent, SWT.NONE); targets.setLayout(new GridLayout(1, false)); gridData = new GridData(); gridData.verticalAlignment = SWT.FILL; @@ -155,7 +156,7 @@ public void createPartControl(Composite parent) { gridData.grabExcessVerticalSpace = false; targets.setLayoutData(gridData); - Label lblTargets = new Label(targets, SWT.NONE); + final Label lblTargets = new Label(targets, SWT.NONE); lblTargets.setText("Targets:"); gridData = new GridData(); gridData.horizontalAlignment = SWT.CENTER; @@ -192,7 +193,7 @@ protected void setupTreeViewer(final Tree tree) { tree.setLinesVisible(true); tree.setHeaderVisible(false); - TableLayout layout = new TableLayout(); + final TableLayout layout = new TableLayout(); tree.setLayout(layout); tree.setHeaderVisible(true); @@ -245,9 +246,9 @@ public void widgetSelected(SelectionEvent e) { } else if (e.getSource().equals(btnSync)) { - for (String project : targetsList.getSelection()) { - IProject iProject = ResourcesPlugin.getWorkspace().getRoot().getProject(project); - for (IDelta delta : lastSelections) { + for (final String project : targetsList.getSelection()) { + final IProject iProject = ResourcesPlugin.getWorkspace().getRoot().getProject(project); + for (final IDelta delta : lastSelections) { if (!delta.getProject().equals(iProject)) { SynchronizationHandler.handleSynchronization(iProject, delta); } @@ -266,16 +267,18 @@ public void widgetDefaultSelected(SelectionEvent e) { protected void updateTreeViewer(String feature) { Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); if (configurationProject != null) { - PatchesManager patchesManager = configurationProject.getPatchesManager(); - List> patches = patchesManager.getPatches(); - IPatch actualPatch = patchesManager.getActualContextPatch(); - if (actualPatch != null && !patches.contains(actualPatch)) + final PatchesManager patchesManager = configurationProject.getPatchesManager(); + final List> patches = patchesManager.getPatches(); + final IPatch actualPatch = patchesManager.getActualContextPatch(); + if ((actualPatch != null) && !patches.contains(actualPatch)) { patches.add(actualPatch); + } - if (patches != null && !patches.isEmpty() && !tvChanges.getControl().isDisposed()) { + if ((patches != null) && !patches.isEmpty() && !tvChanges.getControl().isDisposed()) { tvChanges.setInput(ProjectTree.construct(feature, patches)); } tvChanges.expandToLevel(3); @@ -289,13 +292,14 @@ public void selectionChanged(SelectionChangedEvent event) { clearAll(); lastSelections.clear(); - ITreeSelection selection = tvChanges.getStructuredSelection(); + final ITreeSelection selection = tvChanges.getStructuredSelection(); if (selection.size() == 1) { Object o = selection.getFirstElement(); - if (o instanceof TreeNode) + if (o instanceof TreeNode) { o = ((TreeNode) o).getData(); + } if (o instanceof IDelta) { - IDelta delta = ((IDelta) o); + final IDelta delta = ((IDelta) o); lastSelections.add(delta); lbChange.setDocument(new Document(delta.getRepresentation())); } else { @@ -305,12 +309,14 @@ public void selectionChanged(SelectionChangedEvent event) { IPath res = null; String ret = ""; for (Object o : selection.toList()) { - if (o instanceof TreeNode) + if (o instanceof TreeNode) { o = ((TreeNode) o).getData(); + } if (o instanceof IDelta) { - IDelta delta = ((IDelta) o); - if (res == null) + final IDelta delta = ((IDelta) o); + if (res == null) { res = delta.getResource().getProjectRelativePath(); + } if (!res.equals(delta.getResource().getProjectRelativePath())) { lbChange.setDocument(new Document("No multiple resources supported")); return; @@ -325,11 +331,12 @@ public void selectionChanged(SelectionChangedEvent event) { } private void updateTargets() { - List targets = targetsCalculator.getTargetsForFeatureContext(lastSelections); - if (targets != null && !targetsList.isDisposed()) { + final List targets = targetsCalculator.getTargetsForFeatureContext(lastSelections); + if ((targets != null) && !targetsList.isDisposed()) { targetsList.setItems(getProjectNames(targets).toArray(new String[] {})); - if (!targets.isEmpty()) + if (!targets.isEmpty()) { btnSync.setEnabled(true); + } } } @@ -353,10 +360,9 @@ public void propertyChange(VariantSyncEvent event) { case FEATURECONTEXT_ADDED: case FEATURECONTEXT_CHANGED: case FEATURECONTEXT_REMOVED: - ComboBoxSelectionDispatcher dispatcher = new ComboBoxSelectionDispatcher(cbFeature); + final ComboBoxSelectionDispatcher dispatcher = new ComboBoxSelectionDispatcher(cbFeature); Display.getDefault().syncExec(dispatcher); - cbFeature.setItems( - VariantSyncPlugin.getActiveFeatureContextManager().getContextsAsStrings().toArray(new String[] {})); + cbFeature.setItems(VariantSyncPlugin.getActiveFeatureContextManager().getContextsAsStrings().toArray(new String[] {})); cbFeature.select(dispatcher.selectionIndex); default: break; @@ -364,8 +370,8 @@ public void propertyChange(VariantSyncEvent event) { } private List getProjectNames(List projects) { - List projectNames = new ArrayList<>(); - for (IProject project : projects) { + final List projectNames = new ArrayList<>(); + for (final IProject project : projects) { projectNames.add(project.getName()); } return projectNames; diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/FeatureTree.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/FeatureTree.java index f074bd7..dc182cc 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/FeatureTree.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/FeatureTree.java @@ -9,18 +9,18 @@ /** * Wraps the patches to a tree format - * + * * @author Christopher Sontag */ public class FeatureTree { public static Tree construct(String projectName, List> patches) { - Tree tree = new Tree(); - TreeNode root = new TreeNode(projectName); + final Tree tree = new Tree(); + final TreeNode root = new TreeNode(projectName); tree.setRoot(root); - for (IPatch patch : patches) { - for (IDelta delta : patch.getDeltas()) { + for (final IPatch patch : patches) { + for (final IDelta delta : patch.getDeltas()) { if (!delta.getProject().getName().equals(projectName) && !delta.isSynchronizedProject(projectName)) { TreeNode featureNode = tree.find(delta.getContext()); if (featureNode == null) { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/TargetFocusTreeContentProvider.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/TargetFocusTreeContentProvider.java index d62087e..0c7524e 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/TargetFocusTreeContentProvider.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/TargetFocusTreeContentProvider.java @@ -6,9 +6,9 @@ import de.tubs.variantsync.core.utilities.TreeNode; /** - * + * * ContentProvider for {@link FeatureTree} - * + * * @author Christopher Sontag */ public class TargetFocusTreeContentProvider implements ITreeContentProvider { diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/View.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/View.java index 1e3b25e..0a1e54e 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/View.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/view/targetfocus/View.java @@ -47,9 +47,9 @@ import de.tubs.variantsync.core.view.resourcechanges.ResourceChangesColumnLabelProvider.TYPE; /** - * + * * Target-focused view - * + * * @author Christopher Sontag */ public class View extends ViewPart implements SelectionListener, ISelectionChangedListener, IEventListener { @@ -61,7 +61,7 @@ public class View extends ViewPart implements SelectionListener, ISelectionChang private SourceViewer lbChange; private Button btnSync; private String project = ""; - private List> lastSelections = new ArrayList<>(); + private final List> lastSelections = new ArrayList<>(); public View() { VariantSyncPlugin.getDefault().addListener(this); @@ -71,7 +71,7 @@ public View() { public void createPartControl(Composite parent) { parent.setLayout(new GridLayout(4, false)); - Composite selectFeature = new Composite(parent, SWT.NONE); + final Composite selectFeature = new Composite(parent, SWT.NONE); selectFeature.setLayout(new GridLayout(4, false)); GridData gridData = new GridData(); gridData.horizontalAlignment = SWT.FILL; @@ -79,7 +79,7 @@ public void createPartControl(Composite parent) { gridData.grabExcessHorizontalSpace = false; selectFeature.setLayoutData(gridData); - Label lblFeatureExpression = new Label(selectFeature, SWT.NONE); + final Label lblFeatureExpression = new Label(selectFeature, SWT.NONE); lblFeatureExpression.setText("Variant: "); gridData = new GridData(); gridData.horizontalAlignment = SWT.LEFT; @@ -93,9 +93,10 @@ public void createPartControl(Composite parent) { gridData.horizontalSpan = 2; gridData.grabExcessHorizontalSpace = true; cbVariant.setLayoutData(gridData); - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); - if (configurationProject != null) + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + if (configurationProject != null) { cbVariant.setItems(configurationProject.getVariantNames().toArray(new String[] {})); + } cbVariant.addSelectionListener(this); tvChanges = new TreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); @@ -111,8 +112,8 @@ public void createPartControl(Composite parent) { tvChanges.getTree().setLayoutData(gridData); setupTreeViewer(tvChanges.getTree()); - CompositeRuler ruler = new CompositeRuler(); - LineNumberRulerColumn lineNumber = new LineNumberRulerColumn(); + final CompositeRuler ruler = new CompositeRuler(); + final LineNumberRulerColumn lineNumber = new LineNumberRulerColumn(); ruler.addDecorator(0, lineNumber); lbChange = new SourceViewer(parent, ruler, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FLAT); @@ -127,7 +128,7 @@ public void createPartControl(Composite parent) { lbChange.getControl().setLayoutData(gridData); lbChange.setEditable(false); - Composite targets = new Composite(parent, SWT.NONE); + final Composite targets = new Composite(parent, SWT.NONE); targets.setLayout(new GridLayout(2, false)); gridData = new GridData(); gridData.verticalAlignment = SWT.FILL; @@ -157,7 +158,7 @@ protected void setupTreeViewer(final Tree tree) { tree.setLinesVisible(true); tree.setHeaderVisible(false); - TableLayout layout = new TableLayout(); + final TableLayout layout = new TableLayout(); tree.setLayout(layout); tree.setHeaderVisible(true); @@ -188,8 +189,8 @@ public void widgetSelected(SelectionEvent e) { } else if (e.getSource().equals(btnSync)) { - IProject iProject = ResourcesPlugin.getWorkspace().getRoot().getProject(project); - for (IDelta delta : lastSelections) { + final IProject iProject = ResourcesPlugin.getWorkspace().getRoot().getProject(project); + for (final IDelta delta : lastSelections) { SynchronizationHandler.handleSynchronization(iProject, delta); } VariantSyncPlugin.getDefault().fireEvent(new VariantSyncEvent(View.this, EventType.PATCH_CHANGED)); @@ -205,27 +206,30 @@ public void widgetDefaultSelected(SelectionEvent e) { protected void updateTreeViewer(String project) { Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { - ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); + final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject(); if (configurationProject != null) { - PatchesManager patchesManager = configurationProject.getPatchesManager(); - List> patches = patchesManager.getPatches(); - IPatch actualPatch = patchesManager.getActualContextPatch(); - if (actualPatch != null && !patches.contains(actualPatch)) + final PatchesManager patchesManager = configurationProject.getPatchesManager(); + final List> patches = patchesManager.getPatches(); + final IPatch actualPatch = patchesManager.getActualContextPatch(); + if ((actualPatch != null) && !patches.contains(actualPatch)) { patches.add(actualPatch); + } - Configuration config = configurationProject - .getConfigurationForVariant(configurationProject.getVariant(project)); + final Configuration config = configurationProject.getConfigurationForVariant(configurationProject.getVariant(project)); if (config != null) { - Set selectedFeatures = config.getSelectedFeatureNames(); - List> checkedPatches = new ArrayList<>(); - for (IPatch patch : patches) { - if (selectedFeatures.contains(patch.getContext())) + final Set selectedFeatures = config.getSelectedFeatureNames(); + final List> checkedPatches = new ArrayList<>(); + for (final IPatch patch : patches) { + if (selectedFeatures.contains(patch.getContext())) { checkedPatches.add(patch); + } } - if (patches != null && !patches.isEmpty()) + if ((patches != null) && !patches.isEmpty()) { tvChanges.setInput(FeatureTree.construct(project, checkedPatches)); + } tvChanges.expandToLevel(3); } } @@ -238,14 +242,15 @@ public void selectionChanged(SelectionChangedEvent event) { btnSync.setEnabled(false); lastSelections.clear(); - ITreeSelection selection = tvChanges.getStructuredSelection(); + final ITreeSelection selection = tvChanges.getStructuredSelection(); // Only one element selected if (selection.size() == 1) { Object o = selection.getFirstElement(); - if (o instanceof TreeNode) + if (o instanceof TreeNode) { o = ((TreeNode) o).getData(); + } if (o instanceof IDelta) { - IDelta delta = ((IDelta) o); + final IDelta delta = ((IDelta) o); lastSelections.add(delta); lbChange.setDocument(new Document(delta.getRepresentation())); btnSync.setEnabled(true); @@ -257,12 +262,14 @@ public void selectionChanged(SelectionChangedEvent event) { IPath res = null; String ret = ""; for (Object o : selection.toList()) { - if (o instanceof TreeNode) + if (o instanceof TreeNode) { o = ((TreeNode) o).getData(); + } if (o instanceof IDelta) { - IDelta delta = ((IDelta) o); - if (res == null) + final IDelta delta = ((IDelta) o); + if (res == null) { res = delta.getResource().getProjectRelativePath(); + } if (!res.equals(delta.getResource().getProjectRelativePath())) { lbChange.setDocument(new Document("No multiple resources supported")); return; @@ -288,9 +295,8 @@ public void propertyChange(VariantSyncEvent event) { break; case VARIANT_ADDED: case VARIANT_REMOVED: - int oldSelection = cbVariant.getSelectionIndex(); - cbVariant.setItems( - VariantSyncPlugin.getActiveFeatureContextManager().getContextsAsStrings().toArray(new String[] {})); + final int oldSelection = cbVariant.getSelectionIndex(); + cbVariant.setItems(VariantSyncPlugin.getActiveFeatureContextManager().getContextsAsStrings().toArray(new String[] {})); cbVariant.select(oldSelection); default: break; diff --git a/de.tubs.variantsync.update/category.xml b/de.tubs.variantsync.update/category.xml index bf66b0e..3151a3d 100644 --- a/de.tubs.variantsync.update/category.xml +++ b/de.tubs.variantsync.update/category.xml @@ -1,13 +1,25 @@ - - - - - - VariantSync is a tool to develop variants separately as in clone-and-own and to automate change propagation by using domain knowledge of developers. VariantSync detects and logs changes during development, tags these changes to feature expressions and automates the synchronization of changes between variants. As a side effect, using VariantSync for a while may increase the feature-to-code map-ping and, thus, ease a potential later migration to a product line. VariantSync is an open-source Eclipse plug-in distributed under L-GPL. - - - - + + + + + + VariantSync is a tool to develop variants separately as in clone-and-own and to + automate change propagation by using domain knowledge of developers. + VariantSync detects and logs changes during development, tags these + changes to feature expressions and automates the synchronization of + changes between variants. As a side effect, using VariantSync for a + while may increase the feature-to-code map-ping and, thus, ease a + potential later migration to a product line. VariantSync is an + open-source Eclipse plug-in distributed under L-GPL. + + + + diff --git a/de.tubs.variantsync.update/pom.xml b/de.tubs.variantsync.update/pom.xml index aa7d209..280c300 100644 --- a/de.tubs.variantsync.update/pom.xml +++ b/de.tubs.variantsync.update/pom.xml @@ -1,4 +1,5 @@ - 4.0.0 From b069cd4ed42bba25a87fb1d83c78f7f2eeb17bdf Mon Sep 17 00:00:00 2001 From: wurstbroteater Date: Tue, 2 Feb 2021 15:35:34 +0100 Subject: [PATCH 33/35] changed String to StringBuilder --- .../core/patch/DeltaFactoryManager.java | 3 ++- de.variantsync.core/.project | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 de.variantsync.core/.project diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java index 8a719d6..a491f96 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/patch/DeltaFactoryManager.java @@ -115,7 +115,8 @@ public IDeltaFactory getExtension(String id) throws NoSuchExtensionException { return extension; } } - throw new NoSuchExtensionException("No extension found for ID " + id); + StringBuilder errorMsg = new StringBuilder("No extension found for ID ").append(id); + throw new NoSuchExtensionException(errorMsg.toString()); } } diff --git a/de.variantsync.core/.project b/de.variantsync.core/.project new file mode 100644 index 0000000..38a1870 --- /dev/null +++ b/de.variantsync.core/.project @@ -0,0 +1,23 @@ + + + de.variantsync.core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + From 774e9a5e9c82a475eb5fa393ba12229e66aa3242 Mon Sep 17 00:00:00 2001 From: wurstbroteater Date: Tue, 2 Feb 2021 15:38:05 +0100 Subject: [PATCH 34/35] Auto format VariantSyncComposer --- .../src/de/tubs/variantsync/core/VariantSyncComposer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java index d98d9d6..dc1f212 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java @@ -93,8 +93,8 @@ public void copyNotComposedFiles(Configuration config, IFolder destination) { } @Override - public void buildPartialFeatureProjectAssets(IFolder sourceFolder, ArrayList removedFeatures, ArrayList mandatoryFeatures) - throws IOException, CoreException { + public void buildPartialFeatureProjectAssets(IFolder sourceFolder, ArrayList removedFeatures, + ArrayList mandatoryFeatures) throws IOException, CoreException { } From 381e4918a4a0b047e0a25563910aa274011bb8c2 Mon Sep 17 00:00:00 2001 From: wurstbroteater Date: Tue, 2 Feb 2021 16:03:56 +0100 Subject: [PATCH 35/35] addressing reviewer suggestion: replaced ternary operator with ifElse and Code Style for VSComposer --- .../src/de/tubs/variantsync/core/VariantSyncComposer.java | 4 ++-- .../core/managers/data/ConfigurationProject.java | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java index dc1f212..d98d9d6 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/VariantSyncComposer.java @@ -93,8 +93,8 @@ public void copyNotComposedFiles(Configuration config, IFolder destination) { } @Override - public void buildPartialFeatureProjectAssets(IFolder sourceFolder, ArrayList removedFeatures, - ArrayList mandatoryFeatures) throws IOException, CoreException { + public void buildPartialFeatureProjectAssets(IFolder sourceFolder, ArrayList removedFeatures, ArrayList mandatoryFeatures) + throws IOException, CoreException { } diff --git a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java index 200b3b1..2c926ab 100644 --- a/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java +++ b/de.tubs.variantsync.core/src/de/tubs/variantsync/core/managers/data/ConfigurationProject.java @@ -38,7 +38,11 @@ public class ConfigurationProject extends AManager implements ISaveableManager { private List projects = new ArrayList<>(); public IFeatureProject getFeatureProject() { - return configurationProject != null ? configurationProject.getProject().exists() ? configurationProject : null : null; + if(configurationProject != null && configurationProject.getProject().exists()) { + return configurationProject; + } + + return null; } public void setFeatureProject(IFeatureProject configurationProject) {