Package fr.ifremer.isisfish.ui.script
Class ScriptHandler
java.lang.Object
fr.ifremer.isisfish.ui.script.ScriptHandler
- All Implemented Interfaces:
EventListener
,TreeSelectionListener
ScriptAction.
Template are now loaded with freemarker.
- Version:
- $Revision$ Last update: $Date$ by : $Author$
- Author:
- letellier
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static enum
enum to encapsulate a script module -
Field Summary
Modifier and TypeFieldDescriptionprotected CodeSourceStorage
Storage for currently edited file.static final Color
Couleur d'echec (rouge leger).static final Color
Couleur de succes (vert leger).protected freemarker.template.Configuration
Freemarke configuration used to create new script (based on templates).protected static FileFilter
protected ScriptUI
UI managed by this action class. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Post init, must be called after ui building.protected void
Copy a single file to destination directory.void
Check all scripts.protected void
boolean
Check script content.void
Save script, and display commit UI.void
deleteScript
(boolean deleteRemote) Delete a scriptvoid
Show diff between selected files and files server version.void
Call main method in current cod storage code.void
Exporte le(s) script(s) sélectionnés dans l'arbre.extractFiles
(int prefixLength, TreePath[] selectedPaths) boolean
void
Generate javadoc and display output in UI.static FileFilter
boolean
void
loadScript
(File file) Load specified script in current action.void
moveFiles
(File directory, Collection<File> filesToMove) Move files.void
newScript
(ScriptHandler.ScriptMapping scriptType) Make new script, and select it on tree.void
newScript
(MouseEvent event) Make new script, and select it on tree.protected File
newScript
(String fileName, ScriptHandler.ScriptMapping scriptType) Creer un nouveau script, ici un script peut-etre un Script, un Simulator, un Export.protected void
protected void
returnError
(String s, Exception eee) Write error in log and display exception to user.void
Save current editor test in current loaded codeStorage.Scan archive for script, and return an array of new files and conflict files.protected void
Update script UI component actions buttons.protected void
setStatusMessage
(String msg) protected void
setStatusMessage
(String msg, boolean running) void
Open a browser displaying javadoc.void
-
Field Details
-
COLOR_SUCCESS
Couleur de succes (vert leger). -
COLOR_FAILURE
Couleur d'echec (rouge leger). -
codeStorage
Storage for currently edited file. -
freemarkerConfiguration
protected freemarker.template.Configuration freemarkerConfigurationFreemarke configuration used to create new script (based on templates). -
scriptUI
UI managed by this action class. -
scriptFileFilter
-
-
Constructor Details
-
ScriptHandler
Constructeur. Init freemarker.- Parameters:
scriptUI
- managed script UI
-
-
Method Details
-
afterInit
public void afterInit()Post init, must be called after ui building. -
setButton
protected void setButton()Update script UI component actions buttons. -
setStatusMessage
-
setStatusMessage
-
newScript
Make new script, and select it on tree. -
newScript
Make new script, and select it on tree.- Parameters:
scriptType
- script to make
-
newScript
Creer un nouveau script, ici un script peut-etre un Script, un Simulator, un Export.- Parameters:
fileName
- full filenamescriptType
- le type que l'on souhaite Script, Simulator, ou Export.- Returns:
- created file or
null
if any error happen
-
returnError
Write error in log and display exception to user.- Parameters:
s
- messageeee
- cause
-
valueChanged
- Specified by:
valueChanged
in interfaceTreeSelectionListener
-
loadScript
Load specified script in current action. TODO can we change this ?- Parameters:
file
- file to load
-
fileLoaded
public boolean fileLoaded() -
isJavaScript
public boolean isJavaScript() -
saveScript
public void saveScript()Save current editor test in current loaded codeStorage. -
commitScript
public void commitScript()Save script, and display commit UI. -
exportScript
public void exportScript()Exporte le(s) script(s) sélectionnés dans l'arbre.
L'arbre doit avoir au moins un script de selectionnés -
extractFiles
-
getScriptFileFilter
-
checkScript
public boolean checkScript()Check script content.- Returns:
- compilation success flag
-
checkAllScripts
public void checkAllScripts()Check all scripts. -
resetCheckLogArea
protected void resetCheckLogArea() -
checkAllScriptsAsync
protected void checkAllScriptsAsync() -
evaluateScript
public void evaluateScript()Call main method in current cod storage code. Check script before call. -
backup
Copy a single file to destination directory.- Parameters:
src
- file to copypath
- path of file to copysuffix
- file suffix- Throws:
IOException
- if copy fail
-
scanZip
Scan archive for script, and return an array of new files and conflict files.- Parameters:
source
- archive fileroot
- database directory- Returns:
- an array [newFiles, conflictFiles]
-
deleteScript
public void deleteScript(boolean deleteRemote) Delete a script- Parameters:
deleteRemote
-true
to remove in vcs too
-
diffScript
public void diffScript()Show diff between selected files and files server version. -
generateScriptJavadoc
public void generateScriptJavadoc()Generate javadoc and display output in UI. -
showScriptJavadoc
public void showScriptJavadoc()Open a browser displaying javadoc. -
moveFiles
Move files. (called by drag and drop handler).- Parameters:
directory
- directory to moves files tofilesToMove
- files to move to directory
-