Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbroberts2018-10-30 22:39:22 +0000
committerDavid Miller2018-11-07 17:52:07 +0000
commit208e80ac450e7307fef09f630553f7d4c7d95b1a (patch)
tree1a341dff35e53dc90138526e859648598af4fdcc
parent56294176e34bab170e4596a0d6fa04b55061d9f5 (diff)
downloadorg.eclipse.osee-208e80ac450e7307fef09f630553f7d4c7d95b1a.tar.gz
org.eclipse.osee-208e80ac450e7307fef09f630553f7d4c7d95b1a.tar.xz
org.eclipse.osee-208e80ac450e7307fef09f630553f7d4c7d95b1a.zip
bug: Fix Artifact is historical exception
Change-Id: Id4432ba6da3191583448411ba9c4c558b54aef61 Signed-off-by: broberts <baily.e.roberts@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/DiffHandler.java143
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeCustomMenu.java33
2 files changed, 73 insertions, 103 deletions
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 d3ce5942cbe..74e61707393 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,13 +11,10 @@
package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
-import java.util.LinkedList;
import java.util.List;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -88,98 +85,88 @@ class DiffHandler extends AbstractSelectionEnabledHandler {
@Override
public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- artifacts = new LinkedList<>();
+
List<Conflict> conflicts = Handlers.getConflictsFromStructuredSelection(structuredSelection);
if (conflicts.size() != 1) {
return false;
}
+
if (conflicts.get(0) instanceof AttributeConflict) {
attributeConflict = (AttributeConflict) conflicts.get(0);
artifactConflict = null;
- try {
- switch (diffToShow) {
- case 1:
- if (attributeConflict.getSourceArtifact() != null && MergeUtility.getStartArtifact(
- attributeConflict) != null) {
- artifacts.add(attributeConflict.getSourceArtifact());
- artifacts.add(MergeUtility.getStartArtifact(attributeConflict));
- } else {
- return false;
- }
- break;
- case 2:
- if (attributeConflict.getDestArtifact() != null && MergeUtility.getStartArtifact(
- attributeConflict) != null) {
- artifacts.add(attributeConflict.getDestArtifact());
- artifacts.add(MergeUtility.getStartArtifact(attributeConflict));
- } else {
- return false;
- }
- break;
- case 3:
- if (attributeConflict.getDestArtifact() != null && attributeConflict.getSourceArtifact() != null) {
- artifacts.add(attributeConflict.getSourceArtifact());
- artifacts.add(attributeConflict.getDestArtifact());
- } else {
- return false;
- }
- break;
- case 4:
- if (attributeConflict.getSourceArtifact() != null && attributeConflict.getArtifact() != null) {
- artifacts.add(attributeConflict.getSourceArtifact());
- artifacts.add(attributeConflict.getArtifact());
- } else {
- return false;
- }
- break;
- case 5:
- if (attributeConflict.getDestArtifact() != null && attributeConflict.getArtifact() != null) {
- artifacts.add(attributeConflict.getDestArtifact());
- artifacts.add(attributeConflict.getArtifact());
- } else {
- return false;
- }
- break;
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ boolean diffToShowChecker = diffToShowNullChecker();
+ if (diffToShowChecker == false) {
+ return diffToShowChecker;
}
-
} else if (conflicts.get(0) instanceof ArtifactConflict) {
attributeConflict = null;
artifactConflict = (ArtifactConflict) conflicts.get(0);
- try {
- switch (diffToShow) {
- case 1:
- if (artifactConflict.getSourceArtifact() != null && MergeUtility.getStartArtifact(
- artifactConflict) != null) {
- artifacts.add(artifactConflict.getSourceArtifact());
- artifacts.add(MergeUtility.getStartArtifact(artifactConflict));
- } else {
- return false;
- }
- break;
- case 2:
- if (artifactConflict.getDestArtifact() != null && conflicts.get(
- 0).getStatus().isInformational() && MergeUtility.getStartArtifact(artifactConflict) != null) {
- artifacts.add(artifactConflict.getDestArtifact());
- artifacts.add(MergeUtility.getStartArtifact(artifactConflict));
- } else {
- return false;
- }
- break;
- case 3:
+
+ boolean oneAndTwoChecker = diffToShowOneAndTwoChecker(conflicts);
+ if (oneAndTwoChecker == false) {
+ return oneAndTwoChecker;
+ }
+ }
+ return true;
+ }
+
+ private boolean diffToShowOneAndTwoChecker(List<Conflict> conflicts) {
+ try {
+
+ if (diffToShow <= 5 && diffToShow >= 1) {
+ if (diffToShow == 1) {
+ if (artifactConflict.getSourceArtifact() == null || MergeUtility.getStartArtifact(
+ artifactConflict) == null) {
+ return false;
+ }
+ } else if (diffToShow == 2) {
+ if (artifactConflict.getDestArtifact() == null || !conflicts.get(
+ 0).getStatus().isInformational() || MergeUtility.getStartArtifact(artifactConflict) == null) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return true;
+ }
+
+ private boolean diffToShowNullChecker() {
+ try {
+
+ if (diffToShow <= 5 && diffToShow >= 1) {
+ if (diffToShow == 1) {
+ if (attributeConflict.getSourceArtifact() == null || MergeUtility.getStartArtifact(
+ attributeConflict) == null) {
return false;
- case 4:
+ }
+ } else if (diffToShow == 2) {
+ if (attributeConflict.getDestArtifact() == null || MergeUtility.getStartArtifact(
+ attributeConflict) == null) {
+ return false;
+ }
+ } else if (diffToShow == 3) {
+ if (attributeConflict.getDestArtifact() == null || attributeConflict.getSourceArtifact() == null) {
return false;
- case 5:
+ }
+ } else if (diffToShow == 4) {
+ if (attributeConflict.getSourceArtifact() == null || attributeConflict.getArtifact() == null) {
return false;
+ }
+ } else {
+ if (attributeConflict.getDestArtifact() == null || attributeConflict.getArtifact() == null) {
+ return false;
+ }
}
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
}
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
}
- return AccessControlManager.hasPermission(artifacts, PermissionEnum.READ);
+ return true;
}
} \ 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/MergeCustomMenu.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeCustomMenu.java
index a52e88bf6ee..879520e865f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeCustomMenu.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeCustomMenu.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
-import java.util.LinkedList;
import java.util.List;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
@@ -24,9 +23,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.nebula.widgets.xviewer.XViewer;
import org.eclipse.nebula.widgets.xviewer.customize.XViewerCustomMenu;
-import org.eclipse.osee.framework.access.AccessControlManager;
import org.eclipse.osee.framework.core.enums.ConflictStatus;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
import org.eclipse.osee.framework.core.enums.PresentationType;
import org.eclipse.osee.framework.core.operation.IOperation;
import org.eclipse.osee.framework.core.operation.Operations;
@@ -470,38 +467,24 @@ public class MergeCustomMenu extends XViewerCustomMenu {
@Override
public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- artifacts = new LinkedList<>();
+
List<Conflict> conflicts = Handlers.getConflictsFromStructuredSelection(structuredSelection);
for (Conflict conflict : conflicts) {
try {
- switch (partToPreview) {
- case 1:
- if (conflict.getSourceArtifact() != null) {
- artifacts.add(conflict.getSourceArtifact());
- }
- break;
- case 2:
- if (conflict.getDestArtifact() != null) {
- artifacts.add(conflict.getDestArtifact());
- }
- break;
- case 3:
- ConflictStatus status = conflict.getStatus();
- if (status.isInformational()) {
- return false;
- }
- if (conflict.getArtifact() != null) {
- artifacts.add(conflict.getArtifact());
- }
- break;
+ if (partToPreview == 3) {
+ ConflictStatus status = conflict.getStatus();
+ if (status.isInformational()) {
+ return false;
+ }
+
}
} catch (Exception ex) {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
}
}
- return AccessControlManager.hasPermission(artifacts, PermissionEnum.READ);
+ return true;
}
}

Back to the top