Bug 544155: [History Editor] Add option to remember answer to "add to history" prompt

Add information to the dialog about what package(s) will be added
to the history, and include a "Remember my decision" option.
Add a preference page to clear "Remember my decision" dialog answers.

Change-Id: I63ba794d7b14959819a63881690e1035733e8269
Signed-off-by: Christian W. Damus <give.a.damus@gmail.com>
diff --git a/plugins/org.eclipse.emf.edapt.history.editor/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.edapt.history.editor/META-INF/MANIFEST.MF
index c95e24d..2e7286d 100644
--- a/plugins/org.eclipse.emf.edapt.history.editor/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.edapt.history.editor/META-INF/MANIFEST.MF
@@ -9,6 +9,7 @@
 Bundle-Localization: plugin

 Bundle-RequiredExecutionEnvironment: JavaSE-1.6

 Export-Package: org.eclipse.emf.edapt.history.instantiation.ui;version="1.4.0";x-internal:=true,

+ org.eclipse.emf.edapt.history.preferences.ui;x-internal:=true,

  org.eclipse.emf.edapt.history.presentation;version="1.4.0";x-internal:=true,

  org.eclipse.emf.edapt.history.presentation.action;version="1.4.0";x-internal:=true,

  org.eclipse.emf.edapt.history.reconstruction.ui;version="1.4.0";x-internal:=true,

diff --git a/plugins/org.eclipse.emf.edapt.history.editor/plugin.xml b/plugins/org.eclipse.emf.edapt.history.editor/plugin.xml
index 27edf96..891d224 100644
--- a/plugins/org.eclipse.emf.edapt.history.editor/plugin.xml
+++ b/plugins/org.eclipse.emf.edapt.history.editor/plugin.xml
@@ -2,7 +2,7 @@
 <?eclipse version="3.0"?>
 
 <!--
-    Copyright (c) 2007, 2010 BMW Car IT, Technische Universitaet Muenchen, and others.
+    Copyright (c) 2007, 2019 BMW Car IT, Technische Universitaet Muenchen, 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
@@ -11,6 +11,7 @@
     Contributors:
         BMW Car IT - Initial API and implementation
         Technische Universitaet Muenchen - Major refactoring and extension
+        Christian W. Damus - bug 544155
  -->
 
 <plugin>
@@ -622,4 +623,20 @@
            name="Edapt">
      </category>
   </extension>
+  <extension
+        point="org.eclipse.ui.keywords">
+     <keyword
+            label="edapt history migration"
+            id="org.eclipse.emf.edapt.history"/>
+  </extension>
+  <extension
+        point="org.eclipse.ui.preferencePages">
+     <page
+           class="org.eclipse.emf.edapt.history.preferences.ui.HistoryPreferencePage"
+           id="org.eclipse.emf.edapt.preferences.history"
+           name="Edapt">
+        <keywordReference
+              id="org.eclipse.emf.edapt.history"/>
+     </page>
+  </extension>
 </plugin>
