Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjphillips2008-10-28 15:31:26 +0000
committerjphillips2008-10-28 15:31:26 +0000
commit20b50d6b226e8cf8fdaca5b7267f261cc1eb628f (patch)
tree76e8f012d604fce88538fb9c30fb9d886078f917 /org.eclipse.osee.framework.ui.skynet
parent473d187d2e13407590861d5ad37fdf6208042633 (diff)
downloadorg.eclipse.osee-20b50d6b226e8cf8fdaca5b7267f261cc1eb628f.tar.gz
org.eclipse.osee-20b50d6b226e8cf8fdaca5b7267f261cc1eb628f.tar.xz
org.eclipse.osee-20b50d6b226e8cf8fdaca5b7267f261cc1eb628f.zip
Diffstat (limited to 'org.eclipse.osee.framework.ui.skynet')
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/FixWordTemplateContent.java38
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesBetweenCurrentAndParentHandler.java2
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesMadeToHandler.java2
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesToParentHandler.java2
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/ArtifactDiffMenu.java260
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java4
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/Renderer.java8
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java26
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactJob.java18
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeDocumentRenderer.java10
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java49
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java6
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java2
13 files changed, 212 insertions, 215 deletions
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/FixWordTemplateContent.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/FixWordTemplateContent.java
index cb76e1d9fc3..890d5c82a7a 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/FixWordTemplateContent.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/FixWordTemplateContent.java
@@ -6,11 +6,13 @@ import java.util.regex.Pattern;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.db.connection.exception.OseeArgumentException;
+import org.eclipse.osee.framework.db.connection.exception.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.Branch;
import org.eclipse.osee.framework.skynet.core.artifact.WordArtifact;
import org.eclipse.osee.framework.ui.skynet.blam.BlamVariableMap;
import org.eclipse.osee.framework.ui.skynet.blam.WorkflowEditor;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
/**
*
@@ -30,41 +32,25 @@ public class FixWordTemplateContent implements BlamOperation {
}
@Override
- public void runOperation(BlamVariableMap variableMap,
- IProgressMonitor monitor) throws Exception {
-
-
+ public void runOperation(BlamVariableMap variableMap, IProgressMonitor monitor) throws Exception {
Collection<Artifact> artifacts = variableMap.getArtifacts("Artifacts");
for(Artifact artifact : artifacts){
//template word artifacts only
if(artifact instanceof WordArtifact && !((WordArtifact)artifact).isWholeWordArtifact()){
WordArtifact wordArtifact = (WordArtifact)artifact;
- String wordContent = wordArtifact.getContent();
+ String content = wordArtifact.getContent();
- Matcher pgMatcher = Pattern.compile("<w:pgMar(.*?)>").matcher(wordContent);
- if(pgMatcher.find()){
- System.err.println(wordArtifact.getDescriptiveName() + " Has: w:pgMar");
-
- if(fix){
- wordContent = wordContent.replace(wordContent.substring(pgMatcher.start(), pgMatcher.end()), "");
- }
- }
-
- Matcher hdMatcher = Pattern.compile("<w:hdr(.*?)>").matcher(wordContent);
- if(hdMatcher.find()){
- System.err.println(wordArtifact.getDescriptiveName() + " Has: w:hdr");
-
- if(fix){
- wordContent = wordContent.replace(wordContent.substring(hdMatcher.start(), hdMatcher.end()), "");
- }
- }
-
+ String[] splitString = content.split(WordMLProducer.LISTNUM_FIELD_TAIL_REG_EXP);
+ if (splitString.length >= 2 && fix) {
+ content = splitString[0] + "</w:p></wx:sect>";
+ content = content.replace(WordMLProducer.LISTNUM_FIELD_HEAD, "");
+ } else {
+ throw new OseeCoreException(
+ "There were errors removing template information from the Word content prior to saving. Content was not saved.");
+ }
}
}
-// if(wordContent.contains("hdr")){
-// System.err.println("hdr");
-// }
}
/*
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesBetweenCurrentAndParentHandler.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesBetweenCurrentAndParentHandler.java
index c8f01942616..f1b895e2a91 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesBetweenCurrentAndParentHandler.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesBetweenCurrentAndParentHandler.java
@@ -51,7 +51,7 @@ public class WordChangesBetweenCurrentAndParentHandler extends AbstractHandler {
Artifact secondArtifact =
ArtifactPersistenceManager.getInstance().getArtifactFromId(artifactChange.getArtifact().getArtId(),
artifactChange.getToTransactionId());
- RendererManager.diffInJob(artifactChange.getConflictingModArtifact(), secondArtifact, null);
+ RendererManager.diffInJob(artifactChange.getConflictingModArtifact(), secondArtifact);
} catch (OseeCoreException ex) {
OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
}
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesMadeToHandler.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesMadeToHandler.java
index dddb9923add..c97d89a7ef1 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesMadeToHandler.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesMadeToHandler.java
@@ -66,7 +66,7 @@ public class WordChangesMadeToHandler extends AbstractHandler {
artifactChange.getModType() == DELETED ? null : ArtifactPersistenceManager.getInstance().getArtifactFromId(
artifactChange.getArtifact().getArtId(), artifactChange.getToTransactionId());
- RendererManager.diffInJob(firstArtifact, secondArtifact, null);
+ RendererManager.diffInJob(firstArtifact, secondArtifact);
}
@Override
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesToParentHandler.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesToParentHandler.java
index 9f1d0e3db22..0da74c46b76 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesToParentHandler.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/WordChangesToParentHandler.java
@@ -63,7 +63,7 @@ public class WordChangesToParentHandler extends AbstractHandler {
selectedArtifactChange.getModType() == DELETED ? null : ArtifactQuery.getArtifactFromId(
selectedArtifactChange.getArtifact().getArtId(), parentBranch);
- RendererManager.diffInJob(firstArtifact, secondArtifact, null);
+ RendererManager.diffInJob(firstArtifact, secondArtifact);
} catch (Exception ex) {
OSEELog.logException(getClass(), ex, true);
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/ArtifactDiffMenu.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/ArtifactDiffMenu.java
index b90dcc38fed..769ead4ca77 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/ArtifactDiffMenu.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/ArtifactDiffMenu.java
@@ -1,130 +1,130 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.menu;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactPersistenceManager;
-import org.eclipse.osee.framework.skynet.core.artifact.WordArtifact;
-import org.eclipse.osee.framework.skynet.core.revision.TransactionData;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.events.MenuListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-/**
- * @author Jeff C. Phillips
- */
-public class ArtifactDiffMenu {
-
- public enum DiffTypes {
- CONFLICT, PARENT
- }
-
- private static final String DIFF_ARTIFACT = "DIFF_ARTIFACT";
- private static boolean validSelection;
- private static Object firstSelection;
- private static Object secondSelection;
-
- public static void createDiffMenuItem(Menu parentMenu, final Viewer viewer, String subMenuText, final DiffTypes diffType) {
- final MenuItem diffMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
- diffMenuItem.setText(subMenuText);
-
- final Menu submenu = new Menu(diffMenuItem);
- diffMenuItem.setMenu(submenu);
-
- final MenuItem stdDiffMenuItem = new MenuItem(submenu, SWT.PUSH);
- stdDiffMenuItem.setText("Standard Diff");
-
- stdDiffMenuItem.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent ev) {
- try {
- processSelectedArtifacts(null, viewer, diffType);
- } catch (Exception ex) {
- }
- }
- });
-
- final MenuItem diffArtifactMenuItem = new MenuItem(submenu, SWT.PUSH);
- diffArtifactMenuItem.setText("Diff Artifact");
-
- diffArtifactMenuItem.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent ev) {
- try {
- processSelectedArtifacts(DIFF_ARTIFACT, viewer, diffType);
- } catch (Exception ex) {
- }
- }
- });
-
- parentMenu.addMenuListener(new MenuListener() {
-
- public void menuHidden(MenuEvent e) {
- }
-
- public void menuShown(MenuEvent e) {
- validSelection = false;
-
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
-
- if (!selection.isEmpty()) {
- if (selection.size() == 2) {
- validSelection = validateTransactionData(viewer, selection);
- }
- }
- diffMenuItem.setEnabled(validSelection);
- }
- });
- }
-
- private static boolean validateTransactionData(Viewer viewer, IStructuredSelection selection) {
- boolean valid = false;
- Object[] selections = selection.toArray();
-
- if (selections[1] instanceof TransactionData && selections[0] instanceof TransactionData) {
- Artifact selectedArtifact = (Artifact) viewer.getInput();
- valid = (selectedArtifact instanceof WordArtifact);
- }
- return valid;
- }
-
- private static void processSelectedArtifacts(String option, Viewer viewer, DiffTypes type) throws Exception {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- WordArtifact firstArtifact = null;
- WordArtifact secondArtifact = null;
-
- if (selection.size() == 2) {
- Object[] selections = selection.toArray();
- firstSelection = selections[1];
- secondSelection = selections[0];
-
- if (firstSelection instanceof TransactionData && secondSelection instanceof TransactionData) {
- TransactionData firstTransactionData = (TransactionData) firstSelection;
- TransactionData secondTransactionData = (TransactionData) secondSelection;
-
- firstArtifact =
- (WordArtifact) ArtifactPersistenceManager.getInstance().getArtifactFromId(
- firstTransactionData.getAssociatedArtId(), firstTransactionData.getTransactionId());
- secondArtifact =
- (WordArtifact) ArtifactPersistenceManager.getInstance().getArtifactFromId(
- secondTransactionData.getAssociatedArtId(), secondTransactionData.getTransactionId());
- }
- }
- RendererManager.diffInJob(secondArtifact, firstArtifact, null);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 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.menu;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactPersistenceManager;
+import org.eclipse.osee.framework.skynet.core.artifact.WordArtifact;
+import org.eclipse.osee.framework.skynet.core.revision.TransactionData;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.MenuListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ArtifactDiffMenu {
+
+ public enum DiffTypes {
+ CONFLICT, PARENT
+ }
+
+ private static final String DIFF_ARTIFACT = "DIFF_ARTIFACT";
+ private static boolean validSelection;
+ private static Object firstSelection;
+ private static Object secondSelection;
+
+ public static void createDiffMenuItem(Menu parentMenu, final Viewer viewer, String subMenuText, final DiffTypes diffType) {
+ final MenuItem diffMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
+ diffMenuItem.setText(subMenuText);
+
+ final Menu submenu = new Menu(diffMenuItem);
+ diffMenuItem.setMenu(submenu);
+
+ final MenuItem stdDiffMenuItem = new MenuItem(submenu, SWT.PUSH);
+ stdDiffMenuItem.setText("Standard Diff");
+
+ stdDiffMenuItem.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent ev) {
+ try {
+ processSelectedArtifacts(null, viewer, diffType);
+ } catch (Exception ex) {
+ }
+ }
+ });
+
+ final MenuItem diffArtifactMenuItem = new MenuItem(submenu, SWT.PUSH);
+ diffArtifactMenuItem.setText("Diff Artifact");
+
+ diffArtifactMenuItem.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent ev) {
+ try {
+ processSelectedArtifacts(DIFF_ARTIFACT, viewer, diffType);
+ } catch (Exception ex) {
+ }
+ }
+ });
+
+ parentMenu.addMenuListener(new MenuListener() {
+
+ public void menuHidden(MenuEvent e) {
+ }
+
+ public void menuShown(MenuEvent e) {
+ validSelection = false;
+
+ IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+
+ if (!selection.isEmpty()) {
+ if (selection.size() == 2) {
+ validSelection = validateTransactionData(viewer, selection);
+ }
+ }
+ diffMenuItem.setEnabled(validSelection);
+ }
+ });
+ }
+
+ private static boolean validateTransactionData(Viewer viewer, IStructuredSelection selection) {
+ boolean valid = false;
+ Object[] selections = selection.toArray();
+
+ if (selections[1] instanceof TransactionData && selections[0] instanceof TransactionData) {
+ Artifact selectedArtifact = (Artifact) viewer.getInput();
+ valid = (selectedArtifact instanceof WordArtifact);
+ }
+ return valid;
+ }
+
+ private static void processSelectedArtifacts(String option, Viewer viewer, DiffTypes type) throws Exception {
+ IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ WordArtifact firstArtifact = null;
+ WordArtifact secondArtifact = null;
+
+ if (selection.size() == 2) {
+ Object[] selections = selection.toArray();
+ firstSelection = selections[1];
+ secondSelection = selections[0];
+
+ if (firstSelection instanceof TransactionData && secondSelection instanceof TransactionData) {
+ TransactionData firstTransactionData = (TransactionData) firstSelection;
+ TransactionData secondTransactionData = (TransactionData) secondSelection;
+
+ firstArtifact =
+ (WordArtifact) ArtifactPersistenceManager.getInstance().getArtifactFromId(
+ firstTransactionData.getAssociatedArtId(), firstTransactionData.getTransactionId());
+ secondArtifact =
+ (WordArtifact) ArtifactPersistenceManager.getInstance().getArtifactFromId(
+ secondTransactionData.getAssociatedArtId(), secondTransactionData.getTransactionId());
+ }
+ }
+ RendererManager.diffInJob(secondArtifact, firstArtifact);
+ }
+}
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java
index 612c53f3ad1..70c2d9c1430 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java
@@ -49,9 +49,9 @@ public interface IRenderer {
public boolean supportsPrint();
- public String compare(Artifact baseVersion, Artifact newerVersion, IProgressMonitor monitor, String fileName, PresentationType presentationType, boolean show) throws OseeCoreException;
+ public String compare(Artifact baseVersion, Artifact newerVersion, IProgressMonitor monitor, PresentationType presentationType, boolean show) throws OseeCoreException;
- public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, String fileName, PresentationType presentationType, boolean show) throws OseeCoreException;
+ public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, PresentationType presentationType, boolean show) throws OseeCoreException;
public void compareArtifacts(List<Artifact> baseArtifacts, List<Artifact> newerArtifact, IProgressMonitor monitor, Branch branch, PresentationType presentationType) throws OseeCoreException;
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/Renderer.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/Renderer.java
index 44949bf0b88..a4490284ab3 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/Renderer.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/Renderer.java
@@ -132,11 +132,13 @@ public abstract class Renderer implements IRenderer {
/* (non-Javadoc)
* @see org.eclipse.osee.framework.ui.skynet.render.IRenderer#compare(org.eclipse.osee.framework.skynet.core.artifact.Artifact, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
- public String compare(Artifact baseVersion, Artifact newerVersion, IProgressMonitor monitor, String fileName, PresentationType presentationType, boolean show) throws OseeCoreException {
+ @Override
+ public String compare(Artifact baseVersion, Artifact newerVersion, IProgressMonitor monitor, PresentationType presentationType, boolean show) throws OseeCoreException {
throw new UnsupportedOperationException();
}
- public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, String fileName, PresentationType presentationType, boolean show) throws OseeCoreException {
+ @Override
+ public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, PresentationType presentationType, boolean show) throws OseeCoreException {
throw new UnsupportedOperationException();
}
@@ -146,7 +148,7 @@ public abstract class Renderer implements IRenderer {
@Override
public void compareArtifacts(List<Artifact> baseArtifacts, List<Artifact> newerArtifacts, IProgressMonitor monitor, Branch branch, PresentationType presentationType) throws OseeCoreException {
for (int i = 0; i < baseArtifacts.size(); i++) {
- compare(baseArtifacts.get(i), newerArtifacts.get(i), monitor, null, presentationType, true);
+ compare(baseArtifacts.get(i), newerArtifacts.get(i), monitor, presentationType, true);
}
}
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java
index 8a0fc2f3942..7b1655c2cb2 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java
@@ -210,20 +210,20 @@ public class RendererManager {
}
public static String merge(Artifact baseVersion, Artifact newerVersion, IProgressMonitor monitor, String fileName, boolean show) throws OseeStateException, OseeCoreException {
- return getBestRenderer(PresentationType.MERGE, baseVersion).compare(baseVersion, newerVersion, monitor, fileName,
- PresentationType.MERGE, show);
+ return getBestRenderer(PresentationType.MERGE, baseVersion, "fileName", fileName).compare(baseVersion,
+ newerVersion, monitor, PresentationType.MERGE, show);
}
public static String merge(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, String fileName, boolean show) throws OseeCoreException {
- return getBestRenderer(PresentationType.MERGE_EDIT, baseVersion).compare(baseVersion, newerVersion, baseFile,
- newerFile, fileName, PresentationType.MERGE_EDIT, show);
+ return getBestRenderer(PresentationType.MERGE_EDIT, baseVersion, "fileName", fileName).compare(baseVersion,
+ newerVersion, baseFile, newerFile, PresentationType.MERGE_EDIT, show);
}
- public static void diffInJob(final Artifact baseVersion, final Artifact newerVersion, final String fileName, final String... options) {
+ public static void diffInJob(final Artifact baseVersion, final Artifact newerVersion, final String... options) {
IExceptionableRunnable runnable = new IExceptionableRunnable() {
public void run(IProgressMonitor monitor) throws OseeCoreException {
- diff(baseVersion, newerVersion, fileName, true, options);
+ diff(baseVersion, newerVersion, true, options);
}
};
@@ -233,21 +233,15 @@ public class RendererManager {
}
- public static String diff(final Artifact baseVersion, final Artifact newerVersion, final String fileName, IProgressMonitor monitor, boolean show, final String... options) throws OseeCoreException {
+ public static String diff(final Artifact baseVersion, final Artifact newerVersion, IProgressMonitor monitor, boolean show, final String... options) throws OseeCoreException {
// To handle comparisons with new or deleted artifacts
Artifact artifactToSelectRender = baseVersion == null ? newerVersion : baseVersion;
-
IRenderer renderer = getBestRenderer(PresentationType.DIFF, artifactToSelectRender, options);
- return renderer.compare(baseVersion, newerVersion, new NullProgressMonitor(), fileName, PresentationType.DIFF,
- show);
+ return renderer.compare(baseVersion, newerVersion, new NullProgressMonitor(), PresentationType.DIFF, show);
}
- public static String diff(final Artifact baseVersion, final Artifact newerVersion, final String fileName, boolean show, final String... options) throws OseeCoreException {
- return diff(baseVersion, newerVersion, fileName, new NullProgressMonitor(), show, options);
- }
-
- public static String diff(final Artifact baseVersion, final Artifact newerVersion, IProgressMonitor monitor, boolean show, final String... options) throws OseeCoreException {
- return diff(baseVersion, newerVersion, null, monitor, show, options);
+ public static String diff(final Artifact baseVersion, final Artifact newerVersion, boolean show, final String... options) throws OseeCoreException {
+ return diff(baseVersion, newerVersion, new NullProgressMonitor(), show, options);
}
public static void diffInJob(final List<Artifact> baseArtifacts, final List<Artifact> newerArtifacts, final String... options) {
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactJob.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactJob.java
index d06df18a641..9f5f3d01b68 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactJob.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactJob.java
@@ -233,18 +233,14 @@ public class UpdateArtifactJob extends UpdateJob {
}
//This code pulls out all of the stuff after the inserted listnum reordering stuff. This needs to be
//here so that we remove unwanted template information from single editing
- if (content.contains(WordMLProducer.LISTNUM_FIELD)) {
- content = content.substring(0, content.indexOf(WordMLProducer.LISTNUM_FIELD)) + "</wx:sect>";
+
+ String[] splitString = content.split(WordMLProducer.LISTNUM_FIELD_TAIL_REG_EXP);
+ if (splitString.length == 2) {
+ content = splitString[0] + "</w:p></wx:sect>";
+ content = content.replace(WordMLProducer.LISTNUM_FIELD_HEAD, "");
} else {
- int index = content.indexOf(WordMLProducer.LISTNUM_FIELD_TAIL);
- if (index >= 0) {
- content =
- content.substring(0, content.indexOf(WordMLProducer.LISTNUM_FIELD_TAIL)) + "</w:p></wx:sect>";
- content = content.replace(WordMLProducer.LISTNUM_FIELD_HEAD, "");
- } else {
- throw new OseeCoreException(
- "There were errors removing template information from the Word content prior to saving");
- }
+ throw new OseeCoreException(
+ "There were errors removing template information from the Word content prior to saving. Content was not saved.");
}
if (DEBUG) {
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 a608d73ec7e..fbffb94a2c6 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
@@ -28,9 +28,7 @@ import org.eclipse.osee.framework.skynet.core.attribute.WordWholeDocumentAttribu
import org.eclipse.osee.framework.skynet.core.word.WordUtil;
/**
- *
* @author Jeff C. Phillips
- *
*/
public class WholeDocumentRenderer extends WordRenderer {
@@ -98,7 +96,7 @@ public class WholeDocumentRenderer extends WordRenderer {
}
@Override
- public String compare(Artifact baseVersion, Artifact newerVersion, IProgressMonitor monitor, String fileName, PresentationType presentationType, boolean show) throws OseeCoreException {
+ public String compare(Artifact baseVersion, Artifact newerVersion, IProgressMonitor monitor, PresentationType presentationType, boolean show) throws OseeCoreException {
if (baseVersion == null && newerVersion == null) throw new IllegalArgumentException(
"baseVersion and newerVersion can't both be null.");
@@ -126,13 +124,13 @@ public class WholeDocumentRenderer extends WordRenderer {
newerFile = renderForDiff(monitor, branch);
}
- return compare(baseVersion, newerVersion, baseFile, newerFile, fileName, presentationType, show);
+ return compare(baseVersion, newerVersion, baseFile, newerFile, presentationType, show);
}
@Override
- public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, String fileName, PresentationType presentationType, boolean show) throws OseeCoreException {
+ public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, PresentationType presentationType, boolean show) throws OseeCoreException {
String diffPath;
-
+ String fileName = getOption("filename");
if (fileName == null || fileName.equals("")) {
if (baseVersion != null) {
String baseFileStr = baseFile.getLocation().toOSString();
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
index 36a3ea38c33..7fc470b53a2 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
@@ -16,6 +16,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
@@ -109,12 +110,24 @@ public class WordTemplateRenderer extends WordRenderer implements ITemplateRende
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
+ String file = getOption("fileName");
+ if (file == null) {
+ if (baseArtifacts.size() == 1) {
+ file =
+ (newerArtifact.get(0) != null ? newerArtifact.get(0).getSafeName() : baseArtifacts.get(0).getSafeName()) + (new Date()).toString().replaceAll(
+ ":", ";") + ".xml";
+ } else {
+ file =
+ "Word_Change_Report_" + baseArtifacts.size() + "_Items_" + (new Date()).toString().replaceAll(
+ ":", ";") + ".xml";
+ }
+ }
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 = "c:/UserData";
- String fileName = null;
+ String localFileName = null;
VbaWordDiffGenerator generator = new VbaWordDiffGenerator();
generator.initialize(false, false);
@@ -127,8 +140,8 @@ public class WordTemplateRenderer extends WordRenderer implements ITemplateRende
getRenderInputStream(newerArtifact.get(i), PresentationType.DIFF), PresentationType.DIFF);
baseFileStr = changeReportFolder.getLocation().toOSString();
- fileName = baseFileStr + "/" + GUID.generateGuidStr() + ".xml";
- fileNames.add(fileName);
+ localFileName = baseFileStr + "/" + GUID.generateGuidStr() + ".xml";
+ fileNames.add(localFileName);
monitor.setTaskName("Adding to Diff Script: " + (newerArtifact.get(i) == null ? baseArtifacts.get(i).getDescriptiveName() : newerArtifact.get(
i).getDescriptiveName()));
@@ -139,17 +152,17 @@ public class WordTemplateRenderer extends WordRenderer implements ITemplateRende
monitor.done();
return Status.CANCEL_STATUS;
}
- generator.addComparison(baseFile, newerFile, fileName, false);
+ generator.addComparison(baseFile, newerFile, localFileName, false);
//compare(baseFile, newerFile, fileName, false, plugin.getPluginStoreFile("support/compareDocs3.vbs"));
}
monitor.setTaskName("Running Diff Script");
generator.finish(baseFileStr + "/compareDocs.vbs");
- if (fileNames.size() == 1) {
- getAssociatedProgram(null).execute(fileNames.get(0));
- } else {
- createAggregateArtifactDiffReport(fileNames, baseFileStr, null, monitor);
- }
+ //if (fileNames.size() == 1) {
+ // getAssociatedProgram(null).execute(baseFileStr + fileName);
+ // } else {
+ createAggregateArtifactDiffReport(fileNames, baseFileStr, null, baseFileStr + "/" + file, monitor);
+ // }
} catch (OseeCoreException ex) {
return new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, Status.OK, ex.getLocalizedMessage(), ex);
}
@@ -158,7 +171,7 @@ public class WordTemplateRenderer extends WordRenderer implements ITemplateRende
});
}
- private void createAggregateArtifactDiffReport(ArrayList<String> fileNames, String baseFileStr, Artifact artifact, IProgressMonitor monitor) throws OseeCoreException {
+ private void createAggregateArtifactDiffReport(ArrayList<String> fileNames, String baseFileStr, Artifact artifact, String fileName, IProgressMonitor monitor) throws OseeCoreException {
monitor.setTaskName("Writing final document");
ArrayList<String> datas = new ArrayList<String>(fileNames.size());
int startIndex;
@@ -192,16 +205,17 @@ public class WordTemplateRenderer extends WordRenderer implements ITemplateRende
if (!file.contains("xmlns:ns1=\"http")) {
file = file.replaceAll("ns1", "ns0");
}
-
- String diffFile = baseFileStr + "/" + GUID.generateGuidStr() + "_diff.xml";
- AFile.writeFile(diffFile, file);
+ if (fileName == null) {
+ fileName = baseFileStr + "/" + GUID.generateGuidStr() + "_diff.xml";
+ }
+ AFile.writeFile(fileName, file);
monitor.done();
- getAssociatedProgram(artifact).execute(diffFile);
+ getAssociatedProgram(artifact).execute(fileName);
}
@Override
- public String compare(Artifact baseVersion, Artifact newerVersion, IProgressMonitor monitor, String fileName, PresentationType presentationType, boolean show) throws OseeCoreException {
+ public String compare(Artifact baseVersion, Artifact newerVersion, IProgressMonitor monitor, PresentationType presentationType, boolean show) throws OseeCoreException {
if (baseVersion == null && newerVersion == null) throw new OseeArgumentException(
"baseVersion and newerVersion can't both be null.");
@@ -229,13 +243,14 @@ public class WordTemplateRenderer extends WordRenderer implements ITemplateRende
newerFile = renderForDiff(monitor, branch);
}
- return compare(baseVersion, newerVersion, baseFile, newerFile, fileName, presentationType, show);
+ return compare(baseVersion, newerVersion, baseFile, newerFile, presentationType, show);
}
@Override
- public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, String fileName, PresentationType presentationType, boolean show) throws OseeCoreException {
+ public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, PresentationType presentationType, boolean show) throws OseeCoreException {
String diffPath;
+ String fileName = getOption("fileName");
if (fileName == null || fileName.equals("")) {
if (baseVersion != null) {
String baseFileStr = baseFile.getLocation().toOSString();
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java
index 1de71031af5..1e174c60372 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java
@@ -38,6 +38,11 @@ public class WordMLProducer {
public static final String LISTNUM_FIELD_HEAD = "<w:pPr><w:rPr><w:vanish/></w:rPr></w:pPr>";
public static final String LISTNUM_FIELD_TAIL =
"<w:r><w:rPr><w:vanish/></w:rPr><w:fldChar w:fldCharType=\"begin\"/></w:r><w:r><w:rPr><w:vanish/></w:rPr><w:instrText> LISTNUM \"listreset\" \\l 1 \\s 0 </w:instrText></w:r><w:r><w:rPr><w:vanish/></w:rPr><w:fldChar w:fldCharType=\"end\"/><wx:t wx:val=\" .\"/></w:r>";
+
+ //This regular expression pulls out all of the stuff after the inserted listnum reordering stuff. This needs to be
+ //here so that we remove unwanted template information from single editing
+ public static final String LISTNUM_FIELD_TAIL_REG_EXP =
+ "<w:r(>| .*?>)<w:rPr><w:vanish/></w:rPr><w:fldChar w:fldCharType=\"begin\"/></w:r><w:r(>| .*?>)<w:rPr><w:vanish/></w:rPr><w:instrText> LISTNUM \"listreset\"";
public static final String LISTNUM_FIELD = "<w:p>" + LISTNUM_FIELD_HEAD + LISTNUM_FIELD_TAIL + "</w:p>";
private static final String SUB_DOC =
"<wx:sect><w:p><w:pPr><w:sectPr><w:pgSz w:w=\"12240\" w:h=\"15840\"/><w:pgMar w:top=\"1440\" w:right=\"1800\" w:bottom=\"1440\" w:left=\"1800\" w:header=\"720\" w:footer=\"720\" w:gutter=\"0\"/><w:cols w:space=\"720\"/><w:docGrid w:line-pitch=\"360\"/></w:sectPr></w:pPr></w:p><w:subDoc w:link=\"" + FILE_NAME + "\"/></wx:sect><wx:sect><wx:sub-section><w:p><w:pPr><w:pStyle w:val=\"Heading1\"/></w:pPr></w:p><w:sectPr><w:type w:val=\"continuous\"/><w:pgSz w:w=\"12240\" w:h=\"15840\"/><w:pgMar w:top=\"1440\" w:right=\"1800\" w:bottom=\"1440\" w:left=\"1800\" w:header=\"720\" w:footer=\"720\" w:gutter=\"0\"/><w:cols w:space=\"720\"/><w:docGrid w:line-pitch=\"360\"/></w:sectPr></wx:sub-section></wx:sect>";
@@ -173,6 +178,7 @@ public class WordMLProducer {
public void resetListValue() throws OseeWrappedException {
startParagraph();
+ //The listnum also acts a template delimiter to know when to remove unwanted content.
addWordMl(LISTNUM_FIELD);
endParagraph();
}
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 33af5c7335d..5f23e735ef1 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
@@ -120,7 +120,7 @@ public class MergeUtility {
*/
public static String showCompareFile(Artifact art1, Artifact art2, String fileName) throws Exception {
if (art1 == null || art2 == null) return " ";
- return RendererManager.diff(art1, art2, fileName, true);
+ return RendererManager.diff(art1, art2, true, "fileName", fileName);
}
/*

Back to the top