Révision 737
tmp/org.txm.internalview.rcp/plugin.xml (revision 737) | ||
---|---|---|
6 | 6 |
categoryId="org.txm.rcp.category.txm" |
7 | 7 |
defaultHandler="org.txm.internalview.rcp.handlers.ComputeInternalView" |
8 | 8 |
id="org.txm.internalview.rcp.handlers.ComputeInternalView" |
9 |
name="Internal View"> |
|
9 |
name="Internal View" |
|
10 |
returnTypeId="org.txm.internalview.core.functions.InternalView"> |
|
10 | 11 |
</command> |
11 | 12 |
</extension> <extension |
12 | 13 |
point="org.eclipse.ui.menus"> |
tmp/org.txm.internalview.rcp/src/org/txm/internalview/rcp/handlers/ComputeInternalView.java (revision 737) | ||
---|---|---|
7 | 7 |
import org.txm.internalview.rcp.messages.InternalViewUIMessages; |
8 | 8 |
import org.txm.rcp.editors.TXMEditor; |
9 | 9 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
10 |
import org.txm.rcp.views.corpora.CorporaView; |
|
11 | 10 |
import org.txm.searchengine.cqp.corpus.Corpus; |
12 | 11 |
|
12 |
/** |
|
13 |
* Computes an internal view and opens an editor. |
|
14 |
* |
|
15 |
* @author mdecorde |
|
16 |
* @author sjacquot |
|
17 |
* |
|
18 |
*/ |
|
13 | 19 |
public class ComputeInternalView extends BaseAbstractHandler { |
14 | 20 |
|
15 |
// adds a double click listener to the Corpus View |
|
16 |
static { |
|
17 |
CorporaView.addDoubleClickListener(InternalView.class, ComputeInternalView.class); |
|
18 |
} |
|
19 | 21 |
|
20 |
|
|
21 | 22 |
@Override |
22 | 23 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
23 | 24 |
|
tmp/org.txm.partition.core/src/org/txm/partition/core/functions/PartitionDimensions.java (revision 737) | ||
---|---|---|
68 | 68 |
* @param UUID |
69 | 69 |
* @param partition |
70 | 70 |
*/ |
71 |
public PartitionDimensions(String UUID, Partition partition) {
|
|
72 |
super(UUID, partition);
|
|
71 |
public PartitionDimensions(String UUID) { |
|
72 |
super(UUID); |
|
73 | 73 |
} |
74 | 74 |
|
75 | 75 |
|
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifities.java (revision 737) | ||
---|---|---|
32 | 32 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
33 | 33 |
import org.txm.rcp.editors.TXMEditor; |
34 | 34 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
35 |
import org.txm.rcp.views.corpora.CorporaView; |
|
36 | 35 |
import org.txm.searchengine.cqp.corpus.Partition; |
37 | 36 |
import org.txm.searchengine.cqp.corpus.Subcorpus; |
38 | 37 |
import org.txm.specificities.core.functions.Specificities; |
... | ... | |
40 | 39 |
import org.txm.specificities.rcp.editors.SpecificitiesEditor; |
41 | 40 |
import org.txm.utils.logger.Log; |
42 | 41 |
|
43 |
// TODO: Auto-generated Javadoc |
|
44 | 42 |
/** |
45 |
* if the selection is a Partition : open the dialog for partition if the
|
|
46 |
* selection is a sub-corpus : open the diaog for sub-corpus then open the
|
|
47 |
* result in the Specificities Editor
|
|
43 |
* If the selection is a Partition: opens the dialog for partition,
|
|
44 |
* if the selection is a Subcorpus: opens the dialog for subcorpus,
|
|
45 |
* then opens the result in the Specificities Editor.
|
|
48 | 46 |
* |
49 | 47 |
* @author mdecorde |
48 |
* @author sjacquot |
|
50 | 49 |
*/ |
51 | 50 |
public class ComputeSpecifities extends BaseAbstractHandler { |
52 | 51 |
|
53 | 52 |
|
54 |
// adds a double click listener to the Corpus View |
|
55 |
static { |
|
56 |
CorporaView.addDoubleClickListener(Specificities.class, ComputeSpecifities.class); |
|
57 |
} |
|
58 |
|
|
59 | 53 |
@Override |
60 | 54 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
61 | 55 |
|
... | ... | |
108 | 102 |
Log.printStackTrace(e); |
109 | 103 |
return null; |
110 | 104 |
} |
111 |
|
|
112 |
|
|
113 |
//FIXME: old method |
|
114 |
// JobHandler jobhandler = new JobHandler(RCPMessages.ComputeSpecificities_0) { |
|
115 |
// @Override |
|
116 |
// protected IStatus run(IProgressMonitor monitor) { |
|
117 |
// this.runInit(monitor); |
|
118 |
// try { |
|
119 |
// Specificities specifRes = null; |
|
120 |
// |
|
121 |
// if (s instanceof Partition) { |
|
122 |
// Partition partition = (Partition) s; |
|
123 |
// |
|
124 |
// JobsTimer.start(); |
|
125 |
// String str = NLS.bind(RCPMessages.ComputeSpecificities_2, new Object[] { partition.getName(), property }); |
|
126 |
// monitor.beginTask(str, 100); |
|
127 |
// System.out.println(str); |
|
128 |
// |
|
129 |
// this.acquireSemaphore(); |
|
130 |
// LexicalTable table = LexicalTableFactory.getLexicalTable(partition, property, Fmin); |
|
131 |
// this.releaseSemaphore(); |
|
132 |
// |
|
133 |
// if (monitor.isCanceled()) return Status.CANCEL_STATUS; |
|
134 |
// |
|
135 |
// this.acquireSemaphore(); |
|
136 |
// specifRes = new Specificities(table, maxScore); |
|
137 |
// this.releaseSemaphore(); |
|
138 |
// |
|
139 |
// System.out.println(NLS.bind(RCPMessages.DONE, specifRes.getName())); |
|
140 |
// } |
|
141 |
// else if (s instanceof Subcorpus) { |
|
142 |
// Subcorpus subcorpus = (Subcorpus) s; |
|
143 |
// |
|
144 |
// this.acquireSemaphore(); |
|
145 |
// LexicalTable table = LexicalTableFactory.getLexicalTable(subcorpus, property); |
|
146 |
// this.releaseSemaphore(); |
|
147 |
// |
|
148 |
// if (monitor.isCanceled()) return Status.CANCEL_STATUS; |
|
149 |
// |
|
150 |
// System.out.println(NLS.bind(RCPMessages.ComputeSpecifities_3, new Object[] { subcorpus.getName(), subcorpus.getMotherCorpus().getName(), property })); |
|
151 |
// specifRes = new Specificities(table, maxScore); |
|
152 |
// } |
|
153 |
// else if (s instanceof LexicalTable) { |
|
154 |
// LexicalTable table = (LexicalTable) s; |
|
155 |
// |
|
156 |
// JobsTimer.start(); |
|
157 |
// monitor.beginTask(NLS.bind(RCPMessages.ComputeSpecifities_11, table.getPartition().getName()), 100); |
|
158 |
// System.out.println(RCPMessages.ComputeSpecificities_0 + ": " + table.getPartition().getName()); //$NON-NLS-1$ |
|
159 |
// |
|
160 |
// this.acquireSemaphore(); |
|
161 |
// specifRes = new Specificities(table, maxScore); |
|
162 |
// this.releaseSemaphore(); |
|
163 |
// |
|
164 |
// System.out.println(NLS.bind(RCPMessages.DONE, specifRes.getName())); |
|
165 |
// monitor.worked(45); |
|
166 |
// |
|
167 |
// if (monitor.isCanceled()) return Status.CANCEL_STATUS; |
|
168 |
// } else if (s instanceof Specificities) { // re-openning a Speicificties result |
|
169 |
// specifRes = (Specificities) s; |
|
170 |
// } |
|
171 |
// |
|
172 |
// if (specifRes == null) { |
|
173 |
// System.out.println("Cannot compute Specificities with "+s); |
|
174 |
// return Status.CANCEL_STATUS; |
|
175 |
// } |
|
176 |
// |
|
177 |
// if (monitor.isCanceled()) return Status.CANCEL_STATUS; |
|
178 |
// |
|
179 |
// final Specificities specifResFinal = specifRes; |
|
180 |
// this.syncExec(new Runnable() { |
|
181 |
// @Override |
|
182 |
// public void run() { |
|
183 |
//// CorporaView.refresh(); |
|
184 |
//// CorporaView.expand(specifResFinal.getParent()); |
|
185 |
// |
|
186 |
// |
|
187 |
// |
|
188 |
// //editorInput = new SpecificitiesResultEditorInput(specifResFinal); |
|
189 |
// |
|
190 |
// //TXMEditor.openEditor(new TXMResultEditorInput(new Specificities(lexicalTable, maxScore)), SpecificitiesEditor.ID); |
|
191 |
// } |
|
192 |
// }); |
|
193 |
// |
|
194 |
// } catch(Exception e) { |
|
195 |
// System.out.println(RCPMessages.Error_computing_specificities); |
|
196 |
// Log.printStackTrace(e); |
|
197 |
// return Status.CANCEL_STATUS; |
|
198 |
// } |
|
199 |
// |
|
200 |
// return Status.OK_STATUS; |
|
201 |
// } |
|
202 |
// }; |
|
203 |
// jobhandler.startJob(); |
|
204 | 105 |
return null; |
205 | 106 |
} |
206 | 107 |
} |
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifictiesSelectionChart.java (revision 737) | ||
---|---|---|
9 | 9 |
import org.eclipse.ui.handlers.HandlerUtil; |
10 | 10 |
import org.txm.chartsengine.rcp.editors.ChartEditor; |
11 | 11 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
12 |
import org.txm.rcp.views.corpora.CorporaView; |
|
13 | 12 |
import org.txm.specificities.core.functions.Specificities; |
14 | 13 |
import org.txm.specificities.core.functions.SpecificitiesSelection; |
15 | 14 |
import org.txm.specificities.rcp.editors.SpecificitiesEditor; |
16 | 15 |
|
16 |
/** |
|
17 |
* Computes a specificities chart from a selection of lines of a specificities result table. |
|
18 |
* |
|
19 |
* @author mdecorde |
|
20 |
* @author sjacquot |
|
21 |
* |
|
22 |
*/ |
|
17 | 23 |
public class ComputeSpecifictiesSelectionChart extends BaseAbstractHandler { |
18 | 24 |
|
19 | 25 |
|
20 | 26 |
|
21 |
|
|
22 |
// adds a double click listener to the Corpus View |
|
23 |
static { |
|
24 |
CorporaView.addDoubleClickListener(SpecificitiesSelection.class, ComputeSpecifictiesSelectionChart.class); |
|
25 |
} |
|
26 |
|
|
27 |
|
|
28 |
|
|
29 | 27 |
@Override |
30 | 28 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
31 | 29 |
|
tmp/org.txm.specificities.rcp/plugin.xml (revision 737) | ||
---|---|---|
24 | 24 |
categoryId="org.txm.rcp.category.txm" |
25 | 25 |
defaultHandler="org.txm.specificities.rcp.handlers.ComputeSpecifities" |
26 | 26 |
id="org.txm.specificities.rcp.handlers.ComputeSpecifities" |
27 |
name="%command.name"> |
|
27 |
name="%command.name" |
|
28 |
returnTypeId="org.txm.specificities.core.functions.Specificities"> |
|
28 | 29 |
</command> |
29 | 30 |
<command |
30 | 31 |
categoryId="org.txm.rcp.category.txm" |
31 | 32 |
defaultHandler="org.txm.specificities.rcp.handlers.ComputeSpecifictiesSelectionChart" |
32 | 33 |
id="org.txm.specificities.rcp.handlers.ComputeSpecifictiesSelectionChart" |
33 |
name="%command.name.0"> |
|
34 |
name="%command.name.0" |
|
35 |
returnTypeId="org.txm.specificities.core.functions.SpecificitiesSelection"> |
|
34 | 36 |
</command> |
35 | 37 |
</extension> |
36 | 38 |
<extension |
tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/handlers/ComputeWordCloud.java (revision 737) | ||
---|---|---|
34 | 34 |
import org.txm.rcp.StatusLine; |
35 | 35 |
import org.txm.rcp.commands.OpenBrowser; |
36 | 36 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
37 |
import org.txm.rcp.views.corpora.CorporaView; |
|
38 | 37 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
39 | 38 |
import org.txm.searchengine.cqp.corpus.Corpus; |
40 | 39 |
import org.txm.searchengine.cqp.corpus.query.Query; |
... | ... | |
42 | 41 |
import org.txm.wordcloud.core.messages.WordCloudCoreMessages; |
43 | 42 |
|
44 | 43 |
/** |
45 |
* Computes and opens a WordCloudEditor.
|
|
44 |
* Computes and opens a WordCloud editor.
|
|
46 | 45 |
* |
47 | 46 |
* @author mdecorde |
48 | 47 |
* @author sjacquot |
... | ... | |
50 | 49 |
public class ComputeWordCloud extends BaseAbstractHandler { |
51 | 50 |
|
52 | 51 |
|
53 |
// adds a double click listener to the Corpus View |
|
54 |
static { |
|
55 |
CorporaView.addDoubleClickListener(WordCloud.class, ComputeWordCloud.class); |
|
56 |
} |
|
57 |
|
|
58 |
|
|
59 | 52 |
@Override |
60 | 53 |
public Object execute(final ExecutionEvent event) throws ExecutionException { |
61 | 54 |
|
tmp/org.txm.wordcloud.rcp/plugin.xml (revision 737) | ||
---|---|---|
8 | 8 |
categoryId="org.txm.rcp.category.txm" |
9 | 9 |
defaultHandler="org.txm.wordcloud.rcp.handlers.ComputeWordCloud" |
10 | 10 |
id="org.txm.wordcloud.rcp.handlers.ComputeWordCloud" |
11 |
name="%command.name"> |
|
11 |
name="%command.name" |
|
12 |
returnTypeId="org.txm.wordcloud.core.functions.WordCloud"> |
|
12 | 13 |
</command> |
13 | 14 |
</extension> |
14 | 15 |
<extension |
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/handlers/ComputePartitionDimensionsBarChart.java (revision 737) | ||
---|---|---|
46 | 46 |
public class ComputePartitionDimensionsBarChart extends BaseAbstractHandler { |
47 | 47 |
|
48 | 48 |
|
49 |
// adds a double click listener to the Corpus View |
|
50 |
static { |
|
51 |
CorporaView.addDoubleClickListener(PartitionDimensions.class, ComputePartitionDimensionsBarChart.class); |
|
52 |
} |
|
49 |
// FIXME: adds a double click listener to the Corpus View
|
|
50 |
// static {
|
|
51 |
// CorporaView.addDoubleClickListener(PartitionDimensions.class, ComputePartitionDimensionsBarChart.class);
|
|
52 |
// }
|
|
53 | 53 |
|
54 | 54 |
|
55 | 55 |
|
tmp/org.txm.partition.rcp/plugin.xml (revision 737) | ||
---|---|---|
8 | 8 |
categoryId="org.txm.rcp.category.txm" |
9 | 9 |
defaultHandler="org.txm.partition.rcp.handlers.ComputePartitionDimensionsBarChart" |
10 | 10 |
id="org.txm.partition.rcp.handlers.ComputePartitionDimensionsBarChart" |
11 |
name="%command.name"> |
|
11 |
name="%command.name" |
|
12 |
returnTypeId="org.txm.partition.core.functions.PartitionDimensions"> |
|
12 | 13 |
</command> |
13 | 14 |
</extension> |
14 | 15 |
<extension |
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/handlers/ComputeCooccurrences.java (revision 737) | ||
---|---|---|
39 | 39 |
import org.txm.core.preferences.TXMPreferences; |
40 | 40 |
import org.txm.rcp.StatusLine; |
41 | 41 |
import org.txm.rcp.editors.TXMEditor; |
42 |
import org.txm.rcp.editors.TXMResultEditorInput; |
|
43 | 42 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
44 | 43 |
import org.txm.rcp.messages.TXMUIMessages; |
45 |
import org.txm.rcp.utils.Logger; |
|
46 |
import org.txm.rcp.views.corpora.CorporaView; |
|
47 |
import org.txm.searchengine.cqp.CQPEngine; |
|
48 | 44 |
import org.txm.searchengine.cqp.corpus.Corpus; |
49 | 45 |
import org.txm.searchengine.cqp.corpus.Property; |
50 | 46 |
import org.txm.searchengine.cqp.corpus.StructuralUnit; |
... | ... | |
52 | 48 |
import org.txm.utils.logger.Log; |
53 | 49 |
|
54 | 50 |
/** |
55 |
* if the selection is a corpus, open an empty Cooc editor if the selection is a concordance, open a Cooc editor already computed. |
|
51 |
* If the selection is a corpus, opens an empty Cooc editor, |
|
52 |
* if the selection is a concordance, opens a Cooc editor already computed. |
|
56 | 53 |
* |
57 | 54 |
* @author mdecorde |
58 | 55 |
* |
59 | 56 |
*/ |
60 | 57 |
public class ComputeCooccurrences extends BaseAbstractHandler { |
61 | 58 |
|
62 |
// adds a double click listener to the Corpus View |
|
63 |
static { |
|
64 |
CorporaView.addDoubleClickListener(Cooccurrence.class, ComputeCooccurrences.class); |
|
65 |
} |
|
66 | 59 |
|
67 |
/* (non-Javadoc) |
|
68 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
69 |
*/ |
|
70 | 60 |
@Override |
71 | 61 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
72 | 62 |
|
tmp/org.txm.cooccurrence.rcp/plugin.xml (revision 737) | ||
---|---|---|
7 | 7 |
categoryId="org.txm.rcp.category.txm" |
8 | 8 |
defaultHandler="org.txm.cooccurrence.rcp.handlers.ComputeCooccurrences" |
9 | 9 |
id="org.txm.cooccurrence.rcp.handlers.ComputeCooccurrences" |
10 |
name="%command.name"> |
|
10 |
name="%command.name" |
|
11 |
returnTypeId="org.txm.cooccurrence.core.functions.Cooccurrence"> |
|
11 | 12 |
</command> |
12 | 13 |
</extension> |
13 | 14 |
<extension |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/handlers/ComputeCA.java (revision 737) | ||
---|---|---|
46 | 46 |
import org.txm.rcp.editors.TXMResultEditorInput; |
47 | 47 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
48 | 48 |
import org.txm.rcp.messages.TXMUIMessages; |
49 |
import org.txm.rcp.views.corpora.CorporaView; |
|
50 | 49 |
import org.txm.searchengine.cqp.corpus.Partition; |
51 | 50 |
import org.txm.searchengine.cqp.corpus.Property; |
52 | 51 |
import org.txm.utils.logger.Log; |
53 | 52 |
import org.txm.utils.logger.MessageBox; |
54 | 53 |
|
55 | 54 |
/** |
56 |
* if the selection is a lexical table : opens the CA if the selection is a |
|
57 |
* partition : ask the user which property used and which threshold used then |
|
58 |
* open the CaEditor |
|
55 |
* If the selection is a lexical table: opens the CA, |
|
56 |
* if the selection is a partition: asks the user which property used and which threshold used then opens an editor |
|
59 | 57 |
* |
60 | 58 |
* @author mdecorde |
61 | 59 |
* @author sjacquot |
62 | 60 |
*/ |
63 | 61 |
public class ComputeCA extends BaseAbstractHandler { |
64 | 62 |
|
65 |
// adds a double click listener to the Corpus View |
|
66 |
static { |
|
67 |
CorporaView.addDoubleClickListener(CA.class, ComputeCA.class); |
|
68 |
} |
|
69 | 63 |
|
70 |
/* |
|
71 |
* (non-Javadoc) |
|
72 |
* |
|
73 |
* @see |
|
74 |
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands |
|
75 |
* .ExecutionEvent) |
|
76 |
*/ |
|
77 | 64 |
@Override |
78 | 65 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
79 | 66 |
|
tmp/org.txm.ca.rcp/plugin.xml (revision 737) | ||
---|---|---|
85 | 85 |
categoryId="org.txm.rcp.category.txm" |
86 | 86 |
defaultHandler="org.txm.ca.rcp.handlers.ComputeCA" |
87 | 87 |
id="org.txm.ca.rcp.handlers.ComputeCA" |
88 |
name="%command.name"> |
|
88 |
name="%command.name" |
|
89 |
returnTypeId="org.txm.ca.core.functions.CA"> |
|
89 | 90 |
</command> |
90 | 91 |
</extension> |
91 | 92 |
<extension |
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/handlers/ComputeAHC.java (revision 737) | ||
---|---|---|
67 | 67 |
|
68 | 68 |
|
69 | 69 |
// adds a double click listener to the Corpus View |
70 |
static { |
|
71 |
CorporaView.addDoubleClickListener(AHC.class, ComputeAHC.class); |
|
72 |
} |
|
70 |
// static {
|
|
71 |
// CorporaView.addDoubleClickListener(AHC.class, ComputeAHC.class);
|
|
72 |
// }
|
|
73 | 73 |
|
74 | 74 |
|
75 | 75 |
/* (non-Javadoc) |
tmp/org.txm.ahc.rcp/plugin.xml (revision 737) | ||
---|---|---|
7 | 7 |
categoryId="org.txm.rcp.category.txm" |
8 | 8 |
defaultHandler="org.txm.ahc.rcp.handlers.ComputeAHC" |
9 | 9 |
id="org.txm.cah.rcp.handlers.ComputeAHC" |
10 |
name="%command.name"> |
|
10 |
name="%command.name" |
|
11 |
returnTypeId="org.txm.ahc.core.functions.AHC"> |
|
11 | 12 |
</command> |
12 | 13 |
</extension> |
13 | 14 |
<extension |
tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 737) | ||
---|---|---|
68 | 68 |
*/ |
69 | 69 |
public final static String DEFAULT_UNIT_PROPERTY = "word"; //$NON-NLS-1$ |
70 | 70 |
|
71 |
// essentially for Links and Persistence |
|
71 | 72 |
public final static String RESULT_UUID = "result_uuid"; //$NON-NLS-1$ |
72 | 73 |
public final static String PARENT_UUID = "parent_uuid"; //$NON-NLS-1$ |
74 |
public final static String BUNDLE_ID = "bundle_id"; //$NON-NLS-1$ |
|
73 | 75 |
|
74 | 76 |
// to shared strings in some preferences |
75 | 77 |
/** |
... | ... | |
881 | 883 |
} |
882 | 884 |
} |
883 | 885 |
} catch (Exception e) { |
884 |
System.err.println(e);
|
|
886 |
e.printStackTrace();;
|
|
885 | 887 |
} |
886 | 888 |
} |
887 | 889 |
|
... | ... | |
917 | 919 |
} |
918 | 920 |
|
919 | 921 |
/** |
922 |
* Gets all the result nodes qualifier (from *.prefs file starting with "txm_res"). |
|
923 |
* @return |
|
924 |
*/ |
|
925 |
public static ArrayList<String> getResultsNodesQualifiers() { |
|
926 |
ArrayList<String> resultsNodesQualifiers = new ArrayList<String>(); |
|
927 |
try { |
|
928 |
IPreferencesService service = Platform.getPreferencesService(); |
|
929 |
for (String scopeName : service.getRootNode().childrenNames()) { |
|
930 |
if(scopeName != TXMPreferences.scope.getName()) { |
|
931 |
continue; |
|
932 |
} |
|
933 |
|
|
934 |
String[] nodesNames = service.getRootNode().node(scopeName).childrenNames(); |
|
935 |
Arrays.sort(nodesNames); |
|
936 |
for (String nodeName : nodesNames) { |
|
937 |
if(nodeName.startsWith("txm_res_")) { |
|
938 |
resultsNodesQualifiers.add(nodeName); |
|
939 |
} |
|
940 |
} |
|
941 |
} |
|
942 |
} catch (Exception e) { |
|
943 |
e.printStackTrace();; |
|
944 |
} |
|
945 |
|
|
946 |
return resultsNodesQualifiers; |
|
947 |
} |
|
948 |
|
|
949 |
|
|
950 |
/** |
|
920 | 951 |
* |
921 | 952 |
* @param nodeQualifier |
922 | 953 |
* @throws BackingStoreException |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 737) | ||
---|---|---|
134 | 134 |
} |
135 | 135 |
|
136 | 136 |
/** |
137 |
* Creates a new TXMResult with no parent. |
|
138 |
* If a local node exist with the parent_uuid, the parent will be retrieved and this result will be added to it. |
|
139 |
* @param uuid |
|
140 |
*/ |
|
141 |
public TXMResult(String uuid) { |
|
142 |
this(uuid, null); |
|
143 |
} |
|
144 |
|
|
145 |
/** |
|
137 | 146 |
* Creates a new TXMResult, child of the specified parent. |
138 | 147 |
* If UUID is null, a new UUID is generated. |
139 | 148 |
* |
... | ... | |
177 | 186 |
|
178 | 187 |
this.dirty = true; |
179 | 188 |
|
189 |
|
|
190 |
// retrieving parent from UUID |
|
191 |
if(parent == null && uuid != null && !this.getStringParameterValue(TXMPreferences.PARENT_UUID).isEmpty()) { |
|
192 |
TXMResult retrievedParent = TXMResult.getResult(this.getStringParameterValue(TXMPreferences.PARENT_UUID)); |
|
193 |
if (retrievedParent != null) { |
|
194 |
Log.warning("Parent retrieved from UUID: " + retrievedParent + "."); |
|
195 |
retrievedParent.addChild(this); |
|
196 |
} |
|
197 |
} |
|
198 |
|
|
199 |
|
|
180 | 200 |
// loads parameters from local result node, current command preferences or default command preferences |
181 | 201 |
try { |
182 | 202 |
this.autoLoadParametersFromAnnotations(); // auto fill from Parameter annotations |
183 | 203 |
this.loadParameters(); // subclasses manual settings |
184 | 204 |
|
185 |
// retrieving parent from UUID |
|
186 |
if(parent == null && uuid != null && !this.getStringParameterValue(TXMPreferences.PARENT_UUID).isEmpty()) { |
|
187 |
TXMResult retrievedParent = TXMResult.getResult(this.getStringParameterValue(TXMPreferences.PARENT_UUID)); |
|
188 |
if (retrievedParent != null) { |
|
189 |
Log.warning("Parent retrieved from UUID: " + retrievedParent + "."); |
|
190 |
retrievedParent.addChild(this); |
|
191 |
} |
|
192 |
} |
|
193 | 205 |
|
194 | 206 |
} catch (Exception e) { |
195 | 207 |
// TODO Auto-generated catch block |
... | ... | |
203 | 215 |
protected void createUUID() { |
204 | 216 |
// FIXME: see if it's useful to put the class name or not, should be better to save it in the .prefs |
205 | 217 |
//this.uniqueID = this.getClass().getName() + '@' + ID_TIME_FORMAT.format(new Date(System.currentTimeMillis())) + "_" + UUID.randomUUID(); |
206 |
this.uniqueID = ID_TIME_FORMAT.format(new Date(System.currentTimeMillis())) + "_" + UUID.randomUUID(); |
|
218 |
this.uniqueID = "txm_res_" + ID_TIME_FORMAT.format(new Date(System.currentTimeMillis())) + "_" + UUID.randomUUID();
|
|
207 | 219 |
} |
208 | 220 |
|
209 | 221 |
/** |
... | ... | |
683 | 695 |
// internal data to save for unserialization |
684 | 696 |
this.saveParameter("class", this.getClass().getName()); |
685 | 697 |
this.saveParameter(TXMPreferences.RESULT_UUID, this.uniqueID); |
698 |
this.saveParameter(TXMPreferences.BUNDLE_ID, this.preferencesNodeQualifier); |
|
686 | 699 |
if(this.parent != null) { |
687 | 700 |
this.saveParameter(TXMPreferences.PARENT_UUID, this.parent.getUUID()); |
688 | 701 |
} |
... | ... | |
1088 | 1101 |
continue; |
1089 | 1102 |
} |
1090 | 1103 |
|
1091 |
System.out.println("TXMResult.getResult(): checking UUID " + results.get(i).getUUID() + " against " + UUID); |
|
1092 | 1104 |
if(results.get(i).getUUID().equals(UUID)) { |
1093 | 1105 |
result = results.get(i); |
1094 | 1106 |
break; |
... | ... | |
1444 | 1456 |
*/ |
1445 | 1457 |
protected boolean compute(IProgressMonitor monitor, boolean updateLastParameters) throws Exception { |
1446 | 1458 |
|
1459 |
boolean skipComputing = false; |
|
1460 |
|
|
1447 | 1461 |
this.monitor = monitor; |
1448 | 1462 |
|
1449 | 1463 |
if (!this.isDirtyFromHistory()) { |
... | ... | |
1451 | 1465 |
// FIXME: Debug |
1452 | 1466 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": result parameters have not changed since last computing, computing skipped."); |
1453 | 1467 |
|
1454 |
return true;
|
|
1468 |
skipComputing = true;
|
|
1455 | 1469 |
} |
1456 | 1470 |
|
1457 | 1471 |
if (!this.isDirty()) { |
... | ... | |
1459 | 1473 |
// FIXME: Debug |
1460 | 1474 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": result is not dirty, computing skipped."); |
1461 | 1475 |
|
1462 |
return true;
|
|
1476 |
skipComputing = true;
|
|
1463 | 1477 |
} |
1464 | 1478 |
|
1465 |
// FIXME: Debug |
|
1466 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing result of type " + this.getClass() + "..."); |
|
1467 |
|
|
1468 |
|
|
1469 |
// // TODO THIS IS FUCKING LAZY LINE CODES OH YEAH YOU MAD BRO |
|
1470 |
// TODO where do we put this parent compute ? :o |
|
1471 |
// if (parent != null && !parent.getHasBeenComputedOnce()) { // parent must be computed at least one time |
|
1472 |
// SJ: other way, test the object itself |
|
1473 |
if (parent != null && !parent.getHasBeenComputedOnce()) { |
|
1474 |
if (!this.parent.compute(monitor)) { |
|
1475 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to compute parent result, computing stopped."); |
|
1476 |
|
|
1479 |
|
|
1480 |
if(!skipComputing) { |
|
1481 |
|
|
1482 |
// FIXME: Debug |
|
1483 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing result of type " + this.getClass() + "..."); |
|
1484 |
|
|
1485 |
|
|
1486 |
// // TODO THIS IS FUCKING LAZY LINE CODES OH YEAH YOU MAD BRO |
|
1487 |
// TODO where do we put this parent compute ? :o |
|
1488 |
// if (parent != null && !parent.getHasBeenComputedOnce()) { // parent must be computed at least one time |
|
1489 |
// SJ: other way, test the object itself |
|
1490 |
if (parent != null && !parent.getHasBeenComputedOnce()) { |
|
1491 |
if (!this.parent.compute(monitor)) { |
|
1492 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to compute parent result, computing stopped."); |
|
1493 |
|
|
1494 |
return false; |
|
1495 |
} |
|
1496 |
} |
|
1497 |
|
|
1498 |
if (!this.canCompute()) { |
|
1499 |
// FIXME: Debug |
|
1500 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": missing or wrong parameters, computing aborted."); |
|
1501 |
|
|
1477 | 1502 |
return false; |
1478 | 1503 |
} |
1504 |
|
|
1505 |
if (!this._compute()) { |
|
1506 |
|
|
1507 |
// FIXME: Debug |
|
1508 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing failed."); |
|
1509 |
|
|
1510 |
return false; |
|
1511 |
} |
|
1479 | 1512 |
} |
1480 |
|
|
1481 |
if (!this.canCompute()) { |
|
1482 |
// FIXME: Debug |
|
1483 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": missing or wrong parameters, computing aborted."); |
|
1484 |
|
|
1485 |
return false; |
|
1486 |
} |
|
1487 |
|
|
1488 |
if (!this._compute()) { |
|
1489 |
|
|
1490 |
// FIXME: Debug |
|
1491 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing failed."); |
|
1492 |
|
|
1493 |
return false; |
|
1494 |
} |
|
1495 |
|
|
1513 |
|
|
1496 | 1514 |
// store last used parameters |
1497 | 1515 |
if(updateLastParameters) { |
1498 | 1516 |
this.updateLastParameters(); |
... | ... | |
1511 | 1529 |
TXMPreferences.flush(this); |
1512 | 1530 |
} |
1513 | 1531 |
|
1514 |
|
|
1532 |
if(!skipComputing) { |
|
1533 |
this.dirty = false; // the computing was successful, the result is no more dirty |
|
1534 |
this.hasBeenComputedOnce = true; |
|
1535 |
// FIXME: Debug |
|
1536 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing of result type " + this.getClass() + " done."); |
|
1537 |
} |
|
1515 | 1538 |
|
1516 |
this.dirty = false; // the computing was successful, the result is no more dirty |
|
1517 |
this.hasBeenComputedOnce = true; |
|
1518 |
// FIXME: Debug |
|
1519 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing of result type " + this.getClass() + " done."); |
|
1520 |
|
|
1521 | 1539 |
return true; |
1522 | 1540 |
} |
1523 | 1541 |
|
tmp/org.txm.core/src/java/org/txm/objects/Corpus.java (revision 737) | ||
---|---|---|
156 | 156 |
protected int conc_left_context = 8; // read only |
157 | 157 |
protected int conc_right_context = 12; // read only |
158 | 158 |
|
159 |
|
|
160 |
|
|
161 |
/** |
|
162 |
* Instantiates a new corpus. |
|
163 |
* |
|
164 |
* @param base the base |
|
165 |
* @param c the c |
|
166 |
*/ |
|
167 |
public Corpus(Base base, Element c) { |
|
168 |
super(base); |
|
169 |
if(base != null && c != null) { |
|
170 |
this.base = base; |
|
171 |
this.setPath(base.getPath() + getName()); |
|
172 |
setSelfElement(c); |
|
173 |
load(); |
|
174 |
} |
|
175 |
} |
|
159 | 176 |
|
177 |
|
|
178 |
|
|
160 | 179 |
/** |
161 | 180 |
* Gets the text. |
162 | 181 |
* |
... | ... | |
989 | 1008 |
this.viewProperties = viewProperties; |
990 | 1009 |
} |
991 | 1010 |
|
992 |
/** |
|
993 |
* Instantiates a new corpus. |
|
994 |
* |
|
995 |
* @param base the base |
|
996 |
* @param c the c |
|
997 |
*/ |
|
998 |
public Corpus(Base base, Element c) { |
|
999 |
super(base); |
|
1000 |
if(base != null && c != null) { |
|
1001 |
this.base = base; |
|
1002 |
this.setPath(base.getPath() + getName()); |
|
1003 |
setSelfElement(c); |
|
1004 |
load(); |
|
1005 |
} |
|
1006 |
} |
|
1007 | 1011 |
|
1008 | 1012 |
/** |
1009 | 1013 |
* Gets the project. |
tmp/org.txm.core/src/java/org/txm/Toolbox.java (revision 737) | ||
---|---|---|
34 | 34 |
import java.io.FileNotFoundException; |
35 | 35 |
import java.io.IOException; |
36 | 36 |
import java.io.InputStreamReader; |
37 |
import java.lang.reflect.Constructor; |
|
38 |
import java.util.ArrayList; |
|
37 | 39 |
import java.util.Arrays; |
38 | 40 |
import java.util.LinkedHashMap; |
39 | 41 |
import java.util.logging.Level; |
... | ... | |
45 | 47 |
import org.eclipse.core.runtime.ISafeRunnable; |
46 | 48 |
import org.eclipse.core.runtime.Platform; |
47 | 49 |
import org.eclipse.core.runtime.SafeRunner; |
50 |
import org.osgi.framework.Bundle; |
|
48 | 51 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
49 | 52 |
import org.eclipse.core.runtime.preferences.IPreferencesService; |
50 | 53 |
import org.txm.core.messages.TXMCoreMessages; |
... | ... | |
234 | 237 |
} catch(Exception e) { |
235 | 238 |
System.out.println("Error while post-installaing plugins: "+e.getLocalizedMessage()); |
236 | 239 |
} |
240 |
|
|
241 |
|
|
242 |
// FIXME: persistence tests |
|
243 |
if (TBXPreferences.getBoolean(TBXPreferences.AUTO_SAVE_RESULTS, TBXPreferences.PREFERENCES_NODE)) { |
|
244 |
System.out.println("Toolbox.initialize(): reloading persitent results..."); |
|
245 |
ArrayList<String> resultsNodesQualifiers = TXMPreferences.getResultsNodesQualifiers(); |
|
246 |
for (String nodeQualifier : resultsNodesQualifiers) { |
|
247 |
try { |
|
248 |
System.out.println("Toolbox.initialize(): loading from result node qualifier " + nodeQualifier); |
|
249 |
System.out.println("Toolbox.initialize(): class = " + TXMPreferences.getString("class", nodeQualifier)); |
|
250 |
System.out.println("Toolbox.initialize(): parent_uuid = " + TXMPreferences.getString(TXMPreferences.PARENT_UUID, nodeQualifier)); |
|
251 |
System.out.println("Toolbox.initialize(): bundle_id = " + TXMPreferences.getString(TXMPreferences.BUNDLE_ID, nodeQualifier)); |
|
252 |
Bundle bundle = Platform.getBundle(TXMPreferences.getString(TXMPreferences.BUNDLE_ID, nodeQualifier)); |
|
253 |
Class<?> cl = bundle.loadClass(TXMPreferences.getString("class", nodeQualifier)); |
|
254 |
Constructor<?> cons = cl.getConstructor(String.class); |
|
255 |
cons.newInstance(nodeQualifier); |
|
256 |
} |
|
257 |
catch (Exception e) { |
|
258 |
// TODO Auto-generated catch block |
|
259 |
e.printStackTrace(); |
|
260 |
} |
|
261 |
} |
|
262 |
} |
|
263 |
|
|
264 |
|
|
265 |
|
|
237 | 266 |
initializing = false; |
238 | 267 |
return checkState(); |
239 | 268 |
} |
tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/ComputeLexicon.java (revision 737) | ||
---|---|---|
9 | 9 |
import org.txm.index.rcp.editors.DictionnaryEditor; |
10 | 10 |
import org.txm.rcp.editors.TXMEditor; |
11 | 11 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
12 |
import org.txm.rcp.views.corpora.CorporaView; |
|
13 | 12 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
14 | 13 |
import org.txm.searchengine.cqp.corpus.Corpus; |
15 | 14 |
import org.txm.searchengine.cqp.corpus.query.Query; |
... | ... | |
22 | 21 |
*/ |
23 | 22 |
public class ComputeLexicon extends BaseAbstractHandler { |
24 | 23 |
|
25 |
// FIXME: adds a double click listener to the Corpus View |
|
26 |
static { |
|
27 |
CorporaView.addDoubleClickListener(Index.class, ComputeIndex.class); |
|
28 |
} |
|
29 |
|
|
30 |
|
|
31 |
|
|
32 | 24 |
@Override |
33 | 25 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
34 | 26 |
|
... | ... | |
53 | 45 |
e.printStackTrace(); |
54 | 46 |
} |
55 | 47 |
} |
56 |
// Reopening an existing Lexicon |
|
57 |
else if(selection instanceof Index) { |
|
58 |
index = (Index) selection; |
|
59 |
} |
|
48 |
// // Reopening an existing Lexicon
|
|
49 |
// else if(selection instanceof Index) {
|
|
50 |
// index = (Index) selection;
|
|
51 |
// }
|
|
60 | 52 |
else { |
61 | 53 |
super.logCanNotCompute(selection); |
62 | 54 |
} |
tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/ComputeIndex.java (revision 737) | ||
---|---|---|
27 | 27 |
// |
28 | 28 |
package org.txm.index.rcp.handlers; |
29 | 29 |
|
30 |
import java.util.Map.Entry; |
|
31 |
|
|
32 | 30 |
import org.eclipse.core.commands.ExecutionEvent; |
33 | 31 |
import org.eclipse.core.commands.ExecutionException; |
34 | 32 |
import org.txm.index.core.functions.Index; |
35 | 33 |
import org.txm.index.rcp.editors.IndexEditor; |
36 | 34 |
import org.txm.rcp.editors.TXMEditor; |
37 | 35 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
38 |
import org.txm.rcp.views.corpora.CorporaView; |
|
39 | 36 |
import org.txm.searchengine.cqp.corpus.Corpus; |
40 | 37 |
import org.txm.searchengine.cqp.corpus.Partition; |
41 | 38 |
|
... | ... | |
48 | 45 |
public class ComputeIndex extends BaseAbstractHandler { |
49 | 46 |
|
50 | 47 |
|
51 |
|
|
52 |
// adds a double click listener to the Corpus View |
|
53 |
static { |
|
54 |
CorporaView.addDoubleClickListener(Index.class, ComputeIndex.class); |
|
55 |
} |
|
56 |
|
|
57 | 48 |
@Override |
58 | 49 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
59 | 50 |
|
tmp/org.txm.index.rcp/plugin.xml (revision 737) | ||
---|---|---|
170 | 170 |
categoryId="org.txm.rcp.category.txm" |
171 | 171 |
defaultHandler="org.txm.index.rcp.handlers.ComputeIndex" |
172 | 172 |
id="org.txm.index.rcp.handlers.ComputeIndex" |
173 |
name="%command.name"> |
|
173 |
name="%command.name" |
|
174 |
returnTypeId="org.txm.index.core.functions.Index"> |
|
174 | 175 |
</command> |
175 | 176 |
<command |
176 | 177 |
categoryId="org.txm.rcp.category.txm" |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 737) | ||
---|---|---|
14 | 14 |
import org.eclipse.swt.widgets.Composite; |
15 | 15 |
import org.eclipse.swt.widgets.Group; |
16 | 16 |
import org.eclipse.ui.IPartListener; |
17 |
import org.eclipse.ui.IWorkbenchPage; |
|
17 | 18 |
import org.eclipse.ui.IWorkbenchPart; |
19 |
import org.eclipse.ui.IWorkbenchWindow; |
|
20 |
import org.eclipse.ui.PartInitException; |
|
18 | 21 |
import org.eclipse.ui.PlatformUI; |
19 | 22 |
import org.eclipse.ui.part.EditorPart; |
20 | 23 |
import org.eclipse.ui.part.MultiPageEditorPart; |
... | ... | |
27 | 30 |
import org.txm.chartsengine.rcp.swt.AdvancedChartEditorToolBar; |
28 | 31 |
import org.txm.chartsengine.rcp.swt.ChartComposite; |
29 | 32 |
import org.txm.chartsengine.rcp.swt.ChartEditorToolBar; |
33 |
import org.txm.core.results.TXMResult; |
|
34 |
import org.txm.rcp.TXMWindows; |
|
30 | 35 |
import org.txm.rcp.editors.TXMEditor; |
36 |
import org.txm.rcp.editors.TXMResultEditorInput; |
|
31 | 37 |
import org.txm.utils.logger.Log; |
32 | 38 |
|
33 | 39 |
/** |
... | ... | |
170 | 176 |
|
171 | 177 |
|
172 | 178 |
/** |
173 |
* |
|
179 |
* Opens an editor where id is the specified result class name, computes the result then refreshes the editor components.
|
|
174 | 180 |
* @param result |
175 | 181 |
*/ |
176 | 182 |
public static void openEditor(ChartResult result) { |
... | ... | |
179 | 185 |
|
180 | 186 |
|
181 | 187 |
/** |
182 |
* |
|
188 |
* Opens an editor specified by its id, computes the specified result then refreshes the editor components.
|
|
183 | 189 |
* @param result |
184 | 190 |
* @param editorPartId |
191 |
* @return |
|
185 | 192 |
*/ |
186 |
public static void openEditor(ChartResult result, String editorPartId) { |
|
187 |
compute(new ChartEditorInput(result), editorPartId, false, null); |
|
193 |
public static ChartEditor openEditor(ChartResult result, String editorPartId) { |
|
194 |
|
|
195 |
// FIXME: voir si on peut pas revenir à l'ouverture de l'éditeur ICI plutot que dans le compute, ca permettrait de retourner le TXMEditor dans openEditor() |
|
196 |
return (ChartEditor) openEditor(new ChartEditorInput<ChartResult>(result), editorPartId); |
|
197 |
|
|
198 |
//compute(new ChartEditorInput<ChartResult>(result), editorPartId, false, null); |
|
188 | 199 |
} |
189 | 200 |
|
190 | 201 |
|
... | ... | |
225 | 236 |
|
226 | 237 |
|
227 | 238 |
|
239 |
boolean needInit = (this.chartComposite.getChartComponent() == null) && (this.getResult().getChart() != null); |
|
240 |
|
|
228 | 241 |
// loading chart |
229 | 242 |
this.getResult().subTask("Loading chart."); |
230 | 243 |
this.loadChart(); |
231 | 244 |
|
232 | 245 |
// if editor wasn't exist: |
233 | 246 |
// hiding command parameters, updating tool bar buttons states, registering context menus and event user callbacks |
234 |
if(!update && !getResult().isChartDirty()) { |
|
247 |
if(needInit |
|
248 |
|
|
249 |
//!update |
|
250 |
// && !this.getResult().isChartDirty() |
|
251 |
) { |
|
235 | 252 |
// getSite().getShell().getDisplay().syncExec(new Runnable() { |
236 | 253 |
// @Override |
237 | 254 |
// public void run() { |
... | ... | |
269 | 286 |
/** |
270 | 287 |
* Registers user entries event call back extensions. |
271 | 288 |
*/ |
272 |
protected void registerEventCallBackExtensions() {
|
|
289 |
public void registerEventCallBackExtensions() {
|
|
273 | 290 |
String extensionPointId = "org.txm.chartsengine.eventcallback"; //$NON-NLS-1$ |
274 | 291 |
IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointId); |
275 | 292 |
|
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 737) | ||
---|---|---|
52 | 52 |
/** The corpus. */ |
53 | 53 |
private Corpus corpus; |
54 | 54 |
|
55 |
/** The graphtype. */
|
|
55 |
/** The chart type. */
|
|
56 | 56 |
private boolean cumulative = true; |
57 | 57 |
|
58 | 58 |
/** The linewidth. */ |
... | ... | |
168 | 168 |
|
169 | 169 |
try { |
170 | 170 |
|
171 |
cumulative = this.getBooleanParameterValue(ProgressionPreferences.CHART_CUMULATIVE); |
|
172 | 171 |
|
173 | 172 |
// System.out.println(parent.getLayout()); |
174 | 173 |
Composite mainPanel = this.getCommandParametersGroup(); |
... | ... | |
192 | 191 |
|
193 | 192 |
cumulativeButton = new Button(paramPanel, SWT.RADIO); |
194 | 193 |
cumulativeButton.setText(ProgressionUIMessages.ProgressionDialog_2); |
195 |
cumulativeButton.setSelection(cumulative); |
|
196 | 194 |
// listeners |
197 | 195 |
cumulativeButton.addSelectionListener(new ComputeSelectionListener(this)); |
198 | 196 |
cumulativeButton.addSelectionListener(new SelectionListener() { |
... | ... | |
208 | 206 |
|
209 | 207 |
densityButton = new Button(paramPanel, SWT.RADIO); |
210 | 208 |
densityButton.setText(ProgressionUIMessages.ProgressionDialog_3); |
211 |
densityButton.setSelection(!cumulative); |
|
212 | 209 |
// listener |
213 | 210 |
densityButton.addSelectionListener(new SelectionListener() { |
214 | 211 |
|
... | ... | |
420 | 417 |
* @return the added QueryField |
421 | 418 |
*/ |
422 | 419 |
private QueryField addFocusQueryField() { |
423 |
return this.addFocusQueryField(""); |
|
420 |
return this.addFocusQueryField(""); //$NON-NLS-1$
|
|
424 | 421 |
} |
425 | 422 |
|
426 | 423 |
|
... | ... | |
436 | 433 |
addFocusQueryField(q.getQueryString()); |
437 | 434 |
} |
438 | 435 |
} |
436 |
|
|
437 |
cumulative = this.getResult().isDefaultChartType(); |
|
438 |
cumulativeButton.setSelection(cumulative); |
|
439 |
densityButton.setSelection(!cumulative); |
|
440 |
|
|
441 |
|
|
439 | 442 |
} |
440 | 443 |
|
441 | 444 |
|
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/events/ProgressionEventCallBack.java (revision 737) | ||
---|---|---|
7 | 7 |
import java.util.ArrayList; |
8 | 8 |
import java.util.List; |
9 | 9 |
|
10 |
import org.eclipse.core.runtime.jobs.IJobChangeEvent; |
|
11 |
import org.eclipse.core.runtime.jobs.Job; |
|
12 |
import org.eclipse.core.runtime.jobs.JobChangeAdapter; |
|
10 | 13 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
11 | 14 |
import org.eclipse.jface.viewers.StructuredSelection; |
12 | 15 |
import org.eclipse.jface.viewers.TableViewer; |
16 |
import org.eclipse.swt.widgets.Display; |
|
13 | 17 |
import org.eclipse.ui.IWorkbenchPage; |
14 | 18 |
import org.eclipse.ui.IWorkbenchWindow; |
15 | 19 |
import org.eclipse.ui.PartInitException; |
... | ... | |
33 | 37 |
import org.txm.searchengine.cqp.corpus.Property; |
34 | 38 |
import org.txm.searchengine.cqp.corpus.StructuralUnit; |
35 | 39 |
import org.txm.searchengine.cqp.corpus.query.Match; |
40 |
import org.txm.searchengine.cqp.corpus.query.Query; |
|
36 | 41 |
import org.txm.synopticedition.rcp.editors.RGBA; |
37 | 42 |
import org.txm.synopticedition.rcp.editors.SynopticEditionEditor; |
38 | 43 |
import org.txm.synopticedition.rcp.handlers.OpenEdition; |
... | ... | |
50 | 55 |
* To keep track of the concordance lines and recomputing only if the selected item is out of this range. |
51 | 56 |
*/ |
52 | 57 |
protected int lastConcordanceTopLine = -1; |
53 |
protected int lastConcordanceBottomLine = -1; |
|
58 |
//protected int lastConcordanceBottomLine = -1;
|
|
54 | 59 |
|
55 | 60 |
/** |
56 | 61 |
* To keep track of the concordance lines sort and recomputing only if the sorting order has changed. |
... | ... | |
252 | 257 |
* @param linkedEditors |
253 | 258 |
* @param selectedPointPositions |
254 | 259 |
*/ |
255 |
public void updateLinkedConcordanceEditor(ArrayList<EditorPart> linkedEditors, ArrayList<Integer> selectedPointPositions) { |
|
260 |
public void updateLinkedConcordanceEditor(ArrayList<EditorPart> linkedEditors, final ArrayList<Integer> selectedPointPositions) {
|
|
256 | 261 |
|
257 | 262 |
// FIXME: Debug |
258 | 263 |
//System.err.println("ProgressionEventCallBack.updateLinkedConcordanceEditor(): linked editors count: " + linkedEditors.size()); |
... | ... | |
292 | 297 |
|
293 | 298 |
|
294 | 299 |
|
295 |
TXMResultEditorInput editorInput; |
|
300 |
final TXMResultEditorInput editorInput;
|
|
296 | 301 |
boolean newEditor = false; |
297 | 302 |
// Create the linked editor input if needed |
298 | 303 |
if (linkedEditor == null) { |
299 | 304 |
Concordance concordance = new Concordance(((Progression) chartEditor.getResult()).getCorpus()); |
305 |
concordance.setQuery(query); |
|
300 | 306 |
editorInput = new TXMResultEditorInput(concordance); |
301 | 307 |
newEditor = true; |
302 |
} else { |
|
308 |
} |
|
309 |
else { |
|
303 | 310 |
editorInput = (TXMResultEditorInput) linkedEditor.getEditorInput(); |
304 | 311 |
} |
305 | 312 |
|
306 | 313 |
try { |
307 |
boolean wasOpenEditor = SWTEditorsUtils.isOpenEditor(editorInput);
|
|
314 |
boolean wasOpenedEditor = SWTEditorsUtils.isOpenEditor(editorInput, ConcordanceEditor.ID);
|
|
308 | 315 |
|
309 |
linkedEditor = (ConcordanceEditor) page.openEditor(editorInput, ConcordanceEditor.ID, false); //$NON-NLS-1$
|
|
316 |
linkedEditor = (ConcordanceEditor) page.openEditor(editorInput, ConcordanceEditor.ID, false); |
|
310 | 317 |
if(newEditor) { |
311 | 318 |
chartEditor.addLinkedEditor(linkedEditor); |
312 | 319 |
} |
313 | 320 |
|
314 | 321 |
// Split the area and insert the new editor |
315 |
if(!wasOpenEditor) { |
|
322 |
if(!wasOpenedEditor) {
|
|
316 | 323 |
|
317 | 324 |
int position = EModelService.BELOW; |
318 | 325 |
EditorPart parentEditor = chartEditor; |
... | ... | |
333 | 340 |
System.err.println("Error: "+e.getLocalizedMessage()); |
334 | 341 |
} |
335 | 342 |
|
336 |
linkedEditor.setQuery(query); |
|
337 |
// Compute the concordance if the query has changed or if the concordance has never been computed |
|
338 |
if(linkedEditor.getConcordance() == null || newEditor) { |
|
339 |
linkedEditor.compute(false); |
|
340 |
// initialize range change tracking variables |
|
341 |
this.lastConcordanceTopLine = 0; |
|
342 |
this.lastConcordanceBottomLine = linkedEditor.getLinePerPage(); |
|
343 |
this.lastSortingComparator = linkedEditor.getCurrentComparator(); |
|
343 |
// Compute the concordance if it has never been computed |
|
344 |
if(newEditor) { |
|
345 |
Job job = linkedEditor.compute(false); |
|
346 |
|
|
347 |
final ConcordanceEditor linkedEditor2 = linkedEditor; |
|
348 |
|
|
349 |
job.addJobChangeListener(new JobChangeAdapter() { |
|
350 |
@Override |
|
351 |
public void done(IJobChangeEvent event) { |
|
352 |
super.done(event); |
|
353 |
|
|
354 |
// initialize range change tracking variables |
|
355 |
lastConcordanceTopLine = -1; |
|
356 |
//lastConcordanceBottomLine = linkedEditor.getLinePerPage(); |
|
357 |
lastSortingComparator = linkedEditor2.getCurrentComparator(); |
|
358 |
|
|
359 |
updateLinkedConcordanceEditor(linkedEditor2, selectedPointPositions, true); |
|
360 |
|
|
361 |
} |
|
362 |
}); |
|
363 |
|
|
344 | 364 |
} |
365 |
else { |
|
366 |
updateLinkedConcordanceEditor(linkedEditor, selectedPointPositions, false); |
|
367 |
} |
|
368 |
|
|
369 |
// give back the focus to chart editor |
|
370 |
chartEditor.setFocus(); |
|
371 |
} |
|
345 | 372 |
|
346 |
|
|
347 | 373 |
|
374 |
public void updateLinkedConcordanceEditor(final ConcordanceEditor linkedEditor, final ArrayList<Integer> selectedPointPositions, boolean loadLines) { |
|
348 | 375 |
|
349 | 376 |
final TableViewer tableViewer = linkedEditor.getLineTableViewer(); |
350 | 377 |
if(selectedPointPositions.size() > 0) { |
... | ... | |
353 | 380 |
int lineIndex = linkedEditor.getConcordance().indexOf(selectedPointPositions.get(selectedPointPositions.size() - 1)); |
354 | 381 |
|
355 | 382 |
int top = lineIndex - (lineIndex % linkedEditor.getLinePerPage()); |
356 |
int bottom = top + linkedEditor.getLinePerPage() - 1; |
|
357 | 383 |
|
384 |
linkedEditor.getConcordance().setTopIndex(top); |
|
358 | 385 |
|
359 |
// Manage the lazy loading of new lines range in the concordance |
|
360 |
boolean loadLines = false; |
|
361 |
// not open editor (or new editor) |
|
362 |
if(!SWTEditorsUtils.isOpenEditor(editorInput)) { |
|
363 |
loadLines = true; |
|
364 |
} |
|
386 |
// Manage the lazy loading of new lines range in the concordance table |
|
365 | 387 |
// page change |
366 |
else if(this.lastConcordanceTopLine != top || this.lastConcordanceBottomLine != bottom) {
|
|
388 |
if(lastConcordanceTopLine != top) {
|
|
367 | 389 |
loadLines = true; |
368 | 390 |
} |
369 | 391 |
// sort change |
370 |
else if(this.lastSortingComparator != linkedEditor.getCurrentComparator()) {
|
|
392 |
else if(lastSortingComparator != linkedEditor.getCurrentComparator()) { |
|
371 | 393 |
loadLines = true; |
372 | 394 |
} |
395 |
|
|
373 | 396 |
|
374 |
|
|
375 | 397 |
// Loads new lines, fill the display area and select the table row |
376 | 398 |
if(loadLines) { |
377 |
//FIXME: old code that workd but Matt has removed this method from the ConcordanceEditor, see if it still work |
|
378 |
//linkedEditor.fillDisplayArea(top, bottom); |
|
379 |
linkedEditor.fillDisplayArea(); |
|
399 |
Display.getDefault().syncExec(new Runnable() { |
|
400 |
@Override |
|
401 |
public void run() { |
|
402 |
linkedEditor.fillDisplayArea(); |
|
403 |
} |
|
404 |
}); |
|
405 |
|
|
380 | 406 |
} |
381 | 407 |
|
382 | 408 |
// update range change tracking variables |
383 |
this.lastConcordanceTopLine = top; |
|
384 |
this.lastConcordanceBottomLine = bottom; |
|
385 |
this.lastSortingComparator = linkedEditor.getCurrentComparator(); |
|
386 |
|
|
409 |
lastConcordanceTopLine = top; |
|
410 |
//lastConcordanceBottomLine = bottom; |
|
411 |
lastSortingComparator = linkedEditor.getCurrentComparator(); |
|
387 | 412 |
|
388 | 413 |
|
389 | 414 |
final int selectedPointInTableRange = lineIndex - top; |
... | ... | |
398 | 423 |
tableViewer.setSelection(new StructuredSelection(line), true); |
399 | 424 |
// FIXME: commented because the set top index makes the read of the table difficult |
400 | 425 |
//tableViewer.getTable().setTopIndex(selectedPointInTableRange); |
426 |
System.out.println("ProgressionEventCallBack.updateLinkedConcordanceEditor(...).new Runnable() {...}.run(): Selecting progression point (" + selectedPointInTableRange + " / " + tableViewer.getTable().getItemCount() + ") in the linked Concordance table."); |
|
401 | 427 |
} |
402 | 428 |
else { |
403 |
Log.info("Selected progression point doesn't exist in the linked Concordance.");
|
|
429 |
System.err.println("ProgressionEventCallBack.updateLinkedConcordanceEditor(...).new Runnable() {...}.run(): Selected progression point (" + selectedPointInTableRange + " / " + tableViewer.getTable().getItemCount() + ") doesn't exist in the linked Concordance table.");
|
|
404 | 430 |
} |
405 | 431 |
} |
406 | 432 |
}); |
... | ... | |
408 | 434 |
else { |
409 | 435 |
tableViewer.getTable().deselectAll(); |
410 | 436 |
} |
411 |
|
|
412 |
// give back the focus to chart editor |
|
413 |
chartEditor.setFocus(); |
|
414 | 437 |
} |
415 |
|
|
438 |
|
|
416 | 439 |
//FIXME: version with new SynopticEditionEditor system edition |
417 | 440 |
/** |
418 | 441 |
* Updates the linked edition editor. |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java (revision 737) | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import org.eclipse.core.commands.ExecutionEvent; |
31 | 31 |
import org.eclipse.core.commands.ExecutionException; |
32 |
import org.eclipse.core.runtime.preferences.InstanceScope; |
|
33 | 32 |
import org.txm.chartsengine.rcp.editors.ChartEditor; |
34 | 33 |
import org.txm.core.preferences.TXMPreferences; |
35 | 34 |
import org.txm.progression.core.functions.Progression; |
36 | 35 |
import org.txm.progression.core.messages.ProgressionCoreMessages; |
37 | 36 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
38 |
import org.txm.rcp.views.corpora.CorporaView; |
|
39 | 37 |
import org.txm.searchengine.cqp.corpus.Corpus; |
40 | 38 |
import org.txm.utils.logger.Log; |
41 | 39 |
|
... | ... | |
50 | 48 |
|
51 | 49 |
// FIXME: should be put in an Activator? or better in an extension point loaded by the corpora view? or in a method called here as initTreeDoubleClickListener(Class resultDataType, String commandId)? |
52 | 50 |
// adds a double click listener to the Corpus View |
53 |
static { |
|
54 |
CorporaView.addDoubleClickListener(Progression.class, ComputeProgression.class); |
|
55 |
} |
|
51 |
// static {
|
|
52 |
// CorporaView.addDoubleClickListener(Progression.class, ComputeProgression.class);
|
|
53 |
// }
|
|
56 | 54 |
|
57 | 55 |
|
58 | 56 |
|
... | ... | |
84 | 82 |
return null; |
85 | 83 |
} |
86 | 84 |
progression = new Progression(corpus); |
87 |
|
|
88 |
// FIXME: persistence tests from a file named "201805123_433f0b69-1083-4ed6-be1c-bcd48c73aeae" |
|
89 |
// progression = new Progression("201805123_433f0b69-1083-4ed6-be1c-bcd48c73aeae", corpus); |
|
90 |
|
|
91 |
|
|
92 | 85 |
} |
93 | 86 |
// Reopening an existing result |
94 | 87 |
else if (selection instanceof Progression) { |
tmp/org.txm.progression.rcp/plugin.xml (revision 737) | ||
---|---|---|
16 | 16 |
categoryId="org.txm.rcp.category.txm" |
17 | 17 |
defaultHandler="org.txm.progression.rcp.handlers.ComputeProgression" |
18 | 18 |
id="org.txm.progression.rcp.handlers.ComputeProgression" |
19 |
name="%command.name"> |
|
19 |
name="%command.name" |
|
20 |
returnTypeId="org.txm.progression.core.functions.Progression"> |
|
20 | 21 |
</command> |
21 | 22 |
</extension> |
22 | 23 |
<extension |
tmp/org.txm.textsbalance.rcp/plugin.xml (revision 737) | ||
---|---|---|
16 | 16 |
<command |
17 | 17 |
defaultHandler="org.txm.textsbalance.rcp.handlers.ComputeTextsBalance" |
18 | 18 |
id="org.txm.textsbalance.rcp.handlers.ComputeTextsBalance" |
19 |
name="Texts balance"> |
|
19 |
name="Texts balance" |
|
20 |
returnTypeId="org.txm.textsbalance.core.functions.TextsBalance"> |
|
20 | 21 |
<commandParameter |
21 | 22 |
id="TextsBalance.createNewEditor" |
22 | 23 |
name="%commandParameter.name" |
tmp/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/handlers/ComputeTextsBalance.java (revision 737) | ||
---|---|---|
45 | 45 |
public class ComputeTextsBalance extends BaseAbstractHandler { |
46 | 46 |
|
47 | 47 |
|
48 |
|
|
49 |
// adds a double click listener to the Corpus View |
|
50 |
static { |
|
51 |
CorporaView.addDoubleClickListener(TextsBalance.class, ComputeTextsBalance.class); |
|
52 |
} |
|
53 |
|
|
54 |
|
|
55 |
|
|
56 | 48 |
@Override |
57 | 49 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
58 | 50 |
|
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 737) | ||
---|---|---|
10 | 10 |
import org.txm.chartsengine.core.ChartCreator; |
11 | 11 |
import org.txm.chartsengine.core.ChartsEngine; |
12 | 12 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
13 |
import org.txm.core.preferences.TBXPreferences; |
|
13 | 14 |
import org.txm.core.preferences.TXMPreferences; |
14 | 15 |
import org.txm.core.results.Parameter; |
15 | 16 |
import org.txm.core.results.TXMResult; |
... | ... | |
99 | 100 |
|
100 | 101 |
|
101 | 102 |
/** |
102 |
* |
|
103 |
* Creates a new ChartResult child of the specified parent.
|
|
103 | 104 |
* @param parent |
104 | 105 |
*/ |
105 | 106 |
public ChartResult(TXMResult parent) { |
106 | 107 |
this(null, parent); |
107 | 108 |
} |
108 | 109 |
|
110 |
|
|
109 | 111 |
/** |
110 |
* |
|
112 |
* Creates a new ChartResult with no parent. |
|
113 |
* If a local node exist with the parent_uuid, the parent will be retrieved and this result will be added to it. |
|
111 | 114 |
* @param uuid |
115 |
*/ |
|
116 |
public ChartResult(String uuid) { |
|
117 |
this(uuid, null); |
|
118 |
} |
|
119 |
|
|
120 |
/** |
|
121 |
* Creates a new ChartResult child of the specified parent. |
|
122 |
* @param uuid |
|
112 | 123 |
* @param parent |
113 | 124 |
*/ |
114 | 125 |
public ChartResult(String uuid, TXMResult parent) { |
... | ... | |
221 | 232 |
|
222 | 233 |
this.chartDirty = false; |
223 | 234 |
|
235 |
|
|
236 |
// if (TBXPreferences.getBoolean(TBXPreferences.AUTO_SAVE_RESULTS, TBXPreferences.PREFERENCES_NODE)) { |
|
237 |
// System.err.println("ChartResult.renderChart(): flushing local preferences node in file for persistence tests."); |
|
238 |
// TXMPreferences.flush(this); |
|
239 |
// } |
|
240 |
|
|
241 |
|
|
242 |
|
|
224 | 243 |
// FIXME: debug |
225 | 244 |
System.err.println("ChartResult.renderChart(): chart rendering done."); |
226 | 245 |
|
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 737) | ||
---|---|---|
448 | 448 |
sash.getParent().layout(); |
449 | 449 |
} |
450 | 450 |
}); |
451 |
viewer = new TableViewer(displayArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.VIRTUAL); |
|
451 |
viewer = new TableViewer(displayArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER |
|
452 |
// | SWT.VIRTUAL |
|
453 |
); |
|
452 | 454 |
viewer.getTable().addKeyListener(new TableKeyListener(viewer)); |
453 | 455 |
//viewer.setLabelProvider(new LineLabelProvider(this)); |
454 | 456 |
viewer.setContentProvider(new ConcordancesProvider()); |
... | ... | |
804 | 806 |
* @param to the to |
805 | 807 |
*/ |
806 | 808 |
public void fillDisplayArea() { |
807 |
if (viewer == null) |
|
809 |
if (viewer == null) {
|
|
808 | 810 |
return; |
811 |
} |
|
809 | 812 |
|
810 | 813 |
int from = concordance.getTopIndex(); |
811 | 814 |
from = Math.max(from, 0); |
... | ... | |
824 | 827 |
System.err.println(ConcordanceUIMessages.ERROR_WHILE_LOADING_CONCORDANCE_LINE+ e); |
825 | 828 |
org.txm.rcp.utils.Logger.printStackTrace(e); |
826 | 829 |
} |
827 |
} else |
|
830 |
} |
|
831 |
else { |
|
828 | 832 |
lines = new ArrayList<Line>(); |
833 |
} |
|
829 | 834 |
|
830 | 835 |
viewer.setInput(lines); |
831 | 836 |
viewer2.setInput(lines); |
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/ComputeConcordance.java (revision 737) | ||
---|---|---|
41 | 41 |
import org.txm.rcp.StatusLine; |
42 | 42 |
import org.txm.rcp.editors.TXMEditor; |
43 | 43 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
44 |
import org.txm.rcp.views.corpora.CorporaView; |
|
45 | 44 |
import org.txm.searchengine.cqp.CQPEngine; |
46 | 45 |
import org.txm.searchengine.cqp.corpus.Corpus; |
47 | 46 |
|
48 | 47 |
/** |
49 |
* Opens the concordance editor.
|
|
48 |
* Opens a Concordance editor.
|
|
50 | 49 |
* |
51 | 50 |
* @author mdecorde |
52 | 51 |
* @author sjacquot |
53 | 52 |
*/ |
54 | 53 |
public class ComputeConcordance extends BaseAbstractHandler { |
55 | 54 |
|
56 |
// adds a double click listener to the Corpus View |
|
57 |
static { |
|
58 |
CorporaView.addDoubleClickListener(Concordance.class, ComputeConcordance.class); |
|
59 |
} |
|
60 |
|
|
61 | 55 |
@Override |
62 | 56 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
63 | 57 |
|
tmp/org.txm.concordance.rcp/plugin.xml (revision 737) | ||
---|---|---|
106 | 106 |
categoryId="org.txm.rcp.category.txm" |
107 | 107 |
defaultHandler="org.txm.concordance.rcp.handlers.ComputeConcordance" |
108 | 108 |
id="org.txm.concordance.rcp.handlers.ComputeConcordance" |
109 |
name="%command.name"> |
|
109 |
name="%command.name" |
|
110 |
returnTypeId="org.txm.concordance.core.functions.Concordance"> |
|
110 | 111 |
<commandParameter |
111 | 112 |
id="org.txm.core.results.TXMParameters" |
112 | 113 |
name="TXM Parameter" |
Formats disponibles : Unified diff