Revision 735

tmp/trunk/org.txm.setups/getSharedFiles.sh (revision 735)
5 5
SHAREDALL="$SHARED/all"
6 6
SCRIPTCOPYDIR="$SHAREDALL/scripts"
7 7

  
8
echo "reset the shared/all directory..."
9
rm -rf "$SHAREDALL" &&
10
svn update
11

  
12
if [ ! -d "$SCRIPTCOPYDIR" ]; then
13
	echo "** Scripts copy: failed to reset the shared/all directory."
14
	exit 1;
15
fi
16

  
17
IMPORTERPACKAGE=/src/groovy/org/txm/importer
18
ALCESTE=$IMPORTERPACKAGE/alceste/alcesteLoader.groovy
19
DISCOURS=$IMPORTERPACKAGE/discours/discoursLoader.groovy
20
BFM=$IMPORTERPACKAGE/bfm/bfmLoader.groovy
21
FRANTEXT=$IMPORTERPACKAGE/frantext/frantextLoader.groovy
22
HYPERBASE=$IMPORTERPACKAGE/hyperbase/hyperbaseLoader.groovy
23
TXT=$IMPORTERPACKAGE/txt/txtLoader.groovy
24
XML=$IMPORTERPACKAGE/xml/xmlLoader.groovy
25
FACTIVA=$IMPORTERPACKAGE/factiva/factivaLoader.groovy
26
FACTIVATXT=$IMPORTERPACKAGE/factiva/factivamailLoader.groovy
27
XMLTXM=$IMPORTERPACKAGE/xmltxm/xmltxmLoader.groovy
28
TRANSCRIBER=$IMPORTERPACKAGE/transcriber/transcriberLoader.groovy
29
TMX=$IMPORTERPACKAGE/tmx/tmxLoader.groovy
30
DOC=$IMPORTERPACKAGE/doc/docLoader.groovy
31
WTC=$IMPORTERPACKAGE/wtc/wtcLoader.groovy
32
#LIMSI=$IMPORTERPACKAGE/limsi/limsiLoader.groovy
33

  
34
echo $SCRIPTCOPYDIR
35

  
36
mkdir "$SCRIPTCOPYDIR/import/"
37
# get all xxxxLoader.groovy sccripts
38
cp -v "$TOOLBOXDIRECTORY$ALCESTE" "$SCRIPTCOPYDIR/import/" && \
39
cp -v "$TOOLBOXDIRECTORY$DISCOURS" "$SCRIPTCOPYDIR/import/" && \
40
cp -v "$TOOLBOXDIRECTORY$BFM" "$SCRIPTCOPYDIR/import/" && \
41
cp -v "$TOOLBOXDIRECTORY$FRANTEXT" "$SCRIPTCOPYDIR/import/" && \
42
cp -v "$TOOLBOXDIRECTORY$HYPERBASE" "$SCRIPTCOPYDIR/import/" && \
43
cp -v "$TOOLBOXDIRECTORY$TXT" "$SCRIPTCOPYDIR/import/" && \
44
cp -v "$TOOLBOXDIRECTORY$XML" "$SCRIPTCOPYDIR/import/" && \
45
cp -v "$TOOLBOXDIRECTORY$FACTIVA" "$SCRIPTCOPYDIR/import/" && \
46
cp -v "$TOOLBOXDIRECTORY$FACTIVATXT" "$SCRIPTCOPYDIR/import/" && \
47
cp -v "$TOOLBOXDIRECTORY$XMLTXM" "$SCRIPTCOPYDIR/import/" && \
48
cp -v "$TOOLBOXDIRECTORY$TRANSCRIBER" "$SCRIPTCOPYDIR/import/" && \
49
cp -v "$TOOLBOXDIRECTORY$DOC" "$SCRIPTCOPYDIR/import/" && \
50
cp -v "$TOOLBOXDIRECTORY$TMX" "$SCRIPTCOPYDIR/import/" && \
51
cp -v "$TOOLBOXDIRECTORY$WTC" "$SCRIPTCOPYDIR/import/"
52
#cp -v "$TOOLBOXDIRECTORY$LIMSI" "$SCRIPTCOPYDIR/import/"
53

  
8
# copy TXM sample corpora files files
9
svn update "${SVNDIR}"
10
mkdir  "$SHAREDALL/samples"
11
cp -f "${SVNDIR}/corpora/tdm80j" "$SHAREDALL/samples/tdm80j"
54 12
if [ $? != 0 ]; then
55
	echo "** Loader scripts copy: copy failed"
13
	echo "** TXM REFMAN copy failed"
56 14
	exit 1;
57 15
fi
58 16

  
59
#copy Macros
60
mkdir "$SCRIPTCOPYDIR/macro/"
61
mkdir "$SCRIPTCOPYDIR/macro/org/"
62
mkdir "$SCRIPTCOPYDIR/macro/org/txm/"
63
#mkdir "$SCRIPTCOPYDIR/macro/org/txm/annotation/"
64

  
65
rsync -r --exclude '.svn' "$TOOLBOXDIRECTORY/src/groovy/org/txm/macro/" "$SCRIPTCOPYDIR/macro/org/txm/macro" &&
66
#rsync -r --exclude '.svn' "$TOOLBOXDIRECTORY/src/groovy/org/txm/importer/europress/" "$SCRIPTCOPYDIR/macro" &&
67
#rsync -r --exclude '.svn' "$TOOLBOXDIRECTORY/src/groovy/org/txm/annotation/" "$SCRIPTCOPYDIR/macro/org/txm/annotation" &&
68
#rsync -r --exclude '.svn' "$TOOLBOXDIRECTORY/src/groovy/org/txm/importer/transcription/" "$SCRIPTCOPYDIR/macro/org/txm/importer/transcription"
69
if [ $? != 0 ]; then
70
	echo "** Macros copy failed"
71
	exit 1;
72
fi
73

  
74
#copy Groovy samples scripts
75
mkdir "$SCRIPTCOPYDIR/samples/groovy"
76
mkdir "$SCRIPTCOPYDIR/samples/groovy/org" &&
77
mkdir "$SCRIPTCOPYDIR/samples/groovy/org/txm" &&
78
mkdir "$SCRIPTCOPYDIR/samples/groovy/org/txm/export" &&
79
mkdir "$SCRIPTCOPYDIR/samples/groovy/org/txm/functions" && 
80
mkdir "$SCRIPTCOPYDIR/samples/groovy/org/txm/importer" &&
81
mkdir "$SCRIPTCOPYDIR/samples/groovy/org/txm/sw" &&
82
#mkdir "$SCRIPTCOPYDIR/samples/groovy/org/txm/tal" &&
83
rsync -r  --exclude '.svn' "$TOOLBOXDIRECTORY/src/groovy/org/txm/export"/* "$SCRIPTCOPYDIR/samples/groovy/org/txm/export" && 
84
rsync -r  --exclude '.svn' "$TOOLBOXDIRECTORY/src/groovy/org/txm/functions"/* "$SCRIPTCOPYDIR/samples/groovy/org/txm/functions" &&
85
rsync -r  --exclude '.svn' "$TOOLBOXDIRECTORY/src/groovy/org/txm/importer"/* "$SCRIPTCOPYDIR/samples/groovy/org/txm/importer" &&
86
rsync -r  --exclude '.svn' "$TOOLBOXDIRECTORY/src/groovy/org/txm/sw"/* "$SCRIPTCOPYDIR/samples/groovy/org/txm/sw" &&
87
rsync -r  --exclude '.svn' "$TOOLBOXDIRECTORY/src/groovy/org/txm/tal"/* "$SCRIPTCOPYDIR/samples/groovy/org/txm/tal" &&
88
if [ $? != 0 ]; then
89
	echo "** Groovy samples copy failed"
90
	exit 1;
91
fi
92

  
93
#copy R samples scripts
94
rsync -r  --exclude '.svn' "$TOOLBOXDIRECTORY/src/R/"* "$SCRIPTCOPYDIR/samples/R"
95
if [ $? != 0 ]; then
96
	echo "** R samples copy failed"
97
	exit 1;
98
fi
99

  
100
# copy XSL files
101
rsync -r  --exclude '.svn' "$TOOLBOXDIRECTORY/res/org/txm/xml/xsl/"* "$SHAREDALL/xsl"
102
if [ $? != 0 ]; then
103
	echo "** Loader xsl copy: copy failed"
104
	exit 1;
105
fi
106

  
107
# copy CSS files
108

  
109
rsync -r --exclude '.svn' "$TOOLBOXDIRECTORY/res/org/txm/css/txm.css" "$SHAREDALL/css/" &&
110
rsync -r --exclude '.svn' "$TOOLBOXDIRECTORY/res/org/txm/css/tmx.css" "$SHAREDALL/css/" &&  
111
rsync -r --exclude '.svn' "$TOOLBOXDIRECTORY/res/org/txm/css/doc.css" "$SHAREDALL/css/" && 
112
rsync -r --exclude '.svn' "$TOOLBOXDIRECTORY/res/org/txm/css/transcriber.css" "$SHAREDALL/css/"
113
if [ $? != 0 ]; then
114
	echo "** css copy failed"
115
	exit 1;
116
fi
117

  
118 17
# copy TXM documentation files files
119
svn update "${SVNDOCTRUNK}"
18
mkdir "$SHAREDALL/doc"
120 19
cp -f "${SVNDOCTRUNK}/user manuals/txm-manual-fr.pdf" "$SHAREDALL/doc/Manuel de TXM 0.7 FR.pdf"
121 20
if [ $? != 0 ]; then
122 21
	echo "** TXM REFMAN copy failed"
123 22
	exit 1;
124 23
fi
125 24

  
126
chmod -R +r "$SHAREDALL"/*
127
find "$SHAREDALL" -type d -exec chmod +rx {} \;
128

  
129
# remove dev scripts
130
rm -f "$SCRIPTCOPYDIR/samples/groovy/ReleaseFunctionsValidation.groovy"
131
rm -f "$SCRIPTCOPYDIR/samples/groovy/ReleaseLoadersValidation.groovy"
132
rm -rf "$SCRIPTCOPYDIR/samples/groovy/org/txm/setup"
133
rm -rf "$SCRIPTCOPYDIR/samples/groovy/org/txm/i18n"
134
rm -rf "$SCRIPTCOPYDIR/samples/groovy/org/txm/svn"
135
rm -f "$SCRIPTCOPYDIR/samples/groovy/org/txm/AntTest.groovy"
136
rm -f "$SCRIPTCOPYDIR/samples/groovy/org/txm/Build.java"
137
rm -f "$SCRIPTCOPYDIR/samples/groovy/org/txm/Build2.java"
138
rm -f "$SCRIPTCOPYDIR/samples/groovy/org/txm/Build3.groovy"
139

  
140 25
echo "** Shared files copy: success !"
141 26

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_ru.properties (revision 735)
34 34
ApplicationWorkbenchAdvisor_1           = Инициализация платформы...
35 35
ApplicationWorkbenchAdvisor_11          = Загрузка демонстрационных корпусов
36 36
ApplicationWorkbenchAdvisor_12          = ** Ошибка: переменная среды ''TXMHOME'' задана ({0}), но нет папки: 
37
ApplicationWorkbenchAdvisor_13          = ** Не удалось создать папку TXMHOME : {0}
37

  
38 38
ApplicationWorkbenchAdvisor_16          = N/A_Removing old corpus backup directory {0}. 
39 39
ApplicationWorkbenchAdvisor_18          = Corpora backuped: {0} 
40 40
ApplicationWorkbenchAdvisor_2           = Загрузка опций установки TXM из: {0}
......
49 49
ApplicationWorkbenchAdvisor_31          = ** Не удалось создать рабочее пространство 'default.xml'
50 50
ApplicationWorkbenchAdvisor_34          = ** Ошибка: не удалсоь создать папку для сохранения корпуса
51 51
ApplicationWorkbenchAdvisor_37          = \ в 
52
ApplicationWorkbenchAdvisor_39          = Не хватает папки в директории установки TXM : {0}
53
ApplicationWorkbenchAdvisor_40          = ** Не удалось скопировать файлы из папки TXMINSTALL в TXMHOME: {0}
52

  
54 53
ApplicationWorkbenchAdvisor_41          = ** Не удалось задать опции: {0}
55 54
ApplicationWorkbenchAdvisor_43          = Corpora {0} not restored, since this setup provides more recent ones.
56 55
ApplicationWorkbenchAdvisor_43_single   = Corpus {0} not restored, since this setup provides more recent ones.
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties (revision 735)
40 40
ApplicationWorkbenchAdvisor_1           = Initialisation de la plateforme...
41 41
ApplicationWorkbenchAdvisor_11          = Chargement des corpus d'exemple 
42 42
ApplicationWorkbenchAdvisor_12          = ** Erreur : la variable d''environnement ''TXMHOME'' est bien définie ({0}) mais le dossier n''existe pas : 
43
ApplicationWorkbenchAdvisor_13          = ** Échec de la création du dossier TXMHOME : {0}
44 43
ApplicationWorkbenchAdvisor_16          = Nettoyage de l''ancien dossier de sauvegarde des corpus ''{0}''. 
45 44
ApplicationWorkbenchAdvisor_18          = Corpus sauvegardés dans : {0}.
46 45
ApplicationWorkbenchAdvisor_2           = Chargement des préférences d''installation de TXM à partir de : {0}
......
55 54
ApplicationWorkbenchAdvisor_31          = ** Échec de la création de l'espace de travail 'default.xml'
56 55
ApplicationWorkbenchAdvisor_34          = ** Échec : le dossier de sauvegarde des corpus n'a pas pu être créé
57 56
ApplicationWorkbenchAdvisor_37          = \ vers 
58
ApplicationWorkbenchAdvisor_39          = Dossier manquant dans le dossier d''installation de TXM : {0}
59
ApplicationWorkbenchAdvisor_40          = ** Échec de la copie des fichiers TXM du dossier TXMINSTALL vers TXMHOME : {0}
57

  
60 58
ApplicationWorkbenchAdvisor_41          = ** Échec de réglage des préférences : {0}
61 59
ApplicationWorkbenchAdvisor_43          = Les corpus {0} ont été mis à jour avec une version plus récente.
62 60
ApplicationWorkbenchAdvisor_43_single   = Le corpus {0} a été mis à jour avec une version plus récente.
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java (revision 735)
50 50
	public static String ApplicationWorkbenchAdvisor_0;
51 51
	public static String ApplicationWorkbenchAdvisor_11;
52 52
	public static String ApplicationWorkbenchAdvisor_12;
53
	public static String ApplicationWorkbenchAdvisor_13;
53

  
54 54
	public static String ApplicationWorkbenchAdvisor_16;
55 55
	public static String ApplicationWorkbenchAdvisor_18;
56 56
	public static String ApplicationWorkbenchAdvisor_1;
......
66 66
	public static String ApplicationWorkbenchAdvisor_31;
67 67
	public static String ApplicationWorkbenchAdvisor_34;
68 68
	public static String ApplicationWorkbenchAdvisor_37;
69
	public static String ApplicationWorkbenchAdvisor_39;
70 69
	public static String ApplicationWorkbenchAdvisor_3;
71
	public static String ApplicationWorkbenchAdvisor_40;
72 70
	public static String ApplicationWorkbenchAdvisor_41;
73 71
	public static String ApplicationWorkbenchAdvisor_43;
74 72
	public static String ApplicationWorkbenchAdvisor_43_single;
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties (revision 735)
40 40
ApplicationWorkbenchAdvisor_1           = Initialization of the platform
41 41
ApplicationWorkbenchAdvisor_11          = Loading sample corpora
42 42
ApplicationWorkbenchAdvisor_12          = ** Error: ''TXMHOME'' environment variable is set ({0}), but the directory doesn''t exist:
43
ApplicationWorkbenchAdvisor_13          = ** Could not create TXMHOME directory: {0}
43

  
44 44
ApplicationWorkbenchAdvisor_16          = Removing old corpus backup directory {0}.
45 45
ApplicationWorkbenchAdvisor_18          = Corpora backuped: {0}
46 46
ApplicationWorkbenchAdvisor_2           = Loading TXM install preferences
......
56 56
ApplicationWorkbenchAdvisor_31          = ** Failed to create TXM default.xml workspace
57 57
ApplicationWorkbenchAdvisor_34          = ** Could not create backup directory :
58 58
ApplicationWorkbenchAdvisor_37          = \ to
59
ApplicationWorkbenchAdvisor_39          = Missing folder in TXM install dir: {0}
60
ApplicationWorkbenchAdvisor_40          = Failed to copy TXM files from TXMINSTALL DIR to TXMHOME: {0}
59

  
61 60
ApplicationWorkbenchAdvisor_41          = Failed to set preferences: {0}
62 61
ApplicationWorkbenchAdvisor_43          = Corpora {0} not restored, since this setup provides more recent ones.
63 62
ApplicationWorkbenchAdvisor_43_single   = Corpus {0} not restored, since this setup provides more recent ones.
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/PurgeCorpora.java (revision 735)
101 101
						System.out.println(TXMUIMessages.PurgeCorpora_10);
102 102
						File xmlfile = new File(workspace, "workspaces/default.xml"); //$NON-NLS-1$
103 103
						this.acquireSemaphore();
104
						Toolbox.workspace = Workspace.createEmptyWorkspace(xmlfile);
104
						Toolbox.workspace = Workspace.createEmptyWorkspaceDefinition(xmlfile);
105 105
						this.releaseSemaphore();
106 106
						
107 107
						System.out.println(TXMUIMessages.PurgeCorpora_12);
tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java (revision 735)
27 27
//
28 28
package org.txm.rcp;
29 29

  
30
import java.io.BufferedReader;
31 30
import java.io.File;
32 31
import java.io.IOException;
33 32
import java.io.PrintStream;
......
35 34
import java.net.URL;
36 35
import java.util.ArrayList;
37 36
import java.util.Arrays;
38
import java.util.Locale;
39
import java.util.Properties;
40 37
import java.util.logging.Handler;
41 38
import java.util.logging.Level;
42 39
import java.util.logging.LogRecord;
......
92 89
import org.txm.importer.Convert5To6;
93 90
import org.txm.objects.Base;
94 91
import org.txm.objects.Workspace;
95
import org.txm.rcp.commands.OpenBrowser;
96 92
import org.txm.rcp.commands.OpenWelcomePage;
97 93
import org.txm.rcp.commands.RestartTXM;
98 94
import org.txm.rcp.commands.workspace.LoadBinaryCorpus;
......
106 102
import org.txm.rcp.utils.JobHandler;
107 103
import org.txm.utils.BundleUtils;
108 104
import org.txm.utils.DeleteDir;
109
import org.txm.utils.io.FileCopy;
110
import org.txm.utils.io.IOUtils;
111 105
import org.txm.utils.logger.Log;
112 106
import org.txm.utils.zip.Zip;
113 107

  
......
719 713
					
720 714
					String version = v.getMajor()+"_"+v.getMinor()+"_"+v.getMicro();
721 715
					if ("qualifier".equals(v.getQualifier())) {
722
						System.out.println("RUNNING TXM FROM ECLIPSE - GOD MODE ACTIVATED");
723
						version = "dev";
716
						System.out.println("RUNNING TXM FROM ECLIPSE - DEV MODE ACTIVATED");
717
						version += "_dev";
724 718
					}
725 719
					txmhomedir = new File(System.getProperty("user.home"), "TXM_"+version); //$NON-NLS-1$ //$NON-NLS-2$
726 720
				} else {
......
753 747
				backup = new File(txmhomedir, "corpus-backup"); //$NON-NLS-1$
754 748
				oldbackup = new File(txmhomedir, "corpus-backup-old"); //$NON-NLS-1$
755 749
				errorbackup = new File(txmhomedir, "corpus-backup-error"); //$NON-NLS-1$
750
				
756 751
				corporaDir = new File(txmhomedir, "corpora"); //$NON-NLS-1$
757 752
				File[] corporaDirFiles = corporaDir.listFiles();
758 753
				if (corporaDir.exists() && corporaDirFiles != null && corporaDirFiles.length > 0) { // if the txmhomedir is not empty, try to restore its content
......
819 814
				return false;
820 815
			}
821 816

  
822
			try {
823
				txmhomedir.mkdir();
824
				if (!txmhomedir.exists()) {
825
					System.out.println(NLS.bind(TXMUIMessages.ApplicationWorkbenchAdvisor_13, txmhomedir));
826
					return false;
827
				}
828 817

  
829
				// create folders
830
				String createfolders[] = {
831
						"corpora", "clipboard", //$NON-NLS-1$ //$NON-NLS-2$
832
						"workspaces", "css", "scripts", "scripts/lib", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
833
						"scripts/macro", "scripts/user", "xsl", "samples", "schema"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
834
				String deletefolders[] = {"clipboard", "registry", "samples"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
818
			// create or update the workspace & create TXM default.xml workspace file
819
			Toolbox.workspace = Workspace.createOrUpdate(txmhomedir); //$NON-NLS-1$
835 820

  
836
				for (String folder : deletefolders) {
837
					DeleteDir.deleteDirectory(new File(txmhomedir, folder));
838
				}
839

  
840
				for (String folder : createfolders) {
841
					new File(txmhomedir, folder).mkdir();
842
				}
843

  
844
				// create TXM default.xml workspace
845
				Toolbox.workspace = Workspace.createEmptyWorkspace(new File(
846
						txmhomedir, "workspaces/default.xml")); //$NON-NLS-1$
847

  
848
				// test
849
				if (Toolbox.workspace == null) {
850
					System.out.println(TXMUIMessages.ApplicationWorkbenchAdvisor_31);
851
					return false;
852
				}
853

  
854
				// the folders to copy from TXM install dir
855
				String copyfolders[] = {"css", "scripts", "xsl", "samples", "scripts", "schema"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
856
				for (String folder : copyfolders) {
857
					File ffile = new File(TXMPreferences.getString(TBXPreferences.INSTALL_DIR, TBXPreferences.PREFERENCES_NODE), folder);
858
					if (!ffile.exists()) {
859
						System.out.println(NLS.bind(TXMUIMessages.ApplicationWorkbenchAdvisor_39, ffile));
860
						continue;
861
					}
862

  
863
					FileCopy.copyFiles(ffile, new File(txmhomedir, folder));
864
				}
865
			} catch (Exception e) {
866
				Log.severe(NLS.bind(TXMUIMessages.ApplicationWorkbenchAdvisor_40, e.getLocalizedMessage()));
867
				System.err.println(NLS.bind(TXMUIMessages.ApplicationWorkbenchAdvisor_40, e.getLocalizedMessage()));
821
			// test
822
			if (Toolbox.workspace == null) {
823
				System.out.println(TXMUIMessages.ApplicationWorkbenchAdvisor_31);
868 824
				return false;
869 825
			}
870 826

  
871 827
			try {
872 828
				TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, 
873 829
						TBXPreferences.USER_TXM_HOME, txmhomedir.getAbsolutePath());
874
				TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, 
875
						TBXPreferences.WORKSPACE_LOCATION, new File(txmhomedir,	"workspaces/default.xml").getAbsolutePath()); //$NON-NLS-1$
876 830
			} catch (Exception e) {
877 831
				Log.severe(NLS.bind(TXMUIMessages.ApplicationWorkbenchAdvisor_41, e.getLocalizedMessage()));
878 832
				System.out.println(NLS.bind(TXMUIMessages.ApplicationWorkbenchAdvisor_41, e.getLocalizedMessage()));
......
882 836
			try {
883 837
				ArrayList<String> basenames = new ArrayList<String>();
884 838
				ArrayList<String> sampleCorpusLoaded = new ArrayList<String>();
885
				if (new File(txmhomedir, "samples").exists()) { //$NON-NLS-1$
839
				
840
				String installdirpath = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.INSTALL_DIR);
841
				File sampleCorporaDirectory = new File(installdirpath, "samples");
842
				// load corpora from the install directory
843
				if (sampleCorporaDirectory.exists()) { //$NON-NLS-1$
886 844
					Log.info(TXMUIMessages.ApplicationWorkbenchAdvisor_11);
887 845
					monitor.setTaskName(TXMUIMessages.ApplicationWorkbenchAdvisor_11);
888 846
					//File corporaDir = new File(txmhomedir.getAbsolutePath(), "corpora"); //$NON-NLS-1$
889 847
					corporaDir.mkdir();
890 848

  
891
					File[] sampleCorpusFiles = new File(txmhomedir, "samples").listFiles(); //$NON-NLS-1$
849
					File[] sampleCorpusFiles = sampleCorporaDirectory.listFiles(); //$NON-NLS-1$
892 850

  
893
					for (File zipFile : sampleCorpusFiles) {
851
					if (sampleCorpusFiles != null) for (File zipFile : sampleCorpusFiles) {
894 852
						try {
895 853
							String filename = zipFile.getName();
896 854
							File basedir;
......
930 888
					}
931 889
				}
932 890

  
891
				// after loading sample corpora, restore older corpus
933 892
				if (backup.exists()) {
934 893
					System.out.print(NLS.bind(TXMUIMessages.ApplicationWorkbenchAdvisor_53, backup));
935 894
					monitor.setTaskName(NLS.bind(TXMUIMessages.ApplicationWorkbenchAdvisor_53, backup));
tmp/org.txm.rcp/src/main/java/org/txm/rcp/Application.java (revision 735)
123 123
					new File(userhomeDirectory, folder).mkdir();
124 124
				}
125 125

  
126
				Workspace.createEmptyWorkspace(new File(corpusworkspaceDirectory, "default.xml")); //$NON-NLS-1$
126
				Workspace.createEmptyWorkspaceDefinition(new File(corpusworkspaceDirectory, "default.xml")); //$NON-NLS-1$
127 127
				BundleUtils.copyFiles("org.txm.core",  "res", "org/txm", "css", new File(userhomeDirectory, "css"));
128 128
				BundleUtils.copyFiles("org.txm.core",  "res", "org/txm/xml", "xsl", new File(userhomeDirectory, "xsl"));
129 129
				BundleUtils.copyFiles("org.txm.core",  "res", "org/txm/xml", "schema", new File(userhomeDirectory, "schema"));
tmp/org.txm.core/src/java/org/txm/ToolboxOld.java (revision 735)
408 408
				stateWorkspace = false;
409 409
				return false;
410 410
			}
411
			String location = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.WORKSPACE_LOCATION);
411
			String location = txmhome+"workspaces/default.xml";//TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.WORKSPACE_LOCATION);
412 412
			
413 413
			System.out.println("Toolbox.startWorkspace(): workspace location = " + location);
414 414
			
415 415
			if (!new File(location).exists()) {
416 416
				Log.info(TXMCoreMessages.Toolbox_10 + location); 
417
				workspace = Workspace.createEmptyWorkspace(new File(location));
417
				workspace = Workspace.createEmptyWorkspaceDefinition(new File(location));
418 418
			} else {
419 419
				workspace = new Workspace(new File(location));
420 420
			}
......
429 429
				System.out.println(TXMCoreMessages.common_done);
430 430
			}
431 431
		} catch (Exception e) {
432
			System.err.println(TXMCoreMessages.Toolbox_workspace_init_failed + TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.WORKSPACE_LOCATION)); 
432
//			System.err.println(TXMCoreMessages.Toolbox_workspace_init_failed + TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.WORKSPACE_LOCATION)); 
433 433
			Log.severe(TXMCoreMessages.Toolbox_15 + Log.toString(e));
434 434
			Log.printStackTrace(e);
435 435
			stateWorkspace = false;
tmp/org.txm.core/src/java/org/txm/Toolbox.java (revision 735)
452 452
	}
453 453

  
454 454
	private static boolean startWorkspace() {
455
		String txmhome = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE);
456
		if (txmhome ==null || txmhome.length() == 0) {
457
			state = false;
458
			return false;
459
		}
460
		String location = txmhome+"workspaces/default.xml";
455 461
		try {
456
			String txmhome = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE);
457
			if (txmhome.length() == 0) {
458
				state = false;
459
				return false;
460
			}
461
			String location = TXMPreferences.getString(TBXPreferences.WORKSPACE_LOCATION, TBXPreferences.PREFERENCES_NODE);
462 462
			
463
			
463 464
			//System.out.println("Toolbox.startWorkspace(): workspace location = " + location);
464 465
			
465 466
			if (!new File(location).exists()) {
466 467
				Log.info(TXMCoreMessages.Toolbox_10 + location); 
467
				workspace = Workspace.createEmptyWorkspace(new File(location));
468
				workspace = Workspace.createEmptyWorkspaceDefinition(new File(location));
468 469
			} else {
469 470
				workspace = new Workspace(new File(location));
470 471
			}
......
480 481
				//System.out.println(TXMCoreMessages.DONE);
481 482
			}
482 483
		} catch (Exception e) {
483
			System.err.println(TXMCoreMessages.Toolbox_workspace_init_failed + TXMPreferences.getString(TBXPreferences.WORKSPACE_LOCATION, TBXPreferences.PREFERENCES_NODE)); 
484
			System.err.println(TXMCoreMessages.Toolbox_workspace_init_failed + location); 
484 485
			Log.severe(TXMCoreMessages.Toolbox_15 + Log.toString(e));
485 486
			Log.printStackTrace(e);
486 487
			state = false;
tmp/org.txm.core/src/java/org/txm/PostTXMHOMEInstallationStep.java (revision 735)
1
package org.txm;
2

  
3
import java.io.File;
4

  
5
import org.txm.objects.Workspace;
6

  
7
/**
8
 * Called by the Toolbox when a plugin needs to install things in a newly created/updated TXM user directory
9
 * 
10
 * @author mdecorde
11
 *
12
 */
13
public abstract class PostTXMHOMEInstallationStep {
14
	
15
	public static final String EXTENSION_ID = PostTXMHOMEInstallationStep.class.getCanonicalName();
16
	
17
	/**
18
	 * called after the Core has created its files
19
	 * @return true if success, false if installation failed
20
	 */
21
	public abstract boolean install(Workspace workspace);
22
	
23
	/**
24
	 * 
25
	 * @return user friendly extension point name
26
	 */
27
	public abstract String getName();
28
}
0 29

  
tmp/org.txm.core/src/java/org/txm/core/messages/TXMCoreMessages.java (revision 735)
37 37

  
38 38
	public static String error_error;
39 39
	
40
	
40
	public static String ApplicationWorkbenchAdvisor_13;
41 41
	public static String ApplicationWorkbenchAdvisor_14;
42 42
	public static String ApplicationWorkbenchAdvisor_15;
43
	public static String ApplicationWorkbenchAdvisor_39;
44
	public static String ApplicationWorkbenchAdvisor_40;
43 45
	public static String ApplicationWorkbenchAdvisor_6;
44 46
	public static String FMAX_1;
45 47
	public static String FMAX_2;
tmp/org.txm.core/src/java/org/txm/core/messages/messages_fr.properties (revision 735)
297 297
common_units           = Unités
298 298

  
299 299
error_error = ** Erreur : {0}.
300

  
301
ApplicationWorkbenchAdvisor_13          = ** Échec de la création du dossier TXMHOME : {0}
302
ApplicationWorkbenchAdvisor_39          = Dossier manquant dans le dossier d''installation de TXM : {0}
303
ApplicationWorkbenchAdvisor_40          = ** Échec de la copie des fichiers TXM du dossier TXMINSTALL vers TXMHOME : {0}
tmp/org.txm.core/src/java/org/txm/core/messages/messages.properties (revision 735)
3 3

  
4 4
AbstractCqiClient_2 = No error.
5 5

  
6
ApplicationWorkbenchAdvisor_13          = ** Could not create TXMHOME directory: {0}
6 7
ApplicationWorkbenchAdvisor_14 = \ evaluating extension:
7 8
ApplicationWorkbenchAdvisor_15 = Loading extensions...
9
ApplicationWorkbenchAdvisor_39          = Missing folder in TXM install dir: {0}
10
ApplicationWorkbenchAdvisor_40          = Failed to copy TXM files from TXMINSTALL DIR to TXMHOME: {0}
8 11
ApplicationWorkbenchAdvisor_6  = Exception:
9 12

  
10 13
Base_0  = Binary directory 
tmp/org.txm.core/src/java/org/txm/core/messages/messages_ru.properties (revision 735)
12 12
common_structuralUnit  = Структурная единица: 
13 13
common_structure       = Структура
14 14
common_units           = Единицы
15

  
16
ApplicationWorkbenchAdvisor_13          = ** Не удалось создать папку TXMHOME : {0}
17
ApplicationWorkbenchAdvisor_39          = Не хватает папки в директории установки TXM : {0}
18
ApplicationWorkbenchAdvisor_40          = ** Не удалось скопировать файлы из папки TXMINSTALL в TXMHOME: {0}
tmp/org.txm.core/src/java/org/txm/core/preferences/TBXPreferences.java (revision 735)
30 30
	/** The Constant UI_LOCALE. */
