Révision 560
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorPart.java (revision 560) | ||
|---|---|---|
| 157 | 157 |
* The user must configure its layout |
| 158 | 158 |
* @return |
| 159 | 159 |
*/ |
| 160 |
public Composite getDisplayArea() {
|
|
| 160 |
public Composite getResultArea() {
|
|
| 161 | 161 |
return displayArea; |
| 162 | 162 |
} |
| 163 | 163 |
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/LastOpened.java (revision 560) | ||
|---|---|---|
| 11 | 11 |
public static final String FILE = "FILE"; //$NON-NLS-1$ |
| 12 | 12 |
|
| 13 | 13 |
public static void set(String ID, String folder) {
|
| 14 |
TXMPreferences.putString(PREFERENCES_NODE, ID+FOLDER, folder);
|
|
| 14 |
TXMPreferences.put(PREFERENCES_NODE, ID+FOLDER, folder); |
|
| 15 | 15 |
} |
| 16 | 16 |
|
| 17 | 17 |
public static void set(String ID, String folder, String file) {
|
| 18 |
TXMPreferences.putString(PREFERENCES_NODE, ID+FOLDER, folder);
|
|
| 19 |
TXMPreferences.putString(PREFERENCES_NODE, ID+FILE, file);
|
|
| 18 |
TXMPreferences.put(PREFERENCES_NODE, ID+FOLDER, folder); |
|
| 19 |
TXMPreferences.put(PREFERENCES_NODE, ID+FILE, file); |
|
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 | 22 |
public static void set(String ID, File outfile) {
|
| 23 |
TXMPreferences.putString(PREFERENCES_NODE, ID+FOLDER, outfile.getParent());
|
|
| 24 |
TXMPreferences.putString(PREFERENCES_NODE, ID+FILE, outfile.getName());
|
|
| 23 |
TXMPreferences.put(PREFERENCES_NODE, ID+FOLDER, outfile.getParent()); |
|
| 24 |
TXMPreferences.put(PREFERENCES_NODE, ID+FILE, outfile.getName()); |
|
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 | 27 |
public static String getFolder(String ID) {
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java (revision 560) | ||
|---|---|---|
| 545 | 545 |
String installpath = Platform.getInstallLocation().getURL().getFile(); // the TXM.exe file path |
| 546 | 546 |
File installDirectory = new File(installpath, ".."); //$NON-NLS-1$ |
| 547 | 547 |
//installDirectory = installDirectory.getCanonicalFile(); |
| 548 |
TXMPreferences.putString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.INSTALL_DIR, installDirectory.getAbsolutePath());
|
|
| 548 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, TBXPreferences.INSTALL_DIR, installDirectory.getAbsolutePath()); |
|
| 549 | 549 |
|
| 550 | 550 |
File preferenceFile = new File(installDirectory, "install.prefs"); //$NON-NLS-1$ |
| 551 | 551 |
if (preferenceFile.exists()) {
|
| ... | ... | |
| 699 | 699 |
String path = dialog.open(); |
| 700 | 700 |
if (path != null) {
|
| 701 | 701 |
installDirectory = new File(path); |
| 702 |
TXMPreferences.putString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.INSTALL_DIR, path);
|
|
| 702 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, TBXPreferences.INSTALL_DIR, path); |
|
| 703 | 703 |
} |
| 704 | 704 |
} |
| 705 | 705 |
}); |
| ... | ... | |
| 859 | 859 |
} |
| 860 | 860 |
|
| 861 | 861 |
try {
|
| 862 |
TXMPreferences.putString(TBXPreferences.PREFERENCES_NODE,
|
|
| 862 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, |
|
| 863 | 863 |
TBXPreferences.USER_TXM_HOME, txmhomedir.getAbsolutePath()); |
| 864 |
TXMPreferences.putString(TBXPreferences.PREFERENCES_NODE,
|
|
| 864 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, |
|
| 865 | 865 |
TBXPreferences.WORKSPACE_LOCATION, new File(txmhomedir, "workspaces/default.xml").getAbsolutePath()); //$NON-NLS-1$ |
| 866 | 866 |
} catch (Exception e) {
|
| 867 | 867 |
Log.severe(NLS.bind(RCPMessages.ApplicationWorkbenchAdvisor_41, e.getLocalizedMessage())); |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/Application.java (revision 560) | ||
|---|---|---|
| 88 | 88 |
Log.setPrintInConsole(true); |
| 89 | 89 |
Log.setLevel(Level.ALL); |
| 90 | 90 |
Log.severe(RCPMessages.Application_2); |
| 91 |
TXMPreferences.putBoolean(TBXPreferences.PREFERENCES_NODE, TBXPreferences.ADD_TECH_LOGS, true);
|
|
| 92 |
TXMPreferences.putString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.LOG_LEVEL, "ALL"); //$NON-NLS-1$
|
|
| 93 |
TXMPreferences.putBoolean(TBXPreferences.PREFERENCES_NODE, TBXPreferences.LOG_STACKTRACE, true);
|
|
| 91 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, TBXPreferences.ADD_TECH_LOGS, true); |
|
| 92 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, TBXPreferences.LOG_LEVEL, "ALL"); //$NON-NLS-1$ |
|
| 93 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, TBXPreferences.LOG_STACKTRACE, true); |
|
| 94 | 94 |
} |
| 95 | 95 |
if (argsList.contains("-run")) { //$NON-NLS-1$
|
| 96 | 96 |
//System.out.println("Running TXM");
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/LanguageSwitchHandler.java (revision 560) | ||
|---|---|---|
| 94 | 94 |
service.getString(Application.PLUGIN_ID, |
| 95 | 95 |
RCPPreferences.UI_LOCALE, "fr", null)); //$NON-NLS-1$ |
| 96 | 96 |
if (d.open() == Window.OK) {
|
| 97 |
TXMPreferences.putString(RCPPreferences.PREFERENCES_NODE, RCPPreferences.UI_LOCALE, d |
|
| 98 |
.getSelectedValue()); |
|
| 97 |
TXMPreferences.put(RCPPreferences.PREFERENCES_NODE, RCPPreferences.UI_LOCALE, d.getSelectedValue()); |
|
| 99 | 98 |
} else |
| 100 | 99 |
return null; |
| 101 | 100 |
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteScript.java (revision 560) | ||
|---|---|---|
| 139 | 139 |
@Override |
| 140 | 140 |
public void widgetSelected(SelectionEvent e) {
|
| 141 | 141 |
boolean b = checkDefault.getSelection(); |
| 142 |
TXMPreferences.putBoolean(RCPPreferences.PREFERENCES_NODE, RCPPreferences.SAVE_BEFORE_EXECUTION, b);
|
|
| 142 |
TXMPreferences.put(RCPPreferences.PREFERENCES_NODE, RCPPreferences.SAVE_BEFORE_EXECUTION, b); |
|
| 143 | 143 |
} |
| 144 | 144 |
|
| 145 | 145 |
@Override |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ComputeTXMResult.java (revision 560) | ||
|---|---|---|
| 19 | 19 |
|
| 20 | 20 |
TXMEditorPart editor = (TXMEditorPart) page; |
| 21 | 21 |
editor.updateResultFromEditor(); |
| 22 |
editor.compute(true);
|
|
| 22 |
editor.compute(false);
|
|
| 23 | 23 |
|
| 24 | 24 |
return null; |
| 25 | 25 |
} |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/FileExplorerPreferencePage.java (revision 560) | ||
|---|---|---|
| 79 | 79 |
|
| 80 | 80 |
//show_folders = new BooleanFieldEditor(SHOW_FOLDERS, Messages.FileExplorerPreferencePage_2, getFieldEditorParent()); |
| 81 | 81 |
//addField(show_folders); |
| 82 |
TXMPreferences.putBoolean(RCPPreferences.PREFERENCES_NODE, RCPPreferences.SHOW_FOLDERS, true);
|
|
| 82 |
TXMPreferences.put(RCPPreferences.PREFERENCES_NODE, RCPPreferences.SHOW_FOLDERS, true); |
|
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 | 85 |
/* (non-Javadoc) |
| tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/DiagnosticEditor.java (revision 560) | ||
|---|---|---|
| 45 | 45 |
RowData gdata = new RowData(); |
| 46 | 46 |
gdata.width = 100; |
| 47 | 47 |
maxScore.setLayoutData(gdata); |
| 48 |
Composite displayArea = getDisplayArea();
|
|
| 48 |
Composite displayArea = getResultArea();
|
|
| 49 | 49 |
displayArea.setLayout(new GridLayout(1, true)); |
| 50 | 50 |
|
| 51 | 51 |
browser = new Browser(displayArea, SWT.NONE); |
| tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/ComputeLexicalTable.java (revision 560) | ||
|---|---|---|
| 52 | 52 |
import org.txm.rcp.editors.TXMEditorPart; |
| 53 | 53 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
| 54 | 54 |
import org.txm.rcp.views.corpora.CorporaView; |
| 55 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
|
| 55 | 56 |
import org.txm.searchengine.cqp.corpus.Partition; |
| 56 | 57 |
import org.txm.searchengine.cqp.corpus.Property; |
| 57 | 58 |
// TODO: Auto-generated Javadoc |
| ... | ... | |
| 137 | 138 |
} |
| 138 | 139 |
// Creating from Partition |
| 139 | 140 |
else if (selection instanceof Partition) {
|
| 140 |
final Property property; |
|
| 141 |
final int fMin; |
|
| 142 |
final int vMax; |
|
| 143 |
|
|
| 144 |
final Partition partition = (Partition) selection; |
|
| 145 |
|
|
| 146 |
String title = RCPMessages.bind(RCPMessages.ComputeLexicalTable_0, partition.getName()); |
|
| 147 |
|
|
| 148 |
LexicalTableDialog d = new LexicalTableDialog(Display.getDefault().getActiveShell(), partition.getCorpus(), title); |
|
| 149 |
d.setFminAndVMax(TXMPreferences.getInt(LexicalTablePreferences.F_MIN, LexicalTablePreferences.PREFERENCES_NODE), |
|
| 150 |
TXMPreferences.getInt(LexicalTablePreferences.V_MAX, LexicalTablePreferences.PREFERENCES_NODE)); |
|
| 151 |
|
|
| 152 |
if (d.open() == Window.OK) {
|
|
| 153 |
property = d.getProperty(); |
|
| 154 |
fMin = d.getFmin(); |
|
| 155 |
vMax = d.getMaxLines(); |
|
| 141 |
try {
|
|
| 142 |
lexicalTable = new LexicalTable((Partition) selection); |
|
| 143 |
} |
|
| 144 |
catch (CqiClientException e) {
|
|
| 145 |
// TODO Auto-generated catch block |
|
| 146 |
e.printStackTrace(); |
|
| 147 |
} |
|
| 156 | 148 |
|
| 157 |
lexicalTable = new LexicalTable(partition, property, fMin, vMax); |
|
| 158 |
lexicalTable.setVMax(vMax); |
|
| 159 | 149 |
|
| 160 |
|
|
| 161 | 150 |
// PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(CorporaView.ID); |
| 162 | 151 |
// JobHandler jobhandler = new JobHandler(RCPMessages.bind(RCPMessages.ComputeLexicalTable_0, partition.getName())) {
|
| 163 | 152 |
// @Override |
| ... | ... | |
| 225 | 214 |
// } |
| 226 | 215 |
// }; |
| 227 | 216 |
// jobhandler.startJob(); |
| 228 |
} |
|
| 229 | 217 |
} |
| 230 | 218 |
// Reopening from existing result |
| 231 | 219 |
else if (selection instanceof LexicalTable) {
|
| tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/ColumnSelectionListener.java (revision 560) | ||
|---|---|---|
| 1 |
package org.txm.lexicaltable.rcp.editors; |
|
| 2 |
|
|
| 3 |
import org.eclipse.jface.viewers.TableViewerColumn; |
|
| 4 |
import org.eclipse.swt.events.SelectionEvent; |
|
| 5 |
import org.eclipse.swt.events.SelectionListener; |
|
| 6 |
import org.txm.rcp.RCPMessages; |
|
| 7 |
import org.txm.rcp.StatusLine; |
|
| 8 |
|
|
| 9 |
/** |
|
| 10 |
* The listener interface for receiving columnSelection events. |
|
| 11 |
* The class that is interested in processing a columnSelection |
|
| 12 |
* event implements this interface, and the object created |
|
| 13 |
* with that class is registered with a component using the |
|
| 14 |
* component's <code>addColumnSelectionListener<code> method. When |
|
| 15 |
* the columnSelection event occurs, that object's appropriate |
|
| 16 |
* method is invoked. |
|
| 17 |
* |
|
| 18 |
* @see ColumnSelectionEvent |
|
| 19 |
*/ |
|
| 20 |
public class ColumnSelectionListener implements SelectionListener {
|
|
| 21 |
|
|
| 22 |
LexicalTableEditor editor; |
|
| 23 |
|
|
| 24 |
/** The col. */ |
|
| 25 |
TableViewerColumn col; |
|
| 26 |
|
|
| 27 |
/** The index. */ |
|
| 28 |
int index; |
|
| 29 |
|
|
| 30 |
/** |
|
| 31 |
* Instantiates a new column selection listener. |
|
| 32 |
* |
|
| 33 |
* @param formColumn the form column |
|
| 34 |
* @param index the index |
|
| 35 |
*/ |
|
| 36 |
public ColumnSelectionListener(LexicalTableEditor editor, TableViewerColumn formColumn, int index) {
|
|
| 37 |
this.editor = editor; |
|
| 38 |
this.col = formColumn; |
|
| 39 |
this.index = index; |
|
| 40 |
} |
|
| 41 |
|
|
| 42 |
/* (non-Javadoc) |
|
| 43 |
* @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) |
|
| 44 |
*/ |
|
| 45 |
@Override |
|
| 46 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 47 |
} |
|
| 48 |
|
|
| 49 |
/* (non-Javadoc) |
|
| 50 |
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) |
|
| 51 |
*/ |
|
| 52 |
@Override |
|
| 53 |
public void widgetSelected(SelectionEvent e) {
|
|
| 54 |
StatusLine.setMessage(RCPMessages.SORT_COLUMN); |
|
| 55 |
this.editor.sort(this.col, this.index); |
|
| 56 |
StatusLine.setMessage(""); //$NON-NLS-1$
|
|
| 57 |
} |
|
| 58 |
} |
|
| 0 | 59 | |
| tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor.java (revision 560) | ||
|---|---|---|
| 98 | 98 |
// org.eclipse.swt.widgets.List colCombo; |
| 99 | 99 |
|
| 100 | 100 |
/** The minfreqspinner. */ |
| 101 |
Spinner minfreqspinner;
|
|
| 101 |
Spinner minFreqSpinner;
|
|
| 102 | 102 |
|
| 103 | 103 |
/** The top spinner. */ |
| 104 | 104 |
Spinner nLinesSpinner; |
| ... | ... | |
| 137 | 137 |
//iTable = lexicalTable.getData(); |
| 138 | 138 |
|
| 139 | 139 |
|
| 140 |
Composite paramArea = new Composite(this.getCommandParametersGroup(), SWT.NONE); |
|
| 140 |
Composite paramArea = this.getCommandParametersGroup(); |
|
| 141 |
|
|
| 142 |
// Composite paramArea = new Composite(this.getCommandParametersGroup(), SWT.NONE); |
|
| 141 | 143 |
|
| 142 |
GridLayout paramLayout = new GridLayout(5, false); |
|
| 143 |
paramArea.setLayout(paramLayout); |
|
| 144 |
// GridLayout paramLayout = new GridLayout(5, false);
|
|
| 145 |
// paramArea.setLayout(paramLayout);
|
|
| 144 | 146 |
|
| 145 | 147 |
// Apply button |
| 146 | 148 |
Button keepTop = new Button(paramArea, SWT.PUSH); |
| ... | ... | |
| 149 | 151 |
@Override |
| 150 | 152 |
public void widgetSelected(SelectionEvent e) {
|
| 151 | 153 |
StatusLine.setMessage(LexicalTableUIMessages.LexicalTableEditor_16); |
| 152 |
System.out.println(NLS.bind(LexicalTableUIMessages.LexicalTableEditor_5, nLinesSpinner.getSelection(), minfreqspinner.getSelection()));
|
|
| 154 |
System.out.println(NLS.bind(LexicalTableUIMessages.LexicalTableEditor_5, nLinesSpinner.getSelection(), minFreqSpinner.getSelection()));
|
|
| 153 | 155 |
|
| 154 | 156 |
MessageBox messageBox = new MessageBox(e.display.getActiveShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); |
| 155 | 157 |
messageBox.setMessage(RCPMessages.DeleteLines_1); |
| 156 | 158 |
int response = messageBox.open(); |
| 157 |
if (response != SWT.YES) |
|
| 159 |
if (response != SWT.YES) {
|
|
| 158 | 160 |
return; |
| 161 |
} |
|
| 159 | 162 |
|
| 160 | 163 |
try {
|
| 161 |
lexicalTable.getData().filter(nLinesSpinner.getSelection(), minfreqspinner.getSelection());
|
|
| 164 |
updateResultFromEditor();
|
|
| 162 | 165 |
refresh(false); |
| 163 |
StatusLine.setMessage(""); //$NON-NLS-1$
|
|
| 164 | 166 |
} catch (Exception e1) {
|
| 165 | 167 |
// TODO Auto-generated catch block |
| 166 | 168 |
org.txm.rcp.utils.Logger.printStackTrace(e1); |
| ... | ... | |
| 181 | 183 |
// Fmin |
| 182 | 184 |
Label fmin = new Label(paramArea, SWT.NONE); |
| 183 | 185 |
fmin.setText(LexicalTableUIMessages.LexicalTableEditor_6); |
| 184 |
minfreqspinner = new Spinner(paramArea, SWT.BORDER);
|
|
| 186 |
minFreqSpinner = new Spinner(paramArea, SWT.BORDER);
|
|
| 185 | 187 |
|
| 186 | 188 |
// Merge or delete columns button |
| 187 | 189 |
Button fusionCol = new Button(paramArea, SWT.PUSH); |
| ... | ... | |
| 316 | 318 |
}); |
| 317 | 319 |
|
| 318 | 320 |
// result |
| 319 |
Composite resultArea = new Composite(parent, SWT.NONE); |
|
| 321 |
//Composite resultArea = new Composite(parent, SWT.NONE); |
|
| 322 |
Composite resultArea = this.getResultArea(); |
|
| 320 | 323 |
|
| 324 |
|
|
| 321 | 325 |
GridData gd = new GridData(GridData.FILL_BOTH); |
| 322 | 326 |
gd.grabExcessVerticalSpace = true; |
| 323 | 327 |
gd.grabExcessHorizontalSpace = true; |
| ... | ... | |
| 350 | 354 |
formColumn = new TableViewerColumn(viewer, SWT.LEFT); |
| 351 | 355 |
formColumn.getColumn().setText(this.lexicalTable.getProperty().getName()); |
| 352 | 356 |
formColumn.getColumn().setWidth(200); |
| 353 |
formColumn.getColumn().addSelectionListener(new ColumnSelectionListener(formColumn, -2)); |
|
| 357 |
formColumn.getColumn().addSelectionListener(new ColumnSelectionListener(this, formColumn, -2));
|
|
| 354 | 358 |
formColumn.setLabelProvider(clp); |
| 355 | 359 |
|
| 356 | 360 |
freqColumn = new TableViewerColumn(viewer, SWT.LEFT); |
| 357 | 361 |
freqColumn.getColumn().setText(RCPMessages.FrequencyListEditorInput_4); |
| 358 | 362 |
freqColumn.getColumn().setWidth(200); |
| 359 |
freqColumn.getColumn().addSelectionListener(new ColumnSelectionListener(freqColumn, -1)); |
|
| 363 |
freqColumn.getColumn().addSelectionListener(new ColumnSelectionListener(this, freqColumn, -1));
|
|
| 360 | 364 |
freqColumn.setLabelProvider(clp); |
| 361 | 365 |
|
| 362 | 366 |
collist = new ArrayList<Object>(); |
| ... | ... | |
| 373 | 377 |
partColumn.getColumn().setToolTipText(colname); |
| 374 | 378 |
collist.add(colname); |
| 375 | 379 |
partColumn.getColumn().setWidth(200); |
| 376 |
partColumn.getColumn().addSelectionListener(new ColumnSelectionListener(partColumn, i)); |
|
| 380 |
partColumn.getColumn().addSelectionListener(new ColumnSelectionListener(this, partColumn, i));
|
|
| 377 | 381 |
partColumn.setLabelProvider(clp); |
| 378 | 382 |
i++; |
| 379 | 383 |
} |
| ... | ... | |
| 401 | 405 |
//this.commandParametersGroup.pack(); |
| 402 | 406 |
} |
| 403 | 407 |
|
| 404 |
|
|
| 405 | 408 |
|
| 406 | 409 |
/** |
| 407 |
* Sort. |
|
| 408 |
* |
|
| 409 |
* @param col the col |
|
| 410 |
* @param index the index |
|
| 410 |
* |
|
| 411 |
* @throws StatException |
|
| 412 |
* @throws CqiClientException |
|
| 411 | 413 |
*/ |
| 412 |
public void sort(TableViewerColumn col, int index) {
|
|
| 413 |
|
|
| 414 |
if (index == previousSortedCol) {
|
|
| 415 |
reverse = !reverse; |
|
| 416 |
} else {
|
|
| 417 |
reverse = DEFAULTREVERSE; |
|
| 418 |
} |
|
| 419 |
|
|
| 420 |
if (index == -2) {// rownames
|
|
| 421 |
lexicalTable.getData().sortRowNames(reverse); |
|
| 422 |
} else if (index == -1) { // freqs
|
|
| 423 |
try {
|
|
| 424 |
lexicalTable.getData().sortByFreqs(reverse); |
|
| 425 |
StatusLine.setMessage(RCPMessages.SORT_DONE); |
|
| 426 |
} catch (Exception e2) {
|
|
| 427 |
org.txm.rcp.utils.Logger.printStackTrace(e2); |
|
| 428 |
} |
|
| 429 |
} else if (index >= 0) {
|
|
| 430 |
lexicalTable.getData().sort(index, reverse); |
|
| 431 |
} |
|
| 432 |
|
|
| 433 |
previousSortedCol = index; |
|
| 434 |
refreshTable(); |
|
| 435 |
|
|
| 436 |
viewer.getTable().setSortColumn(col.getColumn()); |
|
| 437 |
if (reverse) {
|
|
| 438 |
viewer.getTable().setSortDirection(SWT.DOWN); |
|
| 439 |
} |
|
| 440 |
else {
|
|
| 441 |
viewer.getTable().setSortDirection(SWT.UP); |
|
| 442 |
} |
|
| 443 |
} |
|
| 444 |
|
|
| 445 |
|
|
| 446 | 414 |
private void refreshColNames() throws StatException, CqiClientException {
|
| 447 | 415 |
TableColumn[] cols = viewer.getTable().getColumns(); |
| 448 | 416 |
String[] colnames = lexicalTable.getColNames().asStringsArray(); |
| ... | ... | |
| 457 | 425 |
*/ |
| 458 | 426 |
public void refreshInfos() {
|
| 459 | 427 |
try {
|
| 460 |
this.setContentDescription(TXMCoreMessages.T + lexicalTable.getData().getTotal() |
|
| 461 |
+ TXMCoreMessages.V + lexicalTable.getData().getNRows() |
|
| 462 |
+ TXMCoreMessages.FMIN_2 + lexicalTable.getData().getFmin() |
|
| 463 |
+ TXMCoreMessages.FMAX_2 + lexicalTable.getData().getFmax()); |
|
| 428 |
this.setContentDescription(TXMCoreMessages.T + lexicalTable.getData().getTotal() + TXMCoreMessages.V + lexicalTable.getData().getNRows() |
|
| 429 |
+ TXMCoreMessages.FMIN_2 + lexicalTable.getData().getFmin() + TXMCoreMessages.FMAX_2 + lexicalTable.getData().getFmax()); |
|
| 464 | 430 |
} catch (Exception e3) {
|
| 465 | 431 |
// TODO Auto-generated catch block |
| 466 | 432 |
org.txm.rcp.utils.Logger.printStackTrace(e3); |
| ... | ... | |
| 542 | 508 |
return null; |
| 543 | 509 |
} |
| 544 | 510 |
|
| 545 |
/** |
|
| 546 |
* The listener interface for receiving columnSelection events. |
|
| 547 |
* The class that is interested in processing a columnSelection |
|
| 548 |
* event implements this interface, and the object created |
|
| 549 |
* with that class is registered with a component using the |
|
| 550 |
* component's <code>addColumnSelectionListener<code> method. When |
|
| 551 |
* the columnSelection event occurs, that object's appropriate |
|
| 552 |
* method is invoked. |
|
| 553 |
* |
|
| 554 |
* @see ColumnSelectionEvent |
|
| 555 |
*/ |
|
| 556 |
public class ColumnSelectionListener implements SelectionListener {
|
|
| 557 | 511 |
|
| 558 |
/** The col. */ |
|
| 559 |
TableViewerColumn col; |
|
| 560 | 512 |
|
| 561 |
/** The index. */ |
|
| 562 |
int index; |
|
| 563 |
|
|
| 564 |
/** |
|
| 565 |
* Instantiates a new column selection listener. |
|
| 566 |
* |
|
| 567 |
* @param formColumn the form column |
|
| 568 |
* @param index the index |
|
| 569 |
*/ |
|
| 570 |
public ColumnSelectionListener(TableViewerColumn formColumn, int index) {
|
|
| 571 |
this.col = formColumn; |
|
| 572 |
this.index = index; |
|
| 573 |
} |
|
| 574 |
|
|
| 575 |
/* (non-Javadoc) |
|
| 576 |
* @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) |
|
| 577 |
*/ |
|
| 578 |
@Override |
|
| 579 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 580 |
} |
|
| 581 |
|
|
| 582 |
/* (non-Javadoc) |
|
| 583 |
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) |
|
| 584 |
*/ |
|
| 585 |
@Override |
|
| 586 |
public void widgetSelected(SelectionEvent e) {
|
|
| 587 |
StatusLine.setMessage(RCPMessages.SORT_COLUMN); |
|
| 588 |
sort(col, index); |
|
| 589 |
StatusLine.setMessage(""); //$NON-NLS-1$
|
|
| 590 |
} |
|
| 591 |
} |
|
| 592 |
|
|
| 593 | 513 |
/** |
| 594 | 514 |
* Gets the line table viewer. |
| 595 | 515 |
* |
| ... | ... | |
| 660 | 580 |
} |
| 661 | 581 |
} |
| 662 | 582 |
|
| 583 |
|
|
| 663 | 584 |
|
| 585 |
/** |
|
| 586 |
* Sort. |
|
| 587 |
* |
|
| 588 |
* @param col the col |
|
| 589 |
* @param index the index |
|
| 590 |
*/ |
|
| 591 |
public void sort(TableViewerColumn col, int index) {
|
|
| 592 |
|
|
| 593 |
if (index == previousSortedCol) {
|
|
| 594 |
reverse = !reverse; |
|
| 595 |
} else {
|
|
| 596 |
reverse = DEFAULTREVERSE; |
|
| 597 |
} |
|
| 598 |
|
|
| 599 |
if (index == -2) {// rownames
|
|
| 600 |
lexicalTable.getData().sortRowNames(reverse); |
|
| 601 |
} else if (index == -1) { // freqs
|
|
| 602 |
try {
|
|
| 603 |
lexicalTable.getData().sortByFreqs(reverse); |
|
| 604 |
StatusLine.setMessage(RCPMessages.SORT_DONE); |
|
| 605 |
} catch (Exception e2) {
|
|
| 606 |
org.txm.rcp.utils.Logger.printStackTrace(e2); |
|
| 607 |
} |
|
| 608 |
} else if (index >= 0) {
|
|
| 609 |
lexicalTable.getData().sort(index, reverse); |
|
| 610 |
} |
|
| 611 |
|
|
| 612 |
previousSortedCol = index; |
|
| 613 |
refreshTable(); |
|
| 614 |
|
|
| 615 |
viewer.getTable().setSortColumn(col.getColumn()); |
|
| 616 |
if (reverse) {
|
|
| 617 |
viewer.getTable().setSortDirection(SWT.DOWN); |
|
| 618 |
} |
|
| 619 |
else {
|
|
| 620 |
viewer.getTable().setSortDirection(SWT.UP); |
|
| 621 |
} |
|
| 622 |
} |
|
| 623 |
|
|
| 624 |
|
|
| 625 |
|
|
| 664 | 626 |
@Override |
| 665 | 627 |
public void updateEditorFromResult(boolean update) {
|
| 666 | 628 |
super.updateEditorFromResult(update); |
| 667 | 629 |
nLinesSpinner.setMinimum(1); |
| 668 | 630 |
nLinesSpinner.setMaximum(lexicalTable.getData().getNRows()); |
| 669 | 631 |
nLinesSpinner.setSelection(lexicalTable.getData().getNRows()); |
| 670 |
minfreqspinner.setMinimum(lexicalTable.getData().getFmin()); |
|
| 671 |
minfreqspinner.setMaximum(lexicalTable.getData().getFmax()); |
|
| 672 |
|
|
| 632 |
minFreqSpinner.setMinimum(lexicalTable.getData().getFmin()); |
|
| 633 |
minFreqSpinner.setMaximum(lexicalTable.getData().getFmax()); |
|
| 673 | 634 |
} |
| 674 | 635 |
|
| 675 |
|
|
| 636 |
|
|
| 676 | 637 |
@Override |
| 677 | 638 |
public void updateResultFromEditor() {
|
| 678 |
// TODO Auto-generated method stub |
|
| 679 |
|
|
| 639 |
try {
|
|
| 640 |
lexicalTable.getData().filter(nLinesSpinner.getSelection(), minFreqSpinner.getSelection()); |
|
| 641 |
} |
|
| 642 |
catch (Exception e) {
|
|
| 643 |
// TODO Auto-generated catch block |
|
| 644 |
e.printStackTrace(); |
|
| 645 |
} |
|
| 680 | 646 |
} |
| 681 | 647 |
} |
| tmp/org.txm.cah.core/src/org/txm/cah/core/functions/AHC.java (revision 560) | ||
|---|---|---|
| 258 | 258 |
} |
| 259 | 259 |
|
| 260 | 260 |
// FIXME: persistence |
| 261 |
TXMPreferences.putLocalInt(this, AHCPreferences.N_CLUSTERS, this.pNCluster);
|
|
| 262 |
TXMPreferences.putLocalBoolean(this, AHCPreferences.COLUMNS_COMPUTING, this.pColumns);
|
|
| 261 |
this.saveParameter(AHCPreferences.N_CLUSTERS, this.pNCluster);
|
|
| 262 |
this.saveParameter(AHCPreferences.COLUMNS_COMPUTING, this.pColumns);
|
|
| 263 | 263 |
|
| 264 | 264 |
// Reset the cached data |
| 265 | 265 |
this.resetCache(); |
| tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesSelectionEditor.java (revision 560) | ||
|---|---|---|
| 35 | 35 |
|
| 36 | 36 |
@Override |
| 37 | 37 |
public void widgetSelected(SelectionEvent e) {
|
| 38 |
TXMPreferences.putLocalBoolean(getResultData(), SpecificitiesPreferences.CHART_TRANSPOSE, groupBarsByLines.getSelection());
|
|
| 38 |
getResultData().saveParameter(SpecificitiesPreferences.CHART_TRANSPOSE, groupBarsByLines.getSelection());
|
|
| 39 | 39 |
getResultData().setDirty(); |
| 40 | 40 |
getResultData().setNeedsToResetView(true); |
| 41 | 41 |
compute(true); |
| tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesTableLabelProvider.java (revision 560) | ||
|---|---|---|
| 108 | 108 |
} |
| 109 | 109 |
|
| 110 | 110 |
/* (non-Javadoc) |
| 111 |
* @see org.eclipse.jface.viewers.BaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener) |
|
| 112 |
*/ |
|
| 113 |
@Override |
|
| 114 |
public void addListener(ILabelProviderListener listener) {
|
|
| 115 |
|
|
| 116 |
} |
|
| 117 |
|
|
| 118 |
/* (non-Javadoc) |
|
| 119 |
* @see org.eclipse.jface.viewers.BaseLabelProvider#dispose() |
|
| 120 |
*/ |
|
| 121 |
@Override |
|
| 122 |
public void dispose() {
|
|
| 123 |
|
|
| 124 |
} |
|
| 125 |
|
|
| 126 |
/* (non-Javadoc) |
|
| 127 | 111 |
* @see org.eclipse.jface.viewers.BaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String) |
| 128 | 112 |
*/ |
| 129 | 113 |
@Override |
| ... | ... | |
| 131 | 115 |
return false; |
| 132 | 116 |
} |
| 133 | 117 |
|
| 134 |
/* (non-Javadoc) |
|
| 135 |
* @see org.eclipse.jface.viewers.BaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener) |
|
| 136 |
*/ |
|
| 137 |
@Override |
|
| 138 |
public void removeListener(ILabelProviderListener listener) {
|
|
| 139 | 118 |
|
| 140 |
} |
|
| 141 | 119 |
} |
| tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 560) | ||
|---|---|---|
| 113 | 113 |
*/ |
| 114 | 114 |
private void composeDisplayArea() throws StatException {
|
| 115 | 115 |
|
| 116 |
Composite parent = this.getDisplayArea();
|
|
| 116 |
Composite parent = this.getResultArea();
|
|
| 117 | 117 |
//parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
| 118 | 118 |
|
| 119 | 119 |
|
| tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifities.java (revision 560) | ||
|---|---|---|
| 95 | 95 |
if (selection instanceof Partition) {
|
| 96 | 96 |
Partition partition = (Partition) selection; |
| 97 | 97 |
//lexicalTable = LexicalTableFactory.getLexicalTable(partition, partition.getCorpus().getProperty(defautProperty), fMin); |
| 98 |
lexicalTable = new LexicalTable(partition, partition.getCorpus().getDefaultProperty(), fMin, vMax); |
|
| 98 |
//lexicalTable = new LexicalTable(partition, partition.getCorpus().getDefaultProperty(), fMin, vMax); |
|
| 99 |
lexicalTable = new LexicalTable(partition); |
|
| 99 | 100 |
} |
| 100 | 101 |
// creating from Subcorpus |
| 101 | 102 |
else if (selection instanceof Subcorpus) {
|
| tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/editors/WordCloudEditor.java (revision 560) | ||
|---|---|---|
| 92 | 92 |
public void widgetSelected(SelectionEvent e) {
|
| 93 | 93 |
|
| 94 | 94 |
// persistence |
| 95 |
TXMPreferences.putLocalInt(getResultData(), WordCloudPreferences.MAX_WORDS, maxWordsSpinner.getSelection());
|
|
| 96 |
TXMPreferences.putLocalInt(getResultData(), WordCloudPreferences.FMIN, minFreqSpinner.getSelection());
|
|
| 97 |
TXMPreferences.putLocalFloat(getResultData(), WordCloudPreferences.ROT, rotPerSpinner.getSelection());
|
|
| 98 |
TXMPreferences.putLocalBoolean(getResultData(), WordCloudPreferences.RANDOM_POSITION, randomOrderButton.getSelection());
|
|
| 95 |
getResultData().saveParameter(WordCloudPreferences.MAX_WORDS, maxWordsSpinner.getSelection());
|
|
| 96 |
getResultData().saveParameter(WordCloudPreferences.FMIN, minFreqSpinner.getSelection());
|
|
| 97 |
getResultData().saveParameter(WordCloudPreferences.ROT, rotPerSpinner.getSelection());
|
|
| 98 |
getResultData().saveParameter(WordCloudPreferences.RANDOM_POSITION, randomOrderButton.getSelection());
|
|
| 99 | 99 |
|
| 100 | 100 |
compute(true); |
| 101 | 101 |
} |
| tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 560) | ||
|---|---|---|
| 372 | 372 |
empantPanel.setLayoutData(empantLayoutData); |
| 373 | 373 |
|
| 374 | 374 |
// result |
| 375 |
Composite resultArea = this.getDisplayArea();
|
|
| 375 |
Composite resultArea = this.getResultArea();
|
|
| 376 | 376 |
// FormData resultLayoutData = new FormData(); |
| 377 | 377 |
// resultLayoutData.top = new FormAttachment(scrollComposite, 0); |
| 378 | 378 |
// resultLayoutData.left = new FormAttachment(0); |
| tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAFactorialMapChartEditor.java (revision 560) | ||
|---|---|---|
| 152 | 152 |
return; |
| 153 | 153 |
} |
| 154 | 154 |
|
| 155 |
TXMPreferences.putLocalBoolean(getResultData(), CAPreferences.SHOW_INDIVIDUALS, ((ToolItem) e.getSource()).getSelection());
|
|
| 155 |
getResultData().saveParameter(CAPreferences.SHOW_INDIVIDUALS, ((ToolItem) e.getSource()).getSelection());
|
|
| 156 | 156 |
} |
| 157 | 157 |
//Show/hide rows |
| 158 | 158 |
else if(e.getSource() == showRows) {
|
| ... | ... | |
| 163 | 163 |
return; |
| 164 | 164 |
} |
| 165 | 165 |
|
| 166 |
TXMPreferences.putLocalBoolean(getResultData(), CAPreferences.SHOW_VARIABLES, ((ToolItem) e.getSource()).getSelection());
|
|
| 166 |
getResultData().saveParameter(CAPreferences.SHOW_VARIABLES, ((ToolItem) e.getSource()).getSelection());
|
|
| 167 | 167 |
} |
| 168 | 168 |
//Show/hide rows |
| 169 | 169 |
else if(e.getSource() == showPointShapes) {
|
| 170 | 170 |
getResultData().setChartDirty(); |
| 171 |
TXMPreferences.putLocalBoolean(getResultData(), CAPreferences.SHOW_POINT_SHAPES, ((ToolItem) e.getSource()).getSelection());
|
|
| 171 |
getResultData().saveParameter(CAPreferences.SHOW_POINT_SHAPES, ((ToolItem) e.getSource()).getSelection());
|
|
| 172 | 172 |
} |
| 173 | 173 |
// Change factors |
| 174 | 174 |
else if(e.getSource() == plansCombo) {
|
| ... | ... | |
| 190 | 190 |
dimension2 = Integer.parseInt(split[1]); |
| 191 | 191 |
|
| 192 | 192 |
// FIXME: persistence |
| 193 |
TXMPreferences.putLocalInt(getResultData(), CAPreferences.FIRST_DIMENSION, dimension1);
|
|
| 194 |
TXMPreferences.putLocalInt(getResultData(), CAPreferences.SECOND_DIMENSION, dimension2);
|
|
| 193 |
getResultData().saveParameter(CAPreferences.FIRST_DIMENSION, dimension1);
|
|
| 194 |
getResultData().saveParameter(CAPreferences.SECOND_DIMENSION, dimension2);
|
|
| 195 | 195 |
|
| 196 | 196 |
resetView = true; |
| 197 | 197 |
} |
| tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificities.java (revision 560) | ||
|---|---|---|
| 37 | 37 |
import java.util.Arrays; |
| 38 | 38 |
import java.util.List; |
| 39 | 39 |
|
| 40 |
import org.txm.core.results.Parameter; |
|
| 40 | 41 |
import org.txm.core.results.TXMParameters; |
| 41 | 42 |
import org.txm.core.results.TXMResult; |
| 42 | 43 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
| ... | ... | |
| 107 | 108 |
private BufferedWriter writer; |
| 108 | 109 |
|
| 109 | 110 |
|
| 111 |
|
|
| 112 |
@Parameter |
|
| 110 | 113 |
protected int pMaxScore; |
| 111 | 114 |
|
| 112 | 115 |
/** |
| ... | ... | |
| 580 | 583 |
public boolean canCompute() {
|
| 581 | 584 |
|
| 582 | 585 |
if(this.lexicalTable == null) {
|
| 586 |
System.err.println("Specificities.canCompute(): Can not compute without a lexical table.");
|
|
| 583 | 587 |
return false; |
| 584 | 588 |
} |
| 585 | 589 |
|
| tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/DoInstallStep.java (revision 560) | ||
|---|---|---|
| 80 | 80 |
|
| 81 | 81 |
File execFile = new File(OSDir, "cqpserver"+ext); |
| 82 | 82 |
|
| 83 |
TXMPreferences.putString(CQPLibPreferences.PREFERENCES_NODE, CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB, OSDir.getAbsolutePath());
|
|
| 84 |
TXMPreferences.putString(CQPLibPreferences.PREFERENCES_NODE, CQPLibPreferences.CQI_SERVER_PATH_TO_INIT_FILE, initFile.getAbsolutePath());
|
|
| 85 |
TXMPreferences.putString(CQPLibPreferences.PREFERENCES_NODE, CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE, execFile.getAbsolutePath());
|
|
| 83 |
TXMPreferences.put(CQPLibPreferences.PREFERENCES_NODE, CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB, OSDir.getAbsolutePath()); |
|
| 84 |
TXMPreferences.put(CQPLibPreferences.PREFERENCES_NODE, CQPLibPreferences.CQI_SERVER_PATH_TO_INIT_FILE, initFile.getAbsolutePath()); |
|
| 85 |
TXMPreferences.put(CQPLibPreferences.PREFERENCES_NODE, CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE, execFile.getAbsolutePath()); |
|
| 86 | 86 |
if (!Util.isWindows()) {
|
| 87 | 87 |
try {
|
| 88 | 88 |
Log.info("Setting execution file rights to: "+OSDir.getAbsolutePath());
|
| ... | ... | |
| 105 | 105 |
} |
| 106 | 106 |
|
| 107 | 107 |
Log.warning("SearchEngine preferences set with: "+OSDir.getAbsolutePath()+ ", "+initFile.getAbsolutePath()+ " and "+execFile.getAbsolutePath());
|
| 108 |
TXMPreferences.putString(CQPLibPreferences.PREFERENCES_NODE, CQPLibPreferences.VERSION, currentVersion.toString());
|
|
| 108 |
TXMPreferences.put(CQPLibPreferences.PREFERENCES_NODE, CQPLibPreferences.VERSION, currentVersion.toString()); |
|
| 109 | 109 |
} |
| 110 | 110 |
} |
| tmp/org.txm.core/src/java/org/txm/ToolboxOld.java (revision 560) | ||
|---|---|---|
| 355 | 355 |
*/ |
| 356 | 356 |
@Deprecated |
| 357 | 357 |
public static void setParam(String key, String value) {
|
| 358 |
TXMPreferences.putString(TBXPreferences.PREFERENCES_NODE, key, value);
|
|
| 358 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, key, value); |
|
| 359 | 359 |
} |
| 360 | 360 |
|
| 361 | 361 |
/** |
| tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 560) | ||
|---|---|---|
| 71 | 71 |
scope.getNode(node).remove(key); |
| 72 | 72 |
} |
| 73 | 73 |
|
| 74 |
/** |
|
| 75 |
* Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method. |
|
| 76 |
* @param result |
|
| 77 |
* @param key |
|
| 78 |
* @param value |
|
| 79 |
*/ |
|
| 80 |
public static void putLocalBoolean(TXMResult result, String key, boolean value) {
|
|
| 81 |
scope.getNode(result.getUUID()).putBoolean(key, value); |
|
| 82 |
} |
|
| 83 | 74 |
|
| 84 |
|
|
| 85 | 75 |
/** |
| 86 | 76 |
* Looks for the value of the specified <code>key</code> in the specified parameters and preference nodes. |
| 87 | 77 |
* Returns the value of a key in the specified parameters if exists. |
| ... | ... | |
| 230 | 220 |
// return stringValue; |
| 231 | 221 |
// } |
| 232 | 222 |
|
| 233 |
/** |
|
| 234 |
* Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method. |
|
| 235 |
* @param result |
|
| 236 |
* @param key |
|
| 237 |
* @param value |
|
| 238 |
*/ |
|
| 239 |
public static void putLocalString(TXMResult result, String key, String value) {
|
|
| 240 |
scope.getNode(result.getUUID()).put(key, value); |
|
| 241 |
} |
|
| 242 | 223 |
|
| 243 | 224 |
|
| 244 |
|
|
| 245 | 225 |
/** |
| 246 | 226 |
* Looks for the value of the specified <code>key</code> in the specified parameters and preference nodes. |
| 247 | 227 |
* Returns the value of a key in the specified parameters if exists. |
| ... | ... | |
| 325 | 305 |
|
| 326 | 306 |
|
| 327 | 307 |
|
| 328 |
/** |
|
| 329 |
* Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method. |
|
| 330 |
* @param result |
|
| 331 |
* @param key |
|
| 332 |
* @param value |
|
| 333 |
*/ |
|
| 334 |
public static void putLocalInt(TXMResult result, String key, int value) {
|
|
| 335 |
scope.getNode(result.getUUID()).putInt(key, value); |
|
| 336 |
} |
|
| 337 | 308 |
|
| 338 |
|
|
| 339 | 309 |
/** |
| 340 | 310 |
* Looks for the value of the specified <code>key</code> in the specified parameters and preference nodes. |
| 341 | 311 |
* Returns the value of a key in the specified parameters if exists. |
| ... | ... | |
| 405 | 375 |
|
| 406 | 376 |
|
| 407 | 377 |
/** |
| 408 |
* Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method. |
|
| 409 |
* @param result |
|
| 410 |
* @param key |
|
| 411 |
* @param value |
|
| 412 |
*/ |
|
| 413 |
public static void putLocalLong(TXMResult result, String key, long value) {
|
|
| 414 |
scope.getNode(result.getUUID()).putLong(key, value); |
|
| 415 |
} |
|
| 416 |
|
|
| 417 |
|
|
| 418 |
/** |
|
| 419 | 378 |
* Looks for the value of the specified <code>key</code> in the specified parameters and preference nodes. |
| 420 | 379 |
* Returns the value of a key in the specified parameters if exists. |
| 421 | 380 |
* Otherwise try to get it from the local result node if exists. |
| ... | ... | |
| 499 | 458 |
|
| 500 | 459 |
|
| 501 | 460 |
/** |
| 502 |
* Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method. |
|
| 503 |
* @param result |
|
| 504 |
* @param key |
|
| 505 |
* @param value |
|
| 506 |
*/ |
|
| 507 |
public static void putLocalDouble(TXMResult result, String key, double value) {
|
|
| 508 |
scope.getNode(result.getUUID()).putDouble(key, value); |
|
| 509 |
} |
|
| 510 |
|
|
| 511 |
|
|
| 512 |
|
|
| 513 |
/** |
|
| 514 | 461 |
* Looks for the value of the specified <code>key</code> in the specified parameters and preference nodes. |
| 515 | 462 |
* Returns the value of a key in the specified parameters if exists. |
| 516 | 463 |
* Otherwise try to get it from the local result node if exists. |
| ... | ... | |
| 591 | 538 |
} |
| 592 | 539 |
|
| 593 | 540 |
|
| 594 |
/** |
|
| 595 |
* Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method. |
|
| 596 |
* @param result |
|
| 597 |
* @param key |
|
| 598 |
* @param value |
|
| 599 |
*/ |
|
| 600 |
public static void putLocalFloat(TXMResult result, String key, float value) {
|
|
| 601 |
scope.getNode(result.getUUID()).putFloat(key, value); |
|
| 602 |
} |
|
| 603 | 541 |
|
| 604 | 542 |
|
| 605 | 543 |
/** |
| ... | ... | |
| 644 | 582 |
return scope.getNode(nodeQualifier).getFloat(key, defaultValue); |
| 645 | 583 |
} |
| 646 | 584 |
|
| 647 |
public static byte[] toByteArray(Serializable s) {
|
|
| 648 |
try {
|
|
| 649 |
ByteArrayOutputStream bwriter = new ByteArrayOutputStream(); |
|
| 650 |
ObjectOutputStream writer = new ObjectOutputStream(bwriter); |
|
| 651 |
writer.writeObject(s); |
|
| 652 |
return bwriter.toByteArray(); |
|
| 653 |
} catch(IOException e) {
|
|
| 654 |
System.out.println("Error while saving "+s+": "+e.getLocalizedMessage());
|
|
| 655 |
Log.printStackTrace(e); |
|
| 656 |
} |
|
| 657 |
return null; |
|
| 658 |
} |
|
| 659 | 585 |
|
| 660 | 586 |
public static Serializable toSerializable(byte[] bytes) {
|
| 661 | 587 |
|
| ... | ... | |
| 953 | 879 |
return nodeQualifier; |
| 954 | 880 |
} |
| 955 | 881 |
|
| 956 |
/** |
|
| 957 |
* |
|
| 958 |
* @param nodeQualifier |
|
| 959 |
* @param key |
|
| 960 |
* @param value |
|
| 961 |
*/ |
|
| 962 |
public static void put(String nodeQualifier, String key, String value) {
|
|
| 963 |
scope.getNode(nodeQualifier).put(key, value); |
|
| 964 |
} |
|
| 965 | 882 |
|
| 966 |
public static void putString(String nodeQualifier, String key, String value) {
|
|
| 967 |
scope.getNode(nodeQualifier).put(key, value); |
|
| 968 |
} |
|
| 969 | 883 |
|
| 970 | 884 |
/** |
| 971 |
* |
|
| 972 |
* @param nodeQualifier |
|
| 973 |
* @param key |
|
| 974 |
* @param value |
|
| 975 |
*/ |
|
| 976 |
public static void putInt(String nodeQualifier, String key, int value) {
|
|
| 977 |
scope.getNode(nodeQualifier).putInt(key, value); |
|
| 978 |
} |
|
| 979 |
|
|
| 980 |
/** |
|
| 981 |
* |
|
| 982 |
* @param nodeQualifier |
|
| 983 |
* @param key |
|
| 984 |
* @param value |
|
| 985 |
*/ |
|
| 986 |
public static void putFloat(String nodeQualifier, String key, float value) {
|
|
| 987 |
scope.getNode(nodeQualifier).putFloat(key, value); |
|
| 988 |
} |
|
| 989 |
|
|
| 990 |
/** |
|
| 991 |
* |
|
| 992 |
* @param nodeQualifier |
|
| 993 |
* @param key |
|
| 994 |
* @param value |
|
| 995 |
*/ |
|
| 996 |
public static void putDouble(String nodeQualifier, String key, double value) {
|
|
| 997 |
scope.getNode(nodeQualifier).putDouble(key, value); |
|
| 998 |
} |
|
| 999 |
|
|
| 1000 |
/** |
|
| 1001 |
* |
|
| 1002 |
* @param nodeQualifier |
|
| 1003 |
* @param key |
|
| 1004 |
* @param value |
|
| 1005 |
*/ |
|
| 1006 |
public static void putByteArray(String nodeQualifier, String key, byte[] value) {
|
|
| 1007 |
scope.getNode(nodeQualifier).putByteArray(key, value); |
|
| 1008 |
} |
|
| 1009 |
|
|
| 1010 |
/** |
|
| 1011 |
* |
|
| 1012 |
* @param nodeQualifier |
|
| 1013 |
* @param key |
|
| 1014 |
* @param value |
|
| 1015 |
*/ |
|
| 1016 |
public static void putBoolean(String nodeQualifier, String key, boolean value) {
|
|
| 1017 |
scope.getNode(nodeQualifier).putBoolean(key, value); |
|
| 1018 |
} |
|
| 1019 |
|
|
| 1020 |
/** |
|
| 1021 |
* |
|
| 1022 |
* @param nodeQualifier |
|
| 1023 |
* @param key |
|
| 1024 |
* @param value |
|
| 1025 |
*/ |
|
| 1026 |
public static void putLong(String nodeQualifier, String key, long value) {
|
|
| 1027 |
scope.getNode(nodeQualifier).putLong(key, value); |
|
| 1028 |
} |
|
| 1029 |
|
|
| 1030 |
|
|
| 1031 |
/** |
|
| 1032 | 885 |
* Stores the specified parameters pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method. |
| 1033 | 886 |
* @param result |
| 1034 | 887 |
* @param parameters |
| ... | ... | |
| 1045 | 898 |
} |
| 1046 | 899 |
} |
| 1047 | 900 |
|
| 901 |
|
|
| 902 |
|
|
| 1048 | 903 |
/** |
| 1049 |
* Stores the specified parameters pairs of key/value in a local node dedicated to the specified result. The node qualifier is generated by the <code>TXMResult.getUUID</code> method.
|
|
| 1050 |
* @param result
|
|
| 904 |
* |
|
| 905 |
* @param nodeQualifier
|
|
| 1051 | 906 |
* @param key |
| 1052 | 907 |
* @param value |
| 1053 | 908 |
*/ |
| 1054 |
public static void putLocal(TXMResult result, String key, Object value) {
|
|
| 1055 |
|
|
| 909 |
public static void put(String nodeQualifier, String key, Object value) {
|
|
| 910 |
|
|
| 1056 | 911 |
if (Integer.class.isInstance(value)) {
|
| 1057 |
putLocalInt(result, key, (Integer) value);
|
|
| 912 |
scope.getNode(nodeQualifier).putInt(key, (Integer) value);
|
|
| 1058 | 913 |
} |
| 1059 | 914 |
else if (Double.class.isInstance(value)) {
|
| 1060 |
putLocalDouble(result, key, (Double) value);
|
|
| 915 |
scope.getNode(nodeQualifier).putDouble(key, (Double) value);
|
|
| 1061 | 916 |
} |
| 1062 | 917 |
else if (Float.class.isInstance(value)) {
|
| 1063 |
putLocalFloat(result, key, (Float) value);
|
|
| 918 |
scope.getNode(nodeQualifier).putFloat(key, (Float) value);
|
|
| 1064 | 919 |
} |
| 1065 | 920 |
else if (Long.class.isInstance(value)) {
|
| 1066 |
putLocalLong(result, key, (Long) value);
|
|
| 921 |
scope.getNode(nodeQualifier).putLong(key, (Long) value);
|
|
| 1067 | 922 |
} |
| 1068 | 923 |
else if (String.class.isInstance(value)) {
|
| 1069 |
putLocalString(result, key, (String) value);
|
|
| 924 |
scope.getNode(nodeQualifier).put(key, (String) value);
|
|
| 1070 | 925 |
} |
| 1071 | 926 |
else if (Boolean.class.isInstance(value)) {
|
| 1072 |
putLocalBoolean(result, key, (Boolean) value);
|
|
| 927 |
scope.getNode(nodeQualifier).putBoolean(key, (Boolean) value);
|
|
| 1073 | 928 |
} |
| 1074 |
// FIXME: to do |
|
| 929 |
// FIXME: need to prove/validate this methode |
|
| 930 |
else if (byte.class.isAssignableFrom(value.getClass().getComponentType())) {
|
|
| 931 |
System.err.println("TXMPreferences.put(): byte array -> need to prove/validate this method.");
|
|
| 932 |
scope.getNode(nodeQualifier).putByteArray(key, (byte[]) value); |
|
| 933 |
} |
|
| 934 |
|
|
| 935 |
// FIXME: to do if needed |
|
| 1075 | 936 |
// else if (Serializable.class.isInstance(value)) {
|
| 1076 | 937 |
// putLocalSerializable(result, key, (Serializable) value); |
| 1077 | 938 |
else {
|
| 1078 |
//FIXME: Debug
|
|
| 1079 |
System.err.println("TXMPreferences.putLocal(): error, can't find a put method that matches the value type: " + value.getClass() + "=" + value + ".");
|
|
| 1080 |
}
|
|
| 939 |
//FIXME: Debug |
|
| 940 |
System.err.println("TXMPreferences.put(): error, can't find a put method that matches the value type: " + value.getClass() + "=" + value + ".");
|
|
| 941 |
} |
|
| 1081 | 942 |
|
| 943 |
|
|
| 1082 | 944 |
} |
| 945 |
|
|
| 946 |
// |
|
| 947 |
// /** |
|
| 948 |
// * |
|
| 949 |
// * @param nodeQualifier |
|
| 950 |
// * @param key |
|
| 951 |
// * @param value |
|
| 952 |
// */ |
|
| 953 |
// public static void putByteArray(String nodeQualifier, String key, byte[] value) {
|
|
| 954 |
// scope.getNode(nodeQualifier).putByteArray(key, value); |
|
| 955 |
// } |
|
| 1083 | 956 |
|
| 957 |
|
|
| 958 |
|
|
| 959 |
/** |
|
| 960 |
* Stores the specified parameters pairs of key/value in a local node dedicated to the specified result. The node qualifier is generated by the <code>TXMResult.getUUID</code> method. |
|
| 961 |
* @param result |
|
| 962 |
* @param key |
|
| 963 |
* @param value |
|
| 964 |
*/ |
|
| 965 |
public static void putLocal(TXMResult result, String key, Object value) {
|
|
| 966 |
put(result.getUUID(), key, value);; |
|
| 967 |
} |
|
| 968 |
|
|
| 969 |
|
|
| 970 |
// FIXME: TO do if needed |
|
| 1084 | 971 |
private static void putLocalSerializable(TXMResult result, String key, Serializable value) {
|
| 1085 | 972 |
byte[] b = toByteArray(value); |
| 1086 | 973 |
scope.getNode(result.getUUID()).putByteArray(key, b); |
| 1087 | 974 |
} |
| 1088 | 975 |
|
| 976 |
public static byte[] toByteArray(Serializable s) {
|
|
| 977 |
try {
|
|
| 978 |
ByteArrayOutputStream bwriter = new ByteArrayOutputStream(); |
|
| 979 |
ObjectOutputStream writer = new ObjectOutputStream(bwriter); |
|
| 980 |
writer.writeObject(s); |
|
| 981 |
return bwriter.toByteArray(); |
|
| 982 |
} catch(IOException e) {
|
|
| 983 |
System.out.println("Error while saving "+s+": "+e.getLocalizedMessage());
|
|
| 984 |
Log.printStackTrace(e); |
|
| 985 |
} |
|
| 986 |
return null; |
|
| 987 |
} |
|
| 988 |
|
|
| 989 |
|
|
| 1089 | 990 |
/** |
| 1090 | 991 |
* Clones nodes. Creates a local node for the destination result and copy it all the source result parameters. |
| 1091 | 992 |
* @param srcResult |
| ... | ... | |
| 1097 | 998 |
try {
|
| 1098 | 999 |
String[] keys = preferences.keys(); |
| 1099 | 1000 |
for(int i = 0; i < keys.length; i++) {
|
| 1100 |
putLocal(dstResult, keys[i], preferences.get(keys[i], ""));
|
|
| 1001 |
dstResult.saveParameter(keys[i], preferences.get(keys[i], ""));
|
|
| 1101 | 1002 |
} |
| 1102 | 1003 |
} |
| 1103 | 1004 |
catch(BackingStoreException e) {
|
| tmp/org.txm.core/src/java/org/txm/core/results/Parameter.java (revision 560) | ||
|---|---|---|
| 9 | 9 |
import java.lang.annotation.Target; |
| 10 | 10 |
|
| 11 | 11 |
/** |
| 12 |
* An annotation to identify The TXMResult parameters |
|
| 12 |
* An annotation to identify The TXMResult parameters.
|
|
| 13 | 13 |
* |
| 14 | 14 |
* @author mdecorde |
| 15 | 15 |
* |
| ... | ... | |
| 18 | 18 |
@Target({FIELD,METHOD,PARAMETER})
|
| 19 | 19 |
public @interface Parameter {
|
| 20 | 20 |
|
| 21 |
// FIXME: could be used to automate saveParameters(), loadParameters(), etc. for accessing the preferences node value of a key in TXMResult class |
|
| 22 |
//public String preferenceName() default ""; |
|
| 21 | 23 |
} |
| tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 560) | ||
|---|---|---|
| 58 | 58 |
protected boolean dirty = true; |
| 59 | 59 |
|
| 60 | 60 |
/** |
| 61 |
* The result Parent. should not be null except for roots TXMResult
|
|
| 61 |
* The result parent. Should not be null except for roots TXMResult
|
|
| 62 | 62 |
*/ |
| 63 | 63 |
protected TXMResult parent; |
| 64 | 64 |
|
| ... | ... | |
| 82 | 82 |
* If set, allows the command to notify its progress. |
| 83 | 83 |
*/ |
| 84 | 84 |
protected IProgressMonitor monitor; |
| 85 |
|
|
| 85 | 86 |
/** |
| 86 |
* |
|
| 87 |
* To manage the computing cancel with TreadDeath.
|
|
| 87 | 88 |
*/ |
| 88 | 89 |
private Semaphore progressSemaphore = new Semaphore(1); |
| 89 | 90 |
|
| 90 | 91 |
/** |
| 92 |
* To keep track of the parameters used for the last computing and to determine if the result is dirty. |
|
| 93 |
*/ |
|
| 94 |
protected HashMap<String, Object> lastComputeParameters = new HashMap<String, Object>(); |
|
| 95 |
|
|
| 96 |
|
|
| 97 |
/** |
|
| 91 | 98 |
* Creates a new TXMResult, child of the specified parent. |
| 92 | 99 |
* |
| 93 | 100 |
* @param parent |
| ... | ... | |
| 119 | 126 |
this.dirty = true; |
| 120 | 127 |
} |
| 121 | 128 |
|
| 129 |
// /** |
|
| 130 |
// * Creates a new TXMResult with no parent. |
|
| 131 |
// */ |
|
| 132 |
// public TXMResult() {
|
|
| 133 |
// this(null); |
|
| 134 |
// } |
|
| 135 |
|
|
| 122 | 136 |
/** |
| 123 |
* Creates a new TXMResult with no parent.
|
|
| 137 |
* Creates and stores an UUID dedicated to persistence of this result.
|
|
| 124 | 138 |
*/ |
| 125 |
public TXMResult() {
|
|
| 126 |
this(null);
|
|
| 139 |
protected void createUUID() {
|
|
| 140 |
this.uniqueID = this.getClass().getName() + '@' + ID_TIME_FORMAT.format(new Date(System.currentTimeMillis())) + "_" + UUID.randomUUID();
|
|
| 127 | 141 |
} |
| 128 | 142 |
|
| 129 | 143 |
/** |
| 130 |
* Creates and stores an UUID dedicated to persistence for this result. |
|
| 144 |
* Checks if the result at least one child. |
|
| 145 |
* @return |
|
| 131 | 146 |
*/ |
| 132 |
protected void createUUID() {
|
|
| 133 |
this.uniqueID = this.getClass().getName() + '@' + ID_TIME_FORMAT.format(new Date(System.currentTimeMillis())) + "_" + UUID.randomUUID(); |
|
| 134 |
} |
|
| 135 |
|
|
| 136 | 147 |
public boolean hasChildren() {
|
| 137 | 148 |
return this.children.size() > 0; |
| 138 | 149 |
} |
| 139 | 150 |
|
| 140 |
protected HashMap<String, Object> lastComputeParameters = new HashMap<String, Object>(); |
|
| 151 |
/** |
|
| 152 |
* Updates the last parameters used for computing. |
|
| 153 |
* @throws Exception |
|
| 154 |
*/ |
|
| 141 | 155 |
protected void updateLastComputeParameters() throws Exception {
|
| 142 | 156 |
Field[] fields = this.getClass().getDeclaredFields(); |
| 143 | 157 |
for (Field f : fields) {
|
| 144 | 158 |
String name = f.getName(); |
| 145 | 159 |
Parameter annotations = f.getAnnotation(Parameter.class); |
| 146 |
if (annotations == null) continue; |
|
| 160 |
if (annotations == null){
|
|
| 161 |
continue; |
|
| 162 |
} |
|
| 147 | 163 |
f.setAccessible(true); |
| 148 | 164 |
lastComputeParameters.put(name, f.get(this)); |
| 149 | 165 |
} |
| 150 | 166 |
} |
| 151 |
public HashMap<String, Object> getLastComputeParameters() {
|
|
| 152 |
return lastComputeParameters; |
|
| 153 |
} |
|
| 167 |
|
|
| 154 | 168 |
/** |
| 155 |
* Update the dirty states by comparing TXMResult @Parameter with previously used parameters in the compute() method. |
|
| 169 |
* Updates the dirty states by comparing TXMResult @Parameter with previously used parameters in the compute() method.
|
|
| 156 | 170 |
* |
| 157 | 171 |
* To work correctly the equals method of the TXMResult parameters must be correctly implemented. |
| 158 | 172 |
* |
| ... | ... | |
| 170 | 184 |
Field[] fields = clazz.getDeclaredFields(); |
| 171 | 185 |
for (Field f : fields) {
|
| 172 | 186 |
String name = f.getName(); |
| 173 |
Parameter annotations = f.getAnnotation(Parameter.class); |
|
| 174 |
if (annotations == null) continue; |
|
| 187 |
Parameter annotation = f.getAnnotation(Parameter.class); |
|
| 188 |
if (annotation == null) {
|
|
| 189 |
continue; |
|
| 190 |
} |
|
| 175 | 191 |
f.setAccessible(true); // not to set accessible to test the field values |
| 176 | 192 |
Object previousValue = lastComputeParameters.get(name); |
| 177 | 193 |
Object newValue = f.get(this); |
| 178 | 194 |
updateDirty(previousValue, newValue); |
| 179 |
if (dirty) return dirty; // no need to go further |
|
| 195 |
if (dirty) {
|
|
| 196 |
return dirty; // no need to go further |
|
| 197 |
} |
|
| 180 | 198 |
} |
| 181 | 199 |
return dirty; |
| 182 | 200 |
} |
| 183 | 201 |
|
| 202 |
|
|
| 203 |
|
|
| 184 | 204 |
/** |
| 205 |
* Updates the dirty state by comparing an old parameter with a new one. |
|
| 206 |
* |
|
| 207 |
* @param previousValue may be null |
|
| 208 |
* @param newValue may be null |
|
| 209 |
*/ |
|
| 210 |
protected void updateDirty(Object previousValue, Object newValue) {
|
|
| 211 |
if (previousValue == null || !previousValue.equals(newValue)) {
|
|
| 212 |
Log.info("Setting dirty to true: old = "+ previousValue + " / new = " + newValue);
|
|
| 213 |
this.dirty = true; |
|
| 214 |
} |
|
| 215 |
} |
|
| 216 |
|
|
| 217 |
|
|
| 218 |
/** |
|
| 185 | 219 |
* Gets the dirty states. |
| 186 | 220 |
* |
| 187 | 221 |
* @return |
| ... | ... | |
| 199 | 233 |
} |
| 200 | 234 |
|
| 201 | 235 |
/** |
| 202 |
* Updates the dirty state by comparing an old parameter with a new one. |
|
| 203 |
* |
|
| 204 |
* @param oldParameter may be null |
|
| 205 |
* @param newParameter may be null |
|
| 206 |
*/ |
|
| 207 |
protected void updateDirty(Object oldParameter, Object newParameter) {
|
|
| 208 |
if (oldParameter == null || !oldParameter.equals(newParameter)) {
|
|
| 209 |
Log.info("set dirty true : old="+oldParameter+" new="+newParameter);
|
|
| 210 |
this.dirty = true; |
|
| 211 |
} |
|
| 212 |
} |
|
| 213 |
|
|
| 214 |
/** |
|
| 215 | 236 |
* Gets the preferences node qualifier of the result command. |
| 216 | 237 |
* |
| 217 | 238 |
* @return |
| ... | ... | |
| 312 | 333 |
return TXMPreferences.getString(key, this, this.preferencesNodeQualifier); |
| 313 | 334 |
} |
| 314 | 335 |
|
| 336 |
|
|
| 315 | 337 |
/** |
| 338 |
* Stores the specified parameters pairs of key/value in a local node dedicated to the specified result. The node qualifier is generated by the <code>TXMResult.getUUID</code> method. |
|
| 339 |
* @param result |
|
| 340 |
* @param key |
|
| 341 |
* @param value |
|
| 342 |
*/ |
|
| 343 |
public void saveParameter(String key, Object value) {
|
|
| 344 |
TXMPreferences.putLocal(this, key, value);; |
|
| 345 |
} |
|
| 346 |
|
|
| 347 |
|
|
| 348 |
/** |
|
| 316 | 349 |
* Copies the parameters stored in the @Parameter Java class members : the pXXXXX named members to the local preferences node. |
| 317 | 350 |
* Commands must define this method to persist their parameters. |
| 318 | 351 |
* Just returns <b>true</b> if you don't want to bother with this. |
| ... | ... | |
| 819 | 852 |
*/ |
| 820 | 853 |
public abstract boolean canCompute() throws Exception; |
| 821 | 854 |
|
| 855 |
/** |
|
| 856 |
* |
|
| 857 |
*/ |
|
| 822 | 858 |
public String getSimpleDetails() {
|
| 823 | 859 |
String mess = this.getDetails(); |
| 824 | 860 |
if (mess != null) |
| ... | ... | |
| 827 | 863 |
return this.toString(); |
| 828 | 864 |
} |
| 829 | 865 |
|
| 866 |
/** |
|
| 867 |
* |
|
| 868 |
*/ |
|
| 830 | 869 |
public void acquireSemaphore() {
|
| 831 | 870 |
try {
|
| 832 | 871 |
this.progressSemaphore.acquire(); |
| ... | ... | |
| 875 | 914 |
if (!this.isDirtyFromHistory()) {
|
| 876 | 915 |
|
| 877 | 916 |
// FIXME: Debug |
| 878 |
System.err.println("TXMResult.compute(): result parameters have not changed computing skipped.");
|
|
| 917 |
System.err.println("TXMResult.compute(): parameters have not changed since last computing, computing skipped.");
|
|
| 879 | 918 |
|
| 880 | 919 |
return true; |
| 881 | 920 |
} |
| ... | ... | |
| 888 | 927 |
return true; |
| 889 | 928 |
} |
| 890 | 929 |
|
| 891 |
if (!canCompute()) {
|
|
| 930 |
if (!this.canCompute()) {
|
|
| 892 | 931 |
// FIXME: Debug |
| 893 | 932 |
System.err.println("TXMResult.compute(): missing or wrong parameters, computing aborted.");
|
| 894 | 933 |
|
| ... | ... | |
| 902 | 941 |
// } |
| 903 | 942 |
|
| 904 | 943 |
|
| 905 |
if (!_compute(update)) {
|
|
| 944 |
if (!this._compute(update)) {
|
|
| 906 | 945 |
|
| 907 | 946 |
// FIXME: Debug |
| 908 | 947 |
System.err.println("TXMResult.compute(): computing failed.");
|
| ... | ... | |
| 910 | 949 |
return false; |
| 911 | 950 |
} |
| 912 | 951 |
|
| 913 |
updateLastComputeParameters(); // store last used parameters |
|
| 952 |
this.updateLastComputeParameters(); // store last used parameters
|
|
| 914 | 953 |
|
| 915 |
if (!saveParameters()) {
|
|
| 954 |
if (!this.saveParameters()) {
|
|
| 916 | 955 |
System.out.println("Warning: " + this.getName() + " parameters are not saved.");
|
| 917 | 956 |
} |
| 918 | 957 |
|
| tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java (revision 560) | ||
|---|---|---|
| 282 | 282 |
// info&navigation panel |
| 283 | 283 |
final Composite infosArea = this.topToolBar.installGroup("Infos", "Informations and Navigation", null, true);
|
| 284 | 284 |
|
| 285 |
Composite resultArea = this.getDisplayArea();
|
|
| 285 |
Composite resultArea = this.getResultArea();
|
|
| 286 | 286 |
|
| 287 | 287 |
// on créé une Query, ici le pivot de la concordance est "[]" |
| 288 | 288 |
// Query Area: query itself + view properties |
| tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/preferences/ChartsEnginePreferencePage.java (revision 560) | ||
|---|---|---|
| 137 | 137 |
SWTChartsComponentsProvider.setCurrrentComponentsProvider(ChartsEngine.getCurrent()); |
| 138 | 138 |
|
| 139 | 139 |
// Set the first charts engine supported export file format as default charts export file format |
| 140 |
TXMPreferences.putString(ChartsEnginePreferences.PREFERENCES_NODE, ChartsEnginePreferences.DEFAULT_EXPORT_FORMAT, ChartsEngine.getCurrent().getSupportedOutputFileFormats().get(0));
|
|
| 140 |
TXMPreferences.put(ChartsEnginePreferences.PREFERENCES_NODE, ChartsEnginePreferences.DEFAULT_EXPORT_FORMAT, ChartsEngine.getCurrent().getSupportedOutputFileFormats().get(0)); |
|
| 141 | 141 |
|
| 142 | 142 |
|
| 143 | 143 |
// Set the new monochrome color for all charts engine theme |
| tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 560) | ||
|---|---|---|
| 439 | 439 |
/** |
| 440 | 440 |
* Reloads the properties of the current selected structural unit. |
| 441 | 441 |
*/ |
| 442 |
// FIXME: mutualize this method, its used for some other editors |
|
| 442 | 443 |
private void reloadSUProperties() {
|
| 443 | 444 |
|
| 444 | 445 |
propertyCombo.removeAll(); |
| ... | ... | |
| 480 | 481 |
// System.out.println("key pressed : "+e.keyCode);
|
| 481 | 482 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
|
| 482 | 483 |
updateResultFromEditor(); |
| 483 |
compute(true);
|
|
| 484 |
compute(false);
|
|
| 484 | 485 |
} |
| 485 | 486 |
} |
| 486 | 487 |
|
| tmp/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/editors/TextsBalanceEditor.java (revision 560) | ||
|---|---|---|
| 96 | 96 |
@Override |
| 97 | 97 |
public void widgetSelected(SelectionEvent e) {
|
| 98 | 98 |
// persistence |
| 99 |
TXMPreferences.putLocalString(getResultData(), TextsBalancePreferences.STRUCTURAL_UNIT, suCombo.getText());
|
|
| 100 |
TXMPreferences.putLocalInt(getResultData(), TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY_INDEX, 0);
|
|
| 99 |
getResultData().saveParameter(TextsBalancePreferences.STRUCTURAL_UNIT, suCombo.getText());
|
|
| 100 |
getResultData().saveParameter(TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY_INDEX, 0);
|
|
| 101 | 101 |
|
| 102 | 102 |
try {
|
| 103 | 103 |
loadSUP(((TextsBalance)getResultData()).getCorpus().getStructuralUnit(suCombo.getText())); |
| ... | ... | |
| 126 | 126 |
|
| 127 | 127 |
|
| 128 | 128 |
// persistence |
| 129 |
TXMPreferences.putLocalInt(getResultData(), TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY_INDEX, supCombo.getSelectionIndex());
|
|
| 130 |
TXMPreferences.putLocalBoolean(getResultData(), TextsBalancePreferences.GROUP_BY_TEXTS, groupByTexts.getSelection());
|
|
| 129 |
getResultData().saveParameter(TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY_INDEX, supCombo.getSelectionIndex());
|
|
| 130 |
getResultData().saveParameter(TextsBalancePreferences.GROUP_BY_TEXTS, groupByTexts.getSelection());
|
|
| 131 | 131 |
getResultData().setDirty(); |
| 132 | 132 |
compute(true); |
| 133 | 133 |
} |
| tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 560) | ||
|---|---|---|
| 62 | 62 |
System.err.println("ChartResult.compute(): computing result of type " + this.getClass() + "...");
|
| 63 | 63 |
|
| 64 | 64 |
// TODO uncomment this |
| 65 |
// if (!this.isDirtyFromHistory()) {
|
|
| 66 |
// |
|
| 67 |
// // FIXME: Debug
|
|
| 68 |
// System.err.println("TXMResult.compute(): result parameters have not changed computing skipped.");
|
|
| 69 |
// |
|
| 65 |
if (!this.isDirtyFromHistory()) {
|
|
| 66 |
|
|
| 67 |
// FIXME: Debug |
|
| 68 |
System.err.println("ChartResult.compute(): result parameters have not changed computing skipped.");
|
|
| 69 |
|
|
| 70 | 70 |
// return true; |
| 71 |
// }
|
|
| 71 |
} |
|
| 72 | 72 |
|
| 73 |
if(!this.isDirty()) {
|
|
| 73 |
else if(!this.isDirty()) {
|
|
| 74 | 74 |
|
| 75 | 75 |
// FIXME: Debug |
| 76 | 76 |
System.err.println("ChartResult.compute(): result is not dirty, computing skipped.");
|
| ... | ... | |
| 100 | 100 |
return false; |
| 101 | 101 |
} |
Formats disponibles : Unified diff