org.argouml.uml.reveng
Class Import

java.lang.Object
  extended byorg.argouml.uml.reveng.Import

public class Import
extends Object

This is the main class for all import classes.

It provides JPanels for tailoring the import run in the FileChooser.

The Import run is started by calling doFile(Project, File)

Supports recursive search in folder for all .java classes.

There are now 3 levels of detail for import:

  1. 0 = classifiers only
  2. 1 = classifiers plus feature specifications
  3. 2 = full import, feature detail (ie. operations with methods)


Nested Class Summary
(package private)  class Import.ImportRun
          This class parses each file in turn and allows the GUI to refresh itself by performing the run() once for each file.
(package private)  class Import.ImportStatusScreen
          A window that shows the progress bar and a cancel button.
(package private)  class Import.ProblemsDialog
          A window that shows the problems occured during import
 
Field Summary
private  Hashtable attributes
           
private  JRadioButton classAndFeatures
           
private  JRadioButton classOnly
           
private  JComponent configPanel
           
private  JCheckBox createDiagrams
           
private  JCheckBox descend
           
private  DiagramInterface diagramInterface
          Create a interface to the current diagram
private  JDialog dialog
           
private  JRadioButton fullImport
           
private  int importLevel
           
private  JTextField inputSourceEncoding
           
private  Import.ImportStatusScreen iss
           
private  JCheckBox layoutDiagrams
           
private static Logger LOG
          logger
private  JCheckBox minimiseFigs
           
private  PluggableImport module
          current language module
private  Hashtable modules
          key = module name, value = PluggableImport instance
private  StringBuffer problems
           
private  Vector secondPassFiles
          The files that needs a second RE pass.
private  String srcPath
          Imported directory
 
Constructor Summary
Import()
          Creates dialog window with chooser and configuration panel.
 
Method Summary
 void disposeDialog()
          Close dialog window.
 void doFile()
          This method is called by ActionImportFromSources to start the import run.
 Object getAttribute(String key)
           
 JComponent getConfigPanel(Import importInstance)
          Get the panel that lets the user set reverse engineering parameters.
private  DiagramInterface getCurrentDiagram()
          Set target diagram.
 String getInputSourceEncoding()
           
 String getSrcPath()
           
 void getUserClasspath()
          Invoke the dialog to get the class path.
 boolean isCreateDiagramsChecked()
          Check, if "Create diagrams from imported code" is selected.
 boolean isDiscendDirectoriesRecursively()
          Check, if "Discend directories recursively" is selected.
 boolean isMinimiseFigsChecked()
          Check, if "Minimise Class icons in diagrams" is selected.
 boolean needsSave()
          If we have modified any diagrams, the project was modified and should be saved.
 void parseFile(Project project, Object f)
          Parse 1 Java file, using JavaImport.
 void setAttribute(String key, Object value)
           
 void setSrcPath(String path)
          Set path for processed directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final Logger LOG
logger


srcPath

private String srcPath
Imported directory


diagramInterface

private DiagramInterface diagramInterface
Create a interface to the current diagram


module

private PluggableImport module
current language module


modules

private Hashtable modules
key = module name, value = PluggableImport instance


configPanel

private JComponent configPanel

descend

private JCheckBox descend

secondPassFiles

private Vector secondPassFiles
The files that needs a second RE pass.


createDiagrams

private JCheckBox createDiagrams

minimiseFigs

private JCheckBox minimiseFigs

layoutDiagrams

private JCheckBox layoutDiagrams

classOnly

private JRadioButton classOnly

classAndFeatures

private JRadioButton classAndFeatures

fullImport

private JRadioButton fullImport

importLevel

private int importLevel

inputSourceEncoding

private JTextField inputSourceEncoding

dialog

private JDialog dialog

iss

private Import.ImportStatusScreen iss

problems

private StringBuffer problems

attributes

private Hashtable attributes
Constructor Detail

Import

public Import()
Creates dialog window with chooser and configuration panel.

Method Detail

getAttribute

public Object getAttribute(String key)
Parameters:
key - the key of the attribute
Returns:
the value of the attribute

setAttribute

public void setAttribute(String key,
                         Object value)
Parameters:
key - the key of the attribute
value - the value of the attribute

getInputSourceEncoding

public String getInputSourceEncoding()
Returns:
the text of this textfield

disposeDialog

public void disposeDialog()
Close dialog window.


getConfigPanel

public JComponent getConfigPanel(Import importInstance)
Get the panel that lets the user set reverse engineering parameters.

Parameters:
importInstance - the instance of the import
Returns:
the panel

getUserClasspath

public void getUserClasspath()
Invoke the dialog to get the class path.


doFile

public void doFile()
This method is called by ActionImportFromSources to start the import run.

The method that for all parsing actions. It calls the actual parser methods depending on the type of the file.


setSrcPath

public void setSrcPath(String path)
Set path for processed directory.

Parameters:
path - the given path

getSrcPath

public String getSrcPath()
Returns:
path for processed directory.

parseFile

public void parseFile(Project project,
                      Object f)
               throws Exception
Parse 1 Java file, using JavaImport.

Parameters:
f - The file to parse.
project - the project
Throws:
Exception - ??? TODO: Couldn't we throw a narrower one?

isCreateDiagramsChecked

public boolean isCreateDiagramsChecked()
Check, if "Create diagrams from imported code" is selected.

Returns:
true, if "Create diagrams from imported code" is selected

isDiscendDirectoriesRecursively

public boolean isDiscendDirectoriesRecursively()
Check, if "Discend directories recursively" is selected.

Returns:
true, if "Discend directories recursively" is selected

isMinimiseFigsChecked

public boolean isMinimiseFigsChecked()
Check, if "Minimise Class icons in diagrams" is selected.

Returns:
true, if "Minimise Class icons in diagrams" is selected

needsSave

public boolean needsSave()
If we have modified any diagrams, the project was modified and should be saved. I don't consider a import, that only modifies the metamodel, at this point (Andreas Rueckert ). Calling Project.setNeedsSave(true) doesn't work here, because Project.postLoad() is called after the import and it sets the needsSave flag to false.

Returns:
true, if any diagrams where modified and the project should be saved before exit.

getCurrentDiagram

private DiagramInterface getCurrentDiagram()
Set target diagram.

Returns:
selected diagram, if it is class diagram, else return null.


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook