1132 |
1132 |
this.pImportModuleName = name;
|
1133 |
1133 |
}
|
1134 |
1134 |
|
|
1135 |
/**
|
|
1136 |
* Checks if the edition specified by its name exists in the project.
|
|
1137 |
*
|
|
1138 |
* @param name the edition to check
|
|
1139 |
*
|
|
1140 |
* @return true if the edition exists otherwise false
|
|
1141 |
*/
|
1135 |
1142 |
public boolean hasEditionDefinition(String name) {
|
1136 |
1143 |
try {
|
1137 |
1144 |
return getPreferencesScope().getNode("EditionDefinition").nodeExists(name);
|
... | ... | |
1143 |
1150 |
}
|
1144 |
1151 |
|
1145 |
1152 |
/**
|
1146 |
|
* Gets the project parameters root path ("/project/[project name]/")
|
1147 |
|
* @return
|
|
1153 |
* Gets the project parameters root node path ("/project/[project name]/")
|
|
1154 |
*
|
|
1155 |
* @return the project parameters root node path
|
1148 |
1156 |
*/
|
1149 |
1157 |
public String getParametersNodeRootPath() {
|
1150 |
1158 |
return "/project/" + this.rcpProject.getName() + "/";
|
1151 |
1159 |
}
|
1152 |
1160 |
|
|
1161 |
/**
|
|
1162 |
* Gets a list of all the root corpus in the project.
|
|
1163 |
*
|
|
1164 |
* @return a list of all the root corpus in the project if some exists otherwise an empty list
|
|
1165 |
*/
|
1153 |
1166 |
public List<? extends CorpusBuild> getCorpora() {
|
1154 |
1167 |
ArrayList<CorpusBuild> l = new ArrayList<>();
|
1155 |
|
for (TXMResult r : getChildren()) {
|
|
1168 |
for (TXMResult r : this.getChildren()) {
|
1156 |
1169 |
if (r instanceof CorpusBuild) {
|
1157 |
1170 |
l.add((CorpusBuild)r);
|
1158 |
1171 |
}
|
... | ... | |
1181 |
1194 |
* @param rcpProject
|
1182 |
1195 |
*/
|
1183 |
1196 |
public static void loadProjectFromProjectScope(IProject rcpProject) {
|
1184 |
|
//IScopeContext projectScope = new ProjectScope(projects[i]);
|
1185 |
|
ArrayList<String> resultNodePaths = TXMPreferences.getAllResultsNodePaths("/project/" + rcpProject.getName() + "/");
|
1186 |
1197 |
|
1187 |
|
Log.fine("Toolbox.initialize(): loading project " + rcpProject.getName() + "...");
|
1188 |
|
Log.fine("Toolbox.initialize(): " + resultNodePaths.size() + " node(s) found in project " + rcpProject.getName() + "...");
|
|
1198 |
ArrayList<String> resultNodePaths = TXMPreferences.getAllResultsNodePaths("/project/" + rcpProject.getName() + "/"); //$NON-NLS-1$ //$NON-NLS-2$
|
1189 |
1199 |
|
|
1200 |
Log.fine("Toolbox.initialize(): loading project " + rcpProject.getName() + "..."); //$NON-NLS-1$ //$NON-NLS-2$
|
|
1201 |
Log.fine("Toolbox.initialize(): " + resultNodePaths.size() + " node(s) found in project " + rcpProject.getName() + "..."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
1202 |
|
1190 |
1203 |
for (String parametersNodePath : resultNodePaths) {
|
1191 |
1204 |
|
|
1205 |
// FIXME: useless?
|
1192 |
1206 |
// skip non-TXMResult preference node
|
1193 |
1207 |
// if (TXMPreferences.getString(TXMPreferences.BUNDLE_ID, nodeQualifier).isEmpty()) {
|
1194 |
1208 |
// continue;
|
... | ... | |
1212 |
1226 |
}
|
1213 |
1227 |
|
1214 |
1228 |
Log.fine("Toolbox.initialize(): loading from result node path " + parametersNodePath);
|
1215 |
|
//Log.finest("Toolbox.initialize(): class = " + TXMPreferences.getString("class", nodeQualifier)nodeitialize(): class = " + className); //$NON-NLS-1$
|
1216 |
|
Log.finest("Toolbox.initialize(): parent_uuid = " + node.get(TXMPreferences.PARENT_PARAMETERS_NODE_PATH, "")); //$NON-NLS-1$
|
|
1229 |
Log.finest("Toolbox.initialize(): parent_uuid = " + node.get(TXMPreferences.PARENT_PARAMETERS_NODE_PATH, "")); //$NON-NLS-1$ //$NON-NLS-2$
|
|
1230 |
|
1217 |
1231 |
String bundleId = node.get(TXMPreferences.BUNDLE_ID, ""); //$NON-NLS-1$
|
1218 |
1232 |
Log.finest("Toolbox.initialize(): bundle_id = " + bundleId); //$NON-NLS-1$
|
|
1233 |
|
1219 |
1234 |
Bundle bundle = Platform.getBundle(bundleId);
|
1220 |
1235 |
if (bundle == null) {
|
1221 |
1236 |
Log.finest("Warning: can not restore object with bundle name " + bundleId); //$NON-NLS-1$
|
... | ... | |
1223 |
1238 |
continue;
|
1224 |
1239 |
}
|
1225 |
1240 |
|
1226 |
|
Log.fine("Toolbox.initialize(): creating project " + rcpProject.getName() + ".");
|
|
1241 |
Log.fine("Toolbox.initialize(): creating project " + rcpProject.getName() + "."); //$NON-NLS-1$ //$NON-NLS-2$
|
1227 |
1242 |
Class<?> cl = bundle.loadClass(className);
|
1228 |
1243 |
Constructor<?> cons = cl.getConstructor(String.class);
|
1229 |
1244 |
TXMResult result = (TXMResult) cons.newInstance(parametersNodePath);
|
... | ... | |
1242 |
1257 |
}
|
1243 |
1258 |
|
1244 |
1259 |
/**
|
1245 |
|
* store parameters and save in the properties files
|
|
1260 |
* Stores parameters of all the Project and all its results in nodes and saves them in the properties files.
|
1246 |
1261 |
*
|
1247 |
|
* @return
|
|
1262 |
* @return true if the save has well been done otherwise false
|
1248 |
1263 |
*/
|
1249 |
|
// FIXME: SJ: need to see if we need this, it doesn't seem. MD: I need this for exporting corpus and saving import parameters
|
1250 |
1264 |
public boolean save() {
|
1251 |
1265 |
try {
|
1252 |
1266 |
ProjectScope scope = this.getPreferencesScope();
|
1253 |
|
scope.getNode("").flush();
|
|
1267 |
scope.getNode("").flush(); //$NON-NLS-1$
|
1254 |
1268 |
|
1255 |
1269 |
autoSaveParametersFromAnnotations();
|
1256 |
1270 |
saveParameters();
|
... | ... | |
1273 |
1287 |
return true;
|
1274 |
1288 |
}
|
1275 |
1289 |
|
|
1290 |
/**
|
|
1291 |
*
|
|
1292 |
* @return
|
|
1293 |
*/
|
1276 |
1294 |
public IProject getRCPProject() {
|
1277 |
1295 |
return rcpProject;
|
1278 |
1296 |
}
|
1279 |
1297 |
|
|
1298 |
@Override
|
1280 |
1299 |
public String toString() {
|
1281 |
1300 |
return this.userName+((this.rcpProject != null && this.rcpProject.getLocation() != null)?" ("+this.rcpProject.getLocation()+")":"");
|
1282 |
1301 |
}
|
1283 |
1302 |
|
|
1303 |
/**
|
|
1304 |
* Gets a list of all the built edition names.
|
|
1305 |
*
|
|
1306 |
* @return a list of all the built edition names if some exists otherwise an empty list
|
|
1307 |
*/
|
1284 |
1308 |
public List<String> getBuiltEditionNames() {
|
1285 |
1309 |
ArrayList<String> availableEditions = new ArrayList<String>();
|
1286 |
1310 |
for (String name : this.getEditionNames()) {
|