31 31
	public static final String UI_LOCALE = "ui_locale"; //$NON-NLS-1$
32 32

  
33
	/** The Constant WORKSPACE_LOCATION. */
34
	public static final String WORKSPACE_LOCATION = "workspace_location"; //$NON-NLS-1$
35

  
36 33
	/** The Constant INSTALL_DIR. */
37 34
	public static final String INSTALL_DIR = "install_dir"; //$NON-NLS-1$
38 35

  
......
79 76

  
80 77
		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
81 78
		
82
		//FIXME: USE osgi.instance.area later
83
		preferences.put(TBXPreferences.USER_TXM_HOME, System.getProperty("user.home")+"/TXM");
84
		preferences.put(TBXPreferences.WORKSPACE_LOCATION, System.getProperty("user.home")+"/TXM/workspaces/default.xml");
85
		
79
//		//FIXME: USE osgi.instance.area later & done in ApplicationWorkbenchAdvisor
80
//		preferences.put(TBXPreferences.USER_TXM_HOME, System.getProperty("user.home")+"/TXM");
81
//		
86 82
		preferences.putBoolean(TBXPreferences.EXPERT_USER, false); //$NON-NLS-1$
87 83
		
88 84
		preferences.put(TBXPreferences.LOG_LEVEL, "OFF"); //$NON-NLS-1$
