Code clean-up in babel tools core plug-in
diff --git a/org.eclipse.babel.tapiji.tools.core.ui/src/org/eclipse/babel/tapiji/tools/core/ui/builder/BuilderPropertyChangeListener.java b/org.eclipse.babel.tapiji.tools.core.ui/src/org/eclipse/babel/tapiji/tools/core/ui/builder/BuilderPropertyChangeListener.java index 313140e..7b2e963 100644 --- a/org.eclipse.babel.tapiji.tools.core.ui/src/org/eclipse/babel/tapiji/tools/core/ui/builder/BuilderPropertyChangeListener.java +++ b/org.eclipse.babel.tapiji.tools.core.ui/src/org/eclipse/babel/tapiji/tools/core/ui/builder/BuilderPropertyChangeListener.java
@@ -11,7 +11,7 @@ package org.eclipse.babel.tapiji.tools.core.ui.builder; import org.eclipse.babel.tapiji.tools.core.Logger; -import org.eclipse.babel.tapiji.tools.core.extensions.IMarkerConstants; +import org.eclipse.babel.tapiji.tools.core.extensions.MarkerConstants; import org.eclipse.babel.tapiji.tools.core.ui.preferences.TapiJIPreferences; import org.eclipse.babel.tapiji.tools.core.ui.utils.EditorUtils; import org.eclipse.core.resources.IMarker; @@ -49,16 +49,16 @@ if (event.getProperty().equals( TapiJIPreferences.AUDIT_UNSPEZIFIED_KEY)) { deleteMarkersByCause(EditorUtils.RB_MARKER_ID, - IMarkerConstants.CAUSE_UNSPEZIFIED_KEY); + MarkerConstants.CAUSE_UNSPEZIFIED_KEY); } if (event.getProperty().equals(TapiJIPreferences.AUDIT_SAME_VALUE)) { deleteMarkersByCause(EditorUtils.RB_MARKER_ID, - IMarkerConstants.CAUSE_SAME_VALUE); + MarkerConstants.CAUSE_SAME_VALUE); } if (event.getProperty().equals( TapiJIPreferences.AUDIT_MISSING_LANGUAGE)) { deleteMarkersByCause(EditorUtils.RB_MARKER_ID, - IMarkerConstants.CAUSE_MISSING_LANGUAGE); + MarkerConstants.CAUSE_MISSING_LANGUAGE); } }
diff --git a/org.eclipse.babel.tapiji.tools.core.ui/src/org/eclipse/babel/tapiji/tools/core/ui/builder/I18nBuilder.java b/org.eclipse.babel.tapiji.tools.core.ui/src/org/eclipse/babel/tapiji/tools/core/ui/builder/I18nBuilder.java index 734024e..ae2b951 100644 --- a/org.eclipse.babel.tapiji.tools.core.ui/src/org/eclipse/babel/tapiji/tools/core/ui/builder/I18nBuilder.java +++ b/org.eclipse.babel.tapiji.tools.core.ui/src/org/eclipse/babel/tapiji/tools/core/ui/builder/I18nBuilder.java
@@ -20,7 +20,7 @@ import org.eclipse.babel.core.configuration.IConfiguration; import org.eclipse.babel.tapiji.tools.core.Logger; import org.eclipse.babel.tapiji.tools.core.extensions.ILocation; -import org.eclipse.babel.tapiji.tools.core.extensions.IMarkerConstants; +import org.eclipse.babel.tapiji.tools.core.extensions.MarkerConstants; import org.eclipse.babel.tapiji.tools.core.model.exception.NoSuchResourceAuditorException; import org.eclipse.babel.tapiji.tools.core.ui.ResourceBundleManager; import org.eclipse.babel.tapiji.tools.core.ui.analyzer.ResourceFinder; @@ -232,7 +232,7 @@ new String[] { problem .getLiteral() }), problem, - IMarkerConstants.CAUSE_CONSTANT_LITERAL, "", + MarkerConstants.CAUSE_CONSTANT_LITERAL, "", (ILocation) problem.getData(), ra .getContextId()); } @@ -251,7 +251,7 @@ .getData()) .getLiteral() }), brokenLiteral, - IMarkerConstants.CAUSE_BROKEN_REFERENCE, + MarkerConstants.CAUSE_BROKEN_REFERENCE, brokenLiteral.getLiteral(), (ILocation) brokenLiteral.getData(), ra .getContextId()); @@ -268,7 +268,7 @@ new String[] { brokenLiteral .getLiteral() }), brokenLiteral, - IMarkerConstants.CAUSE_BROKEN_RB_REFERENCE, + MarkerConstants.CAUSE_BROKEN_RB_REFERENCE, brokenLiteral.getLiteral(), (ILocation) brokenLiteral.getData(), ra .getContextId()); @@ -297,7 +297,7 @@ problem.getFile() .getName() }), problem, - IMarkerConstants.CAUSE_UNSPEZIFIED_KEY, + MarkerConstants.CAUSE_UNSPEZIFIED_KEY, problem.getLiteral(), "", (ILocation) problem.getData(), ra .getContextId()); @@ -323,7 +323,7 @@ .getName(), problem.getLiteral() }), problem, - IMarkerConstants.CAUSE_SAME_VALUE, + MarkerConstants.CAUSE_SAME_VALUE, problem.getLiteral(), sameValues.get(problem).getFile().getName(), (ILocation) problem.getData(), ra @@ -344,7 +344,7 @@ .getFile()), problem.getLiteral() }), problem, - IMarkerConstants.CAUSE_MISSING_LANGUAGE, + MarkerConstants.CAUSE_MISSING_LANGUAGE, problem.getLiteral(), "", (ILocation) problem.getData(), ra .getContextId());
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/extensions/ILocation.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/extensions/ILocation.java index 1faa7c3..48b4de4 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/extensions/ILocation.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/extensions/ILocation.java
@@ -21,40 +21,40 @@ */ public interface ILocation { - /** - * Returns the source resource's physical location. - * - * @return The file within the text fragment is located - */ - public IFile getFile(); + /** + * Returns the source resource's physical location. + * + * @return The file within the text fragment is located + */ + IFile getFile(); - /** - * Returns the position of the text fragments starting character. - * - * @return The position of the first character - */ - public int getStartPos(); + /** + * Returns the position of the text fragments starting character. + * + * @return The position of the first character + */ + int getStartPos(); - /** - * Returns the position of the text fragments last character. - * - * @return The position of the last character - */ - public int getEndPos(); + /** + * Returns the position of the text fragments last character. + * + * @return The position of the last character + */ + int getEndPos(); - /** - * Returns the text fragment. - * - * @return The text fragment - */ - public String getLiteral(); + /** + * Returns the text fragment. + * + * @return The text fragment + */ + String getLiteral(); - /** - * Returns additional metadata. The type and content of this property is not - * specified and can be used to marshal additional data for the computation - * of resolution proposals. - * - * @return The metadata associated with the text fragment - */ - public Serializable getData(); + /** + * Returns additional metadata. The type and content of this property is not + * specified and can be used to marshal additional data for the computation + * of resolution proposals. + * + * @return The metadata associated with the text fragment + */ + Serializable getData(); }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/extensions/IMarkerConstants.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/extensions/MarkerConstants.java similarity index 61% rename from org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/extensions/IMarkerConstants.java rename to org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/extensions/MarkerConstants.java index 36e21bf..d190f67 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/extensions/IMarkerConstants.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/extensions/MarkerConstants.java
@@ -10,12 +10,15 @@ ******************************************************************************/ package org.eclipse.babel.tapiji.tools.core.extensions; -public interface IMarkerConstants { - public static final int CAUSE_BROKEN_REFERENCE = 0; - public static final int CAUSE_CONSTANT_LITERAL = 1; - public static final int CAUSE_BROKEN_RB_REFERENCE = 2; +public class MarkerConstants { + public static final int CAUSE_BROKEN_REFERENCE = 0; + public static final int CAUSE_CONSTANT_LITERAL = 1; + public static final int CAUSE_BROKEN_RB_REFERENCE = 2; - public static final int CAUSE_UNSPEZIFIED_KEY = 3; - public static final int CAUSE_SAME_VALUE = 4; - public static final int CAUSE_MISSING_LANGUAGE = 5; + public static final int CAUSE_UNSPEZIFIED_KEY = 3; + public static final int CAUSE_SAME_VALUE = 4; + public static final int CAUSE_MISSING_LANGUAGE = 5; + + private MarkerConstants() { + } }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/IResourceBundleChangedListener.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/IResourceBundleChangedListener.java index 26727ee..fc47f8e 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/IResourceBundleChangedListener.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/IResourceBundleChangedListener.java
@@ -14,6 +14,6 @@ public interface IResourceBundleChangedListener { - public void resourceBundleChanged(ResourceBundleChangedEvent event); + void resourceBundleChanged(ResourceBundleChangedEvent event); }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/IResourceDescriptor.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/IResourceDescriptor.java index cb80a2f..587b2d2 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/IResourceDescriptor.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/IResourceDescriptor.java
@@ -12,20 +12,20 @@ public interface IResourceDescriptor { - public void setProjectName(String projName); + void setProjectName(String projName); - public void setRelativePath(String relPath); + void setRelativePath(String relPath); - public void setAbsolutePath(String absPath); + void setAbsolutePath(String absPath); - public void setBundleId(String bundleId); + void setBundleId(String bundleId); - public String getProjectName(); + String getProjectName(); - public String getRelativePath(); + String getRelativePath(); - public String getAbsolutePath(); + String getAbsolutePath(); - public String getBundleId(); + String getBundleId(); }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/IResourceExclusionListener.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/IResourceExclusionListener.java index 31f913b..d23e346 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/IResourceExclusionListener.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/IResourceExclusionListener.java
@@ -14,6 +14,6 @@ public interface IResourceExclusionListener { - public void exclusionChanged(ResourceExclusionEvent event); + void exclusionChanged(ResourceExclusionEvent event); }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/ResourceDescriptor.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/ResourceDescriptor.java index fc556c3..8c1003f 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/ResourceDescriptor.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/ResourceDescriptor.java
@@ -19,7 +19,7 @@ private String absolutePath; private String bundleId; - public ResourceDescriptor(IResource resource) { + public ResourceDescriptor(final IResource resource) { projectName = resource.getProject().getName(); relativePath = resource.getProjectRelativePath().toString(); absolutePath = resource.getRawLocation().toString(); @@ -49,7 +49,7 @@ } @Override - public boolean equals(Object other) { + public boolean equals(final Object other) { if (!(other instanceof ResourceDescriptor)) return false; @@ -57,17 +57,17 @@ } @Override - public void setAbsolutePath(String absPath) { + public void setAbsolutePath(final String absPath) { this.absolutePath = absPath; } @Override - public void setProjectName(String projName) { + public void setProjectName(final String projName) { this.projectName = projName; } @Override - public void setRelativePath(String relPath) { + public void setRelativePath(final String relPath) { this.relativePath = relPath; } @@ -77,7 +77,7 @@ } @Override - public void setBundleId(String bundleId) { + public void setBundleId(final String bundleId) { this.bundleId = bundleId; }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/SLLocation.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/SLLocation.java index 5ac24c8..d11079b 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/SLLocation.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/SLLocation.java
@@ -21,10 +21,10 @@ private IFile file = null; private int startPos = -1; private int endPos = -1; - private String literal; + private final String literal; private Serializable data; - public SLLocation(IFile file, int startPos, int endPos, String literal) { + public SLLocation(final IFile file, final int startPos, final int endPos, final String literal) { super(); this.file = file; this.startPos = startPos; @@ -36,7 +36,7 @@ return file; } - public void setFile(IFile file) { + public void setFile(final IFile file) { this.file = file; } @@ -44,7 +44,7 @@ return startPos; } - public void setStartPos(int startPos) { + public void setStartPos(final int startPos) { this.startPos = startPos; } @@ -52,7 +52,7 @@ return endPos; } - public void setEndPos(int endPos) { + public void setEndPos(final int endPos) { this.endPos = endPos; } @@ -64,7 +64,7 @@ return data; } - public void setData(Serializable data) { + public void setData(final Serializable data) { this.data = data; }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/exception/NoSuchResourceAuditorException.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/exception/NoSuchResourceAuditorException.java index 05f0eb8..946662d 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/exception/NoSuchResourceAuditorException.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/exception/NoSuchResourceAuditorException.java
@@ -16,5 +16,12 @@ * default serial id */ private static final long serialVersionUID = 1L; + + public NoSuchResourceAuditorException(final String msg) { + super(msg); + } + public NoSuchResourceAuditorException() { + super(); + } }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/exception/ResourceBundleException.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/exception/ResourceBundleException.java index 767a761..0438297 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/exception/ResourceBundleException.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/exception/ResourceBundleException.java
@@ -14,7 +14,7 @@ private static final long serialVersionUID = -2039182473628481126L; - public ResourceBundleException(String msg) { + public ResourceBundleException(final String msg) { super(msg); }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceBundleChangedEvent.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceBundleChangedEvent.java index 1196f11..069cb0f 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceBundleChangedEvent.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceBundleChangedEvent.java
@@ -24,7 +24,7 @@ private String bundle = ""; private int type = -1; - public ResourceBundleChangedEvent(int type, String bundle, IProject project) { + public ResourceBundleChangedEvent(final int type, final String bundle, final IProject project) { this.type = type; this.bundle = bundle; this.project = project; @@ -34,7 +34,7 @@ return project; } - public void setProject(IProject project) { + public void setProject(final IProject project) { this.project = project; } @@ -42,7 +42,7 @@ return bundle; } - public void setBundle(String bundle) { + public void setBundle(final String bundle) { this.bundle = bundle; } @@ -50,7 +50,7 @@ return type; } - public void setType(int type) { + public void setType(final int type) { this.type = type; } }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceBundleDetector.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceBundleDetector.java deleted file mode 100644 index 6652137..0000000 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceBundleDetector.java +++ /dev/null
@@ -1,15 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Martin Reiterer. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Martin Reiterer - initial API and implementation - ******************************************************************************/ -package org.eclipse.babel.tapiji.tools.core.model.manager; - -public class ResourceBundleDetector { - -}
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceExclusionEvent.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceExclusionEvent.java index 1230be2..0515b84 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceExclusionEvent.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceExclusionEvent.java
@@ -16,12 +16,12 @@ private Collection<Object> changedResources; - public ResourceExclusionEvent(Collection<Object> changedResources) { + public ResourceExclusionEvent(final Collection<Object> changedResources) { super(); this.changedResources = changedResources; } - public void setChangedResources(Collection<Object> changedResources) { + public void setChangedResources(final Collection<Object> changedResources) { this.changedResources = changedResources; }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/EditorUtils.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/EditorUtils.java index 3c7b920..897ce16 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/EditorUtils.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/EditorUtils.java
@@ -16,7 +16,7 @@ import org.eclipse.core.resources.IMarker; -public class EditorUtils { +public final class EditorUtils { /** Marker constants **/ public static final String MARKER_ID = "org.eclipse.babel.tapiji.tools.core.ui.StringLiteralAuditMarker"; @@ -31,15 +31,19 @@ public static final String MESSAGE_SAME_VALUE = "''{0}'' and ''{1}'' have the same translation for the key ''{2}''"; public static final String MESSAGE_MISSING_LANGUAGE = "ResourceBundle ''{0}'' lacks a translation for ''{1}''"; - public static String getFormattedMessage(String pattern, Object[] arguments) { + private EditorUtils() { + } + + public static String getFormattedMessage(final String pattern, final Object[] arguments) { String formattedMessage = ""; - MessageFormat formatter = new MessageFormat(pattern); + final MessageFormat formatter = new MessageFormat(pattern); formattedMessage = formatter.format(arguments); return formattedMessage; } + // TODO refactor public static IMarker[] concatMarkerArray(IMarker[] ms, IMarker[] ms_to_add) { IMarker[] old_ms = ms; ms = new IMarker[old_ms.length + ms_to_add.length];
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/FileUtils.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/FileUtils.java index 986bded..63d3542 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/FileUtils.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/FileUtils.java
@@ -29,13 +29,15 @@ return readFileAsString(resource.getRawLocation().toFile()); } - protected static String readFileAsString(File filePath) { + public static String readFileAsString(final File filePath) { String content = ""; - if (!filePath.exists()) + if (!filePath.exists()) { return content; + } + try { - BufferedReader fileReader = new BufferedReader(new FileReader( + final BufferedReader fileReader = new BufferedReader(new FileReader( filePath)); String line = ""; @@ -67,13 +69,14 @@ * @throws CoreException * @throws OperationCanceledException */ - public synchronized void saveTextFile(IFile file, String editorContent) + public synchronized void saveTextFile(final IFile file, final String editorContent) throws CoreException, OperationCanceledException { try { file.setContents( new ByteArrayInputStream(editorContent.getBytes()), false, true, null); } catch (Exception e) { + // TODO use logger e.printStackTrace(); } }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/FragmentProjectUtils.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/FragmentProjectUtils.java index 99c4924..2ea49f7 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/FragmentProjectUtils.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/FragmentProjectUtils.java
@@ -15,30 +15,35 @@ import org.eclipse.babel.core.util.PDEUtils; import org.eclipse.core.resources.IProject; -public class FragmentProjectUtils { +public final class FragmentProjectUtils { - public static String getPluginId(IProject project) { - return PDEUtils.getPluginId(project); - } + private FragmentProjectUtils() { - public static IProject[] lookupFragment(IProject pluginProject) { - return PDEUtils.lookupFragment(pluginProject); - } + } - public static boolean isFragment(IProject pluginProject) { - return PDEUtils.isFragment(pluginProject); - } + public static String getPluginId(final IProject project) { + return PDEUtils.getPluginId(project); + } - public static List<IProject> getFragments(IProject hostProject) { - return PDEUtils.getFragments(hostProject); - } + public static IProject[] lookupFragment(final IProject pluginProject) { + return PDEUtils.lookupFragment(pluginProject); + } - public static String getFragmentId(IProject project, String hostPluginId) { - return PDEUtils.getFragmentId(project, hostPluginId); - } + public static boolean isFragment(final IProject pluginProject) { + return PDEUtils.isFragment(pluginProject); + } - public static IProject getFragmentHost(IProject fragment) { - return PDEUtils.getFragmentHost(fragment); - } + public static List<IProject> getFragments(final IProject hostProject) { + return PDEUtils.getFragments(hostProject); + } + + public static String getFragmentId(final IProject project, + final String hostPluginId) { + return PDEUtils.getFragmentId(project, hostPluginId); + } + + public static IProject getFragmentHost(final IProject fragment) { + return PDEUtils.getFragmentHost(fragment); + } }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/OverlayIcon.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/OverlayIcon.java index 56465ce..3a2b328 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/OverlayIcon.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/OverlayIcon.java
@@ -17,50 +17,53 @@ public class OverlayIcon extends CompositeImageDescriptor { - public static final int TOP_LEFT = 0; - public static final int TOP_RIGHT = 1; - public static final int BOTTOM_LEFT = 2; - public static final int BOTTOM_RIGHT = 3; + public static final int TOP_LEFT = 0; + public static final int TOP_RIGHT = 1; + public static final int BOTTOM_LEFT = 2; + public static final int BOTTOM_RIGHT = 3; - private Image img; - private Image overlay; - private int location; - private Point imgSize; + private final Image img; + private Image overlay; + private int location; + private Point imgSize; - public OverlayIcon(Image baseImage, Image overlayImage, int location) { - super(); - this.img = baseImage; - this.overlay = overlayImage; - this.location = location; - this.imgSize = new Point(baseImage.getImageData().width, - baseImage.getImageData().height); - } + public OverlayIcon(final Image baseImage, final Image overlayImage, + final int location) { + super(); + this.img = baseImage; + this.overlay = overlayImage; + this.location = location; + this.imgSize = new Point(baseImage.getImageData().width, + baseImage.getImageData().height); + } - @Override - protected void drawCompositeImage(int width, int height) { - drawImage(img.getImageData(), 0, 0); - ImageData imageData = overlay.getImageData(); + @Override + protected void drawCompositeImage(final int width, final int height) { + drawImage(img.getImageData(), 0, 0); + final ImageData imageData = overlay.getImageData(); - switch (location) { - case TOP_LEFT: - drawImage(imageData, 0, 0); - break; - case TOP_RIGHT: - drawImage(imageData, imgSize.x - imageData.width, 0); - break; - case BOTTOM_LEFT: - drawImage(imageData, 0, imgSize.y - imageData.height); - break; - case BOTTOM_RIGHT: - drawImage(imageData, imgSize.x - imageData.width, imgSize.y - - imageData.height); - break; - } - } + switch (location) { + case TOP_LEFT: + drawImage(imageData, 0, 0); + break; + case TOP_RIGHT: + drawImage(imageData, imgSize.x - imageData.width, 0); + break; + case BOTTOM_LEFT: + drawImage(imageData, 0, imgSize.y - imageData.height); + break; + case BOTTOM_RIGHT: + drawImage(imageData, imgSize.x - imageData.width, imgSize.y + - imageData.height); + break; + default: + // TODO report error + } + } - @Override - protected Point getSize() { - return new Point(img.getImageData().width, img.getImageData().height); - } + @Override + protected Point getSize() { + return new Point(img.getImageData().width, img.getImageData().height); + } }
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/RBFileUtils.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/RBFileUtils.java index 915f70a..0f4f06a 100644 --- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/RBFileUtils.java +++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/util/RBFileUtils.java
@@ -12,25 +12,27 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.action.Action; -public class RBFileUtils extends Action { - public static final String PROPERTIES_EXT = "properties"; +public final class RBFileUtils { - /** - * Checks whether a RB-file has a problem-marker - */ - public static boolean hasResourceBundleMarker(IResource r) { - try { - if (r.findMarkers(EditorUtils.RB_MARKER_ID, true, - IResource.DEPTH_INFINITE).length > 0) { - return true; - } else { - return false; - } - } catch (CoreException e) { - return false; - } - } + private RBFileUtils() { + + } + + /** + * Checks whether a RB-file has a problem-marker + */ + public static boolean hasResourceBundleMarker(final IResource resource) { + boolean hasRBMarker; + + try { + hasRBMarker = resource.findMarkers(EditorUtils.RB_MARKER_ID, true, + IResource.DEPTH_INFINITE).length > 0; + } catch (CoreException e) { + hasRBMarker = false; + } + + return hasRBMarker; + } }
diff --git a/org.eclipse.babel.tapiji.tools.java.ui/src/org/eclipse/babel/tapiji/tools/java/ui/JavaResourceAuditor.java b/org.eclipse.babel.tapiji.tools.java.ui/src/org/eclipse/babel/tapiji/tools/java/ui/JavaResourceAuditor.java index dea2c53..cecf043 100644 --- a/org.eclipse.babel.tapiji.tools.java.ui/src/org/eclipse/babel/tapiji/tools/java/ui/JavaResourceAuditor.java +++ b/org.eclipse.babel.tapiji.tools.java.ui/src/org/eclipse/babel/tapiji/tools/java/ui/JavaResourceAuditor.java
@@ -15,7 +15,7 @@ import java.util.Set; import org.eclipse.babel.tapiji.tools.core.extensions.ILocation; -import org.eclipse.babel.tapiji.tools.core.extensions.IMarkerConstants; +import org.eclipse.babel.tapiji.tools.core.extensions.MarkerConstants; import org.eclipse.babel.tapiji.tools.core.model.SLLocation; import org.eclipse.babel.tapiji.tools.core.ui.ResourceBundleManager; import org.eclipse.babel.tapiji.tools.core.ui.extensions.I18nResourceAuditor; @@ -101,12 +101,12 @@ List<IMarkerResolution> resolutions = new ArrayList<IMarkerResolution>(); switch (marker.getAttribute("cause", -1)) { - case IMarkerConstants.CAUSE_CONSTANT_LITERAL: + case MarkerConstants.CAUSE_CONSTANT_LITERAL: resolutions.add(new IgnoreStringFromInternationalization()); resolutions.add(new ExcludeResourceFromInternationalization()); resolutions.add(new ExportToResourceBundleResolution()); break; - case IMarkerConstants.CAUSE_BROKEN_REFERENCE: + case MarkerConstants.CAUSE_BROKEN_REFERENCE: String dataName = marker.getAttribute("bundleName", ""); int dataStart = marker.getAttribute("bundleStart", 0); int dataEnd = marker.getAttribute("bundleEnd", 0); @@ -142,7 +142,7 @@ } break; - case IMarkerConstants.CAUSE_BROKEN_RB_REFERENCE: + case MarkerConstants.CAUSE_BROKEN_RB_REFERENCE: String bname = marker.getAttribute("key", ""); Set<IResource> bundleResources = ResourceBundleManager.getManager(
diff --git a/org.eclipse.babel.tapiji.tools.rbmanager.ui/src/org/eclipse/babel/tapiji/tools/rbmanager/auditor/ResourceBundleAuditor.java b/org.eclipse.babel.tapiji.tools.rbmanager.ui/src/org/eclipse/babel/tapiji/tools/rbmanager/auditor/ResourceBundleAuditor.java index c75044e..bc87e81 100644 --- a/org.eclipse.babel.tapiji.tools.rbmanager.ui/src/org/eclipse/babel/tapiji/tools/rbmanager/auditor/ResourceBundleAuditor.java +++ b/org.eclipse.babel.tapiji.tools.rbmanager.ui/src/org/eclipse/babel/tapiji/tools/rbmanager/auditor/ResourceBundleAuditor.java
@@ -28,7 +28,7 @@ import org.eclipse.babel.core.message.IMessage; import org.eclipse.babel.core.message.IMessagesBundleGroup; import org.eclipse.babel.tapiji.tools.core.extensions.ILocation; -import org.eclipse.babel.tapiji.tools.core.extensions.IMarkerConstants; +import org.eclipse.babel.tapiji.tools.core.extensions.MarkerConstants; import org.eclipse.babel.tapiji.tools.core.ui.ResourceBundleManager; import org.eclipse.babel.tapiji.tools.core.ui.extensions.I18nRBAuditor; import org.eclipse.babel.tapiji.tools.core.ui.utils.RBFileUtils; @@ -248,7 +248,7 @@ List<IMarkerResolution> resolutions = new ArrayList<IMarkerResolution>(); switch (marker.getAttribute("cause", -1)) { - case IMarkerConstants.CAUSE_MISSING_LANGUAGE: + case MarkerConstants.CAUSE_MISSING_LANGUAGE: Locale l = new Locale(marker.getAttribute(LANGUAGE_ATTRIBUTE, "")); // TODO // change // Name