Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2015-07-23 08:27:21 +0000
committerCamille Letavernier2015-07-23 08:27:21 +0000
commitd7f95be54bb8500fabc73c4b366206f6ddb73dc1 (patch)
tree86cdf23a779a175fc01326703591c07e5e5af11c /plugins
parent6c3e823190d08b0e38b17f48955933369dee1173 (diff)
downloadorg.eclipse.papyrus-d7f95be54bb8500fabc73c4b366206f6ddb73dc1.tar.gz
org.eclipse.papyrus-d7f95be54bb8500fabc73c4b366206f6ddb73dc1.tar.xz
org.eclipse.papyrus-d7f95be54bb8500fabc73c4b366206f6ddb73dc1.zip
443799: [Code Quality] Cleanup code according to FindBugs results
https://bugs.eclipse.org/bugs/show_bug.cgi?id=443799 - Fix additional issues in some infra and customization bundles
Diffstat (limited to 'plugins')
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/BundleExplorerDialog.java2
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalSeparatorProxy.java2
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalStackProxy.java2
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/AbstractQVTGenerator.java15
-rw-r--r--plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/internal/common/GradientCanvas.java5
-rw-r--r--plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/viewer/DiscoveryViewer.java7
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/AppearanceHelper.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/BusinessModelResolver.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/HistoryUtil.java8
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/TextReferencesHelper.java6
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintsManager.java4
11 files changed, 27 insertions, 28 deletions
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/BundleExplorerDialog.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/BundleExplorerDialog.java
index 8ae2fc5e322..fed5f51c1c6 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/BundleExplorerDialog.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/BundleExplorerDialog.java
@@ -145,7 +145,7 @@ public class BundleExplorerDialog extends FilteredItemsSelectionDialog {
@Override
protected boolean matches(String text) {
String pattern = patternMatcher.getPattern();
- if (pattern.indexOf("*") != 0 & pattern.indexOf("?") != 0 & pattern.indexOf(".") != 0) {//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (pattern.indexOf("*") != 0 && pattern.indexOf("?") != 0 && pattern.indexOf(".") != 0) {//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
pattern = "*" + pattern; //$NON-NLS-1$
patternMatcher.setPattern(pattern);
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalSeparatorProxy.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalSeparatorProxy.java
index 6162eabf9a4..ba69166cf28 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalSeparatorProxy.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalSeparatorProxy.java
@@ -26,7 +26,7 @@ public class PaletteLocalSeparatorProxy extends PaletteEntryProxy {
protected String id;
/** icon for separators */
- public static String SEPARATOR_ICON = "/icons/separator.gif";
+ public static final String SEPARATOR_ICON = "/icons/separator.gif";
/**
* Creates a new PaletteLocalEntryProxy
diff --git a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalStackProxy.java b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalStackProxy.java
index 9be7196e8b5..b9472ca434c 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalStackProxy.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.palette/src/org/eclipse/papyrus/customization/palette/dialog/PaletteLocalStackProxy.java
@@ -26,7 +26,7 @@ public class PaletteLocalStackProxy extends PaletteContainerProxy {
protected String id;
/** icon for separators */
- public static String STACK_ICON = "/icons/stack.gif";
+ public static final String STACK_ICON = "/icons/stack.gif";
/**
* Creates a new PaletteLocalEntryProxy
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/AbstractQVTGenerator.java b/plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/AbstractQVTGenerator.java
index c2082f9fe1e..1adfbbb1bd0 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/AbstractQVTGenerator.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/AbstractQVTGenerator.java
@@ -15,7 +15,6 @@
package org.eclipse.papyrus.customization.properties.generation.generators;
import java.io.IOException;
-import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -37,7 +36,6 @@ import org.eclipse.m2m.qvt.oml.ExecutionContextImpl;
import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic;
import org.eclipse.m2m.qvt.oml.ModelExtent;
import org.eclipse.m2m.qvt.oml.TransformationExecutor;
-import org.eclipse.m2m.qvt.oml.util.WriterLog;
import org.eclipse.papyrus.customization.properties.generation.Activator;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.views.properties.contexts.Context;
@@ -126,7 +124,7 @@ public abstract class AbstractQVTGenerator implements IGenerator, Listener {
* @param uri
* The URI from which the EObject is loaded
* @return
- * The loaded EObject, or null if an error occured
+ * The loaded EObject, or null if an error occured
* @throws IOException
* If the URI isn't a valid EObject
*/
@@ -175,7 +173,7 @@ public abstract class AbstractQVTGenerator implements IGenerator, Listener {
* @param outObjects
* The list of EObjects from which the context will be retrieved
* @return
- * The main generated context
+ * The main generated context
*/
protected List<Context> getContexts(List<EObject> outObjects) {
List<Context> result = new LinkedList<Context>();
@@ -211,7 +209,8 @@ public abstract class AbstractQVTGenerator implements IGenerator, Listener {
ExecutionContextImpl context = new ExecutionContextImpl();
context.setConfigProperty("keepModeling", true); //$NON-NLS-1$
- context.setLog(new WriterLog(new OutputStreamWriter(System.out)));
+
+ // context.setLog(new WriterLog(new OutputStreamWriter(System.out)));
ExecutionDiagnostic result = executor.execute(context, extents.toArray(new ModelExtent[0]));
@@ -234,12 +233,8 @@ public abstract class AbstractQVTGenerator implements IGenerator, Listener {
return generatedContexts = null;
}
-
-
-
protected abstract List<ModelExtent> getModelExtents(int i);
-
private List<Context> generateDifferentFile(List<URI> targetURI) {
URI transformationURI = getTransformationURI();
@@ -253,7 +248,7 @@ public abstract class AbstractQVTGenerator implements IGenerator, Listener {
List<ModelExtent> extents = null;
ExecutionContextImpl context = new ExecutionContextImpl();
context.setConfigProperty("keepModeling", true); //$NON-NLS-1$
- context.setLog(new WriterLog(new OutputStreamWriter(System.out)));
+ // context.setLog(new WriterLog(new OutputStreamWriter(System.out)));
List<Context> temp = new LinkedList<Context>();
for (int i = 0; i < targetURI.size(); i++) {
diff --git a/plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/internal/common/GradientCanvas.java b/plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/internal/common/GradientCanvas.java
index 0f27c1ab57b..bd800ee224e 100644
--- a/plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/internal/common/GradientCanvas.java
+++ b/plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/internal/common/GradientCanvas.java
@@ -29,7 +29,6 @@ import org.eclipse.swt.widgets.Listener;
/**
* Based on {@link org.eclipse.ui.internal.forms.widgets.FormHeading}.
*/
-@SuppressWarnings("restriction")
public class GradientCanvas extends Canvas {
private static final int SEPARATOR = 1 << 1;
@@ -44,12 +43,12 @@ public class GradientCanvas extends Canvas {
static String H_PREFIX = PREFIX + "H_"; //$NON-NLS-1$
- public static String H_BOTTOM_KEYLINE1 = H_PREFIX + "BOTTOM_KEYLINE1"; //$NON-NLS-1$
+ public static final String H_BOTTOM_KEYLINE1 = H_PREFIX + "BOTTOM_KEYLINE1"; //$NON-NLS-1$
/**
* Key for the form header bottom keyline 2 color.
*/
- public static String H_BOTTOM_KEYLINE2 = H_PREFIX + "BOTTOM_KEYLINE2"; //$NON-NLS-1$
+ public static final String H_BOTTOM_KEYLINE2 = H_PREFIX + "BOTTOM_KEYLINE2"; //$NON-NLS-1$
private Image backgroundImage;
diff --git a/plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/viewer/DiscoveryViewer.java b/plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/viewer/DiscoveryViewer.java
index 7de94d0a441..d5b7669ce6e 100644
--- a/plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/viewer/DiscoveryViewer.java
+++ b/plugins/infra/discovery/org.eclipse.papyrus.infra.discovery.ui/src/org/eclipse/papyrus/infra/discovery/ui/viewer/DiscoveryViewer.java
@@ -954,7 +954,8 @@ public class DiscoveryViewer {
.setToolTipText(Messages.ConnectorDiscoveryWizardMainPage_tooltip_showOverview);
hookTooltip(toolBar, infoButton,
categoryHeaderContainer, nameLabel, category
- .eResource(), category.getOverview(),
+ .eResource(),
+ category.getOverview(),
null);
GridDataFactory.fillDefaults().align(SWT.END,
SWT.CENTER).applyTo(toolBar);
@@ -1021,7 +1022,7 @@ public class DiscoveryViewer {
return null;
}
String regex = filterText;
- regex.replace("\\", "\\\\").replace("?", ".").replace("*", ".*?"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ regex = regex.replace("\\", "\\\\").replace("?", ".").replace("*", ".*?"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
return Pattern
.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
}
@@ -1322,7 +1323,7 @@ public class DiscoveryViewer {
if (!(filterMatches(descriptor.getName())
|| filterMatches(descriptor.getDescription())
|| filterMatches(descriptor.getProvider()) || filterMatches(descriptor
- .getLicense()))) {
+ .getLicense()))) {
return true;
}
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/AppearanceHelper.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/AppearanceHelper.java
index e1606cff7ee..aa1c57c95c8 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/AppearanceHelper.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/AppearanceHelper.java
@@ -21,7 +21,7 @@ import org.eclipse.papyrus.infra.emf.appearance.style.AppearanceStyleProvider;
public class AppearanceHelper {
- public static String EXTENSION_ID = Activator.PLUGIN_ID + ".styleProvider";
+ public static final String EXTENSION_ID = Activator.PLUGIN_ID + ".styleProvider";
private static AppearanceStyleProvider styleProvider = findStyleProvider();
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/BusinessModelResolver.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/BusinessModelResolver.java
index 1aa4fce087c..3040faed3b5 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/BusinessModelResolver.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/BusinessModelResolver.java
@@ -29,7 +29,7 @@ public class BusinessModelResolver {
/**
* The unique instance
*/
- public static BusinessModelResolver instance = new BusinessModelResolver();
+ public static final BusinessModelResolver instance = new BusinessModelResolver();
public BusinessModelResolver() {
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/HistoryUtil.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/HistoryUtil.java
index eedc0a505b2..824035a5849 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/HistoryUtil.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/HistoryUtil.java
@@ -20,6 +20,8 @@ public class HistoryUtil {
/**
* Returns a String identifying the History of selected values for the given object/feature
*
+ * The HistoryID is scoped to a Resource (If editedObject has one)
+ *
* @param editedObject
* @param feature
* @return
@@ -32,13 +34,15 @@ public class HistoryUtil {
* Returns a String identifying the History of selected values for the given object/feature,
* and prepends the given prefix
*
+ * The HistoryID is scoped to a Resource (If editedObject has one)
+ *
* @param editedObject
* @param feature
* @return
*/
public static String getHistoryID(EObject editedObject, EStructuralFeature feature, String prefix) {
- // return String.format("history_%s:%s:%s", feature.getEType().getEPackage().getName(), feature.getEType().getName(), feature.getName()); //$NON-NLS-1$
- if (editedObject.eResource() == null) {
+ // return String.format("history_%s:%s:%s", feature.getEType().getEPackage().getName(), feature.getEType().getName(), feature.getName()); //$NON-NLS-1$
+ if (editedObject == null || editedObject.eResource() == null) {
return String.format("history_%s_%s:%s", prefix, EMFHelper.getQualifiedName(feature.getEType(), ":"), feature.getName()); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/TextReferencesHelper.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/TextReferencesHelper.java
index c7c783ea587..b0f7cb251f1 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/TextReferencesHelper.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/TextReferencesHelper.java
@@ -43,9 +43,9 @@ public abstract class TextReferencesHelper {
public static final String URI_REGEX = String.format("%s*#%s+", URI_CHARS, FRAGMENT_CHARS); // The base uri is optional. The fragment is required.
- public static String UNKNOWN_ELEMENT = "UNKNOWN"; // Replacement text for unknown elements
+ public static final String UNKNOWN_ELEMENT = "UNKNOWN"; // Replacement text for unknown elements
- public static String PROXY_ELEMENT = "PROXY"; // Replacement text for proxy elements
+ public static final String PROXY_ELEMENT = "PROXY"; // Replacement text for proxy elements
protected Resource baseResource;
@@ -117,7 +117,7 @@ public abstract class TextReferencesHelper {
* The position at which the reference must be inserted. 0 is the beginning, while text.length() is the end. For all "invalid" indexes (<0
* and > length()), the reference will be inserted at the end of the string
* @return
- * The text containing the new reference
+ * The text containing the new reference
*/
public String insertReference(EObject toElement, String inText, int atPosition) {
String result = inText;
diff --git a/plugins/infra/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintsManager.java b/plugins/infra/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintsManager.java
index e28e02b23ac..3818f7dd270 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintsManager.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintsManager.java
@@ -95,13 +95,13 @@ public class ConstraintsManager {
/**
* The singleton instance of {@link ConstraintsManager}
*/
- public static ConstraintsManager instance = new ConstraintsManager();
+ public static final ConstraintsManager instance = new ConstraintsManager();
/**
* Returns all {@link ConstraintType}s contained in the {@link ConstraintEnvironment} managed by this singleton
*
* @return
- * All known {@link ConstraintType}s
+ * All known {@link ConstraintType}s
*/
public Collection<ConstraintType> getConstraintTypes() {
Collection<ConstraintType> constraintTypes = new HashSet<ConstraintType>();

Back to the top