Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AST datastructure with Simple Parser for Text File Lines and JSON import/export #63

Merged
merged 94 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
0136287
created library de.variantsync.core
tcerny Dec 9, 2020
ebd6b2e
refractor package name
jeremiaheinle Dec 9, 2020
40b4110
deleted openjdk10 because its not working
wurstbroteater Dec 10, 2020
fd5ea93
minor changes after creating core library project
tcerny Dec 10, 2020
2070412
first draft of a Simple Parser for Text File Lines #52
tcerny Dec 14, 2020
7a95103
implemented #51
jeremiaheinle Dec 14, 2020
2f4ad8a
added UUID as type
wurstbroteater Dec 15, 2020
b9edc59
AST: added add method WIP toString
wurstbroteater Dec 16, 2020
fba3b05
added toString
wurstbroteater Dec 16, 2020
7cc7dce
Fixed and Optimised toString()
wurstbroteater Dec 16, 2020
63b21fc
added forgotten space in toString()
wurstbroteater Dec 16, 2020
421883f
changed gitignore
wurstbroteater Dec 16, 2020
b3d8ebb
edited #51
jeremiaheinle Dec 16, 2020
a003240
removed wrong java version
wurstbroteater Dec 17, 2020
8be0f6e
del apptest, enum
jeremiaheinle Dec 17, 2020
d5417dd
changed add Method of AST and its usage. Updated POM
wurstbroteater Dec 17, 2020
b132ef9
MAVEN: set JAVA version to 11 for usage of Path
wurstbroteater Dec 17, 2020
225174a
changed toString according to pauls ideas #50
wurstbroteater Dec 17, 2020
9259bcc
prettty json and test AST.toString()
jeremiaheinle Dec 17, 2020
829e4db
Merge branch 'issue-50' into issue-51
wurstbroteater Dec 17, 2020
a3a96b7
Merge remote-tracking branch 'origin/issue-51' into issue-51
wurstbroteater Dec 17, 2020
355cec9
merge dropped LineGrammar
wurstbroteater Dec 17, 2020
06dbe23
JsonParserTest fixed
wurstbroteater Dec 17, 2020
dd854f8
exclude fiels in AST from JsonParser
jeremiaheinle Dec 17, 2020
d80b38b
added seriazable
jeremiaheinle Dec 17, 2020
94425ed
Testcase for parseDirectory
tcerny Dec 21, 2020
15c2c40
fixed bug causing that the first dir is displayed twice
wurstbroteater Jan 6, 2021
bf259dc
first try to make attributed LineGrammar Enum
wurstbroteater Jan 6, 2021
5d82215
Styleguide
wurstbroteater Jan 6, 2021
1435db5
refactoring AST.java
wurstbroteater Jan 6, 2021
84b2e15
removed main from AST.java and added toString test
wurstbroteater Jan 6, 2021
34a6d4e
added size method and WIP size testing
wurstbroteater Jan 6, 2021
4071731
removed DEBUG output
wurstbroteater Jan 6, 2021
d136154
updated travis
wurstbroteater Jan 6, 2021
6fd51b2
Update .travis.yml
wurstbroteater Jan 6, 2021
f92002d
Travis decides if this is a fix or not
wurstbroteater Jan 6, 2021
87b22c8
Refactored LineGrammar according to Pauls idea, reduced size test
wurstbroteater Jan 8, 2021
a6249c0
addressing reviewer suggestions of #53
wurstbroteater Jan 16, 2021
0e8b183
added relativePath to child pom
wurstbroteater Jan 25, 2021
fa3a8a8
added maven compiler to fix IntelliJ-only-resolving-bugs
wurstbroteater Jan 25, 2021
8fcc5cd
changes in Simple Parser for Text File Lines
tcerny Jan 26, 2021
870f484
Merge branch 'seproj_ulm_2020' into issue-52
tcerny Jan 27, 2021
4414909
applied code style to newest library
tcerny Jan 27, 2021
f06f071
implemented grammar generalisation
tcerny Jan 27, 2021
b64019b
created ast package
tcerny Jan 27, 2021
28d4135
style guide in tests
tcerny Jan 27, 2021
4bc0314
Merge branch 'seproj_ulm_2020' into issue-52
wurstbroteater Feb 2, 2021
74fed02
Issue-58 resolved
jeremiaheinle Feb 11, 2021
caaadff
processed issue 56 WIP
tcerny Feb 16, 2021
70ca60d
removed commented lines and formatted files prior to pull request
tcerny Mar 2, 2021
58ebef0
finished issue-56 and deleted previously added folder de.variantsync.…
tcerny Mar 2, 2021
84d5696
Merge branch 'issue-56' into issue-52
tcerny Mar 2, 2021
1b44903
added accidentally deleted file de.variantsync.core/.project
tcerny Mar 2, 2021
1cbeff4
adressed reviewers suggestion
tcerny Mar 3, 2021
7a57030
addressed reviewers suggestions
tcerny Mar 10, 2021
21338d5
addressed reviewers suggestion
tcerny Mar 10, 2021
0e40810
changes in LineBasedParser and LineBasedParserTest
tcerny Mar 10, 2021
22f9e9e
review fixes
jeremiaheinle Mar 10, 2021
0a6b2dd
introduced local variables to increase readability
wurstbroteater Mar 10, 2021
989f811
addressing reviewer: move toString to class bottom
wurstbroteater Mar 10, 2021
dd8fbba
removed pointer magic
wurstbroteater Mar 10, 2021
33312e1
WIP: Refactoring toString
wurstbroteater Mar 10, 2021
c571d5e
corrected mistakes made during the work on issue 56
tcerny Mar 11, 2021
fb783d2
added FormatHelper class for refactoring of code duplication
tcerny Mar 11, 2021
c902a59
removed attributes-list in LineGrammar
tcerny Mar 11, 2021
43de43f
regeneralized JsonParser String/B
jeremiaheinle Mar 12, 2021
4812732
WIP refactored separator variables as discussed
wurstbroteater Mar 20, 2021
abc220d
AST added getter, setter, getMaxDepth, docu
wurstbroteater Mar 20, 2021
13cbd01
AST added getter, setter, getMaxDepth, docu
wurstbroteater Mar 20, 2021
09823af
refactored separator vars
wurstbroteater Mar 22, 2021
769ed4f
refactored AST test and toString test
wurstbroteater Mar 22, 2021
6e466ce
added comments and java docs for readability
wurstbroteater Mar 22, 2021
0ec7870
fixed toStringTest out and restructured size test
wurstbroteater Mar 22, 2021
b79c895
naming
wurstbroteater Mar 22, 2021
2e985a6
removed unused/dangerous AST methods
wurstbroteater Mar 22, 2021
1dc99c6
added test for maxDepth of AST
wurstbroteater Mar 22, 2021
f420d69
Deactivated failing test due to new AST format
wurstbroteater Mar 22, 2021
00d542b
Code formatted and clean up
wurstbroteater Mar 22, 2021
3838c0b
Changed name of AST attribut to plural form
wurstbroteater Mar 22, 2021
c6807fe
fixed test for initial size
wurstbroteater Mar 22, 2021
e8cdf23
addressing reviewer suggestion
wurstbroteater Mar 22, 2021
70ebe21
addressing reviewer suggestion
wurstbroteater Mar 22, 2021
d8524f2
changed getSubtrees and code restructure
wurstbroteater Mar 22, 2021
a46fca3
added tests
wurstbroteater Mar 22, 2021
9fabadd
Code format and clean up
wurstbroteater Mar 22, 2021
08ab049
addressing reviewer suggestion
wurstbroteater Mar 22, 2021
063ef68
minor improvments on add methods, added tests, code format and cleanup
wurstbroteater Mar 22, 2021
0669169
renamed Test so that maven will auto exec it
wurstbroteater Mar 23, 2021
94bb0ec
refactored toString, added printTree, fixed tests for AST
wurstbroteater Mar 23, 2021
32bac5e
Code format and cleanup
wurstbroteater Mar 23, 2021
72d897c
impl. reviewer suggestions as far as possible till meeting
wurstbroteater Mar 23, 2021
d297a64
changes after meeting
wurstbroteater Mar 24, 2021
2a6957b
final after meeting changes, code format and cleanup
wurstbroteater Mar 24, 2021
954c6c6
implemented final reviewer suggestions
tcerny Mar 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion de.tubs.variantsync.core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
<groupId>de.tubs.variantsync</groupId>
<artifactId>de.tubs.variantsync</artifactId>
<version>0.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
pmbittner marked this conversation as resolved.
Show resolved Hide resolved
</parent>

