org.argouml.uml.reveng
Class Import

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

public class Import
extends java.lang.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.
 
Field Summary
private  DiagramInterface _diagram
          Create a interface to the current diagram
private  java.util.Hashtable attributes
           
private  org.apache.log4j.Logger cat
          logger
private  javax.swing.JRadioButton classAndFeatures
           
private  javax.swing.JRadioButton classOnly
           
private  javax.swing.JComponent configPanel
           
private  javax.swing.JCheckBox create_diagrams
           
private  javax.swing.JCheckBox descend
           
private  javax.swing.JDialog dialog
           
private  javax.swing.JRadioButton fullImport
           
private  int importLevel
           
private  Import.ImportStatusScreen iss
           
private  javax.swing.JCheckBox layout_diagrams
           
private  javax.swing.JCheckBox minimise_figs
           
private  PluggableImport module
          current language module
private  java.util.Hashtable modules
          key = module name, value = PluggableImport instance
private  java.util.Vector secondPassFiles
          The files that needs a second RE pass.
private  java.lang.String src_path
          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.
 java.lang.Object getAttribute(java.lang.String key)
           
 javax.swing.JComponent getConfigPanel(Import importInstance)
          Get the panel that lets the user set reverse engineering parameters.
private  DiagramInterface getCurrentDiagram()
          Set target diagram.
 java.lang.String getSrcPath()
           
 void getUserClasspath()
           
 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, java.lang.Object f)
          Parse 1 Java file, using JavaImport.
 void setAttribute(java.lang.String key, java.lang.Object value)
           
 void setSrcPath(java.lang.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

cat

private org.apache.log4j.Logger cat
logger


src_path

private java.lang.String src_path
Imported directory


_diagram

private DiagramInterface _diagram
Create a interface to the current diagram


module

private PluggableImport module
current language module


modules

private java.util.Hashtable modules
key = module name, value = PluggableImport instance


configPanel

private javax.swing.JComponent configPanel

descend

private javax.swing.JCheckBox descend

secondPassFiles

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


create_diagrams

private javax.swing.JCheckBox create_diagrams

minimise_figs

private javax.swing.JCheckBox minimise_figs

layout_diagrams

private javax.swing.JCheckBox layout_diagrams

classOnly

private javax.swing.JRadioButton classOnly

classAndFeatures

private javax.swing.JRadioButton classAndFeatures

fullImport

private javax.swing.JRadioButton fullImport

importLevel

private int importLevel

dialog

private javax.swing.JDialog dialog

iss

private Import.ImportStatusScreen iss

attributes

private java.util.Hashtable attributes
Constructor Detail

Import

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

Method Detail

getAttribute

public java.lang.Object getAttribute(java.lang.String key)

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object value)

disposeDialog

public void disposeDialog()
Close dialog window.


getConfigPanel

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


getUserClasspath

public void getUserClasspath()

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(java.lang.String path)
Set path for processed directory.


getSrcPath

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

parseFile

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

Parameters:
f - The file to parse.
Throws:
java.lang.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 (20040316)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook