| 46 |
46 |
import org.txm.cah.core.messages.AHCCoreMessages;
|
| 47 |
47 |
import org.txm.cah.core.preferences.AHCPreferences;
|
| 48 |
48 |
import org.txm.cah.rcp.messages.AHCUIMessages;
|
| 49 |
|
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
|
| 50 |
|
import org.txm.chartsengine.rcp.editors.ChartEditorInput;
|
| 51 |
49 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
|
| 52 |
50 |
import org.txm.core.preferences.TXMPreferences;
|
| 53 |
|
import org.txm.core.results.TXMParameters;
|
| 54 |
51 |
import org.txm.lexicaltable.core.functions.LexicalTable;
|
| 55 |
52 |
import org.txm.lexicaltable.core.functions.LexicalTableFactory;
|
| 56 |
53 |
import org.txm.lexicaltable.rcp.editors.LexicalTableDialog;
|
| ... | ... | |
| 88 |
85 |
}
|
| 89 |
86 |
|
| 90 |
87 |
Object selection = this.getSelection();
|
| 91 |
|
ChartEditorInput editorInput = null;
|
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
CA ca = null;
|
|
88 |
AHC ahc = null;
|
| 96 |
89 |
|
| 97 |
90 |
|
| 98 |
91 |
// reopening an existing result
|
| 99 |
92 |
if (selection instanceof AHC) {
|
| 100 |
|
editorInput = new ChartEditorInput((AHC) selection);
|
|
93 |
ahc = (AHC) selection;
|
| 101 |
94 |
}
|
| 102 |
95 |
// creates from CA
|
| 103 |
96 |
else if (selection instanceof CA) {
|
| 104 |
|
ca = (CA) selection;
|
|
97 |
ahc = new AHC((CA) selection);
|
| 105 |
98 |
}
|
| 106 |
99 |
// creates from LexicalTable
|
| 107 |
100 |
else if (selection instanceof LexicalTable) {
|
| ... | ... | |
| 109 |
102 |
LexicalTable lexicaltable = (LexicalTable) selection;
|
| 110 |
103 |
|
| 111 |
104 |
try {
|
| 112 |
|
ca = new CA(lexicaltable);
|
|
105 |
ahc = new AHC(new CA(lexicaltable));
|
| 113 |
106 |
} catch (StatException e) {
|
| 114 |
107 |
System.out.println("Failed to build the CA with lexical table " + lexicaltable + ": " + e);
|
| 115 |
108 |
Log.printStackTrace(e);
|
| 116 |
109 |
}
|
| 117 |
|
lexicaltable.addResult(ca);
|
|
110 |
lexicaltable.addResult(ahc);
|
| 118 |
111 |
|
| 119 |
112 |
// if (lexicaltable.getPartition() != null)
|
| 120 |
113 |
// lexicaltable.getPartition().storeResult(ca);
|
| ... | ... | |
| 142 |
135 |
lexicaltable.getData().cut(vmax);
|
| 143 |
136 |
partition.addResult(lexicaltable);
|
| 144 |
137 |
|
| 145 |
|
ca = new CA(lexicaltable);
|
| 146 |
|
lexicaltable.addResult(ca);
|
|
138 |
ahc = new AHC(new CA(lexicaltable));
|
|
139 |
lexicaltable.addResult(ahc);
|
| 147 |
140 |
} else {
|
| 148 |
141 |
// canceled
|
| 149 |
142 |
return null;
|
| ... | ... | |
| 155 |
148 |
}
|
| 156 |
149 |
}
|
| 157 |
150 |
|
| 158 |
|
if (ca != null) {
|
| 159 |
|
AHC cah = new AHC(ca);
|
| 160 |
|
|
| 161 |
|
TXMParameters parameters = new TXMParameters();
|
| 162 |
|
parameters.put(AHCPreferences.COLUMNS_COMPUTING, TXMPreferences.getBoolean(AHCPreferences.COLUMNS_COMPUTING, AHCPreferences.PREFERENCES_NODE));
|
| 163 |
|
parameters.put(AHCPreferences.METHOD, TXMPreferences.getString(AHCPreferences.METHOD, AHCPreferences.PREFERENCES_NODE));
|
| 164 |
|
parameters.put(AHCPreferences.METRIC, TXMPreferences.getString(AHCPreferences.METRIC, AHCPreferences.PREFERENCES_NODE));
|
| 165 |
|
parameters.put(AHCPreferences.N_CLUSTERS, TXMPreferences.getInt(AHCPreferences.N_CLUSTERS, AHCPreferences.PREFERENCES_NODE));
|
| 166 |
|
cah.setParameters(parameters);
|
| 167 |
|
|
| 168 |
|
editorInput = new ChartEditorInput(cah);
|
| 169 |
|
}
|
| 170 |
|
|
| 171 |
|
ChartEditorPart editor = SWTChartsComponentsProvider.getCurrent().openEditor(editorInput);
|
|
151 |
ChartEditorPart editor = ChartEditorPart.openEditor(ahc);
|
| 172 |
152 |
|
|
153 |
// FIXME: obsolete?
|
| 173 |
154 |
// computes if not reopening a result
|
| 174 |
|
if(!(selection instanceof AHC)) {
|
| 175 |
|
editor.computeResult();
|
| 176 |
|
}
|
|
155 |
// if(!(selection instanceof AHC)) {
|
|
156 |
// editor.computeResult();
|
|
157 |
// }
|
| 177 |
158 |
|
| 178 |
159 |
|
| 179 |
160 |
return null;
|