<artifactId>de.tubs.variantsync.core</artifactId>
<packaging>eclipse-plugin</packaging>

<groupId>de.tubs.variantsync.core</groupId>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,12 @@ public void listenForActiveClass() {
}

public static void addNature(IProject project) {
final VariantSyncProgressMonitor progressMonitor = new VariantSyncProgressMonitor("Adding VariantSync nature to " + project.getName());
final VariantSyncProgressMonitor progressMonitor = new VariantSyncProgressMonitor(String.format("Adding VariantSync nature to %s", project.getName()));
try {
final IProjectDescription description = project.getDescription();
final String[] natures = description.getNatureIds();

// the natures array is copied to a newNatures array, in which the variant NATURE_ID is added as first element
final String[] newNatures = new String[natures.length + 1];
System.arraycopy(natures, 0, newNatures, 1, natures.length);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +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 String.format("A %s does not exist in the workspace. %s", (type == Type.CONFIGURATION ? "configuration project" : "variant"), getMessage());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private List<IFeatureProject> findConfigurationProjects() {
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());
LogOperations.logInfo(String.format("Found configuration project with name: %s", project.getProjectName()));
projects.add(project);
// System.out.println(" is variant composing");
} else {
Expand All @@ -126,7 +126,7 @@ private void findVariants(ConfigurationProject configurationProject) {
} else {
try {
final IMarker m = file.createMarker("de.tubs.variantsync.marker.error");
m.setAttribute(IMarker.MESSAGE, "Project " + projectName + " is missing in the workspace");
m.setAttribute(IMarker.MESSAGE, String.format("Project %s is missing in the workspace", projectName));
m.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
m.setAttribute(IMarker.LINE_NUMBER, 0);
Expand Down Expand Up @@ -176,9 +176,9 @@ public ConfigurationProject getActiveConfigurationProject() {
public void propertyChange(FeatureIDEEvent event) {
switch (event.getEventType()) {
case FEATURE_ADD:
LogOperations.logInfo("Feature added: " + event);
LogOperations.logInfo(String.format("Feature added: %s", event));
case MODEL_DATA_SAVED:
LogOperations.logInfo("Model Event" + event);
LogOperations.logInfo(String.format("Model Event %s", event));
if (event.getSource() instanceof IFeatureModel) {
final IFeatureModel model = (IFeatureModel) event.getSource();
final List<String> featureExpressions = getActiveConfigurationProject().getFeatureContextManager().getContextsAsStrings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class ConfigurationProject extends AManager implements ISaveableManager {
private List<IProject> projects = new ArrayList<>();

public IFeatureProject getFeatureProject() {
if(configurationProject != null && configurationProject.getProject().exists()) {
if ((configurationProject != null) && configurationProject.getProject().exists()) {
return configurationProject;
}

Expand Down Expand Up @@ -85,8 +85,8 @@ public Configuration getConfigurationForVariant(IProject project) {
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 + ")");
System.out.println(String.format("[ConfigurationProject.getConfigurationForVariant] Check name equality Project(%s) with Config(%s)",
project.getName(), configName));
if (configName.equals(project.getName())) {
final ConfigurationManager configurationManager = ConfigurationManager.getInstance(Paths.get(configPath.getRawLocationURI()));
if (configurationManager != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public FeatureContext(String name, FeatureColor highlighter) {
}

public boolean isComposed() {
// if the name contains one of the operators "or", "and" or "not" in its middle, the FeatureContext is supposed to be composed
return name.matches(".*(or|and|not).*");
tcerny marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public class CodeMappingFormat extends AXMLFormat<List<SourceFile>> {
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 = XMLFormatHelper.createContentRegex(MAPPINGS);

public static final String FILENAME = ".mapping.xml";

Expand Down Expand Up @@ -108,5 +109,4 @@ public boolean supportsContent(CharSequence content) {
public String getName() {
return "CodeMapping";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public class FeatureContextFormat extends AXMLFormat<List<FeatureContext>> {
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 = XMLFormatHelper.createContentRegex(FEATURE_CONTEXTS);

public static final String FILENAME = ".contexts.xml";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public class PatchFormat extends AXMLFormat<List<IPatch<?>>> {
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 = XMLFormatHelper.createContentRegex(PATCHES);

public static final String FILENAME = ".patches.xml";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package de.tubs.variantsync.core.managers.persistence;

import java.util.regex.Pattern;

public class XMLFormatHelper {

// the xml pattern should start with an optional standard xml-starting line (e.g. <?xml charSequenceOfArbitraryLength?>)
// followed by an xml tag starting with the content string
public static Pattern createContentRegex(String content) {
return Pattern.compile("\\A\\s*(<[?]xml\\s.*[?]>\\s*)?<" + content + "[\\s>]");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
}

private IProject createJavaProjectWithVariantNature(String projectName) {
final VariantSyncProgressMonitor progressMonitor = new VariantSyncProgressMonitor("Create Project " + projectName);
final VariantSyncProgressMonitor progressMonitor = new VariantSyncProgressMonitor(String.format("Create Project %s", projectName));
// create project
final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
final IProject project = root.getProject(projectName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public boolean isEmpty() {

@Override
public String toString() {
return "APatch [deltas=" + deltas + "]";
return String.format("APatch [deltas= %s ]", deltas);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public IDeltaFactory getExtension(String id) throws NoSuchExtensionException {
return extension;
}
}
StringBuilder errorMsg = new StringBuilder("No extension found for ID ").append(id);
throw new NoSuchExtensionException(errorMsg.toString());
final String errorMsg = String.format("No extension found for ID %s", id);
throw new NoSuchExtensionException(errorMsg);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,29 @@ public DefaultDelta(IFile res, long timestamp, String factoryId) {

@Override
public String getOriginalAsString() {
String ret = String.valueOf(original.getPosition());
ret = ret + ":;:";
StringBuilder ret = new StringBuilder(String.valueOf(original.getPosition()));
ret.append(":;:");

for (final String line : original.getLines()) {
ret = ret + line + "#:#";
ret.append(line);
ret.append("#:#");
}
ret = ret.substring(0, ret.lastIndexOf("#:#"));
ret = ret + ":;:";
ret = new StringBuilder(ret.substring(0, ret.lastIndexOf("#:#")));
ret.append(":;:");

for (final String bLine : original.getBefore()) {
ret = ret + bLine + "#:#";
ret.append(bLine);
ret.append("#:#");
}
ret = ret.substring(0, ret.lastIndexOf("#:#"));
ret = ret + ":;:";
ret = new StringBuilder(ret.substring(0, ret.lastIndexOf("#:#")));
ret.append(":;:");

for (final String aLine : original.getAfter()) {
ret = ret + aLine + "#:#";
ret.append(aLine);
ret.append("#:#");
}
ret = ret.substring(0, ret.lastIndexOf("#:#"));

return ret;
return ret.substring(0, ret.lastIndexOf("#:#"));
}

@Override
Expand All @@ -58,33 +60,36 @@ public void setOriginalFromString(String original) {

@Override
public String getRevisedAsString() {
String ret = String.valueOf(revised.getPosition());
ret = ret + ":;:";
StringBuilder ret = new StringBuilder(String.valueOf(revised.getPosition()));
ret.append(":;:");

for (final String line : revised.getLines()) {
ret = ret + line + "#:#";
ret.append(line);
ret.append("#:#");
}
if (!revised.getLines().isEmpty()) {
ret = ret.substring(0, ret.lastIndexOf("#:#"));
ret = new StringBuilder(ret.substring(0, ret.lastIndexOf("#:#")));
}
ret = ret + ":;:";
ret.append(":;:");

for (final String bLine : revised.getBefore()) {
ret = ret + bLine + "#:#";
ret.append(bLine);
ret.append("#:#");
}
if (!revised.getBefore().isEmpty()) {
ret = ret.substring(0, ret.lastIndexOf("#:#"));
ret = new StringBuilder(ret.substring(0, ret.lastIndexOf("#:#")));
}
ret = ret + ":;:";
ret.append(":;:");

for (final String aLine : revised.getAfter()) {
ret = ret + aLine + "#:#";
ret.append(aLine);
ret.append("#:#");
}
if (!revised.getAfter().isEmpty()) {
ret = ret.substring(0, ret.lastIndexOf("#:#"));
ret = new StringBuilder(ret.substring(0, ret.lastIndexOf("#:#")));
}

return ret;
return ret.toString();
}

@Override
Expand All @@ -101,7 +106,7 @@ public void setRevisedFromString(String revised) {

@Override
public String getRepresentation() {
return "--- (" + original.getPosition() + ") " + original.getLines() + "\n" + "+++ (" + revised.getPosition() + ") " + revised.getLines();
return String.format("--- (%s) %s%n+++ (%s) %s", original.getPosition(), original.getLines(), revised.getPosition(), revised.getLines());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static IDeltaFactory<?> getInstance() {

@Override
public String toString() {
return "DefaultDeltaFactory [getId()=" + getId() + ", getName()=" + getName() + "]";
return String.format("DefaultDeltaFactory [getId()=%s, getName()=%s]", getId(), getName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public List<IVariantSyncMarker> getMarkersForDeltas(IFile file, List<IDelta<Chun
final List<IVariantSyncMarker> variantSyncMarkers = new ArrayList<>();
for (final IDelta<Chunk<String>> delta : deltas) {
final Chunk revised = delta.getRevised();
// For the display of markers, the utilities.MarkerUtils.setMarker-method uses Editor/Document-information provided by IDocument.
// IDocument is 0-based (so the first line is line 0 in IDocument), which means that every line number has to be reduced by 1
final IVariantSyncMarker variantSyncMarker = new AMarkerInformation(revised.getPosition() - 1, revised.getLines().size() - 1, true);
tcerny marked this conversation as resolved.
Show resolved Hide resolved
variantSyncMarker.setContext(delta.getContext());
variantSyncMarkers.add(variantSyncMarker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public IFile applyDelta(IFile file, IPatch<?> patch) {
final IDeltaFactory<?> factory = DeltaFactoryManager.getFactoryById(delta.getFactoryId());
newFile = factory.applyDelta(newFile, delta);
} catch (final NoSuchExtensionException e) {
LogOperations.logError("Could not find extension with id: " + delta.getFactoryId(), e);
LogOperations.logError(String.format("Could not find extension with id: %s", delta.getFactoryId()), e);
}
}
return newFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class MyDiffNode extends DiffNode {

@Override
public String toString() {
return "MyDiffNode [fDirty=" + fDirty + ", fLastId=" + fLastId + ", fLastName=" + fLastName + "]";
return String.format("MyDiffNode [fDirty=%s, fLastId=%s, fLastName=%s]", fDirty, fLastId, fLastName);
}

private boolean fDirty = false;
Expand Down Expand Up @@ -99,7 +99,7 @@ public String getName() {
fLastName = super.getName();
}
if (fDirty) {
return '<' + fLastName + '>';
return String.format("<%s>", fLastName);
}
return fLastName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@Deprecated
public class DeltaCompareViewer extends Wizard {

public static final String ID = VariantSyncPlugin.PLUGIN_ID + ".views.synchronization.compare";
public static final String ID = String.format("%s.views.synchronization.compare", VariantSyncPlugin.PLUGIN_ID);
private final DeltaCompareViewerPage page;
private final IFile file;
private final IDelta<?> delta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ public void createControl(Composite parent) {
}

public List<String> getSourceCode() {
return Arrays.asList(sourceViewer.getDocument().get().split("\n"));
return Arrays.asList(sourceViewer.getDocument().get().split(String.format("%n")));
}

private String getStringFromList(List<String> entries) {
String str = "";
for (final String el : entries) {
str += el + "\n";
str += String.format("%s%n", el);
pmbittner marked this conversation as resolved.
Show resolved Hide resolved
}
return str;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private static long addMarker(IResource res, int posStart, int posEnd, FeatureCo
IMarker marker = null;
if (res.exists()) {
marker = res.createMarker(getMarker(featureContext.highlighter));
marker.setAttribute(IMarker.MESSAGE, "Feature: " + featureContext.name);
marker.setAttribute(IMarker.MESSAGE, String.format("Feature: %s", featureContext.name));
marker.setAttribute(IMarker.CHAR_START, posStart);
marker.setAttribute(IMarker.CHAR_END, posEnd);
return marker.getId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
public class PerspectiveFactory implements IPerspectiveFactory {

public static final String ID = VariantSyncPlugin.PLUGIN_ID + ".perspective";
public static final String ID = String.format("%s.perspective", VariantSyncPlugin.PLUGIN_ID);

@Override
public void createInitialLayout(IPageLayout layout) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ public String toString() {
if (root != null) {
int i = 0;
TreeNode currentNode = root;
String ret = root.toString() + "\n";
String ret = String.format("%s%n", root.toString());
while ((currentNode == null) && (i < currentNode.getNumberOfChildren())) {
currentNode = currentNode.getChildAt(i);
ret = ret + currentNode.toString() + "\n";
ret += String.format("%s%n", currentNode.toString());
i++;
}
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public Object getNewValue() {

@Override
public String toString() {
return "VariantSyncEvent [source=" + source + ", eventType=" + eventType + ", oldValue=" + oldValue + ", newValue=" + newValue + "]";
return String.format("VariantSyncEvent [source=%s, eventType=%s, oldValue=%s, newValue=%s]", source, eventType, oldValue, newValue);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public IStatus runInUIThread(IProgressMonitor monitor) {
try {
MarkerUtils.cleanResource(currentFile);
} catch (final CoreException e) {
LogOperations.logError("Cannot clear all markers from: " + currentFile.getFullPath(), e);
LogOperations.logError(String.format("Cannot clear all markers from: %s", currentFile.getFullPath()), e);
}

final ConfigurationProject configurationProject = VariantSyncPlugin.getActiveConfigurationProject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
public class FeatureContextManager extends Wizard {

public static final String ID = VariantSyncPlugin.PLUGIN_ID + ".views.featurecontexts.manage";
public static final String ID = String.format("%s.views.featurecontexts.manage", VariantSyncPlugin.PLUGIN_ID);

private final List<FeatureContext> expressions;

Expand Down
Loading