Révision 685
tmp/org.txm.ahc.rcp/plugin.xml (revision 685) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<?eclipse version="3.4"?> |
|
3 |
<plugin> |
|
4 |
<extension |
|
5 |
point="org.eclipse.ui.commands"> |
|
6 |
<command |
|
7 |
categoryId="org.txm.rcp.category.txm" |
|
8 |
defaultHandler="org.txm.ahc.rcp.handlers.ComputeAHC" |
|
9 |
id="org.txm.cah.rcp.handlers.ComputeAHC" |
|
10 |
name="%command.name"> |
|
11 |
</command> |
|
12 |
</extension> |
|
13 |
<extension |
|
14 |
point="org.eclipse.ui.menus"> |
|
15 |
<menuContribution |
|
16 |
allPopups="false" |
|
17 |
locationURI="toolbar:org.txm.rcp.toolbartools?after=org.txm.ca.rcp.handlers.ComputeCA"> |
|
18 |
<command |
|
19 |
commandId="org.txm.cah.rcp.handlers.ComputeAHC" |
|
20 |
icon="icons/cah.png" |
|
21 |
style="push" |
|
22 |
tooltip="%command.tooltip"> |
|
23 |
<visibleWhen |
|
24 |
checkEnabled="false"> |
|
25 |
<or> |
|
26 |
<reference |
|
27 |
definitionId="OneCASelected"> |
|
28 |
</reference> |
|
29 |
<reference |
|
30 |
definitionId="OneLexicalTableSelected"> |
|
31 |
</reference> |
|
32 |
<reference |
|
33 |
definitionId="OnePartitionSelected"> |
|
34 |
</reference> |
|
35 |
</or> |
|
36 |
</visibleWhen> |
|
37 |
</command> |
|
38 |
</menuContribution> |
|
39 |
<menuContribution |
|
40 |
allPopups="false" |
|
41 |
locationURI="popup:org.txm.rcp.views.corpora.CorporaView"> |
|
42 |
<command |
|
43 |
commandId="org.txm.cah.rcp.handlers.ComputeAHC" |
|
44 |
icon="icons/cah.png" |
|
45 |
style="push"> |
|
46 |
<visibleWhen |
|
47 |
checkEnabled="false"> |
|
48 |
<or> |
|
49 |
<reference |
|
50 |
definitionId="OneCASelected"> |
|
51 |
</reference> |
|
52 |
<reference |
|
53 |
definitionId="OneLexicalTableSelected"> |
|
54 |
</reference> |
|
55 |
<reference |
|
56 |
definitionId="OnePartitionSelected"> |
|
57 |
</reference> |
|
58 |
</or> |
|
59 |
</visibleWhen> |
|
60 |
</command> |
|
61 |
</menuContribution> |
|
62 |
<menuContribution |
|
63 |
locationURI="menu:menu.tools"> |
|
64 |
<command |
|
65 |
commandId="org.txm.cah.rcp.handlers.ComputeAHC" |
|
66 |
icon="icons/cah.png" |
|
67 |
style="push"> |
|
68 |
<visibleWhen |
|
69 |
checkEnabled="false"> |
|
70 |
<or> |
|
71 |
<reference |
|
72 |
definitionId="OneCASelected"> |
|
73 |
</reference> |
|
74 |
<reference |
|
75 |
definitionId="OneLexicalTableSelected"> |
|
76 |
</reference> |
|
77 |
<reference |
|
78 |
definitionId="OnePartitionSelected"> |
|
79 |
</reference> |
|
80 |
</or> |
|
81 |
</visibleWhen> |
|
82 |
</command> |
|
83 |
</menuContribution> |
|
84 |
</extension> |
|
85 |
<extension |
|
86 |
point="org.eclipse.ui.editors"> |
|
87 |
<editor |
|
88 |
class="org.txm.ahc.rcp.editors.AHCChartEditor" |
|
89 |
default="false" |
|
90 |
icon="icons/cah.png" |
|
91 |
id="org.txm.ahc.core.functions.AHC" |
|
92 |
name="%editor.name"> |
|
93 |
</editor> |
|
94 |
</extension> |
|
95 |
<extension |
|
96 |
point="org.eclipse.core.runtime.adapters"> |
|
97 |
<factory |
|
98 |
adaptableType="org.txm.ahc.core.functions.AHC" |
|
99 |
class="org.txm.ahc.rcp.adapters.AHCAdapterFactory"> |
|
100 |
<adapter |
|
101 |
type="org.eclipse.ui.model.IWorkbenchAdapter"> |
|
102 |
</adapter> |
|
103 |
</factory> |
|
104 |
</extension> |
|
105 |
<extension |
|
106 |
point="org.eclipse.ui.preferencePages"> |
|
107 |
<page |
|
108 |
category="org.txm.rcp.preferences.UserPreferencePage" |
|
109 |
class="org.txm.ahc.rcp.preferences.AHCPreferencePage" |
|
110 |
id="org.txm.cah.rcp.preferences.CAHPreferencePage" |
|
111 |
name="%page.name"> |
|
112 |
</page> |
|
113 |
</extension> |
|
114 |
<extension |
|
115 |
point="org.eclipse.core.expressions.definitions"> |
|
116 |
<definition |
|
117 |
id="OneCAHSelected"> |
|
118 |
<with |
|
119 |
variable="selection"> |
|
120 |
<iterate |
|
121 |
ifEmpty="false" |
|
122 |
operator="and"> |
|
123 |
<instanceof |
|
124 |
value="org.txm.ahc.core.functions.CAH"> |
|
125 |
</instanceof> |
|
126 |
</iterate> |
|
127 |
</with> |
|
128 |
</definition> |
|
129 |
</extension> |
|
130 |
|
|
131 |
</plugin> |
|
0 | 132 |
tmp/org.txm.ahc.rcp/.settings/org.eclipse.core.resources.prefs (revision 685) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
encoding//src/org/txm/ahc/rcp/messages/messages_fr.properties=UTF-8 |
|
3 |
encoding//src/org/txm/ahc/rcp/messages/messages_ru.properties=UTF-8 |
|
0 | 4 |
tmp/org.txm.ahc.rcp/.settings/org.eclipse.jdt.core.prefs (revision 685) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled |
|
3 |
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 |
|
4 |
org.eclipse.jdt.core.compiler.compliance=1.6 |
|
5 |
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
|
6 |
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error |
|
7 |
org.eclipse.jdt.core.compiler.source=1.6 |
|
0 | 8 |
tmp/org.txm.ahc.rcp/.classpath (revision 685) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<classpath> |
|
3 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> |
|
4 |
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> |
|
5 |
<accessrules> |
|
6 |
<accessrule kind="accessible" pattern="**"/> |
|
7 |
</accessrules> |
|
8 |
</classpathentry> |
|
9 |
<classpathentry kind="src" path="src"/> |
|
10 |
<classpathentry kind="output" path="bin"/> |
|
11 |
</classpath> |
|
0 | 12 |
tmp/org.txm.ahc.rcp/META-INF/MANIFEST.MF (revision 685) | ||
---|---|---|
1 |
Manifest-Version: 1.0 |
|
2 |
Bundle-ManifestVersion: 2 |
|
3 |
Bundle-Name: AHC RCP |
|
4 |
Bundle-SymbolicName: org.txm.ahc.rcp;singleton:=true |
|
5 |
Bundle-Version: 1.0.0.qualifier |
|
6 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
|
7 |
Export-Package: org.txm.ahc.rcp.adapters, |
|
8 |
org.txm.ahc.rcp.editors, |
|
9 |
org.txm.ahc.rcp.handlers, |
|
10 |
org.txm.ahc.rcp.messages, |
|
11 |
org.txm.ahc.rcp.preferences |
|
12 |
Require-Bundle: org.txm.ahc.core;bundle-version="1.0.0";visibility:=reexport, |
|
13 |
org.txm.utils;bundle-version="1.0.0";visibility:=reexport, |
|
14 |
org.eclipse.osgi;visibility:=reexport, |
|
15 |
org.eclipse.core.runtime;bundle-version="3.10.0";visibility:=reexport, |
|
16 |
org.eclipse.ui;bundle-version="3.106.1";visibility:=reexport, |
|
17 |
org.txm.statsengine.r.rcp;bundle-version="1.0.0";visibility:=reexport, |
|
18 |
org.txm.lexicaltable.rcp;bundle-version="1.0.0";visibility:=reexport, |
|
19 |
org.txm.statsengine.core;bundle-version="1.0.0";visibility:=reexport, |
|
20 |
org.txm.searchengine.cqp.core;bundle-version="1.1.0";visibility:=reexport, |
|
21 |
org.txm.ca.core;visibility:=reexport, |
|
22 |
org.txm.lexicaltable.core;bundle-version="1.0.0";visibility:=reexport, |
|
23 |
org.txm.chartsengine.rcp;bundle-version="1.0.0";visibility:=reexport, |
|
24 |
org.txm.core;bundle-version="0.7.0";visibility:=reexport, |
|
25 |
org.txm.rcp;bundle-version="0.7.8";visibility:=reexport, |
|
26 |
org.eclipse.core.expressions;bundle-version="3.4.600";visibility:=reexport, |
|
27 |
org.txm.searchengine.core;bundle-version="1.0.0";visibility:=reexport, |
|
28 |
org.eclipse.core.commands |
|
29 |
Bundle-Vendor: Textometrie.org |
|
0 | 30 |
tmp/org.txm.ahc.rcp/.project (revision 685) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>org.txm.ahc.rcp</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
<buildCommand> |
|
14 |
<name>org.eclipse.pde.ManifestBuilder</name> |
|
15 |
<arguments> |
|
16 |
</arguments> |
|
17 |
</buildCommand> |
|
18 |
<buildCommand> |
|
19 |
<name>org.eclipse.pde.SchemaBuilder</name> |
|
20 |
<arguments> |
|
21 |
</arguments> |
|
22 |
</buildCommand> |
|
23 |
</buildSpec> |
|
24 |
<natures> |
|
25 |
<nature>org.eclipse.pde.PluginNature</nature> |
|
26 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
27 |
</natures> |
|
28 |
</projectDescription> |
|
0 | 29 |
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/handlers/ComputeAHC.java (revision 685) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// |
|
23 |
// |
|
24 |
// $LastChangedDate:$ |
|
25 |
// $LastChangedRevision:$ |
|
26 |
// $LastChangedBy:$ |
|
27 |
// |
|
28 |
package org.txm.ahc.rcp.handlers; |
|
29 |
|
|
30 |
import org.eclipse.core.commands.ExecutionEvent; |
|
31 |
import org.eclipse.core.commands.ExecutionException; |
|
32 |
import org.eclipse.jface.dialogs.Dialog; |
|
33 |
import org.eclipse.jface.window.Window; |
|
34 |
import org.eclipse.swt.SWT; |
|
35 |
import org.eclipse.swt.layout.GridLayout; |
|
36 |
import org.eclipse.swt.widgets.Button; |
|
37 |
import org.eclipse.swt.widgets.Composite; |
|
38 |
import org.eclipse.swt.widgets.Control; |
|
39 |
import org.eclipse.swt.widgets.Display; |
|
40 |
import org.eclipse.swt.widgets.Label; |
|
41 |
import org.eclipse.swt.widgets.Shell; |
|
42 |
import org.eclipse.swt.widgets.Spinner; |
|
43 |
import org.txm.ca.core.functions.CA; |
|
44 |
import org.txm.ca.core.preferences.CAPreferences; |
|
45 |
import org.txm.ahc.core.functions.AHC; |
|
46 |
import org.txm.ahc.core.messages.AHCCoreMessages; |
|
47 |
import org.txm.ahc.core.preferences.AHCPreferences; |
|
48 |
import org.txm.ahc.rcp.messages.AHCUIMessages; |
|
49 |
import org.txm.chartsengine.rcp.editors.ChartEditor; |
|
50 |
import org.txm.core.preferences.TXMPreferences; |
|
51 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
|
52 |
import org.txm.lexicaltable.rcp.editors.LexicalTableDialog; |
|
53 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
|
54 |
import org.txm.rcp.views.corpora.CorporaView; |
|
55 |
import org.txm.searchengine.cqp.corpus.Partition; |
|
56 |
import org.txm.searchengine.cqp.corpus.Property; |
|
57 |
import org.txm.statsengine.core.StatException; |
|
58 |
import org.txm.utils.logger.Log; |
|
59 |
|
|
60 |
/** |
|
61 |
* If the selection is a CA or a Lexical Table result computes the CAH. |
|
62 |
* |
|
63 |
* @author mdecorde |
|
64 |
* @author sjacquot |
|
65 |
*/ |
|
66 |
public class ComputeAHC extends BaseAbstractHandler { |
|
67 |
|
|
68 |
|
|
69 |
// adds a double click listener to the Corpus View |
|
70 |
static { |
|
71 |
CorporaView.addDoubleClickListener(AHC.class, ComputeAHC.class); |
|
72 |
} |
|
73 |
|
|
74 |
|
|
75 |
/* (non-Javadoc) |
|
76 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
77 |
*/ |
|
78 |
@Override |
|
79 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
80 |
|
|
81 |
|
|
82 |
if(!this.checkStatsEngine()) { |
|
83 |
return null; |
|
84 |
} |
|
85 |
|
|
86 |
Object selection = this.getSelection(); |
|
87 |
AHC ahc = null; |
|
88 |
|
|
89 |
|
|
90 |
// reopening an existing result |
|
91 |
if (selection instanceof AHC) { |
|
92 |
ahc = (AHC) selection; |
|
93 |
} |
|
94 |
// creates from CA |
|
95 |
else if (selection instanceof CA) { |
|
96 |
ahc = new AHC((CA) selection); |
|
97 |
} |
|
98 |
// creates from LexicalTable |
|
99 |
else if (selection instanceof LexicalTable) { |
|
100 |
//System.out.println("Compute CAH with LT : "+((LexicalTable)selection.getFirstElement()).getName()); |
|
101 |
LexicalTable lexicaltable = (LexicalTable) selection; |
|
102 |
|
|
103 |
try { |
|
104 |
ahc = new AHC(new CA(lexicaltable)); |
|
105 |
} catch (StatException e) { |
|
106 |
System.out.println("Failed to build the CA with lexical table " + lexicaltable + ": " + e); |
|
107 |
Log.printStackTrace(e); |
|
108 |
} |
|
109 |
lexicaltable.addChild(ahc); |
|
110 |
|
|
111 |
} |
|
112 |
// creates from Partition |
|
113 |
else if (selection instanceof Partition) { |
|
114 |
//System.out.println("Compute CAH with Partition : "+((Partition)selection.getFirstElement()).getName()); |
|
115 |
Partition partition = (Partition)selection; |
|
116 |
try { |
|
117 |
String title = AHCUIMessages.bind(AHCUIMessages.ComputeCAH_0, partition.getName()); |
|
118 |
int vMax = TXMPreferences.getInt(CAPreferences.V_MAX, CAPreferences.PREFERENCES_NODE); |
|
119 |
int fMin = TXMPreferences.getInt(CAPreferences.F_MIN, CAPreferences.PREFERENCES_NODE); |
|
120 |
Shell shell = Display.getCurrent().getActiveShell(); |
|
121 |
LexicalTableDialog d = new LexicalTableDialog(shell, partition.getCorpus(), title); |
|
122 |
d.setFminAndVMax(fMin, vMax); |
|
123 |
|
|
124 |
if (d.open() == Window.OK) { |
|
125 |
Property property = d.getProperty(); |
|
126 |
fMin = d.getFmin(); |
|
127 |
vMax = d.getMaxLines(); |
|
128 |
|
|
129 |
LexicalTable lexicaltable = new LexicalTable(partition, property, fMin, vMax); // use the CAPreferencePage Fmin |
|
130 |
ahc = new AHC(new CA(lexicaltable)); |
|
131 |
} else { |
|
132 |
// canceled |
|
133 |
return null; |
|
134 |
} |
|
135 |
} catch (Exception e) { |
|
136 |
System.out.println("Failed to build the lexical table of " + partition + ": " + e); |
|
137 |
Log.printStackTrace(e); |
|
138 |
return null; |
|
139 |
} |
|
140 |
} |
|
141 |
|
|
142 |
ChartEditor.openEditor(ahc); |
|
143 |
|
|
144 |
|
|
145 |
return null; |
|
146 |
} |
|
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
|
151 |
/** |
|
152 |
* The Class CAHParamDialog. |
|
153 |
*/ |
|
154 |
// FIXME: not used? |
|
155 |
public class CAHParamDialog extends Dialog { |
|
156 |
|
|
157 |
//protected Combo methodsCombo; |
|
158 |
//protected Combo metricsCombo; |
|
159 |
/** The ncluster spinner. */ |
|
160 |
protected Spinner nclusterSpinner; |
|
161 |
|
|
162 |
/** The docolumns button. */ |
|
163 |
protected Button docolumnsButton; |
|
164 |
|
|
165 |
/** The title. */ |
|
166 |
protected String title; |
|
167 |
|
|
168 |
/** |
|
169 |
* Instantiates a new cAH param dialog. |
|
170 |
* |
|
171 |
* @param parentShell the parent shell |
|
172 |
*/ |
|
173 |
public CAHParamDialog(Shell parentShell) { |
|
174 |
super(parentShell); |
|
175 |
this.title = AHCCoreMessages.RESULT_TYPE; |
|
176 |
} |
|
177 |
|
|
178 |
/* (non-Javadoc) |
|
179 |
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) |
|
180 |
*/ |
|
181 |
@Override |
|
182 |
protected void configureShell(Shell newShell) { |
|
183 |
super.configureShell(newShell); |
|
184 |
|
|
185 |
if (title != null) |
|
186 |
newShell.setText(title); |
|
187 |
else |
|
188 |
newShell.setText(AHCCoreMessages.RESULT_TYPE); |
|
189 |
} |
|
190 |
|
|
191 |
/** The composite. */ |
|
192 |
protected Composite composite; |
|
193 |
|
|
194 |
/** The method. */ |
|
195 |
private String method; |
|
196 |
|
|
197 |
/** The metric. */ |
|
198 |
private String metric; |
|
199 |
|
|
200 |
/** The Ncluster. */ |
|
201 |
private int Ncluster; |
|
202 |
|
|
203 |
/** The doculumns. */ |
|
204 |
private boolean doculumns; |
|
205 |
|
|
206 |
/* (non-Javadoc) |
|
207 |
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) |
|
208 |
*/ |
|
209 |
@Override |
|
210 |
protected Control createDialogArea(Composite parent) { |
|
211 |
composite = new Composite(parent, SWT.NONE); |
|
212 |
GridLayout layout = new GridLayout(2, false); |
|
213 |
composite.setLayout(layout); |
|
214 |
|
|
215 |
// N CLUSTERS |
|
216 |
Label label = new Label(composite, SWT.NONE); |
|
217 |
label.setText(AHCUIMessages.CAHPreferencePage_2); |
|
218 |
|
|
219 |
nclusterSpinner = new Spinner(composite, SWT.BORDER); |
|
220 |
nclusterSpinner.setMinimum(2); |
|
221 |
nclusterSpinner.setIncrement(1); |
|
222 |
nclusterSpinner.setSelection(TXMPreferences.getInt(AHCPreferences.N_CLUSTERS, AHCPreferences.PREFERENCES_NODE)); |
|
223 |
nclusterSpinner.setMaximum(50); |
|
224 |
|
|
225 |
// ROWS OR COLS |
|
226 |
docolumnsButton = new Button(composite, SWT.RADIO); |
|
227 |
docolumnsButton.setText(AHCUIMessages.COMPUTE_COLUMNS); |
|
228 |
docolumnsButton.setSelection(true); |
|
229 |
|
|
230 |
Button dorowsButton = new Button(composite, SWT.RADIO); |
|
231 |
dorowsButton.setText(AHCUIMessages.COMPUTE_ROWS); |
|
232 |
|
|
233 |
/* |
|
234 |
// METHODS |
|
235 |
Label methodLabel = new Label(composite, SWT.NONE); |
|
236 |
methodLabel.setText("Methods"); |
|
237 |
|
|
238 |
methodLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER, |
|
239 |
false, false)); |
|
240 |
|
|
241 |
methodsCombo = new Combo(composite, SWT.READ_ONLY); |
|
242 |
methodsCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, |
|
243 |
true, false)); |
|
244 |
methodsCombo.select(methodsCombo.indexOf(CAH.getDefaultMethod())); |
|
245 |
for(String method : CAH.getMethods()) |
|
246 |
methodsCombo.add(method); |
|
247 |
|
|
248 |
// METRICS |
|
249 |
Label metricsLabel = new Label(composite, SWT.NONE); |
|
250 |
metricsLabel.setText("Methods"); |
|
251 |
|
|
252 |
metricsLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER, |
|
253 |
false, false)); |
|
254 |
|
|
255 |
metricsCombo = new Combo(composite, SWT.READ_ONLY); |
|
256 |
metricsCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, |
|
257 |
true, false)); |
|
258 |
metricsCombo.select(metricsCombo.indexOf(CAH.getDefaultMetric())); |
|
259 |
for(String method : CAH.getMetrics()) |
|
260 |
metricsCombo.add(method); |
|
261 |
*/ |
|
262 |
|
|
263 |
return composite; |
|
264 |
} |
|
265 |
|
|
266 |
/* (non-Javadoc) |
|
267 |
* @see org.eclipse.jface.dialogs.Dialog#okPressed() |
|
268 |
*/ |
|
269 |
@Override |
|
270 |
protected void okPressed() { |
|
271 |
/*int idx = methodsCombo.getSelectionIndex(); |
|
272 |
method = methodsCombo.getItem(idx); |
|
273 |
|
|
274 |
idx = metricsCombo.getSelectionIndex(); |
|
275 |
metric = metricsCombo.getItem(idx); |
|
276 |
*/ |
|
277 |
Ncluster = this.nclusterSpinner.getSelection(); |
|
278 |
|
|
279 |
doculumns = this.docolumnsButton.getSelection(); |
|
280 |
|
|
281 |
super.okPressed(); |
|
282 |
} |
|
283 |
|
|
284 |
/** |
|
285 |
* Gets the method. |
|
286 |
* |
|
287 |
* @return the method |
|
288 |
*/ |
|
289 |
public String getMethod() { |
|
290 |
return method; |
|
291 |
} |
|
292 |
|
|
293 |
/** |
|
294 |
* Gets the metric. |
|
295 |
* |
|
296 |
* @return the metric |
|
297 |
*/ |
|
298 |
public String getMetric() { |
|
299 |
return metric; |
|
300 |
} |
|
301 |
|
|
302 |
/** |
|
303 |
* Gets the ncluster. |
|
304 |
* |
|
305 |
* @return the ncluster |
|
306 |
*/ |
|
307 |
public int getNcluster() { |
|
308 |
return Ncluster; |
|
309 |
} |
|
310 |
|
|
311 |
/** |
|
312 |
* Checks if is doculumns. |
|
313 |
* |
|
314 |
* @return true, if is doculumns |
|
315 |
*/ |
|
316 |
public boolean isDoculumns() { |
|
317 |
return doculumns; |
|
318 |
} |
|
319 |
} |
|
320 |
|
|
321 |
|
|
322 |
} |
|
0 | 323 |
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/handlers/package.html (revision 685) | ||
---|---|---|
1 |
<html> |
|
2 |
<body> |
|
3 |
<p>Commands which call textometry functions</p> |
|
4 |
</body> |
|
5 |
</html> |
|
0 | 6 |
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/preferences/AHCPreferencePage.java (revision 685) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// |
|
23 |
// |
|
24 |
// $LastChangedDate:$ |
|
25 |
// $LastChangedRevision:$ |
|
26 |
// $LastChangedBy:$ |
|
27 |
// |
|
28 |
package org.txm.ahc.rcp.preferences; |
|
29 |
|
|
30 |
import org.eclipse.jface.preference.ComboFieldEditor; |
|
31 |
import org.eclipse.jface.preference.IntegerFieldEditor; |
|
32 |
import org.eclipse.jface.preference.RadioGroupFieldEditor; |
|
33 |
import org.eclipse.swt.widgets.Composite; |
|
34 |
import org.eclipse.ui.IWorkbench; |
|
35 |
import org.txm.ahc.core.functions.AHC; |
|
36 |
import org.txm.ahc.core.messages.AHCCoreMessages; |
|
37 |
import org.txm.ahc.core.preferences.AHCPreferences; |
|
38 |
import org.txm.ahc.rcp.adapters.AHCAdapterFactory; |
|
39 |
import org.txm.ahc.rcp.messages.AHCUIMessages; |
|
40 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
|
41 |
import org.txm.rcp.preferences.TXMPreferencePage; |
|
42 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
|
43 |
|
|
44 |
/** |
|
45 |
* CAH preferences page. |
|
46 |
* |
|
47 |
* @author mdecorde |
|
48 |
* @author sjacquot |
|
49 |
*/ |
|
50 |
public class AHCPreferencePage extends TXMPreferencePage { |
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
@Override |
|
55 |
public void createFieldEditors() { |
|
56 |
|
|
57 |
IntegerFieldEditor nClusters = new IntegerFieldEditor(AHCPreferences.N_CLUSTERS, AHCUIMessages.CAHPreferencePage_2, getFieldEditorParent()); |
|
58 |
addField(nClusters); |
|
59 |
|
|
60 |
String list[] = AHC.getMethods(); |
|
61 |
String methods[][] = new String[list.length][2]; |
|
62 |
for(int i = 0 ; i < list.length ; i++) |
|
63 |
methods[i][0] = methods[i][1] = list[i]; |
|
64 |
|
|
65 |
ComboFieldEditor method = new ComboFieldEditor(AHCPreferences.METHOD, AHCUIMessages.CAHPreferencePage_3, methods, getFieldEditorParent()); |
|
66 |
addField(method); |
|
67 |
|
|
68 |
list = AHC.getMetrics(); |
|
69 |
String metrics[][] = new String[list.length][2]; |
|
70 |
for(int i = 0 ; i < list.length ; i++) |
|
71 |
metrics[i][0] = metrics[i][1] = list[i]; |
|
72 |
|
|
73 |
ComboFieldEditor metric = new ComboFieldEditor(AHCPreferences.METRIC, AHCUIMessages.CAHPreferencePage_4, metrics, getFieldEditorParent()); |
|
74 |
addField(metric); |
|
75 |
|
|
76 |
|
|
77 |
// Charts |
|
78 |
Composite chartsTab = SWTChartsComponentsProvider.createChartsRenderingPreferencesTabFolderComposite(getFieldEditorParent()); |
|
79 |
|
|
80 |
String[][] labelAndValues = {{"2D", "true"}, {"3D", "false"}}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ |
|
81 |
RadioGroupFieldEditor default2D3Ddisplay = new RadioGroupFieldEditor(AHCPreferences.RENDERING_2D, AHCUIMessages.CAHPreferencePage_0, 2, labelAndValues, chartsTab); |
|
82 |
addField(default2D3Ddisplay); |
|
83 |
|
|
84 |
|
|
85 |
// other shared preferences |
|
86 |
SWTChartsComponentsProvider.createChartsRenderingPreferencesFields(this, chartsTab); |
|
87 |
} |
|
88 |
|
|
89 |
@Override |
|
90 |
public void init(IWorkbench workbench) { |
|
91 |
this.setPreferenceStore(new TXMPreferenceStore(AHCPreferences.PREFERENCES_NODE)); |
|
92 |
//setDescription("AHC"); |
|
93 |
this.setTitle(AHCCoreMessages.RESULT_TYPE); |
|
94 |
this.setImageDescriptor(AHCAdapterFactory.ICON); |
|
95 |
} |
|
96 |
|
|
97 |
} |
|
0 | 98 |
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/adapters/AHCAdapterFactory.java (revision 685) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
package org.txm.ahc.rcp.adapters; |
|
3 |
|
|
4 |
import org.eclipse.jface.resource.ImageDescriptor; |
|
5 |
import org.eclipse.ui.model.IWorkbenchAdapter; |
|
6 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
|
7 |
import org.osgi.framework.FrameworkUtil; |
|
8 |
import org.txm.ahc.core.functions.AHC; |
|
9 |
import org.txm.rcp.adapters.TXMResultAdapter; |
|
10 |
import org.txm.rcp.adapters.TXMResultAdapterFactory; |
|
11 |
|
|
12 |
/** |
|
13 |
* A factory for creating Adapter objects. |
|
14 |
* |
|
15 |
* @author mdecorde |
|
16 |
* @author sjacquot |
|
17 |
*/ |
|
18 |
public class AHCAdapterFactory extends TXMResultAdapterFactory { |
|
19 |
|
|
20 |
|
|
21 |
public static final ImageDescriptor ICON = |
|
22 |
AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(AHCAdapterFactory.class).getSymbolicName(), |
|
23 |
"platform:/plugin/"+ FrameworkUtil.getBundle(AHCAdapterFactory.class).getSymbolicName() + "/icons/cah.png"); //$NON-NLS-1$ |
|
24 |
|
|
25 |
/** |
|
26 |
* Gets the adapter. |
|
27 |
* |
|
28 |
* @param adaptableObject the adaptable object |
|
29 |
* @param adapterType the adapter type |
|
30 |
* @return the adapter |
|
31 |
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) |
|
32 |
*/ |
|
33 |
@Override |
|
34 |
public Object getAdapter(Object adaptableObject, Class adapterType) { |
|
35 |
if(adapterType == IWorkbenchAdapter.class && adaptableObject instanceof AHC) { |
|
36 |
return new TXMResultAdapter() { |
|
37 |
@Override |
|
38 |
public ImageDescriptor getImageDescriptor(Object object) { |
|
39 |
return ICON; |
|
40 |
} |
|
41 |
}; |
|
42 |
} |
|
43 |
return null; |
|
44 |
} |
|
45 |
|
|
46 |
|
|
47 |
} |
|
0 | 48 |
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/messages/messages_ru.properties (revision 685) | ||
---|---|---|
1 |
|
|
2 |
CAHPreferencePage_0 = Показывать графики в 2D |
|
3 |
CAHPreferencePage_2 = Число кластеров |
|
4 |
CAHPreferencePage_3 = Метод |
|
5 |
CAHPreferencePage_4 = Метрика |
|
6 |
|
|
7 |
COMPUTE_COLUMNS = Колонки |
|
8 |
COMPUTE_ROWS = Строчки |
|
9 |
|
|
10 |
ComputeCAH_0 = Расчет Классификации {0} |
|
11 |
ComputeCAH_1 = Показать график |
|
12 |
ComputeCAH_2 = ** Не удается записать данные во временный файл |
|
13 |
ComputeCAH_3 = Расчет классификации с |
|
0 | 14 |
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/messages/messages_fr.properties (revision 685) | ||
---|---|---|
1 |
|
|
2 |
CAHPreferencePage_0 = Afficher les graphiques en 2D |
|
3 |
|
|
4 |
CAHPreferencePage_2 = Nombre de clusters |
|
5 |
|
|
6 |
CAHPreferencePage_3 = Méthode |
|
7 |
|
|
8 |
CAHPreferencePage_4 = Métrique |
|
9 |
|
|
10 |
CHART_TOOLBAR_BUTTON_NUMBER_OF_CLUSTERS = Nombre de clusters : |
|
11 |
|
|
12 |
COMPUTE_COLUMNS = Classer les colonnes |
|
13 |
|
|
14 |
COMPUTE_ROWS = Classer les lignes |
|
15 |
|
|
16 |
ComputeCAH_0 = Calcul de la Classification avec {0} |
|
17 |
|
|
18 |
ComputeCAH_1 = Afficher le graphique |
|
19 |
|
|
20 |
ComputeCAH_2 = ** Impossible d'écrire dans le fichier temporaire |
|
21 |
|
|
22 |
ComputeCAH_3 = Calcul de la classification avec |
|
23 |
|
|
24 |
ComputeCAH_5 = Ouverture de la fenêtre de Classification |
|
25 |
|
|
26 |
ComputeCAH_6 = Erreur lors de l'ouverture de l'éditeur de Classification : {0} |
|
0 | 27 |
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/messages/AHCUIMessages.java (revision 685) | ||
---|---|---|
1 |
package org.txm.ahc.rcp.messages; |
|
2 |
|
|
3 |
import org.eclipse.osgi.util.NLS; |
|
4 |
import org.txm.utils.messages.Utf8NLS; |
|
5 |
|
|
6 |
public class AHCUIMessages extends NLS { |
|
7 |
|
|
8 |
static { |
|
9 |
Utf8NLS.initializeMessages(AHCUIMessages.class); |
|
10 |
} |
|
11 |
|
|
12 |
public static String CAHPreferencePage_0; |
|
13 |
public static String CAHPreferencePage_2; |
|
14 |
public static String CAHPreferencePage_3; |
|
15 |
public static String CAHPreferencePage_4; |
|
16 |
|
|
17 |
public static String ComputeCAH_0; |
|
18 |
|
|
19 |
//FIXME: these keys/values are not used, remove or use them? |
|
20 |
public static String ComputeCAH_1; |
|
21 |
public static String ComputeCAH_2; |
|
22 |
public static String ComputeCAH_3; |
|
23 |
public static String ComputeCAH_5; |
|
24 |
public static String ComputeCAH_6; |
|
25 |
// end of fixme |
|
26 |
|
|
27 |
public static String COMPUTE_COLUMNS; |
|
28 |
public static String COMPUTE_ROWS; |
|
29 |
|
|
30 |
public static String CHART_TOOLBAR_BUTTON_NUMBER_OF_CLUSTERS; |
|
31 |
} |
|
0 | 32 |
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/messages/messages.properties (revision 685) | ||
---|---|---|
1 |
|
|
2 |
CAHPreferencePage_0 = Display chart in |
|
3 |
|
|
4 |
CAHPreferencePage_2 = Number of clusters |
|
5 |
|
|
6 |
CAHPreferencePage_3 = Method |
|
7 |
|
|
8 |
CAHPreferencePage_4 = Metric |
|
9 |
|
|
10 |
CHART_TOOLBAR_BUTTON_NUMBER_OF_CLUSTERS = Number of clusters: |
|
11 |
|
|
12 |
COMPUTE_COLUMNS = Compute columns |
|
13 |
|
|
14 |
COMPUTE_ROWS = Compute rows |
|
15 |
|
|
16 |
ComputeCAH_0 = Compute Classification with {0} |
|
17 |
|
|
18 |
ComputeCAH_1 = Show chart |
|
19 |
|
|
20 |
ComputeCAH_2 = Error: temporary file created cannot be written: |
|
21 |
|
|
22 |
ComputeCAH_3 = Computing CAH with |
|
23 |
|
|
24 |
ComputeCAH_5 = Opening the Classification result |
|
25 |
|
|
26 |
ComputeCAH_6 = Error while computing Classification: {0} |
|
0 | 27 |
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/editors/AHCChartEditor.java (revision 685) | ||
---|---|---|
1 |
package org.txm.ahc.rcp.editors; |
|
2 |
|
|
3 |
import org.eclipse.swt.SWT; |
|
4 |
import org.eclipse.swt.custom.CLabel; |
|
5 |
import org.eclipse.swt.widgets.Button; |
|
6 |
import org.eclipse.swt.widgets.Composite; |
|
7 |
import org.eclipse.swt.widgets.Display; |
|
8 |
import org.eclipse.swt.widgets.Spinner; |
|
9 |
import org.eclipse.swt.widgets.ToolItem; |
|
10 |
import org.txm.ahc.core.functions.AHC; |
|
11 |
import org.txm.ahc.core.preferences.AHCPreferences; |
|
12 |
import org.txm.ahc.rcp.messages.AHCUIMessages; |
|
13 |
import org.txm.chartsengine.rcp.editors.ChartEditor; |
|
14 |
import org.txm.core.results.Parameter; |
|
15 |
import org.txm.rcp.IImageKeys; |
|
16 |
import org.txm.rcp.editors.listeners.ComputeSelectionListener; |
|
17 |
|
|
18 |
/** |
|
19 |
* CAH chart editor. |
|
20 |
* |
|
21 |
* @author mdecorde |
|
22 |
* @author sjacquot |
|
23 |
* |
|
24 |
*/ |
|
25 |
public class AHCChartEditor extends ChartEditor<AHC> { |
|
26 |
|
|
27 |
|
|
28 |
/** |
|
29 |
* Rows computing button. |
|
30 |
*/ |
|
31 |
protected ToolItem rowsComputing; |
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
/** |
|
36 |
* The metric (euclidean, manhattan). |
|
37 |
*/ |
|
38 |
@Parameter(key=AHCPreferences.METRIC) |
|
39 |
protected String metric; |
|
40 |
|
|
41 |
/** |
|
42 |
* The method (METHODS <- c("average", "single", "complete", "ward", "weighted", "flexible")). |
|
43 |
*/ |
|
44 |
@Parameter(key=AHCPreferences.METHOD) |
|
45 |
protected String method; |
|
46 |
|
|
47 |
/** |
|
48 |
* The number of clusters. |
|
49 |
*/ |
|
50 |
@Parameter(key=AHCPreferences.N_CLUSTERS) |
|
51 |
protected Spinner numberOfClusters; |
|
52 |
|
|
53 |
/** |
|
54 |
* To compute the columns or the rows. |
|
55 |
*/ |
|
56 |
@Parameter(key=AHCPreferences.COLUMNS_COMPUTING) |
|
57 |
protected ToolItem columnsComputing; |
|
58 |
|
|
59 |
/** |
|
60 |
* To render in 2D or 3D. |
|
61 |
*/ |
|
62 |
@Parameter(key=AHCPreferences.RENDERING_2D) |
|
63 |
protected Button rendering2D; |
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
@Override |
|
69 |
public void _createPartControl(Composite parent) { |
|
70 |
|
|
71 |
// Extend the chart editor tool bar |
|
72 |
new ToolItem(this.chartToolBar, SWT.SEPARATOR); |
|
73 |
|
|
74 |
// Number of clusters |
|
75 |
CLabel clustersLabel = new CLabel(this.chartToolBar, SWT.CENTER); |
|
76 |
clustersLabel.setText(AHCUIMessages.CHART_TOOLBAR_BUTTON_NUMBER_OF_CLUSTERS); |
|
77 |
this.chartToolBar.addControl(clustersLabel); |
|
78 |
|
|
79 |
this.numberOfClusters = new Spinner(this.chartToolBar, SWT.BORDER); |
|
80 |
this.numberOfClusters.setMinimum(2); |
|
81 |
this.numberOfClusters.setIncrement(1); |
|
82 |
this.chartToolBar.addControl(this.numberOfClusters); |
|
83 |
this.numberOfClusters.addSelectionListener(new ComputeSelectionListener(this)); |
|
84 |
|
|
85 |
|
|
86 |
// Columns |
|
87 |
this.columnsComputing = new ToolItem(this.chartToolBar, SWT.RADIO); |
|
88 |
this.columnsComputing.setToolTipText(AHCUIMessages.COMPUTE_COLUMNS); |
|
89 |
this.columnsComputing.setImage(IImageKeys.getImage(AHCChartEditor.class, "icons/compute_columns.png")); //$NON-NLS-1$ |
|
90 |
this.columnsComputing.addSelectionListener(new ComputeSelectionListener(this)); |
|
91 |
// FIXME: keep this for offering an option "large icons" with text in buttons ? |
|
92 |
//this.columnsComputing.setText(CAUIPMessages.ComputeClassification_5); |
|
93 |
//this.columnsComputing.setSelection(this.getBooleanParameterValue(AHCPreferences.COLUMNS_COMPUTING)); |
|
94 |
|
|
95 |
// Rows |
|
96 |
this.rowsComputing = new ToolItem(this.chartToolBar, SWT.RADIO); |
|
97 |
this.rowsComputing.setToolTipText(AHCUIMessages.COMPUTE_ROWS); |
|
98 |
this.rowsComputing.setImage(IImageKeys.getImage(AHCChartEditor.class, "icons/compute_rows.png")); //$NON-NLS-1$ |
|
99 |
|
|
100 |
|
|
101 |
// 2D/3D rendering |
|
102 |
this.rendering2D = new Button(this.chartToolBar, SWT.CHECK); |
|
103 |
this.rendering2D.setText("2D");//$NON-NLS-1$ |
|
104 |
this.chartToolBar.addControl(this.rendering2D); |
|
105 |
this.rendering2D.addSelectionListener(new ComputeSelectionListener(this)); |
|
106 |
//this.rendering2D.setBackground(itemSeparator.getParent().getBackground()); |
|
107 |
|
|
108 |
} |
|
109 |
|
|
110 |
|
|
111 |
@Override |
|
112 |
public void updateEditorFromResult(boolean update) { |
|
113 |
|
|
114 |
// Update the maximum value of the number of clusters spinner according to the new CAH configuration |
|
115 |
this.numberOfClusters.setMaximum(this.getResult().getMaxClustersCount()); |
|
116 |
|
|
117 |
// Updates the current value of the number of clusters spinner |
|
118 |
this.numberOfClusters.setSelection(this.getResult().getNumberOfClusters()); |
|
119 |
|
|
120 |
this.rowsComputing.setSelection(!this.getResult().isColumnsComputing()); |
|
121 |
} |
|
122 |
|
|
123 |
} |
|
0 | 124 |
tmp/org.txm.ahc.rcp/build.properties (revision 685) | ||
---|---|---|
1 |
source.. = src/ |
|
2 |
output.. = bin/ |
|
3 |
bin.includes = META-INF/,\ |
|
4 |
.,\ |
|
5 |
plugin.xml,\ |
|
6 |
OSGI-INF/,\ |
|
7 |
icons/ |
|
0 | 8 |
tmp/org.txm.ahc.rcp/OSGI-INF/l10n/bundle.properties (revision 685) | ||
---|---|---|
1 |
|
|
2 |
command.name = Classification |
|
3 |
|
|
4 |
command.tooltip = Compute classification |
|
5 |
|
|
6 |
editor.name = Classification |
|
7 |
|
|
8 |
page.name = Classification |
|
0 | 9 |
tmp/org.txm.ahc.rcp/OSGI-INF/l10n/bundle_ru.properties (revision 685) | ||
---|---|---|
1 |
|
|
2 |
command.name = Классификация |
|
3 |
command.tooltip = Классификация |
|
4 |
|
|
5 |
page.name = Классификация |
|
0 | 6 |
tmp/org.txm.ahc.rcp/OSGI-INF/l10n/bundle_fr.properties (revision 685) | ||
---|---|---|
1 |
command.name=Classification |
|
2 |
command.tooltip=Calculer la classification |
|
3 |
page.name=Classification |
|
0 | 4 |
tmp/org.txm.ahc.rcp/OSGI-INF/l10n/bundle_ru_utf-8.properties (revision 685) | ||
---|---|---|
1 |
command.name=Классификация |
|
2 |
command.tooltip=Классификация |
|
3 |
page.name=Классификация |
|
0 | 4 |
Formats disponibles : Unified diff