Merge remote-tracking branch 'refs/remotes/origin/master' into desktop 36/5236/1
Allan CORNET [Thu, 13 Oct 2011 12:57:19 +0000 (14:57 +0200)]
Conflicts:
scilab/CHANGES_5.4.X

Change-Id: I03d632d3048fbd5e55fc6791a3c83545e0e7c758

261 files changed:
SEP/SEP_068_FileBrowser.odt [new file with mode: 0644]
scilab/CHANGES_5.4.X
scilab/Version.incl
scilab/configure
scilab/configure.ac
scilab/etc/classpath.xml.vc
scilab/etc/librarypath.xml
scilab/modules/commons/includes/fileutils.h [new file with mode: 0644]
scilab/modules/commons/src/c/commons.vcxproj
scilab/modules/commons/src/c/commons.vcxproj.filters
scilab/modules/commons/src/c/fileutils.c [new file with mode: 0644]
scilab/modules/commons/src/java/org/scilab/modules/commons/CommonFileUtils.java [new file with mode: 0644]
scilab/modules/commons/src/java/org/scilab/modules/commons/CommonFileUtilsJNI.java [new file with mode: 0644]
scilab/modules/commons/src/java/org/scilab/modules/commons/ScilabCommonsUtils.java
scilab/modules/commons/src/java/org/scilab/modules/commons/gui/ScilabGUIUtilities.java [new file with mode: 0644]
scilab/modules/commons/src/java/org/scilab/modules/commons/xml/ScilabXMLUtilities.java [new file with mode: 0644]
scilab/modules/commons/src/jni/CommonFileUtils.i [new file with mode: 0644]
scilab/modules/commons/src/jni/CommonFileUtils_wrap.c [new file with mode: 0644]
scilab/modules/console/src/c/fileio_Import.def
scilab/modules/console/src/c/ui_data_Import.def
scilab/modules/console/src/java/org/scilab/modules/console/SciConsole.java
scilab/modules/console/src/java/org/scilab/modules/console/SciInputCommandView.java
scilab/modules/console/src/java/org/scilab/modules/console/SciOutputView.java
scilab/modules/core/Makefile.am
scilab/modules/core/Makefile.in
scilab/modules/core/includes/version.h.in
scilab/modules/core/includes/version.h.vc
scilab/modules/core/sci_gateway/c/sci_exit.c
scilab/modules/core/src/c/getvariablesname.c
scilab/modules/core/src/c/sciquit.c
scilab/modules/core/src/java/org/scilab/modules/core/ConsoleTab.java [new file with mode: 0644]
scilab/modules/core/src/java/org/scilab/modules/core/ConsoleTabFactory.java [new file with mode: 0644]
scilab/modules/core/src/java/org/scilab/modules/core/Scilab.java
scilab/modules/fileio/fileio.vcxproj
scilab/modules/fileio/fileio.vcxproj.filters
scilab/modules/fileio/includes/sendtorecyclebin.h [moved from scilab/modules/gui/src/c/TerminateGui.c with 55% similarity]
scilab/modules/fileio/src/c/sendtorecyclebin.c [new file with mode: 0644]
scilab/modules/gui/Makefile.am
scilab/modules/gui/Makefile.in
scilab/modules/gui/etc/main_menubar.xml
scilab/modules/gui/etc/main_toolbar.xml
scilab/modules/gui/etc/windowsConfiguration.xml [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/actions/edit-clear.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/application-pdf.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/binary.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/dynamic-blue-up.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/emblem-readonly.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/filter.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/folder-open.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/folder.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/go-next.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/go-previous.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/icon_scilab.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/image-x-generic.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/open-scilab-folder.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/open-user-home.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/scilab-folder.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/system-search.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/text-csv.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/text-html.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/text-x-generic.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/text-xml.png [new file with mode: 0644]
scilab/modules/gui/images/icons/16x16/filebrowser/user-home.png [new file with mode: 0644]
scilab/modules/gui/images/icons/32x32/actions/edit-clear.png [new file with mode: 0644]
scilab/modules/gui/images/icons/close-tab-on.png [new file with mode: 0644]
scilab/modules/gui/images/icons/close-tab.png
scilab/modules/gui/includes/CallMainWindow.h [deleted file]
scilab/modules/gui/src/c/LibScilab_Import.def
scilab/modules/gui/src/c/ScilabTermination.c [new file with mode: 0644]
scilab/modules/gui/src/c/ScilabTermination.h [new file with mode: 0644]
scilab/modules/gui/src/c/gui.vcxproj
scilab/modules/gui/src/c/gui.vcxproj.filters
scilab/modules/gui/src/cpp/CallMainWindow.cpp [deleted file]
scilab/modules/gui/src/java/org/scilab/modules/gui/ScilabTermination.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/ScilabTerminationJNI.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/CallScilabBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/ScilabBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/console/SwingScilabConsole.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/helpbrowser/SwingScilabHelpBrowser.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/helpbrowser/SwingScilabHelpBrowserViewer.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/messagebox/SwingScilabMessageBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabTab.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/window/SwingScilabWindow.java
scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/ScilabHelpBrowser.java
scilab/modules/gui/src/java/org/scilab/modules/gui/messagebox/ScilabModalDialog.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tab/ScilabTab.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tab/ScilabTabBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tab/SimpleTab.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tab/Tab.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tabfactory/AbstractScilabTabFactory.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/tabfactory/HelpBrowserTab.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/tabfactory/HelpBrowserTabFactory.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/tabfactory/ScilabTabFactory.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/BarUpdater.java
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/ClosingOperationsManager.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/ConfigManager.java
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/SciClosingAction.java
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/SciDockingListener.java
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/SciUndockingAction.java
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/WindowsConfigurationManager.java [new file with mode: 0644]
scilab/modules/gui/src/jni/CallScilabBridge.cpp
scilab/modules/gui/src/jni/CallScilabBridge.giws.xml
scilab/modules/gui/src/jni/CallScilabBridge.hxx
scilab/modules/gui/src/jni/ScilabTermination.i [new file with mode: 0644]
scilab/modules/gui/src/jni/ScilabTermination_wrap.c [new file with mode: 0644]
scilab/modules/helptools/src/java/org/scilab/modules/helptools/SciDocMain.java
scilab/modules/history_browser/src/java/history_browser-JAVA.vcxproj
scilab/modules/history_browser/src/java/org/scilab/modules/history_browser/CommandHistory.java
scilab/modules/history_browser/src/java/org/scilab/modules/history_browser/CommandHistoryTab.java [new file with mode: 0644]
scilab/modules/history_browser/src/java/org/scilab/modules/history_browser/CommandHistoryTabFactory.java [new file with mode: 0644]
scilab/modules/history_browser/src/java/org/scilab/modules/history_browser/actions/CloseAction.java
scilab/modules/history_manager/sci_gateway/c/sci_historymanager.c
scilab/modules/history_manager/src/c/getCommentDateSession.c
scilab/modules/history_manager/src/c/getCommentDateSession.h
scilab/modules/history_manager/src/cpp/HistoryManager.cpp
scilab/modules/jvm/includes/InitializeJVM.h
scilab/modules/jvm/libjvm_export.def
scilab/modules/jvm/src/c/InitializeJVM.c
scilab/modules/jvm/src/c/createMainScilabObject.c
scilab/modules/jvm/src/c/createMainScilabObject.h
scilab/modules/jvm/src/nojvm/nojvm.c
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/SciNotes.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/SciNotesGUI.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/ScilabEditorPane.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/ScilabLexer.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/SearchManager.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/actions/CodeNavigatorAction.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/actions/ExitAction.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/actions/FindAction.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/actions/RemoveAnchorAction.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/actions/RestoreOpenedFilesAction.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/actions/SetAnchorAction.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/tabfactory/CodeNavigatorTab.java [new file with mode: 0644]
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/tabfactory/CodeNavigatorTabFactory.java [new file with mode: 0644]
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/tabfactory/SciNotesTab.java [new file with mode: 0644]
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/tabfactory/SciNotesTabFactory.java [new file with mode: 0644]
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/tabfactory/SearchInFilesTab.java [new file with mode: 0644]
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/tabfactory/SearchInFilesTabFactory.java [new file with mode: 0644]
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/utils/ConfigSciNotesManager.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/utils/DropFilesListener.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/utils/NavigatorWindow.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/utils/SciNotesContents.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/utils/ScilabTabbedPane.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/utils/SearchFile.java
scilab/modules/scinotes/src/java/scinotes-JAVA.vcxproj
scilab/modules/scinotes/src/jflex/scilab.jflex
scilab/modules/types/src/java/org/scilab/modules/types/ScilabTypeEnumDescription.java [new file with mode: 0644]
scilab/modules/ui_data/Makefile.am
scilab/modules/ui_data/Makefile.in
scilab/modules/ui_data/images/icons/array_up.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/boolean.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/cell.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/double.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/fptr.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/function.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/handle.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/int.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/list.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/mlist.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/noicon.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/object.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/polynomial.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/sparse.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/string.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/timeseries.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/tlist.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/tp00.gif [deleted file]
scilab/modules/ui_data/images/icons/tp01.gif [deleted file]
scilab/modules/ui_data/images/icons/tp02.gif [deleted file]
scilab/modules/ui_data/images/icons/tp04.gif [deleted file]
scilab/modules/ui_data/images/icons/tp05.gif [deleted file]
scilab/modules/ui_data/images/icons/tp06.gif [deleted file]
scilab/modules/ui_data/images/icons/tp08.gif [deleted file]
scilab/modules/ui_data/images/icons/tp10.gif [deleted file]
scilab/modules/ui_data/images/icons/tp15.gif [deleted file]
scilab/modules/ui_data/images/icons/tp16.gif [deleted file]
scilab/modules/ui_data/images/icons/tp17.gif [deleted file]
scilab/modules/ui_data/images/icons/uint.png [new file with mode: 0644]
scilab/modules/ui_data/images/icons/user.png [new file with mode: 0644]
scilab/modules/ui_data/includes/FileBrowserChDir.h [new file with mode: 0644]
scilab/modules/ui_data/includes/gw_ui_data.h
scilab/modules/ui_data/sci_gateway/c/gw_ui_data.c
scilab/modules/ui_data/sci_gateway/cpp/sci_browsevar.cpp
scilab/modules/ui_data/sci_gateway/cpp/sci_filebrowser.cpp [new file with mode: 0644]
scilab/modules/ui_data/sci_gateway/ui_data_gateway.xml
scilab/modules/ui_data/src/c/ui_data.vcxproj
scilab/modules/ui_data/src/c/ui_data.vcxproj.filters
scilab/modules/ui_data/src/cpp/FileBrowserChDir.cpp [new file with mode: 0644]
scilab/modules/ui_data/src/cpp/UpdateBrowseVar.cpp
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/#BrowseVar.java# [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/BrowseVar.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/FileBrowser.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/BooleanFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/CompiledFunctionFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/DoubleFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/FilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/FunctionLibFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/GraphicHandlesFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/IntegerFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/ListFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/MListFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/PointerFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/PolynomialFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/ScilabVarFilteringAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/ScilabVarFilteringButtonAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/SparseBoolFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/SparseFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/StringFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/TListFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/actions/UncompiledFunctionFilteringAction.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/AbstractScilabTreeTableModel.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/FileBrowserRowSorter.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/FileComparators.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/FileNode.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/FileUtils.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/ScilabFileBrowser.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/ScilabFileBrowserComponent.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/ScilabFileBrowserHistory.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/ScilabFileBrowserModel.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/ScilabFileSelectorComboBox.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/ScilabFileSelectorFilter.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/ScilabFileSelectorPanel.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/ScilabTreeTableCellRenderer.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/ScilabTreeTableModel.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/ScilabTreeTableModelAdapter.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/SwingScilabFileBrowser.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/SwingScilabTreeTable.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/actions/ChangeCWDAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/actions/CloseAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/actions/EditFileWithDefaultAppAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/actions/ExecuteCommandAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/actions/ExecuteFileInConsoleAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/actions/ExecuteFileInXcosAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/actions/GoToHomeAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/actions/GoToSCIAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/actions/LoadFileAsGraphAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/actions/LoadFileInScilabAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/actions/OpenFileInSciNotesAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/actions/OpenFileWithDefaultAppAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/actions/ValidateAction.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/tabfactory/FileBrowserTab.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/tabfactory/FileBrowserTabFactory.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/tabfactory/VariableBrowserTab.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/tabfactory/VariableBrowserTabFactory.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/utils/UiDataMessages.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/variablebrowser/ScilabVariableBrowser.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/variablebrowser/SwingScilabVariableBrowser.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/variablebrowser/VariableBrowser.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/variablebrowser/rowfilter/VariableBrowserRowDataFilter.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/variablebrowser/rowfilter/VariableBrowserRowFilter.java [deleted file]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/variablebrowser/rowfilter/VariableBrowserRowTypeFilter.java [new file with mode: 0644]
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/variableeditor/SwingScilabVariableEditor.java
scilab/modules/ui_data/src/java/ui_data-JAVA.vcxproj
scilab/modules/ui_data/src/jni/BrowseVar.cpp
scilab/modules/ui_data/src/jni/BrowseVar.giws.xml
scilab/modules/ui_data/src/jni/BrowseVar.hxx
scilab/modules/ui_data/src/jni/FileBrowser.cpp [new file with mode: 0644]
scilab/modules/ui_data/src/jni/FileBrowser.giws.xml [new file with mode: 0644]
scilab/modules/ui_data/src/jni/FileBrowser.hxx [new file with mode: 0644]
scilab/modules/ui_data/src/noui_data/noui_data.c
scilab/scilab-lib.properties.vc

diff --git a/SEP/SEP_068_FileBrowser.odt b/SEP/SEP_068_FileBrowser.odt
new file mode 100644 (file)
index 0000000..d788a9e
Binary files /dev/null and b/SEP/SEP_068_FileBrowser.odt differ
index 1b5eb3a..a50e03b 100644 (file)
@@ -154,12 +154,13 @@ Xcos:
 * bug 10003 fixed - The MAXMIN block did not update its display according to
                     the settings.
 
-* bug 10048 fixed - Superblock based blocks index sub-blocks 
+* bug 10048 fixed - Superblock based blocks index sub-blocks
                     parameters instead of looking for them.
 
-* bug 10069 fixed - AFFICH_m block did not update its display at 
+* bug 10069 fixed - AFFICH_m block did not update its display at
                     re-initialization.
 
+
 Localization:
 =============
 
@@ -168,8 +169,8 @@ Localization:
 * bug 10032 fixed - Force the unset of the environnement variable LANGUAGE to
                     tackle some issues.
 
-* bug 10032 fixed - Mac OS X locale detection did not take in account 
-                    the LANG variable. 
+* bug 10032 fixed - Mac OS X locale detection did not take in account
+                    the LANG variable.
 
 File input/output:
 ==================
@@ -440,6 +441,26 @@ Dynamic link:
 * bug 9930 fixed - ilib_build did not display all filenames used.
 
 
+Variable browser:
+=================
+
+* Shows the dimension of the variable by default.
+
+* Automatically resize the variable browser table when docked.
+
+* A tooltip has been added on the type column to display the name of the type.
+
+* A tooltip has been added on the size column to display the size in Bytes
+  (like in previous version of Scilab).
+
+
+History:
+========
+
+* Default text in history for a starting session has been changed for:
+"Begin Session : Tue Jun 21 14:35:45 2011" to "21/05/2011 14:11:19"
+
+
 Graphics:
 =========
 
@@ -557,6 +578,8 @@ Bug fixes:
 * bug 7249 fixed - 'string' function did not work with a macro as input argument
                    as documented.
 
+* bug 7333 fixed - In BrowseVar, variables could have a weird type number.
+
 * bug 7358 fixed - Help pages of type and typeof have now links to the actual
                    description pages.
 
index d66dd00..198aec9 100644 (file)
@@ -1 +1 @@
-SCIVERSION=Scilab-Branch-master-GIT
+SCIVERSION=Scilab-Branch-desktop-GIT
index 8bdc31f..0290e03 100755 (executable)
@@ -12527,8 +12527,8 @@ $as_echo "$as_me: WARNING: Could not find or use the Java package/jar flexdock u
 
 
 
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking minimal version (0.5.2) of flexdock" >&5
-$as_echo_n "checking minimal version (0.5.2) of flexdock... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking minimal version (0.5.3) of flexdock" >&5
+$as_echo_n "checking minimal version (0.5.3) of flexdock... " >&6; }
    saved_ac_java_classpath=$ac_java_classpath
    export ac_java_classpath="$FLEXDOCK:$ac_java_classpath"
    if test "x" == "x"; then
