diff options
author | Camille Letavernier | 2015-07-23 08:27:21 +0000 |
---|---|---|
committer | Camille Letavernier | 2015-07-23 08:27:21 +0000 |
commit | d7f95be54bb8500fabc73c4b366206f6ddb73dc1 (patch) | |
tree | 86cdf23a779a175fc01326703591c07e5e5af11c /plugins/infra/emf | |
parent | 6c3e823190d08b0e38b17f48955933369dee1173 (diff) | |
download | org.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/infra/emf')
4 files changed, 11 insertions, 7 deletions
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; |