Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbrooks2011-01-24 18:51:00 +0000
committerRyan D. Brooks2011-01-24 18:51:00 +0000
commit64491b1151e80456b5ce7e480e1c344bcbfd254d (patch)
treee9aecf0473f0ca351d57c90d008dcb4cb00b4087
parentb195106846b6e81994165ba3f4f247890d291a14 (diff)
downloadorg.eclipse.osee-64491b1151e80456b5ce7e480e1c344bcbfd254d.tar.gz
org.eclipse.osee-64491b1151e80456b5ce7e480e1c344bcbfd254d.tar.xz
org.eclipse.osee-64491b1151e80456b5ce7e480e1c344bcbfd254d.zip
bug[ats_9PZVC]: Three-way merge shows no rev tracking
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/render/RendererManagerTest.java8
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizardPage.java35
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java35
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DiffUsingRenderer.java7
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java33
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java84
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java7
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/AbstractWordCompare.java1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/ArtifactDeltaToFileConverter.java34
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WholeWordCompare.java5
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordTemplateCompare.java5
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/DiffHandler.java84
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java207
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/ThreeWayWordMergeOperation.java176
16 files changed, 301 insertions, 422 deletions
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/render/RendererManagerTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/render/RendererManagerTest.java
index a0b359e95ed..79f7c925ba2 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/render/RendererManagerTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/render/RendererManagerTest.java
@@ -22,7 +22,6 @@ import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.DEFAU
import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.DIFF;
import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.GENERALIZED_EDIT;
import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.MERGE;
-import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.MERGE_EDIT;
import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.PREVIEW;
import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.PRODUCE_ATTRIBUTE;
import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.SPECIALIZED_EDIT;
@@ -67,7 +66,7 @@ public class RendererManagerTest {
private final Class<? extends IRenderer> clazz;
private final DefaultOption defaultOption;
- public RendererManagerTest(IArtifactType artifactType, PresentationType presentationType, Class<? extends IRenderer> clazz, DefaultOption defaultOption) throws OseeCoreException {
+ public RendererManagerTest(IArtifactType artifactType, PresentationType presentationType, Class<? extends IRenderer> clazz, DefaultOption defaultOption) {
this.artifactType = artifactType;
this.presentationType = presentationType;
this.clazz = clazz;
@@ -117,7 +116,6 @@ public class RendererManagerTest {
addTest(data, SoftwareRequirement, DIFF, WordTemplateRenderer.class, Both);
addTest(data, SoftwareRequirement, PREVIEW, WordTemplateRenderer.class, Both);
addTest(data, SoftwareRequirement, MERGE, WordTemplateRenderer.class, Both);
- addTest(data, SoftwareRequirement, MERGE_EDIT, WordTemplateRenderer.class, Both);
addTest(data, SoftwareRequirement, DEFAULT_OPEN, WordTemplateRenderer.class, Off);
addTest(data, SoftwareRequirement, DEFAULT_OPEN, DefaultArtifactRenderer.class, On);
addTest(data, SoftwareRequirement, PRODUCE_ATTRIBUTE, WordTemplateRenderer.class, Both);
@@ -127,7 +125,6 @@ public class RendererManagerTest {
addTest(data, Action, DIFF, AtsWorkflowRenderer.class, Both);
addTest(data, Action, PREVIEW, AtsWorkflowRenderer.class, Both);
addTest(data, Action, MERGE, AtsWorkflowRenderer.class, Both);
- addTest(data, Action, MERGE_EDIT, AtsWorkflowRenderer.class, Both);
addTest(data, Action, DEFAULT_OPEN, AtsWorkflowRenderer.class, Off);
addTest(data, Action, DEFAULT_OPEN, AtsWorkflowRenderer.class, On);
addTest(data, Action, PRODUCE_ATTRIBUTE, DefaultArtifactRenderer.class, Both);
@@ -137,7 +134,6 @@ public class RendererManagerTest {
addTest(data, TestProcedureWML, DIFF, WholeWordRenderer.class, Both);
addTest(data, TestProcedureWML, PREVIEW, WholeWordRenderer.class, Both);
addTest(data, TestProcedureWML, MERGE, WholeWordRenderer.class, Both);
- addTest(data, TestProcedureWML, MERGE_EDIT, WholeWordRenderer.class, Both);
addTest(data, TestProcedureWML, DEFAULT_OPEN, WholeWordRenderer.class, Off);
addTest(data, TestProcedureWML, DEFAULT_OPEN, DefaultArtifactRenderer.class, On);
addTest(data, TestProcedureWML, PRODUCE_ATTRIBUTE, DefaultArtifactRenderer.class, Both);
@@ -147,7 +143,6 @@ public class RendererManagerTest {
addTest(data, GeneralDocument, DIFF, null, Both);
addTest(data, GeneralDocument, PREVIEW, NativeRenderer.class, Both);
addTest(data, GeneralDocument, MERGE, null, Both);
- addTest(data, GeneralDocument, MERGE_EDIT, null, Both);
addTest(data, GeneralDocument, DEFAULT_OPEN, NativeRenderer.class, Off);
addTest(data, GeneralDocument, DEFAULT_OPEN, DefaultArtifactRenderer.class, On);
addTest(data, GeneralDocument, PRODUCE_ATTRIBUTE, DefaultArtifactRenderer.class, Both);
@@ -157,7 +152,6 @@ public class RendererManagerTest {
addTest(data, TestInformationSheet, DIFF, WordTemplateRenderer.class, Both);
addTest(data, TestInformationSheet, PREVIEW, TisRenderer.class, Both);
addTest(data, TestInformationSheet, MERGE, WordTemplateRenderer.class, Both);
- addTest(data, TestInformationSheet, MERGE_EDIT, WordTemplateRenderer.class, Both);
addTest(data, TestInformationSheet, DEFAULT_OPEN, TisRenderer.class, Off);
addTest(data, TestInformationSheet, DEFAULT_OPEN, DefaultArtifactRenderer.class, On);
addTest(data, TestInformationSheet, PRODUCE_ATTRIBUTE, WordTemplateRenderer.class, Both);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizardPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizardPage.java
index dd20f485d1a..98e048eea90 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizardPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizardPage.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.diffWizard;
-import java.util.Date;
import java.util.logging.Level;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -90,34 +89,20 @@ public class DiffWizardPage extends WizardPage {
} else if (event.widget == destButton) {
MergeUtility.setToDest(conflict, getShell(), true);
} else if (event.widget == sourceDiffButton) {
- MergeUtility.showCompareFile(
- MergeUtility.getStartArtifact(conflict),
- conflict.getSourceArtifact(),
- "Source_Diff_For_" + conflict.getArtifact().getSafeName() + new Date().toString().replaceAll(":", ";") + ".xml");
+ MergeUtility.showCompareFile(MergeUtility.getStartArtifact(conflict), conflict.getSourceArtifact(),
+ "Source_Diff_For");
} else if (event.widget == destDiffButton) {
- MergeUtility.showCompareFile(
- MergeUtility.getStartArtifact(conflict),
- conflict.getDestArtifact(),
- "Destination_Diff_For_" + conflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
+ MergeUtility.showCompareFile(MergeUtility.getStartArtifact(conflict), conflict.getDestArtifact(),
+ "Destination_Diff_For");
} else if (event.widget == sourceDestDiffButton) {
- MergeUtility.showCompareFile(
- conflict.getSourceArtifact(),
- conflict.getDestArtifact(),
- "Source_Destination_Diff_For_" + conflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
+ MergeUtility.showCompareFile(conflict.getSourceArtifact(), conflict.getDestArtifact(),
+ "Source_Destination_Diff_For");
} else if (event.widget == sourceMergeDiffButton) {
- MergeUtility.showCompareFile(
- conflict.getSourceArtifact(),
- conflict.getArtifact(),
- "Source_Merge_Diff_For_" + conflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
+ MergeUtility.showCompareFile(conflict.getSourceArtifact(), conflict.getArtifact(),
+ "Source_Merge_Diff_For");
} else if (event.widget == destMergeDiffButton) {
- MergeUtility.showCompareFile(
- conflict.getDestArtifact(),
- conflict.getArtifact(),
- "Destination_Merge_Diff_For_" + conflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
+ MergeUtility.showCompareFile(conflict.getDestArtifact(), conflict.getArtifact(),
+ "Destination_Merge_Diff_For");
} else if (event.widget == mergeButton) {
// MergeUtility.launchMerge(conflict, getShell());
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java
index c69238aacf6..eaa9f2cf961 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.mergeWizard;
-import java.util.Date;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLevel;
@@ -93,40 +92,26 @@ public class EditWFCAttributeWizardPage extends WizardPage {
} else if (event.widget == destButton) {
MergeUtility.setToDest(conflict, getShell(), true);
} else if (event.widget == sourceDiffButton) {
- MergeUtility.showCompareFile(
- MergeUtility.getStartArtifact(conflict),
- conflict.getSourceArtifact(),
- "Source_Diff_For_" + conflict.getArtifact().getSafeName() + new Date().toString().replaceAll(":", ";") + ".xml");
+ MergeUtility.showCompareFile(MergeUtility.getStartArtifact(conflict), conflict.getSourceArtifact(),
+ "Source_Diff_For");
} else if (event.widget == destDiffButton) {
- MergeUtility.showCompareFile(
- MergeUtility.getStartArtifact(conflict),
- conflict.getDestArtifact(),
- "Destination_Diff_For_" + conflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
+ MergeUtility.showCompareFile(MergeUtility.getStartArtifact(conflict), conflict.getDestArtifact(),
+ "Destination_Diff_For");
} else if (event.widget == sourceDestDiffButton) {
- MergeUtility.showCompareFile(
- conflict.getSourceArtifact(),
- conflict.getDestArtifact(),
- "Source_Destination_Diff_For_" + conflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
+ MergeUtility.showCompareFile(conflict.getSourceArtifact(), conflict.getDestArtifact(),
+ "Source_Destination_Diff_For");
} else if (event.widget == sourceMergeDiffButton) {
if (conflict.wordMarkupPresent()) {
throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
}
- MergeUtility.showCompareFile(
- conflict.getSourceArtifact(),
- conflict.getArtifact(),
- "Source_Merge_Diff_For_" + conflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
+ MergeUtility.showCompareFile(conflict.getSourceArtifact(), conflict.getArtifact(),
+ "Source_Merge_Diff_For");
} else if (event.widget == destMergeDiffButton) {
if (conflict.wordMarkupPresent()) {
throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
}
- MergeUtility.showCompareFile(
- conflict.getDestArtifact(),
- conflict.getArtifact(),
- "Destination_Merge_Diff_For_" + conflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
+ MergeUtility.showCompareFile(conflict.getDestArtifact(), conflict.getArtifact(),
+ "Destination_Merge_Diff_For");
} else if (event.widget == mergeButton) {
MergeUtility.launchMerge(conflict, getShell());
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DiffUsingRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DiffUsingRenderer.java
index 7115d6f9742..7d08b47c51c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DiffUsingRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DiffUsingRenderer.java
@@ -26,6 +26,7 @@ import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
public final class DiffUsingRenderer extends AbstractOperation {
private final VariableMap options;
private final Collection<ArtifactDelta> artifactDeltas;
+ private String diffResultPath;
public DiffUsingRenderer(Collection<ArtifactDelta> artifactDeltas, VariableMap options) {
super(generateOperationName(artifactDeltas), SkynetGuiPlugin.PLUGIN_ID);
@@ -58,9 +59,13 @@ public final class DiffUsingRenderer extends AbstractOperation {
IRenderer renderer = RendererManager.getBestRenderer(PresentationType.DIFF, sampleArtifact, options);
IComparator comparator = renderer.getComparator();
if (artifactDeltas.size() == 1) {
- comparator.compare(monitor, PresentationType.DIFF, firstDelta);
+ diffResultPath = comparator.compare(monitor, PresentationType.DIFF, firstDelta);
} else {
comparator.compareArtifacts(monitor, PresentationType.DIFF, artifactDeltas);
}
}
+
+ public String getDiffResultPath() {
+ return diffResultPath;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java
index dee2e4091f1..1e5eb541dee 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java
@@ -37,6 +37,7 @@ public interface IRenderer {
public static final int NO_MATCH = -1;
public static final String FILE_NAME_OPTION = "filename";
+ public static final String FILE_PREFIX_OPTION = "filePrefix";
public static final String NO_DISPLAY = "noDisplay";
public static final String SKIP_DIALOGS = "skipDialogs";
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java
index 0b016ebabe1..9c407a10097 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java
@@ -19,7 +19,6 @@ public enum PresentationType {
DIFF,
PREVIEW, // open read-only using application specific editor
MERGE,
- MERGE_EDIT,
DEFAULT_OPEN, // up to the renderer to determine what is used for default
GENERAL_REQUESTED, // this is the case where default open is selected and the preference "Default Presentation opens in Artifact Editor if applicable" is true
PRODUCE_ATTRIBUTE; // used in conjunction with renderAttribute()
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java
index 8615c35a8ee..606a2e5a763 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java
@@ -217,29 +217,24 @@ public final class RendererManager {
open(Collections.singletonList(artifact), presentationType);
}
- public static String merge(Artifact baseVersion, Artifact newerVersion, VariableMap options) throws OseeStateException, OseeCoreException {
- IRenderer renderer = getBestRenderer(PresentationType.MERGE, baseVersion, options);
- IComparator comparator = renderer.getComparator();
- ArtifactDelta artifactDelta = new ArtifactDelta(baseVersion, newerVersion);
- return comparator.compare(new NullProgressMonitor(), PresentationType.MERGE, artifactDelta);
- }
-
public static String merge(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, VariableMap options) throws OseeCoreException {
- IRenderer renderer = getBestRenderer(PresentationType.MERGE_EDIT, baseVersion, options);
+ IRenderer renderer = getBestRenderer(PresentationType.MERGE, baseVersion, options);
IComparator comparator = renderer.getComparator();
- return comparator.compare(baseVersion, newerVersion, baseFile, newerFile, PresentationType.MERGE_EDIT);
+ return comparator.compare(baseVersion, newerVersion, baseFile, newerFile, PresentationType.MERGE);
}
- public static void diffInJob(ArtifactDelta artifactDelta) {
- diff(artifactDelta, null, true);
+ public static void diffInJob(ArtifactDelta artifactDelta) throws OseeCoreException {
+ diffInJob(artifactDelta, new VariableMap(IRenderer.FILE_PREFIX_OPTION, "Diff_For"));
}
public static void diffInJob(ArtifactDelta artifactDelta, VariableMap options) {
- diff(artifactDelta, options, true);
+ Operations.executeAsJob(new DiffUsingRenderer(artifactDelta, options), true);
}
- public static void diff(ArtifactDelta artifactDelta, VariableMap options) {
- diff(artifactDelta, options, false);
+ public static String diff(ArtifactDelta artifactDelta, VariableMap options) {
+ DiffUsingRenderer operation = new DiffUsingRenderer(artifactDelta, options);
+ Operations.executeWork(operation);
+ return operation.getDiffResultPath();
}
public static void diffInJob(Collection<ArtifactDelta> artifactDeltas) {
@@ -255,14 +250,4 @@ public final class RendererManager {
IOperation operation = new DiffUsingRenderer(artifactDeltas, options);
Operations.executeWork(operation);
}
-
- private static void diff(ArtifactDelta artifactDelta, VariableMap options, boolean asynchronous) {
- IOperation operation = new DiffUsingRenderer(artifactDelta, options);
-
- if (asynchronous) {
- Operations.executeAsJob(operation, true);
- } else {
- Operations.executeWork(operation);
- }
- }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java
index 632801258a9..0e8e0e074cc 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java
@@ -11,6 +11,8 @@
package org.eclipse.osee.framework.ui.skynet.render;
import java.net.URLEncoder;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Random;
@@ -24,14 +26,11 @@ import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.plugin.core.util.OseeData;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.swt.Displays;
@@ -39,10 +38,10 @@ public final class RenderingUtil {
private static final Random generator = new Random();
private static IFolder workingFolder;
- private static IFolder diffFolder;
+ private static IFolder compareFolder;
private static IFolder previewFolder;
- private static IFolder mergeEditFolder;
private static boolean arePopupsAllowed = true;
+ private static final DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");
public static void setPopupsAllowed(boolean popupsAllowed) {
arePopupsAllowed = popupsAllowed;
@@ -85,26 +84,8 @@ public final class RenderingUtil {
return arePopupsAllowed;
}
- public static Pair<Artifact, Artifact> asRenderInput(ArtifactDelta artifactDelta) {
- Artifact artFile1;
- Artifact artFile2;
-
- if (artifactDelta.getEndArtifact().getModType().isDeleted()) {
- artFile1 = artifactDelta.getStartArtifact();
- artFile2 = null;
- } else if (artifactDelta.getStartArtifact() == null) {
- artFile1 = null;
- artFile2 = artifactDelta.getEndArtifact();
- } else {
- artFile1 = artifactDelta.getStartArtifact();
- artFile2 = artifactDelta.getEndArtifact();
- }
- return new Pair<Artifact, Artifact>(artFile1, artFile2);
- }
-
public static IFile getRenderFile(FileSystemRenderer renderer, List<Artifact> artifacts, IOseeBranch branch, PresentationType presentationType) throws OseeCoreException {
- Artifact aritfact = artifacts.isEmpty() ? null : artifacts.get(0);
- String fileName = getFilenameFromArtifact(renderer, aritfact, presentationType);
+ String fileName = getFilenameFromArtifact(renderer, artifacts, presentationType);
return getRenderFile(fileName, branch, presentationType);
}
@@ -117,36 +98,36 @@ public final class RenderingUtil {
return getRenderFile(fileName, branch, presentationType).getLocation().toOSString();
}
- public static String getFilenameFromArtifact(FileSystemRenderer renderer, Artifact artifact, PresentationType presentationType) throws OseeCoreException {
+ public static String getFilenameFromArtifact(FileSystemRenderer renderer, List<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException {
String fileName = renderer.getStringOption(IRenderer.FILE_NAME_OPTION);
+ String prefix = renderer.getStringOption(IRenderer.FILE_PREFIX_OPTION);
if (Strings.isValid(fileName)) {
- // return fileName;
+ return fileName;
}
- StringBuilder name = new StringBuilder(100);
+ StringBuilder name = new StringBuilder(128);
+ if (Strings.isValid(prefix)) {
+ name.append(prefix);
+ name.append("_");
+ }
- if (artifact != null) {
- name.append(artifact.getSafeName());
- name.append("(");
- name.append(artifact.getGuid());
- name.append(")");
+ Artifact artifact = artifacts.iterator().next();
+ name.append(artifact.getSafeName());
- if (artifact.isHistorical() || presentationType == PresentationType.DIFF) {
- name.append("(");
- name.append(artifact.getTransactionNumber());
- name.append(")");
- }
-
- name.append(" ");
- name.append(new Date().toString().replaceAll(":", ";"));
- name.append("-");
- name.append(generator.nextInt(99) + 1);
- name.append(".");
- name.append(renderer.getAssociatedExtension(artifact));
- } else {
- name.append(GUID.create());
- name.append(".xml");
+ if (artifact.isHistorical() || presentationType == PresentationType.DIFF) {
+ name.append("_");
+ name.append(artifact.getTransactionNumber());
+ }
+ if (artifacts.size() > 1) {
+ name.append("_multi");
}
+
+ name.append("_");
+ name.append(dateFormat.format(new Date()));
+ name.append("-");
+ name.append(generator.nextInt(99) + 1);
+ name.append(".");
+ name.append(renderer.getAssociatedExtension(artifact));
return name.toString();
}
@@ -181,9 +162,10 @@ public final class RenderingUtil {
public static IFolder ensureRenderFolderExists(PresentationType presentationType) throws OseeCoreException {
IFolder toReturn = null;
switch (presentationType) {
+ case MERGE:
case DIFF:
- diffFolder = getOrCreateFolder(diffFolder, ".diff");
- toReturn = diffFolder;
+ compareFolder = getOrCreateFolder(compareFolder, ".compare");
+ toReturn = compareFolder;
break;
case SPECIALIZED_EDIT:
workingFolder = getOrCreateFolder(workingFolder, ".working");
@@ -193,10 +175,6 @@ public final class RenderingUtil {
previewFolder = getOrCreateFolder(previewFolder, ".preview");
toReturn = previewFolder;
break;
- case MERGE_EDIT:
- mergeEditFolder = getOrCreateFolder(mergeEditFolder, ".mergeEdit");
- toReturn = mergeEditFolder;
- break;
default:
throw new OseeArgumentException("Unexpected presentation type: %s", presentationType);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
index 7559cf38fc8..9ea00fa29af 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
@@ -170,7 +170,7 @@ public class WordTemplateRenderer extends WordRenderer implements ITemplateRende
data = WordUtil.reassignBookMarkID(data);
}
- if (presentationType == PresentationType.SPECIALIZED_EDIT || presentationType == PresentationType.MERGE_EDIT) {
+ if (presentationType == PresentationType.SPECIALIZED_EDIT) {
OseeLinkBuilder linkBuilder = new OseeLinkBuilder();
wordMl.addEditParagraphNoEscape(linkBuilder.getStartEditImage(artifact.getGuid()));
wordMl.addWordMl(data);
@@ -179,10 +179,7 @@ public class WordTemplateRenderer extends WordRenderer implements ITemplateRende
} else {
wordMl.addWordMl(data);
}
- if (presentationType != PresentationType.MERGE && presentationType != PresentationType.MERGE_EDIT) {
- wordMl.resetListValue();
- }
-
+ wordMl.resetListValue();
} else {
super.renderAttribute(attributeType, artifact, PresentationType.SPECIALIZED_EDIT, wordMl, map,
attributeElement);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/AbstractWordCompare.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/AbstractWordCompare.java
index bc0e18d4464..d10740bc42b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/AbstractWordCompare.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/AbstractWordCompare.java
@@ -51,7 +51,6 @@ public abstract class AbstractWordCompare implements IComparator {
return renderer;
}
- protected abstract PresentationType getMergePresentationType();
@Override
public String compare(IProgressMonitor monitor, PresentationType presentationType, ArtifactDelta artifactDelta) throws OseeCoreException {
boolean show = !getRenderer().getBooleanOption(IRenderer.NO_DISPLAY);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/ArtifactDeltaToFileConverter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/ArtifactDeltaToFileConverter.java
index 8d9e4858e51..fa7cc9f13ff 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/ArtifactDeltaToFileConverter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/ArtifactDeltaToFileConverter.java
@@ -18,7 +18,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
import org.eclipse.osee.framework.ui.skynet.render.FileSystemRenderer;
import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RenderingUtil;
public class ArtifactDeltaToFileConverter {
private final FileSystemRenderer renderer;
@@ -32,33 +31,14 @@ public class ArtifactDeltaToFileConverter {
}
public Pair<IFile, IFile> convertToFile(PresentationType presentationType, ArtifactDelta artifactDelta) throws OseeCoreException {
- Pair<IFile, IFile> toReturn;
- if (presentationType == PresentationType.MERGE || presentationType == PresentationType.MERGE_EDIT) {
- Branch branch = artifactDelta.getBranch();
- IFile baseFile = renderForMerge(renderer, artifactDelta.getStartArtifact(), branch, presentationType);
- IFile newerFile = renderForMerge(renderer, artifactDelta.getEndArtifact(), branch, presentationType);
- toReturn = new Pair<IFile, IFile>(baseFile, newerFile);
- } else {
- toReturn = asFiles(renderer, presentationType, artifactDelta);
+ Artifact baseArtifact = artifactDelta.getStartArtifact();
+ Artifact newerArtifact = artifactDelta.getEndArtifact();
+ if (newerArtifact.getModType().isDeleted()) {
+ newerArtifact = null;
}
- return toReturn;
- }
-
- private IFile renderForMerge(FileSystemRenderer renderer, Artifact artifact, Branch branch, PresentationType presentationType) throws OseeCoreException {
- if (artifact == null) {
- throw new IllegalArgumentException("Artifact can not be null.");
- }
- if (presentationType != PresentationType.MERGE_EDIT) {
- presentationType = PresentationType.DIFF;
- }
- return renderer.renderToFile(artifact, artifact.getBranch(), presentationType);
- }
-
- private Pair<IFile, IFile> asFiles(FileSystemRenderer renderer, PresentationType presentationType, ArtifactDelta artifactDelta) throws OseeCoreException {
- Pair<Artifact, Artifact> renderInput = RenderingUtil.asRenderInput(artifactDelta);
Branch branch = artifactDelta.getBranch();
- IFile baseFile = renderer.renderToFile(renderInput.getFirst(), branch, presentationType);
- IFile newerFile = renderer.renderToFile(renderInput.getSecond(), branch, presentationType);
+ IFile baseFile = renderer.renderToFile(baseArtifact, branch, presentationType);
+ IFile newerFile = renderer.renderToFile(newerArtifact, branch, presentationType);
return new Pair<IFile, IFile>(baseFile, newerFile);
}
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WholeWordCompare.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WholeWordCompare.java
index 995a40b49d4..c9042a28b34 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WholeWordCompare.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WholeWordCompare.java
@@ -24,11 +24,6 @@ public class WholeWordCompare extends AbstractWordCompare {
}
@Override
- protected PresentationType getMergePresentationType() {
- return PresentationType.SPECIALIZED_EDIT;
- }
-
- @Override
public void compareArtifacts(IProgressMonitor monitor, PresentationType presentationType, Collection<ArtifactDelta> artifactDeltas) throws OseeCoreException {
for (ArtifactDelta entry : artifactDeltas) {
compare(monitor, presentationType, entry);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordTemplateCompare.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordTemplateCompare.java
index 15ac9dca22d..73be7371201 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordTemplateCompare.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordTemplateCompare.java
@@ -30,11 +30,6 @@ public class WordTemplateCompare extends AbstractWordCompare {
super(renderer, CoreAttributeTypes.WordTemplateContent);
}
- @Override
- protected PresentationType getMergePresentationType() {
- return PresentationType.MERGE_EDIT;
- }
-
/**
* Creates a difference report for each artifact between baseArtifact and newerArtifact. Then produces a single
* report by combining each of the difference reports together for a single report.
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/DiffHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/DiffHandler.java
index a93a1684b59..7852d62296a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/DiffHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/DiffHandler.java
@@ -11,7 +11,6 @@
package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
-import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.core.commands.ExecutionEvent;
@@ -47,61 +46,42 @@ class DiffHandler extends AbstractSelectionEnabledHandler {
if (attributeConflict != null) {
switch (diffToShow) {
case 1:
- MergeUtility.showCompareFile(
- MergeUtility.getStartArtifact(attributeConflict),
- attributeConflict.getSourceArtifact(),
- "Source_Diff_For_" + attributeConflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
+ MergeUtility.showCompareFile(MergeUtility.getStartArtifact(attributeConflict),
+ attributeConflict.getSourceArtifact(), "Source_Diff_For");
break;
case 2:
- MergeUtility.showCompareFile(
- MergeUtility.getStartArtifact(attributeConflict),
- attributeConflict.getDestArtifact(),
- "Destination_Diff_For_" + attributeConflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
- break;
- case 3:
- MergeUtility.showCompareFile(
- attributeConflict.getSourceArtifact(),
- attributeConflict.getDestArtifact(),
- "Source_Destination_Diff_For_" + attributeConflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
- break;
- case 4:
- if (attributeConflict.wordMarkupPresent()) {
- throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
- }
- MergeUtility.showCompareFile(
- attributeConflict.getSourceArtifact(),
- attributeConflict.getArtifact(),
- "Source_Merge_Diff_For_" + attributeConflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
- break;
- case 5:
- if (attributeConflict.wordMarkupPresent()) {
- throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
- }
- MergeUtility.showCompareFile(
- attributeConflict.getDestArtifact(),
- attributeConflict.getArtifact(),
- "Destination_Merge_Diff_For_" + attributeConflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
- break;
- }
- } else if (artifactConflict != null) {
- if (diffToShow == 1) {
- MergeUtility.showCompareFile(
- artifactConflict.getSourceArtifact(),
- MergeUtility.getStartArtifact(artifactConflict),
- "Source_Diff_For_" + artifactConflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
+ MergeUtility.showCompareFile(MergeUtility.getStartArtifact(attributeConflict),
+ attributeConflict.getDestArtifact(), "Destination_Diff_For");
+ break;
+ case 3:
+ MergeUtility.showCompareFile(attributeConflict.getSourceArtifact(),
+ attributeConflict.getDestArtifact(), "Source_Destination_Diff_For");
+ break;
+ case 4:
+ if (attributeConflict.wordMarkupPresent()) {
+ throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
+ }
+ MergeUtility.showCompareFile(attributeConflict.getSourceArtifact(), attributeConflict.getArtifact(),
+ "Source_Merge_Diff_For");
+ break;
+ case 5:
+ if (attributeConflict.wordMarkupPresent()) {
+ throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
+ }
+ MergeUtility.showCompareFile(attributeConflict.getDestArtifact(), attributeConflict.getArtifact(),
+ "Destination_Merge_Diff_For");
+ break;
+ }
+ } else if (artifactConflict != null) {
+ if (diffToShow == 1) {
+ MergeUtility.showCompareFile(artifactConflict.getSourceArtifact(),
+ MergeUtility.getStartArtifact(artifactConflict), "Source_Diff_For");
}
if (diffToShow == 2) {
- MergeUtility.showCompareFile(
- artifactConflict.getDestArtifact(),
- MergeUtility.getStartArtifact(artifactConflict),
- "Destination_Diff_For_" + artifactConflict.getArtifact().getSafeName() + new Date().toString().replaceAll(
- ":", ";") + ".xml");
+ }
+ if (diffToShow == 2) {
+ MergeUtility.showCompareFile(artifactConflict.getDestArtifact(),
+ MergeUtility.getStartArtifact(artifactConflict), "Destination_Diff_For");
}
}
return null;
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java
index 6470aa84680..ed0910dda15 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java
@@ -12,31 +12,19 @@
package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
import static org.eclipse.osee.framework.core.enums.DeletionFlag.INCLUDE_DELETED;
-import java.io.File;
-import java.io.IOException;
-import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osee.framework.core.enums.ConflictType;
import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.operation.Operations;
import org.eclipse.osee.framework.help.ui.OseeHelpContext;
-import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.util.AIFile;
-import org.eclipse.osee.framework.plugin.core.util.Jobs;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
import org.eclipse.osee.framework.skynet.core.attribute.WordAttribute;
@@ -51,8 +39,6 @@ import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
import org.eclipse.osee.framework.ui.skynet.revert.RevertWizard;
-import org.eclipse.osee.framework.ui.skynet.util.IVbaDiffGenerator;
-import org.eclipse.osee.framework.ui.skynet.util.WordUiUtil;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.NonmodalWizardDialog;
import org.eclipse.swt.widgets.Shell;
@@ -77,25 +63,6 @@ public class MergeUtility {
public static final String OPEN_MERGE_DIALOG =
"This will open a window that will allow in-document merging in Word. You will need to right click on every difference and either accept or reject the change. If you begin an in-document merge you will not be able to finalize the conflict until you resolve every change in the document.\n Computing a Merge will wipe out any merge changes you have made and start with a fresh diff of the two files. If you want to only view the changes use the difference options.\n Change that touch the entire file are better handled using copy and paste. \n\nWARNING: Word will occasionaly show incorrect changes especially when users have both modified the same block of text. Check your final version.";
- private static final Pattern authorPattern = Pattern.compile("aml:author=\".*?\"",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- private static final Pattern rsidRootPattern = Pattern.compile("\\</wsp:rsids\\>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- private static final Pattern findSetRsids = Pattern.compile("wsp:rsidR=\".*?\"",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- private static final Pattern findSetRsidRPR = Pattern.compile("wsp:rsidRPr=\".*?\"",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- private static final Pattern findSetRsidP = Pattern.compile("wsp:rsidP=\".*?\"",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- private static final Pattern findSetRsidRDefault = Pattern.compile("wsp:rsidRDefault=\".*?\"",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- private static final Pattern annotationTag = Pattern.compile(
- "(<aml:annotation[^\\>]*?[^/]\\>)|(</aml:annotation\\>)",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
-
- private static final Pattern rsidPattern = Pattern.compile("wsp:rsid(RPr|P|R)=\"(.*?)\"",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
-
public static void clearValue(Conflict conflict, Shell shell, boolean prompt) throws MultipleArtifactsExist, ArtifactDoesNotExist, Exception {
if (conflict == null) {
return;
@@ -135,48 +102,9 @@ public class MergeUtility {
return proceed;
}
- /*
- * This is not in the AttributeConflict because it relies on the renderer that is in not in the skynet core package.
- */
- public static void showCompareFile(Artifact art1, Artifact art2, String fileName) throws OseeCoreException {
- RendererManager.diffInJob(new ArtifactDelta(art1, art2), new VariableMap(IRenderer.FILE_NAME_OPTION, fileName));
- }
-
- /*
- * This is not in the AttributeConflict because it relies on the renderer that is in not in the skynet core package.
- */
- private static String createMergeDiffFile(Artifact art1, Artifact art2) throws Exception {
- if (art1 == null || art2 == null) {
- return " ";
- }
- VariableMap options = new VariableMap(IRenderer.NO_DISPLAY, true);
- return RendererManager.merge(art1, art2, options);
- }
-
- /*
- * This is not in the AttributeConflict because it relies on the renderer that is in not in the skynet core package.
- */
- private static void mergeEditableDiffFiles(Artifact art1, String art1FileName, String art2FileName, String fileName) throws Exception {
- if (art1 == null) {
- return;
- }
- VariableMap options = new VariableMap(IRenderer.FILE_NAME_OPTION, fileName, IRenderer.NO_DISPLAY, true);
- RendererManager.merge(art1, null, AIFile.constructIFile(art1FileName), AIFile.constructIFile(art2FileName),
- options);
- }
-
- public static Artifact getStartArtifact(Conflict conflict) {
- try {
- if (conflict.getSourceBranch() == null) {
- return null;
- }
- TransactionRecord baseTransaction = conflict.getSourceBranch().getBaseTransaction();
- return ArtifactQuery.getHistoricalArtifactFromId(conflict.getArtifact().getGuid(), baseTransaction,
- INCLUDE_DELETED);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- return null;
+ public static void showCompareFile(Artifact art1, Artifact art2, String filePrefix) throws OseeCoreException {
+ RendererManager.diffInJob(new ArtifactDelta(art1, art2),
+ new VariableMap(IRenderer.FILE_PREFIX_OPTION, filePrefix));
}
public static boolean showDeletedConflict(Conflict conflict, Shell shell) {
@@ -240,7 +168,6 @@ public class MergeUtility {
}
public static void launchMerge(final AttributeConflict attributeConflict, Shell shell) {
-
try {
if (attributeConflict.getAttribute() instanceof WordAttribute) {
if (!attributeConflict.statusEditable()) {
@@ -264,55 +191,7 @@ public class MergeUtility {
if (response == 2) {
HelpUtil.displayHelp(OseeHelpContext.MERGE_MANAGER);
} else if (response == 1) {
-
- Job job = new Job("Generate 3 Way Merge") {
-
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- try {
- int gamma = attributeConflict.getAttribute().getGammaId();
- monitor.beginTask("Generate 3 Way Merge", 100);
- IVbaDiffGenerator generator = WordUiUtil.createScriptGenerator();
- generator.initialize(false, false);
- monitor.worked(5);
- String sourceChangeFile =
- createMergeDiffFile(getStartArtifact(attributeConflict),
- attributeConflict.getSourceArtifact());
- monitor.worked(15);
- String destChangeFile =
- createMergeDiffFile(getStartArtifact(attributeConflict), attributeConflict.getDestArtifact());
- monitor.worked(15);
- changeAuthorinWord("Source", sourceChangeFile, 2, "12345678", "55555555");
- changeAuthorinWord("Destination", destChangeFile, 2, "56781234", "55555555");
- monitor.worked(15);
-
- String fileName =
- "Source_Dest_Merge_" + attributeConflict.getArtifact().getSafeName() + "(" + attributeConflict.getArtifact().getGuid() + ")" + new Date().toString().replaceAll(
- ":", ";") + ".xml";
- mergeEditableDiffFiles(attributeConflict.getArtifact(), sourceChangeFile, destChangeFile,
- fileName);
-
- monitor.worked(40);
- attributeConflict.markStatusToReflectEdit();
-
- int maxCount = 5;
- int counter = 0;
- while (gamma == attributeConflict.getAttribute().getGammaId() && counter++ != maxCount) {
- Thread.sleep(500);
- }
- monitor.done();
- RendererManager.openInJob(attributeConflict.getArtifact(), PresentationType.SPECIALIZED_EDIT);
-
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- monitor.done();
- return Status.OK_STATUS;
- }
- };
-
- Jobs.startJob(job);
-
+ Operations.executeAsJob(new ThreeWayWordMergeOperation(attributeConflict), true);
} else if (response == 0) {
RendererManager.openInJob(attributeConflict.getArtifact(), PresentationType.SPECIALIZED_EDIT);
attributeConflict.markStatusToReflectEdit();
@@ -323,71 +202,17 @@ public class MergeUtility {
}
}
- protected static void changeAuthorinWord(String newAuthor, String fileName, int revisionNumber, String rsidNumber, String baselineRsid) throws Exception {
- File file = new File(fileName);
- String fileValue = Lib.fileToString(file);
-
- Matcher m = authorPattern.matcher(fileValue);
- while (m.find()) {
- String name = m.group();
- fileValue = fileValue.replace(name, "aml:author=\"" + newAuthor + "\"");
- }
-
- m = findSetRsids.matcher(fileValue);
- while (m.find()) {
- String rev = m.group();
- fileValue = fileValue.replace(rev, "wsp:rsidR=\"" + baselineRsid + "\"");
- }
- m = findSetRsidRPR.matcher(fileValue);
- while (m.find()) {
- String rev = m.group();
- fileValue = fileValue.replace(rev, "wsp:rsidRPr=\"" + baselineRsid + "\"");
- }
- m = findSetRsidP.matcher(fileValue);
- while (m.find()) {
- String rev = m.group();
- fileValue = fileValue.replace(rev, "wsp:rsidP=\"" + baselineRsid + "\"");
- }
- m = findSetRsidRDefault.matcher(fileValue);
- while (m.find()) {
- String rev = m.group();
- fileValue = fileValue.replace(rev, "wsp:rsidRDefault=\"" + baselineRsid + "\"");
- }
-
- resetRsidIds(fileValue, rsidNumber, baselineRsid, file);
- }
-
- private static void resetRsidIds(String fileValue, String rsidNumber, String baselineRsid, File file) throws IOException {
- ChangeSet changeSet = new ChangeSet(fileValue);
- Matcher matcher = annotationTag.matcher(fileValue);
-
- while (matcher.find()) {
- int startIndex = matcher.start();
- int level = 1;
-
- do {
- matcher.find();
-
- if (matcher.group().startsWith("<aml:annotation")) {
- level++;
- } else {
- level--;
- }
- } while (level != 0);
-
- Matcher rsidMatcher = rsidPattern.matcher(fileValue);
-
- while (rsidMatcher.find(startIndex) && rsidMatcher.end() <= matcher.end()) {
- changeSet.replace(rsidMatcher.start(2), rsidMatcher.end(2) - 1, rsidNumber);
- startIndex = rsidMatcher.end();
+ public static Artifact getStartArtifact(Conflict conflict) {
+ try {
+ if (conflict.getSourceBranch() == null) {
+ return null;
}
+ TransactionRecord baseTransaction = conflict.getSourceBranch().getBaseTransaction();
+ return ArtifactQuery.getHistoricalArtifactFromId(conflict.getArtifact().getGuid(), baseTransaction,
+ INCLUDE_DELETED);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
}
-
- Matcher m = rsidRootPattern.matcher(fileValue);
- while (m.find()) {
- changeSet.replace(m.start(), m.end() - 1, "<wsp:rsid wsp:val=\"" + baselineRsid + "\"/></wsp:rsids>");
- }
-
- changeSet.applyChanges(file);
+ return null;
}
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/ThreeWayWordMergeOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/ThreeWayWordMergeOperation.java
new file mode 100644
index 00000000000..112ca50731c
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/ThreeWayWordMergeOperation.java
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Date;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.plugin.core.util.AIFile;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
+import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
+import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.ITemplateRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+import org.eclipse.osee.framework.ui.skynet.render.UpdateArtifactOperation;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class ThreeWayWordMergeOperation extends AbstractOperation {
+ private static final Pattern authorPattern = Pattern.compile("aml:author=\".*?\"",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ private static final Pattern rsidRootPattern = Pattern.compile("\\</wsp:rsids\\>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ private static final Pattern findSetRsids = Pattern.compile("wsp:rsidR=\".*?\"",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ private static final Pattern findSetRsidRPR = Pattern.compile("wsp:rsidRPr=\".*?\"",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ private static final Pattern findSetRsidP = Pattern.compile("wsp:rsidP=\".*?\"",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ private static final Pattern findSetRsidRDefault = Pattern.compile("wsp:rsidRDefault=\".*?\"",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ private static final Pattern annotationTag = Pattern.compile(
+ "(<aml:annotation[^\\>]*?[^/]\\>)|(</aml:annotation\\>)",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+
+ private static final Pattern rsidPattern = Pattern.compile("wsp:rsid(RPr|P|R)=\"(.*?)\"",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+
+ private final AttributeConflict attributeConflict;
+
+ public ThreeWayWordMergeOperation(AttributeConflict attributeConflict) {
+ super("Generate 3 Way Merge", SkynetGuiPlugin.PLUGIN_ID);
+ this.attributeConflict = attributeConflict;
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ Artifact mergeArtifact = attributeConflict.getArtifact();
+
+ Artifact startArtifact = MergeUtility.getStartArtifact(attributeConflict);
+ monitor.worked(5);
+ IFile sourceChangeFile = createMergeDiffFile(startArtifact, attributeConflict.getSourceArtifact());
+ monitor.worked(15);
+ IFile destChangeFile = createMergeDiffFile(startArtifact, attributeConflict.getDestArtifact());
+ monitor.worked(15);
+ changeAuthorinWord("Source", sourceChangeFile, 2, "12345678", "55555555");
+ changeAuthorinWord("Destination", destChangeFile, 2, "56781234", "55555555");
+ monitor.worked(15);
+
+ String fileName =
+ "Source_Dest_Merge_" + mergeArtifact.getSafeName() + "(" + mergeArtifact.getGuid() + ")" + new Date().toString().replaceAll(
+ ":", ";") + ".xml";
+
+ VariableMap options = new VariableMap(IRenderer.FILE_NAME_OPTION, fileName, IRenderer.NO_DISPLAY, true);
+ File mergedFile = new File(RendererManager.merge(mergeArtifact, null, sourceChangeFile, destChangeFile, options));
+
+ monitor.worked(40);
+ attributeConflict.markStatusToReflectEdit();
+
+ IOperation op =
+ new UpdateArtifactOperation(mergedFile, Collections.singletonList(mergeArtifact), mergeArtifact.getBranch());
+ Operations.executeWork(op, monitor);
+
+ monitor.done();
+ RendererManager.openInJob(mergeArtifact, PresentationType.SPECIALIZED_EDIT);
+
+ }
+
+ private static IFile createMergeDiffFile(Artifact baseVersion, Artifact newerVersion) throws Exception {
+ VariableMap options =
+ new VariableMap(IRenderer.NO_DISPLAY, true, ITemplateRenderer.TEMPLATE_OPTION,
+ ITemplateRenderer.DIFF_NO_ATTRIBUTES_VALUE);
+ ArtifactDelta artifactDelta = new ArtifactDelta(baseVersion, newerVersion);
+ return AIFile.constructIFile(RendererManager.diff(artifactDelta, options));
+ }
+
+ private static void changeAuthorinWord(String newAuthor, IFile iFile, int revisionNumber, String rsidNumber, String baselineRsid) throws Exception {
+ File file = iFile.getLocation().toFile();
+ String fileValue = Lib.fileToString(file);
+
+ Matcher m = authorPattern.matcher(fileValue);
+ while (m.find()) {
+ String name = m.group();
+ fileValue = fileValue.replace(name, "aml:author=\"" + newAuthor + "\"");
+ }
+
+ m = findSetRsids.matcher(fileValue);
+ while (m.find()) {
+ String rev = m.group();
+ fileValue = fileValue.replace(rev, "wsp:rsidR=\"" + baselineRsid + "\"");
+ }
+ m = findSetRsidRPR.matcher(fileValue);
+ while (m.find()) {
+ String rev = m.group();
+ fileValue = fileValue.replace(rev, "wsp:rsidRPr=\"" + baselineRsid + "\"");
+ }
+ m = findSetRsidP.matcher(fileValue);
+ while (m.find()) {
+ String rev = m.group();
+ fileValue = fileValue.replace(rev, "wsp:rsidP=\"" + baselineRsid + "\"");
+ }
+ m = findSetRsidRDefault.matcher(fileValue);
+ while (m.find()) {
+ String rev = m.group();
+ fileValue = fileValue.replace(rev, "wsp:rsidRDefault=\"" + baselineRsid + "\"");
+ }
+
+ resetRsidIds(fileValue, rsidNumber, baselineRsid, file);
+ }
+
+ private static void resetRsidIds(String fileValue, String rsidNumber, String baselineRsid, File file) throws IOException {
+ ChangeSet changeSet = new ChangeSet(fileValue);
+ Matcher matcher = annotationTag.matcher(fileValue);
+
+ while (matcher.find()) {
+ int startIndex = matcher.start();
+ int level = 1;
+
+ do {
+ matcher.find();
+
+ if (matcher.group().startsWith("<aml:annotation")) {
+ level++;
+ } else {
+ level--;
+ }
+ } while (level != 0);
+
+ Matcher rsidMatcher = rsidPattern.matcher(fileValue);
+
+ while (rsidMatcher.find(startIndex) && rsidMatcher.end() <= matcher.end()) {
+ changeSet.replace(rsidMatcher.start(2), rsidMatcher.end(2) - 1, rsidNumber);
+ startIndex = rsidMatcher.end();
+ }
+ }
+
+ Matcher m = rsidRootPattern.matcher(fileValue);
+ while (m.find()) {
+ changeSet.replace(m.start(), m.end() - 1, "<wsp:rsid wsp:val=\"" + baselineRsid + "\"/></wsp:rsids>");
+ }
+
+ changeSet.applyChanges(file);
+ }
+} \ No newline at end of file

Back to the top