Revision 532

tmp/org.txm.cah.rcp/plugin.xml (revision 532)
6 6
      <command
7 7
            categoryId="org.txm.rcp.category.txm"
8 8
            defaultHandler="org.txm.cah.rcp.handlers.ComputeAHC"
9
            id="org.txm.cah.rcp.handlers.ComputeCAH"
9
            id="org.txm.cah.rcp.handlers.ComputeAHC"
10 10
            name="%command.name">
11 11
      </command>
12 12
   </extension>
......
16 16
            allPopups="false"
17 17
            locationURI="toolbar:org.txm.rcp.toolbartools">
18 18
         <command
19
               commandId="org.txm.cah.rcp.handlers.ComputeCAH"
19
               commandId="org.txm.cah.rcp.handlers.ComputeAHC"
20 20
               icon="icons/cah.png"
21 21
               style="push"
22 22
               tooltip="%command.tooltip">
......
40 40
            allPopups="false"
41 41
            locationURI="popup:org.txm.rcp.views.corpora.CorporaView">
42 42
         <command
43
               commandId="org.txm.cah.rcp.handlers.ComputeCAH"
43
               commandId="org.txm.cah.rcp.handlers.ComputeAHC"
44 44
               icon="icons/cah.png"
45 45
               style="push">
46 46
            <visibleWhen
......
62 62
      <menuContribution
63 63
            locationURI="menu:menu.tools">
64 64
         <command
65
               commandId="org.txm.cah.rcp.handlers.ComputeCAH"
65
               commandId="org.txm.cah.rcp.handlers.ComputeAHC"
66 66
               icon="icons/cah.png"
67 67
               style="push">
68 68
            <visibleWhen
......
88 88
            class="org.txm.cah.rcp.editors.AHCChartEditor"
89 89
            default="false"
90 90
            icon="icons/cah.png"
91
            id="org.txm.cah.core.functions.CAH"
91
            id="org.txm.cah.core.functions.AHC"
92 92
            name="%editor.name">
93 93
      </editor>
94 94
   </extension>
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/handlers/ComputeAHC.java (revision 532)
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;

Also available in: Unified diff