Warning cleanup in org.eclipse.e4.tools.emf.ui

* Mostly non-localised strings (some of them should be localised)
* Resource warning (now ignored)

API and illegal access problems are not touched.

Change-Id: Ic6f95a15d5f227568b7f1ec7633e5773eb2df0fc
Signed-off-by: Jens Lidestrom <jens@lidestrom.se>
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java
index f018aba..db80523 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java
@@ -42,7 +42,7 @@
 
 		@Override
 		public String toString() {
-			return "FeatureClass : " + label;
+			return "FeatureClass : " + label; //$NON-NLS-1$
 		}
 	}
 
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java
index d6e6151..aee76a9 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java
@@ -327,7 +327,7 @@
 						IResource r = rd.getResource();
 						if (r instanceof IFile)
 						{
-							if ("e4xmi".equals(((IFile) r).getFileExtension())) {
+							if ("e4xmi".equals(((IFile) r).getFileExtension())) { //$NON-NLS-1$
 								modelResourceSet = null;
 								break;
 							}
@@ -428,7 +428,7 @@
 	 */
 	public static boolean referenceIsModelFragmentCompliant(EReference r) {
 		String t = r.getEReferenceType().getName();
-		return (r.isContainment() && !t.equals("StringToStringMap") && !t.equals("StringToObjectMap"));
+		return (r.isContainment() && !t.equals("StringToStringMap") && !t.equals("StringToObjectMap")); //$NON-NLS-1$ //$NON-NLS-2$
 
 	}
 
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java
index f9bd017..b216293 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java
@@ -257,7 +257,22 @@
 	 * @return
 	 */
 	private ImageDescriptor getImageDescriptorFromUri(String uri) {
+		ImageDescriptor result = null;
 
+		URL url = findPlatformImage(uri);
+
+		if (url != null) {
+			ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
+			Image scaled = Util.scaleImage(imageDesc.createImage(), MAX_IMG_SIZE);
+			createdImages.add(scaled);
+			result = ImageDescriptor.createFromImage(scaled);
+		}
+
+		return result;
+	}
+
+	@SuppressWarnings("resource")
+	private static URL findPlatformImage(String uri) {
 		// SEVERAL CASES are possible here :
 		// * uri = platform:/plugin/myplugin/icons/image.gif
 		// * uri = platform:/resource/myplugin/icons/image.gif
@@ -270,7 +285,6 @@
 		// case, we must rather use platform:/resource/.
 		// Used ideas from the ImageTooltip code around line 70 to fix this
 
-		ImageDescriptor result = null;
 		InputStream stream = null;
 		URL url = null;
 
@@ -312,15 +326,7 @@
 			} catch (final IOException ex) {
 			}
 		}
-
-		if (url != null) {
-			ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
-			Image scaled = Util.scaleImage(imageDesc.createImage(), MAX_IMG_SIZE);
-			createdImages.add(scaled);
-			result = ImageDescriptor.createFromImage(scaled);
-		}
-
-		return result;
+		return url;
 	}
 
 	public Image getImage(Object element) {
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java
index 6b44c88..b5d33b7 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java
@@ -229,7 +229,7 @@
 		}
 
 		// known ID for application are directly filtered.