tmp/org.txm.core/src/java/org/txm/objects/Workspace.java (revision 735)
34 34
import java.io.OutputStreamWriter;
35 35
import java.io.Writer;
36 36
import java.util.ArrayList;
37
import java.util.Arrays;
37 38
import java.util.Collection;
38 39
import java.util.HashMap;
39 40
import java.util.List;
......
48 49
import javax.xml.transform.dom.DOMSource;
49 50
import javax.xml.transform.stream.StreamResult;
50 51

  
52
import org.eclipse.core.runtime.CoreException;
53
import org.eclipse.core.runtime.IConfigurationElement;
54
import org.eclipse.core.runtime.Platform;
55
import org.eclipse.osgi.util.NLS;
56
import org.txm.EnginesManager;
57
import org.txm.PostTXMHOMEInstallationStep;
51 58
import org.txm.core.messages.TXMCoreMessages;
59
import org.txm.core.preferences.TBXPreferences;
60
import org.txm.core.preferences.TXMPreferences;
61
import org.txm.utils.BundleUtils;
62
import org.txm.utils.DeleteDir;
52 63
import org.txm.utils.io.FileCopy;
53 64
import org.txm.utils.logger.Log;
54 65
import org.w3c.dom.Document;
......
65 76

  
66 77
	/** The bases. */
67 78
	HashMap<String, Base> bases = new HashMap<String, Base>();
68
	
79

  
69 80
	/** The projects. */
70 81
	HashMap<String, Project> projects = new HashMap<String, Project>();
71 82

  
72 83
	/** The xmlfile. */
73
	File xmlfile;
74
	
84
	File xmlDefinitionFile;
85

  
75 86
	/** The doc. */
76 87
	Document doc;
77
	
88

  
78 89
	/** The projs. */
79 90
	Element projs;
80 91

  
81 92
	/**
93
	 * Creates&Update workspace directory.
94
	 * 
95
	 * The update part consist of copying files from the install directory
96
	 *
97
	 * @param xmlDefinitionFile the xmlfile
98
	 * @return the workspace
99
	 */
