Bläddra i källkod

Removed custom MergeViewer

Andreas Mülder 11 år sedan
förälder
incheckning
0c8f7ef31c

+ 2 - 14
plugins/org.yakindu.sct.compare/plugin.xml

@@ -1,19 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?eclipse version="3.4"?>
 <plugin>
-   <extension
-         point="org.eclipse.compare.contentMergeViewers">
-      <viewer
-            class="org.yakindu.sct.compare.viewer.DiagramContentMergeViewerCreator"
-            extensions="diagramcompare_match, diagramcompare_diff, sct"
-            id="org.yakindu.sct.compare.viewer"
-            label="Statechart Content Merge Viewer">
-      </viewer>
-      <contentTypeBinding
-            contentMergeViewerId="org.yakindu.sct.compare.viewer"
-            contentTypeId="org.eclipse.emf.compare.content.type">
-      </contentTypeBinding>
-   </extension>
+  
    <extension
          point="org.eclipse.core.contenttype.contentTypes">
       <file-association
@@ -23,7 +11,7 @@
    <extension
          point="org.eclipse.emf.compare.rcp.matchEngine">
       <engineFactory
-            class="org.yakindu.sct.compare.match.MatchEngine.SCTMatchEngineFactory"
+            class="org.yakindu.sct.compare.match.SCTMatchEngineFactory"
             ranking="11">
       </engineFactory>
    </extension>

+ 1 - 1
plugins/org.yakindu.sct.compare/src/org/yakindu/sct/compare/match/MatchEngine/SCTMatchEngineFactory.java

@@ -8,7 +8,7 @@
  * 	committers of YAKINDU - initial API and implementation
  * 
  */
-package org.yakindu.sct.compare.match.MatchEngine;
+package org.yakindu.sct.compare.match;
 
 import org.eclipse.emf.common.util.Monitor;
 import org.eclipse.emf.compare.Comparison;

+ 53 - 20
plugins/org.yakindu.sct.compare/src/org/yakindu/sct/compare/postprocessor/EdgeChangePostProcessor.java

@@ -25,7 +25,8 @@ import org.eclipse.emf.compare.postprocessor.IPostProcessor;
 import org.yakindu.sct.model.sgraph.SGraphPackage;
 
 /**
- * Postprocessor for adjusting dependencies between {@link EdgeChange} diffs and {@link ReferenceChange}s for incoming/outgoing transitions.
+ * Postprocessor for adjusting dependencies between {@link EdgeChange} diffs and
+ * {@link ReferenceChange}s for incoming/outgoing transitions.
  * 
  * @author thomas kutz - Initial contribution
  *
@@ -63,24 +64,30 @@ public class EdgeChangePostProcessor implements IPostProcessor {
 			if (diff instanceof EdgeChange) {
 				EdgeChange edgeChange = (EdgeChange) diff;
 				switch (edgeChange.getKind()) {
-					case ADD : 		postProcessEdgeAddition(edgeChange); break;
-					case DELETE : 	postProcessEdgeDeletion(edgeChange); break;
-					default : // do nothing
+				case ADD:
+					postProcessEdgeAddition(edgeChange);
+					break;
+				case DELETE:
+					postProcessEdgeDeletion(edgeChange);
+					break;
+				default: // do nothing
 				}
-				
+
 			}
 		}
 	}
 
-	
 	/**
 	 * In this case by default following dependencies are created:<br>
 	 * <br>
-	 * EdgeDeletion --requires-> OutgoingTransitionDeletion <-requires-- IncomingTransitionDeletion<br>
+	 * EdgeDeletion --requires-> OutgoingTransitionDeletion <-requires--
+	 * IncomingTransitionDeletion<br>
 	 * <br>
 	 * Needs to be changed into:<br>
 	 * <br>
-	 * EdgeDeletion --requires-> IncomingTransitionDeletion --requires-> OutgoingTransitionDeletion<br>
+	 * EdgeDeletion --requires-> IncomingTransitionDeletion --requires->
+	 * OutgoingTransitionDeletion<br>
+	 * 
 	 * @param edgeChange
 	 */
 	@SuppressWarnings("restriction")
