RESOLVED bug - 511105: Ensure Mars compatibility & fix compilation
errors under Oxygen due to internal API usage
https://bugs.eclipse.org/bugs/show_bug.cgi?id=511105
diff --git a/plugins/org.eclipse.sphinx.emf.validation/src/org/eclipse/sphinx/emf/validation/markers/ValidationMarkerManager.java b/plugins/org.eclipse.sphinx.emf.validation/src/org/eclipse/sphinx/emf/validation/markers/ValidationMarkerManager.java
index 62f366e..28436ef 100644
--- a/plugins/org.eclipse.sphinx.emf.validation/src/org/eclipse/sphinx/emf/validation/markers/ValidationMarkerManager.java
+++ b/plugins/org.eclipse.sphinx.emf.validation/src/org/eclipse/sphinx/emf/validation/markers/ValidationMarkerManager.java
@@ -1,7 +1,7 @@
 /**

  * <copyright>

  *

- * Copyright (c) 2008-2015 See4sys, itemis and others.

+ * Copyright (c) 2008-2017 See4sys, itemis and others.

  * 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

@@ -12,6 +12,7 @@
  *     itemis - [418902] ValidationMarkerManager does not distinguish objects with identical URI

  *     itemis - [458509] NPE in ValidationMarkerManager

  *     itemis - [480135] Introduce metamodel and view content agnostic problem decorator for model elements

+ *     itemis - [511105] Ensure Mars compatibility & fix compilation errors under Oxygen due to internal API usage

  *

  * </copyright>

  */

@@ -26,15 +27,17 @@
 import java.util.Map;

 import java.util.Set;

 

-import org.eclipse.core.internal.resources.Workspace;

 import org.eclipse.core.resources.IMarker;

 import org.eclipse.core.resources.IResource;

+import org.eclipse.core.resources.IWorkspace;

+import org.eclipse.core.resources.IWorkspaceRunnable;

 import org.eclipse.core.resources.ResourcesPlugin;

 import org.eclipse.core.runtime.Assert;

 import org.eclipse.core.runtime.CoreException;

+import org.eclipse.core.runtime.IProgressMonitor;

 import org.eclipse.core.runtime.ListenerList;

+import org.eclipse.core.runtime.NullProgressMonitor;

 import org.eclipse.core.runtime.Platform;

-import org.eclipse.core.runtime.jobs.ISchedulingRule;

 import org.eclipse.emf.common.util.Diagnostic;

 import org.eclipse.emf.common.util.URI;

 import org.eclipse.emf.ecore.EObject;

@@ -385,43 +388,29 @@
 	 *            an IResource

 	 * @throws CoreException

 	 */