diff --git a/plugins/org.eclipse.emf.edapt.history.editor/src/org/eclipse/emf/edapt/history/preferences/ui/HistoryPreferencePage.java b/plugins/org.eclipse.emf.edapt.history.editor/src/org/eclipse/emf/edapt/history/preferences/ui/HistoryPreferencePage.java
new file mode 100644
index 0000000..2919a01
--- /dev/null
+++ b/plugins/org.eclipse.emf.edapt.history.editor/src/org/eclipse/emf/edapt/history/preferences/ui/HistoryPreferencePage.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Christian W. Damus 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:
+ * Christian W. Damus - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.emf.edapt.history.preferences.ui;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * Top-level preference page for the Edapt history management.
+ */
+public class HistoryPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+	/**
+	 * Initializes me.
+	 */
+	public HistoryPreferencePage() {
+		super();
+	}
+
+	@Override
+	public void init(IWorkbench workbench) {
+		// Nothing to initialize
+	}
+
+	@Override
+	protected Control createContents(Composite parent) {
+		final Composite result = new Composite(parent, SWT.NONE);
+		GridLayoutFactory.swtDefaults().numColumns(2).applyTo(result);
+
+		createClearDialogsPreference(result);
+
+		return result;
+	}
+
+	private void createClearDialogsPreference(Composite parent) {
+		new Label(parent, SWT.NONE).setText("Forget all decisions remembered by dialogs:"); //$NON-NLS-1$
+		final Button clearDialogs = new Button(parent, SWT.PUSH);
+		clearDialogs.setText("Clear Dialogs"); //$NON-NLS-1$
+		clearDialogs.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				final boolean delete = MessageDialog.openConfirm(getShell(), "Clear Dialogs", //$NON-NLS-1$
+					"Are you sure you want to forget all responses to dialogs via the \"Remember my decision\" option?"); //$NON-NLS-1$
+
+				if (delete) {
+					ResourcePreferences.deleteAll();
+				}
+			}
+		});
+	}
+
+}
diff --git a/plugins/org.eclipse.emf.edapt.history.editor/src/org/eclipse/emf/edapt/history/preferences/ui/PromptKind.java b/plugins/org.eclipse.emf.edapt.history.editor/src/org/eclipse/emf/edapt/history/preferences/ui/PromptKind.java
new file mode 100644
index 0000000..849b24d
--- /dev/null
+++ b/plugins/org.eclipse.emf.edapt.history.editor/src/org/eclipse/emf/edapt/history/preferences/ui/PromptKind.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Christian W. Damus 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:
+ * Christian W. Damus - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.emf.edapt.history.preferences.ui;
+
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * An enumeration of preference values for a prompting preference.
+ */
+public enum PromptKind {
+	PROMPT(MessageDialogWithToggle.PROMPT), NEVER(MessageDialogWithToggle.NEVER), ALWAYS(
+		MessageDialogWithToggle.ALWAYS);
+
+	private final String value;
+
+	private PromptKind(String value) {
+		this.value = value;
+	}
+
+	/**
+	 * Get the value of a preference {@code key} from the given {@code store}.
+	 *
+	 * @param store the preference store
+	 * @param key the preference to get
+	 * @return the preference value
+	 */
+	public static PromptKind get(IPreferenceStore store, String key) {
+		store.setDefault(key, PROMPT.value);
+
+		return getByValue(store.getString(key));
+	}
+
+	/**
+	 * Get a prompt kind by string value.
+	 *
+	 * @param value the value
+	 * @return the corresponding prompt kind, or {@link #PROMPT} if the {@code value}
+	 *         is invalid
+	 */
+	public static PromptKind getByValue(String value) {
+		PromptKind result = PROMPT;
+
+		for (final PromptKind next : values()) {
+			if (next.value.equals(value)) {
+				result = next;
+				break;
+			}
+		}
+
+		return result;
+	}
+
+	@Override
+	public String toString() {
+		return value;
+	}
+
+}
diff --git a/plugins/org.eclipse.emf.edapt.history.editor/src/org/eclipse/emf/edapt/history/preferences/ui/ResourcePreferences.java b/plugins/org.eclipse.emf.edapt.history.editor/src/org/eclipse/emf/edapt/history/preferences/ui/ResourcePreferences.java
new file mode 100644
index 0000000..93690c9
--- /dev/null
+++ b/plugins/org.eclipse.emf.edapt.history.editor/src/org/eclipse/emf/edapt/history/preferences/ui/ResourcePreferences.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Christian W. Damus 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:
+ * Christian W. Damus - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.emf.edapt.history.preferences.ui;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.ISaveContext;
+import org.eclipse.core.resources.ISaveParticipant;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edapt.history.presentation.HistoryEditorPlugin;
+import org.eclipse.emf.edapt.history.util.HistoryUtils;
+import org.eclipse.emf.edapt.internal.common.FileUtils;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.preference.IPersistentPreferenceStore;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceStore;
+
+/**
+ * Manager of preferences for resources by URI.
+ */
+public final class ResourcePreferences {
+
+	/** Location in the metadata area of the directory containing preference stores. */
+	private static final IPath STORE_LOCATION;
+
+	private static final Map<URI, IPersistentPreferenceStore> preferenceStores = new HashMap<URI, IPersistentPreferenceStore>();
+
+	static {
+		final IPath stateLocation = HistoryEditorPlugin.getPlugin().getStateLocation();
+		STORE_LOCATION = stateLocation.append("resources"); //$NON-NLS-1$
+	}
+
+	/**
+	 * Not instantiable by clients.
+	 */
+	private ResourcePreferences() {
+		super();
+	}
+
+	/**
+	 * Get the preference store for the principal resource of an editing domain.
+	 * That principal resource is the history resource, if any, otherwise the resource
+	 * that is being edited in that domain.
+	 *
+	 * @param editingDomain an editing domain
+	 * @return the preference store for its principal resource
+	 */
+	public synchronized static IPreferenceStore getPreferences(EditingDomain editingDomain) {
+		final ResourceSet rset = editingDomain.getResourceSet();
+		// Prefer the history resource, if any, else the resource being edited
+		final Resource resource = getHistoryOrMainResource(rset);
+		return getPreferences(rset.getURIConverter().normalize(resource.getURI()));
+	}
+
+	private static Resource getHistoryOrMainResource(ResourceSet rset) {
+		Resource result = HistoryUtils.getHistoryResource(rset);
+
+		if (result == null) {
+			result = rset.getResources().get(0);
+		}
+
+		return result;
+	}
+
+	/**
+	 * Get the preference store for the resource identified by the given URI.
+	 *
+	 * @param uri the reosurce URI
+	 * @return the preference store for that resource
+	 */
+	public synchronized static IPreferenceStore getPreferences(URI uri) {
+		IPreferenceStore result = preferenceStores.get(uri);
+
+		if (result == null) {
+			result = createPreferenceStore(uri);
+		}
+
+		return result;
+	}
+
+	private static IPreferenceStore createPreferenceStore(URI uri) {
+		final IPath storeLocation;
+
+		try {
+			storeLocation = STORE_LOCATION.append(URLEncoder.encode(uri.toString(), "UTF-8") + ".prefs"); //$NON-NLS-1$//$NON-NLS-2$
+		} catch (final UnsupportedEncodingException e) {
+			throw new Error("UTF-8 encoding not supported"); //$NON-NLS-1$
+		}
+
+		final File storeFile = storeLocation.toFile();
+
+		final PreferenceStore result = new PreferenceStore(storeFile.getAbsolutePath());
+
+		if (storeFile.exists()) {
+			try {
+				result.load();
+			} catch (final IOException e) {
+				HistoryEditorPlugin.INSTANCE.log(e);
+			}
+		}
+
+		try {
+			register(result, uri);
+		} catch (final CoreException e) {
+			HistoryEditorPlugin.getPlugin().getLog().log(e.getStatus());
+		}
+
+		return result;
+	}
+
+	private static void register(IPersistentPreferenceStore store, URI uri) throws CoreException {
+		if (preferenceStores.isEmpty()) {
+			// Registering the first store.
+			installWorkspaceSaveParticipant();
+		}
+
+		preferenceStores.put(uri, store);
+	}
+
+	private static void installWorkspaceSaveParticipant() throws CoreException {
+		ResourcesPlugin.getWorkspace().addSaveParticipant(
+			HistoryEditorPlugin.getPlugin().getSymbolicName(),
+			new ISaveParticipant() {
+
+				@Override
+				public void saving(ISaveContext context) throws CoreException {
+					savePreferenceStores();
+				}
+
+				@Override
+				public void prepareToSave(ISaveContext context) throws CoreException {
+					// Not interesting
+				}
+
+				@Override
+				public void doneSaving(ISaveContext context) {
+					// Not interesting
+				}
+
+				@Override
+				public void rollback(ISaveContext context) {
+					// Not interesting
+				}
+			});
+	}
+
+	private static void savePreferenceStores() throws CoreException {
+		Map<URI, IPersistentPreferenceStore> toSave;
+
+		synchronized (ResourcePreferences.class) {
+			toSave = new HashMap<URI, IPersistentPreferenceStore>(preferenceStores);
+		}
+
+		for (final Iterator<Map.Entry<URI, IPersistentPreferenceStore>> iter = toSave.entrySet().iterator(); iter
+			.hasNext();) {
+
+			if (!iter.next().getValue().needsSaving()) {
+				iter.remove();
+			}
+		}
+
+		if (!toSave.isEmpty()) {
+			final List<URI> failed = new ArrayList<URI>(toSave.size());
+			final File storeDirectory = STORE_LOCATION.toFile();
+			if (storeDirectory.exists() && !storeDirectory.isDirectory()) {
+				throw new CoreException(new Status(IStatus.ERROR, HistoryEditorPlugin.getPlugin().getSymbolicName(),
+					String.format("Cannot create preference store. Path exists but is not a directory: %s", //$NON-NLS-1$
+						STORE_LOCATION)));
+			} else if (!storeDirectory.exists()) {
+				storeDirectory.mkdirs();
+			}
+
+			for (final Map.Entry<URI, IPersistentPreferenceStore> next : toSave.entrySet()) {
+				try {
+					next.getValue().save();
+				} catch (final IOException e) {
+					HistoryEditorPlugin.INSTANCE.log(e);
+					failed.add(next.getKey());
+				}
+			}
+
+			if (!failed.isEmpty()) {
+				throw new CoreException(new Status(IStatus.ERROR, HistoryEditorPlugin.getPlugin().getSymbolicName(),
+					String.format("Failed to save resource preferences: %s.", failed))); //$NON-NLS-1$
+			}
+		}
+	}
+
+	/**
+	 * Unset all resource preferences and delete them from the workspace metadata area.
+	 */
+	static void deleteAll() {
+		synchronized (ResourcePreferences.class) {
+			preferenceStores.clear();
+		}
+
+		FileUtils.deleteContents(STORE_LOCATION.toFile());
+	}
+}
diff --git a/plugins/org.eclipse.emf.edapt.history.editor/src/org/eclipse/emf/edapt/history/recorder/ui/EcoreEditorDetector.java b/plugins/org.eclipse.emf.edapt.history.editor/src/org/eclipse/emf/edapt/history/recorder/ui/EcoreEditorDetector.java
index f7660a5..2d9303e 100644
--- a/plugins/org.eclipse.emf.edapt.history.editor/src/org/eclipse/emf/edapt/history/recorder/ui/EcoreEditorDetector.java
+++ b/plugins/org.eclipse.emf.edapt.history.editor/src/org/eclipse/emf/edapt/history/recorder/ui/EcoreEditorDetector.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2018 BMW Car IT, Technische Universitaet Muenchen, and others.
+ * Copyright (c) 2007, 2019 BMW Car IT, Technische Universitaet Muenchen, Christian W. Damus, 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
@@ -8,7 +8,7 @@
  * Contributors:
  * BMW Car IT - Initial API and implementation
  * Technische Universitaet Muenchen - Major refactoring and extension
