Révision 2101
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 2101) | ||
---|---|---|
25 | 25 |
import org.eclipse.jface.viewers.TableViewer; |
26 | 26 |
import org.eclipse.jface.viewers.Viewer; |
27 | 27 |
import org.eclipse.swt.SWT; |
28 |
import org.eclipse.swt.custom.StyledText; |
|
28 | 29 |
import org.eclipse.swt.events.MouseAdapter; |
29 | 30 |
import org.eclipse.swt.events.MouseEvent; |
30 | 31 |
import org.eclipse.swt.graphics.Point; |
... | ... | |
1196 | 1197 |
else if(object instanceof Text) { |
1197 | 1198 |
((Text)object).setText(String.valueOf(value)); |
1198 | 1199 |
} |
1200 |
else if(object instanceof StyledText) { |
|
1201 |
((StyledText)object).setText(String.valueOf(value)); |
|
1202 |
} |
|
1199 | 1203 |
else if(object instanceof Button) { |
1200 | 1204 |
((Button)object).setSelection((Boolean) value); |
1201 | 1205 |
} |
... | ... | |
1319 | 1323 |
else if(object instanceof Text) { |
1320 | 1324 |
value = ((Text)object).getText(); |
1321 | 1325 |
} |
1326 |
else if(object instanceof StyledText) { |
|
1327 |
value = ((StyledText)object).getText(); |
|
1328 |
} |
|
1322 | 1329 |
else if(object instanceof Button) { |
1323 | 1330 |
value = ((Button)object).getSelection(); |
1324 | 1331 |
} |
tmp/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java (revision 2101) | ||
---|---|---|
33 | 33 |
} |
34 | 34 |
|
35 | 35 |
public TIGERSearch(CorpusBuild corpus2) { |
36 |
super(corpus2); |
|
37 |
this.corpus = corpus2; |
|
36 |
this(null, corpus2); |
|
38 | 37 |
|
39 |
String id = corpus2.getName(); |
|
40 |
File configfile = new File(corpus2.getProjectDirectory(),"tiger/tigersearch.logprop"); |
|
41 |
File registrydir = new File(corpus2.getProjectDirectory(), "tiger"); |
|
42 |
File tscorpusdir = new File(corpus2.getProjectDirectory(), "tiger/"+id); |
|
38 |
} |
|
39 |
|
|
40 |
public TIGERSearch(String parentNodePath, CorpusBuild corpus2) { |
|
41 |
super(parentNodePath, corpus2); |
|
42 |
|
|
43 |
this.corpus = getParent(); |
|
43 | 44 |
|
45 |
String id = corpus.getName(); |
|
46 |
File configfile = new File(corpus.getProjectDirectory(),"tiger/tigersearch.logprop"); |
|
47 |
File registrydir = new File(corpus.getProjectDirectory(), "tiger"); |
|
48 |
File tscorpusdir = new File(corpus.getProjectDirectory(), "tiger/"+id); |
|
49 |
|
|
44 | 50 |
if (!tscorpusdir.exists()) { |
45 | 51 |
System.out.println("Error: can't find corpus directory: "+tscorpusdir); |
46 | 52 |
return; |
... | ... | |
60 | 66 |
ready = true; |
61 | 67 |
} |
62 | 68 |
} |
69 |
|
|
70 |
public TIGERSearch(String parentNodePath) { |
|
71 |
this( parentNodePath, null); |
|
72 |
} |
|
63 | 73 |
|
64 | 74 |
public TSResult getTSResult() { |
65 | 75 |
return tsresult; |
... | ... | |
77 | 87 |
if (tsresult == null) return false; // no result |
78 | 88 |
this.T = T; |
79 | 89 |
this.NT = NT; |
90 |
|
|
91 |
if (tsresult.getNumberOfMatch() == 0) return false; |
|
80 | 92 |
|
81 | 93 |
tsresult.setDisplayProperties(Arrays.asList(T), NT); |
82 | 94 |
|
... | ... | |
109 | 121 |
} |
110 | 122 |
|
111 | 123 |
public CorpusBuild getParent() { |
112 |
return corpus;
|
|
124 |
return (CorpusBuild)super.getParent();
|
|
113 | 125 |
} |
114 | 126 |
|
115 | 127 |
public boolean isReady() { |
... | ... | |
131 | 143 |
|
132 | 144 |
public int getNSubGraph() { |
133 | 145 |
if (tsresult == null) return 0; |
146 |
if (tsresult.getCurrentMatch() == null) return 0; |
|
147 |
|
|
134 | 148 |
return tsresult.getCurrentMatch().getNumberOfSubGraph(); |
135 | 149 |
} |
136 | 150 |
|
tmp/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TIGERSearchEngine.java (revision 2101) | ||
---|---|---|
3 | 3 |
import java.io.File; |
4 | 4 |
import java.lang.reflect.Field; |
5 | 5 |
import java.util.ArrayList; |
6 |
import java.util.LinkedHashSet; |
|
6 | 7 |
import java.util.List; |
7 | 8 |
|
8 | 9 |
import org.eclipse.core.runtime.IProgressMonitor; |
... | ... | |
87 | 88 |
} |
88 | 89 |
} |
89 | 90 |
|
90 |
ArrayList<TIGERMatch> tigerMatchesList = new ArrayList<TIGERMatch>();
|
|
91 |
LinkedHashSet<TIGERMatch> tigerMatchesList = new LinkedHashSet<TIGERMatch>();
|
|
91 | 92 |
//System.out.println("submatchSize: "+subsize); |
92 | 93 |
for (int imatch = 0 ; imatch < size; imatch++) { // the matching sentences |
93 | 94 |
int sent = mresult.getSentenceNumberAt(imatch); |
94 | 95 |
//Sentence sentence = tcorpus.manager.getSentence(sent); |
95 | 96 |
|
96 |
System.out.println(" sent: "+sent); |
|
97 |
//System.out.println(" sent: "+sent);
|
|
97 | 98 |
int sent_submatch = mresult.getSentenceSubmatchSize(sent); |
98 | 99 |
//System.out.println(" sent submatch size: "+sent_submatch); |
99 | 100 |
for (int isubmatch = 0 ; isubmatch < sent_submatch ; isubmatch++) { // the matches in the sentence |
... | ... | |
101 | 102 |
|
102 | 103 |
int sent_start = starts[sent]; |
103 | 104 |
|
104 |
TIGERMatch tigerMatch = new TIGERMatch(sent_start+match[0], sent_start+match[match.length-1]); |
|
105 |
System.out.println(" start="+sent_start+" matches="+Arrays.toString(match)); |
|
106 |
System.out.println(" m="+(tigerMatch)); |
|
107 |
tigerMatchesList.add(tigerMatch); |
|
105 |
//System.out.println(" sent="+sent_start+ " matches="+Arrays.toString(match)); |
|
106 |
for (int i = 0 ; i < match.length ; i++) { |
|
107 |
int left = index.getLeftCorner(sent, match[i]); |
|
108 |
int right = index.getRightCorner(sent, match[i]); |
|
109 |
//System.out.println(" M="+match[i]+" ("+left+", "+right+")"); |
|
110 |
|
|
111 |
TIGERMatch tigerMatch = new TIGERMatch(sent_start+left, sent_start+right); |
|
112 |
|
|
113 |
//System.out.println(" ajusted="+(tigerMatch)); |
|
114 |
tigerMatchesList.add(tigerMatch); |
|
115 |
} |
|
108 | 116 |
} |
109 | 117 |
} |
110 | 118 |
|
111 |
return new TIGERSelection(query, tigerMatchesList);
|
|
119 |
return new TIGERSelection(query, new ArrayList<TIGERMatch>(tigerMatchesList));
|
|
112 | 120 |
} |
113 | 121 |
|
114 | 122 |
@Override |
tmp/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TSCorpus.java (revision 2101) | ||
---|---|---|
61 | 61 |
/** The results. */ |
62 | 62 |
HashMap<Integer, TSResult> results = new HashMap<Integer, TSResult>(); |
63 | 63 |
|
64 |
|
|
65 |
|
|
66 | 64 |
/** |
67 | 65 |
* Instantiates a new TS corpus. |
68 | 66 |
* |
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/rcp/TIGERSearchAdapterFactory.java (revision 2101) | ||
---|---|---|
19 | 19 |
|
20 | 20 |
public static final ImageDescriptor ICON = |
21 | 21 |
AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(TIGERSearchAdapterFactory.class).getSymbolicName(), |
22 |
"platform:/plugin/"+ FrameworkUtil.getBundle(TIGERSearchAdapterFactory.class).getSymbolicName() + "/icons/TS.png"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
22 |
"platform:/plugin/"+ FrameworkUtil.getBundle(TIGERSearchAdapterFactory.class).getSymbolicName() + "/icons/functions/TS.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
23 | 23 |
|
24 | 24 |
@Override |
25 | 25 |
public Object getAdapter(Object adaptableObject, Class adapterType) { |
26 |
if (this.canAdapt(adapterType) && adaptableObject instanceof TIGERSearch) { |
|
26 |
if (this.canAdapt(adapterType) && adaptableObject instanceof org.txm.function.tigersearch.TIGERSearch) {
|
|
27 | 27 |
return new TXMResultAdapter() { |
28 | 28 |
@Override |
29 | 29 |
public ImageDescriptor getImageDescriptor(Object object) { |
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/TIGERSearchEditor.java (revision 2101) | ||
---|---|---|
23 | 23 |
import org.eclipse.ui.IEditorSite; |
24 | 24 |
import org.eclipse.ui.PartInitException; |
25 | 25 |
import org.txm.Toolbox; |
26 |
import org.txm.core.preferences.TXMPreferences; |
|
27 |
import org.txm.core.results.Parameter; |
|
26 | 28 |
import org.txm.function.tigersearch.TIGERSearch; |
27 | 29 |
import org.txm.objects.CorpusBuild; |
28 | 30 |
import org.txm.rcp.JobsTimer; |
... | ... | |
55 | 57 |
|
56 | 58 |
private TIGERSearch ts = null; |
57 | 59 |
|
60 |
@Parameter(key=TXMPreferences.QUERY) |
|
58 | 61 |
private StyledText queryArea; |
62 |
|
|
59 | 63 |
private Label subCounterLabel; |
60 | 64 |
private Label sentCounterLabel; |
61 | 65 |
private Combo NTCombo; |
... | ... | |
259 | 263 |
|
260 | 264 |
@Override |
261 | 265 |
public void updateResultFromEditor() { |
262 |
// FIXME: not yet implemented |
|
263 |
System.err.println("TIGERSearchEditor.updateResultFromEditor(): not yet implemented.");
|
|
266 |
|
|
267 |
reloadGraph();
|
|
264 | 268 |
} |
265 | 269 |
|
266 | 270 |
@Override |
tmp/org.txm.tigersearch.rcp/plugin.xml (revision 2101) | ||
---|---|---|
11 | 11 |
</category> |
12 | 12 |
<command |
13 | 13 |
categoryId="TIGERSearch4TXM.commands.category" |
14 |
defaultHandler="org.txm.tigersearch.commands.ComputeTIGERSearch" |
|
14 | 15 |
id="org.txm.tigersearch.commands.ComputeTIGERSearch" |
15 | 16 |
name="%command.name" |
16 | 17 |
returnTypeId="org.txm.function.tigersearch.TIGERSearch"> |
... | ... | |
50 | 51 |
<visibleWhen |
51 | 52 |
checkEnabled="false"> |
52 | 53 |
<or> |
53 |
<reference |
|
54 |
definitionId="OneCorpusSelected"> |
|
55 |
</reference> |
|
54 |
<test |
|
55 |
forcePluginActivation="true" |
|
56 |
property="org.txm.rcp.testers.TIGERSearchReady" |
|
57 |
value="TIGERSearchReady"> |
|
58 |
</test> |
|
56 | 59 |
</or> |
57 | 60 |
</visibleWhen> |
58 | 61 |
</command> |
... | ... | |
116 | 119 |
<visibleWhen |
117 | 120 |
checkEnabled="false"> |
118 | 121 |
<or> |
119 |
<reference |
|
120 |
definitionId="OneCorpusSelected"> |
|
121 |
</reference> |
|
122 |
<test |
|
123 |
forcePluginActivation="true" |
|
124 |
property="org.txm.rcp.testers.TIGERSearchReady" |
|
125 |
value="TIGERSearchReady"> |
|
126 |
</test> |
|
122 | 127 |
</or> |
123 | 128 |
</visibleWhen> |
124 | 129 |
</command> |
... | ... | |
134 | 139 |
<visibleWhen |
135 | 140 |
checkEnabled="false"> |
136 | 141 |
<or> |
137 |
<reference |
|
138 |
definitionId="OneCorpusSelected"> |
|
139 |
</reference> |
|
142 |
<test |
|
143 |
forcePluginActivation="true" |
|
144 |
property="org.txm.rcp.testers.TIGERSearchReady" |
|
145 |
value="TIGERSearchReady"> |
|
146 |
</test> |
|
140 | 147 |
</or> |
141 | 148 |
</visibleWhen> |
142 | 149 |
</command> |
... | ... | |
176 | 183 |
point="org.txm.PostInstallationStep"> |
177 | 184 |
</extension> |
178 | 185 |
<extension |
179 |
point="org.eclipse.ui.handlers"> |
|
180 |
<handler |
|
181 |
class="org.txm.tigersearch.commands.ComputeTIGERSearch" |
|
182 |
commandId="org.txm.tigersearch.commands.ComputeTIGERSearch"> |
|
183 |
<enabledWhen> |
|
184 |
<test |
|
185 |
forcePluginActivation="true" |
|
186 |
property="org.txm.rcp.testers.TIGERSearchReady" |
|
187 |
value="TIGERSearchReady"> |
|
188 |
</test> |
|
189 |
</enabledWhen> |
|
190 |
</handler> |
|
191 |
</extension> |
|
192 |
<extension |
|
193 | 186 |
point="org.txm.PostTXMHOMEInstallationStep"> |
194 | 187 |
<PostTXMHOMEInstallationStep |
195 | 188 |
class="org.txm.tigersearch.rcp.InstallGroovyTIGERFiles" |
... | ... | |
225 | 218 |
</adapter> |
226 | 219 |
</factory> |
227 | 220 |
</extension> |
221 |
<extension |
|
222 |
point="org.eclipse.ui.preferencePages"> |
|
223 |
<page |
|
224 |
category="org.txm.rcp.preferences.UserPreferencePage" |
|
225 |
class="org.txm.tigersearch.rcp.preferences.TIGERSearchPreferencePage" |
|
226 |
id="org.txm.tigersearch.rcp.preferences.TIGERSearchPreferencePage" |
|
227 |
name="TIGERSearch"> |
|
228 |
</page> |
|
229 |
</extension> |
|
230 |
<extension |
|
231 |
point="org.eclipse.core.runtime.preferences"> |
|
232 |
<initializer |
|
233 |
class="org.txm.tigersearch.rcp.preferences.TIGERSearchPreferences"> |
|
234 |
</initializer> |
|
235 |
</extension> |
|
228 | 236 |
|
229 | 237 |
</plugin> |
tmp/org.txm.tigersearch.rcp/META-INF/MANIFEST.MF (revision 2101) | ||
---|---|---|
60 | 60 |
org.txm.tigersearch.commands, |
61 | 61 |
org.txm.tigersearch.editors, |
62 | 62 |
org.txm.tigersearch.rcp, |
63 |
org.txm.tigersearch.rcp.preferences, |
|
63 | 64 |
org.txm.tigersearch.rcp.tester, |
64 | 65 |
tigerAPI, |
65 | 66 |
tigerAPI.converters, |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 2101) | ||
---|---|---|
1804 | 1804 |
*/ |
1805 | 1805 |
// FIXME: SJ: this method must become abstract in TXM0.8.1 and implemented by subclasses |
1806 | 1806 |
public String getComputingStartMessage() { |
1807 |
return ""; |
|
1807 |
return "Computing "+this.getClass().getSimpleName()+"...";
|
|
1808 | 1808 |
} |
1809 | 1809 |
// public abstract String getComputingStartMessage(); |
1810 | 1810 |
|
Formats disponibles : Unified diff