Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse')
-rw-r--r--deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/Activator.java70
-rw-r--r--deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/AbstractPapyrusCompareEditor.java290
-rw-r--r--deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/EMFCompareEditor.java309
-rw-r--r--deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/listener/CloseEditorTriggerListener.java115
-rw-r--r--deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/factory/AbstractEMFCompareEditorFactory.java204
-rw-r--r--deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/handler/AbstractEMFCompareEditorHandler.java174
-rw-r--r--deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/Messages.java23
-rw-r--r--deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/messages.properties4
-rw-r--r--deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/modelresource/EMFCompareEditorModel.java108
-rw-r--r--deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/EMFCompareUtils.java53
-rw-r--r--deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/ICompareViewerProvider.java40
-rw-r--r--deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/PapyrusModelCompareEditorInput.java178
12 files changed, 0 insertions, 1568 deletions
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/Activator.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/Activator.java
deleted file mode 100644
index 779c3fbb3c9..00000000000
--- a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/Activator.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * 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:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.common;
-
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.emf.compare.common"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /** the Papyrus log helper */
- public static LogHelper log;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- log = new LogHelper(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/AbstractPapyrusCompareEditor.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/AbstractPapyrusCompareEditor.java
deleted file mode 100644
index c6a4b893771..00000000000
--- a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/AbstractPapyrusCompareEditor.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * 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:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.common.editor;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-
-import org.eclipse.compare.internal.CompareEditor;
-import org.eclipse.core.commands.operations.IOperationHistory;
-import org.eclipse.core.commands.operations.IOperationHistoryListener;
-import org.eclipse.core.commands.operations.OperationHistoryEvent;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.compare.EMFCompareException;
-import org.eclipse.emf.compare.diff.metamodel.ComparisonResourceSnapshot;
-import org.eclipse.emf.compare.diff.metamodel.ComparisonSnapshot;
-import org.eclipse.emf.compare.diff.metamodel.DiffFactory;
-import org.eclipse.emf.compare.diff.metamodel.DiffModel;
-import org.eclipse.emf.compare.diff.service.DiffService;
-import org.eclipse.emf.compare.match.MatchOptions;
-import org.eclipse.emf.compare.match.engine.GenericMatchScopeProvider;
-import org.eclipse.emf.compare.match.metamodel.MatchModel;
-import org.eclipse.emf.compare.match.service.MatchService;
-import org.eclipse.emf.compare.ui.editor.ModelCompareEditorInput;
-import org.eclipse.emf.compare.util.EMFCompareMap;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.infra.emf.compare.common.Activator;
-import org.eclipse.papyrus.infra.emf.compare.common.utils.ICompareViewerProvider;
-import org.eclipse.papyrus.infra.emf.compare.common.utils.PapyrusModelCompareEditorInput;
-import org.eclipse.papyrus.infra.emf.compare.ui.provider.EMFCompareLabelProvider;
-import org.eclipse.papyrus.infra.emf.compare.ui.utils.ICustomizableEditor;
-import org.eclipse.papyrus.infra.emf.compare.ui.utils.LabelProviderUtil;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.PlatformUI;
-
-/**
- *
- * This abstract allows to regroup the configuration for the Papyrus nested compare editor
- * and the standalone Papyrus Compare Editor
- *
- */
-@SuppressWarnings("restriction")
-//suppress restriction for CompareEditor
-public abstract class AbstractPapyrusCompareEditor extends CompareEditor implements ICustomizableEditor {
-
-
- /**
- * The listener on the operation history to catch the Undo/Redo and update the upper viewer
- */
- private IOperationHistoryListener historyListener;
-
-
- /**
- * The label provider for this editor
- */
- private EMFCompareLabelProvider labelProvider;
-
- public AbstractPapyrusCompareEditor() {
- super();
- }
-
- protected final void addUndoRedoListeners() {
- final IOperationHistory operationHistory = getIOperationHistory();
- operationHistory.addOperationHistoryListener(getUndoRedoListener());
- }
-
- /**
- * Remove the listener on the Undo/Redo
- */
- protected void removeUndoRedoListener() {
- final IOperationHistory operationHistory = getIOperationHistory();
- operationHistory.removeOperationHistoryListener(getUndoRedoListener());
- }
-
- public EMFCompareLabelProvider getLabelProvider() {
- if(labelProvider == null) {
- labelProvider = LabelProviderUtil.createLabelProvider();
- }
- return labelProvider;
- }
-
- /**
- *
- * @param monitor
- * the monitor
- * @param left
- * the left object
- * @param right
- * the right object
- * @return
- * the options for the comparison
- */
- //TODO : i'm not sure of these options for EMF, but this method is always overriden in Papyrus
- protected Map<String, Object> getCompareOptions(final IProgressMonitor monitor, final EObject left, final EObject right) {
- final Map<String, Object> options = new EMFCompareMap<String, Object>();
- options.put(MatchOptions.OPTION_PROGRESS_MONITOR, monitor);
- options.put(MatchOptions.OPTION_MATCH_SCOPE_PROVIDER, new GenericMatchScopeProvider(left.eResource(), right.eResource()));
- options.put(MatchOptions.OPTION_IGNORE_ID, Boolean.TRUE); //TODO verify this parameter
- options.put(MatchOptions.OPTION_IGNORE_XMI_ID, Boolean.TRUE); //TODO verify this parameter
- return options;
- }
-
-
- @Override
- public void setFocus() {
- //I refresh the viewer here, because the EMF queries for name, ... are called during the creation of the editor, and
- //it is not the correct Editor which is used by these queries to get the correct label provider
- //
- refreshViewers();
- super.setFocus();
- }
-
- /**
- *
- * @param left
- * the left eobject
- * @param right
- * the rihgt eobject
- * @return
- * the ComparisinSnapshot
- */
- protected ComparisonSnapshot doContentCompare(final EObject left, final EObject right) {
- final ComparisonResourceSnapshot snapshot = DiffFactory.eINSTANCE.createComparisonResourceSnapshot();
-
- try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
-
- public void run(final IProgressMonitor monitor) throws InterruptedException {
- final Map<String, Object> options = getCompareOptions(monitor, left, right);
- final MatchModel match = doMatch(monitor, left, right, options);
- DiffModel diff = doDiff(match, options);
- snapshot.setDiff(diff);
- snapshot.setMatch(match);
- }
-
- });
-
- } catch (final InterruptedException e) {
- Activator.log.error(e);
- } catch (final EMFCompareException e) {
- Activator.log.error(e);
- } catch (final InvocationTargetException e) {
- Activator.log.error(e);
- }
-
- return snapshot;
- }
-
- /**
- *
- * @param monitor TODO
- * @param left
- * @param right
- * @param options
- * @return
- * the MatchModel for the comparison
- * @throws InterruptedException
- */
- protected MatchModel doMatch(IProgressMonitor monitor, final EObject left, final EObject right, final Map<String, Object> options) throws InterruptedException {
- return MatchService.doContentMatch(left, right, options);
- }
-
- /**
- *
- * @param match
- * @param options
- * @return
- * the DiffModel for the comparison
- */
- protected DiffModel doDiff(final MatchModel match, Map<String, Object> options) {
- return DiffService.doDiff(match);
- }
-
- /**
- *
- * @param left
- * @param right
- * @return
- */
- protected final ModelCompareEditorInput getCompareInput(final EObject left, final EObject right) {
- final ComparisonSnapshot snapshot = doContentCompare(left, right);
- return getConfiguredModelCompareEditorInput(snapshot);
- }
-
- /**
- *
- * @param snapshot
- * the ComparisonSnapshot
- * @return
- * the ModelCompareEditorInput for this snapshot
- */
- //TODO try to set this method in private
- private final ModelCompareEditorInput getConfiguredModelCompareEditorInput(final ComparisonSnapshot snapshot) {
- final ModelCompareEditorInput input = createModelCompareEditorInput(snapshot);
- configureInput((PapyrusModelCompareEditorInput)input);
- return input;
- }
-
- protected ModelCompareEditorInput createModelCompareEditorInput(final ComparisonSnapshot snapshot) {
- return new PapyrusModelCompareEditorInput(snapshot, this);
- }
-
- /**
- * This method allows to set label and image to use for this input
- *
- * @param input
- * the input
- */
- protected abstract void configureInput(final PapyrusModelCompareEditorInput input);
-
- /**
- *
- */
- protected void addListeners() {
-
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.emf.compare.ui.utils.ICustomizableEditor#refreshViewers()
- *
- */
- public void refreshViewers() {
- final IEditorInput input = this.getEditorInput();
- if(input instanceof ICompareViewerProvider) {
- final Viewer contentViewer = ((ICompareViewerProvider)input).getContentMergeViewer();
- final Viewer structureViewer = ((ICompareViewerProvider)input).getStructureMergeViewer();
- if(contentViewer != null) {
- contentViewer.refresh();
- }
- if(structureViewer != null) {
- structureViewer.refresh();
- }
- }
- }
-
- protected IOperationHistoryListener getUndoRedoListener() {
- if(this.historyListener == null) {
- this.historyListener = new IOperationHistoryListener() {
-
- /** the last catched event */
- private OperationHistoryEvent lastEvent = null;
-
- /**
- *
- * @see org.eclipse.core.commands.operations.IOperationHistoryListener#historyNotification(org.eclipse.core.commands.operations.OperationHistoryEvent)
- *
- * @param event
- */
- public void historyNotification(final OperationHistoryEvent event) {
- int eventType = event.getEventType();
- if(eventType == OperationHistoryEvent.UNDONE || eventType == OperationHistoryEvent.REDONE) {
- if(this.lastEvent != event) {
- this.lastEvent = event;
- if(!event.getOperation().getLabel().equals("Create CompareEditor")) {//TODO improve it!
- resetInput();
- }
- }
- }
- //after each action, the status could have change
- firePropertyChange(PROP_DIRTY);
- }
-
- private void resetInput() {
- AbstractPapyrusCompareEditor.this.resetInput();
- }
- };
- }
- return this.historyListener;
- }
-
- protected abstract IOperationHistory getIOperationHistory();
-
- /**
- * reset the input in the viewer
- */
- protected abstract void resetInput();
-}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/EMFCompareEditor.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/EMFCompareEditor.java
deleted file mode 100644
index 8aef8ca034e..00000000000
--- a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/EMFCompareEditor.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * 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:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.common.editor;
-
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.commands.operations.IOperationHistory;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.compare.ui.ModelCompareInput;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.papyrus.commands.NotifyingWorkspaceCommandStack;
-import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.emf.compare.common.Activator;
-import org.eclipse.papyrus.infra.emf.compare.common.editor.listener.CloseEditorTriggerListener;
-import org.eclipse.papyrus.infra.emf.compare.common.messages.Messages;
-import org.eclipse.papyrus.infra.emf.compare.common.utils.EMFCompareUtils;
-import org.eclipse.papyrus.infra.emf.compare.common.utils.PapyrusModelCompareEditorInput;
-import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IReusableEditor;
-import org.eclipse.ui.ISaveablesLifecycleListener;
-import org.eclipse.ui.ISaveablesSource;
-import org.eclipse.ui.PartInitException;
-
-/**
- *
- * This class provides an EMF-Compare Editor for Papyrus. This Editor has been created to be embedded in the Papyrus SashEditor
- *
- */
-public class EMFCompareEditor extends AbstractPapyrusCompareEditor implements IReusableEditor, ISaveablesSource, IPropertyChangeListener, ISaveablesLifecycleListener {
-
- /** the service registry */
- protected ServicesRegistry servicesRegistry;
-
- private CloseEditorTriggerListener closeListener;
-
- protected PapyrusEMFCompareInstance rawModel;
-
-
- /**
- * The compare editor input
- */
- private CompareEditorInput input;//TODO move it in the supper class?
-
- private PartNameSynchronizer synchronizer;
-
- /**
- *
- * @see org.eclipse.compare.internal.CompareEditor#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- *
- * @param event
- */
- @Override
- public void propertyChange(final PropertyChangeEvent event) {
- if(event.getSource() == IAction.class && event.getProperty() == CompareEditorInput.PROP_TITLE) {
- //the CustomizationAction of the viewer sent this refresh
- setPartName(EMFCompareUtils.getCompareEditorTitle(EMFCompareEditor.this, rawModel));
- } else {
- super.propertyChange(event);
- }
- }
-
-
- /**
- * @param servicesRegistry
- * the service registry
- * @param rawModel
- * the raw model
- *
- */
- public EMFCompareEditor(final ServicesRegistry servicesRegistry, final PapyrusEMFCompareInstance rawModel) {
- this.servicesRegistry = servicesRegistry;
- this.rawModel = rawModel;
- this.synchronizer = new PartNameSynchronizer(rawModel);
- this.input = getCompareInput(rawModel.getLeft(), rawModel.getRight());
- addListeners();
- }
-
-
- protected EMFCompareEditor() {
- //FIXME, used by the compare UMl File Editor, try to merge code
- super();
- }
-
-
-
- @Override
- protected void addListeners() {
- addUndoRedoListeners();
- if(EMFCompareEditor.this.servicesRegistry != null) {//we are in papyrus
- TransactionalEditingDomain domain = null;
- try {
- domain = EMFCompareEditor.this.servicesRegistry.getService(TransactionalEditingDomain.class);
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
-
- closeListener = new CloseEditorTriggerListener(this.rawModel, this.servicesRegistry);
- domain.addResourceSetListener(closeListener);
- }
- }
-
- /**
- * Remove the listener
- */
- protected void removeListeners() {
- removeUndoRedoListener();
- //done by the CloseTriggerlistener. Here, it is too early to remove it
- // if(EMFCompareEditor.this.servicesRegistry != null) {//we are in papyrus
- // TransactionalEditingDomain domain = null;
- // try {
- // domain = EMFCompareEditor.this.servicesRegistry.getService(TransactionalEditingDomain.class);
- // } catch (ServiceException e) {
- // Activator.log.error(e);
- // }
- //
- // domain.removeResourceSetListener(closeListener);
- // }
- }
-
- protected ISashWindowsContainer getISashWindowsContainer() {
- ISashWindowsContainer container = null;
- if(EMFCompareEditor.this.servicesRegistry != null) {//we are in papyrus
- try {
- container = ServiceUtils.getInstance().getISashWindowsContainer(this.servicesRegistry);
- } catch (ServiceException e) {
- Activator.log.error("I can't get the ISashWindowsContainer to add a listener on it", e); //$NON-NLS-1$
- }
- }
- return container;
- }
-
-
-
- /**
- *
- * @see org.eclipse.ui.IEditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
- *
- * @param site
- * @param input
- * @throws PartInitException
- */
- @Override
- public void init(final IEditorSite site, final IEditorInput input) throws PartInitException {
- if(input instanceof CompareEditorInput) {
- super.init(site, input);
- } else {
- super.init(site, this.input);
- }
-
- }
-
- @Override
- public void dispose() {
- removeListeners();
- super.dispose();
- }
-
- /**
- *
- * A class taking in charge the synchronization of the partName and the right/left elements.
- * When a name change, the other is automatically updated.
- *
- * @author vincent lorenzo
- * adapted class from UmlGmfDiagramEditor
- */
- public class PartNameSynchronizer {
-
- /** the papyrus table */
- private PapyrusEMFCompareInstance compareInstance;
-
- /**
- * Listener on diagram name change.
- */
- private final Adapter tableNameListener = new Adapter() {
-
- /**
- *
- * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
- *
- * @param notification
- */
- public void notifyChanged(final Notification notification) {
- setPartName(EMFCompareUtils.getCompareEditorTitle(EMFCompareEditor.this, rawModel));
- }
-
- /**
- *
- * @see org.eclipse.emf.common.notify.Adapter#getTarget()
- *
- * @return
- */
- public Notifier getTarget() {
- return null;
- }
-
- /**
- *
- * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common.notify.Notifier)
- *
- * @param newTarget
- */
- public void setTarget(final Notifier newTarget) {
- }
-
- /**
- *
- * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object)
- *
- * @param type
- * @return
- */
- public boolean isAdapterForType(final Object type) {
- return false;
- }
-
- };
-
- /**
- *
- * Constructor.
- *
- * @param diagram
- */
- public PartNameSynchronizer(final PapyrusEMFCompareInstance compareInstance) {
- setCompare(compareInstance);
- }
-
- /**
- * Change the associated diagram.
- *
- * @param papyrusTable
- */
- public void setCompare(final PapyrusEMFCompareInstance compareInstance) {
- // Remove from old diagram, if any
- if(this.compareInstance != null) {
- compareInstance.getLeft().eAdapters().remove(this.tableNameListener);
- compareInstance.getRight().eAdapters().remove(this.tableNameListener);
- }
- // Set new table
- this.compareInstance = compareInstance;
-
- // Listen to name change
- compareInstance.getLeft().eAdapters().add(this.tableNameListener);
- compareInstance.getRight().eAdapters().add(this.tableNameListener);
-
- }
- }
-
- @Override
- protected void configureInput(final PapyrusModelCompareEditorInput input) {
- //not useful for the moment
- }
-
-
- @Override
- protected IOperationHistory getIOperationHistory() {
- return ((NotifyingWorkspaceCommandStack)getEditingDomain().getCommandStack()).getOperationHistory();
- }
-
-
- @Override
- protected void resetInput() {
- final TreeViewer viewer = ((PapyrusModelCompareEditorInput)this.input).getStructureMergeViewer();
- final PapyrusModelCompareEditorInput input = (PapyrusModelCompareEditorInput)getCompareInput(rawModel.getLeft(), rawModel.getRight());
- final ModelCompareInput input2 = input.getpreparedModelCompareInput();
- viewer.setInput(input2);
- }
-
-
- public EditingDomain getEditingDomain() {
- return (EditingDomain)getAdapter(TransactionalEditingDomain.class);
- }
-
- @Override
- public Object getAdapter(Class adapter) {
- if(adapter.equals(TransactionalEditingDomain.class)) {
- TransactionalEditingDomain domain = null;
- try {
- domain = servicesRegistry.getService(adapter);
- } catch (ServiceException e) {
- Activator.log.error(Messages.EMFCompareEditor_EditingDomainNotFound, e);
- }
- return domain;
- }
- return super.getAdapter(adapter);
- }
-}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/listener/CloseEditorTriggerListener.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/listener/CloseEditorTriggerListener.java
deleted file mode 100644
index 2531ee4e670..00000000000
--- a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/listener/CloseEditorTriggerListener.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * 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:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.common.editor.listener;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.RemoveCommand;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.TriggerListener;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
-import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.emf.compare.common.Activator;
-import org.eclipse.papyrus.infra.emf.compare.common.messages.Messages;
-
-/**
- *
- * This class listen the close of the nested Compare Editor.
- * When it is closed,
- * - it removed it from the model (notation and di files are concerned)
- * - it remove itself from the list of listener on the editing domain
- *
- */
-public class CloseEditorTriggerListener extends TriggerListener {
-
- /**
- * The listened model of the editor
- */
- private final EObject rawModel;
-
- /** the service registry */
- private final ServicesRegistry registry;
-
- /**
- *
- * Constructor.
- *
- * @param rawModel
- * the model for the editor to listen
- * @param registry
- * the service registry
- */
- public CloseEditorTriggerListener(final EObject rawModel, final ServicesRegistry registry) {
- this.rawModel = rawModel;
- this.registry = registry;
- }
-
- /**
- *
- * @see org.eclipse.emf.transaction.TriggerListener#trigger(org.eclipse.emf.transaction.TransactionalEditingDomain,
- * org.eclipse.emf.common.notify.Notification)
- *
- * @param domain
- * @param notification
- * @return
- */
- @Override
- protected Command trigger(final TransactionalEditingDomain domain, final Notification notification) {
- final Object notifier = notification.getNotifier();
- IPageMngr mngr = null;
- try {
- mngr = ServiceUtils.getInstance().getIPageMngr(registry);
- } catch (ServiceException e) {
- Activator.log.error(Messages.CloseEditorTriggerListener_ICantFoundTheIPageManager, e);
- }
-
- final IPageMngr mngr2 = mngr;
- if(notifier instanceof PageRef) {
- final PageRef ref = (PageRef)notifier;
- final EObject pageId = ref.getEmfPageIdentifier();
- if(pageId == rawModel) {
- final CompoundCommand command = new CompoundCommand();
- final Command sashRemoveComd = new RecordingCommand(domain) {
-
- @Override
- protected void doExecute() {
- mngr2.removePage(rawModel);
- }
- };
- EList<EObject> tabls = rawModel.eResource().getContents();
- command.append(sashRemoveComd);
- command.append(new RemoveCommand(domain, tabls, rawModel));
- final Command removeListener = new RecordingCommand(domain) {
-
- @Override
- protected void doExecute() {
- //we remove this listener from the editingdomain
- //it can't be done in the class which set it, because it would be removed too early
- domain.removeResourceSetListener(CloseEditorTriggerListener.this);
- }
- };
- command.append(removeListener);
- return command;
- }
- }
- return null;
- }
-}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/factory/AbstractEMFCompareEditorFactory.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/factory/AbstractEMFCompareEditorFactory.java
deleted file mode 100644
index 94077194016..00000000000
--- a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/factory/AbstractEMFCompareEditorFactory.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * 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:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.common.factory;
-
-import java.lang.reflect.Constructor;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.extension.diagrameditor.AbstractEditorFactory;
-import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.emf.compare.common.Activator;
-import org.eclipse.papyrus.infra.emf.compare.common.utils.EMFCompareUtils;
-import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.EditorActionBarContributor;
-
-public abstract class AbstractEMFCompareEditorFactory extends AbstractEditorFactory {
-
- /**
- *
- * Constructor.
- *
- * @param editorClass
- * the editor class
- * @param editorType
- * the type of editor
- */
- public AbstractEMFCompareEditorFactory(final Class<?> editorClass, final String type) {
- super(editorClass, type);
- }
-
- /**
- * Create the IPageModel that is used by the SashWindows to manage the editor.
- *
- * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object)
- *
- * @param pageIdentifier
- * The model pushed in the sashmodel by the creation command
- * @return A model implementing the IPageModel
- */
- public IPageModel createIPageModel(Object pageIdentifier) {
- return new CompareEditorModel(pageIdentifier, getServiceRegistry());
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object)
- *
- * @param pageIdentifier
- * @return
- */
- public boolean isPageModelFactoryFor(Object pageIdentifier) {
- if(pageIdentifier instanceof PapyrusEMFCompareInstance) {
- return ((PapyrusEMFCompareInstance)pageIdentifier).getType().equals(this.getExpectedType());
- }
- return false;
- }
-
- /**
- * IEditorModel used internally by the SashContainer. This model know how to handle IEditor creation.
- *
- *
- *
- */
- private class CompareEditorModel implements IEditorModel {
-
-
- /**
- * The servicesRegistry provided at creation.
- */
- private ServicesRegistry servicesRegistry;
-
- /**
- * The created editor.
- */
- private IEditorPart editor;
-
- /**
- * The raw model stored in the SashProvider.
- */
- private PapyrusEMFCompareInstance rawModel;
-
- /**
- *
- * Constructor.
- */
- public CompareEditorModel(Object pageIdentifier, ServicesRegistry servicesRegistry) {
- rawModel = (PapyrusEMFCompareInstance)pageIdentifier;
- this.servicesRegistry = servicesRegistry;
- }
-
- /**
- * Create the IEditor for the diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#createIEditorPart()
- * @return
- * @throws PartInitException
- *
- */
- public IEditorPart createIEditorPart() throws PartInitException {
- try {
- Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, PapyrusEMFCompareInstance.class);
- editor = (IEditorPart)c.newInstance(servicesRegistry, rawModel);
- return editor;
-
- } catch (Exception e) {
- // Lets propagate. This is an implementation problem that should be solved by
- // programmer.
- throw new PartInitException("Can't create CompareEditor", e); //$NON-NLS-1$
- }
-
- }
-
- /**
- * Get the action bar requested by the Editor.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#getActionBarContributor()
- * @return
- *
- */
- public EditorActionBarContributor getActionBarContributor() {
-
- String actionBarId = editorDescriptor.getActionBarContributorId();
-
- // Do nothing if no EditorActionBarContributor is specify.
- if(actionBarId == null || actionBarId.length() == 0) {
- return null;
- }
-
- // Try to get it.
-
- // Get ServiceRegistry
- // ServicesRegistry serviceRegistry = getServicesRegistry();
- ActionBarContributorRegistry registry;
- try {
- registry = servicesRegistry.getService(ActionBarContributorRegistry.class);
- } catch (ServiceException e) {
- // Service not found
- Activator.log.error(e);
- return null;
- }
-
- try {
- return registry.getActionBarContributor(actionBarId);
- } catch (BackboneException e) {
- Activator.log.error(e);
- return null;
- }
- }
-
- /**
- * Get the underlying RawModel. Return the Diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getRawModel()
- * @return
- *
- */
- public Object getRawModel() {
- return rawModel;
- }
-
- /**
- * Get the icon to be shown by Tabs
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabIcon()
- * @return
- *
- */
- public Image getTabIcon() {
- ImageDescriptor imageDescriptor = getEditorDescriptor().getIcon();
- if(imageDescriptor == null) {
- return null;
- }
- return imageDescriptor.createImage();
- }
-
- /**
- * Get the title of the Diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabTitle()
- * @return
- *
- */
- public String getTabTitle() {
- return EMFCompareUtils.getCompareEditorTitle(editor, rawModel);
- }
- }
-}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/handler/AbstractEMFCompareEditorHandler.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/handler/AbstractEMFCompareEditorHandler.java
deleted file mode 100644
index c0e8c6ce386..00000000000
--- a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/handler/AbstractEMFCompareEditorHandler.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * 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:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.common.handler;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.AbstractEMFOperation;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.commands.CheckedOperationHistory;
-import org.eclipse.papyrus.infra.core.resource.NotFoundException;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
-import org.eclipse.papyrus.infra.emf.compare.common.Activator;
-import org.eclipse.papyrus.infra.emf.compare.common.modelresource.EMFCompareEditorModel;
-import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance;
-import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstanceFactory;
-import org.eclipse.ui.PlatformUI;
-
-
-public abstract class AbstractEMFCompareEditorHandler extends AbstractHandler {
-
- final private String type;
-
- public AbstractEMFCompareEditorHandler(final String type) {
- this.type = type;
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
- *
- * @return
- */
- @Override
- public boolean isEnabled() {
- return getSelection().size() == 2;
- }
-
-
- //TODO essayer de merger cet handler avec un autre fournissant une commande et la sélection!
- protected List<EObject> getSelection() {
- ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- List<EObject> currentSelection = new ArrayList<EObject>();
- Iterator<?> iter = ((IStructuredSelection)selection).iterator();
- while(iter.hasNext()) {
- Object current = iter.next();
- if(current instanceof IAdaptable) {
- EObject tmp = (EObject)((IAdaptable)current).getAdapter(EObject.class);
- if(tmp != null) {
- currentSelection.add(tmp);
- }
- }
- }
- return currentSelection;
- }
-
- /**
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- try {
-
- runAsTransaction();
- } catch (ServiceException e) {
- throw new ExecutionException("I can't create CompareEditor", e); //$NON-NLS-1$
- }
- return null;
- }
-
- /**
- * Run the command as a transaction.
- * Create a Transaction and delegate the command to {@link #doExecute(ServicesRegistry)}.
- *
- * @throws ServiceException
- *
- */
- public void runAsTransaction() throws ServiceException {
- final ServicesRegistry serviceRegistry = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry();
- TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
-
- //Create the transactional command
- AbstractEMFOperation command = new AbstractEMFOperation(domain, "Create CompareEditor") { //$NON-NLS-1$
-
- @Override
- protected IStatus doExecute(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- try {
- AbstractEMFCompareEditorHandler.this.doExecute(serviceRegistry);
- } catch (ServiceException e) {
- Activator.log.error(e);
- return Status.CANCEL_STATUS;
- } catch (NotFoundException e) {
- Activator.log.error(e);
- return Status.CANCEL_STATUS;
- }
- return Status.OK_STATUS;
- }
- };
-
- // Execute the command
- try {
- CheckedOperationHistory.getInstance().execute(command, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- Activator.log.error("I can't create CompareEditor", e); //$NON-NLS-1$
- }
-
- }
-
-
- /**
- * Do the execution of the command.
- *
- * @param serviceRegistry
- * @throws ServiceException
- * @throws NotFoundException
- */
- public void doExecute(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
- Object editorModel = createEditorModel(serviceRegistry);
- // Get the mngr allowing to add/open new editor.
- IPageMngr pageMngr = ServiceUtils.getInstance().getIPageMngr(serviceRegistry);
- // add the new editor model to the sash.
- pageMngr.openPage(editorModel);
-
- }
-
- /**
- * Create a model identifying the editor. This model will be saved with the sash
- *
- * @return
- * @throws ServiceException
- * @throws NotFoundException
- * The model where to save the TableInstance is not found.
- */
- protected Object createEditorModel(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
- PapyrusEMFCompareInstance editor = PapyrusemfcompareinstanceFactory.eINSTANCE.createPapyrusEMFCompareInstance();
- editor.setLeft(getSelection().get(0));
- editor.setRight(getSelection().get(1));
- editor.setType(this.type);
- EMFCompareEditorModel model = (EMFCompareEditorModel)ServiceUtils.getInstance().getModelSet(serviceRegistry).getModelChecked(EMFCompareEditorModel.MODEL_ID);
- model.addEMFCompareEditorInstance(editor);
- return editor;
- }
-
-}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/Messages.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/Messages.java
deleted file mode 100644
index 7e04def1dbd..00000000000
--- a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/Messages.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.papyrus.infra.emf.compare.common.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.emf.compare.common.messages.messages"; //$NON-NLS-1$
-
- public static String CloseEditorTriggerListener_ICantFoundTheIPageManager;
-
- public static String EMFCompareEditor_EditingDomainNotFound;
-
- public static String EMFCompareUtils_CompareTitle;
-
- public static String PapyrusModelCompareEditorInput_CompareTitle;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/messages.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/messages.properties
deleted file mode 100644
index ba07d46048a..00000000000
--- a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/messages.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-CloseEditorTriggerListener_ICantFoundTheIPageManager=I can't find the IPageManager
-EMFCompareEditor_EditingDomainNotFound=TransactionalEditingDomain not found
-EMFCompareUtils_CompareTitle=Compare (''{0}'' - ''{1}'')
-PapyrusModelCompareEditorInput_CompareTitle=Compare (''{0}'' - ''{1}'')
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/modelresource/EMFCompareEditorModel.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/modelresource/EMFCompareEditorModel.java
deleted file mode 100644
index 149c4dec57c..00000000000
--- a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/modelresource/EMFCompareEditorModel.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * 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:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.common.modelresource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource;
-import org.eclipse.papyrus.infra.core.resource.IModel;
-import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance;
-
-
-public class EMFCompareEditorModel extends AbstractModelWithSharedResource<PapyrusEMFCompareInstance> implements IModel {
-
- /*
- * To save in a new file :
- * the class should extends AbstractBaseModel and NOTATION_FILE_EXTENSION = "nattable" for example
- */
-
-
- /**
- * File extension used for notation.
- */
- public static final String NOTATION_FILE_EXTENSION = "notation"; //$NON-NLS-1$
-
- /**
- * Model ID.
- */
- public static final String MODEL_ID = "org.eclipse.papyrus.emf.compare.resource.EMFCompareEditorModel"; //$NON-NLS-1$
-
-
- /**
- *
- * Constructor.
- *
- */
- public EMFCompareEditorModel() {
-
- }
-
-
- /**
- * Get the file extension used for this model.
- *
- * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
- *
- * @return
- */
- @Override
- protected String getModelFileExtension() {
- return NOTATION_FILE_EXTENSION;
- }
-
- /**
- * Get the identifier used to register this model.
- *
- * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getIdentifier()
- *
- * @return
- */
- @Override
- public String getIdentifier() {
- return MODEL_ID;
- }
-
-
- /**
- * Add a new initialized {@link PapyrusEMFCompareInstance} to the model.
- *
- * @param compareInstance
- * The compareInstance to add.
- */
- public void addEMFCompareEditorInstance(PapyrusEMFCompareInstance compareInstance) {
- getResource().getContents().add(compareInstance);
- }
-
- /**
- * Add a new initialized {@link PapyrusEMFCompareInstance} to the model.
- *
- * @param compareInstance
- * The compareInstance to add.
- */
- public void removeEMFCompareEditorInstance(PapyrusEMFCompareInstance compareInstance) {
- getResource().getContents().remove(compareInstance);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource#isModelRoot(org.eclipse.emf.ecore.EObject)
- *
- * @param object
- * @return
- */
- @Override
- protected boolean isModelRoot(EObject object) {
- return false;
- }
-
-}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/EMFCompareUtils.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/EMFCompareUtils.java
deleted file mode 100644
index efdfa3d06aa..00000000000
--- a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/EMFCompareUtils.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * 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:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.common.utils;
-
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.emf.compare.common.messages.Messages;
-import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance;
-import org.eclipse.papyrus.infra.emf.compare.ui.provider.EMFCompareLabelProvider;
-import org.eclipse.papyrus.infra.emf.compare.ui.utils.ICustomizableEditor;
-import org.eclipse.ui.IEditorPart;
-
-
-
-public class EMFCompareUtils {
-
- private EMFCompareUtils() {
- //nothing to do
- }
-
-
- /**
- *
- * @param editor
- * the editor
- * @param rawModel
- * the raw model
- * @return
- * the name for the editor
- */
- public static String getCompareEditorTitle(final IEditorPart editor, final PapyrusEMFCompareInstance rawModel) {
- if(editor instanceof ICustomizableEditor) {
- EMFCompareLabelProvider labelProvider = (EMFCompareLabelProvider)((ICustomizableEditor)editor).getLabelProvider();
- String leftLabel = labelProvider.getText(rawModel.getLeft());
- String rightLabel = labelProvider.getText(rawModel.getRight());
- String title = NLS.bind(Messages.EMFCompareUtils_CompareTitle, leftLabel, rightLabel);
- return title;
- }
- return "";
-
- }
-
-}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/ICompareViewerProvider.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/ICompareViewerProvider.java
deleted file mode 100644
index ed11d80beae..00000000000
--- a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/ICompareViewerProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * 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:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.common.utils;
-
-import org.eclipse.compare.contentmergeviewer.ContentMergeViewer;
-import org.eclipse.emf.compare.ui.viewer.structure.ModelStructureMergeViewer;
-
-/**
- *
- * This interface
- *
- */
-public interface ICompareViewerProvider {
-
- /**
- *
- * @return
- * the content merge viewer for this input. The returned value can be <code>null</code> if the viewer has not been yet created
- */
- public ContentMergeViewer getContentMergeViewer();
-
- /**
- *
- * @return
- * the structure merge viewer for this input. The returned value can be <code>null</code> if the viewer has not been yet created
- */
- public ModelStructureMergeViewer getStructureMergeViewer();
-
-}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/PapyrusModelCompareEditorInput.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/PapyrusModelCompareEditorInput.java
deleted file mode 100644
index de33db83c16..00000000000
--- a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/PapyrusModelCompareEditorInput.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * 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:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.common.utils;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareViewerPane;
-import org.eclipse.compare.Splitter;
-import org.eclipse.compare.contentmergeviewer.ContentMergeViewer;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.compare.diff.metamodel.ComparisonSnapshot;
-import org.eclipse.emf.compare.ui.ModelCompareInput;
-import org.eclipse.emf.compare.ui.editor.ModelCompareEditorInput;
-import org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer;
-import org.eclipse.emf.compare.ui.viewer.structure.ModelStructureMergeViewer;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.emf.compare.common.messages.Messages;
-import org.eclipse.papyrus.infra.emf.compare.ui.content.transactional.viewer.PapyrusTransactionalModelContentMergeViewer;
-import org.eclipse.papyrus.infra.emf.compare.ui.structural.viewer.PapyrusCustomizableParameterizedStructureMergeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IEditorPart;
-
-/**
- *
- * the ModelInput for Papyrus Compare
- *
- */
-public class PapyrusModelCompareEditorInput extends ModelCompareEditorInput implements ICompareViewerProvider {
-
- /** the editor */
- protected IEditorPart editor;
-
- /**
- *
- * Constructor.
- *
- * @param snapshot
- * the snapshot
- * @param editor
- * the editor for the comparison
- * @param ancestor
- * the ancestor
- * @param left
- * the left Object to compare (used to display the name of elementthe element
- * @param right
- */
- public PapyrusModelCompareEditorInput(final ComparisonSnapshot snapshot, final IEditorPart editor) {
- super(snapshot);
- this.editor = editor;
- }
-
- /**
- * This methods allows to set the labels displayed at the top of the content merger viewers
- * These labels are used too for the title of the editor
- *
- * @param leftLabel
- * the left label
- * @param leftImage
- * the left image
- * @param rightLabel
- * the right label
- * @param rightImage
- * the right image
- */
- public void initLabels(final String leftLabel, final Image leftImage, final String rightLabel, final Image rightImage) {
- CompareConfiguration cc = getCompareConfiguration();
- cc.setLeftLabel(leftLabel);
- cc.setRightLabel(rightLabel);
- cc.setLeftImage(leftImage);
- cc.setRightImage(rightImage);
- setTitle(NLS.bind(Messages.PapyrusModelCompareEditorInput_CompareTitle, leftLabel, rightLabel));
- }
-
- /**
- *
- * @see org.eclipse.emf.compare.ui.editor.ModelCompareEditorInput#createMergeViewer(org.eclipse.compare.CompareViewerPane,
- * org.eclipse.compare.CompareConfiguration)
- *
- * @param pane
- * @param config
- * @return
- */
- @Override
- protected ModelContentMergeViewer createMergeViewer(final CompareViewerPane pane, final CompareConfiguration config) {
- return new PapyrusTransactionalModelContentMergeViewer(pane, config, editor);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see CompareEditorInput#createOutlineContents(Composite, int)
- */
- @Override
- public Control createOutlineContents(final Composite parent, final int direction) {
- final Splitter splitter = new Splitter(parent, direction);
-
- final CompareViewerPane pane = new CompareViewerPane(splitter, SWT.NONE);
-
- //structureMergeViewer = new ModelStructureMergeViewer(pane, getCompareConfiguration());
- CompareConfiguration conf = getCompareConfiguration();
- // conf.s
- structureMergeViewer = new PapyrusCustomizableParameterizedStructureMergeViewer(pane, getCompareConfiguration(), editor);
- pane.setContent(structureMergeViewer.getTree());
-
- structureMergeViewer.setInput(preparedInput);
-
- return splitter;
- }
-
- /**
- *
- * @see org.eclipse.emf.compare.ui.editor.ModelCompareEditorInput#saveChanges(org.eclipse.core.runtime.IProgressMonitor)
- *
- * @param monitor
- */
- @Override
- public void saveChanges(final IProgressMonitor monitor) {
- //normally it ok, there is nothing to do to save notation and di files
- super.saveChanges(monitor);
- }
-
- /**
- *
- * @return
- * the content merge viewer for this input. The returned value can be <code>null</code> if the viewer has not been yet created
- */
- public ContentMergeViewer getContentMergeViewer() {
- return this.contentMergeViewer;
- }
-
- /**
- *
- * @return
- * the structure merge viewer for this input. The retruned value can be <code>null</code> if the viewer has not been yet created
- */
- public ModelStructureMergeViewer getStructureMergeViewer() {
- return this.structureMergeViewer;
- }
-
- /**
- *
- * @return
- * the prepared input
- */
- public ModelCompareInput getpreparedModelCompareInput() {
- prepareInput(new NullProgressMonitor());
- return this.preparedInput;
- }
-
- /**
- *
- * @return
- * the EditingDomain for the current Editor, or <code>null</code> if not found
- */
- protected TransactionalEditingDomain getEditingDomain() {
- TransactionalEditingDomain domain = null;
- if(this.editor instanceof IAdaptable) {
- domain = (TransactionalEditingDomain)this.editor.getAdapter(TransactionalEditingDomain.class);
- }
- return domain;
- }
-}

Back to the top