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)
TODO: Add registration methods for new languages.


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.
 String getInputSourceEncoding()
           
 String getSrcPath()
           
 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
 

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

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:
project - the project
f - The file to parse.
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.


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook