Author: thn
Date: 2008-06-02 10:42:29-0700
New Revision: 14861
Added:
trunk/src/argouml-app/src/org/argouml/uml/reveng/ExtendedImportInterface.java (contents, props changed)
trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommand.java (contents, props changed)
trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommandInterface.java (contents, props changed)
Modified:
trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java
trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportInterface.java
trunk/src/argouml-app/src/org/argouml/uml/reveng/java/JavaImport.java
trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportClasspathDialog.java
Log:
reverting changes to ImportInterface and introducing new Interfaces
Added: trunk/src/argouml-app/src/org/argouml/uml/reveng/ExtendedImportInterface.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/ExtendedImportInterface.java?view=auto&rev=14861
==============================================================================
--- (empty file)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/ExtendedImportInterface.java 2008-06-02 10:42:29-0700
@@ -0,0 +1,53 @@
+// $Id$
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.uml.reveng;
+
+import java.awt.Component;
+
+/**
+ * An extended interface which identifies an ArgoUML plug-in which imports
+ * source language modules and creates UML model elements in our model.
+ * <p>
+ * WARNING: This is very new stuff and probably will be changed. If you
+ * are going to use it in your import module, then please send a mail to
+ * [email protected], so that your module gets the needed support
+ * until this interface has become stable!
+ *
+ * @author Thomas Neustupny
+ * @since 0.25.6
+ */
+public interface ExtendedImportInterface extends ImportInterface {
+
+ /**
+ * Invokes the import process. Normally, this is done for import modules,
+ * so the module need not invoke it on its own. This is needed only for
+ * extended import module functionality (e.g. displaying a classpath
+ * dialog for JavaImport).
+ *
+ * @param component the visual component this is called from
+ * @param importCmd the import command to invoke the import
+ */
+ void invokeImport(Component component, ImportCommandInterface importCmd);
+}
Modified: trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java?view=diff&rev=14861&p1=trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java&p2=trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java&r1=14860&r2=14861
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java 2008-06-02 10:42:29-0700
@@ -65,24 +65,28 @@
import org.tigris.gef.base.Globals;
import org.tigris.swidgets.GridLayout2;
-
/**
- * This is the main class for all import classes.<p>
- *
- * It provides JPanels for tailoring the import run in the FileChooser.<p>
- *
- * The Import run is started by calling doFile(Project, File)<p>
- *
- * Supports recursive search in folder for all .java classes.<p>
- *
- * There are now 3 levels of detail for import:<p>
- *
+ * This is the main class for all import classes.
+ * <p>
+ *
+ * It provides JPanels for tailoring the import run in the FileChooser.
+ * <p>
+ *
+ * The Import run is started by calling doFile(Project, File)
+ * <p>
+ *
+ * Supports recursive search in folder for all .java classes.
+ * <p>
+ *
+ * There are now 3 levels of detail for import:
+ * <p>
+ *
* <ol>
- * <li> 0 - classifiers only
- * <li> 1 - classifiers plus feature specifications
- * <li> 2 - full import, feature detail (ie. operations with methods)
+ * <li> 0 - classifiers only
+ * <li> 1 - classifiers plus feature specifications
+ * <li> 2 - full import, feature detail (ie. operations with methods)
* </ol>
- *
+ *
* @author Andreas Rueckert [email protected]
*/
public class Import extends ImportCommon implements ImportSettings {
@@ -108,28 +112,27 @@
// level 2 import detail
private JRadioButton fullImport;
- //import detail level var:
-// private int importLevel;
+ // import detail level var:
+ // private int importLevel;
private JTextField inputSourceEncoding;
private JDialog dialog;
private ImportStatusScreen iss;
-
- private Frame myFrame;
+ private Frame myFrame;
/**
- * The default extended configuration panel.
- * TODO: This used to be provided by the abstract class FileImportSupport
- * and it can be merged with our main configuration panel here.
+ * The default extended configuration panel. TODO: This used to be provided
+ * by the abstract class FileImportSupport and it can be merged with our
+ * main configuration panel here.
*/
private ConfigPanelExtension importConfigPanel;
/**
* Creates dialog window with chooser and configuration panel.
- *
+ *
* @param frame the ui frame to display dialogs on
*/
public Import(Frame frame) {
@@ -137,21 +140,14 @@
myFrame = frame;
JComponent chooser = getChooser();
- dialog =
- new JDialog(frame,
- Translator.localize("action.import-sources"), true);
+ dialog = new JDialog(frame, Translator
+ .localize("action.import-sources"), true);
dialog.getContentPane().add(chooser, BorderLayout.CENTER);
dialog.getContentPane().add(getConfigPanel(this), BorderLayout.EAST);
dialog.pack();
- int x =
- (frame.getSize().width
- - dialog.getSize().width)
- / 2;
- int y =
- (frame.getSize().height
- - dialog.getSize().height)
- / 2;
+ int x = (frame.getSize().width - dialog.getSize().width) / 2;
+ int y = (frame.getSize().height - dialog.getSize().height) / 2;
dialog.setLocation(x > 0 ? x : 0, y > 0 ? y : 0);
UIUtils.loadCommonKeyMap(dialog);
@@ -194,12 +190,12 @@
flags.append(isCreateDiagramsSelected()).append(",");
flags.append(isMinimizeFigsSelected()).append(",");
flags.append(isDiagramLayoutSelected());
- Configuration.setString(Argo.KEY_IMPORT_GENERAL_SETTINGS_FLAGS,
- flags.toString());
- Configuration.setString(Argo.KEY_IMPORT_GENERAL_DETAIL_LEVEL,
- String.valueOf(getImportLevel()));
+ Configuration.setString(Argo.KEY_IMPORT_GENERAL_SETTINGS_FLAGS, flags
+ .toString());
+ Configuration.setString(Argo.KEY_IMPORT_GENERAL_DETAIL_LEVEL, String
+ .valueOf(getImportLevel()));
Configuration.setString(Argo.KEY_INPUT_SOURCE_ENCODING,
- getInputSourceEncoding());
+ getInputSourceEncoding());
if (importConfigPanel != null) {
importConfigPanel.disposeDialog();
}
@@ -208,13 +204,11 @@
}
/**
- * Get the panel that lets the user set reverse engineering
- * parameters.
- *
+ * Get the panel that lets the user set reverse engineering parameters.
+ *
* @param importInstance the instance of the import
- * @return the panel
- * This is an internal method. Use the accessors in
- * {@link ImportSettings} to determine the current settings.
+ * @return the panel This is an internal method. Use the accessors in
+ * {@link ImportSettings} to determine the current settings.
*/
private JComponent getConfigPanel(final Import importInstance) {
@@ -223,16 +217,15 @@
// build the configPanel:
if (configPanel == null) {
JPanel general = new JPanel();
- general.setLayout(
- new GridLayout2(13, 1, 0, 0, GridLayout2.NONE));
+ general.setLayout(new GridLayout2(13, 1, 0, 0, GridLayout2.NONE));
- general.add(new JLabel(
- Translator.localize("action.import-select-lang")));
+ general.add(new JLabel(Translator
+ .localize("action.import-select-lang")));
- JComboBox selectedLanguage =
- new JComboBox(getModules().keySet().toArray());
- selectedLanguage.addActionListener(
- new SelectedLanguageListener(importInstance, tab));
+ JComboBox selectedLanguage = new JComboBox(getModules().keySet()
+ .toArray());
+ selectedLanguage.addActionListener(new SelectedLanguageListener(
+ importInstance, tab));
general.add(selectedLanguage);
boolean desc = true;
@@ -240,9 +233,8 @@
boolean crea = true;
boolean mini = true;
boolean layo = true;
- String flags =
- Configuration
- .getString(Argo.KEY_IMPORT_GENERAL_SETTINGS_FLAGS);
+ String flags = Configuration
+ .getString(Argo.KEY_IMPORT_GENERAL_SETTINGS_FLAGS);
if (flags != null && flags.length() > 0) {
StringTokenizer st = new StringTokenizer(flags, ",");
if (st.hasMoreTokens() && st.nextToken().equals("false")) {
@@ -261,31 +253,27 @@
layo = false;
}
}
-
- descend =
- new JCheckBox(Translator.localize(
- "action.import-option-descend-dir-recur"), desc);
+
+ descend = new JCheckBox(Translator
+ .localize("action.import-option-descend-dir-recur"), desc);
general.add(descend);
- changedOnly =
- new JCheckBox(Translator.localize(
- "action.import-option-changed_new"), chan);
+ changedOnly = new JCheckBox(Translator
+ .localize("action.import-option-changed_new"), chan);
general.add(changedOnly);
- createDiagrams =
- new JCheckBox(Translator.localize(
- "action.import-option-create-diagram"), crea);
+ createDiagrams = new JCheckBox(Translator
+ .localize("action.import-option-create-diagram"), crea);
general.add(createDiagrams);
- minimiseFigs =
- new JCheckBox(Translator.localize(
- "action.import-option-min-class-icon"), mini);
+ minimiseFigs = new JCheckBox(Translator
+ .localize("action.import-option-min-class-icon"), mini);
general.add(minimiseFigs);
- layoutDiagrams =
- new JCheckBox(Translator.localize(
- "action.import-option-perform-auto-diagram-layout"),
- layo);
+ layoutDiagrams = new JCheckBox(
+ Translator
+ .localize("action.import-option-perform-auto-diagram-layout"),
+ layo);
general.add(layoutDiagrams);
// de-selects the fig minimising & layout
@@ -304,26 +292,22 @@
// 1 - classifiers plus feature specifications
// 2 - full import, feature detail
- JLabel importDetailLabel =
- new JLabel(Translator.localize(
- "action.import-level-of-import-detail"));
+ JLabel importDetailLabel = new JLabel(Translator
+ .localize("action.import-level-of-import-detail"));
ButtonGroup detailButtonGroup = new ButtonGroup();
- classOnly =
- new JRadioButton(Translator.localize(
- "action.import-option-classifiers"));
+ classOnly = new JRadioButton(Translator
+ .localize("action.import-option-classifiers"));
detailButtonGroup.add(classOnly);
- classAndFeatures =
- new JRadioButton(Translator.localize(
- "action.import-option-classifiers-plus-specs"));
+ classAndFeatures = new JRadioButton(Translator
+ .localize("action.import-option-classifiers-plus-specs"));
detailButtonGroup.add(classAndFeatures);
- fullImport =
- new JRadioButton(Translator.localize(
- "action.import-option-full-import"));
- String detaillevel =
- Configuration.getString(Argo.KEY_IMPORT_GENERAL_DETAIL_LEVEL);
+ fullImport = new JRadioButton(Translator
+ .localize("action.import-option-full-import"));
+ String detaillevel = Configuration
+ .getString(Argo.KEY_IMPORT_GENERAL_DETAIL_LEVEL);
if ("0".equals(detaillevel)) {
classOnly.setSelected(true);
} else if ("1".equals(detaillevel)) {
@@ -338,31 +322,31 @@
general.add(classAndFeatures);
general.add(fullImport);
- general.add(new JLabel(
- Translator.localize("action.import-file-encoding")));
- String enc =
- Configuration.getString(Argo.KEY_INPUT_SOURCE_ENCODING);
+ general.add(new JLabel(Translator
+ .localize("action.import-file-encoding")));
+ String enc = Configuration
+ .getString(Argo.KEY_INPUT_SOURCE_ENCODING);
if (enc == null || enc.trim().equals("")) {
- inputSourceEncoding =
- new JTextField(System.getProperty("file.encoding"));
+ inputSourceEncoding = new JTextField(System
+ .getProperty("file.encoding"));
} else {
inputSourceEncoding = new JTextField(enc);
}
general.add(inputSourceEncoding);
- // TODO: Encoding needs to be validated against set of
+ // TODO: Encoding needs to be validated against set of
// available encodings using {@link Charset.isSupported(String)}
- // -- or use a menu with the contents of
- // {@link Charset.availableCharsets()}
-// JComboBox encoding =
-// new JComboBox(Charset.availableCharsets().keySet()
-// .toArray());
-// encoding.setSelectedItem(inputSourceEncoding.getText());
-// general.add(encoding);
+ // -- or use a menu with the contents of
+ // {@link Charset.availableCharsets()}
+ // JComboBox encoding =
+ // new JComboBox(Charset.availableCharsets().keySet()
+ // .toArray());
+ // encoding.setSelectedItem(inputSourceEncoding.getText());
+ // general.add(encoding);
tab.add(general, Translator.localize("action.import-general"));
- tab.add(getConfigPanelExtension(),
+ tab.add(getConfigPanelExtension(),
((ModuleInterface) getCurrentModule()).getName());
configPanel = tab;
}
@@ -396,6 +380,7 @@
/**
* The constructor.
+ *
* @param i The current import.
* @param t The pane.
*/
@@ -412,20 +397,18 @@
String selected = (String) cb.getSelectedItem();
ImportInterface oldModule = getCurrentModule();
setCurrentModule(getModules().get(selected));
- updateFilters(
- (JFileChooser) dialog.getContentPane().getComponent(0),
- oldModule.getSuffixFilters(),
- getCurrentModule()
- .getSuffixFilters());
+ updateFilters((JFileChooser) dialog.getContentPane()
+ .getComponent(0), oldModule.getSuffixFilters(),
+ getCurrentModule().getSuffixFilters());
// TODO: Update configPanelExtension with extension settings
// for new language
-
+
}
}
/**
- * Parse all selected files. It calls the actual
- * parser methods depending on the type of the file.
+ * Parse all selected files. It calls the actual parser methods depending on
+ * the type of the file.
*/
public void doFile() {
iss = new ImportStatusScreen(myFrame, "Importing", "Splash");
@@ -474,7 +457,6 @@
return false;
}
-
/*
* @see org.argouml.uml.reveng.ImportCommon#isDiagramLayoutSelected()
*/
@@ -485,7 +467,6 @@
return false;
}
-
/*
* @see org.argouml.uml.reveng.ImportCommon#isDescendSelected()
*/
@@ -506,7 +487,6 @@
return false;
}
-
/*
* Create chooser for objects we are to import. Old style modules get to
* provide their own (although I don't believe any of them do), while new
@@ -538,7 +518,6 @@
}
}
-
private static class ImportFileChooser extends JFileChooser {
private Import theImport;
@@ -565,9 +544,7 @@
* @param fsv the file system view
* @see javax.swing.JFileChooser#JFileChooser(String, FileSystemView)
*/
- public ImportFileChooser(
- Import imp,
- String currentDirectoryPath,
+ public ImportFileChooser(Import imp, String currentDirectoryPath,
FileSystemView fsv) {
super(currentDirectoryPath, fsv);
theImport = imp;
@@ -593,21 +570,18 @@
* @param fsv the file system view
* @see javax.swing.JFileChooser#JFileChooser(FileSystemView)
*/
- public ImportFileChooser(
- Import imp,
- FileSystemView fsv) {
+ public ImportFileChooser(Import imp, FileSystemView fsv) {
super(fsv);
theImport = imp;
initChooser();
}
-
private void initChooser() {
setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
setMultiSelectionEnabled(true);
setSelectedFile(getCurrentDirectory());
}
-
+
/*
* @see javax.swing.JFileChooser#approveSelection()
*/
@@ -616,7 +590,7 @@
File[] files = getSelectedFiles();
File dir = getCurrentDirectory();
if (files.length == 0) {
- files = new File[] {dir};
+ files = new File[] { dir };
}
if (files.length == 1) {
File file = files[0];
@@ -629,10 +603,15 @@
theImport.setSelectedFiles(files);
Globals.setLastDirectory(dir.getPath());
theImport.disposeDialog();
-
- if (theImport.getCurrentModule().isApprovedImport(theImport)) {
+
+ if (theImport.getCurrentModule() instanceof ExtendedImportInterface) {
+ ExtendedImportInterface eii = (ExtendedImportInterface) theImport
+ .getCurrentModule();
+ eii.invokeImport(theImport.getFrame(), new ImportCommand(
+ theImport));
+ } else {
theImport.doFile();
- }
+ }
}
/*
Added: trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommand.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommand.java?view=auto&rev=14861
==============================================================================
--- (empty file)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommand.java 2008-06-02 10:42:29-0700
@@ -0,0 +1,53 @@
+// $Id$
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.uml.reveng;
+
+/**
+ * An import command, that allows import modules to execute the
+ * import process.
+ *
+ * @author Thomas Neustupny
+ */
+public class ImportCommand implements ImportCommandInterface {
+
+ private Import importer;
+
+ /**
+ * The constructor.
+ *
+ * @param imp the Import instance
+ */
+ public ImportCommand(Import imp) {
+ importer = imp;
+ }
+
+ /**
+ * @see org.argouml.uml.reveng.ImportCommandInterface#execute()
+ */
+ public void execute() {
+ importer.doFile();
+ }
+
+}
Added: trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommandInterface.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommandInterface.java?view=auto&rev=14861
==============================================================================
--- (empty file)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommandInterface.java 2008-06-02 10:42:29-0700
@@ -0,0 +1,50 @@
+// $Id$
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.uml.reveng;
+
+/**
+ * An interface for an import command, that allows import modules to execute the
+ * import process.
+ * <p>
+ * WARNING: This is very new stuff and probably will be changed. If you
+ * are going to use it in your import module, then please send a mail to
+ * [email protected], so that your module gets the needed support
+ * until this interface has become stable!
+ *
+ * @author Thomas Neustupny
+ * @since 0.25.6
+ */
+public interface ImportCommandInterface {
+
+ /**
+ * The execute method for the command instance.
+ * <p>
+ * WARNING: This is very new stuff and probably will be changed. If you
+ * are going to use it in your import module, then please send a mail to
+ * [email protected], so that your module gets the needed support
+ * until this method signature has become stable!
+ */
+ public void execute();
+}
Modified: trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportInterface.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportInterface.java?view=diff&rev=14861&p1=trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportInterface.java&p2=trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportInterface.java&r1=14860&r2=14861
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportInterface.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportInterface.java 2008-06-02 10:42:29-0700
@@ -37,7 +37,7 @@
* An interface which identifies an ArgoUML plug-in which imports
* source language modules and creates UML model elements in our model.
*
- * @author Tom Morris, Thomas Neustupny
+ * @author Tom Morris
* @since 0.23.2
*/
@@ -66,20 +66,6 @@
SuffixFilter[] getSuffixFilters();
/**
- * Allows for a check of the import facility before actually doing the
- * import. If true is returned, then the import will be invoked by calling
- * the public doFile() method of the Import class, otherwise no import is
- * invoked. The import module normally returns true, but it could return
- * false and call the doFile() method on it's own, which is done e.g. by
- * the JavaImport after displaying a classpath dialog.
- *
- * @param importer the Import instance
- *
- * @return whether Import.doFile() should be invoked or not
- */
- boolean isApprovedImport(Import importer);
-
- /**
* Tells if the object is parseable or not. It's is up to the module
* to decide whether it does something simple like verify that the file
* has the correct extension, or something more complicated.
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=14861&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=14860&r2=14861
==============================================================================
--- 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-06-02 10:42:29-0700
@@ -24,6 +24,7 @@
package org.argouml.uml.reveng.java;
+import java.awt.Component;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@@ -41,9 +42,9 @@
import org.argouml.i18n.Translator;
import org.argouml.kernel.Project;
import org.argouml.taskmgmt.ProgressMonitor;
+import org.argouml.uml.reveng.ExtendedImportInterface;
import org.argouml.uml.reveng.FileImportUtils;
-import org.argouml.uml.reveng.Import;
-import org.argouml.uml.reveng.ImportInterface;
+import org.argouml.uml.reveng.ImportCommandInterface;
import org.argouml.uml.reveng.ImportSettings;
import org.argouml.uml.reveng.ImporterManager;
import org.argouml.uml.reveng.ui.ImportClasspathDialog;
@@ -56,7 +57,7 @@
*
* @author Andreas Rueckert, Thomas Neustupny
*/
-public class JavaImport implements ImportInterface {
+public class JavaImport implements ExtendedImportInterface {
/** logger */
private static final Logger LOG = Logger.getLogger(JavaImport.class);
@@ -225,7 +226,7 @@
}
- /*
+ /**
* @see org.argouml.uml.reveng.ImportInterface#getSuffixFilters()
*/
public SuffixFilter[] getSuffixFilters() {
@@ -233,12 +234,12 @@
return result;
}
- /*
- * @see org.argouml.uml.reveng.ImportInterface#isApprovedImport(Import)
+ /**
+ * @see org.argouml.uml.reveng.ExtendedImportInterface#invokeImport(java.awt.Component, org.argouml.uml.reveng.ImportCommandInterface)
*/
- public boolean isApprovedImport(Import importer) {
- new ImportClasspathDialog(importer);
- return false;
+ public void invokeImport(Component component,
+ ImportCommandInterface importCmd) {
+ new ImportClasspathDialog(component, importCmd);
}
/*
Modified: trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportClasspathDialog.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportClasspathDialog.java?view=diff&rev=14861&p1=trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportClasspathDialog.java&p2=trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportClasspathDialog.java&r1=14860&r2=14861
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportClasspathDialog.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportClasspathDialog.java 2008-06-02 10:42:29-0700
@@ -1,6 +1,7 @@
package org.argouml.uml.reveng.ui;
import java.awt.BorderLayout;
+import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;
@@ -22,8 +23,8 @@
import org.argouml.application.api.Argo;
import org.argouml.configuration.Configuration;
import org.argouml.i18n.Translator;
-import org.argouml.uml.reveng.Import;
import org.argouml.uml.reveng.ImportClassLoader;
+import org.argouml.uml.reveng.ImportCommandInterface;
import org.tigris.gef.base.Globals;
/**
@@ -46,21 +47,23 @@
private JButton removeFile;
private JButton ok;
+
+ private Component parent;
- private Import importer;
+ private ImportCommandInterface importCmd;
/**
* Construct a dialog to allow the user to set up the classpath for the
* import.
- *
- * @param importProcess1
*/
- public ImportClasspathDialog(Import imp) {
+ public ImportClasspathDialog(Component comp,
+ ImportCommandInterface impCmd) {
super();
importClasspathDialog = this;
setTitle(Translator.localize("dialog.import.classpath.title"));
- importer = imp;
+ parent = comp;
+ importCmd = impCmd;
Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();
getContentPane().setLayout(new BorderLayout(0, 0));
@@ -150,7 +153,7 @@
setVisible(false);
setModal(false);
dispose();
- importer.doFile();
+ importCmd.execute();
} finally {
setVisible(false);
setModal(false);
@@ -221,7 +224,7 @@
}
});
- chooser.showOpenDialog(importer.getFrame());
+ chooser.showOpenDialog(parent);
}
}
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.