Révision 3450
| TXM/trunk/org.txm.specificities.rcp/src/org/txm/specificities/rcp/adapters/SpecificitiesAdapterFactory.java (revision 3450) | ||
|---|---|---|
| 23 | 23 |
|
| 24 | 24 |
public static final ImageDescriptor ICON = |
| 25 | 25 |
AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(SpecificitiesAdapterFactory.class).getSymbolicName(), |
| 26 |
"platform:/plugin/"+ FrameworkUtil.getBundle(SpecificitiesAdapterFactory.class).getSymbolicName() + "/icons/functions/specificities.png"); //$NON-NLS-1$ |
|
| 26 |
"platform:/plugin/"+ FrameworkUtil.getBundle(SpecificitiesAdapterFactory.class).getSymbolicName() + "/icons/functions/specificities.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 27 | 27 |
public static final ImageDescriptor ICON_SELECTION = |
| 28 | 28 |
AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(SpecificitiesAdapterFactory.class).getSymbolicName(), |
| 29 |
"platform:/plugin/"+ FrameworkUtil.getBundle(SpecificitiesAdapterFactory.class).getSymbolicName() + "/icons/functions/specificities_selection.png"); //$NON-NLS-1$ |
|
| 29 |
"platform:/plugin/"+ FrameworkUtil.getBundle(SpecificitiesAdapterFactory.class).getSymbolicName() + "/icons/functions/specificities_selection.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 30 | 30 |
|
| 31 | 31 |
|
| 32 | 32 |
@Override |
| TXM/trunk/org.txm.specificities.rcp/src/org/txm/specificities/rcp/messages/messages.properties (revision 3450) | ||
|---|---|---|
| 7 | 7 |
failedToComputeSpecificities=** Failed to compute specificities\: {0}.
|
| 8 | 8 |
groupBarsByLines=Group the bars by the rows of the table |
| 9 | 9 |
maximumScore=Maximum score |
| 10 |
maximumScoreToDisplay=The maximum score to display |
|
| 10 | 11 |
scoresFormatDefaultIsPercent1f=Scores format (default is %,.1f) |
| 11 | 12 |
specificities=Specificities |
| 12 | 13 |
t=\ T |
| TXM/trunk/org.txm.specificities.rcp/src/org/txm/specificities/rcp/messages/SpecificitiesUIMessages.java (revision 3450) | ||
|---|---|---|
| 25 | 25 |
public static String failedToComputeSpecificities; |
| 26 | 26 |
public static String t; |
| 27 | 27 |
|
| 28 |
public static String index; |
|
| 28 |
public static String index; |
|
| 29 |
|
|
| 30 |
public static String maximumScoreToDisplay; |
|
| 29 | 31 |
|
| 30 | 32 |
static {
|
| 31 | 33 |
// initialize resource bundle |
| TXM/trunk/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesSelectionEditor.java (revision 3450) | ||
|---|---|---|
| 48 | 48 |
// Group bars by lines |
| 49 | 49 |
this.groupBarsByLines = new ToolItem(this.getToolBar(), SWT.CHECK); |
| 50 | 50 |
this.groupBarsByLines.setToolTipText(SpecificitiesUIMessages.groupBarsByLines); |
| 51 |
this.groupBarsByLines.setImage(IImageKeys.getImage(ComputeSpecifities.class, "icons/silk_group_bars_by_lines.png")); |
|
| 51 |
this.groupBarsByLines.setImage(IImageKeys.getImage(ComputeSpecifities.class, "icons/silk_group_bars_by_lines.png")); //$NON-NLS-1$
|
|
| 52 | 52 |
this.groupBarsByLines.addSelectionListener(computeSelectionListener); |
| 53 | 53 |
|
| 54 | 54 |
// Banality |
| TXM/trunk/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesTableLabelProvider.java (revision 3450) | ||
|---|---|---|
| 79 | 79 |
return null; |
| 80 | 80 |
} |
| 81 | 81 |
|
| 82 |
public static final String EMPTY = ""; |
|
| 82 |
public static final String EMPTY = ""; //$NON-NLS-1$
|
|
| 83 | 83 |
|
| 84 | 84 |
/* |
| 85 | 85 |
* (non-Javadoc) |
| TXM/trunk/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 3450) | ||
|---|---|---|
| 146 | 146 |
Composite extendedParametersArea = this.getExtendedParametersGroup(); |
| 147 | 147 |
|
| 148 | 148 |
// max score |
| 149 |
LabeledSpinner maxScore = new LabeledSpinner(extendedParametersArea, this, "Maximum score", "The maximum score to display");
|
|
| 149 |
LabeledSpinner maxScore = new LabeledSpinner(extendedParametersArea, this, SpecificitiesUIMessages.maximumScore, SpecificitiesUIMessages.maximumScoreToDisplay);
|
|
| 150 | 150 |
this.maxScoreFilter = maxScore.getSpinner(); |
| 151 | 151 |
this.maxScoreFilter.setMinimum(0); |
| 152 | 152 |
this.maxScoreFilter.setMaximum(100000); |
| TXM/trunk/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/PluginMessagesManager.java (revision 3450) | ||
|---|---|---|
| 1037 | 1037 |
*/ |
| 1038 | 1038 |
// dict.summary(); |
| 1039 | 1039 |
|
| 1040 |
pmManager.saveChanges(false); |
|
| 1040 |
//pmManager.saveChanges(false);
|
|
| 1041 | 1041 |
|
| 1042 | 1042 |
System.out.println("dir=" + pmManager.getProjectDirectory());
|
| 1043 | 1043 |
System.out.println("Elapsed time:" + ((double) (System.currentTimeMillis() - startTime) / 1000));
|
| TXM/trunk/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/adapters/WordCloudAdapterFactory.java (revision 3450) | ||
|---|---|---|
| 19 | 19 |
|
| 20 | 20 |
|
| 21 | 21 |
public static final ImageDescriptor ICON = AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(WordCloudAdapterFactory.class).getSymbolicName(), |
| 22 |
"platform:/plugin/" + FrameworkUtil.getBundle(WordCloudAdapterFactory.class).getSymbolicName() + "/icons/functions/wordcloud.png"); //$NON-NLS-1$ |
|
| 22 |
"platform:/plugin/" + FrameworkUtil.getBundle(WordCloudAdapterFactory.class).getSymbolicName() + "/icons/functions/wordcloud.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 23 | 23 |
|
| 24 | 24 |
|
| 25 | 25 |
|
| TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/tigersearch/rcp/Messages.java (revision 3450) | ||
|---|---|---|
| 1 |
package org.txm.tigersearch.rcp; |
|
| 2 |
|
|
| 3 |
import org.eclipse.osgi.util.NLS; |
|
| 4 |
|
|
| 5 |
public class Messages extends NLS {
|
|
| 6 |
|
|
| 7 |
private static final String BUNDLE_NAME = "org.txm.tigersearch.rcp.messages"; //$NON-NLS-1$ |
|
| 8 |
|
|
| 9 |
public static String ErrorCantFindCorpusDirectoryP0; |
|
| 10 |
|
|
| 11 |
public static String ErrorInTSIndexNoLabelEtc; |
|
| 12 |
|
|
| 13 |
public static String ErrorInTSIndexTooManyLabelsEtc; |
|
| 14 |
|
|
| 15 |
public static String ErrorWhilePropertiesProjectionP0; |
|
| 16 |
|
|
| 17 |
public static String ErrorWhileQueingTIGERSearchP0; |
|
| 18 |
|
|
| 19 |
public static String FailToRenderSVGMatchForSentEqualsP0AndSubEqualsP1; |
|
| 20 |
|
|
| 21 |
public static String TIGERSearchCorpusNotFoundInP0; |
|
| 22 |
static {
|
|
| 23 |
// initialize resource bundle |
|
| 24 |
NLS.initializeMessages(BUNDLE_NAME, Messages.class); |
|
| 25 |
} |
|
| 26 |
|
|
| 27 |
private Messages() {}
|
|
| 28 |
} |
|
| 0 | 29 | |
| TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/tigersearch/rcp/messages.properties (revision 3450) | ||
|---|---|---|
| 1 |
ErrorCantFindCorpusDirectoryP0=Error: can't find corpus directory: |
|
| 2 |
ErrorInTSIndexNoLabelEtc=** Error in TSIndex: no label '@' or 'pivot' found in TIGERSearch query. Aborting. |
|
| 3 |
ErrorInTSIndexTooManyLabelsEtc=** Error in TSIndex: too many labels '@' or 'pivot' found in TIGERSearch query. Aborting. |
|
| 4 |
ErrorWhilePropertiesProjectionP0=Error while properties projection: {0}
|
|
| 5 |
ErrorWhileQueingTIGERSearchP0=Error while queing TIGERSearch: {0}
|
|
| 6 |
FailToRenderSVGMatchForSentEqualsP0AndSubEqualsP1=Fail to render SVG match for sent={0} and sub={1}
|
|
| 7 |
TIGERSearchCorpusNotFoundInP0=TIGERSearch corpus not found in |
|
| 0 | 8 | |
| TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TSIndex.java (revision 3450) | ||
|---|---|---|
| 34 | 34 |
import org.txm.searchengine.ts.TSCorpus; |
| 35 | 35 |
import org.txm.searchengine.ts.TSCorpusManager; |
| 36 | 36 |
import org.txm.searchengine.ts.TSResult; |
| 37 |
import org.txm.tigersearch.rcp.Messages; |
|
| 37 | 38 |
import org.txm.utils.logger.Log; |
| 38 | 39 |
|
| 39 | 40 |
public class TSIndex extends Index {
|
| 40 | 41 |
|
| 41 |
public static final String EDITIONID = "editionId"; |
|
| 42 |
public static final String EDITIONID = "editionId"; //$NON-NLS-1$
|
|
| 42 | 43 |
|
| 43 | 44 |
public TSIndex(CQPCorpus corpus, List<WordProperty> props) |
| 44 | 45 |
throws CqiClientException, IOException, CqiServerError {
|
| 45 | 46 |
super(corpus); |
| 46 |
this.setParameters(new CQLQuery("[]"), props, null, null, null, null);
|
|
| 47 |
this.setParameters(new CQLQuery("[]"), props, null, null, null, null); //$NON-NLS-1$
|
|
| 47 | 48 |
} |
| 48 | 49 |
|
| 49 | 50 |
public TSIndex(CQPCorpus corpus, CQLQuery query, List<WordProperty> props) |
| ... | ... | |
| 69 | 70 |
if (isTigerInitialized) return isTigerInitialized; |
| 70 | 71 |
|
| 71 | 72 |
String id = getCorpus().getMainCorpus().getName(); |
| 72 |
File configfile = new File(getCorpus().getProjectDirectory(), "tiger/tigersearch.logprop"); |
|
| 73 |
File registrydir = new File(getCorpus().getProjectDirectory(), "tiger"); |
|
| 73 |
File configfile = new File(getCorpus().getProjectDirectory(), "tiger/tigersearch.logprop"); //$NON-NLS-1$
|
|
| 74 |
File registrydir = new File(getCorpus().getProjectDirectory(), "tiger"); //$NON-NLS-1$
|
|
| 74 | 75 |
|
| 75 | 76 |
TSCorpusManager manager = new TSCorpusManager(registrydir, configfile); |
| 76 | 77 |
if (manager.isInitialized()) {
|
| 77 | 78 |
tscorpus = manager.getCorpus(id); |
| 78 | 79 |
if (tscorpus == null) {
|
| 79 |
System.out.println("TIGERSearch corpus not found in " + registrydir);
|
|
| 80 |
System.out.println("TIGERSearch corpus not found in " + registrydir); //$NON-NLS-1$
|
|
| 80 | 81 |
isTigerInitialized = false; |
| 81 | 82 |
} |
| 82 | 83 |
|
| ... | ... | |
| 110 | 111 |
matches = getMatchesFromTSQuery(corp); |
| 111 | 112 |
} |
| 112 | 113 |
catch (Exception e1) {
|
| 113 |
System.out.println("Error while queing TIGERSearch: " + e1);
|
|
| 114 |
System.out.println(Messages.ErrorWhileQueingTIGERSearchP0 + e1);
|
|
| 114 | 115 |
e1.printStackTrace(); |
| 115 | 116 |
return false; |
| 116 | 117 |
} |
| ... | ... | |
| 162 | 163 |
} |
| 163 | 164 |
} |
| 164 | 165 |
catch (Exception e) {
|
| 165 |
System.out.println("Error while properties projection: " + e);
|
|
| 166 |
System.out.println(Messages.ErrorWhilePropertiesProjectionP0 + e);
|
|
| 166 | 167 |
Log.printStackTrace(e); |
| 167 | 168 |
return false; |
| 168 | 169 |
} |
| ... | ... | |
| 221 | 222 |
MatchResult result = tsresult.getMatchResult(); |
| 222 | 223 |
|
| 223 | 224 |
int var_ok = 0; |
| 224 |
String label = "@|pivot"; |
|
| 225 |
String label = "@|pivot"; //$NON-NLS-1$
|
|
| 225 | 226 |
Pattern p = Pattern.compile(label); |
| 226 | 227 |
for (String var : result.getVariableNames()) {
|
| 227 | 228 |
if (p.matcher(var).matches()) var_ok++; |
| 228 | 229 |
} |
| 229 | 230 |
if (var_ok == 0) {
|
| 230 |
System.out.println("** Error in TSIndex: no label '@' or 'pivot' found in TIGERSearch query. Aborting.");
|
|
| 231 |
System.out.println(Messages.ErrorInTSIndexNoLabelEtc);
|
|
| 231 | 232 |
return matches; |
| 232 | 233 |
} |
| 233 | 234 |
else if (var_ok > 1) {
|
| 234 |
System.out.println("** Error in TSIndex: too many labels '@' or 'pivot' found in TIGERSearch query. Aborting.");
|
|
| 235 |
System.out.println(Messages.ErrorInTSIndexTooManyLabelsEtc);
|
|
| 235 | 236 |
return matches; |
| 236 | 237 |
} |
| 237 | 238 |
|
| ... | ... | |
| 248 | 249 |
|
| 249 | 250 |
int size = forest.getForestSize(); |
| 250 | 251 |
for (int match_no = 0; match_no < size; match_no++) {
|
| 251 |
if (debug) System.out.println("Match " + match_no);
|
|
| 252 |
if (debug) System.out.println("Match " + match_no); //$NON-NLS-1$
|
|
| 252 | 253 |
int sentno = result.getSentenceNumberAt(match_no); |
| 253 | 254 |
Sentence sentence = manager.getSentence(sentno); |
| 254 | 255 |
|
| ... | ... | |
| 256 | 257 |
int n = result.getSentenceSubmatchSize(sentno); |
| 257 | 258 |
|
| 258 | 259 |
for (int iSubMatch = 0; iSubMatch < n; iSubMatch++) {
|
| 259 |
if (debug) System.out.println(" Sub " + iSubMatch);
|
|
| 260 |
if (debug) System.out.println(" Sub " + iSubMatch); //$NON-NLS-1$
|
|
| 260 | 261 |
int[] var_values = result.getSentenceSubmatchAt(sentno, iSubMatch); |
| 261 | 262 |
int value; |
| 262 | 263 |
for (int j = 0; j < var_values.length; j++) {
|
| 263 |
if (debug) System.out.println(" Var " + j + " name=" + result.getVariableName(j));
|
|
| 264 |
if (debug) System.out.println(" Var " + j + " name=" + result.getVariableName(j)); //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 264 | 265 |
value = var_values[j]; |
| 265 | 266 |
if (value >= 0) {
|
| 266 | 267 |
String var_name = result.getVariableName(j); |
| 267 | 268 |
Node referred = sentence.getNode(value); |
| 268 | 269 |
if (p.matcher(var_name).matches()) {
|
| 269 | 270 |
if (referred instanceof T_Node) {
|
| 270 |
if (debug) System.out.println(" Node: " + referred.getFeature(EDITIONID));
|
|
| 271 |
if (debug) System.out.println(" Node: " + referred.getFeature(EDITIONID)); //$NON-NLS-1$
|
|
| 271 | 272 |
matchingTnodesID.add(referred.getFeature(EDITIONID)); |
| 272 | 273 |
} |
| 273 | 274 |
else if (referred instanceof NT_Node) {
|
| ... | ... | |
| 322 | 323 |
|
| 323 | 324 |
HashSet<String> matchingTnodesIDFiltered = new HashSet<>(); |
| 324 | 325 |
for (String s : matchingTnodesID) {
|
| 325 |
if (s == null || s.length() == 0 || s.endsWith("_dupl")) {
|
|
| 326 |
if (s == null || s.length() == 0 || s.endsWith("_dupl")) { //$NON-NLS-1$
|
|
| 326 | 327 |
|
| 327 | 328 |
} |
| 328 | 329 |
else {
|
| ... | ... | |
| 330 | 331 |
} |
| 331 | 332 |
} |
| 332 | 333 |
|
| 333 |
if (debug) System.out.println("Matching ids: " + matchingTnodesIDFiltered);
|
|
| 334 |
if (debug) System.out.println("Matching ids: " + matchingTnodesIDFiltered); //$NON-NLS-1$
|
|
| 334 | 335 |
String[] strings = new String[matchingTnodesIDFiltered.size()]; |
| 335 | 336 |
int i = 0; |
| 336 | 337 |
for (String s : matchingTnodesIDFiltered) |
| ... | ... | |
| 365 | 366 |
boolean debug = false; |
| 366 | 367 |
ArrayList<Match> matches = new ArrayList<>(); |
| 367 | 368 |
AbstractCqiClient CQI = CQPSearchEngine.getCqiClient(); |
| 368 |
Property idProperty = getCorpus().getProperty("id");
|
|
| 369 |
Property idProperty = getCorpus().getProperty("id"); //$NON-NLS-1$
|
|
| 369 | 370 |
|
| 370 |
if (debug) System.out.println("Call CQI.str2Id with strings.len=" + strings.length);
|
|
| 371 |
if (debug) System.out.println("Call CQI.str2Id with strings.len=" + strings.length); //$NON-NLS-1$
|
|
| 371 | 372 |
if (debug) System.out.println(Arrays.toString(strings)); |
| 372 | 373 |
if (debug) System.out.flush(); |
| 373 | 374 |
|
| 374 | 375 |
int[] ids = CQI.str2Id(idProperty.getQualifiedName(), strings); |
| 375 | 376 |
|
| 376 |
if (debug) System.out.println("Call CQI.idList2Cpos with strings.len=" + ids.length);
|
|
| 377 |
if (debug) System.out.println("Call CQI.idList2Cpos with strings.len=" + ids.length); //$NON-NLS-1$
|
|
| 377 | 378 |
if (debug) System.out.println(Arrays.toString(ids)); |
| 378 | 379 |
if (debug) System.out.flush(); |
| 379 | 380 |
|
| ... | ... | |
| 390 | 391 |
positions[i++] = p; |
| 391 | 392 |
positionsSet = null; |
| 392 | 393 |
Arrays.sort(positions); |
| 393 |
if (debug) System.out.println("Positions: " + Arrays.toString(positions));
|
|
| 394 |
if (debug) System.out.println("Positions: " + Arrays.toString(positions)); //$NON-NLS-1$
|
|
| 394 | 395 |
|
| 395 | 396 |
for (int p : positions) |
| 396 | 397 |
matches.add(new Match(p, p, -1)); |
| TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java (revision 3450) | ||
|---|---|---|
| 22 | 22 |
import org.txm.searchengine.ts.TSMatch; |
| 23 | 23 |
import org.txm.searchengine.ts.TSResult; |
| 24 | 24 |
import org.txm.tigersearch.preferences.TigerSearchPreferences; |
| 25 |
import org.txm.tigersearch.rcp.Messages; |
|
| 25 | 26 |
import org.txm.treesearch.function.TreeSearch; |
| 26 | 27 |
import org.txm.treesearch.function.TreeSearchSelector; |
| 27 | 28 |
import org.txm.utils.TXMProgressMonitor; |
| ... | ... | |
| 53 | 54 |
|
| 54 | 55 |
String id = corpus.getRootCorpusBuild().getName(); |
| 55 | 56 |
|
| 56 |
File tsRegistryDirectory = new File(corpus.getProjectDirectory(), "tiger"); |
|
| 57 |
File configfile = new File(tsRegistryDirectory, "tigersearch.logprop"); |
|
| 57 |
File tsRegistryDirectory = new File(corpus.getProjectDirectory(), "tiger"); //$NON-NLS-1$
|
|
| 58 |
File configfile = new File(tsRegistryDirectory, "tigersearch.logprop"); //$NON-NLS-1$
|
|
| 58 | 59 |
File tscorpusdir = new File(tsRegistryDirectory, id); |
| 59 | 60 |
|
| 60 | 61 |
if (!tscorpusdir.exists()) {
|
| 61 |
System.out.println("Error: can't find corpus directory: " + tscorpusdir);
|
|
| 62 |
System.out.println(Messages.ErrorCantFindCorpusDirectoryP0 + tscorpusdir);
|
|
| 62 | 63 |
return; |
| 63 | 64 |
} |
| 64 | 65 |
|
| ... | ... | |
| 67 | 68 |
|
| 68 | 69 |
tscorpus = manager.getCorpus(id); |
| 69 | 70 |
if (tscorpus == null) {
|
| 70 |
System.out.println("TIGERSearch corpus not found in " + tsRegistryDirectory);
|
|
| 71 |
System.out.println(Messages.TIGERSearchCorpusNotFoundInP0 + tsRegistryDirectory);
|
|
| 71 | 72 |
ready = false; |
| 72 | 73 |
|
| 73 | 74 |
return; |
| ... | ... | |
| 112 | 113 |
svgFile.delete(); |
| 113 | 114 |
match.toSVGFile(svgFile); |
| 114 | 115 |
if (!svgFile.exists()) {
|
| 115 |
System.out.println("Fail to render SVG match for sent=" + sent + " and sub=" + sub);
|
|
| 116 |
System.out.println(Messages.FailToRenderSVGMatchForSentEqualsP0AndSubEqualsP1 + sent + " and sub=" + sub); //$NON-NLS-2$
|
|
| 116 | 117 |
return false; |
| 117 | 118 |
} |
| 118 | 119 |
} |
| ... | ... | |
| 174 | 175 |
*/ |
| 175 | 176 |
public String getQuery() {
|
| 176 | 177 |
if (pQuery == null || pQuery.getQueryString().length() ==0) {
|
| 177 |
return "root(#n1)"; |
|
| 178 |
return "root(#n1)"; //$NON-NLS-1$
|
|
| 178 | 179 |
} else {
|
| 179 | 180 |
return pQuery.getQueryString(); |
| 180 | 181 |
} |
| ... | ... | |
| 183 | 184 |
@Override |
| 184 | 185 |
public String toString() {
|
| 185 | 186 |
if (pQuery != null) |
| 186 |
return pQuery.getQueryString().substring(0, Math.min(20, pQuery.getQueryString().length())).replaceAll("\n", " ") + " T: " + T + " NT: " + NT;
|
|
| 187 |
return pQuery.getQueryString().substring(0, Math.min(20, pQuery.getQueryString().length())).replaceAll("\n", " ") + " T: " + T + " NT: " + NT; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
|
| 187 | 188 |
|
| 188 |
return "" + corpus; |
|
| 189 |
return "" + corpus; //$NON-NLS-1$
|
|
| 189 | 190 |
} |
| 190 | 191 |
|
| 191 | 192 |
@Override |
| ... | ... | |
| 204 | 205 |
*/ |
| 205 | 206 |
@Override |
| 206 | 207 |
public String[] getExportTXTExtensions() {
|
| 207 |
return new String[] { "*.xml" };
|
|
| 208 |
return new String[] { "*.xml" }; //$NON-NLS-1$
|
|
| 208 | 209 |
} |
| 209 | 210 |
|
| 210 | 211 |
@Override |
| ... | ... | |
| 214 | 215 |
|
| 215 | 216 |
@Override |
| 216 | 217 |
public boolean setParameters(TXMParameters parameters) {
|
| 217 |
if (parameters.getString("query") != null) {
|
|
| 218 |
this.pQuery = new TIGERQuery(parameters.getString("query"));
|
|
| 218 |
if (parameters.getString("query") != null) { //$NON-NLS-1$
|
|
| 219 |
this.pQuery = new TIGERQuery(parameters.getString("query")); //$NON-NLS-1$
|
|
| 219 | 220 |
} |
| 220 | 221 |
return true; |
| 221 | 222 |
} |
| ... | ... | |
| 238 | 239 |
tsresult = null; |
| 239 | 240 |
|
| 240 | 241 |
if (pQuery == null || pQuery.getQueryString().length() == 0) {
|
| 241 |
pQuery = new TIGERQuery("root(#n1)");
|
|
| 242 |
pQuery = new TIGERQuery("root(#n1)"); //$NON-NLS-1$
|
|
| 242 | 243 |
} |
| 243 | 244 |
|
| 244 | 245 |
tsresult = tscorpus.query(pQuery.getQueryString()); |
| ... | ... | |
| 249 | 250 |
|
| 250 | 251 |
@Override |
| 251 | 252 |
public String getResultType() {
|
| 252 |
return "TIGER search"; |
|
| 253 |
return "TIGER search"; //$NON-NLS-1$
|
|
| 253 | 254 |
} |
| 254 | 255 |
|
| 255 | 256 |
public void setIndexAndSubIndex(int sent, int sub) {
|
| ... | ... | |
| 307 | 308 |
// if (offsetsMapped != null) { // the TIGER token is not in the CQP corpus
|
| 308 | 309 |
// right += offsetsMapped.getInt(right * Integer.BYTES); |
| 309 | 310 |
// } |
| 310 |
WordProperty pid = corpus.getProperty("id");
|
|
| 311 |
StructuralUnitProperty ptextid = corpus.getStructuralUnitProperty("text_id");
|
|
| 311 |
WordProperty pid = corpus.getProperty("id"); //$NON-NLS-1$
|
|
| 312 |
StructuralUnitProperty ptextid = corpus.getStructuralUnitProperty("text_id"); //$NON-NLS-1$
|
|
| 312 | 313 |
|
| 313 | 314 |
List<String> idvalues = CQPSearchEngine.getEngine().getValuesForProperty(positions, pid); |
| 314 | 315 |
int[] structid = CQPSearchEngine.getCqiClient().cpos2Struc(ptextid.getQualifiedName(), positions); |
| 315 | 316 |
String[] values = CQPSearchEngine.getCqiClient().struc2Str(ptextid.getQualifiedName(), structid); |
| 316 | 317 |
|
| 317 | 318 |
textAndWord[0] = values[0]; |
| 318 |
textAndWord[1] = StringUtils.join(idvalues, ","); |
|
| 319 |
textAndWord[1] = StringUtils.join(idvalues, ","); //$NON-NLS-1$
|
|
| 319 | 320 |
|
| 320 | 321 |
return textAndWord; |
| 321 | 322 |
} |
| ... | ... | |
| 323 | 324 |
@Override |
| 324 | 325 |
public String getIconPath() {
|
| 325 | 326 |
|
| 326 |
return "platform:/plugin/org.txm.tigersearch.rcp/icons/functions/TS.png"; |
|
| 327 |
return "platform:/plugin/org.txm.tigersearch.rcp/icons/functions/TS.png"; //$NON-NLS-1$
|
|
| 327 | 328 |
} |
| 328 | 329 |
|
| 329 | 330 |
@Override |
| TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERTreeSearchSelector.java (revision 3450) | ||
|---|---|---|
| 11 | 11 |
|
| 12 | 12 |
public class TIGERTreeSearchSelector extends TreeSearchSelector {
|
| 13 | 13 |
|
| 14 |
public static String TIGER = "TIGER"; |
|
| 14 |
public static String TIGER = "TIGER"; //$NON-NLS-1$
|
|
| 15 | 15 |
|
| 16 | 16 |
@Override |
| 17 | 17 |
public String getEngine() {
|
| TXM/trunk/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/editors/TextsBalanceEditor.java (revision 3450) | ||
|---|---|---|
| 13 | 13 |
import org.txm.rcp.swt.widget.structures.StructuralUnitsCombosGroup; |
| 14 | 14 |
import org.txm.textsbalance.core.functions.TextsBalance; |
| 15 | 15 |
import org.txm.textsbalance.core.preferences.TextsBalancePreferences; |
| 16 |
import org.txm.textsbalance.rcp.Messages; |
|
| 16 | 17 |
|
| 17 | 18 |
/** |
| 18 | 19 |
* Texts balance editor. |
| ... | ... | |
| 56 | 57 |
public void __createPartControl() {
|
| 57 | 58 |
|
| 58 | 59 |
if (((TextsBalance)this.getResult()).getCorpus() == null) {
|
| 59 |
System.out.println("Error: no corpus");
|
|
| 60 |
System.out.println(Messages.ErrorNoCorpus);
|
|
| 60 | 61 |
return; |
| 61 | 62 |
} |
| 62 | 63 |
|
| ... | ... | |
| 66 | 67 |
|
| 67 | 68 |
Group group = new Group(parametersArea, SWT.NONE); |
| 68 | 69 |
|
| 69 |
group.setText("Count");
|
|
| 70 |
group.setText(Messages.Count);
|
|
| 70 | 71 |
group.setLayout(new RowLayout()); |
| 71 | 72 |
|
| 72 | 73 |
this.groupByTexts = new Button(group, SWT.RADIO); |
| TXM/trunk/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/preferences/TextsBalancePreferencePage.java (revision 3450) | ||
|---|---|---|
| 37 | 37 |
import org.txm.rcp.preferences.TXMPreferencePage; |
| 38 | 38 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
| 39 | 39 |
import org.txm.textsbalance.core.preferences.TextsBalancePreferences; |
| 40 |
import org.txm.textsbalance.rcp.Messages; |
|
| 40 | 41 |
import org.txm.textsbalance.rcp.adapters.TextsBalanceAdapterFactory; |
| 41 | 42 |
|
| 42 | 43 |
/** |
| ... | ... | |
| 69 | 70 |
methods[i][1] = String.valueOf(i + 1); |
| 70 | 71 |
} |
| 71 | 72 |
|
| 72 |
this.addField(new ComboFieldEditor(TextsBalancePreferences.METHOD, "Method", methods, chartsTab));
|
|
| 73 |
this.addField(new BooleanFieldEditor(TextsBalancePreferences.GROUP_BY_TEXTS, "Group by words", chartsTab));
|
|
| 73 |
this.addField(new ComboFieldEditor(TextsBalancePreferences.METHOD, Messages.Method, methods, chartsTab));
|
|
| 74 |
this.addField(new BooleanFieldEditor(TextsBalancePreferences.GROUP_BY_TEXTS, Messages.GroupByWords, chartsTab));
|
|
| 74 | 75 |
|
| 75 | 76 |
// other shared preferences |
| 76 | 77 |
SWTChartsComponentsProvider.createChartsRenderingPreferencesFields(this, chartsTab); |
| ... | ... | |
| 88 | 89 |
@Override |
| 89 | 90 |
public void init(IWorkbench workbench) {
|
| 90 | 91 |
this.setPreferenceStore(new TXMPreferenceStore(TextsBalancePreferences.getInstance().getPreferencesNodeQualifier())); |
| 91 |
this.setDescription("Texts balance charts.");
|
|
| 92 |
this.setDescription(Messages.TextsBalanceCharts);
|
|
| 92 | 93 |
this.setImageDescriptor(TextsBalanceAdapterFactory.ICON); |
| 93 | 94 |
} |
| 94 | 95 |
|
| TXM/trunk/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/messages.properties (revision 3450) | ||
|---|---|---|
| 1 |
Count=Count |
|
| 2 |
ErrorNoCorpus=Error: no corpus |
|
| 3 |
GroupByWords=Group by words |
|
| 4 |
Method=Method |
|
| 5 |
TextsBalanceCharts=Texts balance charts. |
|
| 0 | 6 | |
| TXM/trunk/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/adapters/TextsBalanceAdapterFactory.java (revision 3450) | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
public static final ImageDescriptor ICON = |
| 23 | 23 |
AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(TextsBalanceAdapterFactory.class).getSymbolicName(), |
| 24 |
"platform:/plugin/"+ FrameworkUtil.getBundle(TextsBalanceAdapterFactory.class).getSymbolicName() + "/icons/balance.png"); //$NON-NLS-1$ |
|
| 24 |
"platform:/plugin/"+ FrameworkUtil.getBundle(TextsBalanceAdapterFactory.class).getSymbolicName() + "/icons/balance.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 25 | 25 |
|
| 26 | 26 |
|
| 27 | 27 |
@Override |
| TXM/trunk/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/Messages.java (revision 3450) | ||
|---|---|---|
| 1 |
package org.txm.textsbalance.rcp; |
|
| 2 |
|
|
| 3 |
import org.eclipse.osgi.util.NLS; |
|
| 4 |
|
|
| 5 |
public class Messages extends NLS {
|
|
| 6 |
|
|
| 7 |
private static final String BUNDLE_NAME = "org.txm.textsbalance.rcp.messages"; //$NON-NLS-1$ |
|
| 8 |
|
|
| 9 |
public static String Count; |
|
| 10 |
|
|
| 11 |
public static String ErrorNoCorpus; |
|
| 12 |
|
|
| 13 |
public static String GroupByWords; |
|
| 14 |
|
|
| 15 |
public static String Method; |
|
| 16 |
|
|
| 17 |
public static String TextsBalanceCharts; |
|
| 18 |
static {
|
|
| 19 |
// initialize resource bundle |
|
| 20 |
NLS.initializeMessages(BUNDLE_NAME, Messages.class); |
|
| 21 |
} |
|
| 22 |
|
|
| 23 |
private Messages() {}
|
|
| 24 |
} |
|
| 0 | 25 | |
| TXM/trunk/org.txm.treesearch.rcp/src/org/txm/treesearch/rcp/messages.properties (revision 3450) | ||
|---|---|---|
| 1 |
CurrentRepresentation=Current representation |
|
| 2 |
ErrorDuringTreeSearchInitializationP0=Error during TreeSearch initialization: {0}
|
|
| 3 |
ErrorFailedToInstantiateP0=Error: failed to instantiate {0}.
|
|
| 4 |
ErrorFailToGenerateSVGFileP0=Error: Fail to generate SVG file: {0}
|
|
| 5 |
ErrorP0=Error: {0}
|
|
| 6 |
ErrorWhileComputingTheTreeP0=Error while computing the Tree: {0}
|
|
| 7 |
NoEditorSelectionP0=No editor selection: {0}
|
|
| 8 |
NoSentence=No Sentence |
|
| 9 |
NoSubGraph=No sub graph |
|
| 10 |
ResultIsNotAConcordanceP0=Result is not a concordance: {0}
|
|
| 11 |
SelectionIsNotACorpusP0=Selection is not a corpus: {0}
|
|
| 12 |
SelectionIsNotALineP0=Selection is not a Line: {0}
|
|
| 13 |
SyntacticAnnotation=Syntactic annotation |
|
| 14 |
SyntacticRepresentation=Syntactic representation |
|
| 15 |
SyntaxRepresentationP0=Syntax representations: {0}
|
|
| 0 | 16 | |
| TXM/trunk/org.txm.treesearch.rcp/src/org/txm/treesearch/rcp/Messages.java (revision 3450) | ||
|---|---|---|
| 1 |
package org.txm.treesearch.rcp; |
|
| 2 |
|
|
| 3 |
import org.eclipse.osgi.util.NLS; |
|
| 4 |
|
|
| 5 |
public class Messages extends NLS {
|
|
| 6 |
|
|
| 7 |
private static final String BUNDLE_NAME = "org.txm.treesearch.rcp.messages"; //$NON-NLS-1$ |
|
| 8 |
|
|
| 9 |
public static String CurrentRepresentation; |
|
| 10 |
|
|
| 11 |
public static String ErrorDuringTreeSearchInitializationP0; |
|
| 12 |
|
|
| 13 |
public static String ErrorFailedToInstantiateP0; |
|
| 14 |
|
|
| 15 |
public static String ErrorFailToGenerateSVGFileP0; |
|
| 16 |
|
|
| 17 |
public static String ErrorP0; |
|
| 18 |
|
|
| 19 |
public static String ErrorWhileComputingTheTreeP0; |
|
| 20 |
|
|
| 21 |
public static String NoEditorSelectionP0; |
|
| 22 |
|
|
| 23 |
public static String NoSentence; |
|
| 24 |
|
|
| 25 |
public static String NoSubGraph; |
|
| 26 |
|
|
| 27 |
public static String ResultIsNotAConcordanceP0; |
|
| 28 |
|
|
| 29 |
public static String SelectionIsNotACorpusP0; |
|
| 30 |
|
|
| 31 |
public static String SelectionIsNotALineP0; |
|
| 32 |
public static String SyntacticAnnotation; |
|
| 33 |
|
|
| 34 |
public static String SyntacticRepresentation; |
|
| 35 |
|
|
| 36 |
public static String SyntaxRepresentationP0; |
|
| 37 |
static {
|
|
| 38 |
// initialize resource bundle |
|
| 39 |
NLS.initializeMessages(BUNDLE_NAME, Messages.class); |
|
| 40 |
} |
|
| 41 |
|
|
| 42 |
private Messages() {}
|
|
| 43 |
} |
|
| 0 | 44 | |
| TXM/trunk/org.txm.treesearch.rcp/src/org/txm/treesearch/editor/TreeSearchEditor.java (revision 3450) | ||
|---|---|---|
| 38 | 38 |
import org.txm.treesearch.function.TreeSearch; |
| 39 | 39 |
import org.txm.treesearch.function.TreeSearchSelector; |
| 40 | 40 |
import org.txm.treesearch.preferences.TreeSearchPreferences; |
| 41 |
import org.txm.treesearch.rcp.Messages; |
|
| 41 | 42 |
//import org.txm.stat.engine.r.RDevice; |
| 42 | 43 |
import org.txm.utils.logger.Log; |
| 43 | 44 |
//import org.txm.functions.queryindex.QueryIndex; |
| ... | ... | |
| 99 | 100 |
HashMap<String, TreeSearchSelector> selectors = ComputeTreeSearch.getSelectorsForCorpus(corpus); |
| 100 | 101 |
|
| 101 | 102 |
boolean updateFields = false; |
| 102 |
if (representationCombo.getText().equals("TIGER") && !currentSelector.getEngine().equals("TIGER")) {
|
|
| 103 |
currentSelector = selectors.get("TIGER");
|
|
| 104 |
if (!tsPerRepresentation.containsKey("TIGER")) {
|
|
| 105 |
tsPerRepresentation.put("TIGER", currentSelector.getTreeSearch(corpus));
|
|
| 103 |
if (representationCombo.getText().equals("TIGER") && !currentSelector.getEngine().equals("TIGER")) { //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 104 |
currentSelector = selectors.get("TIGER"); //$NON-NLS-1$
|
|
| 105 |
if (!tsPerRepresentation.containsKey("TIGER")) { //$NON-NLS-1$
|
|
| 106 |
tsPerRepresentation.put("TIGER", currentSelector.getTreeSearch(corpus)); //$NON-NLS-1$
|
|
| 106 | 107 |
} |
| 107 | 108 |
updateFields = true; |
| 108 |
} else if (representationCombo.getText().equals("UD") && !currentSelector.getEngine().equals("UD")) {
|
|
| 109 |
currentSelector = selectors.get("UD");
|
|
| 110 |
if (!tsPerRepresentation.containsKey("UD")) {
|
|
| 111 |
tsPerRepresentation.put("UD", currentSelector.getTreeSearch(corpus));
|
|
| 109 |
} else if (representationCombo.getText().equals("UD") && !currentSelector.getEngine().equals("UD")) { //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 110 |
currentSelector = selectors.get("UD"); //$NON-NLS-1$
|
|
| 111 |
if (!tsPerRepresentation.containsKey("UD")) { //$NON-NLS-1$
|
|
| 112 |
tsPerRepresentation.put("UD", currentSelector.getTreeSearch(corpus)); //$NON-NLS-1$
|
|
| 112 | 113 |
} |
| 113 | 114 |
updateFields = true; |
| 114 | 115 |
} |
| ... | ... | |
| 122 | 123 |
|
| 123 | 124 |
subSpinner.setSelection(1); |
| 124 | 125 |
subSpinner.setMaximum(tsPerRepresentation.get(currentSelector.getEngine()).getNSubGraph(sentSpinner.getSelection() - 1)); |
| 125 |
subCounterLabel.setText("/" + tsPerRepresentation.get(currentSelector.getEngine()).getNSubGraph(sentSpinner.getSelection() - 1));
|
|
| 126 |
subCounterLabel.setText("/" + tsPerRepresentation.get(currentSelector.getEngine()).getNSubGraph(sentSpinner.getSelection() - 1)); //$NON-NLS-1$
|
|
| 126 | 127 |
//} |
| 127 | 128 |
} |
| 128 | 129 |
|
| ... | ... | |
| 137 | 138 |
|
| 138 | 139 |
representationLabel = new Label(getMainParametersComposite(), SWT.NONE); |
| 139 | 140 |
representationLabel.setImage(IImageKeys.getImage(tsPerRepresentation.get(currentSelector.getEngine()).getIconPath())); |
| 140 |
representationLabel.setToolTipText("Current representation");
|
|
| 141 |
representationLabel.setToolTipText(Messages.CurrentRepresentation);
|
|
| 141 | 142 |
|
| 142 | 143 |
representationCombo = new Combo(getMainParametersComposite(), SWT.READ_ONLY); |
| 143 | 144 |
GridData gdataR = new GridData(SWT.FILL, SWT.CENTER, true, true); |
| ... | ... | |
| 198 | 199 |
} |
| 199 | 200 |
}); |
| 200 | 201 |
|
| 201 |
new Label(queryPanel, SWT.NONE).setText("T ");
|
|
| 202 |
new Label(queryPanel, SWT.NONE).setText("T "); //$NON-NLS-1$
|
|
| 202 | 203 |
TCombo = new Combo(queryPanel, SWT.READ_ONLY); |
| 203 | 204 |
GridData gdata = new GridData(SWT.FILL, SWT.CENTER, true, true); |
| 204 | 205 |
TCombo.setLayoutData(gdata); |
| 205 | 206 |
TCombo.addSelectionListener(selChangedListener); |
| 206 | 207 |
|
| 207 |
new Label(queryPanel, SWT.NONE).setText("NT ");
|
|
| 208 |
new Label(queryPanel, SWT.NONE).setText("NT "); //$NON-NLS-1$
|
|
| 208 | 209 |
NTCombo = new Combo(queryPanel, SWT.READ_ONLY); |
| 209 | 210 |
gdata = new GridData(SWT.FILL, SWT.CENTER, true, true); |
| 210 | 211 |
NTCombo.setLayoutData(gdata); |
| ... | ... | |
| 215 | 216 |
|
| 216 | 217 |
// fill param Area |
| 217 | 218 |
gdata = new GridData(SWT.FILL, SWT.CENTER, true, true); |
| 218 |
new Label(navigationAreaComposite, SWT.NONE).setText("Sent ");
|
|
| 219 |
new Label(navigationAreaComposite, SWT.NONE).setText("Sent "); //$NON-NLS-1$
|
|
| 219 | 220 |
sentSpinner = new Spinner(navigationAreaComposite, SWT.BORDER); |
| 220 | 221 |
sentSpinner.setMinimum(1); |
| 221 | 222 |
sentSpinner.setIncrement(1); |
| ... | ... | |
| 230 | 231 |
sentCounterLabel.setLayoutData(gdata); |
| 231 | 232 |
|
| 232 | 233 |
//if (tsPerRepresentation.get(currentSelector.getEngine()).hasSubMatchesStrategy()) {
|
| 233 |
new Label(navigationAreaComposite, SWT.NONE).setText("Sub ");
|
|
| 234 |
new Label(navigationAreaComposite, SWT.NONE).setText("Sub "); //$NON-NLS-1$
|
|
| 234 | 235 |
subSpinner = new Spinner(navigationAreaComposite, SWT.BORDER); |
| 235 | 236 |
subSpinner.setMinimum(1); |
| 236 | 237 |
subSpinner.setIncrement(1); |
| ... | ... | |
| 275 | 276 |
|
| 276 | 277 |
if (representationCombo.getItemCount() == 0) {
|
| 277 | 278 |
HashMap<String, TreeSearchSelector> selectors = ComputeTreeSearch.getSelectorsForCorpus(corpus); |
| 278 |
Log.fine("Syntax representations: "+selectors);
|
|
| 279 |
Log.fine(Messages.SyntaxRepresentationP0+selectors);
|
|
| 279 | 280 |
String[] values = selectors.keySet().toArray(new String[selectors.size()]); |
| 280 | 281 |
representationCombo.setItems(values); |
| 281 | 282 |
|
| ... | ... | |
| 289 | 290 |
|
| 290 | 291 |
if (ts.isComputed()) {
|
| 291 | 292 |
queryArea.setText(ts.getQuery()); |
| 292 |
sentCounterLabel.setText("/" + ts.getNSentences());
|
|
| 293 |
subCounterLabel.setText("/" + ts.getNSubGraph(0));
|
|
| 293 |
sentCounterLabel.setText("/" + ts.getNSentences()); //$NON-NLS-1$
|
|
| 294 |
subCounterLabel.setText("/" + ts.getNSubGraph(0)); //$NON-NLS-1$
|
|
| 294 | 295 |
} |
| 295 | 296 |
else {
|
| 296 |
sentCounterLabel.setText("No Sentence");
|
|
| 297 |
if (ts.hasSubMatchesStrategy()) subCounterLabel.setText("No sub graph");
|
|
| 297 |
sentCounterLabel.setText(Messages.NoSentence);
|
|
| 298 |
if (ts.hasSubMatchesStrategy()) subCounterLabel.setText(Messages.NoSubGraph);
|
|
| 298 | 299 |
} |
| 299 | 300 |
|
| 300 | 301 |
if (ts.isDrawn()) {
|
| ... | ... | |
| 309 | 310 |
reloadGraph(); |
| 310 | 311 |
} |
| 311 | 312 |
catch (Exception e) {
|
| 312 |
System.out.println("Error during TreeSearch initialization: " + e);
|
|
| 313 |
System.out.println(Messages.ErrorDuringTreeSearchInitializationP0 + e);
|
|
| 313 | 314 |
Log.printStackTrace(e); |
| 314 | 315 |
} |
| 315 | 316 |
} |
| ... | ... | |
| 368 | 369 |
try {
|
| 369 | 370 |
TreeSearch ts = tsPerRepresentation.get(currentSelector.getEngine()); |
| 370 | 371 |
if (ts.getNSentences() > 0) {
|
| 371 |
sentCounterLabel.setText("/" + ts.getNSentences());
|
|
| 372 |
if (ts.hasSubMatchesStrategy()) subCounterLabel.setText("/" + ts.getNSubGraph(0));
|
|
| 372 |
sentCounterLabel.setText("/" + ts.getNSentences()); //$NON-NLS-1$
|
|
| 373 |
if (ts.hasSubMatchesStrategy()) subCounterLabel.setText("/" + ts.getNSubGraph(0)); //$NON-NLS-1$
|
|
| 373 | 374 |
sentSpinner.setSelection(ts.getCurrentMatchIndex()); |
| 374 | 375 |
sentSpinner.setMaximum(ts.getNSentences()); |
| 375 | 376 |
|
| ... | ... | |
| 384 | 385 |
QueriesView.refresh(); |
| 385 | 386 |
} |
| 386 | 387 |
catch (Exception e) {
|
| 387 |
System.out.println("Error while computing the Tree: " + e);
|
|
| 388 |
System.out.println(Messages.ErrorWhileComputingTheTreeP0 + e);
|
|
| 388 | 389 |
Log.printStackTrace(e); |
| 389 | 390 |
} |
| 390 | 391 |
// JobsTimer.stopAndPrint(); |
| ... | ... | |
| 415 | 416 |
|
| 416 | 417 |
try {
|
| 417 | 418 |
if (ts.toSVG(svgFile, sent, sub, T, NT)) {
|
| 418 |
Log.finer("SVG file: "+svgFile);
|
|
| 419 |
Log.finer("SVG file: "+svgFile); //$NON-NLS-1$
|
|
| 419 | 420 |
svgPanel.setUrl(svgFile.toURI().toURL().toString()); |
| 420 | 421 |
svgPanel.layout(); |
| 421 | 422 |
svgPanel.redraw(); |
| 422 | 423 |
} |
| 423 | 424 |
else {
|
| 424 |
Log.warning("Error: Fail to generate SVG file: "+svgFile);
|
|
| 425 |
Log.warning(Messages.ErrorFailToGenerateSVGFileP0+svgFile);
|
|
| 425 | 426 |
} |
| 426 | 427 |
} |
| 427 | 428 |
catch (Exception e1) {
|
| ... | ... | |
| 447 | 448 |
File resultDir = new File(Toolbox.getTxmHomePath(), "results"); //$NON-NLS-1$ |
| 448 | 449 |
resultDir.mkdirs(); |
| 449 | 450 |
try {
|
| 450 |
svgFile = File.createTempFile("TreeSearch", ".svg", resultDir);
|
|
| 451 |
svgFile = File.createTempFile("TreeSearch", ".svg", resultDir); //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 451 | 452 |
} |
| 452 | 453 |
catch (IOException e) {
|
| 453 |
System.out.println("Error: " + e.getLocalizedMessage());
|
|
| 454 |
System.out.println(Messages.ErrorP0 + e.getLocalizedMessage());
|
|
| 454 | 455 |
Log.printStackTrace(e); |
| 455 | 456 |
} |
| 456 | 457 |
Log.fine(svgFile.toString()); |
| TXM/trunk/org.txm.treesearch.rcp/src/org/txm/treesearch/command/ConcordanceLineToTreeSearch.java (revision 3450) | ||
|---|---|---|
| 52 | 52 |
import org.txm.treesearch.function.TreeSearch; |
| 53 | 53 |
import org.txm.treesearch.function.TreeSearchSelector; |
| 54 | 54 |
import org.txm.treesearch.preferences.TreeSearchPreferences; |
| 55 |
import org.txm.treesearch.rcp.Messages; |
|
| 55 | 56 |
import org.txm.utils.logger.Log; |
| 56 | 57 |
|
| 57 | 58 |
|
| ... | ... | |
| 75 | 76 |
TXMResult r = BaseAbstractHandler.getActiveEditorResult(event); |
| 76 | 77 |
|
| 77 | 78 |
if (!(r instanceof Concordance)) {
|
| 78 |
Log.warning("Result is not a concordance: "+r);
|
|
| 79 |
Log.warning(Messages.ResultIsNotAConcordanceP0+r);
|
|
| 79 | 80 |
return null; |
| 80 | 81 |
} |
| 81 | 82 |
|
| 82 | 83 |
ISelection s = HandlerUtil.getCurrentSelection(event); |
| 83 | 84 |
if (!(s instanceof StructuredSelection)) {
|
| 84 |
Log.warning("Selection is not a Line: "+s);
|
|
| 85 |
Log.warning(Messages.SelectionIsNotALineP0+s);
|
|
| 85 | 86 |
return null; |
| 86 | 87 |
} |
| 87 | 88 |
|
| ... | ... | |
| 89 | 90 |
List list = selection.toList(); |
| 90 | 91 |
|
| 91 | 92 |
if (list.size() == 0) {
|
| 92 |
Log.warning("No editor selection: "+r);
|
|
| 93 |
Log.warning(Messages.NoEditorSelectionP0+r);
|
|
| 93 | 94 |
return null; |
| 94 | 95 |
} |
| 95 | 96 |
|
| 96 | 97 |
Concordance concordance = (Concordance)r; |
| 97 | 98 |
Object o = list.get(0); |
| 98 | 99 |
if (!(o instanceof Line)) {
|
| 99 |
Log.warning("Selection is not a Line: "+o);
|
|
| 100 |
Log.warning(Messages.SelectionIsNotALineP0+o);
|
|
| 100 | 101 |
return null; |
| 101 | 102 |
} |
| 102 | 103 |
Line l = (Line)o; |
| TXM/trunk/org.txm.treesearch.rcp/src/org/txm/treesearch/command/ComputeTreeSearch.java (revision 3450) | ||
|---|---|---|
| 46 | 46 |
import org.txm.treesearch.function.TreeSearch; |
| 47 | 47 |
import org.txm.treesearch.function.TreeSearchSelector; |
| 48 | 48 |
import org.txm.treesearch.preferences.TreeSearchPreferences; |
| 49 |
import org.txm.treesearch.rcp.Messages; |
|
| 49 | 50 |
import org.txm.utils.logger.Log; |
| 50 | 51 |
|
| 51 | 52 |
|
| ... | ... | |
| 84 | 85 |
public static HashMap<String, TreeSearchSelector> getSelectorsForCorpus(CQPCorpus corpus) {
|
| 85 | 86 |
|
| 86 | 87 |
HashMap<String, TreeSearchSelector> ret = new HashMap<String, TreeSearchSelector>(); |
| 87 |
IConfigurationElement[] contributions = RegistryFactory.getRegistry().getConfigurationElementsFor("org.txm.treesearch.TreeSearchSelector");
|
|
| 88 |
IConfigurationElement[] contributions = RegistryFactory.getRegistry().getConfigurationElementsFor("org.txm.treesearch.TreeSearchSelector"); //$NON-NLS-1$
|
|
| 88 | 89 |
|
| 89 | 90 |
for (int i = 0; i < contributions.length; i++) {
|
| 90 | 91 |
try {
|
| 91 | 92 |
@SuppressWarnings("unchecked")
|
| 92 | 93 |
TreeSearchSelector s = (TreeSearchSelector) contributions[i].createExecutableExtension("class"); //$NON-NLS-1$
|
| 93 | 94 |
|
| 94 |
Log.fine(TXMCoreMessages.bind("Initializing selector: {0}...", s));
|
|
| 95 |
Log.fine(TXMCoreMessages.bind("Initializing selector: {0}...", s)); //$NON-NLS-1$
|
|
| 95 | 96 |
|
| 96 | 97 |
if (s.canComputeWith(corpus)) {
|
| 97 | 98 |
ret.put(s.getEngine(), s); |
| 98 | 99 |
} |
| 99 | 100 |
} |
| 100 | 101 |
catch (Exception e) {
|
| 101 |
Log.severe("Error: failed to instantiate " + contributions[i].getName() + ".");
|
|
| 102 |
Log.severe(Messages.ErrorFailedToInstantiateP0 + contributions[i].getName() + "."); //$NON-NLS-2$
|
|
| 102 | 103 |
e.printStackTrace(); |
| 103 | 104 |
} |
| 104 | 105 |
} |
| ... | ... | |
| 115 | 116 |
|
| 116 | 117 |
TreeSearchSelector found = null; |
| 117 | 118 |
|
| 118 |
IConfigurationElement[] contributions = RegistryFactory.getRegistry().getConfigurationElementsFor("org.txm.treesearch.TreeSearchSelector");
|
|
| 119 |
IConfigurationElement[] contributions = RegistryFactory.getRegistry().getConfigurationElementsFor("org.txm.treesearch.TreeSearchSelector"); //$NON-NLS-1$
|
|
| 119 | 120 |
|
| 120 | 121 |
for (int i = 0; i < contributions.length; i++) {
|
| 121 | 122 |
try {
|
| 122 | 123 |
@SuppressWarnings("unchecked")
|
| 123 | 124 |
TreeSearchSelector s = (TreeSearchSelector) contributions[i].createExecutableExtension("class"); //$NON-NLS-1$
|
| 124 | 125 |
|
| 125 |
Log.fine(TXMCoreMessages.bind("Initializing selector: {0}...", s));
|
|
| 126 |
Log.fine(TXMCoreMessages.bind("Initializing selector: {0}...", s)); //$NON-NLS-1$
|
|
| 126 | 127 |
|
| 127 | 128 |
if (s.canComputeWith(corpus)) {
|
| 128 | 129 |
if (s.getEngine().equals(defaultEngine) || defaultEngine == null) { // it is the default engine, return it !
|
| ... | ... | |
| 132 | 133 |
} |
| 133 | 134 |
} |
| 134 | 135 |
catch (Exception e) {
|
| 135 |
Log.severe("Error: failed to instantiate " + contributions[i].getName() + ".");
|
|
| 136 |
Log.severe(Messages.ErrorFailedToInstantiateP0 + contributions[i].getName() + "."); //$NON-NLS-2$
|
|
| 136 | 137 |
e.printStackTrace(); |
| 137 | 138 |
} |
| 138 | 139 |
} |
| ... | ... | |
| 162 | 163 |
} |
| 163 | 164 |
else {
|
| 164 | 165 |
|
| 165 |
Log.warning("Selection is not a corpus: " + obj);
|
|
| 166 |
Log.warning(Messages.SelectionIsNotACorpusP0 + obj);
|
|
| 166 | 167 |
return null; |
| 167 | 168 |
} |
| 168 | 169 |
|
| TXM/trunk/org.txm.treesearch.rcp/src/org/txm/treesearch/preferences/TreeSearchPreferencePage.java (revision 3450) | ||
|---|---|---|
| 5 | 5 |
import org.txm.rcp.IImageKeys; |
| 6 | 6 |
import org.txm.rcp.preferences.TXMPreferencePage; |
| 7 | 7 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
| 8 |
import org.txm.treesearch.rcp.Messages; |
|
| 8 | 9 |
|
| 9 | 10 |
/** |
| 10 | 11 |
* Syntatic annotations preferences page |
| ... | ... | |
| 16 | 17 |
|
| 17 | 18 |
@Override |
| 18 | 19 |
public void createFieldEditors() {
|
| 19 |
this.addField(new StringFieldEditor(TreeSearchPreferences.DEFAULT_REPRESENTATION, "Syntactic representation", this.getFieldEditorParent()));
|
|
| 20 |
this.addField(new StringFieldEditor(TreeSearchPreferences.DEFAULT_REPRESENTATION, Messages.SyntacticRepresentation, this.getFieldEditorParent()));
|
|
| 20 | 21 |
} |
| 21 | 22 |
|
| 22 | 23 |
/* |
| ... | ... | |
| 28 | 29 |
@Override |
| 29 | 30 |
public void init(IWorkbench workbench) {
|
| 30 | 31 |
this.setPreferenceStore(new TXMPreferenceStore(TreeSearchPreferences.getInstance().getPreferencesNodeQualifier())); |
| 31 |
this.setDescription("Syntatic annotation");
|
|
| 32 |
this.setImageDescriptor(IImageKeys.getImageDescriptor(this.getClass(), "icons/functions/Tree.png")); |
|
| 32 |
this.setDescription(Messages.SyntacticAnnotation);
|
|
| 33 |
this.setImageDescriptor(IImageKeys.getImageDescriptor(this.getClass(), "icons/functions/Tree.png")); //$NON-NLS-1$
|
|
| 33 | 34 |
} |
| 34 | 35 |
} |
| TXM/trunk/org.txm.xmleditor.rcp/src/org/txm/xmleditor/messages/XMLEditorMessages.java (revision 3450) | ||
|---|---|---|
| 7 | 7 |
|
| 8 | 8 |
private static final String BUNDLE_NAME = "org.txm.xmleditor.messages.messages"; //$NON-NLS-1$ |
| 9 | 9 |
|
| 10 |
public static String AbortingTheOpeningOfP0; |
|
| 11 |
|
|
| 12 |
public static String BigFile; |
|
| 13 |
|
|
| 10 | 14 |
public static String OpenXMLEditor_1; |
| 11 | 15 |
|
| 12 | 16 |
public static String OpenXMLEditor_3; |
| 13 | 17 |
|
| 14 | 18 |
public static String OpenXMLEditor_4; |
| 19 |
|
|
| 20 |
public static String P0IsAVeryBigFileDoYouWantToContinueAndOpensIt; |
|
| 15 | 21 |
|
| 22 |
public static String SelectedWordFromP0ToP1; |
|
| 23 |
|
|
| 24 |
public static String SelectedWordP0; |
|
| 25 |
|
|
| 26 |
public static String WordSelectionIdentifiersP0; |
|
| 27 |
|
|
| 16 | 28 |
static {
|
| 17 | 29 |
// initialize resource bundle |
| 18 | 30 |
Utf8NLS.initializeMessages(BUNDLE_NAME, XMLEditorMessages.class); |
| TXM/trunk/org.txm.xmleditor.rcp/src/org/txm/xmleditor/messages/messages.properties (revision 3450) | ||
|---|---|---|
| 1 |
AbortingTheOpeningOfP0=Aborting the opening of {0}
|
|
| 2 |
BigFile=Big file |
|
| 1 | 3 |
OpenXMLEditor_1=Open XML Editor... |
| 2 | 4 |
OpenXMLEditor_3=Opening XML editor... |
| 3 | 5 |
OpenXMLEditor_4=Error: |
| 6 |
P0IsAVeryBigFileDoYouWantToContinueAndOpensIt={0} is a very big file. Do you want to continue and opens it?
|
|
| 7 |
SelectedWordFromP0ToP1=Selected word: from {0} to {1}
|
|
| 8 |
SelectedWordP0=Selected word: {0}
|
|
| 9 |
WordSelectionIdentifiersP0=Word selection identifiers: {0}
|
|
| TXM/trunk/org.txm.xmleditor.rcp/src/org/txm/xmleditor/OpenXMLEditor.java (revision 3450) | ||
|---|---|---|
| 71 | 71 |
File txmFile = text.getXMLTXMFile(); |
| 72 | 72 |
if (txmFile != null && txmFile.exists()) {
|
| 73 | 73 |
if (txmFile.length() > ALERT) {
|
| 74 |
if (!MessageDialog.openQuestion(shell, "Big file /o\\", txmFile.getAbsolutePath()+" is a very big file. Do you want to continue and opens it?")) {
|
|
| 75 |
Log.info("Aborting the opening of "+txmFile);
|
|
| 74 |
if (!MessageDialog.openQuestion(shell, XMLEditorMessages.BigFile, txmFile.getAbsolutePath()+XMLEditorMessages.P0IsAVeryBigFileDoYouWantToContinueAndOpensIt)) {
|
|
| 75 |
Log.info(XMLEditorMessages.AbortingTheOpeningOfP0+txmFile);
|
|
| 76 | 76 |
return null; |
| 77 | 77 |
} |
| 78 | 78 |
} |
| 79 | 79 |
reditor = openfile(txmFile); |
| 80 | 80 |
} |
| 81 | 81 |
else { // wrong link ?
|
| 82 |
txmFile = new File(text.getProject().getProjectDirectory(), "txm/" + text.getProject().getName() + "/" + text.getName() + ".xml"); |
|
| 82 |
txmFile = new File(text.getProject().getProjectDirectory(), "txm/" + text.getProject().getName() + "/" + text.getName() + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
| 83 | 83 |
reditor = openfile(txmFile); |
| 84 | 84 |
} |
| 85 | 85 |
|
| ... | ... | |
| 93 | 93 |
// |
| 94 | 94 |
// String search = "\""+wordSelection[0]+"\""; |
| 95 | 95 |
if (wordSelection[1] == null) {
|
| 96 |
System.out.println("Selected word: " + wordSelection[0]);
|
|
| 96 |
System.out.println(XMLEditorMessages.SelectedWordP0 + wordSelection[0]);
|
|
| 97 | 97 |
} |
| 98 | 98 |
else {
|
| 99 |
System.out.println("Selected word: from " + wordSelection[0] + " to " + wordSelection[1]);
|
|
| 99 |
System.out.println(XMLEditorMessages.SelectedWordFromP0ToP1 + wordSelection[0] + " to " + wordSelection[1]); //$NON-NLS-2$
|
|
| 100 | 100 |
} |
| 101 | 101 |
} |
| 102 | 102 |
} |
| ... | ... | |
| 106 | 106 |
Concordance conc = line.getConcordance(); |
| 107 | 107 |
String text = line.getTextId(); |
| 108 | 108 |
|
| 109 |
File txmFile = new File(conc.getProject().getProjectDirectory(), "txm/" + conc.getCorpus().getID() + "/" + text + ".xml"); |
|
| 109 |
File txmFile = new File(conc.getProject().getProjectDirectory(), "txm/" + conc.getCorpus().getID() + "/" + text + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
| 110 | 110 |
reditor = openfile(txmFile); |
| 111 | 111 |
if (reditor != null & reditor instanceof XMLMultiPageEditorPart) {
|
| 112 | 112 |
XMLMultiPageEditorPart xmlEditor = (XMLMultiPageEditorPart) reditor; |
| 113 | 113 |
Object selectedPage = xmlEditor.getSelectedPage(); |
| 114 | 114 |
if (selectedPage != null && selectedPage instanceof StructuredTextEditor) {
|
| 115 |
System.out.println("Word selection identifiers: " + line.getKeywordIds());
|
|
| 115 |
System.out.println(XMLEditorMessages.WordSelectionIdentifiersP0 + line.getKeywordIds());
|
|
| 116 | 116 |
} |
| 117 | 117 |
} |
| 118 | 118 |
} |
Formats disponibles : Unified diff