@@ -89,35 +96,60 @@ public class EdgeChangePostProcessor implements IPostProcessor {
 		for (Diff requireds : edgeChange.getRequires()) {
 			if (requireds instanceof ReferenceChange) {
 				ReferenceChange requiredRefChange = (ReferenceChange) requireds;
-				// for required changes in outgoing transition refs we also need to add the corresponding change in incoming transition refs
-				if (requiredRefChange.getReference() == SGraphPackage.Literals.VERTEX__OUTGOING_TRANSITIONS && requiredRefChange.getKind() == DifferenceKind.ADD) {
-					requiredIncomingTransitionAdditions.addAll(findRequiredIncomingTransitionRefChange(requiredRefChange, DifferenceKind.ADD));
+				// for required changes in outgoing transition refs we also need
+				// to add the corresponding change in incoming transition refs
+				if (requiredRefChange.getReference() == SGraphPackage.Literals.VERTEX__OUTGOING_TRANSITIONS
+						&& requiredRefChange.getKind() == DifferenceKind.ADD) {
+					requiredIncomingTransitionAdditions
+							.addAll(findRequiredIncomingTransitionRefChange(
+									requiredRefChange, DifferenceKind.ADD));
 				}
 			}
 		}
 		edgeChange.getRequires().addAll(requiredIncomingTransitionAdditions);
 	}
 
-	private Collection<Diff> findRequiredIncomingTransitionRefChange(ReferenceChange requiredRefChange, DifferenceKind changeKind) {
+	private Collection<Diff> findRequiredIncomingTransitionRefChange(
+			ReferenceChange requiredRefChange, DifferenceKind changeKind) {
 		for (Diff requiredBy : requiredRefChange.getRequiredBy()) {
 			if (requiredBy instanceof ReferenceChange) {
 				ReferenceChange requiredByRefChange = (ReferenceChange) requiredBy;
-				if (requiredByRefChange.getReference() == SGraphPackage.Literals.VERTEX__INCOMING_TRANSITIONS && requiredByRefChange.getKind() == changeKind) {
-					return Collections.<Diff>singletonList(requiredByRefChange); // FIXME: collect all and return set? Are there cases where more than one should be returned?
+				if (requiredByRefChange.getReference() == SGraphPackage.Literals.VERTEX__INCOMING_TRANSITIONS
+						&& requiredByRefChange.getKind() == changeKind) {
+					return Collections
+							.<Diff> singletonList(requiredByRefChange); // FIXME:
+																		// collect
+																		// all
+																		// and
+																		// return
+																		// set?
+																		// Are
+																		// there
+																		// cases
+																		// where
+																		// more
+																		// than
+																		// one
+																		// should
+																		// be
+																		// returned?
 				}
 			}
 		}
 		return Collections.emptyList();
 	}
-	
+
 	/**
 	 * In this case by default following dependencies are created:<br>
 	 * <br>
-	 * EdgeDeletion <-requires-- OutgoingTransitionDeletion --requires-> IncomingTransitionDeletion<br>
+	 * EdgeDeletion <-requires-- OutgoingTransitionDeletion --requires->
+	 * IncomingTransitionDeletion<br>
 	 * <br>
 	 * Needs to be changed into:<br>
 	 * <br>
-	 * EdgeDeletion --requires-> OutgoingTransitionDeletion --requires-> IncomingTransitionDeletion<br>
+	 * EdgeDeletion --requires-> OutgoingTransitionDeletion --requires->
+	 * IncomingTransitionDeletion<br>
+	 * 
 	 * @param edgeChange
 	 */
 	@SuppressWarnings("restriction")
@@ -126,8 +158,10 @@ public class EdgeChangePostProcessor implements IPostProcessor {
 		for (Diff requireds : edgeChange.getRequiredBy()) {
 			if (requireds instanceof ReferenceChange) {
 				ReferenceChange requiredRefChange = (ReferenceChange) requireds;
-				// for required changes in outgoing transition refs we also need to add the corresponding change in incoming transition refs
-				if (requiredRefChange.getReference() == SGraphPackage.Literals.VERTEX__OUTGOING_TRANSITIONS && requiredRefChange.getKind() == DifferenceKind.DELETE) {
+				// for required changes in outgoing transition refs we also need
+				// to add the corresponding change in incoming transition refs
+				if (requiredRefChange.getReference() == SGraphPackage.Literals.VERTEX__OUTGOING_TRANSITIONS
+						&& requiredRefChange.getKind() == DifferenceKind.DELETE) {
 					requiredOutgoingTransitionDeletions.add(requiredRefChange);
 				}
 			}
@@ -135,5 +169,4 @@ public class EdgeChangePostProcessor implements IPostProcessor {
 		edgeChange.getRequires().addAll(requiredOutgoingTransitionDeletions);
 	}
 
-
 }

+ 0 - 31
plugins/org.yakindu.sct.compare/src/org/yakindu/sct/compare/viewer/DiagramContentMergeViewerCreator.java

@@ -1,31 +0,0 @@
-/**
- * Copyright (c) 2013 committers of YAKINDU 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:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.compare.viewer;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.IViewerCreator;
-import org.eclipse.emf.compare.diagram.ide.ui.internal.contentmergeviewer.diagram.DiagramContentMergeViewer;
-import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- */
-@SuppressWarnings("restriction")
-public class DiagramContentMergeViewerCreator implements IViewerCreator {
-
-	public Viewer createViewer(Composite parent, CompareConfiguration config) {
-		return new DiagramContentMergeViewer(parent, (EMFCompareConfiguration) config);
-	}
-
-}