-	public void updateMarkersURI(IResource resource) throws CoreException {

+	public void updateMarkersURI(final IResource resource) throws CoreException {

+		Assert.isNotNull(resource);

+

 		if (resource.isAccessible()) {

 			ValidationPerformanceStats.INSTANCE.startNewEvent(ValidationPerformanceStats.ValidationEvent.EVENT_UPDATE_PROBLEM_MARKERS,

 					resource.getFullPath());

-			IMarker[] markers = resource.findMarkers(IValidationMarker.MODEL_VALIDATION_PROBLEM, true, IResource.DEPTH_INFINITE);

 

-			String workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();

+			IWorkspaceRunnable runnable = new IWorkspaceRunnable() {

+				@Override

+				public void run(IProgressMonitor monitor) throws CoreException {

+					String workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();

+					String newURIPath = resource.getLocation().toString().replace(workspacePath, "platform:/resource"); //$NON-NLS-1$

 

-			String currentUri = null;

-			String fragment = null;

-

-			String newURIPath = resource.getLocation().toString().replace(workspacePath, "platform:/resource"); //$NON-NLS-1$

-

-			// final ISchedulingRule rule = workspace.getRuleFactory().markerRule(resource);

-			final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(resource);

-

-			Workspace workspace = (Workspace) resource.getWorkspace();

-			try {

-				workspace.prepareOperation(rule, null);

-				// ResourceInfo info = workspace.getResourceInfo(resource.getFullPath(), false, false);

-				workspace.beginOperation(true);

-

-				for (IMarker marker : markers) {

-					currentUri = marker.getAttribute(EValidator.URI_ATTRIBUTE, "#"); //$NON-NLS-1$

-					fragment = currentUri.substring(currentUri.lastIndexOf("#")); //$NON-NLS-1$

-					marker.setAttribute(EValidator.URI_ATTRIBUTE, newURIPath + fragment);

+					IMarker[] markers = resource.findMarkers(IValidationMarker.MODEL_VALIDATION_PROBLEM, true, IResource.DEPTH_INFINITE);

+					for (IMarker marker : markers) {

+						String currentUri = marker.getAttribute(EValidator.URI_ATTRIBUTE, "#"); //$NON-NLS-1$

+						String fragment = currentUri.substring(currentUri.lastIndexOf("#")); //$NON-NLS-1$

+						marker.setAttribute(EValidator.URI_ATTRIBUTE, newURIPath + fragment);

+					}

 				}

-			} catch (CoreException ex) {

-				PlatformLogUtil.logAsWarning(Activator.getDefault(),

-						NLS.bind(Messages.warningProblemWithMarkerOperationOnResource, resource.getLocationURI().toString()));

-			} finally {

-				try {

-					workspace.endOperation(rule, false, null);

-				} catch (CoreException ex) {

-					PlatformLogUtil.logAsWarning(Activator.getDefault(), Messages.warningProblemWithWorkspaceOperation);

-				}

-			}

+			};

+			ResourcesPlugin.getWorkspace().run(runnable, resource, IWorkspace.AVOID_UPDATE, new NullProgressMonitor());

+

 			ValidationPerformanceStats.INSTANCE.endEvent(ValidationPerformanceStats.ValidationEvent.EVENT_UPDATE_PROBLEM_MARKERS,

 					resource.getFullPath());

 		}

diff --git a/plugins/org.eclipse.sphinx.emf.validation/src/org/eclipse/sphinx/emf/validation/util/Messages.java b/plugins/org.eclipse.sphinx.emf.validation/src/org/eclipse/sphinx/emf/validation/util/Messages.java
index dedcaf9..88b49ce 100644
--- a/plugins/org.eclipse.sphinx.emf.validation/src/org/eclipse/sphinx/emf/validation/util/Messages.java
+++ b/plugins/org.eclipse.sphinx.emf.validation/src/org/eclipse/sphinx/emf/validation/util/Messages.java
@@ -1,15 +1,16 @@
 /**

  * <copyright>

- * 

- * Copyright (c) 2008-2010 See4sys and others.

+ *

+ * Copyright (c) 2008-2017 See4sys, itemis and others.

  * 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: 

+ *

+ * Contributors:

  *     See4sys - Initial API and implementation

- * 

+ *     itemis - [511105] Ensure Mars compatibility & fix compilation errors under Oxygen due to internal API usage

+ *

  * </copyright>

  */

 package org.eclipse.sphinx.emf.validation.util;

@@ -23,7 +24,6 @@
 	public static String __EValidatorRegstering_NoSuchPackage;

 	public static String warningNoSuchMarker;

 	public static String warningProblemWithMarkerOperationOnResource;

-	public static String warningProblemWithWorkspaceOperation;

 	public static String noMessageAvailableForThisMarker;

 

 	static {

diff --git a/plugins/org.eclipse.sphinx.emf.validation/src/org/eclipse/sphinx/emf/validation/util/messages.properties b/plugins/org.eclipse.sphinx.emf.validation/src/org/eclipse/sphinx/emf/validation/util/messages.properties
index f887584..b236a50 100644
--- a/plugins/org.eclipse.sphinx.emf.validation/src/org/eclipse/sphinx/emf/validation/util/messages.properties
+++ b/plugins/org.eclipse.sphinx.emf.validation/src/org/eclipse/sphinx/emf/validation/util/messages.properties
@@ -1,6 +1,23 @@
+# <copyright>

+# 

+# Copyright (c) 2008-2017 See4sys, itemis and others.

+# 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: 

+#     See4sys - Initial API and implementation

+#     itemis - [511105] Ensure Mars compatibility & fix compilation errors under Oxygen due to internal API usage

+# 

+# </copyright>

+

+# ------------------------------------------------ #

+#  Messages for org.eclipse.sphinx.emf.validation  #

+# ------------------------------------------------ #

+

 __EValidatorRegstering_NoSuchPackage =  The package with URI {0} does not exit into the EPackage registry. That means this package does not exit at all or that the connected model ({1}) is not loaded yet.

 warningNoSuchMarker = Marker with ID {0} does not exist.

 warningProblemWithMarkerOperationOnResource = a problem occurs during add/removing of markers connected with the resource {0}.

-warningProblemWithWorkspaceOperation = a problem occurs during workspace operation.

 noMessageAvailableForThisMarker = No message available

 

diff --git a/plugins/org.eclipse.sphinx.platform.ui/src/org/eclipse/sphinx/platform/ui/groups/AbstractGroup.java b/plugins/org.eclipse.sphinx.platform.ui/src/org/eclipse/sphinx/platform/ui/groups/AbstractGroup.java
index d61c13d..cfa3b9f 100644
--- a/plugins/org.eclipse.sphinx.platform.ui/src/org/eclipse/sphinx/platform/ui/groups/AbstractGroup.java
+++ b/plugins/org.eclipse.sphinx.platform.ui/src/org/eclipse/sphinx/platform/ui/groups/AbstractGroup.java
@@ -1,7 +1,7 @@
 /**

  * <copyright>

  *

- * Copyright (c) 2011-2016 See4sys, itemis and others.

+ * Copyright (c) 2011-2017 See4sys, itemis and others.

  * 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

@@ -10,6 +10,7 @@
  * Contributors:

  *     See4sys - Initial API and implementation

  *     itemis - [503063] Provide launching support for Sphinx Workflows

+ *     itemis - [511105] Ensure Mars compatibility & fix compilation errors under Oxygen due to internal API usage

  *

  * </copyright>

  */

@@ -40,7 +41,7 @@
 	 * <p>

 	 * Listeners added to this list must be instances of {@link IGroupListener}.

 	 */

-	private ListenerList<IGroupListener> groupListeners = new ListenerList<IGroupListener>();

+	private ListenerList groupListeners = new ListenerList();

 

 	/**

 	 * This construct a group with <code>groupName</code> group name.

diff --git a/plugins/org.eclipse.sphinx.platform.ui/src/org/eclipse/sphinx/platform/ui/groups/NameValueTableGroup.java b/plugins/org.eclipse.sphinx.platform.ui/src/org/eclipse/sphinx/platform/ui/groups/NameValueTableGroup.java
index 09c4b40..d299a61 100644
--- a/plugins/org.eclipse.sphinx.platform.ui/src/org/eclipse/sphinx/platform/ui/groups/NameValueTableGroup.java
+++ b/plugins/org.eclipse.sphinx.platform.ui/src/org/eclipse/sphinx/platform/ui/groups/NameValueTableGroup.java
@@ -1,7 +1,7 @@
 /**
  * <copyright>
  *
- * Copyright (c) 2016 itemis and others.
+ * Copyright (c) 2016-2017 itemis and others.
  * 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
@@ -10,6 +10,7 @@
  * Contributors:
  *     itemis - Initial API and implementation
  *     itemis - [506671] Add support for specifying and injecting user-defined arguments for workflows through workflow launch configurations
+ *     itemis - [511105] Ensure Mars compatibility & fix compilation errors under Oxygen due to internal API usage
  *
  * </copyright>
  */
@@ -295,7 +296,7 @@
 		valueColumn.setEditingSupport(new ValueEditingSupport(nameValueViewer));
 
 		// Create table column layout
-		TableColumnLayout tableColumnLayout = new TableColumnLayout(true);
+		TableColumnLayout tableColumnLayout = new TableColumnLayout();
 		PixelConverter pixelConverter = new PixelConverter(parent.getFont());
 		tableColumnLayout.setColumnData(nameColumn.getColumn(), new ColumnWeightData(1, pixelConverter.convertWidthInCharsToPixels(20)));
 		tableColumnLayout.setColumnData(valueColumn.getColumn(), new ColumnWeightData(2, pixelConverter.convertWidthInCharsToPixels(20)));
diff --git a/tools/org.eclipse.sphinx.targets/mars/mars.target b/tools/org.eclipse.sphinx.targets/mars/mars.target
new file mode 100644
index 0000000..0244943
--- /dev/null
+++ b/tools/org.eclipse.sphinx.targets/mars/mars.target
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>

+<?pde version="3.8"?><target name="Sphinx Neon Target" sequenceNumber="25">

+<locations>

+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">

+<unit id="org.eclipse.sdk.ide" version="4.5.2.M20160212-1500"/>

+<unit id="org.eclipse.rcp.configuration.feature.group" version="1.0.102.v20160212-1500"/>

+<unit id="org.eclipse.equinox.executable.feature.group" version="3.6.200.v20150602-1417"/>

+<repository location="http://download.eclipse.org/eclipse/updates/4.5"/>

+</location>

+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">

+<unit id="org.eclipse.viatra.query.runtime.feature.feature.group" version="1.5.0.201612211702"/>

+<repository location="http://download.eclipse.org/viatra/updates/release"/>

+</location>

+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">

+<unit id="org.eclipse.nebula.feature.feature.group" version="0.0.0"/>

+<unit id="org.eclipse.nebula.examples.release.feature.feature.group" version="0.0.0"/>

+<repository location="http://download.eclipse.org/technology/nebula/snapshot"/>

+</location>

+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">

+<unit id="com.google.guava" version="15.0.0.v201403281430"/>

+<unit id="javax.xml" version="1.3.4.v201005080400"/>

+<unit id="org.apache.commons.cli" version="1.2.0.v201404270220"/>

+<unit id="org.apache.xerces" version="2.9.0.v201101211617"/>

+<unit id="org.apache.xml.resolver" version="1.2.0.v201005080400"/>

+<unit id="org.apache.xml.serializer" version="2.7.1.v201005080400"/>

+<unit id="org.easymock" version="2.4.0.v20090202-0900"/>

+<unit id="org.jdom" version="1.1.1.v201101151400"/>

+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20160520211859/repository"/>

+</location>

+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">

+<unit id="org.eclipse.license.feature.group" version="0.0.0"/>

+<repository location="http://download.eclipse.org/cbi/updates/license"/>

+</location>

+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">

+<unit id="org.eclipse.emf.compare.ide.ui.feature.group" version="3.1.1.201509120604"/>

+<unit id="org.eclipse.gmf.runtime.sdk.feature.group" version="1.9.0.201506060219"/>

+<unit id="org.eclipse.emf.ecore.xcore.lib.feature.group" version="1.2.100.v20160209-0349"/>

+<unit id="org.eclipse.wst.xml_ui.feature.feature.group" version="3.7.2.v201511240257"/>

+<unit id="org.eclipse.xpand.sdk.feature.group" version="2.1.0.v201505260349"/>

+<unit id="org.eclipse.mylyn.wikitext_feature.feature.group" version="2.7.0.v20151015-1452"/>

+<unit id="org.eclipse.emf.transaction.sdk.feature.group" version="1.9.0.201506010221"/>

+<unit id="org.eclipse.emf.validation.sdk.feature.group" version="1.9.0.201505312255"/>

+<unit id="org.eclipse.gmf.tooling.feature.group" version="3.3.1.201509020853"/>

+<unit id="org.eclipse.emf.sdk.feature.group" version="2.11.2.v20160208-0841"/>

+<unit id="org.eclipse.emf.mwe.sdk.feature.group" version="1.3.13.v201512160556"/>

+<unit id="org.eclipse.xtext.sdk.feature.group" version="2.9.1.v201512180746"/>

+<unit id="org.eclipse.xsd.sdk.feature.group" version="2.11.0.v20160208-0841"/>

+<unit id="org.eclipse.gmf.runtime.notation.sdk.feature.group" version="1.9.0.201505312221"/>

+<unit id="org.eclipse.uml2.sdk.feature.group" version="5.1.2.v20160201-0816"/>

+<repository location="http://download.eclipse.org/releases/mars"/>

+</location>

+</locations>

+<environment>

+<nl>en_EN</nl>

+</environment>

+<launcherArgs>

+<vmArgs>-Xms128m -Xmx512m</vmArgs>

+</launcherArgs>

+</target>