Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2013-01-15 21:14:31 +0000
committerRoberto E. Escobar2013-01-15 21:14:31 +0000
commitf730b8dbc09a4851552f34ac0cfb7160a71cba99 (patch)
tree8679e346a5fe28ea06c0534ed921abd472cc41b0 /plugins/org.eclipse.osee.define
parent9f8d155bc05e1c1488f11b50f359894b4b0393ab (diff)
downloadorg.eclipse.osee-f730b8dbc09a4851552f34ac0cfb7160a71cba99.tar.gz
org.eclipse.osee-f730b8dbc09a4851552f34ac0cfb7160a71cba99.tar.xz
org.eclipse.osee-f730b8dbc09a4851552f34ac0cfb7160a71cba99.zip
bug[ats_JK7X3]: Traceability tool exceptioning out
Bad paths causing the tool to exception out. Improve the feedback by providing earlier notification of bad paths. Change-Id: I7f5ef96d62352aaf196142fff0b1a21e58954cbe
Diffstat (limited to 'plugins/org.eclipse.osee.define')
-rw-r--r--plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/ImportTraceabilityPage.java60
1 files changed, 60 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/ImportTraceabilityPage.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/ImportTraceabilityPage.java
index c0616a24025..048d7588757 100644
--- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/ImportTraceabilityPage.java
+++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/ImportTraceabilityPage.java
@@ -11,10 +11,18 @@
package org.eclipse.osee.define.traceability;
import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.logging.Level;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.define.internal.Activator;
import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.ui.plugin.util.DirectoryOrFileSelector;
import org.eclipse.osee.framework.ui.skynet.branch.BranchSelectComposite;
import org.eclipse.swt.SWT;
@@ -80,6 +88,11 @@ public class ImportTraceabilityPage extends WizardDataTransferPage {
setPageComplete(determinePageCompletion());
}
+ @Override
+ protected boolean determinePageCompletion() {
+ return super.determinePageCompletion() && preprocessInput(getImportFile());
+ }
+
protected void createSourceGroup(Composite parent) {
directoryFileSelector = new DirectoryOrFileSelector(parent, SWT.NONE, "Import Source", this);
@@ -131,4 +144,51 @@ public class ImportTraceabilityPage extends WizardDataTransferPage {
protected boolean allowNewContainerName() {
return false;
}
+
+ private boolean preprocessInput(final File file) {
+ final StringBuilder errorMessage = new StringBuilder();
+ try {
+ getContainer().run(true, true, new IRunnableWithProgress() {
+
+ @Override
+ public void run(IProgressMonitor monitor) {
+ if (file != null) {
+ try {
+ int count = 0;
+ for (String path : Lib.readListFromFile(file, true)) {
+ File toCheck = new File(path);
+ if (!toCheck.exists()) {
+ count++;
+ errorMessage.append(String.format("\nPath does not exist: [%s]", path));
+ } else if (!toCheck.isDirectory()) {
+ count++;
+ errorMessage.append(String.format("\nNot a directory: [%s]", path));
+ }
+ }
+ if (count > 0) {
+ errorMessage.insert(0, String.format("%d paths have errors:", count));
+ }
+ } catch (IOException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, Lib.exceptionToString(ex));
+ }
+
+ }
+ }
+ });
+ } catch (InvocationTargetException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, Lib.exceptionToString(ex));
+ } catch (InterruptedException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, Lib.exceptionToString(ex));
+ }
+
+ if (errorMessage.length() != 0) {
+ setErrorMessage(errorMessage.toString());
+ return false;
+ } else {
+ setErrorMessage(null);
+ setMessage(null);
+ return true;
+ }
+
+ }
} \ No newline at end of file

Back to the top