Author: thn
Date: 2008-05-01 11:05:26-0700
New Revision: 14562
Modified:
trunk/src/argouml-app/src/org/argouml/uml/reveng/java/JavaImport.java
trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportStatusScreen.java
trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ProblemsDialog.java
Log:
Fix completed for issue #4615 (Reverse engineering should attempt to continue after error)
Modified: trunk/src/argouml-app/src/org/argouml/uml/reveng/java/JavaImport.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/java/JavaImport.java?view=diff&rev=14562&p1=trunk/src/argouml-app/src/org/argouml/uml/reveng/java/JavaImport.java&p2=trunk/src/argouml-app/src/org/argouml/uml/reveng/java/JavaImport.java&r1=14561&r2=14562
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/reveng/java/JavaImport.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/java/JavaImport.java 2008-05-01 11:05:26-0700
@@ -29,6 +29,8 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.util.Collection;
import java.util.HashSet;
@@ -102,7 +104,22 @@
}
Object file = it.next();
if (file instanceof File) {
- parseFile(p, (File) file, settings, pass);
+ try {
+ parseFile(p, (File) file, settings, pass);
+ } catch (ImportException e) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new java.io.PrintWriter(sw);
+ e.printStackTrace(pw);
+ monitor.notifyMessage(
+ Translator.localize(
+ "dialog.title.import-problems"), //$NON-NLS-1$
+ Translator.localize(
+ "label.import-problems"), //$NON-NLS-1$
+ sw.toString());
+ if (monitor.isCanceled()) {
+ break;
+ }
+ }
monitor.updateProgress(count++);
monitor.updateSubTask(Translator.localize(
"dialog.import.parsingAction",
@@ -183,9 +200,10 @@
LOG.error(e.getClass().getName()
+ errorString, e);
throw new ImportException(errorString, e);
+ } finally {
+ newElements.addAll(modeller.getNewElements());
+ in.close();
}
- newElements.addAll(modeller.getNewElements());
- in.close();
} catch (IOException e) {
throw new ImportException(buildErrorString(f), e);
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportStatusScreen.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportStatusScreen.java?view=diff&rev=14562&p1=trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportStatusScreen.java&p2=trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportStatusScreen.java&r1=14561&r2=14562
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportStatusScreen.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportStatusScreen.java 2008-05-01 11:05:26-0700
@@ -156,13 +156,16 @@
String message) {
// TODO: Create an error dialog or panel in our progress dialog
// for now we just use our old style separate error dialog
- JDialog problemsDialog = new ProblemsDialog(parentFrame, message);
+ ProblemsDialog problemsDialog = new ProblemsDialog(parentFrame, message);
problemsDialog.setTitle(title);
problemsDialog.setVisible(true);
+ cancelled = problemsDialog.isAborted();
// TODO: Only needed while we have a separate problem dialog
// (see above)
- setVisible(false);
- dispose();
+ if (cancelled) {
+ setVisible(false);
+ dispose();
+ }
}
/*
Modified: trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ProblemsDialog.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ProblemsDialog.java?view=diff&rev=14562&p1=trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ProblemsDialog.java&p2=trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ProblemsDialog.java&r1=14561&r2=14562
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ProblemsDialog.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ProblemsDialog.java 2008-05-01 11:05:26-0700
@@ -74,6 +74,7 @@
private JButton abortButton;
private JButton continueButton;
private JLabel northLabel;
+ private boolean aborted = false;
/**
* The constructor.
@@ -107,6 +108,7 @@
bottomPanel.add(continueButton);
bottomPanel.add(abortButton);
getContentPane().add(bottomPanel, BorderLayout.SOUTH);
+ continueButton.requestFocusInWindow();
// listeners
continueButton.addActionListener(this);
@@ -127,9 +129,20 @@
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(abortButton)) {
+ aborted = true;
+ }
disposeDialog();
}
+ /**
+ * Returns whether the Abort button was pressed.
+ * @return aborted
+ */
+ public boolean isAborted() {
+ return aborted;
+ }
+
private void disposeDialog() {
setVisible(false);
dispose();
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.