@@ -12539,7 +12539,7 @@ import org.flexdock.util.Utilities;
 
 public class conftest {
     public static void main(String[] argv) {
-        String minVersion="0.5.2";
+        String minVersion="0.5.3";
 
                             System.out.println(Utilities.VERSION);
                                   if (minVersion.compareTo(Utilities.VERSION) > 0) {
@@ -12569,7 +12569,7 @@ EOF
                    STDOUT=`cat conftest.java.output`
                 fi
                 echo "configure: CLASSPATH was $CLASSPATH" >&5
-                  as_fn_error $? "Wrong version of flexdock. Expected at least 0.5.2. Found $STDOUT" "$LINENO" 5
+                  as_fn_error $? "Wrong version of flexdock. Expected at least 0.5.3. Found $STDOUT" "$LINENO" 5
                             fi
         fi
         if test -f conftest.java.output; then
@@ -12579,7 +12579,7 @@ EOF
         echo "configure: failed program was:" >&5
         cat conftest.java >&5
         echo "configure: CLASSPATH was $CLASSPATH" >&5
-          as_fn_error $? "Wrong version of flexdock. Expected at least 0.5.2. Found $STDOUT" "$LINENO" 5
+          as_fn_error $? "Wrong version of flexdock. Expected at least 0.5.3. Found $STDOUT" "$LINENO" 5
             fi
 
    else
@@ -12590,7 +12590,7 @@ import org.flexdock.util.Utilities;
 
 public class conftest {
     public static void main(String[] argv) {
-        String minVersion="0.5.2";
+        String minVersion="0.5.3";
 
                             System.out.println(Utilities.VERSION);
                                   if (minVersion.compareTo(Utilities.VERSION) != 0) {
@@ -12620,7 +12620,7 @@ EOF
                    STDOUT=`cat conftest.java.output`
                 fi
                 echo "configure: CLASSPATH was $CLASSPATH" >&5
-                  as_fn_error $? "Wrong version of flexdock. Expected exact version 0.5.2. Found $STDOUT" "$LINENO" 5
+                  as_fn_error $? "Wrong version of flexdock. Expected exact version 0.5.3. Found $STDOUT" "$LINENO" 5
                             fi
         fi
         if test -f conftest.java.output; then
@@ -12630,7 +12630,7 @@ EOF
         echo "configure: failed program was:" >&5
         cat conftest.java >&5
         echo "configure: CLASSPATH was $CLASSPATH" >&5
-          as_fn_error $? "Wrong version of flexdock. Expected exact version 0.5.2. Found $STDOUT" "$LINENO" 5
+          as_fn_error $? "Wrong version of flexdock. Expected exact version 0.5.3. Found $STDOUT" "$LINENO" 5
             fi
 
     fi
index 28a9a4d..830719e 100644 (file)
@@ -861,7 +861,7 @@ if test "$with_javasci" != no -o "$with_gui" != no -o "$enable_build_help" != no
                 FLEXDOCK=$PACKAGE_JAR_FILE
                 AC_SUBST(FLEXDOCK)
 
-                AC_JAVA_CHECK_VERSION_PACKAGE([flexdock],[import org.flexdock.util.Utilities;],$FLEXDOCK,[0.5.2],[Utilities.VERSION])
+                AC_JAVA_CHECK_VERSION_PACKAGE([flexdock],[import org.flexdock.util.Utilities;],$FLEXDOCK,[0.5.3],[Utilities.VERSION])
 
                 # Swing look&feel implementations
                 AC_JAVA_CHECK_PACKAGE([looks],[com.jgoodies.looks.common.MenuItemRenderer],[Scilab Gui - Look and feel],"yes")
index 730a49e..e2f9762 100644 (file)
@@ -28,7 +28,7 @@ The option is "disableUnderMode" and can be:
 <classpaths>
 
 <!-- Mandatory on startup -->
-<path value="$SCILAB/thirdparty/flexdock-0.5.2.jar"/>
+<path value="$SCILAB/thirdparty/flexdock-0.5.3.jar"/>
 <path value="$SCILAB/thirdparty/jrosetta-API.jar" disableUnderMode="NW"/>
 <path value="$SCILAB/thirdparty/jrosetta-engine.jar"/>
 <path value="$SCILAB/thirdparty/skinlf.jar"/>
index 0f2207e..cdc53d3 100644 (file)
@@ -28,6 +28,7 @@
 <path value="$SCILAB/modules/graphic_export/.libs"/>
 <path value="$SCILAB/modules/scinotes/.libs"/>
 <path value="$SCILAB/modules/commons/.libs"/>
+<path value="$SCILAB/modules/gui/.libs"/>
 <path value="$SCILAB/.libs"/>
 
 <!-- Default path to the JNI classes under some Linux (JoGL under Debian for example) -->
diff --git a/scilab/modules/commons/includes/fileutils.h b/scilab/modules/commons/includes/fileutils.h
new file mode 100644 (file)
index 0000000..cc8ec49
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Calixte DENIZET
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+#ifndef __FILEUTILS_H__
+#define __FILEUTILS_H__
+/*--------------------------------------------------------------------------*/
+int isEmptyDirectory(char * dirName);
+/*--------------------------------------------------------------------------*/
+#endif /* __FILEUTILS_H__ */
index f633167..afec3a9 100644 (file)
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
+      <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>.;../../includes;../../../../libs/MALLOC/includes;../../../core/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../dynamic_link/src/c;../../../localization/includes;../../../core/src/c;../../../../libs/intl;../../../commons/includes;../../../api_scilab/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;COMMONS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <CompileAs>Default</CompileAs>
+      <DisableSpecificWarnings>4251</DisableSpecificWarnings>
     </ClCompile>
     <PreLinkEvent>
       <Message>Make dependencies</Message>
@@ -93,8 +101,13 @@ lib /DEF:"$(ProjectDir)commons_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     <Link>
       <AdditionalDependencies>LibScilab.lib;commons_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(SolutionDir)bin\sci$(ProjectName).dll</OutputFile>
+      <ModuleDefinitionFile>
+      </ModuleDefinitionFile>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
       <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
       <TargetMachine>MachineX86</TargetMachine>
       <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
@@ -109,8 +122,15 @@ lib /DEF:"$(ProjectDir)commons_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>.;../../includes;../../../../libs/MALLOC/includes;../../../core/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../dynamic_link/src/c;../../../localization/includes;../../../core/src/c;../../../../libs/intl;../../../commons/includes;../../../api_scilab/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;COMMONS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <CompileAs>Default</CompileAs>
+      <DisableSpecificWarnings>4251</DisableSpecificWarnings>
     </ClCompile>
     <PreLinkEvent>
       <Message>Make dependencies</Message>
@@ -120,8 +140,13 @@ lib /DEF:"$(ProjectDir)commons_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     <Link>
       <AdditionalDependencies>LibScilab.lib;commons_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(SolutionDir)bin\sci$(ProjectName).dll</OutputFile>
+      <ModuleDefinitionFile>
+      </ModuleDefinitionFile>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
       <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
       <TargetMachine>MachineX64</TargetMachine>
       <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
@@ -130,14 +155,22 @@ lib /DEF:"$(ProjectDir)commons_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
+      <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
       <AdditionalIncludeDirectories>.;../../includes;../../../../libs/MALLOC/includes;../../../core/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../dynamic_link/src/c;../../../localization/includes;../../../core/src/c;../../../../libs/intl;../../../commons/includes;../../../api_scilab/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;COMMONS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <CompileAs>Default</CompileAs>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <DisableSpecificWarnings>4251</DisableSpecificWarnings>
     </ClCompile>
     <PreLinkEvent>
       <Message>Make dependencies</Message>
@@ -147,10 +180,17 @@ lib /DEF:"$(ProjectDir)commons_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     <Link>
       <AdditionalDependencies>LibScilab.lib;commons_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(SolutionDir)bin\sci$(ProjectName).dll</OutputFile>
+      <ModuleDefinitionFile>
+      </ModuleDefinitionFile>
       <GenerateDebugInformation>false</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
       <OptimizeReferences>true</OptimizeReferences>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <LinkTimeCodeGeneration>
+      </LinkTimeCodeGeneration>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
       <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
       <TargetMachine>MachineX86</TargetMachine>
       <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
@@ -162,14 +202,21 @@ lib /DEF:"$(ProjectDir)commons_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
       <TargetEnvironment>X64</TargetEnvironment>
     </Midl>
     <ClCompile>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
       <AdditionalIncludeDirectories>.;../../includes;../../../../libs/MALLOC/includes;../../../core/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../dynamic_link/src/c;../../../localization/includes;../../../core/src/c;../../../../libs/intl;../../../commons/includes;../../../api_scilab/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;COMMONS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <CompileAs>Default</CompileAs>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <DisableSpecificWarnings>4251</DisableSpecificWarnings>
     </ClCompile>
     <PreLinkEvent>
       <Message>Make dependencies</Message>
@@ -179,10 +226,17 @@ lib /DEF:"$(ProjectDir)commons_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     <Link>
       <AdditionalDependencies>LibScilab.lib;commons_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(SolutionDir)bin\sci$(ProjectName).dll</OutputFile>
+      <ModuleDefinitionFile>
+      </ModuleDefinitionFile>
       <GenerateDebugInformation>false</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
       <OptimizeReferences>true</OptimizeReferences>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <LinkTimeCodeGeneration>
+      </LinkTimeCodeGeneration>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
       <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
       <TargetMachine>MachineX64</TargetMachine>
       <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
@@ -190,19 +244,24 @@ lib /DEF:"$(ProjectDir)commons_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\jni\CommonFileUtils_wrap.c" />
     <ClCompile Include="..\jni\GiwsException.cpp" />
     <ClCompile Include="DllmainCommons.c" />
     <ClCompile Include="..\jni\ScilabCommons_wrap.c" />
+    <ClCompile Include="fileutils.c" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\includes\dynlib_commons.h" />
+    <ClInclude Include="..\..\includes\fileutils.h" />
     <ClInclude Include="..\jni\GiwsException.hxx" />
   </ItemGroup>
   <ItemGroup>
     <None Include="commons_f_Import.def" />
     <None Include="LibScilab_Import.def" />
     <None Include="..\..\commons.iss" />
+    <None Include="..\..\sci_gateway\commons_gateway.xml" />
     <None Include="..\..\Makefile.am" />
+    <None Include="..\..\version.xml" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="commons.rc" />
@@ -219,6 +278,9 @@ lib /DEF:"$(ProjectDir)commons_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     <ProjectReference Include="..\..\..\fileio\fileio.vcxproj">
       <Project>{4fc72d4a-80ee-4b1a-8724-0201c1a35621}</Project>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\localization\src\localization.vcxproj">
+      <Project>{ecffeb0c-1eda-45ee-9a10-b18143852e17}</Project>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
index 2c010af..b1d1cfa 100644 (file)
     <ClCompile Include="..\jni\ScilabCommons_wrap.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="fileutils.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\jni\CommonFileUtils_wrap.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
     <ClCompile Include="..\jni\GiwsException.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -37,6 +43,9 @@
     <ClInclude Include="..\..\includes\dynlib_commons.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\includes\fileutils.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
     <ClInclude Include="..\jni\GiwsException.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -49,7 +58,9 @@
       <Filter>Libraries Dependencies\Imports</Filter>
     </None>
     <None Include="..\..\commons.iss" />
+    <None Include="..\..\sci_gateway\commons_gateway.xml" />
     <None Include="..\..\Makefile.am" />
+    <None Include="..\..\version.xml" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="commons.rc">
diff --git a/scilab/modules/commons/src/c/fileutils.c b/scilab/modules/commons/src/c/fileutils.c
new file mode 100644 (file)
index 0000000..2591647
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2011 - DIGITEO - Calixte DENIZET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#ifdef _MSC_VER
+#include <Windows.h>
+#include <stdio.h>
+#include "charEncoding.h"
+#else
+#include <sys/types.h>
+#include <dirent.h>
+#endif
+
+#include "PATH_MAX.h"
+#include <string.h>
+#include "fileutils.h"
+#include "MALLOC.h"
+
+/*--------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+int isEmptyDirectory(char * dirName)
+{
+    wchar_t *wcpath = NULL;
+       wchar_t wdirpath[PATH_MAX + FILENAME_MAX + 1];
+    HANDLE hFile;
+    WIN32_FIND_DATAW FileInformation;
+    int ret = 1;
+
+    wcpath = to_wide_string(dirName);
+       swprintf(wdirpath, wcslen(wcpath) + 2 + 1, L"%s\\*", wcpath);
+       FREE(wcpath);
+
+    hFile = FindFirstFileW(wdirpath, &FileInformation);
+    
+    if (hFile == INVALID_HANDLE_VALUE)
+    {
+        return 0;
+    }
+
+    do
+    {
+        if (!wcscmp(FileInformation.cFileName, L".") || !wcscmp(FileInformation.cFileName, L".."))
+        {
+            continue;
+        }
+
+        ret = 0;
+        break;
+    } while (FindNextFileW(hFile, &FileInformation) == TRUE);
+
+    FindClose(hFile);
+       
+    return ret;
+}
+/*--------------------------------------------------------------------------*/
+#else
+/*--------------------------------------------------------------------------*/
+int isEmptyDirectory(char * dirName)
+{
+    DIR *dir = NULL;
+#ifdef __APPLE__
+    struct dirent *ptr;
+    struct dirent *result;
+#else
+    struct dirent64 *ptr;
+    struct dirent64 *result;
+#endif
+    int ret = 1;
+
+    dir = opendir(dirName);
+    if (dir == NULL)
+    {
+        return 0;
+    }
+
+#ifdef __APPLE__
+    ptr = MALLOC(sizeof(struct dirent) + (PATH_MAX + 1));
+#else
+    ptr = MALLOC(sizeof(struct dirent64) + (PATH_MAX + 1));
+#endif
+    if (ptr == NULL)
+    {
+        closedir(dir);
+        return 0;
+    }
+
+#ifdef __APPLE__
+    while ((readdir_r(dir, ptr, &result) == 0)  && (result != NULL))
+#else
+        while ((readdir64_r(dir, ptr, &result) == 0)  && (result != NULL))
+#endif
+        {
+            if (!strcmp(ptr->d_name, ".") || !strcmp(ptr->d_name, ".."))
+            {
+                continue;
+            }
+
+            ret = 0;
+            break;
+        }
+
+    FREE(ptr);
+    closedir(dir);
+
+    return ret;
+}
+#endif
diff --git a/scilab/modules/commons/src/java/org/scilab/modules/commons/CommonFileUtils.java b/scilab/modules/commons/src/java/org/scilab/modules/commons/CommonFileUtils.java
new file mode 100644 (file)
index 0000000..d7aca18
--- /dev/null
@@ -0,0 +1,29 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.40
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.scilab.modules.commons;
+
+
+ /** 
+   * Some file utils
+   * @author Calixte DENIZET
+   * @copyright DIGITEO 2011
+   */
+public class CommonFileUtils {
+
+ /**
+   * Constructor
+   */
+ protected CommonFileUtils() {
+    throw new UnsupportedOperationException();
+ }
+  public static int isEmptyDirectory(String dirName) {
+    return CommonFileUtilsJNI.isEmptyDirectory(dirName);
+  }
+
+}
diff --git a/scilab/modules/commons/src/java/org/scilab/modules/commons/CommonFileUtilsJNI.java b/scilab/modules/commons/src/java/org/scilab/modules/commons/CommonFileUtilsJNI.java
new file mode 100644 (file)
index 0000000..827de46
--- /dev/null
@@ -0,0 +1,48 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.40
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.scilab.modules.commons;
+
+
+/* It is generated code. Disable checkstyle */
+//CHECKSTYLE:OFF
+ /** 
+   * Some file utils
+   * @author Calixte DENIZET
+   * @copyright DIGITEO 2011
+   */
+public class CommonFileUtilsJNI {
+
+  /**
+    * Constructor
+    */
+  protected CommonFileUtilsJNI() {
+    throw new UnsupportedOperationException();
+  }
+
+  static {
+    try {
+        System.loadLibrary("scicommons");
+    } catch (SecurityException e) {
+        System.err.println("A security manager exists and does not allow the loading of the specified dynamic library.");
+        System.err.println(e.getLocalizedMessage());
+        System.exit(-1);
+    } catch (UnsatisfiedLinkError e)    {
+           System.err.println("The native library scicommons does not exist or cannot be found.");
+        if (System.getenv("CONTINUE_ON_JNI_ERROR") == null) {
+           System.err.println(e.getLocalizedMessage());
+           System.err.println("Current java.library.path is : "+System.getProperty("java.library.path"));
+           System.exit(-1);
+        }else{
+           System.err.println("Continuing anyway because of CONTINUE_ON_JNI_ERROR");
+        }
+    }
+  }
+
+  public final static native int isEmptyDirectory(String jarg1);
+}
index 11b98b5..ac776c8 100644 (file)
 
 package org.scilab.modules.commons;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
 import java.lang.reflect.Method;
 import java.math.BigInteger;
 import java.security.MessageDigest;
@@ -23,6 +27,8 @@ import java.security.NoSuchAlgorithmException;
  */
 public final class ScilabCommonsUtils {
 
+    private static final int BUFFERSIZE = 8192;
+
     private static MessageDigest MD5;
     static {
         try {
@@ -48,6 +54,51 @@ public final class ScilabCommonsUtils {
     }
 
     /**
+     * Copy a file
+     * @param inFile src file
+     * @param outFile dest file
+     * @return true if the operation succeeded
+     */
+    public static boolean copyFile(File inFile, File outFile) {
+        FileInputStream in = null;
+        FileOutputStream out = null;
+        boolean success = false;
+
+        try {
+            in = new FileInputStream(inFile);
+            out = new FileOutputStream(outFile);
+            byte[] buffer = new byte[BUFFERSIZE];
+            int n;
+
+            while ((n = in.read(buffer)) != -1) {
+                out.write(buffer, 0, n);
+            }
+            out.flush();
+            success = true;
+        } catch (IOException e) {
+            System.err.println("Error in copying file " + inFile.getAbsolutePath() + " to " + outFile.getAbsolutePath());
+            System.err.println(e);
+        } finally {
+            if (in != null) {
+                try {
+                    in.close();
+                } catch (IOException e) {
+                    System.err.println(e);
+                }
+            }
+            if (out != null) {
+                try {
+                    out.close();
+                } catch (IOException e) {
+                    System.err.println(e);
+                }
+            }
+        }
+
+        return success;
+    }
+
+    /**
      * Load on use
      * @param str the action
      */
diff --git a/scilab/modules/commons/src/java/org/scilab/modules/commons/gui/ScilabGUIUtilities.java b/scilab/modules/commons/src/java/org/scilab/modules/commons/gui/ScilabGUIUtilities.java
new file mode 100644 (file)
index 0000000..65e0fe3
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2011 - Calixte DENIZET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+package org.scilab.modules.commons.gui;
+
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowFocusListener;
+
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+/**
+ * GUI utilities
+ * @author Calixte DENIZET
+ */
+public class ScilabGUIUtilities {
+
+    /**
+     * Bring a window to the front
+     * @param window the window to bring to the front
+     */
+    public static void toFront(final JFrame window) {
+        WindowFocusListener listener = new WindowFocusListener() {
+
+                public void windowGainedFocus(WindowEvent e) {
+                    window.setAlwaysOnTop(true);
+                }
+
+                public void windowLostFocus(WindowEvent e) {
+                    window.setAlwaysOnTop(false);
+                    window.removeWindowFocusListener(this);
+                }
+            };
+        window.addWindowFocusListener(listener);
+        window.toFront();
+        SwingUtilities.invokeLater(new Runnable() {
+                public void run() {
+                    window.requestFocus();
+                }
+            });
+    }
+}
diff --git a/scilab/modules/commons/src/java/org/scilab/modules/commons/xml/ScilabXMLUtilities.java b/scilab/modules/commons/src/java/org/scilab/modules/commons/xml/ScilabXMLUtilities.java
new file mode 100644 (file)
index 0000000..8dea0f6
--- /dev/null
@@ -0,0 +1,486 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2010 - Calixte DENIZET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+package org.scilab.modules.commons.xml;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.xml.sax.SAXException;
+
+import org.scilab.modules.localization.Messages;
+
+/**
+ * Class to provide different tools to manage xml.
+ *
+ * @author Calixte DENIZET
+ */
+public class ScilabXMLUtilities {
+
+    private static final String ENCODING = "UTF-8";
+    private static final String ERROR_WRITE = Messages.gettext("Could not save file: ");
+    private static final String ERROR_READ = Messages.gettext("Could not load file: ");
+    private static final Integer INDENTATION = new Integer(4);
+
+    private static Transformer transformer;
+
+    /**
+     * Read a xml file and parse it
+     * @param fileToRead the file to read
+     * @return the corresponding document
+     */
+    public static Document readDocument(String fileToRead) {
+        Document doc = null;
+        try {
+            DocumentBuilderFactory factory = ScilabDocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = factory.newDocumentBuilder();
+            doc = docBuilder.parse(new File(fileToRead));
+        } catch (ParserConfigurationException e) {
+            System.err.println(ERROR_READ + fileToRead);
+        } catch (SAXException e) {
+            System.err.println(ERROR_READ + fileToRead);
+        } catch (IOException e) {
+            System.err.println(ERROR_READ + fileToRead);
+        }
+
+        return doc;
+    }
+
+    /**
+     * Write a Document in a file. The empty lines are removed and the xml code is indented
+     * @param doc the document to write
+     * @param fileName the file name
+     */
+    public static void writeDocument(Document doc, String fileName) {
+        if (doc != null && fileName != null) {
+            if (transformer == null) {
+                initTransformer();
+            }
+
+            if (transformer != null) {
+                removeEmptyLines(doc.getDocumentElement());
+
+                FileOutputStream fos = null;
+                OutputStreamWriter osw = null;
+
+                try {
+                    /* FileOutputStream & OutputStreamWriter are needed to be sure that
+                       the indentation will be correct (known Java bug) */
+
+                    fos = new FileOutputStream(fileName, false);
+                    osw = new OutputStreamWriter(fos, ENCODING);
+                    transformer.transform(new DOMSource(doc), new StreamResult(osw));
+                } catch (FileNotFoundException e) {
+                    System.err.println(ERROR_WRITE + fileName);
+                    System.err.println(e);
+                } catch (UnsupportedEncodingException e) {
+                    System.err.println(ERROR_WRITE + fileName);
+                    System.err.println(e);
+                } catch (TransformerException e) {
+                    System.err.println(ERROR_WRITE + fileName);
+                    System.err.println(e);
+                } finally {
+                    if (osw != null) {
+                        try {
+                            osw.close();
+                        } catch (IOException ex) {
+                            System.err.println(ex);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Remove empty lines which are a descendant of node
+     * @param node the initial node
+     */
+    public static void removeEmptyLines(Node node) {
+        Set<Node> nodesToRemove = new HashSet<Node>();
+        collectEmptyLines(node, nodesToRemove);
+        for (Node n : nodesToRemove) {
+            n.getParentNode().removeChild(n);
+        }
+    }
+
+    /**
+     * Collect the empty lines to remove
+     * @param node the parent node
+     * @param nodesToRemove the set containing the nodes to remove
+     */
+    private static void collectEmptyLines(Node node, Set<Node> nodesToRemove) {
+        if (node != null) {
+            NodeList list = node.getChildNodes();
+            int length = getNodeListLength(list);
+            for (int i = 0; i < length; i++) {
+                Node n = list.item(i);
+                if (n != null) {
+                    if (n.getNodeType() == Node.TEXT_NODE) {
+                        nodesToRemove.add(n);
+                    } else {
+                        collectEmptyLines(n, nodesToRemove);
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Replace or create a named node with parent element
+     * @param doc the document
+     * @param parent the parent element
+     * @param nodeName the node name
+     * @param attr an array containing attribute name followed by its value: "attr1", 1, "attr2", true, ...
+     * @return the created element
+     */
+    public static Element replaceNamedNode(Document doc, Element parent, String nodeName, Object[] attr) {
+        NodeList children = parent.getElementsByTagName(nodeName);
+        Element elem;
+        if (getNodeListLength(children) > 0) {
+            elem = (Element) children.item(0);
+        } else {
+            elem = doc.createElement(nodeName);
+            parent.appendChild(elem);
+        }
+
+        for (int i = 0; i < attr.length; i += 2) {
+            elem.setAttribute(attr[i].toString(), attr[i + 1].toString());
+        }
+
+        return elem;
+    }
+
+    /**
+     * Replace or create a named node with parent element
+     * @param doc the document
+     * @param parent the name of the parent element
+     * @param nodeName the node name
+     * @param attr an array containing attribute name followed by its value: "attr1", 1, "attr2", true, ...
+     * @return the created element
+     */
+    public static Element replaceNamedNode(Document doc, String parent, String nodeName, Object[] attr) {
+        NodeList parents = doc.getDocumentElement().getElementsByTagName(parent);
+        if (getNodeListLength(parents) > 0) {
+            return replaceNamedNode(doc, (Element) parents.item(0), nodeName, attr);
+        }
+
+        return null;
+    }
+
+    /**
+     * Replace or create a named node with parent element
+     * @param doc the document
+     * @param parent the parent element
+     * @param nodeName the node name
+     * @param map a map containing {attributes -&gt; value}, the method value.toString() will be used.
+     * @return the created element
+     */
+    public static Element replaceNamedNode(Document doc, Element parent, String nodeName, Map<String, Object> map) {
+        NodeList children = parent.getElementsByTagName(nodeName);
+        Element elem;
+        if (getNodeListLength(children) > 0) {
+            elem = (Element) children.item(0);
+        } else {
+            elem = doc.createElement(nodeName);
+            parent.appendChild(elem);
+        }
+
+        for (String name : map.keySet()) {
+            elem.setAttribute(name, map.get(name).toString());
+        }
+
+        return elem;
+    }
+
+    /**
+     * Replace or create a named node with parent element
+     * @param doc the document
+     * @param parent the name of the parent element
+     * @param nodeName the node name
+     * @param map a map containing {attributes -&gt; value}, the method value.toString() will be used.
+     * @return the created element
+     */
+    public static Element replaceNamedNode(Document doc, String parent, String nodeName, Map<String, Object> map) {
+        NodeList parents = doc.getDocumentElement().getElementsByTagName(parent);
+        if (getNodeListLength(parents) > 0) {
+            return replaceNamedNode(doc, (Element) parents.item(0), nodeName, map);
+        }
+
+        return null;
+    }
+
+    /**
+     * Create a new node with parent element
+     * @param doc the document
+     * @param parent the parent element
+     * @param nodeName the node name
+     * @param attr an array containing attribute name followed by its value: "attr1", 1, "attr2", true, ...
+     * @return the created element
+     */
+    public static Element createNode(Document doc, Element parent, String nodeName, Object[] attr) {
+        Element elem = doc.createElement(nodeName);
+        for (int i = 0; i < attr.length; i += 2) {
+            elem.setAttribute(attr[i].toString(), attr[i + 1].toString());
+        }
+        parent.appendChild(elem);
+
+        return elem;
+    }
+
+    /**
+     * Create a new node with parent element
+     * @param doc the document
+     * @param parent the parent element
+     * @param nodeName the node name
+     * @param map a map containing {attributes -&gt; value}, the method value.toString() will be used.
+     * @return the created element
+     */
+    public static Element createNode(Document doc, Element parent, String nodeName, Map<String, Object> map) {
+        Element elem = doc.createElement(nodeName);
+        for (String name : map.keySet()) {
+            elem.setAttribute(name, map.get(name).toString());
+        }
+        parent.appendChild(elem);
+
+        return elem;
+    }
+
+    /**
+     * Read the attributes of elem.
+     * Map must be like this: "attr1" -&gt; integer.class, "attr2" -&gt; boolean.class, ...
+     * Map will be filled with the value (as Object) of the different attributes
+     * @param elem the element to analyze
+     * @param map the map containing the attributes type.
+     */
+    public static void readNodeAttributes(Element elem, Map<String, Object> map) {
+        NamedNodeMap attrMap = elem.getAttributes();
+        for (int i = 0; i < attrMap.getLength(); i++) {
+            Attr attr = (Attr) attrMap.item(i);
+            String key = attr.getName();
+            if (map.containsKey(key)) {
+                map.put(key, convert(attr.getValue(), (Class) map.get(key)));
+            }
+        }
+    }
+
+    /**
+     * Read the attributes of elem.
+     * Map must be like this: Object[]{"attr1", integer.class, "attr2", boolean.class, ...}
+     * Map will be filled with the value (as Object) of the different attributes
+     * @param elem the element to analyze
+     * @param map the map containing the attributes type.
+     */
+    public static void readNodeAttributes(Element elem, Object[] map) {
+        NamedNodeMap attrMap = elem.getAttributes();
+        for (int i = 0; i < attrMap.getLength(); i++) {
+            Attr attr = (Attr) attrMap.item(i);
+            String key = attr.getName();
+            for (int j = 0; j < map.length; j += 2) {
+                if (map[j].equals(key)) {
+                    map[j + 1] = convert(attr.getValue(), (Class) map[j + 1]);
+                }
+            }
+        }
+    }
+
+    /**
+     * Read the attributes of first element named nodeName in the document.
+     * Map must be like this: "attr1" -&gt; integer.class, "attr2" -&gt; boolean.class, ...
+     * Map will be filled with the value (as Object) of the different attributes
+     * @param doc the document
+     * @param nodeName the node name
+     * @param map the map containing the attributes type.
+     * @return the corresponding element or null if it doesn't exist
+     */
+    public static Element readNodeAttributes(Document doc, String nodeName, Map<String, Object> map) {
+        NodeList list = doc.getDocumentElement().getElementsByTagName(nodeName);
+        if (getNodeListLength(list) > 0) {
+            Node n = list.item(0);
+            if (n instanceof Element) {
+                readNodeAttributes((Element) n, map);
+                return (Element) n;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Read the attributes of first element named nodeName in the document.
+     * Map must be like this: Object[]{"attr1", integer.class, "attr2", boolean.class, ...}
+     * Map will be filled with the value (as Object) of the different attributes
+     * @param doc the document
+     * @param nodeName the node name
+     * @param map the map containing the attributes type.
+     * @return the corresponding element or null if it doesn't exist
+     */
+    public static Element readNodeAttributes(Document doc, String nodeName, Object[] map) {
+        NodeList list = doc.getDocumentElement().getElementsByTagName(nodeName);
+        if (getNodeListLength(list) > 0) {
+            Node n = list.item(0);
+            if (n instanceof Element) {
+                readNodeAttributes((Element) n, map);
+                return (Element) n;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Retrieve the list of the elements which have an attribute equals to the given value.
+     * @param root the root element
+     * @param attribute the attribute name
+     * @param value the value
+     * @return the list
+     */
+    public static List<Element> getElementsWithAttributeEquals(Element root, String attribute, String value) {
+        List<Element> list = new ArrayList<Element>();
+        getElementsWithAttributeEquals(root, attribute, value, list);
+
+        return list;
+    }
+
+    /**
+     * Retrieve the list of the elements which have an attribute equals to the given value (recursive function).
+     * @param root the root element
+     * @param attribute the attribute name
+     * @param value the value
+     * @param list the list to fill
+     */
+    private static final void getElementsWithAttributeEquals(Element root, String attribute, String value, List<Element> list) {
+        if (root.getAttribute(attribute).equals(value)) {
+            list.add(root);
+        }
+        if (root.hasChildNodes()) {
+            NodeList nodes = root.getChildNodes();
+            int length = nodes.getLength();
+            for (int i = 0; i < length; i++) {
+                Node node = nodes.item(i);
+                if (node instanceof Element) {
+                    Element elem = (Element) nodes.item(i);
+                    getElementsWithAttributeEquals(elem, attribute, value, list);
+                }
+            }
+        }
+    }
+
+    /**
+     * Convert a value (as String) into an object according to its class type giving in clazz
+     * @param value the value to convert
+     * @param clazz the class type of the value
+     * @return the converted object
+     */
+    private static final Object convert(String value, Class clazz) {
+        if (clazz == int.class) {
+            return Integer.parseInt(value);
+        } else if (clazz == float.class) {
+            return Float.parseFloat(value);
+        } else if (clazz == boolean.class) {
+            return Boolean.parseBoolean(value);
+        } else if (clazz == double.class) {
+            return Double.parseDouble(value);
+        } else if (clazz == short.class) {
+            return Short.parseShort(value);
+        } else if (clazz == long.class) {
+            return Long.parseLong(value);
+        } else if (clazz == byte.class) {
+            return Byte.parseByte(value);
+        } else if (clazz == char.class) {
+            return value.length() == 0 ? '\0' : value.charAt(0);
+        } else if (clazz == String[].class) {
+            return getArray(value, ";");
+        }
+
+        return value;
+    }
+
+    /**
+     * Get an array from a string containing strings separated with a delimitor
+     * @param value the string to parse
+     * @param delimitor the delimitor
+     * @return an array of String
+     */
+    private static final String[] getArray(String value, String delimitor) {
+        StringTokenizer tokens = new StringTokenizer(value, delimitor);
+        String[] arr = new String[tokens.countTokens()];
+        for (int i = 0; i < arr.length; i++) {
+            arr[i] = tokens.nextToken();
+        }
+
+        return arr;
+    }
+
+    /**
+     * Init the transformer
+     */
+    private static final void initTransformer() {
+        try {
+            TransformerFactory factory = ScilabTransformerFactory.newInstance();
+            factory.setAttribute("indent-number", INDENTATION);
+            transformer = factory.newTransformer();
+            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+            transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
+            transformer.setOutputProperty(OutputKeys.ENCODING, ENCODING);
+        } catch (TransformerConfigurationException e) {
+            System.err.println("Problem to init the Transformer to write xml files");
+            System.err.println(e);
+        } catch (TransformerFactoryConfigurationError e) {
+            System.err.println("Problem to init the Transformer to write xml files");
+            System.err.println(e);
+        }
+    }
+
+    /**
+     * @param list a node list
+     * @return the length
+     */
+    private static int getNodeListLength(NodeList list) {
+        int length = 0;
+        try {
+            length = list.getLength();
+        } catch (NullPointerException e) {
+            /* Avoid Java bug */
+        }
+        return length;
+    }
+}
diff --git a/scilab/modules/commons/src/jni/CommonFileUtils.i b/scilab/modules/commons/src/jni/CommonFileUtils.i
new file mode 100644 (file)
index 0000000..de444a2
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) DIGITEO - 2011 - Calixte DENIZET
+ * 
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at    
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+
+/* CommonFileUtils.i */
+/** 
+ * Windows: swig -java -package org.scilab.modules.commons -outdir ../java/org/scilab/modules/commons/ CommonFileUtils.i 
+ * Other: Use the option --enable-build-swig to the configure
+*/
+%module CommonFileUtils
+%{
+#include "../../includes/fileutils.h"
+%}
+
+/* JavaDoc for CommonFileUtilsJNI class */
+%pragma(java) jniclassclassmodifiers=%{
+/* It is generated code. Disable checkstyle */
+//CHECKSTYLE:OFF
+ /** 
+   * Some file utils
+   * @author Calixte DENIZET
+   * @copyright DIGITEO 2011
+   */
+public class%}
+
+/* Constructor for CommonFileUtilsJNI class */
+%pragma(java) jniclasscode="
+  /**
+    * Constructor
+    */
+  protected CommonFileUtilsJNI() {
+    throw new UnsupportedOperationException();
+  }";
+  
+/* static load of library */
+%pragma(java) jniclasscode=%{
+  static {
+    try {
+        System.loadLibrary("scicommons");
+    } catch (SecurityException e) {
+        System.err.println("A security manager exists and does not allow the loading of the specified dynamic library.");
+        System.err.println(e.getLocalizedMessage());
+        System.exit(-1);
+    } catch (UnsatisfiedLinkError e)    {
+           System.err.println("The native library scicommons does not exist or cannot be found.");
+        if (System.getenv("CONTINUE_ON_JNI_ERROR") == null) {
+           System.err.println(e.getLocalizedMessage());
+           System.err.println("Current java.library.path is : "+System.getProperty("java.library.path"));
+           System.exit(-1);
+        }else{
+           System.err.println("Continuing anyway because of CONTINUE_ON_JNI_ERROR");
+        }
+    }
+  }
+%}
+
+
+/* JavaDoc for CommonFileUtils class */
+%pragma(java) moduleclassmodifiers="
+ /** 
+   * Some file utils
+   * @author Calixte DENIZET
+   * @copyright DIGITEO 2011
+   */
+public class";
+
+/* Constructor for CommonFileUtils class */
+%pragma(java) modulecode="
+ /**
+   * Constructor
+   */
+ protected CommonFileUtils() {
+    throw new UnsupportedOperationException();
+ }";
+
+/* JavaDoc */
+%javamethodmodifiers isEmptyDirectory(String dirName) "
+ /**
+   * Test if a directory is empty or not
+   * @param dirName the directory name
+   * @return true if it is a directory
+   */
+public";
+int isEmptyDirectory(char * dirName);
diff --git a/scilab/modules/commons/src/jni/CommonFileUtils_wrap.c b/scilab/modules/commons/src/jni/CommonFileUtils_wrap.c
new file mode 100644 (file)
index 0000000..29ffc45
--- /dev/null
@@ -0,0 +1,219 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.40
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGJAVA
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif 
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+
+/* Fix for jlong on some versions of gcc on Windows */
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+  typedef long long __int64;
+#endif
+
+/* Fix for jlong on 64-bit x86 Solaris */
+#if defined(__x86_64)
+# ifdef _LP64
+#   undef _LP64
+# endif
+#endif
+
+#include <jni.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+/* Support for throwing Java exceptions */
+typedef enum {
+  SWIG_JavaOutOfMemoryError = 1, 
+  SWIG_JavaIOException, 
+  SWIG_JavaRuntimeException, 
+  SWIG_JavaIndexOutOfBoundsException,
+  SWIG_JavaArithmeticException,
+  SWIG_JavaIllegalArgumentException,
+  SWIG_JavaNullPointerException,
+  SWIG_JavaDirectorPureVirtual,
+  SWIG_JavaUnknownError
+} SWIG_JavaExceptionCodes;
+
+typedef struct {
+  SWIG_JavaExceptionCodes code;
+  const char *java_exception;
+} SWIG_JavaExceptions_t;
+
+
+static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
+  jclass excep;
+  static const SWIG_JavaExceptions_t java_exceptions[] = {
+    { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
+    { SWIG_JavaIOException, "java/io/IOException" },
+    { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
+    { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
+    { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
+    { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
+    { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
+    { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
+    { SWIG_JavaUnknownError,  "java/lang/UnknownError" },
+    { (SWIG_JavaExceptionCodes)0,  "java/lang/UnknownError" }
+  };
+  const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
+
+  while (except_ptr->code != code && except_ptr->code)
+    except_ptr++;
+
+  (*jenv)->ExceptionClear(jenv);
+  excep = (*jenv)->FindClass(jenv, except_ptr->java_exception);
+  if (excep)
+    (*jenv)->ThrowNew(jenv, excep, msg);
+}
+
+
+/* Contract support */
+
+#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else
+
+
+#include "../../includes/fileutils.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGEXPORT jint JNICALL Java_org_scilab_modules_commons_CommonFileUtilsJNI_isEmptyDirectory(JNIEnv *jenv, jclass jcls, jstring jarg1) {
+  jint jresult = 0 ;
+  char *arg1 = (char *) 0 ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = 0;
+  if (jarg1) {
+    arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0);
+    if (!arg1) return 0;
+  }
+  result = (int)isEmptyDirectory(arg1);
+  jresult = (jint)result; 
+  if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1);
+  return jresult;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
index 23c307b..270b17a 100644 (file)
@@ -1,3 +1,4 @@
        LIBRARY    fileio.dll
 
 EXPORTS 
+scigetcwd
\ No newline at end of file
index d5cf008..d804ae9 100644 (file)
@@ -2,4 +2,5 @@ LIBRARY    sciui_data.dll
 
 
 EXPORTS
-UpdateBrowseVar
\ No newline at end of file
+UpdateBrowseVar
+FileBrowserChDir
\ No newline at end of file
index abf8f92..5386437 100644 (file)
@@ -23,6 +23,8 @@ import java.awt.event.ComponentEvent;
 import java.io.IOException;
 import java.util.concurrent.Semaphore;
 
+import javax.swing.BoundedRangeModel;
+import javax.swing.DefaultBoundedRangeModel;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
@@ -100,6 +102,8 @@ public abstract class SciConsole extends JPanel {
      */
     private boolean workDone;
 
+    private boolean atBottom;
+
     /**
      * Constructor
      * @param configFilePath the configuration file to use
@@ -111,16 +115,16 @@ public abstract class SciConsole extends JPanel {
             config = ConfigurationBuilder.buildConfiguration(configFilePath);
             config.setActiveProfile("scilab");
             if (System.getProperty("os.name").toLowerCase().indexOf("mac") != -1)
-                {
-                    ConsoleConfiguration configMac = ConfigurationBuilder.buildConfiguration(configFilePath);;
-                    configMac.setActiveProfile("macosx");
-                    for (KeyStroke key : config.getKeyMapping().keys()){
-                        config.getKeyMapping().put(key,"");
-                    }
-                    for (KeyStroke key : configMac.getKeyMapping().keys()){
-                        config.getKeyMapping().put(key, configMac.getKeyMapping().get(key));
-                    }
+            {
+                ConsoleConfiguration configMac = ConfigurationBuilder.buildConfiguration(configFilePath);;
+                configMac.setActiveProfile("macosx");
+                for (KeyStroke key : config.getKeyMapping().keys()){
+                    config.getKeyMapping().put(key,"");
                 }
+                for (KeyStroke key : configMac.getKeyMapping().keys()){
+                    config.getKeyMapping().put(key, configMac.getKeyMapping().get(key));
+                }
+            }
         } catch (IllegalArgumentException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
@@ -137,8 +141,33 @@ public abstract class SciConsole extends JPanel {
 
         sciConsole = ConsoleBuilder.buildConsole(config, this);
         jSP = new JScrollPane(sciConsole);
-        /* This option is a good compromise for speed and rendering (bad display when several lines with default SIMPLE_SCROLL_MODE) */
-        jSP.getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE);
+
+        BoundedRangeModel model = jSP.getVerticalScrollBar().getModel();
+        jSP.getVerticalScrollBar().setModel(new DefaultBoundedRangeModel(model.getValue(), model.getExtent(), model.getMinimum(), model.getMaximum()) {
+                public void setRangeProperties(int newValue, int newExtent, int newMin, int newMax, boolean adjusting) {
+                    // This method is overriden to keep the knob at the bottom during viewport resize
+                    // and to keep the knob at an other place if the user decided it.
+                    if (newMax != getMaximum()) {
+                        if (!adjusting) {
+                            if (atBottom) {
+                                super.setRangeProperties(newMax - newExtent, newExtent, newMin, newMax, false);
+                            } else {
+                                super.setRangeProperties(newValue, newExtent, newMin, newMax, false);
+                            }
+                        } else {
+                            double percent = (double) Math.abs(newMax - newValue - newExtent) / (double) newMax;
+                            if (atBottom && percent <= 0.03) {
+                                super.setRangeProperties(newMax - newExtent, newExtent, newMin, newMax, true);
+                            } else {
+                                super.setRangeProperties(newValue, newExtent, newMin, newMax, true);
+                                atBottom = percent <= 0.01;
+                            }
+                        }
+                    } else {
+                        super.setRangeProperties(newValue, newExtent, newMin, newMax, adjusting);
+                    }
+                }
+            });
 
         this.add(jSP, BorderLayout.CENTER);
 
@@ -247,19 +276,14 @@ public abstract class SciConsole extends JPanel {
      * Updates the scroll bars according to the contents
      */
     public void updateScrollPosition() {
+        // Update the scrollbar properties
+        jSP.getVerticalScrollBar().setBlockIncrement(jSP.getViewport().getExtentSize().height);
+        jSP.getHorizontalScrollBar().setBlockIncrement(jSP.getViewport().getExtentSize().width);
         SwingUtilities.invokeLater(new Runnable() {
                 public void run() {
-                    jSP.getViewport().setViewPosition(new Point(0, sciConsole.getPreferredSize().height - jSP.getViewport().getExtentSize().height));
+                    jSP.getVerticalScrollBar().getModel().setValue(jSP.getVerticalScrollBar().getModel().getMaximum() - jSP.getVerticalScrollBar().getModel().getExtent());
                 }
             });
-        //jSP.getVerticalScrollBar().setValue(jSP.getVerticalScrollBar().getMaximum());
-        //jSP.invalidate();
-        //jSP.getViewport().setViewPosition(new Point(0, sciConsole.getPreferredSize().height - jSP.getViewport().getExtentSize().height));
-        //jSP.revalidate();
-
-        // Update the scrollbar properties
-        jSP.getVerticalScrollBar().setBlockIncrement(jSP.getViewport().getExtentSize().height);
-        jSP.getHorizontalScrollBar().setBlockIncrement(jSP.getViewport().getExtentSize().width);
     }
 
     /**
@@ -387,6 +411,8 @@ public abstract class SciConsole extends JPanel {
         String[] linesToExec = textToExec.split(StringConstants.NEW_LINE);
         int nbStatements = 0;
 
+        atBottom = true;
+
         // Display Cursor to show Scilab is busy
         this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 
@@ -404,6 +430,7 @@ public abstract class SciConsole extends JPanel {
 
             // Hide the prompt and command line
             config.getInputCommandView().setEditable(false);
+            ((SciInputCommandView) config.getInputCommandView()).getCaret().setVisible(false);
             config.getPromptView().setVisible(false);
 
             // Remove the prompt if present at the beginning of the text to execute
index f718053..33fc88e 100644 (file)
@@ -90,6 +90,12 @@ public class SciInputCommandView extends ConsoleTextPane implements InputCommand
         caret.setBlinkRate(getCaret().getBlinkRate());
         setCaret(caret);
         addCaretListener(this);
+        setFocusTraversalPolicy(new java.awt.DefaultFocusTraversalPolicy() {
+                public java.awt.Component getComponentAfter(java.awt.Container aContainer, java.awt.Component aComponent) {
+                    return SciInputCommandView.this;
+                }
+            });
+        setFocusCycleRoot(true);
     }
 
     /**
index 3ebf42b..da8e941 100644 (file)
@@ -100,8 +100,7 @@ public class SciOutputView extends JEditorPane implements OutputView {
         activeStyle = StyleContext.DEFAULT_STYLE;
         bufferQueue = new ArrayBlockingQueue<StringBuffer>(BUFFER_SIZE);
         styleQueue = new LinkedList<String>();
-        setFocusable(false);
-
+        
         /**
          * Default caret for output view (to handle paste actions using middle button)
          * @author Vincent COUVERT
@@ -298,11 +297,6 @@ public class SciOutputView extends JEditorPane implements OutputView {
             ((JTextPane) console.getConfiguration().getInputCommandView()).invalidate();
             ((JTextPane) console.getConfiguration().getInputCommandView()).doLayout();
         }
-        /* Update scroll only if console has been set */
-        /* TODO : Must not do this each time... consume pretty much computing resources */
-        if (console != null) {
-            console.updateScrollPosition();
-        }
     }
 
     /**
index 1879b52..81232f7 100644 (file)
@@ -316,7 +316,7 @@ libscicore_la_LDFLAGS = -version-number $(SCILAB_LIBRARY_VERSION) $(XML_LIBS)
 CHECK_SRC= $(CORE_C_SOURCES) $(GATEWAY_C_SOURCES)
 INCLUDE_FLAGS = $(libscicore_la_CFLAGS)
 
-libscicore_algo_la_SOURCES = $(CORE_C_SOURCES) $(CORE_CPP_SOURCES) $(CORE_FORTRAN_SOURCES)  $(JNI_SOURCES)
+libscicore_algo_la_SOURCES = $(CORE_C_SOURCES) $(CORE_CPP_SOURCES) $(CORE_FORTRAN_SOURCES)
 libscicore_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_FORTRAN_SOURCES)
 libscicore_algo_la_CFLAGS = $(libscicore_la_CFLAGS)
 libscicore_algo_la_CPPFLAGS = $(libscicore_la_CPPFLAGS)
index 3351525..2cb0704 100644 (file)
@@ -793,7 +793,7 @@ libscicore_la_LDFLAGS = -version-number $(SCILAB_LIBRARY_VERSION) $(XML_LIBS)
 # For the code check (splint)
 CHECK_SRC = $(CORE_C_SOURCES) $(GATEWAY_C_SOURCES)
 INCLUDE_FLAGS = $(libscicore_la_CFLAGS)
-libscicore_algo_la_SOURCES = $(CORE_C_SOURCES) $(CORE_CPP_SOURCES) $(CORE_FORTRAN_SOURCES)  $(JNI_SOURCES)
+libscicore_algo_la_SOURCES = $(CORE_C_SOURCES) $(CORE_CPP_SOURCES) $(CORE_FORTRAN_SOURCES)
 libscicore_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_FORTRAN_SOURCES)
 libscicore_algo_la_CFLAGS = $(libscicore_la_CFLAGS)
 libscicore_algo_la_CPPFLAGS = $(libscicore_la_CPPFLAGS)
index 61214f8..eadf886 100644 (file)
@@ -15,7 +15,7 @@
 #define SCI_VERSION_MAJOR @SCILAB_VERSION_MAJOR@
 #define SCI_VERSION_MINOR @SCILAB_VERSION_MINOR@
 #define SCI_VERSION_MAINTENANCE @SCILAB_VERSION_MAINTENANCE@
-#define SCI_VERSION_STRING "scilab-branch-master"
+#define SCI_VERSION_STRING "scilab-branch-desktop"
 /* SCI_VERSION_REVISION --> hash key commit */
 #define SCI_VERSION_REVISION 0
 #define SCI_VERSION_TIMESTAMP 0
@@ -25,7 +25,7 @@ void disp_scilab_version(void);
 /* for compatibility */
 /* Deprecated */
 #define SCI_VERSION SCI_VERSION_STRING
-#define DEFAULT_SCI_VERSION_MESSAGE "scilab-branch-master"
+#define DEFAULT_SCI_VERSION_MESSAGE "scilab-branch-desktop"
 
 
 #endif
index 88d0cbd..03b8474 100644 (file)
@@ -15,7 +15,7 @@
 #define SCI_VERSION_MAJOR 5
 #define SCI_VERSION_MINOR 4
 #define SCI_VERSION_MAINTENANCE 0
-#define SCI_VERSION_STRING "scilab-branch-master"
+#define SCI_VERSION_STRING "scilab-branch-desktop"
 /* SCI_VERSION_REVISION --> hash key commit */
 #define SCI_VERSION_REVISION 0
 #define SCI_VERSION_TIMESTAMP 0
@@ -25,7 +25,7 @@ void disp_scilab_version(void);
 /* for compatibility */
 /* Deprecated */
 #define SCI_VERSION SCI_VERSION_STRING
-#define DEFAULT_SCI_VERSION_MESSAGE "scilab-branch-master"
+#define DEFAULT_SCI_VERSION_MESSAGE "scilab-branch-desktop"
 
 
 #endif
index 5be1873..b4b07e9 100644 (file)
@@ -1,11 +1,11 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2009 - DIGITEO - Allan CORNET
- * 
+ *
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
  * you should have received as part of this distribution.  The terms
- * are also available at    
+ * are also available at
  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  */
 #include "localization.h"
 #include "Scierror.h"
 #include "exitCodeValue.h"
+#include "scilabmode.h"
+#include "../../../jvm/src/c/createMainScilabObject.h"
 /*--------------------------------------------------------------------------*/
 int C2F(sci_exit)(char *fname,unsigned long fname_len)
 {
-       SciErr sciErr;
-
-       CheckLhs(1,1);
-       CheckRhs(0,1);
+    SciErr sciErr;
 
-       if (Rhs == 0)
-       {
-               setExitCodeValue(0);
-       }
-       else
-       {
-               int iExit = 0;
-               int m1 = 0, n1 = 0;
-               int iType1 = 0;
-               int *piAddressVarOne = NULL;
-               double *pdVarOne = NULL;
+    CheckLhs(1,1);
+    CheckRhs(0,1);
 
-               /* get Address of inputs */
-               sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
-               if(sciErr.iErr)
-               {
-                       printError(&sciErr, 0);
-                       return 0;
-               }
+    if (Rhs == 0)
+    {
+        setExitCodeValue(0);
+    }
+    else
+    {
+        int iExit = 0;
+        int m1 = 0, n1 = 0;
+        int iType1 = 0;
+        int *piAddressVarOne = NULL;
+        double *pdVarOne = NULL;
 
-               sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType1);
-               if(sciErr.iErr)
-               {
-                       printError(&sciErr, 0);
-                       return 0;
-               }
+        /* get Address of inputs */
+        sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
+        if(sciErr.iErr)
+        {
+            printError(&sciErr, 0);
+            return 0;
+        }
 
-               /* check input type */
-               if ( iType1 != sci_matrix )
-               {
-                       Scierror(999,_("%s: Wrong type for input argument #%d: A scalar expected.\n"),fname,1);
-                       return 0;
-               }
+        sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType1);
+        if(sciErr.iErr)
+        {
+            printError(&sciErr, 0);
+            return 0;
+        }
 
-               sciErr = getMatrixOfDouble(pvApiCtx, piAddressVarOne,&m1,&n1,&pdVarOne);
-               if(sciErr.iErr)
-               {
-                       printError(&sciErr, 0);
-                       return 0;
-               }
+        /* check input type */
+        if ( iType1 != sci_matrix )
+        {
+            Scierror(999,_("%s: Wrong type for input argument #%d: A scalar expected.\n"),fname,1);
+            return 0;
+        }
 
-               if( n1 != 1 || m1 != 1)
-               {
-                       Scierror(999,_("%s: Wrong size for input argument #%d: A scalar expected.\n"),fname,1);
-                       return 0;
-               }
+        sciErr = getMatrixOfDouble(pvApiCtx, piAddressVarOne,&m1,&n1,&pdVarOne);
+        if(sciErr.iErr)
+        {
+            printError(&sciErr, 0);
+            return 0;
+        }
 
-               iExit = (int) *pdVarOne;
+        if( n1 != 1 || m1 != 1)
+        {
+            Scierror(999,_("%s: Wrong size for input argument #%d: A scalar expected.\n"),fname,1);
+            return 0;
+        }
 
-               if (*pdVarOne != (double)iExit)
-               {
-                       Scierror(999,_("%s: Wrong value for input argument #%d: An integer expected.\n"),fname,1);
-                       return 0;
-               }
+        iExit = (int) *pdVarOne;
 
-               setExitCodeValue(iExit);
-       }
+        if (*pdVarOne != (double)iExit)
+        {
+            Scierror(999,_("%s: Wrong value for input argument #%d: An integer expected.\n"),fname,1);
+            return 0;
+        }
 
-       // this value do quit in scirun
-       C2F(com).fun = -999;
+        setExitCodeValue(iExit);
+    }
 
-       LhsVar(1) = 0; 
-       PutLhsVar();
+    if (getScilabMode() != SCILAB_NWNI)
+    {
+        if (canCloseMainScilabObject())
+        {
+            // this value do quit in scirun
+            C2F(com).fun = -999;
+        }
+    }
+    else
+    {
+        C2F(com).fun = -999;
+    }
 
-       return 0;
+  LhsVar(1) = 0; 
+  PutLhsVar();
+   return 0;
 }
 /*--------------------------------------------------------------------------*/
index 8809561..de44c97 100644 (file)
@@ -1,11 +1,11 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2007 - INRIA - Allan CORNET
- * 
+ *
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
  * you should have received as part of this distribution.  The terms
- * are also available at    
+ * are also available at
  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  */
 #include "getvariablesname.h"
 #include "stackinfo.h"
 #include "MALLOC.h"
-/*--------------------------------------------------------------------------*/ 
+/*--------------------------------------------------------------------------*/
 static void SortStrings(char **Strings,int SizeStrings);
 static void RemoveDuplicateStrings(char **Strings,int *SizeStrings);
-/*--------------------------------------------------------------------------*/ 
+/*--------------------------------------------------------------------------*/
 char **getVariablesName(int *sizearray, BOOL sorted)
 {
-       char **variables = NULL;
+    char **variables = NULL;
 
-       char **localvariables = NULL;
-       int sizelocalvariables = 0;
+    char **localvariables = NULL;
+    int sizelocalvariables = 0;
 
-       char **globalvariables = NULL;
-       int sizeglobalvariables = 0;
+    char **globalvariables = NULL;
+    int sizeglobalvariables = 0;
 
-       localvariables = getLocalVariablesName(&sizelocalvariables,sorted);
-       globalvariables = getGlobalVariablesName(&sizeglobalvariables,sorted);
+    localvariables = getLocalVariablesName(&sizelocalvariables,sorted);
+    globalvariables = getGlobalVariablesName(&sizeglobalvariables,sorted);
 
-       if (localvariables && globalvariables)
-       {
-               int i = 0;
-               variables = (char **)MALLOC(sizeof(char*)*(sizelocalvariables+sizeglobalvariables+1));
-               for (i = 0; i < sizelocalvariables ; i++) variables[i] = localvariables[i];
-               for (i = sizelocalvariables; i < sizelocalvariables + sizeglobalvariables; i++) 
-               {
-                       variables[i] = globalvariables[i - sizelocalvariables];
-               }
-               FREE(localvariables); localvariables = NULL;
-               FREE(globalvariables); globalvariables = NULL;
-       }
+    if (localvariables || globalvariables)
+    {
+        int i = 0;
+        variables = (char **)MALLOC(sizeof(char*)*(sizelocalvariables+sizeglobalvariables+1));
+        for (i = 0; i < sizelocalvariables ; i++) variables[i] = localvariables[i];
+        for (i = sizelocalvariables; i < sizelocalvariables + sizeglobalvariables; i++)
+        {
+            variables[i] = globalvariables[i - sizelocalvariables];
+        }
+        if (localvariables)
+        {
+            FREE(localvariables);
+            localvariables = NULL;
+        }
+        if (globalvariables)
+        {
+            FREE(globalvariables);
+            globalvariables = NULL;
+        }
+    }
 
-       if (variables)
-       {
-               *sizearray = sizelocalvariables+sizeglobalvariables;
-               if (sorted) SortStrings(variables,*sizearray);
-               RemoveDuplicateStrings(variables,sizearray);
-       }
-       else
-       {
-               *sizearray = 0;
-       }
-       return variables;
+    if (variables)
+    {
+        *sizearray = sizelocalvariables+sizeglobalvariables;
+        if (sorted) SortStrings(variables,*sizearray);
+        RemoveDuplicateStrings(variables,sizearray);
+    }
+    else
+    {
+        *sizearray = 0;
+    }
+    return variables;
 }
-/*----------------------------------------------------------------------------------*/ 
+/*----------------------------------------------------------------------------------*/
 char **getLocalVariablesName(int *sizearray,BOOL sorted)
 {
-       char **variablesLocal = NULL;
-       int Ltotal = 0;
-       int Lused = 0;
-       int j = 0;
+    char **variablesLocal = NULL;
+    int Ltotal = 0;
+    int Lused = 0;
+    int j = 0;
 
-       C2F(getvariablesinfo)(&Ltotal,&Lused);
+    C2F(getvariablesinfo)(&Ltotal,&Lused);
 
-       if (Lused) 
-       {
-               variablesLocal = (char **)MALLOC(sizeof(char*)*(Lused+1));
-               if (variablesLocal)
-               {
-                       for (j=1;j<Lused+1;++j) variablesLocal[j-1] = getLocalNamefromId(j);
-                       *sizearray = Lused;
-                       if (sorted) SortStrings(variablesLocal,*sizearray);
-               }
-               else
-               {
-                       *sizearray = 0;
-               }
-       }
-       else
-       {
-               *sizearray = 0;
-       }
+    if (Lused > 0)
+    {
+        variablesLocal = (char **)MALLOC(sizeof(char*)*(Lused+1));
+        if (variablesLocal)
+        {
+            for (j=1;j<Lused+1;++j) variablesLocal[j-1] = getLocalNamefromId(j);
+            *sizearray = Lused;
+            if (sorted) SortStrings(variablesLocal,*sizearray);
+        }
+        else
+        {
+            *sizearray = 0;
+        }
+    }
+    else
+    {
+        *sizearray = 0;
+    }
 
-       return variablesLocal;
+    return variablesLocal;
 }
-/*--------------------------------------------------------------------------*/ 
+/*--------------------------------------------------------------------------*/
 char **getGlobalVariablesName(int *sizearray, BOOL sorted)
 {
-       char **variablesGlobal = NULL;
-       int Gtotal = 0;
-       int Gused = 0;
-       int j = 0;
+    char **variablesGlobal = NULL;
+    int Gtotal = 0;
+    int Gused = 0;
+    int j = 0;
 
-       C2F(getgvariablesinfo)(&Gtotal,&Gused);
+    C2F(getgvariablesinfo)(&Gtotal,&Gused);
 
-       if (Gused) 
-       {
-               variablesGlobal = (char **)MALLOC(sizeof(char*)*(Gused+1));
-               if (variablesGlobal)
-               {
-                       for (j=0;j<Gused;++j) variablesGlobal[j] = getGlobalNamefromId(j);
-                       *sizearray = Gused;
-                       if (sorted) SortStrings(variablesGlobal,*sizearray);
-               }
-               else
-               {
-                       *sizearray = 0;
-               }
-       }
-       else
-       {
-               *sizearray = 0;
-       }
+    if (Gused > 0)
+    {
+        variablesGlobal = (char **)MALLOC(sizeof(char*)*(Gused+1));
+        if (variablesGlobal)
+        {
+            for (j=0;j<Gused;++j) variablesGlobal[j] = getGlobalNamefromId(j);
+            *sizearray = Gused;
+            if (sorted) SortStrings(variablesGlobal,*sizearray);
+        }
+        else
+        {
+            *sizearray = 0;
+        }
+    }
+    else
+    {
+        *sizearray = 0;
+    }
 
-       return variablesGlobal;
+    return variablesGlobal;
 }
-/*--------------------------------------------------------------------------*/ 
+/*--------------------------------------------------------------------------*/
 static void SortStrings(char **Strings,int SizeStrings)
 {
-       int fin,i;
-       for(fin=SizeStrings-1;fin>0;fin--)
-       {
-               int Sorted=FALSE;
-               for(i=0;i<fin;i++)
-               {
-                       if(strcmp(Strings[i],Strings[i+1])>0)
-                       {
-                               char *StringTmp;
+    int fin,i;
+    for(fin=SizeStrings-1;fin>0;fin--)
+    {
+        int Sorted=FALSE;
+        for(i=0;i<fin;i++)
+        {
+            if(strcmp(Strings[i],Strings[i+1])>0)
+            {
+                char *StringTmp;
 
-                               StringTmp = Strings[i];
+                StringTmp = Strings[i];
 
-                               Strings[i] = Strings[i+1];
-                               Strings[i+1] = StringTmp;
+                Strings[i] = Strings[i+1];
+                Strings[i+1] = StringTmp;
 
-                               Sorted=TRUE;
-                       }
-               }
-               if(!Sorted)break;
-       }
+                Sorted=TRUE;
+            }
+        }
+        if(!Sorted)break;
+    }
 }
-/*--------------------------------------------------------------------------*/ 
+/*--------------------------------------------------------------------------*/
 static void RemoveDuplicateStrings(char **Strings,int *SizeStrings)
 {
-       int fin,i;
-       int newsize = *SizeStrings;
-       for(fin=*SizeStrings-1;fin>0;fin--)
-       {
-               int Sorted=FALSE;
-               for(i=0;i<fin;i++)
-               {
-                       if (Strings[i])
-                       {
-                               if(strcmp(Strings[i],Strings[i+1]) == 0)
-                               {
-                                       FREE(Strings[i+1]);
-                                       Strings[i+1] = NULL;
-                                       Sorted=TRUE;
-                                       newsize--;
-                               }
-                       }
-                       else
-                       {
-                               Strings[i] = Strings[i+1];
-                               Strings[i+1] = NULL;
-                               Sorted=TRUE;
-                       }
-               }
-               if(!Sorted)break;
-       }
+    int fin,i;
+    int newsize = *SizeStrings;
+    for(fin=*SizeStrings-1;fin>0;fin--)
+    {
+        int Sorted=FALSE;
+        for(i=0;i<fin;i++)
+        {
+            if (Strings[i])
+            {
+                if(strcmp(Strings[i],Strings[i+1]) == 0)
+                {
+                    FREE(Strings[i+1]);
+                    Strings[i+1] = NULL;
+                    Sorted=TRUE;
+                    newsize--;
+                }
+            }
+            else
+            {
+                Strings[i] = Strings[i+1];
+                Strings[i+1] = NULL;
+                Sorted=TRUE;
+            }
+        }
+        if(!Sorted)break;
+    }
 
-       *SizeStrings = newsize;
+    *SizeStrings = newsize;
 }
-/*--------------------------------------------------------------------------*/ 
+/*--------------------------------------------------------------------------*/
index bd394d2..99ca92a 100644 (file)
@@ -38,7 +38,6 @@ int ExitScilab(void)
        {
                dynamic_TerminateTclTk();
                TerminateGraphics();
-               TerminateGUI();
                TerminateJVM();
        }
 
diff --git a/scilab/modules/core/src/java/org/scilab/modules/core/ConsoleTab.java b/scilab/modules/core/src/java/org/scilab/modules/core/ConsoleTab.java
new file mode 100644 (file)
index 0000000..d0a8b1a
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2011 - Calixte DENIZET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+package org.scilab.modules.core;
+
+import java.awt.event.ActionEvent;
+import java.util.List;
+import java.util.UUID;
+
+import javax.swing.JTextArea;
+
+import org.scilab.modules.jvm.LoadClassPath;
+import org.scilab.modules.gui.ScilabTermination;
+import org.scilab.modules.gui.bridge.CallScilabBridge;
+import org.scilab.modules.gui.bridge.tab.SwingScilabTab;
+import org.scilab.modules.gui.console.ScilabConsole;
+import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.menubar.MenuBar;
+import org.scilab.modules.gui.tab.ScilabTab;
+import org.scilab.modules.gui.tab.Tab;
+import org.scilab.modules.gui.textbox.ScilabTextBox;
+import org.scilab.modules.gui.textbox.TextBox;
+import org.scilab.modules.gui.toolbar.ToolBar;
+import org.scilab.modules.gui.utils.ClosingOperationsManager;
+import org.scilab.modules.gui.utils.ConfigManager;
+import org.scilab.modules.gui.utils.MenuBarBuilder;
+import org.scilab.modules.gui.utils.ToolBarBuilder;
+import org.scilab.modules.gui.utils.UIElementMapper;
+import org.scilab.modules.gui.utils.WindowsConfigurationManager;
+import org.scilab.modules.gui.window.Window;
+import org.scilab.modules.localization.Messages;
+
+/**
+ *
+ * @author Calixte DENIZET
+ */
+public class ConsoleTab {
+
+    private static final String CLASS_NOT_FOUND = "Could not find class: ";
+    private static final String SEE_DEFAULT_PATHS = "See SCI/etc/classpath.xml for default paths.";
+    private static final String SCIDIR = System.getenv("SCI");
+    private static final String MENUBARXMLFILE = SCIDIR + "/modules/gui/etc/main_menubar.xml";
+    private static final String TOOLBARXMLFILE = SCIDIR + "/modules/gui/etc/main_toolbar.xml";
+    private static final String NOCONSOLE = Messages.gettext("No available console !\nPlease use STD mode.");
+    private static final String EMPTYTAB = Messages.gettext("Empty tab");
+
+    /**
+     * Create a console tab
+     * @param uuid the console uuid
+     * @return the corresponding tab
+     */
+    public static Tab getConsoleTab(String uuid) {
+        if (Scilab.getMode() != 2) {
+            Tab tab = ScilabTab.createTab(EMPTYTAB, uuid);
+            JTextArea textarea = new JTextArea(NOCONSOLE);
+            textarea.setEditable(false);
+            ((SwingScilabTab) tab.getAsSimpleTab()).setContentPane(textarea);
+
+            ClosingOperationsManager.registerClosingOperation(tab, new ClosingOperationsManager.ClosingOperation() {
+
+                    public boolean canClose() {
+                        return true;
+                    }
+
+                    public void destroy() { }
+
+                    public String askForClosing() {
+                        return null;
+                    }
+                });
+
+            ClosingOperationsManager.addDependencyWithRoot(tab);
+            WindowsConfigurationManager.restorationFinished((SwingScilabTab) tab.getAsSimpleTab());
+
+            return tab;
+        }
+
+        MenuBar menuBar = MenuBarBuilder.buildMenuBar(MENUBARXMLFILE);
+        ToolBar toolBar = ToolBarBuilder.buildToolBar(TOOLBARXMLFILE);
+
+        /* Create the console */
+        Tab consoleTab = null;
+        try {
+            /* CONSOLE */
+            /* Create a tab to put console into */
+            LoadClassPath.loadOnUse("Console");
+            if (uuid == null) {
+                consoleTab = ScilabTab.createTab(Messages.gettext("Scilab Console"), UUID.randomUUID().toString());
+            } else {
+                consoleTab = ScilabTab.createTab(Messages.gettext("Scilab Console"), uuid);
+            }
+
+            ClosingOperationsManager.registerClosingOperation(consoleTab, new ClosingOperationsManager.ClosingOperation() {
+
+                    public boolean canClose() {
+                        CallScilabBridge.unblockConsole();
+
+                        return true;
+                    }
+
+                    public void destroy() {
+                        if (!Scilab.getExitCalled()) {
+                            ScilabTermination.ScilabExit();
+                        }
+                    }
+
+                    public String askForClosing() {
+                        return "Console";
+                    }
+                });
+
+            ClosingOperationsManager.setRoot(consoleTab);
+
+            ScilabConsole.createConsole();
+        } catch (NoClassDefFoundError exception) {
+            System.err.println("Cannot create Scilab Console.\nCheck if the thirdparties are available (JoGL/JRosetta...).\n"
+                               + SEE_DEFAULT_PATHS);
+            System.err.println(CLASS_NOT_FOUND + exception.getLocalizedMessage());
+            System.exit(-1);
+        }
+
+        TextBox infoBar = ScilabTextBox.createTextBox();
+
+        /** Adding content into container */
+        toolBar.setVisible(false); // Enabled in scilab.start
+        ScilabConsole.getConsole().addToolBar(toolBar);
+        ScilabConsole.getConsole().addMenuBar(menuBar);
+        ScilabConsole.getConsole().addInfoBar(infoBar);
+        ScilabConsole.getConsole().setMaxOutputSize(ConfigManager.getMaxOutputSize());
+        consoleTab.addMember(ScilabConsole.getConsole());
+        WindowsConfigurationManager.restorationFinished((SwingScilabTab) consoleTab.getAsSimpleTab());
+
+        return consoleTab;
+    }
+}
diff --git a/scilab/modules/core/src/java/org/scilab/modules/core/ConsoleTabFactory.java b/scilab/modules/core/src/java/org/scilab/modules/core/ConsoleTabFactory.java
new file mode 100644 (file)
index 0000000..eeace3b
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2011 - Calixte DENIZET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+package org.scilab.modules.core;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.scilab.modules.gui.tab.Tab;
+import org.scilab.modules.gui.bridge.tab.SwingScilabTab;
+import org.scilab.modules.gui.tabfactory.AbstractScilabTabFactory;
+import org.scilab.modules.gui.tabfactory.ScilabTabFactory;
+import org.scilab.modules.gui.utils.WindowsConfigurationManager;
+
+/**
+ * The main Tab factory.
+ * A component which needs to restore a Tab with a given uuid must register its factory.
+ *
+ * @author Calixte DENIZET
+ */
+public class ConsoleTabFactory extends AbstractScilabTabFactory {
+
+    public static final String APPLICATION = "Console";
+    public static final String PACKAGE = "Console";
+    public static final String CLASS = "org.scilab.modules.core.ConsoleTabFactory";
+    public static final String NULLUUID = new UUID(0L, 0L).toString();
+
+    private static ConsoleTabFactory instance;
+
+    /**
+     * Default constructor
+     */
+    public ConsoleTabFactory() { }
+
+    public SwingScilabTab getTab(String uuid) {
+       if (isAValidUUID(uuid)) {
+           return (SwingScilabTab) ConsoleTab.getConsoleTab(uuid).getAsSimpleTab();
+       }
+       return null;
+    }
+
+    public String getPackage() {
+       return PACKAGE;
+    }
+
+    public String getClassName() {
+       return CLASS;
+    }
+
+    public String getApplication() {
+       return APPLICATION;
+    }
+
+    public boolean isAValidUUID(String uuid) {
+       return uuid.equals(NULLUUID);
+    }
+
+    /**
+     * @return an instance of this factory
+     */
+    public static ConsoleTabFactory getInstance() {
+        if (instance == null) {
+            instance = new ConsoleTabFactory();
+        }
+
+        return instance;
+    }
+}
index 3f35592..0b96f39 100644 (file)
@@ -5,6 +5,7 @@
  * Copyright (C) 2007-2008 - INRIA - Sylvestre LEDRU
  * Copyright (C) 2007-2008 - INRIA - Jean-Baptiste SILVY
  * Copyright (C) 2007-2008 - INRIA - Bruno JOFRET
+ * Copyright (C) 2011 - Calixte DENIZET
  *
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
 
 package org.scilab.modules.core;
 
+import java.lang.reflect.InvocationTargetException;
+
 import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
 
 import org.flexdock.docking.DockingConstants;
+import org.flexdock.docking.DockingManager;
 
 import org.scilab.modules.commons.ScilabConstants;
 import org.scilab.modules.jvm.LoadClassPath;
+import org.scilab.modules.gui.bridge.console.SwingScilabConsole;
+import org.scilab.modules.gui.bridge.tab.SwingScilabTab;
+import org.scilab.modules.gui.bridge.window.SwingScilabWindow;
 import org.scilab.modules.gui.console.ScilabConsole;
-import org.scilab.modules.gui.events.callback.CallBack;
-import org.scilab.modules.gui.menubar.MenuBar;
-import org.scilab.modules.gui.tab.ScilabTab;
-import org.scilab.modules.gui.tab.Tab;
-import org.scilab.modules.gui.textbox.ScilabTextBox;
-import org.scilab.modules.gui.textbox.TextBox;
-import org.scilab.modules.gui.toolbar.ToolBar;
+import org.scilab.modules.gui.tabfactory.ScilabTabFactory;
+import org.scilab.modules.gui.utils.ClosingOperationsManager;
 import org.scilab.modules.gui.utils.ConfigManager;
 import org.scilab.modules.gui.utils.LookAndFeelManager;
-import org.scilab.modules.gui.utils.MenuBarBuilder;
-import org.scilab.modules.gui.utils.ToolBarBuilder;
-import org.scilab.modules.gui.window.ScilabWindow;
+import org.scilab.modules.gui.utils.UIElementMapper;
+import org.scilab.modules.gui.utils.WindowsConfigurationManager;
 import org.scilab.modules.gui.window.Window;
-import org.scilab.modules.localization.Messages;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Main Class for Scilab
@@ -45,6 +51,7 @@ import org.scilab.modules.localization.Messages;
  * @author Vincent COUVERT
  * @author Sylvestre Ledru
  * @author Bruno JOFRET
+ * @author Calixte DENIZET
  */
 public class Scilab {
 
@@ -64,9 +71,13 @@ public class Scilab {
 
     private static String SCIDIR;
 
-    private static String MENUBARXMLFILE;
+    private static boolean success;
+    private static boolean finish;
+    private static boolean exitCalled;
+    private static int mode;
 
-    private static String TOOLBARXMLFILE;
+    private static List<Runnable> finalhooks = new ArrayList<Runnable>();
+    private static List<Runnable> initialhooks = new ArrayList<Runnable>();
 
     private Window mainView;
 
@@ -75,6 +86,9 @@ public class Scilab {
      * @param mode Mode Scilab -NW -NWNI -STD -API
      */
     public Scilab(int mode) {
+        this.mode = mode;
+        DockingManager.setDockableFactory(ScilabTabFactory.getInstance());
+
         /*
          * Set Scilab directory. Note that it is done in the constructor
          * and not as directly when setting the member because we had some
@@ -95,9 +109,6 @@ public class Scilab {
             System.exit(-1);
         }
 
-        MENUBARXMLFILE = SCIDIR + "/modules/gui/etc/main_menubar.xml";
-        TOOLBARXMLFILE = SCIDIR + "/modules/gui/etc/main_toolbar.xml";
-
         /*
          * Set options for JOGL
          * they must be set before creating GUI
@@ -119,8 +130,8 @@ public class Scilab {
                 if (isWindowsPlateform()) {
                     scilabLookAndFeel = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
                 } else if (System.getProperty(OSNAME).toLowerCase().indexOf(MACOS) != -1) {
-                                        /** OPTION ADDED TO ALLOW DOCKING UNDER MACOSX */
-                                        System.setProperty(DockingConstants.HEAVYWEIGHT_DOCKABLES, ENABLE);
+                    /** OPTION ADDED TO ALLOW DOCKING UNDER MACOSX */
+                    System.setProperty(DockingConstants.HEAVYWEIGHT_DOCKABLES, ENABLE);
                     scilabLookAndFeel = "apple.laf.AquaLookAndFeel";
                 } else {
                     scilabLookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
@@ -145,66 +156,22 @@ public class Scilab {
         }
 
         if (mode == 2) { /* Mode GUI */
-
             // Create a user config file if not already exists
             ConfigManager.createUserCopy();
 
-            try {
-                mainView = ScilabWindow.createWindow();
-            } catch (NoClassDefFoundError exception) {
-                System.err.println("Cannot create Scilab Window.\n"
-                        + "Check if the thirdparties are available (Flexdock, JOGL...).\n" + SEE_DEFAULT_PATHS);
-                System.err.println(CLASS_NOT_FOUND + exception.getLocalizedMessage());
-                System.exit(-1);
-            } catch (java.awt.HeadlessException exception) {
-                System.err.println("Error during the initialization of the window: "  + exception.getLocalizedMessage());
-                System.exit(-1);
-            }
-
-            mainView.setPosition(ConfigManager.getMainWindowPosition());
-            mainView.setDims(ConfigManager.getMainWindowSize());
+            WindowsConfigurationManager.restoreUUID(ConsoleTabFactory.NULLUUID);
 
-            /************/
-            /* MENU BAR */
-            /************/
-            MenuBar menuBar = MenuBarBuilder.buildMenuBar(MENUBARXMLFILE);
-
-            /************/
-            /* TOOL BAR */
-            /************/
-            ToolBar toolBar = ToolBarBuilder.buildToolBar(TOOLBARXMLFILE);
-
-            /* Create the console */
-            Tab consoleTab = null;
-            try {
-                /* CONSOLE */
-                /* Create a tab to put console into */
-                LoadClassPath.loadOnUse("Console");
-                consoleTab = ScilabTab.createTab(Messages.gettext("Scilab Console"));
-                /* Exit Scilab when the console is closed */
-                consoleTab.setCallback(CallBack.createCallback("exit();", CallBack.SCILAB_INSTRUCTION));
-
-                ScilabConsole.createConsole();
-            } catch (NoClassDefFoundError exception) {
-                System.err.println("Cannot create Scilab Console.\nCheck if the thirdparties are available (JoGL/JRosetta...).\n"
-                        + SEE_DEFAULT_PATHS);
-                System.err.println(CLASS_NOT_FOUND + exception.getLocalizedMessage());
-                System.exit(-1);
-            }
-
-            TextBox infoBar = ScilabTextBox.createTextBox();
-
-            /** Adding content into container */
-            toolBar.setVisible(false); // Enabled in scilab.start
-            ScilabConsole.getConsole().addToolBar(toolBar);
-            ScilabConsole.getConsole().addMenuBar(menuBar);
-            ScilabConsole.getConsole().addInfoBar(infoBar);
-            ScilabConsole.getConsole().setMaxOutputSize(ConfigManager.getMaxOutputSize());
-            consoleTab.addMember(ScilabConsole.getConsole());
-            mainView.addTab(consoleTab);
-            mainView.draw();
+            SwingScilabConsole sciConsole = ((SwingScilabConsole) ScilabConsole.getConsole().getAsSimpleConsole());
+            SwingScilabTab consoleTab = (SwingScilabTab) sciConsole.getParent();
+            mainView = (Window) UIElementMapper.getCorrespondingUIElement(consoleTab.getParentWindowId());
         }
+    }
 
+    /**
+     * @return the current mode
+     */
+    public static int getMode() {
+        return mode;
     }
 
     /**
@@ -236,7 +203,6 @@ public class Scilab {
             // desactivate direct3d and direct draw under windows
             System.setProperty(DISABLE_DDRAW, ENABLE);
         }
-
     }
 
     /**
@@ -263,5 +229,92 @@ public class Scilab {
         return windowsVersion;
     }
 
+    /**
+     * Call from canCloseMainScilabObject (call itself from sci_exit)
+     * @return true if the console is closed
+     */
+    public static boolean canClose() {
+        SwingUtilities.invokeLater(new Runnable() {
+                public void run() {
+                    exitCalled = true;
+                    success = ClosingOperationsManager.startClosingOperationOnRoot();
+                    exitCalled = false;
+                    finish = true;
+                }
+            });
+
+        while (!finish) {
+            try {
+                Thread.sleep(10);
+            } catch (InterruptedException e) {
+                System.err.println(e);
+            }
+        }
+
+        finish = false;
+
+        return success;
+    }
+
+    /**
+     * @return true if exit has been called from command line
+     */
+    public static boolean getExitCalled() {
+        return exitCalled;
+    }
+
+    /**
+     * Register a hook to execute just before the JVM shutdown.
+     * A hook should not contain threads, there is no warranty that they will be fully executed.
+     */
+    public static void registerFinalHook(Runnable hook) {
+        finalhooks.add(hook);
+    }
+
+    /**
+     * Remove a hook
+     */
+    public static void removeFinalHook(Runnable hook) {
+        finalhooks.remove(hook);
+    }
+
+    /**
+     * This method should be called from jni (finishMainScilabObject())
+     */
+    public static void executeFinalHooks() {
+        for (Runnable hook : finalhooks) {
+            hook.run();
+        }
+    }
+
+    /**
+     * Register a hook to execute after the Scilab initialization.
+     * A hook should not contain threads, there is no warranty that they will be fully executed.
+     */
+    public static void registerInitialHook(Runnable hook) {
+        initialhooks.add(hook);
+    }
+
+    /**
+     * Remove a hook
+     */
+    public static void removeInitialHook(Runnable hook) {
+        initialhooks.remove(hook);
+    }
+
+    /**
+     * This method should be called from C (realmain)
+     */
+    public static void executeInitialHooks() {
+        for (final Runnable hook : initialhooks) {
+            try {
+                SwingUtilities.invokeAndWait(hook);
+            } catch (InterruptedException e) {
+                System.err.println(e);
+            } catch (InvocationTargetException e) {
+                e.printStackTrace();
+            }
+        }
+    }
 }
 /*--------------------------------------------------------------------------*/
index 4697397..c0730ce 100644 (file)
@@ -298,6 +298,7 @@ lib /DEF:"$(ProjectDir)Console_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platfor
     <ClCompile Include="sci_gateway\c\sci_pwd.c" />
     <ClCompile Include="sci_gateway\c\sci_removedir.c" />
     <ClCompile Include="src\c\scicurdir.c" />
+    <ClCompile Include="src\c\sendtorecyclebin.c" />
     <ClCompile Include="src\c\splitpath.c" />
     <ClCompile Include="src\c\Status2Mode.c" />
     <ClCompile Include="src\c\URIFileToFilename.c" />
@@ -306,6 +307,7 @@ lib /DEF:"$(ProjectDir)Console_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platfor
     <ClInclude Include="includes\addfile.h" />
     <ClInclude Include="includes\createtempfilename.h" />
     <ClInclude Include="includes\mgetl.h" />
+    <ClInclude Include="includes\sendtorecyclebin.h" />
     <ClInclude Include="src\c\basename.h" />
     <ClInclude Include="includes\cluni0.h" />
     <ClInclude Include="src\c\copyfile.h" />
index 2c5ec86..74d2fe8 100644 (file)
     <ClCompile Include="src\c\URIFileToFilename.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="src\c\sendtorecyclebin.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
     <ClCompile Include="src\c\createtempfilename.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClInclude Include="includes\mgetl.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="includes\sendtorecyclebin.h">
+      <Filter>Header Files</Filter>    
+    </ClInclude>
     <ClInclude Include="includes\createtempfilename.h">
       <Filter>Header Files</Filter>
     </ClInclude>
similarity index 55%
rename from scilab/modules/gui/src/c/TerminateGui.c
rename to scilab/modules/fileio/includes/sendtorecyclebin.h
index 9aa96c5..221562e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Allan CORNET
+ * Copyright (C) 2011 - DIGITEO - Allan CORNET
  * 
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
@@ -9,18 +9,14 @@
  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  */
-/*--------------------------------------------------------------------------*/ 
-#include "TerminateGui.h"
-#include "CallMainWindow.h"
-#include "scilabmode.h"
-/*--------------------------------------------------------------------------*/ 
-BOOL TerminateGUI(void)
-{
-  if (getScilabMode() == SCILAB_STD)
-    {
-      saveMainWindowSettings();
-      saveHelpWindowSettings();
-    }
-  return TRUE;
-}
-/*--------------------------------------------------------------------------*/ 
+/*--------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#include "BOOL.h"
+#include "charEncoding.h"
+
+/* send a file to recycle bin on Windows */
+BOOL sendToRecycleBin(const char* filename);
+BOOL sendToRecycleBinW(const wchar_t* wfilename);
+
+#endif
+/*--------------------------------------------------------------------------*/
\ No newline at end of file
diff --git a/scilab/modules/fileio/src/c/sendtorecyclebin.c b/scilab/modules/fileio/src/c/sendtorecyclebin.c
new file mode 100644 (file)
index 0000000..004a095
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2011 - DIGITEO - Allan CORNET
+ * 
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at    
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+/*--------------------------------------------------------------------------*/
+#include <Windows.h>
+#include <Shellapi.h>
+#include "sendtorecyclebin.h"
+/*--------------------------------------------------------------------------*/
+BOOL sendToRecycleBin(const char* filename)
+{
+    BOOL bOK = FALSE;
+
+    wchar_t* wfilename = to_wide_string((char*)filename);
+    if (wfilename)
+    {
+        bOK = sendToRecycleBinW(wfilename);
+        FREE(wfilename);
+        wfilename = NULL;
+    }
+    return bOK;
+}
+/*--------------------------------------------------------------------------*/
+BOOL sendToRecycleBinW(const wchar_t* wfilename)
+{
+    BOOL bOK = FALSE;
+    if (wfilename)
+    {
+        SHFILEOPSTRUCTW opFile;
+        int len = wcslen(wfilename) + 2;
+        /* we add 00 at the end of filename */
+        /* required by SHFileOperationW */
+        wchar_t* csrc = (wchar_t*)CALLOC(len, sizeof(wchar_t));
+        if (csrc)
+        {
+            wcscpy(csrc, wfilename);
+            /* we add 00 at the end of filename */
+            csrc[len - 1] = csrc[len - 2] = 0;
+            ZeroMemory(&opFile, sizeof(opFile));
+            opFile.wFunc = FO_DELETE;
+            opFile.pFrom = csrc;
+            opFile.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_SILENT;
+            bOK = SHFileOperationW(&opFile) != 0 ? FALSE : TRUE;
+            FREE(csrc);
+            csrc = NULL;
+        }
+    }
+    return bOK;
+}
+/*--------------------------------------------------------------------------*/
\ No newline at end of file
index 2d2d548..b94f648 100644 (file)
@@ -31,7 +31,8 @@ etc/graphics_toolbar.xml \
 etc/helpbrowser_menubar.xml \
 etc/main_menubar.xml \
 etc/main_toolbar.xml \
-etc/flexdock-themes.xml
+etc/flexdock-themes.xml \
+etc/windowsConfiguration.xml
 
 #### gui : tree functions ####
 MACROSDIRSEXT = macros/tree
@@ -39,7 +40,6 @@ MACROSDIRSEXT = macros/tree
 include $(top_srcdir)/Makefile.incl.am
 
 GUI_C_SOURCES = \
-src/c/TerminateGui.c \
 src/c/buildMainWindowTitle.c \
 src/c/getMainWindowTitle.c \
 src/c/InitializeGUI.c \
@@ -52,7 +52,9 @@ src/c/InitProgressionBar.c \
 src/c/CreateUIContextMenu.c \
 src/c/UicontrolStyleToString.c \
 src/c/checkColorRange.c \
-src/c/messageboxoptions.c
+src/c/messageboxoptions.c \
+src/c/ScilabTermination.c \
+src/jni/ScilabTermination_wrap.c
 
 GUI_CPP_SOURCES = src/cpp/InitUIMenu.cpp \
 src/jni/CallScilabBridge.cpp \
@@ -68,7 +70,6 @@ src/cpp/CallColorChooser.cpp \
 src/cpp/CallFontChooser.cpp \
 src/cpp/CallFigure.cpp \
 src/cpp/CallMessageBox.cpp \
-src/cpp/CallMainWindow.cpp \
 src/cpp/CallWaitBar.cpp \
 src/cpp/CallHelpBrowser.cpp \
 src/cpp/PushButton.cpp \
@@ -143,7 +144,6 @@ src/cpp/CallJuigetfile.cpp \
 src/cpp/displaytree.cpp \
 src/jni/ScilabDisplayTree.cpp
 
-
 GIWS_WRAPPERS = \
 src/jni/CallScilabBridge.giws.xml \
 src/jni/Jxclick.giws.xml \
@@ -159,6 +159,14 @@ BUILT_SOURCES=giws
 endif
 
 
+#### SWIG Declaration ####
+SWIG_WRAPPERS = src/jni/ScilabTermination.i 
+
+if SWIG
+    BUILT_SOURCES=swig
+endif
+
+
 GATEWAY_C_SOURCES = sci_gateway/c/sci_x_choice.c \
 sci_gateway/c/gw_gui.c \
 sci_gateway/c/sci_x_mdialog.c \
@@ -290,9 +298,11 @@ libscigui_la_sci_gateway_DATA = sci_gateway/gui_gateway.xml
 #    $ find images/ -type f -printf "%p \\\\\n" -name *.svg -or -name *.gif -or -name *.jpg -or -name *.png |sort -u
 libscigui_la_iconsdir=$(mydatadir)/
 nobase_libscigui_la_icons_DATA = images/icons/32x32/apps/accessories-text-editor.png \
+images/icons/32x32/actions/edit-clear.png \
 images/icons/32x32/apps/rrze_table.png \
 images/icons/32x32/apps/utilities-system-monitor.png \
 images/icons/32x32/apps/system-search.png \
+images/icons/16x16/actions/edit-clear.png \
 images/icons/16x16/actions/execute-all.png \
 images/icons/16x16/actions/go-bottom.png \
 images/icons/16x16/actions/go-top.png \
@@ -302,11 +312,32 @@ images/icons/16x16/search/file.png \
 images/icons/16x16/search/line-found.png \
 images/icons/16x16/search/scilab-file.png \
 images/icons/16x16/actions/save-and-execute.png \
+images/icons/16x16/filebrowser/application-pdf.png \
+images/icons/16x16/filebrowser/binary.png \
+images/icons/16x16/filebrowser/dynamic-blue-up.png \
+images/icons/16x16/filebrowser/emblem-readonly.png \
+images/icons/16x16/filebrowser/filter.png \
+images/icons/16x16/filebrowser/folder-open.png \
+images/icons/16x16/filebrowser/folder.png \
+images/icons/16x16/filebrowser/go-next.png \
+images/icons/16x16/filebrowser/go-previous.png \
+images/icons/16x16/filebrowser/icon_scilab.png \
+images/icons/16x16/filebrowser/image-x-generic.png \
+images/icons/16x16/filebrowser/open-scilab-folder.png \
+images/icons/16x16/filebrowser/open-user-home.png \
+images/icons/16x16/filebrowser/scilab-folder.png \
+images/icons/16x16/filebrowser/system-search.png \
+images/icons/16x16/filebrowser/text-csv.png \
+images/icons/16x16/filebrowser/text-html.png \
+images/icons/16x16/filebrowser/text-x-generic.png \
+images/icons/16x16/filebrowser/text-xml.png \
+images/icons/16x16/filebrowser/user-home.png \
 images/icons/aboutscilab.png \
 images/icons/accessories-text-editor.png \
 images/icons/applications-system.png \
 images/icons/check-icon.png \
 images/icons/close-tab.png \
+images/icons/close-tab-on.png \
 images/icons/datatips.png \
 images/icons/document-new.png \
 images/icons/document-open.png \
index de06d08..71cce7c 100644 (file)
@@ -122,8 +122,7 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" \
        "$(DESTDIR)$(libscigui_la_iconsdir)"
 LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkglib_LTLIBRARIES)
 libscigui_algo_la_LIBADD =
-am__objects_1 = libscigui_algo_la-TerminateGui.lo \
-       libscigui_algo_la-buildMainWindowTitle.lo \
+am__objects_1 = libscigui_algo_la-buildMainWindowTitle.lo \
        libscigui_algo_la-getMainWindowTitle.lo \
        libscigui_algo_la-InitializeGUI.lo \
        libscigui_algo_la-setMainWindowTitle.lo \
@@ -135,7 +134,9 @@ am__objects_1 = libscigui_algo_la-TerminateGui.lo \
        libscigui_algo_la-CreateUIContextMenu.lo \
        libscigui_algo_la-UicontrolStyleToString.lo \
        libscigui_algo_la-checkColorRange.lo \
-       libscigui_algo_la-messageboxoptions.lo
+       libscigui_algo_la-messageboxoptions.lo \
+       libscigui_algo_la-ScilabTermination.lo \
+       libscigui_algo_la-ScilabTermination_wrap.lo
 am__objects_2 = libscigui_algo_la-InitUIMenu.lo \
        libscigui_algo_la-CallScilabBridge.lo \
        libscigui_algo_la-Jxclick.lo \
@@ -150,7 +151,6 @@ am__objects_2 = libscigui_algo_la-InitUIMenu.lo \
        libscigui_algo_la-CallFontChooser.lo \
        libscigui_algo_la-CallFigure.lo \
        libscigui_algo_la-CallMessageBox.lo \
-       libscigui_algo_la-CallMainWindow.lo \
        libscigui_algo_la-CallWaitBar.lo \
        libscigui_algo_la-CallHelpBrowser.lo \
        libscigui_algo_la-PushButton.lo libscigui_algo_la-EditBox.lo \
@@ -558,7 +558,8 @@ etc/graphics_toolbar.xml \
 etc/helpbrowser_menubar.xml \
 etc/main_menubar.xml \
 etc/main_toolbar.xml \
-etc/flexdock-themes.xml
+etc/flexdock-themes.xml \
+etc/windowsConfiguration.xml
 
 
 #### gui : tree functions ####
@@ -627,7 +628,6 @@ HELP_CHAPTERDIR = help/
 HELP_CHAPTERFILE = addchapter.sce
 HELP_CHAPTERLANG = en_US fr_FR pt_BR
 GUI_C_SOURCES = \
-src/c/TerminateGui.c \
 src/c/buildMainWindowTitle.c \
 src/c/getMainWindowTitle.c \
 src/c/InitializeGUI.c \
@@ -640,7 +640,9 @@ src/c/InitProgressionBar.c \
 src/c/CreateUIContextMenu.c \
 src/c/UicontrolStyleToString.c \
 src/c/checkColorRange.c \
-src/c/messageboxoptions.c
+src/c/messageboxoptions.c \
+src/c/ScilabTermination.c \
+src/jni/ScilabTermination_wrap.c
 
 GUI_CPP_SOURCES = src/cpp/InitUIMenu.cpp \
 src/jni/CallScilabBridge.cpp \
@@ -656,7 +658,6 @@ src/cpp/CallColorChooser.cpp \
 src/cpp/CallFontChooser.cpp \
 src/cpp/CallFigure.cpp \
 src/cpp/CallMessageBox.cpp \
-src/cpp/CallMainWindow.cpp \
 src/cpp/CallWaitBar.cpp \
 src/cpp/CallHelpBrowser.cpp \
 src/cpp/PushButton.cpp \
@@ -741,6 +742,10 @@ src/jni/Juigetfile.giws.xml \
 src/jni/ScilabDisplayTree.giws.xml
 
 @GIWS_TRUE@BUILT_SOURCES = giws
+@SWIG_TRUE@BUILT_SOURCES = swig
+
+#### SWIG Declaration ####
+SWIG_WRAPPERS = src/jni/ScilabTermination.i 
 GATEWAY_C_SOURCES = sci_gateway/c/sci_x_choice.c \
 sci_gateway/c/gw_gui.c \
 sci_gateway/c/sci_x_mdialog.c \
@@ -855,9 +860,11 @@ libscigui_la_sci_gateway_DATA = sci_gateway/gui_gateway.xml
 #    $ find images/ -type f -printf "%p \\\\\n" -name *.svg -or -name *.gif -or -name *.jpg -or -name *.png |sort -u
 libscigui_la_iconsdir = $(mydatadir)/
 nobase_libscigui_la_icons_DATA = images/icons/32x32/apps/accessories-text-editor.png \
+images/icons/32x32/actions/edit-clear.png \
 images/icons/32x32/apps/rrze_table.png \
 images/icons/32x32/apps/utilities-system-monitor.png \
 images/icons/32x32/apps/system-search.png \
+images/icons/16x16/actions/edit-clear.png \
 images/icons/16x16/actions/execute-all.png \
 images/icons/16x16/actions/go-bottom.png \
 images/icons/16x16/actions/go-top.png \
@@ -867,11 +874,32 @@ images/icons/16x16/search/file.png \
 images/icons/16x16/search/line-found.png \
 images/icons/16x16/search/scilab-file.png \
 images/icons/16x16/actions/save-and-execute.png \
+images/icons/16x16/filebrowser/application-pdf.png \
+images/icons/16x16/filebrowser/binary.png \
+images/icons/16x16/filebrowser/dynamic-blue-up.png \
+images/icons/16x16/filebrowser/emblem-readonly.png \
+images/icons/16x16/filebrowser/filter.png \
+images/icons/16x16/filebrowser/folder-open.png \
+images/icons/16x16/filebrowser/folder.png \
+images/icons/16x16/filebrowser/go-next.png \
+images/icons/16x16/filebrowser/go-previous.png \
+images/icons/16x16/filebrowser/icon_scilab.png \
+images/icons/16x16/filebrowser/image-x-generic.png \
+images/icons/16x16/filebrowser/open-scilab-folder.png \
+images/icons/16x16/filebrowser/open-user-home.png \
+images/icons/16x16/filebrowser/scilab-folder.png \
+images/icons/16x16/filebrowser/system-search.png \
+images/icons/16x16/filebrowser/text-csv.png \
+images/icons/16x16/filebrowser/text-html.png \
+images/icons/16x16/filebrowser/text-x-generic.png \
+images/icons/16x16/filebrowser/text-xml.png \
+images/icons/16x16/filebrowser/user-home.png \
 images/icons/aboutscilab.png \
 images/icons/accessories-text-editor.png \
 images/icons/applications-system.png \
 images/icons/check-icon.png \
 images/icons/close-tab.png \
+images/icons/close-tab-on.png \
 images/icons/datatips.png \
 images/icons/document-new.png \
 images/icons/document-open.png \
@@ -1012,7 +1040,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-CallJuigetfile.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-CallJxclick.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-CallJxgetmouse.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-CallMainWindow.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-CallMessageBox.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-CallScilabBridge.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-CallWaitBar.Plo@am__quote@
@@ -1067,6 +1094,8 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-PushButton.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-RadioButton.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-ScilabDisplayTree.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-ScilabTermination.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-ScilabTermination_wrap.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-SetUicontrolBackgroundColor.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-SetUicontrolFontAngle.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-SetUicontrolFontName.Plo@am__quote@
@@ -1093,7 +1122,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-SetUiobjectTag.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-SetUiobjectVisible.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-Slider.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-TerminateGui.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-Toolbar.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-UicontrolStyleToString.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-UnitsConversion.Plo@am__quote@
@@ -1166,13 +1194,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
 
-libscigui_algo_la-TerminateGui.lo: src/c/TerminateGui.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_algo_la_CFLAGS) $(CFLAGS) -MT libscigui_algo_la-TerminateGui.lo -MD -MP -MF $(DEPDIR)/libscigui_algo_la-TerminateGui.Tpo -c -o libscigui_algo_la-TerminateGui.lo `test -f 'src/c/TerminateGui.c' || echo '$(srcdir)/'`src/c/TerminateGui.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscigui_algo_la-TerminateGui.Tpo $(DEPDIR)/libscigui_algo_la-TerminateGui.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/TerminateGui.c' object='libscigui_algo_la-TerminateGui.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_algo_la_CFLAGS) $(CFLAGS) -c -o libscigui_algo_la-TerminateGui.lo `test -f 'src/c/TerminateGui.c' || echo '$(srcdir)/'`src/c/TerminateGui.c
-
 libscigui_algo_la-buildMainWindowTitle.lo: src/c/buildMainWindowTitle.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_algo_la_CFLAGS) $(CFLAGS) -MT libscigui_algo_la-buildMainWindowTitle.lo -MD -MP -MF $(DEPDIR)/libscigui_algo_la-buildMainWindowTitle.Tpo -c -o libscigui_algo_la-buildMainWindowTitle.lo `test -f 'src/c/buildMainWindowTitle.c' || echo '$(srcdir)/'`src/c/buildMainWindowTitle.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscigui_algo_la-buildMainWindowTitle.Tpo $(DEPDIR)/libscigui_algo_la-buildMainWindowTitle.Plo
@@ -1264,6 +1285,20 @@ libscigui_algo_la-messageboxoptions.lo: src/c/messageboxoptions.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_algo_la_CFLAGS) $(CFLAGS) -c -o libscigui_algo_la-messageboxoptions.lo `test -f 'src/c/messageboxoptions.c' || echo '$(srcdir)/'`src/c/messageboxoptions.c
 
+libscigui_algo_la-ScilabTermination.lo: src/c/ScilabTermination.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_algo_la_CFLAGS) $(CFLAGS) -MT libscigui_algo_la-ScilabTermination.lo -MD -MP -MF $(DEPDIR)/libscigui_algo_la-ScilabTermination.Tpo -c -o libscigui_algo_la-ScilabTermination.lo `test -f 'src/c/ScilabTermination.c' || echo '$(srcdir)/'`src/c/ScilabTermination.c
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscigui_algo_la-ScilabTermination.Tpo $(DEPDIR)/libscigui_algo_la-ScilabTermination.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/ScilabTermination.c' object='libscigui_algo_la-ScilabTermination.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_algo_la_CFLAGS) $(CFLAGS) -c -o libscigui_algo_la-ScilabTermination.lo `test -f 'src/c/ScilabTermination.c' || echo '$(srcdir)/'`src/c/ScilabTermination.c
+
+libscigui_algo_la-ScilabTermination_wrap.lo: src/jni/ScilabTermination_wrap.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_algo_la_CFLAGS) $(CFLAGS) -MT libscigui_algo_la-ScilabTermination_wrap.lo -MD -MP -MF $(DEPDIR)/libscigui_algo_la-ScilabTermination_wrap.Tpo -c -o libscigui_algo_la-ScilabTermination_wrap.lo `test -f 'src/jni/ScilabTermination_wrap.c' || echo '$(srcdir)/'`src/jni/ScilabTermination_wrap.c
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscigui_algo_la-ScilabTermination_wrap.Tpo $(DEPDIR)/libscigui_algo_la-ScilabTermination_wrap.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/jni/ScilabTermination_wrap.c' object='libscigui_algo_la-ScilabTermination_wrap.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_algo_la_CFLAGS) $(CFLAGS) -c -o libscigui_algo_la-ScilabTermination_wrap.lo `test -f 'src/jni/ScilabTermination_wrap.c' || echo '$(srcdir)/'`src/jni/ScilabTermination_wrap.c
+
 libscigui_disable_la-nogui.lo: src/nogui/nogui.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscigui_disable_la_CFLAGS) $(CFLAGS) -MT libscigui_disable_la-nogui.lo -MD -MP -MF $(DEPDIR)/libscigui_disable_la-nogui.Tpo -c -o libscigui_disable_la-nogui.lo `test -f 'src/nogui/nogui.c' || echo '$(srcdir)/'`src/nogui/nogui.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscigui_disable_la-nogui.Tpo $(DEPDIR)/libscigui_disable_la-nogui.Plo
@@ -1558,13 +1593,6 @@ libscigui_algo_la-CallMessageBox.lo: src/cpp/CallMessageBox.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigui_algo_la-CallMessageBox.lo `test -f 'src/cpp/CallMessageBox.cpp' || echo '$(srcdir)/'`src/cpp/CallMessageBox.cpp
 
-libscigui_algo_la-CallMainWindow.lo: src/cpp/CallMainWindow.cpp
-@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigui_algo_la-CallMainWindow.lo -MD -MP -MF $(DEPDIR)/libscigui_algo_la-CallMainWindow.Tpo -c -o libscigui_algo_la-CallMainWindow.lo `test -f 'src/cpp/CallMainWindow.cpp' || echo '$(srcdir)/'`src/cpp/CallMainWindow.cpp
-@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigui_algo_la-CallMainWindow.Tpo $(DEPDIR)/libscigui_algo_la-CallMainWindow.Plo
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/CallMainWindow.cpp' object='libscigui_algo_la-CallMainWindow.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigui_algo_la-CallMainWindow.lo `test -f 'src/cpp/CallMainWindow.cpp' || echo '$(srcdir)/'`src/cpp/CallMainWindow.cpp
-
 libscigui_algo_la-CallWaitBar.lo: src/cpp/CallWaitBar.cpp
 @am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigui_algo_la-CallWaitBar.lo -MD -MP -MF $(DEPDIR)/libscigui_algo_la-CallWaitBar.Tpo -c -o libscigui_algo_la-CallWaitBar.lo `test -f 'src/cpp/CallWaitBar.cpp' || echo '$(srcdir)/'`src/cpp/CallWaitBar.cpp
 @am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigui_algo_la-CallWaitBar.Tpo $(DEPDIR)/libscigui_algo_la-CallWaitBar.Plo
index c425380..c2bf1f4 100644 (file)
         </submenu>
         <separator/>
         <submenu label="&amp;Command History">
-            <callback instruction='org.scilab.modules.history_browser.CommandHistory.toggleVisibility' type="3"/>
+            <callback instruction='org.scilab.modules.history_browser.CommandHistory.setVisible' type="3"/>
+        </submenu>
+        <submenu label="&amp;File Browser">
+            <callback instruction='filebrowser()' type="0"/>
         </submenu>
     </menu>
 
index 3ba8142..d4e0dda 100644 (file)
 
     <separator/>
 
-    <!-- Change current directory -->
-    <button icon="folder.png" tooltiptext="Change Current Directory">
-        <callback 
-        instruction='
-          %newDir = uigetdir(pwd(), gettext("Select a directory"));
-          if ~(%newDir == "") then 
-            cd(%newDir);
-          end
-          clear("%newDir");'
-        type="0"/>
-    </button> 
-
-    <separator/>
-
     <!-- Change font -->
     <button icon="format-text-bold.png" tooltiptext="Choose Font...">
         <callback instruction='org.scilab.modules.gui.bridge.CallScilabBridge.changeConsoleFont' type="3"/>
diff --git a/scilab/modules/gui/etc/windowsConfiguration.xml b/scilab/modules/gui/etc/windowsConfiguration.xml
new file mode 100644 (file)
index 0000000..90b1610
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<Scilab>
+  <Window height="453" uuid="5171ff0a-e5e6-4ea9-8525-8d9a5434b881" width="556" x="180" y="25">
+    <DockingPortNode>
+      <DockableNode dockableId="00000000-0000-0000-0000-000000000000"/>
+    </DockingPortNode>
+  </Window>
+  <Console factory="org.scilab.modules.core.ConsoleTabFactory" load="Console" uuid="00000000-0000-0000-0000-000000000000" winuuid="5171ff0a-e5e6-4ea9-8525-8d9a5434b881"/>
+</Scilab>
diff --git a/scilab/modules/gui/images/icons/16x16/actions/edit-clear.png b/scilab/modules/gui/images/icons/16x16/actions/edit-clear.png
new file mode 100644 (file)
index 0000000..e6c8e8b
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/actions/edit-clear.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/application-pdf.png b/scilab/modules/gui/images/icons/16x16/filebrowser/application-pdf.png
new file mode 100644 (file)
index 0000000..ec2c8c9
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/application-pdf.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/binary.png b/scilab/modules/gui/images/icons/16x16/filebrowser/binary.png
new file mode 100644 (file)
index 0000000..1103016
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/binary.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/dynamic-blue-up.png b/scilab/modules/gui/images/icons/16x16/filebrowser/dynamic-blue-up.png
new file mode 100644 (file)
index 0000000..9f2cce8
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/dynamic-blue-up.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/emblem-readonly.png b/scilab/modules/gui/images/icons/16x16/filebrowser/emblem-readonly.png
new file mode 100644 (file)
index 0000000..0466619
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/emblem-readonly.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/filter.png b/scilab/modules/gui/images/icons/16x16/filebrowser/filter.png
new file mode 100644 (file)
index 0000000..709636c
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/filter.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/folder-open.png b/scilab/modules/gui/images/icons/16x16/filebrowser/folder-open.png
new file mode 100644 (file)
index 0000000..b67403d
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/folder-open.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/folder.png b/scilab/modules/gui/images/icons/16x16/filebrowser/folder.png
new file mode 100644 (file)
index 0000000..65bd0bb
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/folder.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/go-next.png b/scilab/modules/gui/images/icons/16x16/filebrowser/go-next.png
new file mode 100644 (file)
index 0000000..6ef8de7
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/go-next.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/go-previous.png b/scilab/modules/gui/images/icons/16x16/filebrowser/go-previous.png
new file mode 100644 (file)
index 0000000..659cd90
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/go-previous.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/icon_scilab.png b/scilab/modules/gui/images/icons/16x16/filebrowser/icon_scilab.png
new file mode 100644 (file)
index 0000000..8b4927c
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/icon_scilab.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/image-x-generic.png b/scilab/modules/gui/images/icons/16x16/filebrowser/image-x-generic.png
new file mode 100644 (file)
index 0000000..68da502
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/image-x-generic.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/open-scilab-folder.png b/scilab/modules/gui/images/icons/16x16/filebrowser/open-scilab-folder.png
new file mode 100644 (file)
index 0000000..742a9d5
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/open-scilab-folder.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/open-user-home.png b/scilab/modules/gui/images/icons/16x16/filebrowser/open-user-home.png
new file mode 100644 (file)
index 0000000..79570d5
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/open-user-home.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/scilab-folder.png b/scilab/modules/gui/images/icons/16x16/filebrowser/scilab-folder.png
new file mode 100644 (file)
index 0000000..93ee4ff
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/scilab-folder.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/system-search.png b/scilab/modules/gui/images/icons/16x16/filebrowser/system-search.png
new file mode 100644 (file)
index 0000000..fd7f0b0
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/system-search.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/text-csv.png b/scilab/modules/gui/images/icons/16x16/filebrowser/text-csv.png
new file mode 100644 (file)
index 0000000..b1e79bc
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/text-csv.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/text-html.png b/scilab/modules/gui/images/icons/16x16/filebrowser/text-html.png
new file mode 100644 (file)
index 0000000..53014ab
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/text-html.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/text-x-generic.png b/scilab/modules/gui/images/icons/16x16/filebrowser/text-x-generic.png
new file mode 100644 (file)
index 0000000..2383a3b
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/text-x-generic.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/text-xml.png b/scilab/modules/gui/images/icons/16x16/filebrowser/text-xml.png
new file mode 100644 (file)
index 0000000..2ae96f2
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/text-xml.png differ
diff --git a/scilab/modules/gui/images/icons/16x16/filebrowser/user-home.png b/scilab/modules/gui/images/icons/16x16/filebrowser/user-home.png
new file mode 100644 (file)
index 0000000..7b9110d
Binary files /dev/null and b/scilab/modules/gui/images/icons/16x16/filebrowser/user-home.png differ
diff --git a/scilab/modules/gui/images/icons/32x32/actions/edit-clear.png b/scilab/modules/gui/images/icons/32x32/actions/edit-clear.png
new file mode 100644 (file)
index 0000000..5542948
Binary files /dev/null and b/scilab/modules/gui/images/icons/32x32/actions/edit-clear.png differ
diff --git a/scilab/modules/gui/images/icons/close-tab-on.png b/scilab/modules/gui/images/icons/close-tab-on.png
new file mode 100644 (file)
index 0000000..ac863a0
Binary files /dev/null and b/scilab/modules/gui/images/icons/close-tab-on.png differ
index 78b931f..8b65408 100644 (file)
Binary files a/scilab/modules/gui/images/icons/close-tab.png and b/scilab/modules/gui/images/icons/close-tab.png differ
diff --git a/scilab/modules/gui/includes/CallMainWindow.h b/scilab/modules/gui/includes/CallMainWindow.h
deleted file mode 100644 (file)
index 758892e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef __CALLMAINWINDOW_H__
-#define __CALLMAINWINDOW_H__
-
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2008 - INRIA - Vincent COUVERT
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-/**
- * Save Main Window Size and Position
- */
-void saveMainWindowSettings(void);
-
-/**
- * Save Help Window Size and Position
- */
-void saveHelpWindowSettings(void);
-
-#endif /* !__CALLMAINWINDOW_H__ */
-
index 698f04c..dd827cb 100644 (file)
@@ -34,4 +34,5 @@ vartype_
 IsAScalar
 overload_
 getlistrhsvar_
-getWarningMode
\ No newline at end of file
+getWarningMode
+StoreCommand
\ No newline at end of file
diff --git a/scilab/modules/gui/src/c/ScilabTermination.c b/scilab/modules/gui/src/c/ScilabTermination.c
new file mode 100644 (file)
index 0000000..a2676c4
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2011 - Calixte DENIZET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+/*--------------------------------------------------------------------------*/
+#include "storeCommand.h"
+/*--------------------------------------------------------------------------*/
+void ScilabExit(void)
+{
+    StoreCommand("exit");
+}
diff --git a/scilab/modules/gui/src/c/ScilabTermination.h b/scilab/modules/gui/src/c/ScilabTermination.h
new file mode 100644 (file)
index 0000000..b52628c
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2011 - Calixte DENIZET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+/*--------------------------------------------------------------------------*/
+#ifndef __SCILABTERMINATION_H__
+#define __SCILABTERMINATION_H__
+
+/**
+* Exit Scilab from Java
+**/
+void ScilabExit(void);
+
+#endif /* __SCILABTERMINATION_H__ */
+/*--------------------------------------------------------------------------*/
index e5d2004..2b5517b 100644 (file)
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\jni\ScilabTermination_wrap.c" />
     <ClCompile Include="addmenu.c" />
     <ClCompile Include="buildMainWindowTitle.c" />
     <ClCompile Include="..\cpp\CallClipboard.cpp" />
     <ClCompile Include="..\cpp\CallJuigetfile.cpp" />
     <ClCompile Include="..\cpp\CallJxclick.cpp" />
     <ClCompile Include="..\cpp\CallJxgetmouse.cpp" />
-    <ClCompile Include="..\cpp\CallMainWindow.cpp" />
     <ClCompile Include="..\cpp\CallMessageBox.cpp" />
     <ClCompile Include="..\jni\CallScilabBridge.cpp" />
     <ClCompile Include="..\cpp\CallWaitBar.cpp" />
     <ClCompile Include="..\..\sci_gateway\c\sci_x_dialog.c" />
     <ClCompile Include="..\..\sci_gateway\c\sci_x_mdialog.c" />
     <ClCompile Include="..\jni\ScilabDisplayTree.cpp" />
+    <ClCompile Include="ScilabTermination.c" />
     <ClCompile Include="setMainWindowTitle.c" />
     <ClCompile Include="..\cpp\SetUicontrolBackgroundColor.cpp" />
     <ClCompile Include="..\cpp\SetUicontrolFontAngle.cpp" />
     <ClCompile Include="..\cpp\SetUiobjectVisible.cpp" />
     <ClCompile Include="setVisibleMainWindow.c" />
     <ClCompile Include="..\cpp\Slider.cpp" />
-    <ClCompile Include="TerminateGui.c" />
     <ClCompile Include="..\cpp\Toolbar.cpp" />
     <ClCompile Include="UicontrolStyleToString.c" />
     <ClCompile Include="..\jni\UIElementMapper.cpp" />
     <ClInclude Include="..\cpp\CallJxclick.hxx" />
     <ClInclude Include="..\..\includes\CallJxgetmouse.h" />
     <ClInclude Include="..\cpp\CallJxgetmouse.hxx" />
-    <ClInclude Include="..\..\includes\CallMainWindow.h" />
     <ClInclude Include="..\cpp\CallMainWindow.hxx" />
     <ClInclude Include="..\..\includes\CallMessageBox.h" />
     <ClInclude Include="..\cpp\CallMessageBox.hxx" />
     <ClInclude Include="..\..\includes\RadioButton.h" />
     <ClInclude Include="..\cpp\RadioButton.hxx" />
     <ClInclude Include="..\jni\ScilabDisplayTree.hxx" />
+    <ClInclude Include="ScilabTermination.h" />
     <ClInclude Include="setMainWindowTitle.h" />
     <ClInclude Include="..\..\includes\SetUicontrolBackgroundColor.h" />
     <ClInclude Include="..\cpp\SetUicontrolBackgroundColor.hxx" />
index c1223cb..4af8a68 100644 (file)
@@ -53,9 +53,6 @@
     <ClCompile Include="..\cpp\CallJxgetmouse.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\cpp\CallMainWindow.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\cpp\CallMessageBox.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\cpp\Slider.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="TerminateGui.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\cpp\Toolbar.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\cpp\Widget.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\jni\ScilabTermination_wrap.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="ScilabTermination.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="buildMainWindowTitle.h">
     <ClInclude Include="..\cpp\CallJxgetmouse.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\includes\CallMainWindow.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\cpp\CallMainWindow.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
     <ClInclude Include="..\cpp\Widget.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="ScilabTermination.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\locales\en_US\gui.pot">
diff --git a/scilab/modules/gui/src/cpp/CallMainWindow.cpp b/scilab/modules/gui/src/cpp/CallMainWindow.cpp
deleted file mode 100644 (file)
index c033a0b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2008 - INRIA - Vincent COUVERT
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-#include "CallMainWindow.hxx"
-
-using namespace org_scilab_modules_gui_bridge;
-
-void saveMainWindowSettings()
-{
-  CallScilabBridge::saveMainWindowSettings(getScilabJavaVM());
-}
-
-void saveHelpWindowSettings()
-{
-  CallScilabBridge::saveHelpWindowSettings(getScilabJavaVM());
-}
-
-
-
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/ScilabTermination.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/ScilabTermination.java
new file mode 100644 (file)
index 0000000..51d6d95
--- /dev/null
@@ -0,0 +1,27 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.40
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.scilab.modules.gui;
+
+
+ /**
+   * @author Calixte DENIZET
+   */
+public class ScilabTermination {
+
+ /**
+   * Constructor
+   */
+ protected ScilabTermination() {
+    throw new UnsupportedOperationException();
+ }
+  public static void ScilabExit() {
+    ScilabTerminationJNI.ScilabExit();
+  }
+
+}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/ScilabTerminationJNI.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/ScilabTerminationJNI.java
new file mode 100644 (file)
index 0000000..59f206b
--- /dev/null
@@ -0,0 +1,43 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.40
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.scilab.modules.gui;
+
+
+/* It is generated code. Disable checkstyle */
+//CHECKSTYLE:OFF
+ /**
+   * @author Calixte DENIZET
+   */
+public class ScilabTerminationJNI {
+
+  /**
+    * Constructor
+    */
+  protected ScilabTerminationJNI() {
+    throw new UnsupportedOperationException();
+  }
+
+  static {
+    try {
+        System.loadLibrary("scigui");
+    } catch (SecurityException e) {
+        System.err.println("A security manager exists and does not allow the loading of the specified dynamic library.");
+        System.err.println(e.getLocalizedMessage());
+        e.printStackTrace(System.err);
+    } catch (UnsatisfiedLinkError e) {
+          if (System.getenv("CONTINUE_ON_JNI_ERROR") == null) {
+           System.err.println("The native library core does not exist or cannot be found.");
+           System.err.println(e.getLocalizedMessage());
+           e.printStackTrace(System.err);
+        }
+    }
+  }
+
+  public final static native void ScilabExit();
+}
index b2ce79f..cec5870 100644 (file)
@@ -54,6 +54,7 @@ import org.scilab.modules.gui.bridge.canvas.SwingScilabCanvasImpl;
 import org.scilab.modules.gui.bridge.console.SwingScilabConsole;
 import org.scilab.modules.gui.bridge.helpbrowser.SwingScilabHelpBrowser;
 import org.scilab.modules.gui.bridge.tab.SwingScilabTab;
+import org.scilab.modules.gui.bridge.window.SwingScilabWindow;
 import org.scilab.modules.gui.canvas.Canvas;
 import org.scilab.modules.gui.checkbox.CheckBox;
 import org.scilab.modules.gui.checkbox.ScilabCheckBox;
@@ -122,7 +123,6 @@ import org.scilab.modules.localization.Messages;
 import org.scilab.modules.renderer.FigureMapper;
 import org.scilab.modules.renderer.figureDrawing.DrawableFigureGL;
 
-
 /**
  * This class is used to call Scilab GUIs objects from Scilab
  * @author Vincent COUVERT
@@ -2131,7 +2131,6 @@ public class CallScilabBridge {
      * Close Scilab Help Browser
      */
     public static void closeHelpBrowser() {
-        CallScilabBridge.saveHelpWindowSettings();
         ScilabHelpBrowser.getHelpBrowser().close();
     }
 
@@ -2300,35 +2299,11 @@ public class CallScilabBridge {
     }
 
     /**
-     * Save the main Window size and position
+     * Unblock the console if it is in "Continue display..." mode
      */
-    public static void saveMainWindowSettings() {
+    public static void unblockConsole() {
         SwingScilabConsole sciConsole = ((SwingScilabConsole) ScilabConsole.getConsole().getAsSimpleConsole());
-        SwingScilabTab consoleTab = (SwingScilabTab) sciConsole.getParent();
-        Window mainWindow = (Window) UIElementMapper.getCorrespondingUIElement(consoleTab.getParentWindowId());
-
-        ConfigManager.saveMainWindowPosition(mainWindow.getPosition());
-        ConfigManager.saveMainWindowSize(mainWindow.getDims());
-
-    }
-
-    /**
-     * Save the help Window size and position
-     */
-    public static void saveHelpWindowSettings() {
-        if (ScilabHelpBrowser.getHelpBrowserWithoutCreation() != null )  {
-            SwingScilabHelpBrowser sciHelpBrowser = ((SwingScilabHelpBrowser) ScilabHelpBrowser.getHelpBrowser().getAsSimpleHelpBrowser());
-            if (sciHelpBrowser != null) {
-                SwingScilabTab consoleTab = (SwingScilabTab) sciHelpBrowser.getParent();
-                if (consoleTab != null) {
-                    Window helpWindow = (Window) UIElementMapper.getCorrespondingUIElement(consoleTab.getParentWindowId());
-
-                    ConfigManager.saveHelpWindowPosition(helpWindow.getPosition());
-                    ConfigManager.saveHelpWindowSize(helpWindow.getDims());
-                }
-            }
-        }
-
+        sciConsole.unblock();
     }
 
     /**
index 47bdc0a..afdcf24 100644 (file)
@@ -593,6 +593,16 @@ public class ScilabBridge {
     }
 
     /**
+     * Creates a Scilab tab
+     * @param name the name of the tab
+     * @param uuid an uuid to identify the tab
+     * @return the created tab
+     */
+    public static SimpleTab createTab(String name, String uuid) {
+        return ScilabTabBridge.createTab(name, uuid);
+    }
+
+    /**
      * Creates a Scilab tab able to create graphics
      * @param name the name of the tab (used to identify it)
      * @param figureId index of the created figure
index a9a509f..5ccb867 100644 (file)
@@ -71,51 +71,51 @@ public class SwingScilabConsole extends SciConsole implements SimpleConsole {
         SwingScilabMenuItem cutMenu = new SwingScilabMenuItem();
         cutMenu.setText(Messages.gettext("Cut"));
         cutMenu.setCallback(ScilabCallBack.createCallback(
-                                                          "org.scilab.modules.gui.bridge.CallScilabBridge.cutConsoleSelection",
-                                                          ScilabCallBack.JAVA));
+                                "org.scilab.modules.gui.bridge.CallScilabBridge.cutConsoleSelection",
+                                ScilabCallBack.JAVA));
         cutMenu.setMnemonic('U');
 
         SwingScilabMenuItem copyMenu = new SwingScilabMenuItem();
         copyMenu.setText(Messages.gettext("Copy"));
         copyMenu.setCallback(ScilabCallBack.createCallback(
-                                                           "org.scilab.modules.gui.bridge.CallScilabBridge.copyConsoleSelection",
-                                                           ScilabCallBack.JAVA));
+                                 "org.scilab.modules.gui.bridge.CallScilabBridge.copyConsoleSelection",
+                                 ScilabCallBack.JAVA));
         copyMenu.setMnemonic('C');
 
         SwingScilabMenuItem pasteMenu = new SwingScilabMenuItem();
         pasteMenu.setText(Messages.gettext("Paste"));
         pasteMenu.setCallback(ScilabCallBack.createCallback(
-                                                            "org.scilab.modules.gui.bridge.CallScilabBridge.pasteClipboardIntoConsole",
-                                                            ScilabCallBack.JAVA));
+                                  "org.scilab.modules.gui.bridge.CallScilabBridge.pasteClipboardIntoConsole",
+                                  ScilabCallBack.JAVA));
         pasteMenu.setMnemonic('P');
 
         SwingScilabMenuItem clearHistoryMenu = new SwingScilabMenuItem();
         clearHistoryMenu.setText(Messages.gettext("Clear History"));
         clearHistoryMenu.setCallback(ScilabCallBack.createCallback(
-                                                                   "org.scilab.modules.gui.bridge.CallScilabBridge.clearHistory",
-                                                                   ScilabCallBack.JAVA));
+                                         "org.scilab.modules.gui.bridge.CallScilabBridge.clearHistory",
+                                         ScilabCallBack.JAVA));
         clearHistoryMenu.setMnemonic('H');
 
         SwingScilabMenuItem clearMenu = new SwingScilabMenuItem();
         clearMenu.setText(Messages.gettext("Clear Console"));
         clearMenu.setCallback(ScilabCallBack.createCallback(
-                                                            "org.scilab.modules.gui.bridge.CallScilabBridge.clear",
-                                                            ScilabCallBack.JAVA));
+                                  "org.scilab.modules.gui.bridge.CallScilabBridge.clear",
+                                  ScilabCallBack.JAVA));
         clearMenu.setMnemonic('O');
 
         SwingScilabMenuItem selectMenu = new SwingScilabMenuItem();
         selectMenu.setText(Messages.gettext("Select All"));
         selectMenu.setCallback(ScilabCallBack.createCallback(
-                                                             "org.scilab.modules.gui.bridge.CallScilabBridge.selectAllConsoleContents",
-                                                             ScilabCallBack.JAVA));
+                                   "org.scilab.modules.gui.bridge.CallScilabBridge.selectAllConsoleContents",
+                                   ScilabCallBack.JAVA));
         selectMenu.setMnemonic('S');
 
 
         final SwingScilabMenuItem helpMenu = new SwingScilabMenuItem();
         helpMenu.setText(Messages.gettext("Help on a selected keyword"));
         helpMenu.setCallback(ScilabCallBack.createCallback(
-                                                           "org.scilab.modules.gui.bridge.CallScilabBridge.helpOnTheKeyword",
-                                                           ScilabCallBack.JAVA));
+                                 "org.scilab.modules.gui.bridge.CallScilabBridge.helpOnTheKeyword",
+                                 ScilabCallBack.JAVA));
         helpMenu.setMnemonic('M');
         PropertyChangeListener listener = new PropertyChangeListener() {
                 public void propertyChange(PropertyChangeEvent arg0) {
@@ -238,6 +238,15 @@ public class SwingScilabConsole extends SciConsole implements SimpleConsole {
     }
 
     /**
+     * Unblock the console if needed
+     */
+    public void unblock() {
+        if (getCanReadUserInputValue().availablePermits() == 0) {
+            setUserInputValue((int) 'n');
+        }
+    }
+
+    /**
      * Reads one user input char
      * @return the data entered by the user
      * @see fr.scilab.console.HelpBrowser#getCharWithoutOutput()
index 33871fa..2b6f3e2 100644 (file)
@@ -91,6 +91,7 @@ public class SwingScilabHelpBrowser extends JPanel implements SimpleHelpBrowser,
         super(new BorderLayout());
         jhelp = new JHelp();
         add(jhelp);
+       setFocusable(true);
         searchField = new HelpSearchField(this, null);
 
         /* Send information to the user using status bar and cursor */
@@ -239,6 +240,13 @@ public class SwingScilabHelpBrowser extends JPanel implements SimpleHelpBrowser,
     }
 
     /**
+     * @return the current URL as String being displayed
+     */
+    public String getCurrentURL() {
+        return ((SwingScilabHelpBrowserViewer) jhelp.getContentViewer().getUI()).getCurrentURL();
+    }
+
+    /**
      * Show the search field
      */
     public void showSearchField() {
@@ -279,11 +287,38 @@ public class SwingScilabHelpBrowser extends JPanel implements SimpleHelpBrowser,
      */
     public void displayHomePage() {
         if (homePageURL != null) {
-            jhelp.setCurrentURL(homePageURL);
+            setCurrentURL(homePageURL);
         }
     }
 
     /**
+     * Sets the current URL
+     * @param url the URL to display
+     */
+    public void setCurrentURL(final URL url) {
+        SwingUtilities.invokeLater(new Runnable() {
+
+                public void run() {
+                    jhelp.setCurrentURL(url);
+                }
+            });
+    }
+
+    /**
+     * Sets the current url
+     * @param url the url as String to display
+     */
+    public void setCurrentURL(String url) {
+        URL u = homePageURL;
+        try {
+            if (url != null) {
+                u = new URL(url);
+            }
+        } catch (MalformedURLException e) { }
+        setCurrentURL(u);
+    }
+
+    /**
      * Display the Help Browser
      */
     public void display() { }
index c24cbcb..d345bef 100644 (file)
@@ -12,6 +12,9 @@
  */
 package org.scilab.modules.gui.bridge.helpbrowser;
 
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.DefaultFocusTraversalPolicy;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.MouseWheelEvent;
@@ -283,6 +286,13 @@ public class SwingScilabHelpBrowserViewer extends BasicContentViewerUI implement
     }
 
     /**
+     * @return the current URL as String being displayed
+     */
+    public String getCurrentURL() {
+        return x.getCurrentURL().toString();
+    }
+
+    /**
      * Execute the code in example
      * @param pre the preformatted Element containing Scilab's code
      */
@@ -419,8 +429,11 @@ public class SwingScilabHelpBrowserViewer extends BasicContentViewerUI implement
             this.accessibleHtml = (javax.swing.JEditorPane) privateField.get(this);
             accessibleHtml.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                     public void propertyChange(java.beans.PropertyChangeEvent evt) {
+                        // Crappy workaround to avoid bad html display (the icons play and edit can be misplaced)
+                        // To improve... (it doesn't always work)
                         if (evt.getPropertyName().equals("document")) {
                             accessibleHtml.setVisible(false);
+                            accessibleHtml.validate();
                         }
                         if (evt.getPropertyName().equals("page")) {
                             if (!accessibleHtml.isVisible()) {
@@ -435,6 +448,16 @@ public class SwingScilabHelpBrowserViewer extends BasicContentViewerUI implement
                     }
                 });
 
+            // The previous workaround hides the component accessibleHtml
+            // and consequently the focus is given to an other component.
+            // So we force the accessibleHtml to keep the focus.
+            accessibleHtml.setFocusTraversalPolicy(new DefaultFocusTraversalPolicy() {
+                    public Component getFirstComponent(Container aContainer) {
+                        return x;
+                    }
+                });
+            accessibleHtml.setFocusCycleRoot(true);
+
             String keyModifier = "alt ";
             if (isMac) {
                 keyModifier = "meta ";
index 7e7cf62..0a78df9 100644 (file)
@@ -55,6 +55,7 @@ import javax.swing.text.html.StyleSheet;
 
 import org.scilab.modules.gui.console.ScilabConsole;
 import org.scilab.modules.gui.messagebox.SimpleMessageBox;
+import org.scilab.modules.gui.tab.SimpleTab;
 import org.scilab.modules.gui.tab.Tab;
 import org.scilab.modules.gui.utils.ScilabSwingUtilities;
 import org.scilab.modules.gui.utils.WebBrowser;
@@ -65,793 +66,795 @@ import org.scilab.modules.gui.utils.WebBrowser;
  */
 public class SwingScilabMessageBox extends JDialog implements SimpleMessageBox, ActionListener {
 
-        private static final long serialVersionUID = 7939976395338222763L;
-
-        private static final int WINDOW_WIDTH = 650;
-        private static final int MESSAGE_HEIGHT = 200;
-        private static final int LISTBOX_HEIGHT = 200;
-
-        private static final int X_MDIALOG_MARGIN = 5;
-        private static final int X_MDIALOG_TEXTFIELD_SIZE = 10;
-
-        private static final int X_MESSAGE_TYPE = 0;
-        private static final int X_DIALOG_TYPE = 1;
-        private static final int X_CHOOSE_TYPE = 2;
-        private static final int X_MDIALOG_TYPE = 3;
-        private static final int X_CHOICES_TYPE = 4;
-
-        private static final String SCIDIR = System.getenv("SCI");
-
-        /**
-         * Offset around object and its ScrollPane
-         */
-        private static final int OFFSET = 5;
-
-        /**
-         * New line character for mutli-line text components
-         */
-        private static final String NEW_LINE = "\n";
-
-        /**
-         * Separator used for x_choices
-         */
-        private static final String SEPARATOR = "[--sep--]";
-
-        /**
-         * Icons
-         */
-        private Icon scilabIcon = new ImageIcon(SCIDIR + "/modules/gui/images/icons/scilab.png");
-        private Icon passwdIcon = new ImageIcon(SCIDIR + "/modules/gui/images/icons/emblem-readonly.png");
-        private Icon hourglassIcon = new ImageIcon(SCIDIR + "/modules/gui/images/icons/process-working.png");
-
-        private int elementId;
-
-        private Icon messageIcon; //= new ImageIcon(System.getenv("SCI") + "/modules/gui/images/icons/scilab.png");
-
-        private int scilabDialogType = X_MESSAGE_TYPE;
-
-        private Component parentWindow;
-
-        private JButton btnOK = new JButton("OK");
-        private JButton btnCancel = new JButton("Cancel");
-
-        /**
-         * Used for x_dialog
-         */
-        private JTextArea textArea;
-        private String initialValue;
-        private int initialValueSize;
-        private String userValue;
-
-        /**
-         * Used for x_choose
-         */
-        private JList listBox;
-        private String[] listboxItems;
-        private int selectedItem;
-
-        /**
-         * Used for x_mdialog
-         */
-        private String[] lineLabels;
-        private String[] columnLabels;
-        private String[] defaultInput;
-        private JTextField[] textFields;
-        private String[] userValues;
-
-        /**
-         * Used for x_choose & x_message
-         */
-        private String[] buttonsLabels;
-        private int selectedButton;
-
-        /**
-         * Used for x_choices
-         */
-        private int[] defaultSelectedButtons;
-        private ButtonGroup[] buttonGroups;
-        private int[] userSelectedButtons;
-
-        /**
-         * Used for all Message Boxes
-         */
-        private String message;
-        private String title;
-        private Image imageForIcon = ((ImageIcon) scilabIcon).getImage();
-        private int messageType = -1;
-        private Object[] objs;
-        private Object[] buttons;
-        private boolean modal = true;
-
-        /**
-         * Default constructor
-         */
-        public SwingScilabMessageBox() {
-                super(new JFrame());
-                ((JFrame) getOwner()).setIconImage(imageForIcon); // Java 1.5 compatible
+    private static final long serialVersionUID = 7939976395338222763L;
+
+    private static final int WINDOW_WIDTH = 650;
+    private static final int MESSAGE_HEIGHT = 200;
+    private static final int LISTBOX_HEIGHT = 200;
+
+    private static final int X_MDIALOG_MARGIN = 5;
+    private static final int X_MDIALOG_TEXTFIELD_SIZE = 10;
+
+    private static final int X_MESSAGE_TYPE = 0;
+    private static final int X_DIALOG_TYPE = 1;
+    private static final int X_CHOOSE_TYPE = 2;
+    private static final int X_MDIALOG_TYPE = 3;
+    private static final int X_CHOICES_TYPE = 4;
+
+    private static final String SCIDIR = System.getenv("SCI");
+
+    /**
+     * Offset around object and its ScrollPane
+     */
+    private static final int OFFSET = 5;
+
+    /**
+     * New line character for mutli-line text components
+     */
+    private static final String NEW_LINE = "\n";
+
+    /**
+     * Separator used for x_choices
+     */
+    private static final String SEPARATOR = "[--sep--]";
+
+    /**
+     * Icons
+     */
+    private Icon scilabIcon = new ImageIcon(SCIDIR + "/modules/gui/images/icons/scilab.png");
+    private Icon passwdIcon = new ImageIcon(SCIDIR + "/modules/gui/images/icons/emblem-readonly.png");
+    private Icon hourglassIcon = new ImageIcon(SCIDIR + "/modules/gui/images/icons/process-working.png");
+
+    private int elementId;
+
+    private Icon messageIcon; //= new ImageIcon(System.getenv("SCI") + "/modules/gui/images/icons/scilab.png");
+
+    private int scilabDialogType = X_MESSAGE_TYPE;
+
+    private Component parentWindow;
+
+    private JButton btnOK = new JButton("OK");
+    private JButton btnCancel = new JButton("Cancel");
+
+    /**
+     * Used for x_dialog
+     */
+    private JTextArea textArea;
+    private String initialValue;
+    private int initialValueSize;
+    private String userValue;
+
+    /**
+     * Used for x_choose
+     */
+    private JList listBox;
+    private String[] listboxItems;
+    private int selectedItem;
+
+    /**
+     * Used for x_mdialog
+     */
+    private String[] lineLabels;
+    private String[] columnLabels;
+    private String[] defaultInput;
+    private JTextField[] textFields;
+    private String[] userValues;
+
+    /**
+     * Used for x_choose & x_message
+     */
+    private String[] buttonsLabels;
+    private int selectedButton;
+
+    /**
+     * Used for x_choices
+     */
+    private int[] defaultSelectedButtons;
+    private ButtonGroup[] buttonGroups;
+    private int[] userSelectedButtons;
+
+    /**
+     * Used for all Message Boxes
+     */
+    private String message;
+    private String title;
+    private Image imageForIcon = ((ImageIcon) scilabIcon).getImage();
+    private int messageType = -1;
+    private Object[] objs;
+    private Object[] buttons;
+    private boolean modal = true;
+
+    /**
+     * Default constructor
+     */
+    public SwingScilabMessageBox() {
+        super(new JFrame());
+        ((JFrame) getOwner()).setIconImage(imageForIcon); // Java 1.5 compatible
+    }
+
+    /**
+     * Set the element id for this MessageBox
+     * @param id the id of the corresponding MessageBox object
+     */
+    public void setElementId(int id) {
+        this.elementId = id;
+    }
+
+    /**
+     * Get the element id for MessageBox
+     * @return id the id of the corresponding MessageBox object
+     */
+    public int getElementId() {
+        return this.elementId;
+    }
+
+    /**
+     * Set the title of the MessageBox
+     * @param title the title to set
+     */
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    /**
+     * Set the message of the MessageBox
+     * @param message the message to set
+     */
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    /**
+     * Set the message of the MessageBox (multi-line)
+     * @param mess the message to set
+     */
+    public void setMessage(String[] mess) {
+        int line = 0;
+        message = "<HTML>";
+        for (line = 0; line < mess.length - 1; line++) {
+            message += "<div>" + mess[line] + "</div>";
         }
-
-        /**
-         * Set the element id for this MessageBox
-         * @param id the id of the corresponding MessageBox object
-         */
-        public void setElementId(int id) {
-                this.elementId = id;
-        }
-
-        /**
-         * Get the element id for MessageBox
-         * @return id the id of the corresponding MessageBox object
-         */
-        public int getElementId() {
-                return this.elementId;
-        }
-
-        /**
-         * Set the title of the MessageBox
-         * @param title the title to set
-         */
-        public void setTitle(String title) {
-                this.title = title;
-        }
-
-        /**
-         * Set the message of the MessageBox
-         * @param message the message to set
-         */
-        public void setMessage(String message) {
-                this.message = message;
-        }
-
-        /**
-         * Set the message of the MessageBox (multi-line)
-         * @param mess the message to set
-         */
-        public void setMessage(String[] mess) {
-                int line = 0;
-                message = "<HTML>";
-                for (line = 0; line < mess.length - 1; line++) {
-                        message += "<div>" + mess[line] + "</div>";
+        message += mess[line] + "</HTML>";
+    }
+
+    /**
+     * DefaultValues
+     * Display this MessageBox and wait for user selection
+     */
+    public void displayAndWait() {
+
+        // Set the title & icon
+        //setIconImage(imageForIcon); // Not Java 1.5 compatible
+        super.setTitle(title);
+
+        // Create the message to display
+        JTextPane messageLabel = new JTextPane();
+        messageLabel.setContentType("text/html");
+        messageLabel.setOpaque(false);
+        messageLabel.setBorder(null);
+        messageLabel.setEditable(false);
+
+        // Update the stylesheet so that the font matches JLabel font
+        Font labelFont = UIManager.getFont("Label.font");
+        HTMLEditorKit editorKit = (HTMLEditorKit) messageLabel.getEditorKit();
+        StyleSheet styles = editorKit.getStyleSheet();
+        String css = "body {font-family:\"" + labelFont.getName()
+            + "\"; font-size:\"" + labelFont.getSize() + "pt\"}";
+        styles.addRule(css);
+        editorKit.setStyleSheet(styles);
+        messageLabel.setEditorKit(editorKit);
+
+        messageLabel.setText(message);
+
+        /* Add a link to make HTML links active */
+        messageLabel.addHyperlinkListener(new HyperlinkListener() {
+                public void hyperlinkUpdate(HyperlinkEvent e) {
+                    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+                        WebBrowser.openUrl(e.getURL(), e.getDescription());
+                    }
                 }
-                message += mess[line] + "</HTML>";
-        }
-
-        /**
-         * DefaultValues
-         * Display this MessageBox and wait for user selection
-         */
-        public void displayAndWait() {
-
-                // Set the title & icon
-                //setIconImage(imageForIcon); // Not Java 1.5 compatible
-                super.setTitle(title);
-
-                // Create the message to display
-                JTextPane messageLabel = new JTextPane();
-                messageLabel.setContentType("text/html");
-                messageLabel.setOpaque(false);
-                messageLabel.setBorder(null);
-                messageLabel.setEditable(false);
-
-                // Update the stylesheet so that the font matches JLabel font
-                Font labelFont = UIManager.getFont("Label.font");
-                HTMLEditorKit editorKit = (HTMLEditorKit) messageLabel.getEditorKit();
-                StyleSheet styles = editorKit.getStyleSheet();
-                String css = "body {font-family:\"" + labelFont.getName()
-                                        + "\"; font-size:\"" + labelFont.getSize() + "pt\"}";
-                styles.addRule(css);
-                editorKit.setStyleSheet(styles);
-                messageLabel.setEditorKit(editorKit);
-
-                messageLabel.setText(message);
-
-                /* Add a link to make HTML links active */
-                messageLabel.addHyperlinkListener(new HyperlinkListener() {
-                        public void hyperlinkUpdate(HyperlinkEvent e) {
-                                if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
-                                        WebBrowser.openUrl(e.getURL(), e.getDescription());
-                                }
-                        }
-                });
-
-                JScrollPane messageScrollPane = new JScrollPane(messageLabel);
-                int scrollWidth = (int) Math.min(WINDOW_WIDTH, messageLabel.getPreferredSize().getWidth() + OFFSET);
-                int scrollHeight = (int) Math.min(MESSAGE_HEIGHT, messageLabel.getPreferredSize().getHeight() + OFFSET);
-                messageScrollPane.setPreferredSize(new Dimension(scrollWidth, scrollHeight));
-                // Make the scroll Pane transparent
-                messageScrollPane.setOpaque(false);
-                messageScrollPane.getViewport().setOpaque(false);
-                /* Make the Border of the ScrollPane invisible */
-                messageScrollPane.setBorder(BorderFactory.createEmptyBorder());
-                messageScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
-
-                if (scilabDialogType == X_CHOICES_TYPE) {
-                        // Create a MessageBox for Scilab x_choices
-
-                        // All objects in the MessageBox:
-                        //  - Message
-                        //  - Editable zone
-                        objs = new Object[2];
-
-                        objs[0] = messageScrollPane;
-
-                        // Search the max number of objects in a line
-                        int curNumber = 0;
-                        int numberOfLines = 0;
-                        int numberOfColumns = 0;
-                        List<Integer> buttonsPerLines = new ArrayList<Integer>();
-                        for (int itemIndex = 0; itemIndex < lineLabels.length; itemIndex++) {
-                                if (!lineLabels[itemIndex].equals(SEPARATOR)) {
-                                        curNumber++;
-                                } else {
-                                        if (curNumber > numberOfColumns) {
-                                                numberOfColumns = curNumber;
-                                        }
-                                        // Store informations of current line
-                                        buttonsPerLines.add(curNumber);
-                                        curNumber = 0;
-                                        numberOfLines++;
-                                }
-                        }
-                        // Store information of last line
-                        // Because no separator after last line items
-                        buttonsPerLines.add(curNumber);
-                        numberOfLines++;
-
-                        // Create the panel with button groups
-                        JPanel panel = new JPanel(new GridBagLayout());
-                        GridBagConstraints gbc = new GridBagConstraints();
-                        gbc.gridx = 0;
-                        gbc.gridy = 0;
-                        gbc.fill = GridBagConstraints.HORIZONTAL;
-                        buttonGroups = new ButtonGroup[numberOfLines];
-
-                        // Initialize return value
-                        userSelectedButtons = new int[numberOfLines];
-
-                        int curItemIndex = 0;
-                        int lineNumber = 0;
-                        int buttonNumber = 0;
-                        for (curItemIndex = 0; curItemIndex < lineLabels.length; curItemIndex++) {
-                                // Add the label of the line
-                                gbc.weightx = 1; // Labels will use remaining space when resizing
-                                panel.add(new JLabel(lineLabels[curItemIndex]), gbc);
-                                gbc.gridx++; // Increment the column index
-
-                                buttonNumber = 0;
-                                curItemIndex++;
-
-                                // Add the button group
-                                ButtonGroup group = new ButtonGroup();
-                                while (curItemIndex < lineLabels.length &&  !lineLabels[curItemIndex].equals(SEPARATOR)) {
-                                        // Add a toggle button
-                                        JToggleButton button = new JToggleButton(lineLabels[curItemIndex]);
-                                        buttonNumber++;
-
-                                        // Select this button if default
-                                        if (buttonNumber == defaultSelectedButtons[lineNumber]) {
-                                                button.setSelected(true);
-                                        }
-                                        // Select this button if default selection is a non existing button
-                                        // And this button is the last of the line
-                                        if (buttonNumber == (buttonsPerLines.get(lineNumber) - 1)
-                                                        && defaultSelectedButtons[lineNumber] > (buttonsPerLines.get(lineNumber) - 1)) {
-                                                button.setSelected(true);
-                                        }
-                                        // Add the button to the group (for toggle)
-                                        // And to the panel (for display)
-                                        group.add(button);
-                                        gbc.weightx = 0; // Button size will not change when resizing
-                                        panel.add(button, gbc);
-                                        gbc.gridx++; // Increment the column index
-
-                                        // Increment item index
-                                        curItemIndex++;
-
-                                }
-                                // Add empty labels if number of buttons in the line is lesser than maximum number of buttons found in a line
-                                for (int emptyLabelsIndex = buttonsPerLines.get(lineNumber); emptyLabelsIndex < numberOfColumns; emptyLabelsIndex++) {
-                                        panel.add(new JLabel(), gbc);
-                                        gbc.gridx++; // Increment the column index
-                                }
-
-                                // Store the group to get the user selection when returning
-                                buttonGroups[lineNumber] = group;
-
-                                // Increment current line number
-                                lineNumber++;
-                                gbc.gridx = 0; // New line --> Back to first column
-                                gbc.gridy++; // Increment the row index
-                        }
-
-                        // Display the panel
-                        panel.doLayout();
-
-                        // Editable text zone
-                        JScrollPane scrollPane = new JScrollPane(panel);
-
-                        scrollWidth = (int) Math.min(WINDOW_WIDTH, panel.getPreferredSize().getWidth() + OFFSET);
-                        scrollHeight = (int) Math.min(LISTBOX_HEIGHT, panel.getPreferredSize().getHeight() + OFFSET);
-                        scrollPane.setPreferredSize(new Dimension(scrollWidth, scrollHeight));
-
-                        objs[1] = scrollPane;
-
-                        // And now the buttons
-                        buttons = new Object[2];
-                        btnOK.addActionListener(this);
-                        btnCancel.addActionListener(this);
-                        /* Test added for bug 4347 fix */
-                        if (isWindows()) {
-                                buttons[0] = btnOK;
-                                buttons[1] = btnCancel;
-
-                        } else {
-                                buttons[0] = btnCancel;
-                                buttons[1] = btnOK;
-                        }
-                } else if (scilabDialogType == X_MDIALOG_TYPE) {
-                        // Create a MessageBox for Scilab x_mdialog
-
-                        // All objects in the MessageBox:
-                        //  - Message
-                        //  - Editable zone
-                        objs = new Object[2];
-
-                        objs[0] = messageScrollPane;
-
-                        int numberOfColumns = 0;
-                        if (columnLabels == null) {
-                                numberOfColumns = 2;
-                        } else {
-                                numberOfColumns = columnLabels.length + 1;
-                        }
-                        GridBagLayout layout = new GridBagLayout();
-                        JPanel panel = new JPanel(layout);
-                        GridBagConstraints constraints = new GridBagConstraints();
-                        constraints.gridx = 0;
-                        constraints.gridy = 0;
-                        constraints.fill = GridBagConstraints.HORIZONTAL;
-                        constraints.insets = new Insets(X_MDIALOG_MARGIN, X_MDIALOG_MARGIN, X_MDIALOG_MARGIN, X_MDIALOG_MARGIN);
-
-                        int line = 0;
-                        int col = 0;
-                        // Optional first line
-                        if (columnLabels != null) {
-                                // Column label for "Row labels" column
-                                panel.add(new JLabel(""), constraints);
-                                constraints.gridx++;
-                                for (col = 0; col < columnLabels.length; col++) {
-                                        panel.add(new JLabel(columnLabels[col]), constraints);
-                                        constraints.gridx++;
-                                }
-                                constraints.gridy++;
-                        }
-
-
-                        // Prepare return value
-                        if (columnLabels == null) {
-                                userValues = new String[lineLabels.length];
-                                textFields = new JTextField[lineLabels.length];
-                        } else {
-                                userValues = new String[lineLabels.length * columnLabels.length];
-                                textFields = new JTextField[lineLabels.length * columnLabels.length];
-                        }
-                        for (line = 0; line < lineLabels.length; line++) {
-                                constraints.gridx = 0;
-                                panel.add(new JLabel(lineLabels[line]), constraints);
-                                constraints.gridx++;
-                                for (col = 0; col < numberOfColumns - 1; col++) {
-                                        textFields[col * lineLabels.length + line] = new JTextField(defaultInput[col * lineLabels.length + line]);
-                                        panel.add(textFields[col * lineLabels.length + line], constraints);
-                                        textFields[col * lineLabels.length + line].setColumns(X_MDIALOG_TEXTFIELD_SIZE);
-                                        constraints.gridx++;
-                                }
-                                constraints.gridy++;
-                        }
-
-                        panel.doLayout();
-
-                        // Editable text zone
-                        JScrollPane scrollPane = new JScrollPane(panel);
-
-                        scrollWidth = (int) Math.min(WINDOW_WIDTH, panel.getPreferredSize().getWidth() + OFFSET);
-                        scrollHeight = (int) Math.min(LISTBOX_HEIGHT, panel.getPreferredSize().getHeight() + OFFSET);
-                        scrollPane.setPreferredSize(new Dimension(scrollWidth, scrollHeight));
-
-                        objs[1] = scrollPane;
-
-                        // And now the buttons
-                        buttons = new Object[2];
-                        btnOK.addActionListener(this);
-                        btnCancel.addActionListener(this);
-                        /* Test added for bug 4347 fix */
-                        if (isWindows()) {
-                                buttons[0] = btnOK;
-                                buttons[1] = btnCancel;
-
-                        } else {
-                                buttons[0] = btnCancel;
-                                buttons[1] = btnOK;
-                        }
-                } else if (scilabDialogType == X_CHOOSE_TYPE) {
-                        // Create a MessageBox for Scilab x_choose
-
-                        // All objects in the MessageBox:
-                        //  - Message
-                        //  - Listbox
-                        objs = new Object[2];
-
-                        // Add the message
-                        objs[0] = messageScrollPane;
-
-                        // Add the listBox
-                        objs[1] = createXchooseListBox();
-
-                        // And now the buttons
-                        buttons = new Object[1];
-                        if (buttonsLabels != null) {
-                                btnCancel.setText(buttonsLabels[0]);
-                        }
-                        btnCancel.addActionListener(this);
-                        buttons[0] = btnCancel;
-                } else if (scilabDialogType == X_DIALOG_TYPE) {
-                        // Create a MessageBox for Scilab x_dialog
-
-                        // All objects in the MessageBox:
-                        //  - Message
-                        //  - Editable zone
-                        objs = new Object[2];
-
-                        objs[0] = messageScrollPane;
-
-                        // Editable text zone
-                        textArea = new JTextArea(initialValue);
-                        textArea.setRows(initialValueSize);
-                        JScrollPane scrollPane = new JScrollPane(textArea);
-                        scrollWidth = (int) Math.min(WINDOW_WIDTH, textArea.getPreferredSize().getWidth() + OFFSET);
-                        scrollHeight = (int) Math.min(LISTBOX_HEIGHT, textArea.getPreferredSize().getHeight() + OFFSET);
-                        scrollPane.setPreferredSize(new Dimension(scrollWidth, scrollHeight));
-
-                        objs[1] = scrollPane;
-
-                        // And now the buttons
-                        buttons = new Object[2];
-                        btnOK.addActionListener(this);
-                        btnCancel.addActionListener(this);
-                        /* Test added for bug 4347 fix */
-                        if (isWindows()) {
-                                buttons[0] = btnOK;
-                                buttons[1] = btnCancel;
-
-                        } else {
-                                buttons[0] = btnCancel;
-                                buttons[1] = btnOK;
-                        }
-                } else {
-                        // Create a MessageBox for Scilab x_message
-
-                        // All objects in the MessageBox:
-                        //  - Message
-                        objs = new Object[1];
-
-                        // Add the message
-                        objs[0] = messageScrollPane;
-
-                        // And now the buttons
-                        if (buttonsLabels == null) {
-                                buttons = new Object[1];
-                                btnOK.addActionListener(this);
-                                buttons[0] = btnOK;
-                                //messageType = JOptionPane.INFORMATION_MESSAGE;
-                        } else {
-                                buttons = new Object[buttonsLabels.length];
-                                for (int buttonNb = 0; buttonNb < buttonsLabels.length; buttonNb++) {
-                                        JButton currentButton = new JButton(buttonsLabels[buttonNb]);
-                                        currentButton.addActionListener(this);
-                                        /* Test added for bug 4347 fix */
-                                        if (isWindows()) {
-                                                buttons[buttonNb] = currentButton;
-                                        } else {
-                                                buttons[buttonsLabels.length - buttonNb - 1] = currentButton;
-                                        }
-                                }
-                        }
-                }
-                // Display
-                ((JScrollPane) objs[0]).setBorder(BorderFactory.createEmptyBorder());
-                if (messageType != -1) {
-                        setContentPane(new JOptionPane(objs, messageType, JOptionPane.CANCEL_OPTION, null, buttons));
+            });
+
+        JScrollPane messageScrollPane = new JScrollPane(messageLabel);
+        int scrollWidth = (int) Math.min(WINDOW_WIDTH, messageLabel.getPreferredSize().getWidth() + OFFSET);
+        int scrollHeight = (int) Math.min(MESSAGE_HEIGHT, messageLabel.getPreferredSize().getHeight() + OFFSET);
+        messageScrollPane.setPreferredSize(new Dimension(scrollWidth, scrollHeight));
+        // Make the scroll Pane transparent
+        messageScrollPane.setOpaque(false);
+        messageScrollPane.getViewport().setOpaque(false);
+        /* Make the Border of the ScrollPane invisible */
+        messageScrollPane.setBorder(BorderFactory.createEmptyBorder());
+        messageScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
+
+        if (scilabDialogType == X_CHOICES_TYPE) {
+            // Create a MessageBox for Scilab x_choices
+
+            // All objects in the MessageBox:
+            //  - Message
+            //  - Editable zone
+            objs = new Object[2];
+
+            objs[0] = messageScrollPane;
+
+            // Search the max number of objects in a line
+            int curNumber = 0;
+            int numberOfLines = 0;
+            int numberOfColumns = 0;
+            List<Integer> buttonsPerLines = new ArrayList<Integer>();
+            for (int itemIndex = 0; itemIndex < lineLabels.length; itemIndex++) {
+                if (!lineLabels[itemIndex].equals(SEPARATOR)) {
+                    curNumber++;
                 } else {
-                        if (messageIcon == null) {
-                                messageIcon = scilabIcon;
-                        }
-                        setContentPane(new JOptionPane(objs, messageType, JOptionPane.CANCEL_OPTION, messageIcon, buttons));
+                    if (curNumber > numberOfColumns) {
+                        numberOfColumns = curNumber;
+                    }
+                    // Store informations of current line
+                    buttonsPerLines.add(curNumber);
+                    curNumber = 0;
+                    numberOfLines++;
                 }
-                pack();
-                super.setModal(modal); /* Must call the JDialog class setModal */
+            }
+            // Store information of last line
+            // Because no separator after last line items
+            buttonsPerLines.add(curNumber);
+            numberOfLines++;
+
+            // Create the panel with button groups
+            JPanel panel = new JPanel(new GridBagLayout());
+            GridBagConstraints gbc = new GridBagConstraints();
+            gbc.gridx = 0;
+            gbc.gridy = 0;
+            gbc.fill = GridBagConstraints.HORIZONTAL;
+            buttonGroups = new ButtonGroup[numberOfLines];
+
+            // Initialize return value
+            userSelectedButtons = new int[numberOfLines];
+
+            int curItemIndex = 0;
+            int lineNumber = 0;
+            int buttonNumber = 0;
+            for (curItemIndex = 0; curItemIndex < lineLabels.length; curItemIndex++) {
+                // Add the label of the line
+                gbc.weightx = 1; // Labels will use remaining space when resizing
+                panel.add(new JLabel(lineLabels[curItemIndex]), gbc);
+                gbc.gridx++; // Increment the column index
+
+                buttonNumber = 0;
+                curItemIndex++;
+
+                // Add the button group
+                ButtonGroup group = new ButtonGroup();
+                while (curItemIndex < lineLabels.length &&  !lineLabels[curItemIndex].equals(SEPARATOR)) {
+                    // Add a toggle button
+                    JToggleButton button = new JToggleButton(lineLabels[curItemIndex]);
+                    buttonNumber++;
+
+                    // Select this button if default
+                    if (buttonNumber == defaultSelectedButtons[lineNumber]) {
+                        button.setSelected(true);
+                    }
+                    // Select this button if default selection is a non existing button
+                    // And this button is the last of the line
+                    if (buttonNumber == (buttonsPerLines.get(lineNumber) - 1)
+                        && defaultSelectedButtons[lineNumber] > (buttonsPerLines.get(lineNumber) - 1)) {
+                        button.setSelected(true);
+                    }
+                    // Add the button to the group (for toggle)
+                    // And to the panel (for display)
+                    group.add(button);
+                    gbc.weightx = 0; // Button size will not change when resizing
+                    panel.add(button, gbc);
+                    gbc.gridx++; // Increment the column index
+
+                    // Increment item index
+                    curItemIndex++;
 
-                if (parentWindow == null) {
-                        if (ScilabConsole.isExistingConsole()) {
-                                setLocationRelativeTo((Component) ScilabConsole.getConsole().getAsSimpleConsole());
-                        }
-                } else {
-                        setLocationRelativeTo(parentWindow);
                 }
-
-                ScilabSwingUtilities.closeOnEscape(this);
-
-                setVisible(true);
-                doLayout();
-
-                // If the dialog is not modal and Scilab waits for an answer, have to wait...
-                if (!modal && scilabDialogType != X_MESSAGE_TYPE) {
-                        synchronized (btnOK) {
-                                try {
-                                        btnOK.wait();
-                                } catch (InterruptedException e) {
-                                        e.printStackTrace();
-                                }
-                        }
+                // Add empty labels if number of buttons in the line is lesser than maximum number of buttons found in a line
+                for (int emptyLabelsIndex = buttonsPerLines.get(lineNumber); emptyLabelsIndex < numberOfColumns; emptyLabelsIndex++) {
+                    panel.add(new JLabel(), gbc);
+                    gbc.gridx++; // Increment the column index
                 }
-        }
 
-        /**
-         * Action management
-         * @param ae the action event
-         * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
-         */
-
-        public void actionPerformed(ActionEvent ae) {
-                if (ae.getSource() == btnOK) {
-                        // For a x_dialog, get the user answer
-                        if (scilabDialogType == X_DIALOG_TYPE) {
-                                userValue = textArea.getText();
-                        } else if (scilabDialogType == X_MDIALOG_TYPE) {
-                                for (int textFieldIndex = 0; textFieldIndex < textFields.length; textFieldIndex++) {
-                                        userValues[textFieldIndex] = textFields[textFieldIndex].getText();
-                                }
-                                userValue = ""; /* To make getValueSize return a non zero value */
-                        } else if (scilabDialogType == X_CHOICES_TYPE) {
-
-                                // Get the selected button index of each button group
-                                for (int groupNum = 0; groupNum < buttonGroups.length; groupNum++) {
-                                        Enumeration<AbstractButton> theButtons = buttonGroups[groupNum].getElements();
-                                        for (int btnNum = 0; btnNum < buttonGroups[groupNum].getButtonCount(); btnNum++) {
-                                    JToggleButton b = (JToggleButton) theButtons.nextElement();
-                                    if (b.getModel() == buttonGroups[groupNum].getSelection()) {
-                                        userSelectedButtons[groupNum] = btnNum + 1;
-                                    }
-                                }
-                            }
-                                userValue = ""; /* To make getValueSize return a non zero value */
-                        }
-                        selectedButton = 1;
-                } else if (ae.getSource() == btnCancel) {
-                        selectedButton = 2;
-                } else if (buttonsLabels != null) { // User defined buttons
-                        for (int index = 0; index < buttonsLabels.length; index++) {
-                                if (((JButton) ae.getSource()).getText().equals(buttonsLabels[index])) {
-                                        selectedButton = index + 1;
-                                        break;
-                                }
-                        }
+                // Store the group to get the user selection when returning
+                buttonGroups[lineNumber] = group;
+
+                // Increment current line number
+                lineNumber++;
+                gbc.gridx = 0; // New line --> Back to first column
+                gbc.gridy++; // Increment the row index
+            }
+
+            // Display the panel
+            panel.doLayout();
+
+            // Editable text zone
+            JScrollPane scrollPane = new JScrollPane(panel);
+
+            scrollWidth = (int) Math.min(WINDOW_WIDTH, panel.getPreferredSize().getWidth() + OFFSET);
+            scrollHeight = (int) Math.min(LISTBOX_HEIGHT, panel.getPreferredSize().getHeight() + OFFSET);
+            scrollPane.setPreferredSize(new Dimension(scrollWidth, scrollHeight));
+
+            objs[1] = scrollPane;
+
+            // And now the buttons
+            buttons = new Object[2];
+            btnOK.addActionListener(this);
+            btnCancel.addActionListener(this);
+            /* Test added for bug 4347 fix */
+            if (isWindows()) {
+                buttons[0] = btnOK;
+                buttons[1] = btnCancel;
+
+            } else {
+                buttons[0] = btnCancel;
+                buttons[1] = btnOK;
+            }
+        } else if (scilabDialogType == X_MDIALOG_TYPE) {
+            // Create a MessageBox for Scilab x_mdialog
+
+            // All objects in the MessageBox:
+            //  - Message
+            //  - Editable zone
+            objs = new Object[2];
+
+            objs[0] = messageScrollPane;
+
+            int numberOfColumns = 0;
+            if (columnLabels == null) {
+                numberOfColumns = 2;
+            } else {
+                numberOfColumns = columnLabels.length + 1;
+            }
+            GridBagLayout layout = new GridBagLayout();
+            JPanel panel = new JPanel(layout);
+            GridBagConstraints constraints = new GridBagConstraints();
+            constraints.gridx = 0;
+            constraints.gridy = 0;
+            constraints.fill = GridBagConstraints.HORIZONTAL;
+            constraints.insets = new Insets(X_MDIALOG_MARGIN, X_MDIALOG_MARGIN, X_MDIALOG_MARGIN, X_MDIALOG_MARGIN);
+
+            int line = 0;
+            int col = 0;
+            // Optional first line
+            if (columnLabels != null) {
+                // Column label for "Row labels" column
+                panel.add(new JLabel(""), constraints);
+                constraints.gridx++;
+                for (col = 0; col < columnLabels.length; col++) {
+                    panel.add(new JLabel(columnLabels[col]), constraints);
+                    constraints.gridx++;
                 }
-                // Notify btnOK for not modal Dialogs
-                synchronized (btnOK) {
-                        btnOK.notify();
+                constraints.gridy++;
+            }
+
+
+            // Prepare return value
+            if (columnLabels == null) {
+                userValues = new String[lineLabels.length];
+                textFields = new JTextField[lineLabels.length];
+            } else {
+                userValues = new String[lineLabels.length * columnLabels.length];
+                textFields = new JTextField[lineLabels.length * columnLabels.length];
+            }
+            for (line = 0; line < lineLabels.length; line++) {
+                constraints.gridx = 0;
+                panel.add(new JLabel(lineLabels[line]), constraints);
+                constraints.gridx++;
+                for (col = 0; col < numberOfColumns - 1; col++) {
+                    textFields[col * lineLabels.length + line] = new JTextField(defaultInput[col * lineLabels.length + line]);
+                    panel.add(textFields[col * lineLabels.length + line], constraints);
+                    textFields[col * lineLabels.length + line].setColumns(X_MDIALOG_TEXTFIELD_SIZE);
+                    constraints.gridx++;
                 }
-                // Destroy the Dialog
-                dispose();
-        }
-        /**
-         * Get the index of the button clicked
-         * @return the index of the button clicked
-         */
-        public int getSelectedButton() {
-                return selectedButton;
-        }
-
-        /**
-         * Set the indices of the default selected buttons (x_choices)
-         * @param indices the indices of the default selected buttons
-         */
-        public void setDefaultSelectedButtons(int[] indices) {
-                defaultSelectedButtons = indices;
-                scilabDialogType = X_CHOICES_TYPE;
+                constraints.gridy++;
+            }
+
+            panel.doLayout();
+
+            // Editable text zone
+            JScrollPane scrollPane = new JScrollPane(panel);
+
+            scrollWidth = (int) Math.min(WINDOW_WIDTH, panel.getPreferredSize().getWidth() + OFFSET);
+            scrollHeight = (int) Math.min(LISTBOX_HEIGHT, panel.getPreferredSize().getHeight() + OFFSET);
+            scrollPane.setPreferredSize(new Dimension(scrollWidth, scrollHeight));
+
+            objs[1] = scrollPane;
+
+            // And now the buttons
+            buttons = new Object[2];
+            btnOK.addActionListener(this);
+            btnCancel.addActionListener(this);
+            /* Test added for bug 4347 fix */
+            if (isWindows()) {
+                buttons[0] = btnOK;
+                buttons[1] = btnCancel;
+
+            } else {
+                buttons[0] = btnCancel;
+                buttons[1] = btnOK;
+            }
+        } else if (scilabDialogType == X_CHOOSE_TYPE) {
+            // Create a MessageBox for Scilab x_choose
+
+            // All objects in the MessageBox:
+            //  - Message
+            //  - Listbox
+            objs = new Object[2];
+
+            // Add the message
+            objs[0] = messageScrollPane;
+
+            // Add the listBox
+            objs[1] = createXchooseListBox();
+
+            // And now the buttons
+            buttons = new Object[1];
+            if (buttonsLabels != null) {
+                btnCancel.setText(buttonsLabels[0]);
+            }
+            btnCancel.addActionListener(this);
+            buttons[0] = btnCancel;
+        } else if (scilabDialogType == X_DIALOG_TYPE) {
+            // Create a MessageBox for Scilab x_dialog
+
+            // All objects in the MessageBox:
+            //  - Message
+            //  - Editable zone
+            objs = new Object[2];
+
+            objs[0] = messageScrollPane;
+
+            // Editable text zone
+            textArea = new JTextArea(initialValue);
+            textArea.setRows(initialValueSize);
+            JScrollPane scrollPane = new JScrollPane(textArea);
+            scrollWidth = (int) Math.min(WINDOW_WIDTH, textArea.getPreferredSize().getWidth() + OFFSET);
+            scrollHeight = (int) Math.min(LISTBOX_HEIGHT, textArea.getPreferredSize().getHeight() + OFFSET);
+            scrollPane.setPreferredSize(new Dimension(scrollWidth, scrollHeight));
+
+            objs[1] = scrollPane;
+
+            // And now the buttons
+            buttons = new Object[2];
+            btnOK.addActionListener(this);
+            btnCancel.addActionListener(this);
+            /* Test added for bug 4347 fix */
+            if (isWindows()) {
+                buttons[0] = btnOK;
+                buttons[1] = btnCancel;
+
+            } else {
+                buttons[0] = btnCancel;
+                buttons[1] = btnOK;
+            }
+        } else {
+            // Create a MessageBox for Scilab x_message
+
+            // All objects in the MessageBox:
+            //  - Message
+            objs = new Object[1];
+
+            // Add the message
+            objs[0] = messageScrollPane;
+
+            // And now the buttons
+            if (buttonsLabels == null) {
+                buttons = new Object[1];
+                btnOK.addActionListener(this);
+                buttons[0] = btnOK;
+                //messageType = JOptionPane.INFORMATION_MESSAGE;
+            } else {
+                buttons = new Object[buttonsLabels.length];
+                for (int buttonNb = 0; buttonNb < buttonsLabels.length; buttonNb++) {
+                    JButton currentButton = new JButton(buttonsLabels[buttonNb]);
+                    currentButton.addActionListener(this);
+                    /* Test added for bug 4347 fix */
+                    if (isWindows()) {
+                        buttons[buttonNb] = currentButton;
+                    } else {
+                        buttons[buttonsLabels.length - buttonNb - 1] = currentButton;
+                    }
+                }
+            }
         }
-
-        /**
-         * Get the indices of the selected buttons (x_choices)
-         * @return the indices of the selected buttons
-         */
-        public int[] getUserSelectedButtons() {
-                return userSelectedButtons;
+        // Display
+        ((JScrollPane) objs[0]).setBorder(BorderFactory.createEmptyBorder());
+        if (messageType != -1) {
+            setContentPane(new JOptionPane(objs, messageType, JOptionPane.CANCEL_OPTION, null, buttons));
+        } else {
+            if (messageIcon == null) {
+                messageIcon = scilabIcon;
+            }
+            setContentPane(new JOptionPane(objs, messageType, JOptionPane.CANCEL_OPTION, messageIcon, buttons));
         }
-
-        /**
-         * Set the labels of the buttons in the MessageBox
-         * @param labels the labels of the buttons
-         */
-        public void setButtonsLabels(String[] labels) {
-                buttonsLabels = labels;
+        pack();
+        super.setModal(modal); /* Must call the JDialog class setModal */
+
+        if (parentWindow == null) {
+            if (ScilabConsole.isExistingConsole()) {
+                setLocationRelativeTo((Component) ScilabConsole.getConsole().getAsSimpleConsole());
+            }
+        } else {
+            setLocationRelativeTo(parentWindow);
         }
 
-        /**
-         * Set the initial values of the editable zone in the MessageBox
-         * @param value the initial values
-         */
-        public void setInitialValue(String[] value) {
-                int line = 0;
-                initialValue = "";
-                for (line = 0; line < value.length - 1; line++) {
-                        initialValue += value[line] + NEW_LINE;
-                }
-                initialValue += value[line];
-                initialValueSize = value.length;
+        ScilabSwingUtilities.closeOnEscape(this);
 
-                scilabDialogType = X_DIALOG_TYPE;
-        }
+        setVisible(true);
+        doLayout();
 
-        /**
-         * Get the value of the editable zone in the MessageBox
-         * @return the value
-         */
-        public String[] getValue() {
-                if (scilabDialogType == X_MDIALOG_TYPE) {
-                        return userValues;
-                } else {
-                        return userValue.split(NEW_LINE);
+        // If the dialog is not modal and Scilab waits for an answer, have to wait...
+        if (!modal && scilabDialogType != X_MESSAGE_TYPE) {
+            synchronized (btnOK) {
+                try {
+                    btnOK.wait();
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
                 }
+            }
         }
-
-        /**
-         * Get the size of the value of the editable zone in the MessageBox
-         * @return the value size
-         */
-        public int getValueSize() {
-                if (userValue == null) {
-                        return 0;
-                } else {
-                        return userValue.split(NEW_LINE).length;
+    }
+
+    /**
+     * Action management
+     * @param ae the action event
+     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+     */
+
+    public void actionPerformed(ActionEvent ae) {
+        if (ae.getSource() == btnOK) {
+            // For a x_dialog, get the user answer
+            if (scilabDialogType == X_DIALOG_TYPE) {
+                userValue = textArea.getText();
+            } else if (scilabDialogType == X_MDIALOG_TYPE) {
+                for (int textFieldIndex = 0; textFieldIndex < textFields.length; textFieldIndex++) {
+                    userValues[textFieldIndex] = textFields[textFieldIndex].getText();
                 }
-        }
-
-        /**
-         * Set the items of the listbox in the MessageBox
-         * @param items the items to set
-         */
-        public void setListBoxItems(String[] items) {
-                listboxItems = items;
-
-                scilabDialogType = X_CHOOSE_TYPE;
-        }
-
-        /**
-         * Get the index of the selected item in the listbox in the MessageBox
-         * @return the index
-         */
-        public int getSelectedItem() {
-                return selectedItem;
-        }
-
-        /**
-         * Create the listbox to be displayed in a x_choose dialog
-         * @return the scrollpane containing the listbox
-         */
-        private JScrollPane createXchooseListBox() {
-                // Add the ListBox
-                listBox = new JList();
-                listBox.setLayoutOrientation(JList.VERTICAL);
-                listBox.setModel(new DefaultListModel());
-                listBox.addMouseListener(new MouseListener() {
-
-                        public void mouseClicked(MouseEvent arg0) {
-                                if (arg0.getClickCount() == 2) {
-                                        selectedItem = listBox.getSelectedIndex() + 1;
-                                        // Notify btnOK for not modal Dialogs
-                                        synchronized (btnOK) {
-                                                btnOK.notify();
-                                        }
-                                        dispose();
-                                }
-                        }
-
-                        public void mouseEntered(MouseEvent arg0) {
+                userValue = ""; /* To make getValueSize return a non zero value */
+            } else if (scilabDialogType == X_CHOICES_TYPE) {
+
+                // Get the selected button index of each button group
+                for (int groupNum = 0; groupNum < buttonGroups.length; groupNum++) {
+                    Enumeration<AbstractButton> theButtons = buttonGroups[groupNum].getElements();
+                    for (int btnNum = 0; btnNum < buttonGroups[groupNum].getButtonCount(); btnNum++) {
+                        JToggleButton b = (JToggleButton) theButtons.nextElement();
+                        if (b.getModel() == buttonGroups[groupNum].getSelection()) {
+                            userSelectedButtons[groupNum] = btnNum + 1;
                         }
-
-                        public void mouseExited(MouseEvent arg0) {
-                        }
-
-                        public void mousePressed(MouseEvent arg0) {
-                        }
-
-                        public void mouseReleased(MouseEvent arg0) {
-                        }
-
-                });
-                ((DefaultListModel) listBox.getModel()).clear();
-                for (int i = 0; i < listboxItems.length; i++) {
-                        ((DefaultListModel) listBox.getModel()).addElement(listboxItems[i]);
+                    }
                 }
-                listBox.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-                JScrollPane scrollPane = new JScrollPane(listBox);
-                int scrollWidth = (int) Math.min(WINDOW_WIDTH, listBox.getPreferredSize().getWidth() + OFFSET);
-                int scrollHeight = LISTBOX_HEIGHT;
-                scrollPane.setPreferredSize(new Dimension(scrollWidth, scrollHeight));
-                return  scrollPane;
+                userValue = ""; /* To make getValueSize return a non zero value */
+            }
+            selectedButton = 1;
+        } else if (ae.getSource() == btnCancel) {
+            selectedButton = 2;
+        } else if (buttonsLabels != null) { // User defined buttons
+            for (int index = 0; index < buttonsLabels.length; index++) {
+                if (((JButton) ae.getSource()).getText().equals(buttonsLabels[index])) {
+                    selectedButton = index + 1;
+                    break;
+                }
+            }
         }
-
-        /**
-         * Set the name of the lines labels in the editable zone in the MessageBox
-         * @param labels the labels
-         */
-        public void setLineLabels(String[] labels) {
-                scilabDialogType = X_MDIALOG_TYPE;
-                lineLabels = labels;
+        // Notify btnOK for not modal Dialogs
+        synchronized (btnOK) {
+            btnOK.notify();
         }
-
-        /**
-         * Set the name of the columns labels in the editable zone in the MessageBox
-         * @param labels the labels
-         */
-        public void setColumnLabels(String[] labels) {
-                columnLabels = labels;
+        // Destroy the Dialog
+        dispose();
+    }
+    /**
+     * Get the index of the button clicked
+     * @return the index of the button clicked
+     */
+    public int getSelectedButton() {
+        return selectedButton;
+    }
+
+    /**
+     * Set the indices of the default selected buttons (x_choices)
+     * @param indices the indices of the default selected buttons
+     */
+    public void setDefaultSelectedButtons(int[] indices) {
+        defaultSelectedButtons = indices;
+        scilabDialogType = X_CHOICES_TYPE;
+    }
+
+    /**
+     * Get the indices of the selected buttons (x_choices)
+     * @return the indices of the selected buttons
+     */
+    public int[] getUserSelectedButtons() {
+        return userSelectedButtons;
+    }
+
+    /**
+     * Set the labels of the buttons in the MessageBox
+     * @param labels the labels of the buttons
+     */
+    public void setButtonsLabels(String[] labels) {
+        buttonsLabels = labels;
+    }
+
+    /**
+     * Set the initial values of the editable zone in the MessageBox
+     * @param value the initial values
+     */
+    public void setInitialValue(String[] value) {
+        int line = 0;
+        initialValue = "";
+        for (line = 0; line < value.length - 1; line++) {
+            initialValue += value[line] + NEW_LINE;
         }
-
-        /**
-         * Set the default values of a multi-value editable zone in the MessageBox
-         * @param values the values
-         */
-        public void setDefaultInput(String[] values) {
-                defaultInput = values;
+        initialValue += value[line];
+        initialValueSize = value.length;
+
+        scilabDialogType = X_DIALOG_TYPE;
+    }
+
+    /**
+     * Get the value of the editable zone in the MessageBox
+     * @return the value
+     */
+    public String[] getValue() {
+        if (scilabDialogType == X_MDIALOG_TYPE) {
+            return userValues;
+        } else {
+            return userValue.split(NEW_LINE);
         }
-
-        /**
-         * Set a MessageBox modal or not
-         * @param status true to set the MessageBox modal and false else
-         */
-        public void setModal(boolean status) {
-                modal = status;
+    }
+
+    /**
+     * Get the size of the value of the editable zone in the MessageBox
+     * @return the value size
+     */
+    public int getValueSize() {
+        if (userValue == null) {
+            return 0;
+        } else {
+            return userValue.split(NEW_LINE).length;
         }
+    }
+
+    /**
+     * Set the items of the listbox in the MessageBox
+     * @param items the items to set
+     */
+    public void setListBoxItems(String[] items) {
+        listboxItems = items;
+
+        scilabDialogType = X_CHOOSE_TYPE;
+    }
+
+    /**
+     * Get the index of the selected item in the listbox in the MessageBox
+     * @return the index
+     */
+    public int getSelectedItem() {
+        return selectedItem;
+    }
+
+    /**
+     * Create the listbox to be displayed in a x_choose dialog
+     * @return the scrollpane containing the listbox
+     */
+    private JScrollPane createXchooseListBox() {
+        // Add the ListBox
+        listBox = new JList();
+        listBox.setLayoutOrientation(JList.VERTICAL);
+        listBox.setModel(new DefaultListModel());
+        listBox.addMouseListener(new MouseListener() {
+
+                public void mouseClicked(MouseEvent arg0) {
+                    if (arg0.getClickCount() == 2) {
+                        selectedItem = listBox.getSelectedIndex() + 1;
+                        // Notify btnOK for not modal Dialogs
+                        synchronized (btnOK) {
+                            btnOK.notify();
+                        }
+                        dispose();
+                    }
+                }
 
-
-        /**
-         * Set the MessageBox icon
-         * @param name the name of the icon
-         */
-        public void setIcon(String name) {
-                if (name.equals("error")) {
-                        messageType = JOptionPane.ERROR_MESSAGE;
-                } else if (name.equals("hourglass")) {
-                        messageIcon = hourglassIcon;
-                } else if (name.equals("info")) {
-                        messageType = JOptionPane.INFORMATION_MESSAGE;
-                } else if (name.equals("passwd")) {
-                        messageIcon = passwdIcon;
-                } else if (name.equals("question")) {
-                        messageType = JOptionPane.QUESTION_MESSAGE;
-                } else if (name.equals("warning")) {
-                        messageType = JOptionPane.WARNING_MESSAGE;
-                } else {
-                        messageIcon = scilabIcon;
+                public void mouseEntered(MouseEvent arg0) {
                 }
-        }
 
-        private boolean isWindows() {
-                return System.getProperty("os.name").toLowerCase().contains("windows");
-        }
+                public void mouseExited(MouseEvent arg0) {
+                }
 
-        /**
-         * Set the component used to set the location of the MessageBox (default is Scilab Console)
-         * @param parent
-         */
-        public void setParentForLocation(Tab parent) {
-                if (parent != null) {
-                        parentWindow = (Component) parent.getAsSimpleTab();
-                } else {
-                        parentWindow = null;
+                public void mousePressed(MouseEvent arg0) {
                 }
-        }
 
+                public void mouseReleased(MouseEvent arg0) {
+                }
 
+            });
+        ((DefaultListModel) listBox.getModel()).clear();
+        for (int i = 0; i < listboxItems.length; i++) {
+            ((DefaultListModel) listBox.getModel()).addElement(listboxItems[i]);
+        }
+        listBox.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        JScrollPane scrollPane = new JScrollPane(listBox);
+        int scrollWidth = (int) Math.min(WINDOW_WIDTH, listBox.getPreferredSize().getWidth() + OFFSET);
+        int scrollHeight = LISTBOX_HEIGHT;
+        scrollPane.setPreferredSize(new Dimension(scrollWidth, scrollHeight));
+        return  scrollPane;
+    }
+
+    /**
+     * Set the name of the lines labels in the editable zone in the MessageBox
+     * @param labels the labels
+     */
+    public void setLineLabels(String[] labels) {
+        scilabDialogType = X_MDIALOG_TYPE;
+        lineLabels = labels;
+    }
+
+    /**
+     * Set the name of the columns labels in the editable zone in the MessageBox
+     * @param labels the labels
+     */
+    public void setColumnLabels(String[] labels) {
+        columnLabels = labels;
+    }
+
+    /**
+     * Set the default values of a multi-value editable zone in the MessageBox
+     * @param values the values
+     */
+    public void setDefaultInput(String[] values) {
+        defaultInput = values;
+    }
+
+    /**
+     * Set a MessageBox modal or not
+     * @param status true to set the MessageBox modal and false else
+     */
+    public void setModal(boolean status) {
+        modal = status;
+    }
+
+
+    /**
+     * Set the MessageBox icon
+     * @param name the name of the icon
+     */
+    public void setIcon(String name) {
+        if (name.equals("error")) {
+            messageType = JOptionPane.ERROR_MESSAGE;
+        } else if (name.equals("hourglass")) {
+            messageIcon = hourglassIcon;
+        } else if (name.equals("info")) {
+            messageType = JOptionPane.INFORMATION_MESSAGE;
+        } else if (name.equals("passwd")) {
+            messageIcon = passwdIcon;
+        } else if (name.equals("question")) {
+            messageType = JOptionPane.QUESTION_MESSAGE;
+        } else if (name.equals("warning")) {
+            messageType = JOptionPane.WARNING_MESSAGE;
+        } else {
+            messageIcon = scilabIcon;
+        }
+    }
+
+    private boolean isWindows() {
+        return System.getProperty("os.name").toLowerCase().contains("windows");
+    }
+
+    /**
+     * Set the component used to set the location of the MessageBox (default is Scilab Console)
+     * @param parent
+     */
+    public void setParentForLocation(Component parent) {
+        parentWindow = parent;
+    }
+
+    /**
+     * Set the component used to set the location of the MessageBox (default is Scilab Console)
+     * @param parent
+     */
+    public void setParentForLocation(Tab parent) {
+        setParentForLocation((Component) parent.getAsSimpleTab());
+    }
 }
index b96ad41..5d2bee4 100644 (file)
@@ -24,7 +24,9 @@ import java.awt.Point;
 import java.awt.event.FocusEvent;
 import java.awt.event.FocusListener;
 import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 import javax.swing.Action;
 import javax.swing.ImageIcon;
@@ -35,7 +37,9 @@ import org.flexdock.docking.DockingPort;
 import org.flexdock.docking.event.DockingEvent;
 import org.flexdock.docking.activation.ActiveDockableTracker;
 import org.flexdock.docking.props.PropertyChangeListenerFactory;
+import org.flexdock.view.Titlebar;
 import org.flexdock.view.View;
+
 import org.scilab.modules.gui.bridge.canvas.SwingScilabCanvasImpl;
 import org.scilab.modules.gui.bridge.checkbox.SwingScilabCheckBox;
 import org.scilab.modules.gui.bridge.console.SwingScilabConsole;
@@ -66,6 +70,7 @@ import org.scilab.modules.gui.pushbutton.PushButton;
 import org.scilab.modules.gui.radiobutton.RadioButton;
 import org.scilab.modules.gui.slider.Slider;
 import org.scilab.modules.gui.tab.SimpleTab;
+import org.scilab.modules.gui.tab.Tab;
 import org.scilab.modules.gui.textbox.TextBox;
 import org.scilab.modules.gui.toolbar.ToolBar;
 import org.scilab.modules.gui.tree.Tree;
@@ -74,6 +79,7 @@ import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.SciUndockingAction;
 import org.scilab.modules.gui.utils.SciClosingAction;
 import org.scilab.modules.gui.utils.Size;
+import org.scilab.modules.gui.utils.WindowsConfigurationManager;
 
 /**
  * Swing implementation for Scilab tabs in GUIs
@@ -98,11 +104,9 @@ public class SwingScilabTab extends View implements SimpleTab, FocusListener {
     }
 
     private int parentWindowId;
-
+    private String appNameOnClose;
     private MenuBar menuBar;
-
     private ToolBar toolBar;
-
     private TextBox infoBar;
 
     /** Contains the canvas and widgets */
@@ -115,10 +119,11 @@ public class SwingScilabTab extends View implements SimpleTab, FocusListener {
 
     /**
      * Constructor
-     * @param name the name of the tab (used to identify it)
+     * @param name the name of the tab
+     * @param uuid an uuid to identify the tab
      */
-    public SwingScilabTab(String name) {
-        super(name, name, name);
+    public SwingScilabTab(String name, String uuid) {
+        super(uuid, name, name);
         //This button is "overloaded" when we add a callback
         //this.addAction(DockingConstants.CLOSE_ACTION);
         // Removed because make JOGL crash when "Unpin"
@@ -133,12 +138,64 @@ public class SwingScilabTab extends View implements SimpleTab, FocusListener {
 
         getTitlebar().addFocusListener(this);
         addFocusListener(this);
+       setCallback(null);
+    }
+
+    /**
+     * Create a graphic tab used to display a figure with 3D graphics and/or UIcontrols
+     * @param name name of the tab
+     * @param figureId id of the displayed figure
+     */
+    public SwingScilabTab(String name, int figureId) {
+        super(name, name, name);
+
+        // This button is "overloaded" when we add a callback
+        //this.addAction(DockingConstants.CLOSE_ACTION);
+        // Removed because make JOGL crash when "Unpin"
+        //this.addAction(DockingConstants.PIN_ACTION);
+        this.addAction(DockingConstants.ACTIVE_WINDOW);
+
+        // create the panel in which all the uiobjects will lie.
+        contentPane = new SwingScilabAxes(figureId);
+
+        // add it inside a JSCrollPane
+        scrolling = new SwingScilabScrollPane(contentPane);
+
+        // put in in the back of the tab
+        setContentPane(scrolling.getAsContainer());
+
+        this.setVisible(true);
+
+        getTitlebar().addFocusListener(this);
+        addFocusListener(this);
+       setCallback(null);
+    }
+
+    /**
+     * Constructor
+     * @param name the name of the tab (used to identify it)
+     */
+    public SwingScilabTab(String name) {
+        this(name, name);
+    }
+
+    public static void removeActions(SwingScilabTab tab) {
+       tab.setActionBlocked(DockingConstants.CLOSE_ACTION, true);
+       tab.setActionBlocked(UNDOCK, true);
+       tab.getTitlebar().revalidate();
+    }
+
+    public static void addActions(SwingScilabTab tab) {
+       tab.setActionBlocked(DockingConstants.CLOSE_ACTION, false);
+       tab.setActionBlocked(UNDOCK, false);
+       tab.getTitlebar().revalidate();
     }
 
     /**
      * @param e the FocusEvent
      */
     public void focusGained(FocusEvent e) {
+       //ActiveDockableTracker.requestDockableActivation(this);
         if (contentPane != null) {
             contentPane.requestFocus();
         } else if (getContentPane() != null) {
@@ -149,10 +206,15 @@ public class SwingScilabTab extends View implements SimpleTab, FocusListener {
     }
 
     /**
+     * Call when the tab restoration is ended.
+     */
+    public void endedRestoration() { }
+
+    /**
      * @return the window icon associated with this tab
      */
     public Image getWindowIcon() {
-        if (icon ==null) {
+        if (icon == null) {
             return SCILAB_ICON;
         } else {
             return icon;
@@ -172,35 +234,6 @@ public class SwingScilabTab extends View implements SimpleTab, FocusListener {
     public void focusLost(FocusEvent e) { }
 
     /**
-     * Create a graphic tab used to display a figure with 3D graphics and/or UIcontrols
-     * @param name name of the tab
-     * @param figureId id of the displayed figure
-     */
-    public SwingScilabTab(String name, int figureId) {
-        super(name, name, name);
-
-        // This button is "overloaded" when we add a callback
-        //this.addAction(DockingConstants.CLOSE_ACTION);
-        // Removed because make JOGL crash when "Unpin"
-        //this.addAction(DockingConstants.PIN_ACTION);
-        this.addAction(DockingConstants.ACTIVE_WINDOW);
-
-        // create the panel in which all the uiobjects will lie.
-        contentPane = new SwingScilabAxes(figureId);
-
-        // add it inside a JSCrollPane
-        scrolling = new SwingScilabScrollPane(contentPane);
-
-        // put in in the back of the tab
-        setContentPane(scrolling.getAsContainer());
-
-        this.setVisible(true);
-
-        getTitlebar().addFocusListener(this);
-        addFocusListener(this);
-    }
-
-    /**
      * {@inheritDoc}
      */
     public void dockingComplete(DockingEvent evt) {
@@ -211,15 +244,13 @@ public class SwingScilabTab extends View implements SimpleTab, FocusListener {
         if (port.getDockables().size() > 1) {
             while (iter.hasNext()) {
                 Object d = iter.next();
-                if (d instanceof View) {
-                    View view = (View) d;
-                    view.setActionBlocked(DockingConstants.CLOSE_ACTION, false);
-                    view.setActionBlocked(UNDOCK, false);
+                if (d instanceof SwingScilabTab) {
+                    SwingScilabTab view = (SwingScilabTab) d;
+                    addActions(view);
                 }
             }
         } else {
-            setActionBlocked(UNDOCK, true);
-            setActionBlocked(DockingConstants.CLOSE_ACTION, true);
+           removeActions(this);
         }
     }
 
@@ -230,12 +261,18 @@ public class SwingScilabTab extends View implements SimpleTab, FocusListener {
      */
     public void setName(String newTabName) {
         setTitle(newTabName, true);
-
         getTitlePane().repaint();
         SwingUtilities.getAncestorOfClass(SwingScilabWindow.class, this).setName(newTabName);
     }
 
     /**
+     * @return the UUID of the parent window
+     */
+    public String getParentWindowUUID() {
+        return ((SwingScilabWindow) SwingUtilities.getAncestorOfClass(SwingScilabWindow.class, this)).getUUID();
+    }
+
+    /**
      * Gets the title of a swing Scilab tab
      * @return the title of the tab
      * @see org.scilab.modules.gui.tab.Tab#getTitle()
@@ -752,7 +789,6 @@ public class SwingScilabTab extends View implements SimpleTab, FocusListener {
         return contentPane.addWidget(member.getAsComponent());
     }
 
-
     /**
      * Add a Tree member (dockable element) to container and returns its index
      * @param member the member to add
@@ -779,9 +815,6 @@ public class SwingScilabTab extends View implements SimpleTab, FocusListener {
         contentPane.removeTree(member);
     }
 
-
-
-
     /**
      * Add a member (dockable element) to container and returns its index
      * @param member the member to add
@@ -879,17 +912,18 @@ public class SwingScilabTab extends View implements SimpleTab, FocusListener {
         if (callback != null) {
             action = new SciClosingAction(this, callback);
         } else {
-            this.addAction(DockingConstants.CLOSE_ACTION);
-            action = new SciClosingAction(this, this.getTitlebar().getAction(DockingConstants.CLOSE_ACTION));
+            action = new SciClosingAction(this);
         }
 
         action.putValue(Action.NAME, DockingConstants.CLOSE_ACTION);
-        this.addAction(action);
+       ((Titlebar) getTitlePane()).removeAction(DockingConstants.CLOSE_ACTION);
+        addAction(action);
 
         /* Undock button */
         SciUndockingAction undockAction = new SciUndockingAction(this);
         undockAction.putValue(Action.NAME, UNDOCK);
-        this.addAction(undockAction);
+       ((Titlebar) getTitlePane()).removeAction(UNDOCK);
+        addAction(undockAction);
     }
 
     /**
@@ -1038,12 +1072,12 @@ public class SwingScilabTab extends View implements SimpleTab, FocusListener {
      * Close the tab and disable it.
      */
     public void close() {
-        this.getContentPane().removeAll();
-        this.setMenuBar(null);
-        this.setToolBar(null);
-        this.setInfoBar(null);
-        this.setTitlebar(null);
-        this.removeAll();
+        getContentPane().removeAll();
+        setMenuBar(null);
+        setToolBar(null);
+        setInfoBar(null);
+        setTitlebar(null);
+        removeAll();
         setActive(false);
 
         scrolling = null;
index 8906183..7c46139 100644 (file)
 package org.scilab.modules.gui.bridge.window;
 
 import java.awt.Dimension;
+import java.awt.Point;
 import java.awt.Frame;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
 import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
+import java.util.UUID;
 
 import javax.swing.ImageIcon;
 import javax.swing.JComponent;
 import javax.swing.JFrame;
+import javax.swing.JSplitPane;
 import javax.swing.SwingUtilities;
 import javax.swing.WindowConstants;
 
@@ -35,8 +40,10 @@ import org.flexdock.docking.Dockable;
 import org.flexdock.docking.DockingConstants;
 import org.flexdock.docking.DockingManager;
 import org.flexdock.docking.DockingPort;
+import org.flexdock.docking.DockingStrategy;
 import org.flexdock.docking.activation.ActiveDockableTracker;
 import org.flexdock.docking.defaults.DefaultDockingPort;
+import org.flexdock.docking.defaults.DefaultDockingStrategy;
 import org.flexdock.view.View;
 import org.scilab.modules.action_binding.InterpreterManagement;
 import org.scilab.modules.commons.gui.ScilabKeyStroke;
@@ -51,10 +58,12 @@ import org.scilab.modules.gui.textbox.SimpleTextBox;
 import org.scilab.modules.gui.textbox.TextBox;
 import org.scilab.modules.gui.toolbar.SimpleToolBar;
 import org.scilab.modules.gui.toolbar.ToolBar;
+import org.scilab.modules.gui.utils.ClosingOperationsManager;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.SciDockingListener;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.utils.UIElementMapper;
+import org.scilab.modules.gui.utils.WindowsConfigurationManager;
 import org.scilab.modules.gui.window.SimpleWindow;
 import org.scilab.modules.renderer.utils.RenderingCapabilities;
 
@@ -74,20 +83,25 @@ public class SwingScilabWindow extends JFrame implements SimpleWindow {
     private static final int DEFAULTWIDTH = 500;
     private static final int DEFAULTHEIGHT = 500;
 
+    static {
+        DefaultDockingStrategy.setDefaultResizeWeight(0.5);
+    }
+
     private DefaultDockingPort sciDockingPort;
     private SciDockingListener sciDockingListener;
     private SimpleMenuBar menuBar;
     private SimpleToolBar toolBar;
     private SimpleTextBox infoBar;
-
+    private String uuid;
     private int elementId; // the id of the Window which contains this SimpleWindow
-    boolean MAC_OS_X = (System.getProperty("os.name").toLowerCase().startsWith("mac os x"));
+    private boolean MAC_OS_X = (System.getProperty("os.name").toLowerCase().startsWith("mac os x"));
 
     /**
      * Constructor
      */
     public SwingScilabWindow() {
         super();
+        this.uuid = UUID.randomUUID().toString();
 
         setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
 
@@ -122,6 +136,7 @@ public class SwingScilabWindow extends JFrame implements SimpleWindow {
 
         sciDockingListener = new SciDockingListener();
         sciDockingPort.addDockingListener(sciDockingListener);
+
         /*
          * Prevent the background RootPane to catch Focus.
          * Causes trouble with Scicos use xclick & co.
@@ -133,15 +148,7 @@ public class SwingScilabWindow extends JFrame implements SimpleWindow {
 
         addWindowListener(new WindowAdapter() {
                 public void windowClosing(WindowEvent e) {
-                    Object[] dockArray = sciDockingPort.getDockables().toArray();
-                    for (int i = 0; i < dockArray.length; i++) {
-                        ((View) dockArray[i]).getActionButton(DockingConstants.CLOSE_ACTION).getAction().actionPerformed(null);
-                    }
-
-                    //if dock stay open, do not close main window
-                    if(dockArray.length == 0){
-                        removeWindowListener(this);
-                    }
+                    ClosingOperationsManager.startClosingOperation(SwingScilabWindow.this);
                 }
             });
 
@@ -179,7 +186,19 @@ public class SwingScilabWindow extends JFrame implements SimpleWindow {
         InterpreterManagement.requestScilabExec("exit()");
     }
 
+    /**
+     * @return the UUID associated with this window
+     */
+    public String getUUID() {
+        return uuid;
+    }
 
+    /**
+     * @param uuid the UUID associated with this window
+     */
+    public void setUUID(String uuid) {
+        this.uuid = uuid;
+    }
 
     /**
      * Creates a swing Scilab window
@@ -218,7 +237,7 @@ public class SwingScilabWindow extends JFrame implements SimpleWindow {
     public void raise() {
         // blocking call. So graphic synchronization must be desactivated here.
         if (!SwingUtilities.isEventDispatchThread()) {
-        /* javasci bug: See bug 9544 why we are doing this check */
+            /* javasci bug: See bug 9544 why we are doing this check */
             try {
                 SwingUtilities.invokeAndWait(new Runnable() {
                         public void run() {
@@ -250,7 +269,6 @@ public class SwingScilabWindow extends JFrame implements SimpleWindow {
      * @see org.scilab.modules.gui.UIElement#setDims(org.scilab.modules.gui.utils.Size)
      */
     public void setDims(Size newWindowSize) {
-
         // get the greatest size we can use
         int[] maxSize = RenderingCapabilities.getMaxWindowSize();
 
@@ -337,10 +355,12 @@ public class SwingScilabWindow extends JFrame implements SimpleWindow {
      * @param tab the Scilab tab to remove from the Scilab window
      * @see org.scilab.modules.gui.window.Window#removeTab(org.scilab.modules.gui.tab.Tab)
      */
-    public void removeTab(Tab tab) {
-        DockingManager.close(((SwingScilabTab) tab.getAsSimpleTab()));
-        DockingManager.unregisterDockable((Dockable) ((SwingScilabTab) tab.getAsSimpleTab()));
-        ((SwingScilabTab) tab.getAsSimpleTab()).close();
+    public void removeTabs(SwingScilabTab[] tabs) {
+        for (SwingScilabTab tab : tabs) {
+            DockingManager.unregisterDockable((Dockable) tab);
+            DockingManager.close(tab);
+            tab.close();
+        }
         if (getDockingPort().getDockables().isEmpty()) {
             // remove xxxBars
             if (toolBar != null) {
@@ -369,12 +389,20 @@ public class SwingScilabWindow extends JFrame implements SimpleWindow {
     }
 
     /**
+     * Remove a Scilab tab from a Scilab window
+     * @param tab the Scilab tab to remove from the Scilab window
+     * @see org.scilab.modules.gui.window.Window#removeTab(org.scilab.modules.gui.tab.Tab)
+     */
+    public void removeTab(Tab tab) {
+        removeTabs(new SwingScilabTab[]{(SwingScilabTab) tab.getAsSimpleTab()});
+    }
+
+    /**
      * Sets a Scilab MenuBar to a Scilab window
      * @param newMenuBar the Scilab MenuBar to add to the Scilab window
      * @see org.scilab.modules.gui.window.Window#setMenuBar(org.scilab.modules.gui.menubar.MenuBar)
      */
     public void addMenuBar(MenuBar newMenuBar) {
-
         if (newMenuBar == null) {
             if (this.menuBar != null) {
                 this.menuBar = null;
@@ -398,7 +426,6 @@ public class SwingScilabWindow extends JFrame implements SimpleWindow {
      * @see org.scilab.modules.gui.window.Window#setToolBar(org.scilab.modules.gui.toolbar.ToolBar)
      */
     public void addToolBar(ToolBar newToolBar) {
-
         if (newToolBar == null) {
             if (this.toolBar != null) {
                 // Remove old InfoBar if already set
@@ -427,7 +454,6 @@ public class SwingScilabWindow extends JFrame implements SimpleWindow {
      * @see org.scilab.modules.gui.window.Window#setInfoBar(org.scilab.modules.gui.textbox.T