-		if ("xpath:/".equals(parentElementId) || "org.eclipse.e4.legacy.ide.application".equals(parentElementId)) {
+		if ("xpath:/".equals(parentElementId) || "org.eclipse.e4.legacy.ide.application".equals(parentElementId)) { //$NON-NLS-1$//$NON-NLS-2$
 			return ApplicationPackageImpl.eINSTANCE.getApplication();
 		}
 
@@ -237,7 +237,7 @@
 		// set... this resource set is cached by Util...
 		ResourceSet resourceSet = Util.getModelElementResources();
 
-		String xpath = parentElementId.startsWith("xpath:") ? parentElementId.substring(6) : null;
+		String xpath = parentElementId.startsWith("xpath:") ? parentElementId.substring(6) : null; //$NON-NLS-1$
 
 		for (final Resource res : resourceSet.getResources()) {
 			final TreeIterator<EObject> it = EcoreUtil.getAllContents(res, true);
@@ -382,8 +382,8 @@
 
 			KeyStroke keyStroke;
 			try {
-				char[] autoactivationChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.".toCharArray();
-				keyStroke = KeyStroke.getInstance("Ctrl+Space");
+				char[] autoactivationChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.".toCharArray(); //$NON-NLS-1$
+				keyStroke = KeyStroke.getInstance("Ctrl+Space"); //$NON-NLS-1$
 				ContentProposalAdapter adapter = new ContentProposalAdapter(featureText, new TextContentAdapter(),
 						new StringModelFragmentProposalProvider(this, featureText), keyStroke, autoactivationChar);
 				adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
@@ -479,12 +479,12 @@
 					if (Util.referenceIsModelFragmentCompliant(r) && r.getName().startsWith(text.getText())) {
 						String content = r.getName();
 						sb.setLength(0);
-						sb.append(content).append(": ");
+						sb.append(content).append(": "); //$NON-NLS-1$
 						final EClassifier type = ModelUtils.getTypeArgument(this.fragment.getSelectedContainer(),
 								r.getEGenericType());
 						if (r.isMany()) {
 							// List<Container>
-							sb.append("List<").append(type.getName()).append(">");
+							sb.append("List<").append(type.getName()).append(">"); //$NON-NLS-1$ //$NON-NLS-2$
 						} else {
 							// TypeOfTheClass
 							sb.append(type.getName());
@@ -505,6 +505,7 @@
 
 	}
 
+	@Override
 	public void dispose() {
 		if (composite != null) {
 			composite.dispose();
@@ -642,7 +643,7 @@
 			// bound to feature name
 
 			// We must manage especially snippets (see bug 531219) No other solution ...
-			if ("snippets".equals(featurename)) {
+			if ("snippets".equals(featurename)) { //$NON-NLS-1$
 				result = new ArrayList<>();
 				for (EClass c : VSnippetsEditor.SNIPPET_CHILDREN) {
 					result.add(new FeatureClass(c.getName(), c));
@@ -688,7 +689,7 @@
 
 	// Fix bug 531054 -> This code could be removed when Dialog and WizardDialog
 	// will disappear from model !
-	static private final List<String> excludeNames = Arrays.asList("Dialog", "WizardDialog");
+	static private final List<String> excludeNames = Arrays.asList("Dialog", "WizardDialog"); //$NON-NLS-1$ //$NON-NLS-2$
 
 	// Fix bug 531054 -> This code could be removed when DIalog and WizardDialog
 	// will be definitively removed from code (after 2020).
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java
index c665102..51a431f 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java
@@ -201,9 +201,10 @@
 			pickList.setSelection(new StructuredSelection(defaultStruct));
 		}
 
-		ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context,
+		ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
 				WidgetProperties.buttonSelection(), E4Properties.toBeRendered(getEditingDomain()));
-		ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.buttonSelection(),
+		ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
+				WidgetProperties.buttonSelection(),
 				E4Properties.visible(getEditingDomain()));
 
 		item = new CTabItem(folder, SWT.NONE);
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java
index 366a512..50087a0 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java
@@ -13,32 +13,39 @@
 import org.eclipse.core.databinding.observable.value.IObservableValue;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.emf.databinding.EMFUpdateValueStrategy;
-import org.eclipse.emf.databinding.internal.EMFValueProperty;
+import org.eclipse.emf.databinding.IEMFValueProperty;
+import org.eclipse.emf.databinding.edit.IEMFEditValueProperty;
 import org.eclipse.emf.ecore.EAttribute;
 import org.eclipse.emf.ecore.EDataType;
 import org.eclipse.emf.ecore.EFactory;
 import org.eclipse.emf.edit.command.SetCommand;
 
 /**
- * An updater to deal with unsettable primitive attributes on EMF objects. EMF's {@link EMFEditValueProperty}/
- * {@link EMFValueProperty} does an eGet to
+ * An updater to deal with unsettable primitive attributes on EMF objects. EMF's
+ * {@link IEMFEditValueProperty}/ {@link IEMFValueProperty} does an eGet to
  * retrieve the attribute value, with no regard as to whether the attribute is
  * unset. If the attribute is unset, then eGet() will return the default value.
  *
  * This implementation makes several assumptions:
  * <ul>
- * <li>Assumes that these unsettable attributes have a nonsensical default value that can be used to detect an eGet of
- * an unset attribute.</li>
- * <li>Assumes that we are using EMFEditObservables so that changes are described using {@link SetCommand}, such that we
- * can provide {@link SetCommand#UNSET_VALUE} to remove a value.</li>
+ * <li>Assumes that these unsettable attributes have a nonsensical default value
+ * that can be used to detect an eGet of an unset attribute.</li>
+ * <li>Assumes that we are using EMFEditObservables so that changes are
+ * described using {@link SetCommand}, such that we can provide
+ * {@link SetCommand#UNSET_VALUE} to remove a value.</li>
  * </ul>
  * See the following discussions for background details:
  * <ul>
- * <li><a href="http://www.eclipse.org/forums/index.php?t=msg&th=165026/">Dynamic eGet for unsettable attributes</a></li>
- * <li><a href="http://www.eclipsezone.com/eclipse/forums/t114431.html?start=15"> Creating a ComboViewer for an
- * EReference</a> particularly the later postings from Tom Schindl on handling null values</li>
- * <li><a href="http://www.eclipse.org/forums/index.php?t=msg&th=174967/"> ObservableMapCellLabelProvider doesn't work
- * well with unsettable features</a></li>
+ * <li><a href=
+ * "http://www.eclipse.org/forums/index.php?t=msg&th=165026/">Dynamic eGet for
+ * unsettable attributes</a></li>
+ * <li><a href=
+ * "http://www.eclipsezone.com/eclipse/forums/t114431.html?start=15"> Creating a
+ * ComboViewer for an EReference</a> particularly the later postings from Tom
+ * Schindl on handling null values</li>
+ * <li><a href="http://www.eclipse.org/forums/index.php?t=msg&th=174967/">
+ * ObservableMapCellLabelProvider doesn't work well with unsettable
+ * features</a></li>
  * </ul>
  */
 public class UnsettableUpdateValueStrategy extends EMFUpdateValueStrategy {
@@ -90,7 +97,7 @@
 						}
 						// If the value
 						if (fromObject == SetCommand.UNSET_VALUE || fromObject == null
-							|| fromObject.equals(eAttribute.getDefaultValue())) {
+								|| fromObject.equals(eAttribute.getDefaultValue())) {
 							return ""; //$NON-NLS-1$
 						}
 						return eFactory.convertToString(eDataType, fromObject);
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java
index da63fc7..a9d113e 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java
@@ -272,7 +272,7 @@
 			createRemoveMainMenu.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1));
 		}
 
-		ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context,
+		ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
 				WidgetProperties.buttonSelection(), E4Properties.toBeRendered(getEditingDomain()));
 		ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.buttonSelection(), //$NON-NLS-1$
 				E4Properties.visible(getEditingDomain()));
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java
index 3f070ac..474bbe9 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java
@@ -577,6 +577,7 @@
 	@Override
 	public InputStream getContents() throws CoreException {
 		URL url;
+		@SuppressWarnings("resource")
 		ZipFile zip = null;
 		try {
 			if (path.getFileExtension().equals("jar")) { //$NON-NLS-1$
@@ -595,7 +596,7 @@
 				ret = url.openStream();
 			} catch (final Exception e) {
 				return new BufferedInputStream(new FileInputStream(data.installLocation
-					+ "/" + data.resourceRelativePath)); //$NON-NLS-1$
+						+ "/" + data.resourceRelativePath)); //$NON-NLS-1$
 			}
 			return ret;
 		} catch (final MalformedURLException e) {
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExportIdsHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExportIdsHandler.java
index b136e79..4e69a01 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExportIdsHandler.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExportIdsHandler.java
@@ -71,7 +71,7 @@
  * <code>AppModelId.java</code>.
  */
 public class ExportIdsHandler {
-	public static final String DEFAULT_APPMODELID_CLASSNAME = "AppModelId";
+	public static final String DEFAULT_APPMODELID_CLASSNAME = "AppModelId"; //$NON-NLS-1$
 
 	@Execute
 	public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, @Translation Messages messages, IModelResource resource, IResourcePool pool, IProject project) {
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java
index 7c6a7e5..afc4b28 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java
@@ -260,6 +260,7 @@
 			this.useFallback = useFallback;
 		}
 
+		@SuppressWarnings("resource")
 		@Override
 		public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader,
 				boolean reload) throws IllegalAccessException, InstantiationException, IOException {
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedActionPage.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedActionPage.java
index 7cd19db..a72479e 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedActionPage.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedActionPage.java
@@ -281,7 +281,7 @@
 				@Override
 				public void widgetSelected(SelectionEvent e) {
 					if (btnUseAnyway.getSelection()) {
-						setAction(NonReferencedAction.USE_ANYWAY, () -> context.set("resolvedFile", file));
+						setAction(NonReferencedAction.USE_ANYWAY, () -> context.set("resolvedFile", file)); //$NON-NLS-1$
 					}
 				}
 			});
@@ -409,6 +409,7 @@
 
 		// Get source bundle version from manifest
 		String version = null;
+		@SuppressWarnings("resource")
 		InputStream srcStream = null;
 		try {
 			Manifest manifestSource;
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceDialog.java
index 3b78579..5b9e78a 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceDialog.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceDialog.java
@@ -447,6 +447,7 @@
 
 		// Get source bundle version from manifest
 		String version = null;
+		@SuppressWarnings("resource")
 		InputStream srcStream = null;
 		try {
 			Manifest manifestSource;