- * Christian W. Damus - bug 529599
+ * Christian W. Damus - bugs 529599, 544155
  *******************************************************************************/
 package org.eclipse.emf.edapt.history.recorder.ui;
 
@@ -21,21 +21,30 @@
 import org.eclipse.emf.common.command.CommandStack;
 import org.eclipse.emf.common.notify.AdapterFactory;
 import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.presentation.EcoreEditor;
 import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.emf.edapt.common.ui.EcoreUIUtils;
 import org.eclipse.emf.edapt.common.ui.PartAdapter;
+import org.eclipse.emf.edapt.history.preferences.ui.PromptKind;
+import org.eclipse.emf.edapt.history.preferences.ui.ResourcePreferences;
 import org.eclipse.emf.edapt.history.presentation.HistoryEditorPlugin;
 import org.eclipse.emf.edapt.history.recorder.AddResourceCommand;
 import org.eclipse.emf.edapt.history.recorder.EditingDomainListener;
 import org.eclipse.emf.edapt.history.recorder.IResourceLoadListener;
 import org.eclipse.emf.edapt.internal.common.LoggingUtils;
+import org.eclipse.emf.edapt.internal.common.ResourceUtils;
 import org.eclipse.emf.edapt.spi.history.HistoryPackage;
+import org.eclipse.emf.edit.domain.EditingDomain;
 import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
 import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