100
	public static Workspace createOrUpdate(File txmhomedir) {
101
		//TODO replace this old directory&file with the ".project" Eclipse project configuration file
102
		File xmlfile = new File(txmhomedir, "workspaces/default.xml");
103

  
104
		try {
105
			txmhomedir.mkdirs();
106

  
107
			if (!txmhomedir.exists()) {
108
				System.out.println(NLS.bind(TXMCoreMessages.ApplicationWorkbenchAdvisor_13, txmhomedir));
109
				return null;
110
			}
111

  
112
			// create folders
113
			String createfolders[] = {
114
					"corpora", "clipboard", //$NON-NLS-1$ //$NON-NLS-2$
115
					"workspaces", "css", "xsl", "schema"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
116
			String deletefolders[] = {"clipboard"}; //$NON-NLS-1$ //$NON-NLS-2$
117

  
118
			for (String folder : deletefolders) {
119
				DeleteDir.deleteDirectory(new File(txmhomedir, folder));
120
			}
121

  
122
			for (String folder : createfolders) {
123
				new File(txmhomedir, folder).mkdir();
124
			}
125

  
126
			if (!writeEmptyWorkspaceFile(xmlfile)) {
127
				System.out.println("Error while creating workspace definition file: "+xmlfile);
128
			}
129

  
130
			// the folders to copy from TXM install dir
131
			BundleUtils.copyFiles("org.txm.core", "res", "org/txm/xml", "xsl", new File(txmhomedir, "xsl"));
132
			BundleUtils.copyFiles("org.txm.core", "res", "org/txm/xml", "schema", new File(txmhomedir, "schema"));
133
			BundleUtils.copyFiles("org.txm.core", "res", "org/txm", "css", new File(txmhomedir, "css"));
134

  
135
			Workspace workspace = new Workspace(xmlfile);
136
			workspace.save();
137
			
138
			IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(PostTXMHOMEInstallationStep.EXTENSION_ID);
139
			//System.out.println("contributions: "+Arrays.toString(contributions));
140
			for (int i = 0; i < contributions.length; i++) {
141
				try {
142
					Log.info("Registering engine: "+contributions[i].getName());
143
					PostTXMHOMEInstallationStep engine = (PostTXMHOMEInstallationStep)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$
144
					if (engine.install(workspace)) {
145
						System.out.println("Fail to install "+engine.getName()+" files in "+workspace.getLocation());
146
					} else {
147
						System.out.println(""+engine+" had no engine. Aborting its installation.");
148
					}
149
				} catch(CoreException e) {
150
					e.printStackTrace();
151
				} 
152
			}
153
			
154
			return workspace;
155
		} catch (Exception e) {
156
			Log.severe(NLS.bind(TXMCoreMessages.ApplicationWorkbenchAdvisor_40, e.getLocalizedMessage()));
157
			System.err.println(NLS.bind(TXMCoreMessages.ApplicationWorkbenchAdvisor_40, e.getLocalizedMessage()));
158
			return null;
159
		}
160
	}
161

  
162
	/**
82 163
	 * Creates the empty workspace.
83 164
	 *
84 165
	 * @param xmlfile the xmlfile
85 166
	 * @return the workspace
86 167
	 */
87
	public static Workspace createEmptyWorkspace(File xmlfile) {
168
	public static Workspace createEmptyWorkspaceDefinition(File xmlfile) {
88 169
		writeEmptyWorkspaceFile(xmlfile);
89 170
		return new Workspace(xmlfile);
90 171
	}
91
	
172

  
92 173
	/**
93 174
	 * Write empty workspace file.
94 175
	 *
95 176
	 * @param xmlfile the xmlfile
96 177
	 * @return true, if successful
97 178
	 */
98
	public static boolean writeEmptyWorkspaceFile(File xmlfile)
179
	protected static boolean writeEmptyWorkspaceFile(File xmlfile)
99 180
	{
100 181
		xmlfile.getParentFile().mkdir();
101 182
		try {
......
123 204
	 *
124 205
	 * @param xmlproject the xmlproject
125 206
	 */
126
	public Workspace(File xmlproject) {
207
	public Workspace(File xmlfile) {
127 208
		super(null);
128
		name = xmlproject.getName();
129
		this.setPath(xmlproject.getAbsolutePath()); 
130
		this.xmlfile = xmlproject;
209
		name = xmlfile.getName();
210
		this.setPath("/"+name); 
211
		this.xmlDefinitionFile = xmlfile;
131 212
		load();
132 213
	}
133 214

  
......
180 261
		DocumentBuilder db;
181 262
		try {
182 263
			db = dbf.newDocumentBuilder();
183
			doc = db.parse(xmlfile);
264
			doc = db.parse(xmlDefinitionFile);
184 265
			setSelfElement(doc.getDocumentElement());
185 266
			this.name = getSelfElement().getAttribute("name"); //$NON-NLS-1$
186 267

  
......
199 280
		} catch (Exception e) {
200 281
			System.out.println(TXMCoreMessages.Workspace_2 + e);
201 282
			System.out.println(TXMCoreMessages.Workspace_8);
202
			File copyFile = new File(xmlfile.getParentFile(), "copy_of_"+xmlfile.getName());
283
			File copyFile = new File(xmlDefinitionFile.getParentFile(), "copy_of_"+xmlDefinitionFile.getName());
203 284
			try {
204 285
				System.out.println("Writing a copy in "+copyFile);
205
				FileCopy.copy(xmlfile, copyFile);
286
				FileCopy.copy(xmlDefinitionFile, copyFile);
206 287
			} catch (IOException e1) {
207
				System.out.println("Failed to write a copy of "+xmlfile);
288
				System.out.println("Failed to write a copy of "+xmlDefinitionFile);
208 289
				Log.printStackTrace(e1);
209 290
			}
210
			
211
			if (writeEmptyWorkspaceFile(xmlfile))
291

  
292
			if (writeEmptyWorkspaceFile(xmlDefinitionFile))
212 293
				return load();
213 294
			return false;
214 295
		}
......
220 301
	@Override
221 302
	public boolean save() {
222 303
		try {
223
			for(Project p : projects.values())
304
			for (Project p : projects.values()) {
224 305
				p.save();
306
			}
307

  
225 308
			// Création de la source DOM
226 309
			Source source = new DOMSource(doc);
227 310

  
228 311
			// Création du fichier de sortie
229 312
			Writer writer = new BufferedWriter(new OutputStreamWriter(
230
					new FileOutputStream(xmlfile), "UTF-8")); //$NON-NLS-1$
313
					new FileOutputStream(xmlDefinitionFile), "UTF-8")); //$NON-NLS-1$
231 314
			Result resultat = new StreamResult(writer);
232 315

  
233 316
			// Configuration du transformer
......
255 338
			System.out.println(TXMCoreMessages.Workspace_3 + p.getName());
256 339
			for (Base b : p.bases.values()) {
257 340
				System.out.println(TXMCoreMessages.Workspace_4 + b.getName());
258
//				for (MainCorpus c : b.corpora.values()) {
259
//					System.out.println(TXMCoreMessages.Workspace_10+c);
260
//				}
341
				//				for (MainCorpus c : b.corpora.values()) {
342
				//					System.out.println(TXMCoreMessages.Workspace_10+c);
343
				//				}
261 344
			}
262 345
		}
263 346
	}
......
286 369
	 *
287 370
	 * @return the file
288 371
	 */
289
	public File getFile() {
290
		return xmlfile;
372
	public File getDefinitionFile() {
373
		return xmlDefinitionFile;
291 374
	}
292 375

  
293 376

  
......
295 378
	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
296 379
	 */
297 380
	public TxmObject removeChildren(TxmObject o) {
298
		if (o == null)
381
		if (o == null) {
299 382
			return null;
383
		}
300 384
		if (o instanceof Project) {
301 385
			Project proj = (Project) o;
302 386
			getSelfElement().removeChild(proj.getSelfElement());
......
309 393
	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
310 394
	 */
311 395
	public boolean hasChildren(TxmObject o) {
312
		if (o == null)
396
		if (o == null) {
313 397
			return false;
314
		if (o instanceof Project)
398
		}
399
		if (o instanceof Project) {
315 400
			return projects.containsKey(((Project) o).getName());
401
		}
316 402
		return false;
317 403
	}
318 404

  
......
352 438
	@Override
353 439
	public void clean() {
354 440
		// TODO Auto-generated method stub
355
		
441

  
356 442
	}
357 443

  
358 444
	@Override
......
360 446
		// TODO Auto-generated method stub
361 447
		return false;
362 448
	}
449

  
450
	public File getLocation() {
451
		return xmlDefinitionFile.getParentFile().getParentFile(); // this work for now, must be changed when we use properly Eclipse workspaces
452
	}
363 453
}
tmp/org.txm.core/src/java/org/txm/objects/TxmObject.java (revision 735)
47 47
	/** The Constant serialVersionUID. */
48 48
	private static final long serialVersionUID = 3926941521306059565L;
49 49

  
50
	/** The name. */
50
	/** The name is set with the load() method. */
51 51
	protected String name;
52 52

  
53 53
	/** The self element. */
......
67 67
		super(parent);
68 68
		metadatas = new HashMap<String, Property>();
69 69
	}
70

  
71 70
	
72 71
	/**
73 72
	 * Gets the name.
......
119 118
	 */
120 119
	public abstract boolean save();
121 120

  
122
	//	/**
123
	//	 * Delete.
124
	//	 *
125
	//	 * @return true, if successful
126
	//	 */
127
	//	public boolean delete() {
128
	//		if (this.getTXMObjectParent() != null) {
129
	//			if (this.getTXMObjectParent().removeChildren(this) != null) {
130
	//				return true;
131
	//			}
132
	//		} else
133
	//			System.out.println(Messages.TxmObject_1);
134
	//		return false;
135
	//	}
136

  
137 121
	/**
138 122
	 * Sets the path.
139 123
	 *
......
146 130
	/**
147 131
	 * Gets the path.
148 132
	 *
149
	 * @return the path
133
	 * @return the relative path in the object hierarchy
150 134
	 */
151 135
	public String getPath() {
152 136
		return path;
......
233 217
		if (props == null)
234 218
			return;
235 219
		for (int i = 0; i < props.getLength(); i++) {
236
			if ((props.item(i).getNodeType() == 1)
220
			if ((props.item(i).getNodeType() == 1) // NODE
237 221
					&& props.item(i).getNodeName().equals("prop")) //$NON-NLS-1$
238 222
			{
239 223
				Element self = (Element) props.item(i);
......
304 288
		return true;
305 289
	}
306 290
	
307
	
308 291
	@Override
309 292
	public boolean saveParameters() {
310 293
		// FIXME: need to do something?
311 294
		return true;
312 295
	}
313

  
314
	
315 296
}
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 735)
79 79
		this.workspace = workspace;
80 80
		setSelfElement(project);
81 81
		load();
82
		this.setPath(workspace.getPath() + getName());
82
		this.setPath(workspace.getPath() + "/"+getName());
83 83
	}
84 84

  
85 85
	/**
tmp/org.txm.core/src/java/org/txm/utils/BundleUtils.java (revision 735)
82 82
	 * @param bundle_id
83 83
	 * @param source_relative_directory only used when TXM is run from Eclipse
84 84
	 * @param file_path relative path to the file to copy
85
	 * @param file_name
85
	 * @param file_name if file_name is a directory, the content is copied
86 86
	 * @param outputDirectory
87 87
	 * @return true if success
88 88
	 */
tmp/org.txm.core/plugin.xml (revision 735)
4 4
   <extension-point id="org.txm.EnginesManager" name="org.txm.EnginesManager" schema="schema/engine_manager.exsd"/>
5 5
   <extension-point id="org.txm.functions.CommandsAPIDeclaration" name="CommandsAPIDeclaration" schema="schema/org.txm.commandapi.exsd"/>
6 6
   <extension-point id="org.txm.PostInstallationStep" name="Post installation step" schema="schema/org.txm.PostInstallationStep.exsd"/>
7
   <extension-point id="org.txm.PostTXMHOMEInstallationStep" name="Post TXMHome installation step" schema="schema/org.txm.org.txm.PostTXMHOMEInstallationStep.exsd"/>
7 8
   <extension
8 9
         point="org.eclipse.core.runtime.preferences">
9 10
      <initializer
tmp/org.txm.core/schema/org.txm.org.txm.PostTXMHOMEInstallationStep.exsd (revision 735)
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.txm.core" xmlns="http://www.w3.org/2001/XMLSchema">
4
<annotation>
5
      <appinfo>
6
         <meta.schema plugin="org.txm.core" id="org.txm.PostTXMHOMEInstallationStep" name="Post TXMHome installation step"/>
7
      </appinfo>
8
      <documentation>
9
         Plugins msut extends this to create supplementary files in the TXM user directory (usualy located in ~/TXM_VERSION).
10
      </documentation>
11
   </annotation>
12

  
13
   <element name="extension">
14
      <annotation>
15
         <appinfo>
16
            <meta.element />
17
         </appinfo>
18
      </annotation>
19
      <complexType>
20
         <choice minOccurs="1" maxOccurs="unbounded">
21
            <element ref="PostTXMHOMEInstallationStep"/>
22
         </choice>
23
         <attribute name="point" type="string" use="required">
24
            <annotation>
25
               <documentation>
26
                  
27
               </documentation>
28
            </annotation>
29
         </attribute>
30
         <attribute name="id" type="string">
31
            <annotation>
32
               <documentation>
33
                  
34
               </documentation>
35
            </annotation>
36
         </attribute>
37
         <attribute name="name" type="string">
38
            <annotation>
39
               <documentation>
40
                  
41
               </documentation>
42
               <appinfo>
43
                  <meta.attribute translatable="true"/>
44
               </appinfo>
45
            </annotation>
46
         </attribute>
47
      </complexType>
48
   </element>
49

  
50
   <element name="PostTXMHOMEInstallationStep">
51
      <complexType>
52
         <attribute name="class" type="string">
53
            <annotation>
54
               <documentation>
55
                  
56
               </documentation>
57
               <appinfo>
58
                  <meta.attribute kind="java" basedOn="org.txm.PostTXMHOMEInstallationStep:"/>
59
               </appinfo>
60
            </annotation>
61
         </attribute>
62
         <attribute name="name" type="string" use="required">
63
            <annotation>
64
               <documentation>
65
                  
66
               </documentation>
67
            </annotation>
68
         </attribute>
69
         <attribute name="description" type="string" use="required">
70
            <annotation>
71
               <documentation>
72
                  
73
               </documentation>
74
               <appinfo>
75
                  <meta.attribute translatable="true"/>
76
               </appinfo>
77
            </annotation>
78
         </attribute>
79
      </complexType>
80
   </element>
81

  
82
   <annotation>
83
      <appinfo>
84
         <meta.section type="since"/>
85
      </appinfo>
86
      <documentation>
87
         0.8.0
88
      </documentation>
89
   </annotation>
90

  
91
   <annotation>
92
      <appinfo>
93
         <meta.section type="examples"/>
94
      </appinfo>
95
      <documentation>
96
         The R statistical engine creates the R/libraries directory containing the users R library files
97
      </documentation>
98
   </annotation>
99

  
100
   <annotation>
101
      <appinfo>
102
         <meta.section type="apiinfo"/>
103
      </appinfo>
104
      <documentation>
105
         The extension points are called after TXM core (org.txm.Workspace) has done its job.
106
      </documentation>
107
   </annotation>
108

  
109
   <annotation>
110
      <appinfo>
111
         <meta.section type="implementation"/>
112
      </appinfo>
113
      <documentation>
114
         [Enter information about supplied implementation of this extension point.]
115
      </documentation>
116
   </annotation>
117

  
118

  
119
</schema>
0 120

  
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/InstallRUserPart.java (revision 735)
1
package org.txm.statsengine.r.core;
2

  
3
import java.io.File;
4

  
5
import org.txm.PostTXMHOMEInstallationStep;
6
import org.txm.objects.Workspace;
7
import org.txm.utils.BundleUtils;
8

  
9
public class InstallRUserPart extends PostTXMHOMEInstallationStep {
10

  
11
	@Override
12
	public boolean install(Workspace workspace) {
13
		File dir = new File(workspace.getLocation(), "R/libraries");
14
		dir.mkdirs();
15
		
16
		File scriptsDirectory = new File(workspace.getLocation(), "scripts");
17
		File samplesDirectory = new File(scriptsDirectory, "samples/R");
18
		samplesDirectory.mkdirs();
19
		BundleUtils.copyFiles("org.txm.statengine.r.core", "", "", "R", samplesDirectory);
20
		
21
		return dir.exists() && samplesDirectory.exists();
22
	}
23

  
24
	@Override
25
	public String getName() {
26
		return "R (org.txm.statengine.r.core)";
27
	}
28
}
0 29

  
tmp/org.txm.statsengine.r.core/build.properties (revision 735)
1 1
output.. = bin/
2 2
bin.includes = META-INF/,\
3 3
               plugin.xml,\
4
               .
4
               .,\
5
               R/
5 6
source.. = src/
tmp/org.txm.statsengine.r.core/plugin.xml (revision 735)
12 12
      <StatEngine
13 13
            class="org.txm.statsengine.r.core.RStatsEngine"></StatEngine>
14 14
   </extension>
15
   <extension
16
         point="org.txm.PostTXMHOMEInstallationStep">
17
      <PostTXMHOMEInstallationStep
18
            class="org.txm.statsengine.r.core.InstallRUserPart"
19
            description="description"
20
            name="org.txm.statsengine.r.core.InstallRUserPart">
21
      </PostTXMHOMEInstallationStep>
22
   </extension>
15 23

  
16 24
</plugin>
tmp/org.txm.statsengine.r.core/R/HelloWorld.R (revision 735)
1
print("Hello World!")
tmp/org.txm.statsengine.r.core/R/TXTCSV2Alceste.R (revision 735)
1
# Script R écrit par Lise Vaudor (UMR 5600 EVS) en mars 2012
2

  
3
setwd(choose.dir())  # choix du répertoire de travail
4
metadata=read.table("metadata.csv",sep=",",header=T)
5
write.table("texte_tot.txt")
6

  
7
for (i in 1:nrow(metadata)){   # on parcourt un à un les lignes du fichier de métadonnées
8
   namefile=paste(metadata$id[i],".txt",sep="") # on considère le fichier dont le nom est donnée à la ième ligne
9
   descripteur_i=c("****")
10
   for (j in 1:ncol(metadata)){
11
         descripteur_i=paste(descripteur_i," *",colnames(metadata)[j],"_",metadata[i,j],sep="")  # on parcourt l'ensemble des colonnes de metadata pour créer le descripteur
12
   }
13
   cat(descripteur_i, file="texte_tot.txt",append=T)  # on concatène au fichier texte_tot le decripteur...
14
   cat("\n", file="texte_tot.txt",append=T)                # des sauts de ligne...
15
   cat(scan(namefile, what="character"), file="texte_tot.txt",append=T) # le texte qui nous intéresse...
16
   cat("\n", file="texte_tot.txt",append=T)                # re-des sauts de ligne
17
   cat("\n", file="texte_tot.txt",append=T)
18
}
tmp/org.txm.statsengine.r.core/R/plot100.R (revision 735)
1
x <- rnorm(100)
2
y <- rnorm(100)
3
plot(x, y)
tmp/org.txm.statsengine.r.core/R/sample.R (revision 735)
1
x <- rnorm(100)
2
show(x)
tmp/org.txm.groovy.core/plugin.xml (revision 735)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.4"?>
3
<plugin>
4
   <extension
5
         point="org.txm.PostTXMHOMEInstallationStep">
6
      <PostTXMHOMEInstallationStep
7
            class="org.txm.groovy.core.InstallGroovyFiles"
8
            description="Install Groovy Files"
9
            name="org.txm.groovy.core.PostTXMHOMEInstallationStep2">
10
      </PostTXMHOMEInstallationStep>
11
   </extension>
12

  
13
</plugin>
0 14

  
tmp/org.txm.groovy.core/META-INF/MANIFEST.MF (revision 735)
1 1
Manifest-Version: 1.0
2 2
Bundle-ManifestVersion: 2
3 3
Bundle-Name: Macro
4
Bundle-SymbolicName: org.txm.groovy.core
4
Bundle-SymbolicName: org.txm.groovy.core;singleton:=true
5 5
Bundle-Version: 1.0.0.qualifier
6 6
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
7 7
Require-Bundle: org.txm.libs.groovy-all;bundle-version="2.3.3",
tmp/org.txm.groovy.core/src/groovy/org/txm/groovy/core/InstallGroovyFiles.java (revision 735)
1
package org.txm.groovy.core;
2

  
3
import java.io.File;
4
import java.util.HashMap;
5

  
6
import org.txm.PostTXMHOMEInstallationStep;
7
import org.txm.objects.Workspace;
8
import org.txm.utils.BundleUtils;
9
import org.txm.utils.DeleteDir;
10

  
11
public class InstallGroovyFiles extends PostTXMHOMEInstallationStep {
12

  
13
	@Override
14
	public boolean install(Workspace workspace) {
15
		File txmhomedir = workspace.getLocation();
16
		
17
		String createfolders[] = {"scripts", "scripts/lib", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
18
				"scripts/macro", "scripts/user", "scripts/import"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
19
		
20
		for (String folder : createfolders) {
21
			new File(txmhomedir, folder).mkdirs();
22
		}
23
		File scriptsDirectory = new File(txmhomedir, "scripts");
24
		File importDirectory = new File(scriptsDirectory, "import");
25
		File macroDirectory = new File(scriptsDirectory, "macro");
26
		File samplesDirectory = new File(scriptsDirectory, "samples/groovy");
27
		
28
		HashMap<String, String> publishedImports = new HashMap<String, String>();
29
		String IMPORTERPACKAGE="org/txm/importer/";
30
		publishedImports.put(IMPORTERPACKAGE+"alceste","alcesteLoader.groovy");
31
		publishedImports.put(IMPORTERPACKAGE+"discours","discoursLoader.groovy");
32
		publishedImports.put(IMPORTERPACKAGE+"bfm","bfmLoader.groovy");
33
		publishedImports.put(IMPORTERPACKAGE+"frantext","frantextLoader.groovy");
34
		publishedImports.put(IMPORTERPACKAGE+"hyperbase","hyperbaseLoader.groovy");
35
		publishedImports.put(IMPORTERPACKAGE+"txt","txtLoader.groovy");
36
		publishedImports.put(IMPORTERPACKAGE+"xml","xmlLoader.groovy");
37
		publishedImports.put(IMPORTERPACKAGE+"factiva","factivaLoader.groovy");
38
		publishedImports.put(IMPORTERPACKAGE+"factiva","factivamailLoader.groovy");
39
		publishedImports.put(IMPORTERPACKAGE+"xmltxm","xmltxmLoader.groovy");
40
		publishedImports.put(IMPORTERPACKAGE+"transcriber","transcriberLoader.groovy");
41
		publishedImports.put(IMPORTERPACKAGE+"tmx","tmxLoader.groovy");
42
		publishedImports.put(IMPORTERPACKAGE+"doc","docLoader.groovy");
43
		publishedImports.put(IMPORTERPACKAGE+"wtc","wtcLoader.groovy");
44
		
45
		String bundle_id = "org.txm.groovy.core";
46
		for (String p : publishedImports.keySet()) {
47
			BundleUtils.copyFiles(bundle_id, "src/groovy/", p, publishedImports.get(p), importDirectory);
48
		}
49
		
50
		// copy published macros
51
		BundleUtils.copyFiles(bundle_id, "src/groovy/", "org/txm", "macro", macroDirectory);
52
		
53
		// copy sample Groovy scripts
54
		BundleUtils.copyFiles(bundle_id, "src/groovy/", "org/txm", "export", samplesDirectory);
55
		BundleUtils.copyFiles(bundle_id, "src/groovy/", "org/txm", "functions", samplesDirectory);
56
		BundleUtils.copyFiles(bundle_id, "src/groovy/", "org/txm", "importer", samplesDirectory);
57
		BundleUtils.copyFiles(bundle_id, "src/groovy/", "org/txm", "sw", samplesDirectory);
58
		BundleUtils.copyFiles(bundle_id, "src/groovy/", "org/txm", "tal", samplesDirectory);
59
		
60
		// remove some sample scripts
61
		new File(samplesDirectory, "ReleaseFunctionsValidation.groovy").delete();
62
		new File(samplesDirectory, "ReleaseLoadersValidation.groovy").delete();
63
		new File(samplesDirectory, "org/txm/AntTest.groovy").delete();
64
		new File(samplesDirectory, "org/txm/Build.java").delete();
65
		new File(samplesDirectory, "org/txm/Build2.java").delete();
66
		new File(samplesDirectory, "org/txm/Build3.groovy").delete();
67
		DeleteDir.deleteDirectory(new File(samplesDirectory, "org/txm/setup"));
68
		DeleteDir.deleteDirectory(new File(samplesDirectory, "org/txm/i18n"));
69
		DeleteDir.deleteDirectory(new File(samplesDirectory, "org/txm/svn"));
70
		
71
		return false;
72
	}
73

  
74
	@Override
75
	public String getName() {
76
		return "Groovy (org.txm.groovy.core)";
77
	}
78

  
79
}
0 80

  
tmp/org.txm.groovy.core/build.properties (revision 735)
2 2
output.. = bin/
3 3
bin.includes = META-INF/,\
4 4
               .,\
5
               bin/
5
               bin/,\
6
               plugin.xml
6 7
jars.compile.order = .

Also available in: Unified diff