Révision 1457
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 1457) | ||
---|---|---|
568 | 568 |
} |
569 | 569 |
|
570 | 570 |
if(count > maxCount) { |
571 |
MessageDialog d = new MessageDialog(getShell(), TXMCoreMessages.error_error2, null, |
|
571 |
MessageDialog d = new MessageDialog(this.getShell(), TXMCoreMessages.error_error2, null,
|
|
572 | 572 |
NLS.bind(ProgressionUIMessages.error_theQueryIsAlreadyRepresentedByACurveInTheGraphic, query), 0, new String[] { TXMCoreMessages.common_ok}, 0); |
573 | 573 |
d.open(); |
574 | 574 |
return true; |
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 1457) | ||
---|---|---|
166 | 166 |
|
167 | 167 |
// compute the result if needed |
168 | 168 |
if(super.compute(monitor, deepComputing)) { |
169 |
this.altered = false; |
|
169 | 170 |
// compute the chart |
170 | 171 |
return renderChart(); |
171 | 172 |
} |
... | ... | |
228 | 229 |
// Since the stack is shared by computing and rendering parameters, this.hasParameterChanged(ChartsEnginePreferences.CHART_TYPE) returns true because the parameter doesn't exist in the last stack entry filled only with the computing parameter |
229 | 230 |
// may need to fix this in another way: |
230 | 231 |
// Solution 1: store two stacks, one for computing parameters and another for rendering parameters |
231 |
// Solution 2: stop to dissociate rendering parameters and computing parameters. Maybe the best way but need to check in this dissociation is very useless
|
|
232 |
// Solution 2: stop to dissociate rendering parameters and computing parameters. Maybe the best way but need to check if this dissociation is very useless
|
|
232 | 233 |
// clear the last computing parameters |
233 | 234 |
if(this.parametersHistory.size() > 2) { |
234 | 235 |
this.clearLastComputingParameters(); |
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/handlers/OpenJFCChartPropertiesEditor.java (revision 1457) | ||
---|---|---|
61 | 61 |
@Override |
62 | 62 |
public void run() { |
63 | 63 |
((ChartPanel) chartEditor.getComposite().getChartComponent()).doEditChartProperties(); |
64 |
chartEditor.getResult().setAltered(); |
|
64 | 65 |
|
65 | 66 |
} |
66 | 67 |
}); |
tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java (revision 1457) | ||
---|---|---|
267 | 267 |
} |
268 | 268 |
|
269 | 269 |
@Override |
270 |
public boolean isSaveOnCloseNeeded() throws Exception { |
|
271 |
return true; |
|
272 |
} |
|
273 |
|
|
274 |
@Override |
|
270 | 275 |
public void notifyDoSave() throws Exception { |
271 | 276 |
for (AnnotationArea aa : annotationAreas) { |
272 | 277 |
aa.save(); |
... | ... | |
297 | 302 |
h.add(Text.class); |
298 | 303 |
return h; |
299 | 304 |
} |
305 |
|
|
306 |
|
|
300 | 307 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/debug/TXMResultDebugView.java (revision 1457) | ||
---|---|---|
116 | 116 |
buffer.append("toString(): " + this.currentResult.toString() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
117 | 117 |
buffer.append("Details: " + this.currentResult.getDetails() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
118 | 118 |
buffer.append("Dirty: " + this.currentResult.isDirty() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
119 |
buffer.append("Altered: " + this.currentResult.isAltered() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
119 | 120 |
buffer.append("Has been computed once: " + this.currentResult.hasBeenComputedOnce() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
120 | 121 |
// if (this.currentResult instanceof ChartResult) { |
121 | 122 |
// buffer.append("Chart dirty: " + ((ChartResult)this.currentResult).isChartDirty() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
... | ... | |
134 | 135 |
buffer.append("Selected object = " + this.currentResult + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
135 | 136 |
buffer.append("Node visible = " + this.currentResult.isVisible() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
136 | 137 |
buffer.append("Node weight = " + this.currentResult.getWeight() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
137 |
buffer.append("Persistable = " + this.currentResult.isInternalPersistable() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
138 |
buffer.append("Internal persistable = " + this.currentResult.isInternalPersistable() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
138 | 139 |
buffer.append("User persistable = " + this.currentResult.isUserPersistable() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
139 | 140 |
// if (this.currentResult instanceof ChartResult) { |
140 | 141 |
// buffer.append("Chart engine = " + ((ChartResult)this.currentResult).getChartsEngine() + ", chart object = " + ((ChartResult)this.currentResult).getChart() |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/adapters/TXMResultAdapter.java (revision 1457) | ||
---|---|---|
25 | 25 |
*/ |
26 | 26 |
public abstract class TXMResultAdapter extends WorkbenchAdapter { |
27 | 27 |
|
28 |
|
|
28 | 29 |
/** |
29 |
* |
|
30 |
* Default constructor.
|
|
30 | 31 |
*/ |
31 | 32 |
public TXMResultAdapter() { |
32 | 33 |
// TODO Auto-generated constructor stub |
... | ... | |
39 | 40 |
|
40 | 41 |
@Override |
41 | 42 |
public String getLabel(Object result) { |
42 |
// FIXME: SJ: dirty tests |
|
43 | 43 |
String label = ((TXMResult) result).getCurrentName(); |
44 | 44 |
|
45 | 45 |
IEditorPart editor = SWTEditorsUtils.getEditor((TXMResult) result); |
46 |
// // also look in multipage editors |
|
47 |
// if(editor == null) { |
|
48 |
// editor = SWTEditorsUtils.getEditorInMultiPageEditor(((TXMResult) result)); |
|
49 |
// } |
|
50 |
|
|
51 | 46 |
if(editor != null && editor.isDirty()) { |
52 |
label += " *"; |
|
47 |
label += " *"; //$NON-NLS-1$
|
|
53 | 48 |
} |
54 | 49 |
|
55 |
|
|
56 |
// if(((TXMResult) result).isDirty() && ((TXMResult) result).hasBeenComputedOnce()) { |
|
57 |
// label += " *"; |
|
58 |
// } |
|
59 | 50 |
return label; |
60 | 51 |
} |
61 | 52 |
|
... | ... | |
66 | 57 |
|
67 | 58 |
@Override |
68 | 59 |
public FontData getFont(Object element) { |
69 |
// highlight the node label of the current active editor |
|
70 |
if(element instanceof TXMResult && element == BaseAbstractHandler.getActiveEditorResult(null)) { |
|
71 |
FontData fontData = Display.getCurrent().getSystemFont().getFontData()[0]; |
|
72 |
fontData.setStyle(SWT.BOLD); |
|
73 |
return fontData; |
|
60 |
|
|
61 |
FontData fontData = null; |
|
62 |
|
|
63 |
if(element instanceof TXMResult) { |
|
64 |
|
|
65 |
fontData = Display.getCurrent().getSystemFont().getFontData()[0]; |
|
66 |
|
|
67 |
// highlight the node label of the current active editor |
|
68 |
if(element == BaseAbstractHandler.getActiveEditorResult(null)) { |
|
69 |
fontData.setStyle(SWT.BOLD); |
|
70 |
} |
|
71 |
|
|
72 |
// display non-persisted result with italic font if the autosave result preference is disabled |
|
73 |
if(!TBXPreferences.getInstance().getBoolean(TBXPreferences.AUTO_PERSISTENCE_ENABLED) && !((TXMResult)element).isUserPersistable() && !((TXMResult)element).isInternalPersistable()) { |
|
74 |
fontData.setStyle(fontData.getStyle() | SWT.ITALIC); |
|
75 |
} |
|
76 |
|
|
74 | 77 |
} |
75 |
return null; |
|
78 |
|
|
79 |
return fontData; |
|
76 | 80 |
} |
77 | 81 |
|
78 | 82 |
@Override |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/ITablableEditorInput.java (revision 1457) | ||
---|---|---|
39 | 39 |
* @author sloiseau |
40 | 40 |
* |
41 | 41 |
*/ |
42 |
// FIXME: SJ: reuse this in a generic TXMTableEditor class |
|
42 | 43 |
public interface ITablableEditorInput extends IEditorInput { |
43 | 44 |
|
44 | 45 |
/** |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorExtension.java (revision 1457) | ||
---|---|---|
83 | 83 |
public abstract boolean isDirty() throws Exception; |
84 | 84 |
|
85 | 85 |
/** |
86 |
* Checks if the extension needs to save the editor on close. |
|
87 |
* @return |
|
88 |
* @throws Exception |
|
89 |
*/ |
|
90 |
public abstract boolean isSaveOnCloseNeeded() throws Exception; |
|
91 |
|
|
92 |
/** |
|
86 | 93 |
* Save something when the doSave method is called |
87 | 94 |
* @throws Exception |
88 | 95 |
*/ |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1457) | ||
---|---|---|
49 | 49 |
import org.eclipse.ui.IEditorSite; |
50 | 50 |
import org.eclipse.ui.IPartListener; |
51 | 51 |
import org.eclipse.ui.IPartListener2; |
52 |
import org.eclipse.ui.ISaveablePart2; |
|
52 | 53 |
import org.eclipse.ui.IWorkbenchPage; |
53 | 54 |
import org.eclipse.ui.IWorkbenchPart; |
54 | 55 |
import org.eclipse.ui.IWorkbenchPartReference; |
... | ... | |
95 | 96 |
* @author sjacquot |
96 | 97 |
* |
97 | 98 |
*/ |
98 |
public abstract class TXMEditor<T extends TXMResult> extends EditorPart implements TXMResultListener {
|
|
99 |
public abstract class TXMEditor<T extends TXMResult> extends EditorPart { |
|
99 | 100 |
|
100 | 101 |
/** |
101 | 102 |
* ID to use in plugin.xml to contribute to the top toolbar. |
102 | 103 |
*/ |
103 | 104 |
public final static String TOP_TOOLBAR_ID = "TXMEditorTopToolBar"; //$NON-NLS-1$ |
104 | 105 |
public final static String BOTTOM_TOOLBAR_ID = "TXMEditorBottomToolBar"; //$NON-NLS-1$ |
106 |
|
|
105 | 107 |
//FIXME: SJ: bad idea to use the ID as title, need to change the system |
106 | 108 |
public final static String COMPUTING_PARAMETERS_GROUP_ID = TXMUIMessages.parameters; |
107 | 109 |
|
... | ... | |
152 | 154 |
*/ |
153 | 155 |
protected Composite bottomToolBarContainer; |
154 | 156 |
|
157 |
/** |
|
158 |
* Computing tool item button. |
|
159 |
*/ |
|
160 |
protected ToolItem computeButton; |
|
155 | 161 |
|
156 | 162 |
/** |
157 | 163 |
* To keep track of the parameters used for the last computing and updates only the widgets if a parameter has changed. |
... | ... | |
188 | 194 |
|
189 | 195 |
|
190 | 196 |
/** |
191 |
* |
|
197 |
* Default constructor.
|
|
192 | 198 |
*/ |
193 | 199 |
public TXMEditor() { |
194 | 200 |
super(); |
... | ... | |
200 | 206 |
*/ |
201 | 207 |
public TXMEditor(TXMResult result) { |
202 | 208 |
this(); |
203 |
this.setInput(new TXMResultEditorInput<TXMResult>(result)); |
|
209 |
this.setInput(new TXMResultEditorInput<TXMResult>(result)); // FIXME: SJ: the input is defined twice, on time here and one time in init(), need to see if we still the assignation here in the constructor
|
|
204 | 210 |
} |
205 | 211 |
|
206 | 212 |
|
... | ... | |
267 | 273 |
// getResult().removeResultListener(TXMEditor.this); |
268 | 274 |
// } |
269 | 275 |
|
270 |
if (partRef.getId().equals(TXMEditor.this.getClass().getName())) { // called after this.doSave() |
|
276 |
if (partRef.getId().equals(TXMEditor.this.getClass().getName())) { // called after this.doSave() |
|
277 |
|
|
271 | 278 |
//System.out.println("EVENT partClosed"); |
272 |
for (TXMEditorExtension<T> b : extensions) {
|
|
279 |
for (TXMEditorExtension<T> extension : extensions) {
|
|
273 | 280 |
try { |
274 |
if (b.isDirty()) b.discardChanges(); |
|
281 |
if (extension.isDirty()) { |
|
282 |
extension.discardChanges(); |
|
283 |
} |
|
275 | 284 |
} catch (Exception e) { |
276 | 285 |
// TODO Auto-generated catch block |
277 | 286 |
e.printStackTrace(); |
... | ... | |
316 | 325 |
return firstLineComposite; |
317 | 326 |
} |
318 | 327 |
|
319 |
public boolean isDisposed() { |
|
320 |
return resultArea == null || resultArea.isDisposed(); |
|
321 |
} |
|
322 | 328 |
|
329 |
/** |
|
330 |
* Gets the shell of the parent composite if exists and not disposed otherwise the Display default active shell. |
|
331 |
* @return |
|
332 |
*/ |
|
323 | 333 |
public Shell getShell() { |
324 | 334 |
if (parent !=null && !parent.isDisposed()) { |
325 | 335 |
return parent.getShell(); |
... | ... | |
362 | 372 |
|
363 | 373 |
this.topToolBar = new TXMEditorToolBar(this, this.firstLineComposite, this.extendedParametersComposite, SWT.FLAT | SWT.RIGHT, TOP_TOOLBAR_ID); |
364 | 374 |
|
375 |
// store the Compute button to access if later, especially from sublcasses |
|
376 |
this.computeButton = this.topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID); |
|
365 | 377 |
|
366 | 378 |
// computing parameters components |
367 | 379 |
boolean showExtendedParameters = false; |
... | ... | |
597 | 609 |
public void setDirty(boolean dirty) { |
598 | 610 |
this.dirty = dirty; |
599 | 611 |
|
600 |
// FIXME: old version |
|
601 |
//this.result.setDirty(dirty); |
|
602 |
|
|
603 |
// ToolBarManager manager = new ToolBarManager(this.topToolBar); |
|
604 |
// IContributionItem[] items = manager.getItems(); |
|
605 |
|
|
606 |
|
|
607 | 612 |
// enable/disable the compute button according to dirty state of the editor |
608 |
ToolItem computeButton = this.topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID); //$NON-NLS-1$ |
|
609 |
if (computeButton !=null) { |
|
610 |
computeButton.setEnabled(dirty); |
|
613 |
if (this.computeButton != null && !this.computeButton.isDisposed()) { |
|
614 |
this.computeButton.setEnabled(dirty); |
|
611 | 615 |
} |
612 | 616 |
|
613 |
|
|
614 |
// for(Control c : this.topToolBar.getChildren()) { |
|
615 |
// //c.setEnabled(enabled); |
|
616 |
// System.out.println("TXMEditor.setDirty(): " + c); |
|
617 |
// } |
|
618 |
|
|
619 | 617 |
firePropertyChange(IEditorPart.PROP_DIRTY); |
620 | 618 |
CorporaView.refreshObject(this.result); |
621 | 619 |
} |
... | ... | |
625 | 623 |
|
626 | 624 |
boolean dirty = this.dirty; |
627 | 625 |
|
628 |
//boolean dirty = false; |
|
629 |
|
|
630 |
// if (this.getResult() != null) { //TODO see what to do with dirty results in TXMEditor |
|
631 |
// // if the result has never been computed, the editor is not dirty -> no * shown |
|
632 |
// //dirty = this.getResult().isDirty() && this.getResult().hasBeenComputedOnce(); |
|
633 |
// } |
|
634 |
|
|
635 |
// FIXME: SJ: tests |
|
636 |
//dirty = this.getResult().isDirty() && this.getResult().hasBeenComputedOnce(); |
|
637 |
|
|
638 |
|
|
639 |
|
|
640 |
for (TXMEditorExtension<T> b : extensions) { |
|
626 |
for (TXMEditorExtension<T> extension : this.extensions) { |
|
641 | 627 |
try { |
642 |
dirty = dirty || b.isDirty();
|
|
628 |
dirty = dirty || extension.isDirty();
|
|
643 | 629 |
} catch (Exception e) { |
644 |
// TODO Auto-generated catch block |
|
645 | 630 |
e.printStackTrace(); |
646 | 631 |
} |
647 | 632 |
} |
... | ... | |
649 | 634 |
} |
650 | 635 |
|
651 | 636 |
@Override |
637 |
public boolean isSaveOnCloseNeeded() { |
|
638 |
boolean needed = false; |
|
639 |
|
|
640 |
for (TXMEditorExtension<T> extension : this.extensions) { |
|
641 |
try { |
|
642 |
needed = needed || extension.isSaveOnCloseNeeded(); |
|
643 |
} catch (Exception e) { |
|
644 |
e.printStackTrace(); |
|
645 |
} |
|
646 |
} |
|
647 |
return needed; |
|
648 |
|
|
649 |
} |
|
650 |
|
|
651 |
|
|
652 |
|
|
653 |
@Override |
|
652 | 654 |
public void setFocus() { |
653 | 655 |
// FIXME SJ: this code leads to a bug, the focus must not be regiven to the main parameter after each computing |
654 | 656 |
// if (mainParametersComposite != null && !mainParametersComposite.isDisposed()) { |
... | ... | |
657 | 659 |
CorporaView.focus(this.getResult()); |
658 | 660 |
} |
659 | 661 |
|
662 |
|
|
660 | 663 |
@SuppressWarnings("unchecked") |
661 | 664 |
@Override |
662 | 665 |
public TXMResultEditorInput<T> getEditorInput() { |
... | ... | |
728 | 731 |
|
729 | 732 |
|
730 | 733 |
/** |
734 |
* Opens a popup to inform that the result has been manually edited. |
|
735 |
* @return |
|
736 |
*/ |
|
737 |
public boolean promptResultEditedAlert() { |
|
738 |
return MessageDialog.openQuestion(this.getShell(), "Warning", "The result have been edited. Changes will be lost. Do you want to continue?"); |
|
739 |
} |
|
740 |
|
|
741 |
/** |
|
731 | 742 |
* Synchronizes the result data from the editor data. |
732 | 743 |
*/ |
733 | 744 |
public void synchronizeResultFromEditor() { |
734 |
|
|
745 |
|
|
746 |
// subclasses manual result updating from editor fields |
|
735 | 747 |
Log.finest("TXMEditor.syncrhonizeResultFromEditor(): " + this.getClass().getSimpleName() + ": manually updating result from editor."); //$NON-NLS-1$ |
736 |
this.updateResultFromEditor(); // subclasses manual result updating from editor fields
|
|
748 |
this.updateResultFromEditor(); |
|
737 | 749 |
|
750 |
// auto updating result from Parameter annotations in result <=> editor |
|
738 | 751 |
Log.finest("TXMEditor.syncrhonizeResultFromEditor(): " + this.getClass().getSimpleName() + ": auto updating result from editor."); //$NON-NLS-1$ |
739 |
this.autoUpdateResultFromEditorParameters(); // auto updating result from Parameter annotations in result <=> editor
|
|
752 |
this.autoUpdateResultFromEditorParameters(); |
|
740 | 753 |
|
741 | 754 |
// Stores the last parameters before the computing to later auto-update the Widgets only if some parameters have changed |
742 | 755 |
this.setLastComputingParameters(this.getResult().getLastParametersFromHistory()); |
... | ... | |
768 | 781 |
|
769 | 782 |
try { |
770 | 783 |
JobsTimer.start(); |
784 |
|
|
785 |
// FIXME: SJ: tests |
|
786 |
//showBusy(true); |
|
787 |
|
|
771 | 788 |
this.syncExec(new Runnable() { |
772 | 789 |
@Override |
773 | 790 |
public void run() { |
774 | 791 |
if(update) { |
775 | 792 |
|
776 | 793 |
if (TXMEditor.this.getResult().isAltered()) { |
777 |
if (!MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Warning", "The result have been edited. Changes will be lost. Do you want to continue?")) {
|
|
794 |
if (!promptResultEditedAlert()) {
|
|
778 | 795 |
setCanceled(true); |
779 | 796 |
} |
780 | 797 |
} |
781 | 798 |
|
782 | 799 |
synchronizeResultFromEditor(); |
783 |
|
|
784 |
// // FIXME: DEbug |
|
785 |
// Log.finest("TXMEditor.compute(): " + TXMEditor.this.getClass().getSimpleName() + ": manually updating result from editor."); //$NON-NLS-1$ |
|
786 |
// updateResultFromEditor(); // subclasses manual result updating from editor fields |
|
787 |
// // FIXME: DEbug |
|
788 |
// Log.finest("TXMEditor.compute(): " + TXMEditor.this.getClass().getSimpleName() + ": auto updating result from editor."); //$NON-NLS-1$ |
|
789 |
// |
|
790 |
// autoUpdateResultFromEditorParameters(); // auto updating result from Parameter annotations in result <=> editor |
|
791 |
// |
|
792 |
// // Stores the last parameters before the computing to later auto-update the Widgets only if some parameters have changed |
|
793 |
// setLastComputingParameters(TXMEditor.this.getResult().getLastParametersFromHistory()); |
|
794 | 800 |
} |
795 | 801 |
} |
796 | 802 |
}); |
... | ... | |
817 | 823 |
@Override |
818 | 824 |
public void run() { |
819 | 825 |
try { |
820 |
/// FIXME: SJ: dirty state tests |
|
821 |
// setDirty(false); |
|
822 |
|
|
823 | 826 |
refresh(update); |
824 | 827 |
|
825 | 828 |
// focus in the main widget |
... | ... | |
1625 | 1628 |
return editors; |
1626 | 1629 |
} |
1627 | 1630 |
|
1628 |
@Override |
|
1629 |
public boolean isSaveOnCloseNeeded() { |
|
1630 |
return false; |
|
1631 |
/** |
|
1632 |
* Gets the Compute Tool item button. |
|
1633 |
* @return the computeButton |
|
1634 |
*/ |
|
1635 |
protected ToolItem getComputeButton() { |
|
1636 |
return computeButton; |
|
1631 | 1637 |
} |
1632 |
|
|
1633 | 1638 |
|
1639 |
/** |
|
1640 |
* Remove the Compute Tool item button. |
|
1641 |
*/ |
|
1642 |
protected void removeComputeButton() { |
|
1643 |
if (this.computeButton != null && !this.computeButton.isDisposed()) { |
|
1644 |
this.computeButton.dispose(); |
|
1645 |
} |
|
1646 |
} |
|
1634 | 1647 |
|
1635 | 1648 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TableLinesViewerComparator.java (revision 1457) | ||
---|---|---|
4 | 4 |
package org.txm.rcp.editors; |
5 | 5 |
|
6 | 6 |
import java.text.Collator; |
7 |
import java.util.Date; |
|
7 | 8 |
import java.util.List; |
8 | 9 |
|
9 | 10 |
import org.eclipse.jface.viewers.TableViewer; |
... | ... | |
16 | 17 |
import org.eclipse.swt.widgets.TableColumn; |
17 | 18 |
|
18 | 19 |
/** |
19 |
* Base abstract viewer comparator for table lines sorting.
|
|
20 |
* Generic base viewer comparator for table lines sorting.
|
|
20 | 21 |
* This comparator tries to determine the primitive type of the objects and compare according to it. |
21 | 22 |
* The method compare() is dedicated to be override by subclasses if more granularity is needed. |
22 | 23 |
* Subclasses can for example sort using the column index that is stored each time a sort is done. |
... | ... | |
97 | 98 |
else if (Boolean.class.isInstance(cell1)) { |
98 | 99 |
result = ((Boolean)cell1).compareTo(((Boolean)cell2)); |
99 | 100 |
} |
101 |
else if (Date.class.isInstance(cell1)) { |
|
102 |
result = ((Date)cell1).compareTo(((Date)cell2)); |
|
103 |
} |
|
100 | 104 |
} |
101 | 105 |
|
102 | 106 |
// reverse if needed |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/EigenvaluesChartEditor.java (revision 1457) | ||
---|---|---|
26 | 26 |
|
27 | 27 |
@Override |
28 | 28 |
public void __createPartControl() { |
29 |
// nothing to do |
|
29 |
// remove the compute button |
|
30 |
this.removeComputeButton(); |
|
30 | 31 |
} |
31 | 32 |
|
32 | 33 |
@Override |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/ColsRowsInfosEditor.java (revision 1457) | ||
---|---|---|
65 | 65 |
import org.txm.rcp.editors.input.AbstractTablableEditorInput; |
66 | 66 |
import org.txm.rcp.messages.TXMUIMessages; |
67 | 67 |
import org.txm.rcp.swt.GLComposite; |
68 |
// TODO: Auto-generated Javadoc |
|
68 |
|
|
69 | 69 |
/** |
70 | 70 |
* Used to display rows and cols informations such as contribution, inertia, |
71 |
* mass, coord... @ author mdecorde
|
|
71 |
* mass, coord... |
|
72 | 72 |
* |
73 |
* @author mdecorde |
|
74 |
* |
|
73 | 75 |
*/ |
74 | 76 |
public abstract class ColsRowsInfosEditor extends TXMEditor { |
75 | 77 |
|
76 |
/** The ID. */ |
|
77 |
static public String ID = "org.txm.rcp.editors.ca.ColsrowsInfosEditor"; //$NON-NLS-1$ |
|
78 |
|
|
79 |
/** The viewer. */ |
|
78 |
/** |
|
79 |
* The viewer. |
|
80 |
*/ |
|
80 | 81 |
private TableViewer viewer; |
81 | 82 |
|
82 | 83 |
|
... | ... | |
92 | 93 |
@Override |
93 | 94 |
public void _createPartControl() { |
94 | 95 |
|
95 |
CA ca = (CA) this.getResult(); |
|
96 |
// remove the compute button |
|
97 |
this.removeComputeButton(); |
|
96 | 98 |
|
97 | 99 |
GLComposite resultArea = this.getResultArea(); |
98 | 100 |
|
... | ... | |
155 | 157 |
// Register the context menu |
156 | 158 |
TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer); |
157 | 159 |
|
158 |
// createContextMenu(viewer); |
|
159 |
|
|
160 |
|
|
161 |
|
|
162 | 160 |
} |
163 | 161 |
|
164 |
// /** |
|
165 |
// * Creates the context menu. |
|
166 |
// * |
|
167 |
// * @param tableViewer the table viewer |
|
168 |
// */ |
|
169 |
// private void createContextMenu(TableViewer tableViewer) { |
|
170 |
// |
|
171 |
// MenuManager menuManager = new MenuManager(); |
|
172 |
// Menu menu = menuManager.createContextMenu(tableViewer.getTable()); |
|
173 |
// |
|
174 |
// // Set the MenuManager |
|
175 |
// tableViewer.getTable().setMenu(menu); |
|
176 |
// getSite().registerContextMenu(menuManager, tableViewer); |
|
177 |
// // Make the selection available |
|
178 |
// getSite().setSelectionProvider(tableViewer); |
|
179 |
// } |
|
180 | 162 |
|
181 | 163 |
/** |
182 | 164 |
* Gets the data to give to the viewer. |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/EigenvaluesTableEditor.java (revision 1457) | ||
---|---|---|
50 | 50 |
import org.txm.rcp.editors.TableKeyListener; |
51 | 51 |
import org.txm.rcp.editors.TableLinesViewerComparator; |
52 | 52 |
import org.txm.rcp.swt.GLComposite; |
53 |
// TODO: Auto-generated Javadoc |
|
53 |
|
|
54 |
|
|
54 | 55 |
/** |
55 |
* show the singular values and compute some stats.
|
|
56 |
* Displays the singular values and computes some stats.
|
|
56 | 57 |
* |
57 | 58 |
* @author mdecorde |
59 |
* @author sjacquot |
|
58 | 60 |
*/ |
59 | 61 |
public class EigenvaluesTableEditor extends TXMEditor<CA> { |
60 | 62 |
|
61 | 63 |
|
62 |
|
|
63 |
/** The ID. */ |
|
64 |
static public String ID = "org.txm.rcp.editors.TableEditor"; //$NON-NLS-1$ |
|
65 |
|
|
66 | 64 |
/** The viewer. */ |
67 | 65 |
private TableViewer viewer; |
68 | 66 |
|
69 |
/** The table input. */ |
|
70 |
//private ITablableEditorInput tableInput; |
|
71 | 67 |
|
72 |
/** The columns. */ |
|
73 |
List<TableViewerColumn> columns = new ArrayList<TableViewerColumn>(); |
|
74 |
|
|
75 |
/** The table sorter. */ |
|
76 |
// private TableSorter tableSorter; |
|
77 |
|
|
78 |
|
|
79 |
|
|
80 | 68 |
/** |
81 | 69 |
* |
82 | 70 |
* @param result |
... | ... | |
89 | 77 |
@Override |
90 | 78 |
public void _createPartControl() throws Exception { |
91 | 79 |
|
92 |
//this.parent.setLayout(new FillLayout()); |
|
93 |
|
|
94 |
//tableInput = (ITablableEditorInput) this.getEditorInput(); |
|
95 |
|
|
80 |
// remove the compute button |
|
81 |
this.removeComputeButton(); |
|
82 |
|
|
96 | 83 |
GLComposite resultArea = this.getResultArea(); |
97 | 84 |
|
98 | 85 |
viewer = new TableViewer(resultArea, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); |
... | ... | |
110 | 97 |
CAUIMessages.eigenvalue, |
111 | 98 |
"%", CAUIMessages.CorrespondanceAnalysisEditorInput_11, "", ""}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$; |
112 | 99 |
|
113 |
|
|
100 |
|
|
114 | 101 |
for (int i = 0; i < titles.length; i++) { |
115 |
final int index = i; |
|
116 | 102 |
final TableViewerColumn column; |
117 | 103 |
|
118 | 104 |
int alignment = SWT.RIGHT; |
... | ... | |
127 | 113 |
column.getColumn().setWidth(100); |
128 | 114 |
column.getColumn().setResizable(true); |
129 | 115 |
column.getColumn().setMoveable(true); |
130 |
columns.add(column); |
|
131 |
|
|
132 |
// column.getColumn().addSelectionListener(new SelectionAdapter() { |
|
133 |
// @Override |
|
134 |
// public void widgetSelected(SelectionEvent e) { |
|
135 |
// StatusLine.setMessage(TXMUIMessages.sortingColumn); |
|
136 |
// tableSorter.setColumn(index); |
|
137 |
// int dir = viewer.getTable().getSortDirection(); |
|
138 |
// if (viewer.getTable().getSortColumn() == column.getColumn()) { |
|
139 |
// dir = dir == SWT.UP ? SWT.DOWN : SWT.UP; |
|
140 |
// } else { |
|
141 |
// dir = SWT.DOWN; |
|
142 |
// } |
|
143 |
// viewer.getTable().setSortDirection(dir); |
|
144 |
// viewer.getTable().setSortColumn(column.getColumn()); |
|
145 |
// viewer.refresh(); |
|
146 |
// StatusLine.setMessage(TXMUIMessages.sortDone); |
|
147 |
// } |
|
148 |
// }); |
|
149 | 116 |
} |
150 | 117 |
|
151 | 118 |
|
... | ... | |
186 | 153 |
viewer.setComparator(viewerComparator); |
187 | 154 |
viewerComparator.addSelectionAdapters(viewer); |
188 | 155 |
|
189 |
|
|
190 |
// tableSorter = new TableSorter(); |
|
191 |
// |
|
192 |
// tableSorter.setColumnTypes(new String[] { |
|
193 |
// TXMUIMessages.integer, |
|
194 |
// CAEditor.COL_TYPE, |
|
195 |
// CAEditor.COL_TYPE, |
|
196 |
// CAEditor.COL_TYPE, |
|
197 |
// CAEditor.COL_TYPE, |
|
198 |
// CAEditor.SEPARATOR}); |
|
199 |
// |
|
200 |
// |
|
201 |
// viewer.setSorter(tableSorter); |
|
202 |
|
|
203 |
// tableSorter.setColumn(0); |
|
204 |
// int dir = viewer.getTable().getSortDirection(); |
|
205 |
// if (viewer.getTable().getSortColumn() == columns.get(0).getColumn()) { |
|
206 |
// dir = dir == SWT.UP ? SWT.DOWN : SWT.UP; |
|
207 |
// } else { |
|
208 |
// dir = SWT.DOWN; |
|
209 |
// } |
|
210 |
// viewer.getTable().setSortDirection(dir); |
|
211 |
// viewer.getTable().setSortColumn(columns.get(0).getColumn()); |
|
212 |
|
|
213 |
|
|
214 | 156 |
// Register the context menu |
215 | 157 |
TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer); |
216 |
|
|
217 |
// createContextMenu(viewer); |
|
218 |
|
|
219 |
|
|
220 | 158 |
|
221 | 159 |
} |
222 | 160 |
|
... | ... | |
243 | 181 |
|
244 | 182 |
this.viewer.refresh(); |
245 | 183 |
|
246 |
// Pack the columns |
|
247 |
//TXMEditor.packColumns(viewer); |
|
248 |
|
|
249 | 184 |
} |
250 | 185 |
|
251 | 186 |
|
... | ... | |
258 | 193 |
|
259 | 194 |
@Override |
260 | 195 |
public void updateResultFromEditor() { |
261 |
// TODO Auto-generated method stub |
|
262 |
|
|
196 |
// nothing to do |
|
263 | 197 |
} |
264 | 198 |
|
265 | 199 |
|
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/IndexExtension.java (revision 1457) | ||
---|---|---|
77 | 77 |
return h; |
78 | 78 |
} |
79 | 79 |
|
80 |
@Override |
|
81 |
public boolean isSaveOnCloseNeeded() throws Exception { |
|
82 |
return true; |
|
83 |
} |
|
84 |
|
|
80 | 85 |
} |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1457) | ||
---|---|---|
521 | 521 |
lastParameters.put(name, f.get(this)); |
522 | 522 |
} |
523 | 523 |
|
524 |
if(!appendToLastParameters) { |
|
524 |
if(!appendToLastParameters && !lastParameters.isEmpty()) {
|
|
525 | 525 |
this.parametersHistory.add(lastParameters); |
526 | 526 |
} |
527 | 527 |
|
... | ... | |
2107 | 2107 |
this.dirty = false; // the computing was successful, the result is no more dirty |
2108 | 2108 |
this.hasBeenComputedOnce = true; |
2109 | 2109 |
|
2110 |
if (altered) { |
|
2111 |
System.out.println(NLS.bind("Warning {0} modifications have been lost.", this.getSimpleName()));
|
|
2110 |
if (this.altered) {
|
|
2111 |
Log.finest(NLS.bind("TXMResult.compute(): Warning {0} modifications have been lost.", this.getSimpleName()));
|
|
2112 | 2112 |
} |
2113 | 2113 |
this.altered = false; |
2114 | 2114 |
|
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/editors/PartitionDimensionsEditor.java (revision 1457) | ||
---|---|---|
32 | 32 |
@Override |
33 | 33 |
public void __createPartControl() { |
34 | 34 |
|
35 |
// remove the compute button |
|
36 |
this.removeComputeButton(); |
|
37 |
|
|
35 | 38 |
// extend the tool bar |
36 | 39 |
new ToolItem(this.getToolBar(), SWT.SEPARATOR); |
37 | 40 |
this.sortByPartSize = new ToolItem(this.getToolBar(), SWT.CHECK); |
Formats disponibles : Unified diff