-import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
 import org.eclipse.jface.dialogs.ProgressMonitorDialog;
 import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IEditorReference;
@@ -157,12 +166,13 @@
 	}
 
 	/** Ask the user whether a resource should be added to the history. */
-	private void addHistory(final EditingDomainListener listener,
-		Resource resource) {
-		final boolean addHistory = MessageDialog.openQuestion(Display.getDefault()
-			.getActiveShell(), "Resource loaded", //$NON-NLS-1$
-			"A resource has been loaded. " //$NON-NLS-1$
-				+ "Do you want to add it to the history?"); //$NON-NLS-1$
+	private void addHistory(final EditingDomainListener listener, Resource resource) {
+		final List<EPackage> rootPackages = ResourceUtils.getRootElements(resource, EPackage.class);
+		if (rootPackages.isEmpty()) {
+			return; // Nothing to worry about
+		}
+
+		final boolean addHistory = shouldAddHistory(listener, resource, rootPackages);
 		if (addHistory) {
 			final CommandStack commandStack = listener.getEditingDomain()
 				.getCommandStack();
@@ -171,6 +181,77 @@
 	}
 
 	/**
+	 * Query whether we should add the given packages for a {@code resource} to the history, prompting the user
+	 * if necessary.
+	 *
+	 * @param listener the editing-domain listener in the context of a history
+	 * @param resource a resource that was loaded in the editing domain and contains Ecore packages
+	 * @param rootPackages the Ecore packages contained by the {@code resource}
+	 * @return whether to add the packages to the history
+	 */
+	private boolean shouldAddHistory(final EditingDomainListener listener, Resource resource,
+		final List<EPackage> rootPackages) {
+
+		final EditingDomain domain = listener.getEditingDomain();
+		final IPreferenceStore store = ResourcePreferences.getPreferences(domain);
+		final String resourceKey = "ignore." //$NON-NLS-1$
+			+ domain.getResourceSet().getURIConverter().normalize(resource.getURI()).toString();
+		store.setDefault(resourceKey, MessageDialogWithToggle.PROMPT);
+
+		final boolean result;
+		final PromptKind ignore = PromptKind.get(store, resourceKey);
+		switch (ignore) {
+		case ALWAYS:
+			// Don't need to prompt: user previously answered yes
+			result = true;
+			break;
+		case NEVER:
+			// Don't need to prompt: user previously answered no
+			result = false;
+			break;
+		default: // case PROMPT:
+			// Need to prompt: haven't remembered a previous answer
+			String title;
+			String message;
+			if (rootPackages.size() == 1) {
+				title = "Add EPackage to History"; //$NON-NLS-1$
+				message = NLS.bind("An Ecore resource has been loaded. " + //$NON-NLS-1$
+					"Add the EPackage ''{0}'' to the history?", //$NON-NLS-1$
+					getNSURI(rootPackages.get(0)));
+			} else {
+				title = "Add EPackages to History"; //$NON-NLS-1$
+				final StringBuilder nsURIs = new StringBuilder();
+				final String newline = System.getProperty("line.separator"); //$NON-NLS-1$
+				for (final EPackage next : rootPackages) {
+					nsURIs.append(newline);
+					nsURIs.append("  "); //$NON-NLS-1$
+					nsURIs.append(getNSURI(next));
+				}
+				message = NLS.bind("An Ecore resource has been loaded. " + //$NON-NLS-1$
+					"Add these EPackages to the history?{0}", //$NON-NLS-1$
+					nsURIs);
+			}
+
+			final MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(
+				Display.getDefault().getActiveShell(), title, message,
+				"Remember my decision", false, store, resourceKey); //$NON-NLS-1$
+
+			result = dialog.getReturnCode() == IDialogConstants.YES_ID;
+			break;
+		}
+		return result;
+	}
+
+	private String getNSURI(EPackage ePackage) {
+		String result = ePackage.getNsURI();
+		if (result == null || result.isEmpty()) {
+			// During development, maybe it doesn't have an NS URI, yet
+			result = String.valueOf(EcoreUtil.getURI(ePackage));
+		}
+		return result;
+	}
+
+	/**
 	 * Hack the adapter factory of an Ecore editor so that it uses the adapter
 	 * factory registry instead of the reflective adapter factory.
 	 */
diff --git a/tests/org.eclipse.emf.edapt.rcptt/general/Multiple ecores.test b/tests/org.eclipse.emf.edapt.rcptt/general/Multiple ecores.test
index da4c95a..4dc565f 100644
--- a/tests/org.eclipse.emf.edapt.rcptt/general/Multiple ecores.test
+++ b/tests/org.eclipse.emf.edapt.rcptt/general/Multiple ecores.test
@@ -6,8 +6,8 @@
 Element-Version: 3.0
 External-Reference: 
 Id: _ExiWUMoSEeeVv4pPxMNi2w
-Runtime-Version: 2.2.0.201706152316
-Save-Time: 11/15/17 3:43 PM
+Runtime-Version: 2.3.0.201806262310
+Save-Time: 2/6/19 9:54 AM
 Testcase-Type: ecl
 
 ------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac
@@ -28,7 +28,7 @@
     | select "platform:\\/resource\\/org.eclipse.emf.ecp.makeithappen.model\\/model\\/My.ecore/" | double-click
 with [get-view Properties | get-tree] {
     select "Ns URI" | activate-cell-edit -column 1
-    get-editbox | set-text a
+    get-editbox | set-text "http://test/a"
     apply-cell-edit
     select Name | activate-cell-edit -column 1
     get-editbox | set-text a
@@ -50,7 +50,11 @@
         get-button OK | click
     }
     get-button OK | click
-    get-window "Resource loaded" | get-button Yes | click
+    with [get-window "Add EPackage to History"] {
+        get-label "An Ecore resource.*" | get-property caption | contains "'http://test/a'" | verify-true
+        get-button "Remember my decision" | click
+        get-button Yes | click
+    }
 }
 get-view "Operation Browser - task.ecore" | click
 get-view "Operation Browser - task.ecore" | get-button Release | click
@@ -61,7 +65,8 @@
         | equals "http://eclipse/org/emf/ecp/makeithappen/model/task" | verify-true
     get-editbox -after [get-label "http://eclipse/org/emf/ecp/makeithappen/model/task"] | get-property text 
         | equals task | verify-true
-    get-label a | get-property caption | equals a | verify-true
-    get-editbox -after [get-label a] | get-property text | equals a | verify-true
+    get-label "http://test/a" | get-property caption | equals "http://test/a" | verify-true
+    get-editbox -after [get-label "http://test/a"] | get-property text | equals "a" | verify-true
 }
+
 ------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac--