Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjphillips2008-09-02 18:53:55 +0000
committerjphillips2008-09-02 18:53:55 +0000
commit417fb363708202fa575cea4781a7dcd5489f659f (patch)
treefb8367e4c619ac9d8821e8b5d98b0e6d6e9c7068
parent61733c313536dcfbedbf91c692acd6a4912d67e6 (diff)
downloadorg.eclipse.osee-417fb363708202fa575cea4781a7dcd5489f659f.tar.gz
org.eclipse.osee-417fb363708202fa575cea4781a7dcd5489f659f.tar.xz
org.eclipse.osee-417fb363708202fa575cea4781a7dcd5489f659f.zip
-rw-r--r--org.eclipse.osee.framework.ui.skynet/plugin.xml3
-rw-r--r--org.eclipse.osee.framework.ui.skynet/reference/Merge_Manager.html235
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactExplorer.java11
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ViewWordChangeReportHandler.java8
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IVbaDiffGenerator.java23
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/VbaWordDiffGenerator.java117
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeDocumentRenderer.java31
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordRenderer.java47
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java3
-rw-r--r--org.eclipse.osee.framework.ui.skynet/support/compareDocs.vbs81
-rw-r--r--org.eclipse.osee.framework.ui.skynet/support/compareDocs2.vbs83
11 files changed, 413 insertions, 229 deletions
diff --git a/org.eclipse.osee.framework.ui.skynet/plugin.xml b/org.eclipse.osee.framework.ui.skynet/plugin.xml
index 37095ab94c1..8ea8ea20cf0 100644
--- a/org.eclipse.osee.framework.ui.skynet/plugin.xml
+++ b/org.eclipse.osee.framework.ui.skynet/plugin.xml
@@ -746,9 +746,6 @@
<menuContribution
locationURI="popup:org.eclipse.osee.framework.ui.skynetd.widgets.xchange.ChangeView">
<command
- commandId="org.eclipse.osee.framework.ui.skynet.changeReportView.wordChangesMadeTo.command">
- </command>
- <command
commandId="org.eclipse.osee.framework.ui.skynet.openInEdit.command"
label="Open Final Version">
</command>
diff --git a/org.eclipse.osee.framework.ui.skynet/reference/Merge_Manager.html b/org.eclipse.osee.framework.ui.skynet/reference/Merge_Manager.html
new file mode 100644
index 00000000000..7d81c654a5f
--- /dev/null
+++ b/org.eclipse.osee.framework.ui.skynet/reference/Merge_Manager.html
@@ -0,0 +1,235 @@
+<html>
+
+<head>
+<meta http-equiv="Content-Language" content="en-us">
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+<title>Merge Manager View</title>
+</head>
+
+<body>
+
+<h1>Merge Manager View</h1>
+<img border="0" src="Merge_1.jpg"><br>
+&nbsp;<h2>Purpose</h2>
+<p>The Merge Manager is used to resolve conflicts that arise when doing
+development on parallel branches.&nbsp; The Merge Manager makes conflicts that
+arise easily identifiable and then provides the means for resolving the
+conflicts, so that the working branch can be committed.</p>
+<h2>Icons</h2>
+<ul>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/chkbox_disabled.gif" width="16" height="16">&nbsp;
+ Resolution has been started for the conflict</li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/accept.gif" width="16" height="16">&nbsp;
+ Conflict has been resolved and is ready to be committed, In the Merge column
+ it means that the Source and Destination Branches have the same value even
+ though they were both changed. </li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/chkbox_enabled_conflicted.gif" width="16" height="16">&nbsp;
+ After a conflict has been marked as resolved the value changed on the source
+ or destination branch</li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/issue.gif" width="16" height="16">&nbsp;
+ A conflict that provides the user special information but does not need to
+ be resolved</li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/red_light.gif" width="16" height="16">&nbsp;
+ A conflict that can not be resolved except by reverting the Artifact or
+ Attribute, because it was deleted on the Destination Branch</li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/blue_d.gif" width="16" height="16">&nbsp;
+ Shows that the item defined by the column it is in has the Destination
+ Branches value</li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/green_s.gif" width="16" height="16">&nbsp;
+ Shows that the item defined by the column it is in has the Source Branches
+ value</li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/yellow_m.gif" width="16" height="16">&nbsp;
+ Shows that the item defined by the column it is in has a new value that is
+ neither the Source Branch nor Destination Branch value.</li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/conflict.gif" width="16" height="16">&nbsp;
+ Shows that the conflict has not been given an initial value </li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/user.gif" width="16" height="16">&nbsp;
+ Opens the Associated Artifact for the merge</li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/branch_change_source.gif" width="16" height="16">&nbsp;
+ Opens up the Change Report for the Source Branch</li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/branch_change_dest.gif" width="16" height="16">&nbsp;
+ Opens up the Change Report for the Destination Branch</li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/refresh.gif" width="16" height="16">&nbsp;
+ Refreshes the Merge Manger view to find new conflicts</li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/customize.gif" width="16" height="16">&nbsp;
+ Allows the user to customize the Merge Manager tables</li>
+ <li>
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/bug.gif" width="16" height="16">&nbsp;
+ Report a bug with the Merge Manager</li>
+</ul>
+<h2>Overview</h2>
+<p>The Merge Manager is in place to find conflicts and help users resolve these
+conflicts.&nbsp; A conflict exists if the value of an attribute/artifact has
+changed on both the Destination and Source Branches.&nbsp; For reference the
+Source Branch is the users working branch.&nbsp; It is the branch that the user
+has been making changes to and would like to then add back into the Destination
+Branch or Baseline Branch.&nbsp; Both branches are identified by name in the
+header of the Merge Manager.&nbsp; </p>
+<p>Depending upon the conflict found, the user may have several choices for
+resolution.&nbsp; These include </p>
+<ul>
+ <li>Accept the value on the Source Branch and overwrite the value on the
+ Destination Branch</li>
+ <li>Accept the value on the Destination Branch and do not add any of the
+ Source Branch changes, (These will still show up as merged on
+ <a href="change_table.html">Change Reports</a>)</li>
+ <li>Create a solution that is a combination of the two changes </li>
+ <li>Revert the changes on the Source Branch&nbsp; (This is the only
+ available solution when the Artifact/Attribute was deleted on the
+ Destination Branch, will show up as no change on the
+ <a href="change_table.html">Change Report</a>)</li>
+ <li>Do nothing (only possible for informational conflicts)</li>
+</ul>
+<p>Committing of Branches is blocked until all conflicts are resolved.</p>
+<h2>The GUI</h2>
+<p>The GUI is organized to provide the user with an ability to quickly identify
+conflicts.</p>
+<ul>
+ <li><b>The Heading</b> - The Heading contains text to help identify what is
+ being merged. It identifies the Source Branch, and the Destination Branch.&nbsp;
+ It also provides the user with information about how many conflicts there
+ are and if they have been resolved.&nbsp; The Heading also contains easy
+ launch icons for additional tools in connection with the Merge Manager.</li>
+ <li><b>The Conflict Resolution Column</b> - This column provides the user
+ information about the state of the conflict.&nbsp; A blank entry in the
+ column means that the conflict is new and has not had any actions performed
+ on it. A
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/chkbox_disabled.gif" width="16" height="16">
+ indicates that conflict is in the modified state.&nbsp; This means the user
+ has begun merging the conflict but has not marked it as resolved.&nbsp; The
+ user may transition it into the resolved state by left clicking on the
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/chkbox_disabled.gif" width="16" height="16">
+ icon. The
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/accept.gif" width="16" height="16">
+ icon indicates the the user has marked the conflict as resolved.&nbsp; This
+ means they have selected a value for it and have verified the value going in
+ is what they want.&nbsp; No additional changes are allowed on a conflict
+ once it is in the resolved state.&nbsp; It can be placed back into the
+ modified state by left clicking on the
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/accept.gif" width="16" height="16">
+ icon. The
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/chkbox_enabled_conflicted.gif" width="16" height="16">
+ means that a conflict was in the resolved state but a new change has
+ occurred on either the Source or Destination Branch.&nbsp; It serves to
+ notify the user that the conflict was not in the finalized state when they
+ resolved the conflict.&nbsp; The user can return to resolved state by left
+ clicking on the&nbsp;
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/chkbox_enabled_conflicted.gif" width="16" height="16">
+ icon.&nbsp; The
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/red_light.gif" width="16" height="16">
+ icon indicates that an Artifact or Attribute must be reverted on the Source
+ Branch.&nbsp; This indicates that the Artifact/Attribute was deleted on the
+ Destination Branch and can not have a change committed onto it.&nbsp; The
+ user must abandon any change to that artifact attribute by using the revert
+ command.&nbsp; Once the Artifact/Attribute has been reverted the Merge
+ Manager will be refreshed and the conflict will be removed. The
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/issue.gif" width="16" height="16">icon
+ indicates an informational conflict.&nbsp; The user does not have to take
+ any action to resolve these conflicts.&nbsp; It just provides the
+ information that the Source Branch deleted the Artifact/Attribute but the
+ Destination Branch has been modified.&nbsp; The user is free to act as
+ desired based on the provided information.</li>
+ <li><b>The Artifact Name Column</b> - This column tells which artifact the
+ conflict occurred on.&nbsp; If the name is different between the Source and
+ Destination Branches, (this will show up as a conflict) it will at first
+ showing use the Source Branch value and then use whatever the name is
+ resolved to be after that has occurred.</li>
+ <li><b>The Artifact Type Column</b> - Simply lists what type of Artifact is
+ conflicted</li>
+ <li><b>The Conflicting Item Column</b> - In the case of an attribute
+ conflict it states what attribute type is conflicting.&nbsp; In the case of
+ an artifact conflict it will always say &quot;Artifact State&quot;</li>
+ <li><b>The Source Value Column</b> - When possible this column tells what
+ value the Source Branch has for the conflict.&nbsp; It will always have a
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/green_s.gif" width="16" height="16">
+ icon. If the conflicting item is Word Formatted Content the words &quot;Stream
+ data&quot; will be shown.&nbsp; For artifact conflicts it will either show
+ &quot;Modified&quot; or &quot;Deleted&quot;.&nbsp; Left clicking on the
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/green_s.gif" width="16" height="16">
+ icon will populate the Merge Branch with value found on the Source Branch.</li>
+ <li><b>The Destination Value Column</b> - When possible this column tells
+ what value the Destination Branch has for the conflict.&nbsp; It will always
+ have a
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/blue_d.gif" width="16" height="16">
+ icon. If the conflicting item is Word Formatted Content the words &quot;Stream
+ data&quot; will be shown.&nbsp; For artifact conflicts it will either show
+ &quot;Modified&quot; or &quot;Deleted&quot;.&nbsp; Left clicking on the
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/blue_d.gif" width="16" height="16">
+ icon will populate the Merge Branch with value found on the Destination
+ Branch.</li>
+ <li><b>The Merge Value Column</b> - The Merged Value column serves to show
+ the user the value that has been selected for use when the Branch is
+ committed.&nbsp; The Merge value is actually kept on a new &quot;Merge Branch&quot;
+ and so any changes made to it will not affect the value seen on the Source
+ or Destination Branches.&nbsp; When the Merge Value column is blank with no
+ icon, the conflict is informational and no actions are provided.&nbsp; When
+ the Merge Value column contains a&nbsp;
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/conflict.gif" width="16" height="16">icon
+ the value has not been set.&nbsp; This is the icon you should see for all
+ conflicts (Except informational conflicts, or same value conflicts) the
+ first time you bring up the merge manager.&nbsp; The
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/green_s.gif" width="16" height="16">
+ icon indicates that the Source Value was selected as the final value.&nbsp;
+ The actual Source Value text will also be shown in this column if possible.
+ The
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/blue_d.gif" width="16" height="16">
+ icon indicates that the Destination Value was selected as the final value.&nbsp;
+ The Destination Value text will also be shown in this column if possible.
+ The
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/yellow_m.gif" width="16" height="16">
+ icon will be shown when a new value has been selected for the final value.&nbsp;
+ This indicates that the user has modified the final value so that it is no
+ longer a copy of the Source or Destination, but some variation thereof.&nbsp;
+ A
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/accept.gif" width="16" height="16">
+ icon indicates that although both the Source Branch Value and Destination
+ Branch Value have changed they were both changed to the same value and so
+ there is not really a conflict. Left clicking on the icon in the Merge Value
+ column will bring up the Merge Wizard or in the case of un-resolvable
+ conflicts a dialog offering the ability to revert the conflicting item.</li>
+ <li><b>The Right Click Menu</b> - Right clicking on any row will display a
+ menu with options for dealing with conflicts.&nbsp; Most of these options
+ are directed towards resolving Word Formatted Content conflicts as the other
+ conflicts are trivial.&nbsp; These options are explored below.</li>
+</ul>
+<h2>Resolution Of Conflicts</h2>
+<p>Resolution of conflicts is provided in two different ways.&nbsp; The user may
+right click on the conflict row and bring up the conflict menu, and use that in
+combination with the
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/green_s.gif" width="16" height="16">
+icon in the Source Value column and the
+ <img border="0" src="../../org.eclipse.osee.framework.ui.skynet/images/blue_d.gif" width="16" height="16">
+icon in the Destination Value column. The other way is to bring up the Merge
+Wizard by left clicking on the icon that is in the Merge Value column. </p>
+<p>There are entries on the context menu that are not shown on the wizard.&nbsp;
+These include &quot;Set Source as Default Branch&quot;, &quot;Set Destination as Default
+Branch&quot;, &quot;Reveal Artifact in Explorer&quot; and &quot;Resource History&quot;.&nbsp; These tools
+are intended to allow quick evaluation of the conflicts.&nbsp; The &quot;Set Source
+as Default Branch&quot; and &quot;Set Destination as Default Branch&quot; entries allow for the
+quick changing of the default branch between the Source and Destination
+Branches.&nbsp; The other two commands are used only when the Source or
+Destination Branch is selected as the default branch.&nbsp; If either the Source
+or Destination Branch is selected as the Default Branch it will be grayed out
+and will have a check mark next to it.&nbsp; The &quot;Reveal Artifact in Explorer&quot;
+will reveal the artifact in Explorer for the branch that is selected as the
+default branch.&nbsp; &quot;Resource History&quot; will likewise show the resource history
+for the Artifact on the branch that is selected as the default branch.</p>
+<p><img border="0" src="Merge_2.jpg"></p>
+
+</body>
+
+</html>
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactExplorer.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactExplorer.java
index 2525f29fd0e..c4d4b46896a 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactExplorer.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactExplorer.java
@@ -42,6 +42,7 @@ import org.eclipse.osee.framework.skynet.core.SkynetAuthentication;
import org.eclipse.osee.framework.skynet.core.access.AccessControlManager;
import org.eclipse.osee.framework.skynet.core.access.PermissionEnum;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactData;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactModifiedEvent;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactPersistenceManager;
@@ -318,7 +319,15 @@ public class ArtifactExplorer extends ViewPart implements IEventReceiver, IActio
*/
public static void revealArtifact(Artifact artifact) {
try {
- if (artifact.isOrphan()) {
+
+ if (artifact.isDeleted()) {
+ OSEELog.logInfo(SkynetGuiPlugin.class,
+ "The artifact " + artifact.getDescriptiveName() + " has been deleted.", true);
+ }
+ else if(artifact.isHistorical()){
+ artifact = ArtifactQuery.getArtifactFromId(artifact.getArtId(), artifact.getBranch(), false);
+ }
+ else if (artifact.isOrphan()) {
OSEELog.logInfo(SkynetGuiPlugin.class,
"The artifact " + artifact.getDescriptiveName() + " does not have a parent (orphan).", true);
} else {
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ViewWordChangeReportHandler.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ViewWordChangeReportHandler.java
index 6956aba0a11..ff6a3c5ff05 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ViewWordChangeReportHandler.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ViewWordChangeReportHandler.java
@@ -96,12 +96,8 @@ public class ViewWordChangeReportHandler extends AbstractHandler {
WordRenderer renderer =
(WordRenderer) RendererManager.getInstance().getRendererById(WordRenderer.WORD_RENDERER_EXTENSION);
try {
- renderer.compareArtifacts(
- baseArtifacts,
- newerArtifacts,
- DIFF_ARTIFACT,
- null,
- baseArtifacts.get(0) == null ? newerArtifacts.get(0).getBranch() : baseArtifacts.get(0).getBranch());
+ renderer.compareArtifacts(baseArtifacts,newerArtifacts,DIFF_ARTIFACT,null,
+ baseArtifacts.get(0) == null ? newerArtifacts.get(0).getBranch() : baseArtifacts.get(0).getBranch());
} catch (CoreException ex) {
OSEELog.logException(getClass(), ex, true);
} catch (Exception ex) {
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IVbaDiffGenerator.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IVbaDiffGenerator.java
new file mode 100644
index 00000000000..c39437ead27
--- /dev/null
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IVbaDiffGenerator.java
@@ -0,0 +1,23 @@
+/*
+ * Created on Aug 29, 2008
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.ui.skynet.render;
+
+import java.io.File;
+import java.io.IOException;
+import org.eclipse.core.resources.IFile;
+
+/**
+ * @author Theron Virgin
+ */
+public interface IVbaDiffGenerator {
+ public boolean initialize(boolean visible, boolean detectFormatChanges);
+
+ public boolean addComparison(IFile baseFile, IFile newerFile, String diffPath, boolean merge);
+
+ public void finish(String path) throws IOException, InterruptedException;
+
+ public File getFile(String path) throws IOException;
+}
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/VbaWordDiffGenerator.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/VbaWordDiffGenerator.java
new file mode 100644
index 00000000000..96a590a09d7
--- /dev/null
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/VbaWordDiffGenerator.java
@@ -0,0 +1,117 @@
+/*
+ * Created on Aug 29, 2008
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.ui.skynet.render;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.logging.Logger;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.osee.framework.jdk.core.util.io.streams.StreamCatcher;
+import org.eclipse.osee.framework.plugin.core.config.ConfigUtil;
+
+/**
+ * @author Theron Virgin
+ */
+public class VbaWordDiffGenerator implements IVbaDiffGenerator {
+ private final static String header =
+ "Option Explicit\n\nDim oWord\nDim baseDoc\nDim authorName\nDim detectFormatChanges\nDim ver1\nDim ver2\nDim diffPath\nDim wdCompareTargetSelectedDiff\nDim wdCompareTargetSelectedMerge\nDim wdFormattingFromCurrent\nDim wdFormatXML\nDim visible\n\nPublic Sub main()\n wdCompareTargetSelectedDiff = 0\n wdCompareTargetSelectedMerge = 1\n wdFormattingFromCurrent = 3\n wdFormatXML = 11\n\n authorName = \"OSEE Doc compare\"\n\n detectFormatChanges = True\n\n set oWord = WScript.CreateObject(\"Word.Application\")\n oWord.Visible = False\n\n";
+
+ private final static String comparisonCommand =
+ " oWord.ActiveDocument.Compare ver2, authorName, wdCompareTargetSelectedDiff, detectFormatChanges, False, False\n oWord.ActiveDocument.SaveAs diffPath, wdFormatXML, , , False\n baseDoc.close()\n If visible Then\n Else\n oWord.ActiveDocument.close()\n End If\n\n";
+
+ private final static String mergeCommand =
+ " baseDoc.Merge ver2, wdCompareTargetSelectedMerge, detectFormatChanges, wdFormattingFromCurrent, False\n oWord.ActiveDocument.SaveAs diffPath, wdFormatXML, , , False\n baseDoc.close()\n If visible Then\n Else\n oWord.ActiveDocument.close()\n End If\n\n";
+
+ private final static String tail =
+ " If visible Then\n oWord.Visible = True\n Else\n oWord.Quit()\n set oWord = Nothing\n End If\n\nEnd Sub\n\nmain";
+
+ private static final Logger logger = ConfigUtil.getConfigFactory().getLogger(WordRenderer.class);
+
+ private StringBuilder builder;
+ private boolean finalized;
+ private boolean initialized;
+
+ public VbaWordDiffGenerator() {
+ initialized = false;
+ finalized = false;
+ }
+
+ public boolean initialize(boolean visible, boolean detectFormatChanges) {
+ if (initialized) {
+ return false;
+ }
+ initialized = true;
+ builder = new StringBuilder();
+ builder.append(header);
+ if (visible) {
+ builder.append(" visible = True\n\n");
+ } else {
+ builder.append(" visible = False\n\n");
+ }
+ if (detectFormatChanges) {
+ builder.append(" detectFormatChanges = True\n\n");
+ } else {
+ builder.append(" detectFormatChanges = False\n\n");
+ }
+ return true;
+ }
+
+ public boolean addComparison(IFile baseFile, IFile newerFile, String diffPath, boolean merge) {
+ if (finalized) {
+ return false;
+ }
+ builder.append(" ver1 = \"");
+ builder.append(baseFile.getLocation().toOSString());
+ builder.append("\"\n");
+
+ builder.append(" ver2 = \"");
+ builder.append(newerFile.getLocation().toOSString());
+ builder.append("\"\n");
+
+ builder.append(" diffPath = \"");
+ builder.append(diffPath);
+ builder.append("\"\n\n");
+
+ builder.append(" set baseDoc = oWord.Documents.Open (ver1)\n");
+
+ if (merge) {
+ builder.append(mergeCommand);
+ } else {
+ builder.append(comparisonCommand);
+ }
+ return true;
+ }
+
+ public void finish(String path) throws IOException, InterruptedException {
+ finalized = true;
+ builder.append(tail);
+ compare(getFile(path));
+ }
+
+ public File getFile(String path) throws IOException {
+ if (!finalized) {
+ return null;
+ }
+ FileOutputStream out = new FileOutputStream(path != null ? path : "c:\\UserData\\compareDocs.vbs");
+ out.write(builder.toString().getBytes(), 0, builder.toString().getBytes().length);
+ out.close();
+ return new File(path != null ? path : "c:\\UserData\\compareDocs.vbs");
+ }
+
+ private void compare(File vbDiffScript) throws IOException, InterruptedException {
+ String cmd[] = {"cmd", "/s /c", "\"" + vbDiffScript.getPath() + "\""};
+
+ Process proc = Runtime.getRuntime().exec(cmd);
+
+ StreamCatcher errorCatcher = new StreamCatcher(proc.getErrorStream(), "ERROR", logger);
+ StreamCatcher outputCatcher = new StreamCatcher(proc.getInputStream(), "OUTPUT");
+
+ errorCatcher.start();
+ outputCatcher.start();
+ proc.waitFor();
+ }
+}
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeDocumentRenderer.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeDocumentRenderer.java
index 6cfd7322e7f..86aaf01dc17 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeDocumentRenderer.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeDocumentRenderer.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.render;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
@@ -21,7 +20,6 @@ import javax.xml.transform.TransformerFactoryConfigurationError;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.jdk.core.util.io.Streams;
-import org.eclipse.osee.framework.jdk.core.util.io.streams.StreamCatcher;
import org.eclipse.osee.framework.plugin.core.config.ConfigUtil;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.Branch;
@@ -182,36 +180,19 @@ public class WholeDocumentRenderer extends FileRenderer {
diffPath = baseFileStr.substring(0, baseFileStr.lastIndexOf('\\')) + '\\' + fileName;
}
+ VbaWordDiffGenerator diffGenerator = new VbaWordDiffGenerator();
+ diffGenerator.initialize(presentationType != PresentationType.MERGE, true);
if (presentationType == PresentationType.MERGE_EDIT && baseVersion != null) {
- compare(baseFile, newerFile, diffPath, false, plugin.getPluginFile("support/compareDocs2.vbs"));
addFileToWatcher(getRenderFolder(baseVersion.getBranch(), PresentationType.EDIT),
diffPath.substring(diffPath.lastIndexOf('\\') + 1));
+ diffGenerator.addComparison(baseFile, newerFile, diffPath, true);
+ diffGenerator.finish(diffPath.substring(0, diffPath.lastIndexOf('\\')) + "mergeDocs.vbs");
} else {
- compare(baseFile, newerFile, diffPath, presentationType != PresentationType.MERGE,
- plugin.getPluginFile("support/compareDocs.vbs"));
+ diffGenerator.addComparison(baseFile, newerFile, diffPath, false);
+ diffGenerator.finish(diffPath.substring(0, diffPath.lastIndexOf('\\')) + "/compareDocs.vbs");
}
return diffPath;
}
- public void compare(IFile baseFile, IFile newerFile, String diffPath, boolean visible, File vbDiffScript) throws IOException, InterruptedException {
-
- // quotes are neccessary because of Runtime.exec wraps the last element in quotes...crazy
- String cmd[] =
- {
- "cmd",
- "/s /c",
- "\"" + vbDiffScript.getPath() + "\"",
- "/author:CoolOseeUser\" /diffPath:\"" + diffPath + "\" /detectFormatChanges:true /ver1:\"" + baseFile.getLocation().toOSString() + "\" /ver2:\"" + newerFile.getLocation().toOSString() + "\" /visible:\"" + visible};
-
- Process proc = Runtime.getRuntime().exec(cmd);
-
- StreamCatcher errorCatcher = new StreamCatcher(proc.getErrorStream(), "ERROR", logger);
- StreamCatcher outputCatcher = new StreamCatcher(proc.getInputStream(), "OUTPUT");
-
- errorCatcher.start();
- outputCatcher.start();
- proc.waitFor();
- }
-
} \ No newline at end of file
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordRenderer.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordRenderer.java
index 52a66e8935c..939644cd99c 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordRenderer.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordRenderer.java
@@ -12,7 +12,6 @@
package org.eclipse.osee.framework.ui.skynet.render;
import java.io.ByteArrayOutputStream;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -36,7 +35,6 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.osee.framework.jdk.core.util.AFile;
import org.eclipse.osee.framework.jdk.core.util.Collections;
import org.eclipse.osee.framework.jdk.core.util.GUID;
-import org.eclipse.osee.framework.jdk.core.util.io.streams.StreamCatcher;
import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp;
import org.eclipse.osee.framework.plugin.core.config.ConfigUtil;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -108,14 +106,15 @@ public class WordRenderer extends FileRenderer {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- monitor.beginTask("Word Change Report ", newerArtifact.size());
-
+ monitor.beginTask("Word Change Report ", newerArtifact.size() * 2);
ArrayList<String> fileNames = new ArrayList<String>(newerArtifact.size());
IFolder baseFolder = getRenderFolder(branch, PresentationType.DIFF);
IFolder changeReportFolder = OseeData.getFolder(".diff/" + GUID.generateGuidStr());
- String baseFileStr = null;
+ String baseFileStr = "c:/UserData";
String fileName = null;
+ VbaWordDiffGenerator generator = new VbaWordDiffGenerator();
+ generator.initialize(false, true);
for (int i = 0; i < newerArtifact.size(); i++) {
IFile baseFile =
renderToFile(baseFolder, getFilenameFromArtifact(null, PresentationType.DIFF), branch,
@@ -130,7 +129,7 @@ public class WordRenderer extends FileRenderer {
fileName = baseFileStr + "/" + GUID.generateGuidStr() + ".xml";
fileNames.add(fileName);
- monitor.setTaskName("Processing diff for: " + (newerArtifact.get(i) == null ? baseArtifacts.get(i).getDescriptiveName() : newerArtifact.get(
+ monitor.setTaskName("Adding to Diff Script: " + (newerArtifact.get(i) == null ? baseArtifacts.get(i).getDescriptiveName() : newerArtifact.get(
i).getDescriptiveName()));
monitor.worked(1);
@@ -139,8 +138,12 @@ public class WordRenderer extends FileRenderer {
monitor.done();
return Status.CANCEL_STATUS;
}
- compare(baseFile, newerFile, fileName, false, plugin.getPluginFile("support/compareDocs.vbs"));
+ generator.addComparison(baseFile, newerFile, fileName, false);
+ //compare(baseFile, newerFile, fileName, false, plugin.getPluginStoreFile("support/compareDocs3.vbs"));
+
}
+ monitor.setTaskName("Running Diff Script");
+ generator.finish(baseFileStr + "/compareDocs.vbs");
createAggregateArtifactDiffReport(fileNames, baseFileStr, null, monitor);
} catch (Exception ex) {
return new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, Status.OK, ex.getLocalizedMessage(), ex);
@@ -243,38 +246,22 @@ public class WordRenderer extends FileRenderer {
getRenderFolder(baseVersion.getBranch(), PresentationType.EDIT).getLocation().toOSString() + '\\' + fileName;
}
+ VbaWordDiffGenerator diffGenerator = new VbaWordDiffGenerator();
+ diffGenerator.initialize(presentationType != PresentationType.MERGE, true);
+
if (presentationType == PresentationType.MERGE_EDIT && baseVersion != null) {
addFileToWatcher(getRenderFolder(baseVersion.getBranch(), PresentationType.EDIT),
diffPath.substring(diffPath.lastIndexOf('\\') + 1));
- compare(baseFile, newerFile, diffPath, false, plugin.getPluginFile("support/compareDocs2.vbs"));
+ diffGenerator.addComparison(baseFile, newerFile, diffPath, true);
+ diffGenerator.finish(diffPath.substring(0, diffPath.lastIndexOf('\\')) + "mergeDocs.vbs");
} else {
- compare(baseFile, newerFile, diffPath, presentationType != PresentationType.MERGE,
- plugin.getPluginFile("support/compareDocs.vbs"));
+ diffGenerator.addComparison(baseFile, newerFile, diffPath, false);
+ diffGenerator.finish(diffPath.substring(0, diffPath.lastIndexOf('\\')) + "/compareDocs.vbs");
}
return diffPath;
}
- private void compare(IFile baseFile, IFile newerFile, String diffPath, boolean visible, File vbDiffScript) throws IOException, InterruptedException {
-
- // quotes are neccessary because of Runtime.exec wraps the last element in quotes...crazy
- String cmd[] =
- {
- "cmd",
- "/s /c",
- "\"" + vbDiffScript.getPath() + "\"",
- "/author:CoolOseeUser\" /diffPath:\"" + diffPath + "\" /detectFormatChanges:True /ver1:\"" + baseFile.getLocation().toOSString() + "\" /ver2:\"" + newerFile.getLocation().toOSString() + "\" /visible:\"" + visible};
-
- Process proc = Runtime.getRuntime().exec(cmd);
-
- StreamCatcher errorCatcher = new StreamCatcher(proc.getErrorStream(), "ERROR", logger);
- StreamCatcher outputCatcher = new StreamCatcher(proc.getInputStream(), "OUTPUT");
-
- errorCatcher.start();
- outputCatcher.start();
- proc.waitFor();
- }
-
/**
* Displays a list of artifacts in the Artifact Explorer that could not be multi edited because they contained
* artifacts that had an OLEData attribute.
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java
index b96ddf59599..16f8c533334 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java
@@ -38,6 +38,7 @@ import org.eclipse.osee.framework.ui.skynet.render.FileSystemRenderer;
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.render.VbaWordDiffGenerator;
import org.eclipse.osee.framework.ui.skynet.util.OSEELog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -256,6 +257,8 @@ public class MergeUtility {
@Override
protected IStatus run(final IProgressMonitor monitor) {
try {
+ VbaWordDiffGenerator generator = new VbaWordDiffGenerator();
+ generator.initialize(false, true);
String sourceChangeFile =
MergeUtility.CreateMergeDiffFile(getStartArtifact(attributeConflict),
attributeConflict.getSourceArtifact(), null);
diff --git a/org.eclipse.osee.framework.ui.skynet/support/compareDocs.vbs b/org.eclipse.osee.framework.ui.skynet/support/compareDocs.vbs
deleted file mode 100644
index ed273fc0f8b..00000000000
--- a/org.eclipse.osee.framework.ui.skynet/support/compareDocs.vbs
+++ /dev/null
@@ -1,81 +0,0 @@
-Option Explicit
-
-Dim oWord
-Dim baseDoc
-Dim authorName
-Dim detectFormatChanges
-Dim namedArguments
-Dim ver1
-Dim ver2
-Dim diffPath
-Dim wdCompareTargetSelected
-Dim wdFormatXML
-Dim visible
-
-Public Sub main()
- wdCompareTargetSelected = 0 ' can you believe I have to define a system enum
- wdFormatXML = 11 'dude more than once
-
- Set namedArguments = WScript.Arguments.Named
-
- If namedArguments.Exists("author") Then
- authorName = namedArguments.Item("author")
- Else
- authorName = "OSEE Doc compare"
- End If
-
- If namedArguments.Exists("detectFormatChanges") Then
- detectFormatChanges = (namedArguments.Item("detectFormatChanges") = "True")
- Else
- detectFormatChanges = True
- End If
-
- If namedArguments.Exists("ver1") Then
- ver1 = namedArguments.Item("ver1")
- Else
- MsgBox "required argument ver1 is missing"
- Exit Sub
- End If
-
- If namedArguments.Exists("ver2") Then
- ver2 = namedArguments.Item("ver2")
- Else
- MsgBox "required argument ver2 is missing"
- Exit Sub
- End If
-
-
- If namedArguments.Exists("visible") Then
- visible = namedArguments.Item("visible")
- Else
- MsgBox "required argument visible is missing"
- Exit Sub
- End If
-
- If namedArguments.Exists("diffPath") Then
- diffPath = namedArguments.Item("diffPath")
- Else
- diffPath = "c:\UserData\diff.xml"
- End If
-
- 'Start Word and open the document.
- set oWord = WScript.CreateObject("Word.Application")
- oWord.Visible = False
-
- set baseDoc = oWord.Documents.Open (ver1)
-
- oWord.ActiveDocument.Compare ver2, authorName, wdCompareTargetSelected, detectFormatChanges, False, False
- oWord.ActiveDocument.SaveAs diffPath, wdFormatXML, , , False
-
- baseDoc.close()
-
- If visible Then
- oWord.Visible = True
- Else
- oWord.Quit()
- set oWord = Nothing
- End If
-'
-End Sub
-
-main \ No newline at end of file
diff --git a/org.eclipse.osee.framework.ui.skynet/support/compareDocs2.vbs b/org.eclipse.osee.framework.ui.skynet/support/compareDocs2.vbs
deleted file mode 100644
index 22f72884fa2..00000000000
--- a/org.eclipse.osee.framework.ui.skynet/support/compareDocs2.vbs
+++ /dev/null
@@ -1,83 +0,0 @@
-Option Explicit
-
-Dim oWord
-Dim baseDoc
-Dim authorName
-Dim detectFormatChanges
-Dim namedArguments
-Dim ver1
-Dim ver2
-Dim diffPath
-Dim wdCompareTargetSelected
-Dim wdFormattingFromCurrent
-Dim wdFormatXML
-Dim visible
-
-Public Sub main()
- wdCompareTargetSelected = 1 ' can you believe I have to define a system enum
- wdFormattingFromCurrent = 3
- wdFormatXML = 11 'dude more than once
-
- Set namedArguments = WScript.Arguments.Named
-
- If namedArguments.Exists("author") Then
- authorName = namedArguments.Item("author")
- Else
- authorName = "OSEE Doc compare"
- End If
-
- If namedArguments.Exists("detectFormatChanges") Then
- detectFormatChanges = (namedArguments.Item("detectFormatChanges") = "True")
- Else
- detectFormatChanges = True
- End If
-
- If namedArguments.Exists("ver1") Then
- ver1 = namedArguments.Item("ver1")
- Else
- MsgBox "required argument ver1 is missing"
- Exit Sub
- End If
-
- If namedArguments.Exists("ver2") Then
- ver2 = namedArguments.Item("ver2")
- Else
- MsgBox "required argument ver2 is missing"
- Exit Sub
- End If
-
-
- If namedArguments.Exists("visible") Then
- visible = namedArguments.Item("visible")
- Else
- MsgBox "required argument visible is missing"
- Exit Sub
- End If
-
- If namedArguments.Exists("diffPath") Then
- diffPath = namedArguments.Item("diffPath")
- Else
- diffPath = "c:\UserData\diff.xml"
- End If
-
- 'Start Word and open the document.
- set oWord = WScript.CreateObject("Word.Application")
- oWord.Visible = False
-
- set baseDoc = oWord.Documents.Open (ver1)
-
- baseDoc.Merge ver2, wdCompareTargetSelected, detectFormatChanges, wdFormattingFromCurrent, False
- oWord.ActiveDocument.SaveAs diffPath, wdFormatXML, , , False
-
- baseDoc.close()
-
- If visible Then
- oWord.Visible = True
- Else
- oWord.Quit()
- set oWord = Nothing
- End If
-'
-End Sub
-
-main \ No newline at end of file

Back to the top