Révision 1444
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 1444) | ||
---|---|---|
26 | 26 |
import org.txm.chartsengine.rcp.swt.AdvancedChartEditorToolBar; |
27 | 27 |
import org.txm.chartsengine.rcp.swt.ChartComposite; |
28 | 28 |
import org.txm.chartsengine.rcp.swt.ChartEditorToolBar; |
29 |
import org.txm.core.messages.TXMCoreMessages; |
|
29 | 30 |
import org.txm.rcp.editors.TXMEditor; |
30 | 31 |
import org.txm.rcp.editors.TXMMultiPageEditor; |
31 | 32 |
import org.txm.utils.logger.Log; |
... | ... | |
248 | 249 |
boolean needInit = (this.chartComposite.getChartComponent() == null) && (this.getResult().getChart() != null); |
249 | 250 |
|
250 | 251 |
// loading chart |
251 |
this.getResult().subTask("Loading chart."); //$NON-NLS-1$
|
|
252 |
this.getResult().subTask(TXMCoreMessages.bind("Loading chart of type {0}.", this.getResult().getResultype())); //$NON-NLS-1$
|
|
252 | 253 |
this.loadChart(); |
253 | 254 |
|
254 | 255 |
|
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAFactorialMapChartEditor.java (revision 1444) | ||
---|---|---|
103 | 103 |
GLComposite mainParametersArea = this.getMainParametersComposite(); |
104 | 104 |
|
105 | 105 |
try { |
106 |
// parent parameters
|
|
106 |
// display lexical table parameters if it is not visible
|
|
107 | 107 |
if (!this.getResult().getParent().isVisible()) { |
108 | 108 |
mainParametersArea.getLayout().numColumns = 2; |
109 | 109 |
|
110 | 110 |
// unit property |
111 | 111 |
new Label(mainParametersArea, SWT.NONE).setText(TXMCoreMessages.common_property); |
112 |
this.unitPropertyComboViewer = new PropertiesComboViewer(mainParametersArea, this, true,
|
|
112 |
this.unitPropertyComboViewer = new PropertiesComboViewer(mainParametersArea, this, false,
|
|
113 | 113 |
CQPCorpus.getFirstParentCorpus(this.getResult()).getOrderedProperties(), |
114 | 114 |
this.getResult().getUnitProperty(), false); |
115 | 115 |
} |
... | ... | |
232 | 232 |
getResult().setNeedsToResetView(resetView); |
233 | 233 |
compute(true); |
234 | 234 |
// synchronize the part names |
235 |
((CAEditor)getParentMultiPagesEditor()).setName(getResult().getName()); |
|
235 |
// FIXME: became useless? |
|
236 |
//((CAEditor)getParentMultiPagesEditor()).setPartName(getResult().getName()); |
|
236 | 237 |
forceFocus(); |
237 | 238 |
} |
238 | 239 |
|
... | ... | |
246 | 247 |
// parent parameters |
247 | 248 |
// thresholds |
248 | 249 |
if (!this.getResult().isParentVisible()) { |
249 |
ThresholdsGroup thresholdsGroup = new ThresholdsGroup(this.getExtendedParametersGroup(), SWT.NONE, this, true, false);
|
|
250 |
ThresholdsGroup thresholdsGroup = new ThresholdsGroup(this.getExtendedParametersGroup(), SWT.NONE, this, false, false);
|
|
250 | 251 |
this.fMinSpinner = thresholdsGroup.getFMinSpinner(); |
251 | 252 |
this.vMaxSpinner = thresholdsGroup.getVMaxSpinner(); |
252 | 253 |
this.vMaxSpinner.setMinimum(1); |
... | ... | |
257 | 258 |
@Override |
258 | 259 |
public void updateEditorFromChart(boolean update) { |
259 | 260 |
|
261 |
// update the parent multipart editor partname |
|
262 |
this.parentMultiPagesEditor.setPartName(this.getResult().getName()); |
|
263 |
|
|
260 | 264 |
// Updating complementary editors |
261 | 265 |
try { |
262 |
// singular values
|
|
266 |
// eigenvalues table
|
|
263 | 267 |
((TXMEditor)this.parentMultiPagesEditor.getEditors().get(1)).refresh(update); |
264 |
// cols and rows |
|
268 |
// cols and rows tables
|
|
265 | 269 |
((ColsRowsInfosEditor)this.parentMultiPagesEditor.getEditors().get(2)).refresh(update); |
266 | 270 |
((ColsRowsInfosEditor)this.parentMultiPagesEditor.getEditors().get(3)).refresh(update); |
267 |
// eigenvalues |
|
271 |
// eigenvalues chart
|
|
268 | 272 |
((EigenvaluesChartEditor)this.parentMultiPagesEditor.getEditors().get(4)).refresh(update); |
269 | 273 |
} |
270 | 274 |
catch (Exception e) { |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/ColsRowsInfosEditor.java (revision 1444) | ||
---|---|---|
191 | 191 |
public abstract String[] getTableTitles(); |
192 | 192 |
|
193 | 193 |
|
194 |
@Override |
|
195 |
public void updateEditorFromResult(boolean update) throws Exception { |
|
196 |
|
|
197 |
this.viewer.setInput(this.getTableInput()); |
|
198 |
|
|
199 |
// Pack the columns |
|
200 |
TXMEditor.packColumns(this.viewer); |
|
201 |
|
|
202 |
} |
|
203 |
|
|
204 |
|
|
205 | 194 |
/** |
206 | 195 |
* Gets the ordered labels according to the current table sort. |
207 | 196 |
* @return |
... | ... | |
234 | 223 |
} |
235 | 224 |
|
236 | 225 |
|
237 |
|
|
238 |
|
|
239 | 226 |
@Override |
240 | 227 |
public void updateResultFromEditor() { |
241 | 228 |
// TODO Auto-generated method stub |
... | ... | |
243 | 230 |
} |
244 | 231 |
|
245 | 232 |
|
233 |
@Override |
|
234 |
public void updateEditorFromResult(boolean update) throws Exception { |
|
246 | 235 |
|
236 |
this.viewer.setInput(this.getTableInput()); |
|
237 |
|
|
238 |
// Pack the columns |
|
239 |
TXMEditor.packColumns(this.viewer); |
|
240 |
|
|
241 |
} |
|
242 |
|
|
243 |
|
|
244 |
|
|
247 | 245 |
} |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditor.java (revision 1444) | ||
---|---|---|
83 | 83 |
*/ |
84 | 84 |
private CA ca; |
85 | 85 |
|
86 |
/** |
|
87 |
* The main editor is the editor on the left area and that is always visible (not tabbed). |
|
88 |
*/ |
|
89 |
protected EditorPart mainEditor; |
|
90 |
|
|
91 |
|
|
92 | 86 |
//public static String SEPARATOR = "SEPARATOR"; //$NON-NLS-1$ |
93 | 87 |
public static String SEPARATOR = ""; //$NON-NLS-1$ |
94 | 88 |
|
95 | 89 |
public static String COL_TYPE = "Double"; //$NON-NLS-1$ |
96 | 90 |
|
97 |
/** The names. */ |
|
98 |
private List<String> names = Arrays.asList(new String[] { |
|
99 |
CAUIMessages.factPlan, |
|
100 |
CAUIMessages.eigenvalues, |
|
101 |
CAUIMessages.rowsInfos, |
|
102 |
CAUIMessages.colsInfos, |
|
103 |
CAUIMessages.eigenvaluesHistogram }); |
|
104 | 91 |
|
105 | 92 |
|
106 | 93 |
/* (non-Javadoc) |
... | ... | |
108 | 95 |
*/ |
109 | 96 |
@Override |
110 | 97 |
protected void createPages() { |
98 |
|
|
99 |
|
|
100 |
/** The names. */ |
|
101 |
this.names = Arrays.asList(new String[] {CAUIMessages.factPlan, CAUIMessages.eigenvalues, CAUIMessages.rowsInfos, CAUIMessages.colsInfos, CAUIMessages.eigenvaluesHistogram }); |
|
102 |
|
|
103 |
|
|
111 | 104 |
Composite container = this.getContainer(); |
112 | 105 |
final Composite parentContainer = container.getParent(); |
113 | 106 |
|
... | ... | |
196 | 189 |
|
197 | 190 |
// add the other editors |
198 | 191 |
for (int i = 1; i < editors.size(); i++) { |
199 |
int editorIndex = 0; |
|
200 |
editorIndex = this.addPage(editors.get(i), inputs.get(i)); |
|
201 |
setPageText(editorIndex, names.get(i)); |
|
192 |
int editorIndex = this.addPage(editors.get(i), inputs.get(i)); |
|
193 |
this.setPageText(editorIndex, this.names.get(i)); |
|
202 | 194 |
} |
203 | 195 |
|
204 |
|
|
196 |
// to force the creation of the chart component and then add some listeners to it |
|
197 |
// FIXME: this code may be moved in CaFactorialMapChartEditor class |
|
205 | 198 |
caFactorialMapEditorPart.refresh(false); |
206 | 199 |
|
207 | 200 |
// Axis unit square ratio constraint |
... | ... | |
310 | 303 |
public void initCAFactorialMapEditor() { |
311 | 304 |
|
312 | 305 |
// Editor part |
313 |
ChartEditor caFactorialMapEditorPart = new CAFactorialMapChartEditor(new ChartEditorInput<CA>(ca)); |
|
306 |
ChartEditor caFactorialMapEditorPart = new CAFactorialMapChartEditor(new ChartEditorInput<CA>(this.ca));
|
|
314 | 307 |
//caFactorialMapEditorPart.compute(false); |
315 | 308 |
editors.add(caFactorialMapEditorPart); |
316 | 309 |
|
... | ... | |
395 | 388 |
|
396 | 389 |
/** |
397 | 390 |
* Gets the rows information editor. |
398 |
* @return |
|
391 |
* @return the rows information editor
|
|
399 | 392 |
*/ |
400 | 393 |
public ColsRowsInfosEditor getRowsInfosEditor() { |
401 | 394 |
return (ColsRowsInfosEditor) this.editors.get(2); |
... | ... | |
403 | 396 |
|
404 | 397 |
/** |
405 | 398 |
* Gets the columns information editor. |
406 |
* @return |
|
399 |
* @return the columns information editor
|
|
407 | 400 |
*/ |
408 | 401 |
public ColsRowsInfosEditor getColsInfosEditor() { |
409 | 402 |
return (ColsRowsInfosEditor) this.editors.get(3); |
410 | 403 |
} |
411 | 404 |
|
412 | 405 |
/** |
413 |
* Gets the chart factorial map chart editor.
|
|
414 |
* @return |
|
406 |
* Gets the factorial map chart editor. |
|
407 |
* @return the factorial map chart editor
|
|
415 | 408 |
*/ |
416 | 409 |
public ChartEditor getChartEditor() { |
417 | 410 |
return (ChartEditor) this.editors.get(0); |
... | ... | |
426 | 419 |
// editors.get(4).setFocus(); |
427 | 420 |
} |
428 | 421 |
|
429 |
@Override |
|
430 |
public boolean usingParent(TXMResult parent) { |
|
431 |
if (ca != null && ca.getParent() != null) |
|
432 |
return ca.getParent().getName().equals(parent.getName()); |
|
433 |
return false; |
|
434 |
} |
|
422 |
// @Override |
|
423 |
// public boolean usingParent(TXMResult parent) { |
|
424 |
// if (ca != null && ca.getParent() != null) |
|
425 |
// return ca.getParent().getName().equals(parent.getName()); |
|
426 |
// return false; |
|
427 |
// } |
|
428 |
// |
|
429 |
// |
|
430 |
// |
|
431 |
// @Override |
|
432 |
// public TXMResult getResultData() { |
|
433 |
// return ca; |
|
434 |
// } |
|
435 |
// |
|
436 |
// |
|
437 |
// @Override |
|
438 |
// public void refresh() { |
|
439 |
// System.out.println("ca.refresh() not implemented."); //$NON-NLS-1$ |
|
440 |
// } |
|
441 |
// |
|
442 |
// |
|
443 |
// @Override |
|
444 |
// public void synchronize() { |
|
445 |
// System.out.println("ca.synchronize() not implemented."); //$NON-NLS-1$ |
|
446 |
// } |
|
447 |
// |
|
448 |
// @Override |
|
449 |
// public boolean deleteResult() { |
|
450 |
// return ca.delete(); |
|
451 |
// } |
|
452 |
// |
|
453 |
// @Override |
|
454 |
// public void close(boolean deleteResult) { |
|
455 |
// ((ChartEditor)editors.get(0)).close(deleteResult); |
|
456 |
// } |
|
435 | 457 |
|
436 |
@Override |
|
437 |
public EditorPart getMainEditorPart() { |
|
438 |
return this.mainEditor; |
|
439 |
} |
|
440 |
|
|
441 |
@Override |
|
442 |
public TXMResult getResultData() { |
|
443 |
return ca; |
|
444 |
} |
|
445 |
|
|
446 |
|
|
447 |
@Override |
|
448 |
public void refresh() { |
|
449 |
System.out.println("ca.refresh() not implemented."); //$NON-NLS-1$ |
|
450 |
} |
|
451 |
|
|
452 |
|
|
453 |
@Override |
|
454 |
public void synchronize() { |
|
455 |
System.out.println("ca.synchronize() not implemented."); //$NON-NLS-1$ |
|
456 |
} |
|
457 |
|
|
458 |
@Override |
|
459 |
public boolean deleteResult() { |
|
460 |
return ca.delete(); |
|
461 |
} |
|
462 |
|
|
463 |
@Override |
|
464 |
public void close(boolean deleteResult) { |
|
465 |
((ChartEditor)editors.get(0)).close(deleteResult); |
|
466 |
} |
|
467 |
|
|
468 |
|
|
469 |
|
|
470 |
|
|
471 |
@Override |
|
472 |
public void setName(String partName) { |
|
473 |
this.setPartName(partName); |
|
474 |
} |
|
475 | 458 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/adapters/TXMResultAdapter.java (revision 1444) | ||
---|---|---|
43 | 43 |
String label = ((TXMResult) result).getCurrentName(); |
44 | 44 |
|
45 | 45 |
IEditorPart editor = SWTEditorsUtils.getEditor((TXMResult) result); |
46 |
|
|
46 |
// // also look in multipage editors |
|
47 |
// if(editor == null) { |
|
48 |
// editor = SWTEditorsUtils.getEditorInMultiPageEditor(((TXMResult) result)); |
|
49 |
// } |
|
50 |
|
|
47 | 51 |
if(editor != null && editor.isDirty()) { |
48 | 52 |
label += " *"; |
49 | 53 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/SWTEditorsUtils.java (revision 1444) | ||
---|---|---|
3 | 3 |
*/ |
4 | 4 |
package org.txm.rcp.utils; |
5 | 5 |
|
6 |
import java.util.ArrayList; |
|
7 |
|
|
6 | 8 |
import org.eclipse.e4.ui.model.application.ui.MUIElement; |
7 | 9 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
8 | 10 |
import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement; |
... | ... | |
18 | 20 |
import org.eclipse.ui.PlatformUI; |
19 | 21 |
import org.eclipse.ui.part.EditorPart; |
20 | 22 |
import org.txm.core.results.TXMResult; |
23 |
import org.txm.rcp.editors.TXMEditor; |
|
24 |
import org.txm.rcp.editors.TXMMultiPageEditor; |
|
21 | 25 |
import org.txm.rcp.editors.TXMResultEditorInput; |
22 | 26 |
|
23 | 27 |
/** |
... | ... | |
32 | 36 |
|
33 | 37 |
/** |
34 | 38 |
* Gets an editor for the specified result if its opened. |
35 |
* @param result |
|
39 |
* @param result the result used by the editor to find
|
|
36 | 40 |
* @return the editor if its opened otherwise null |
37 | 41 |
*/ |
38 | 42 |
public static IEditorPart getEditor(TXMResult result) { |
39 | 43 |
|
40 | 44 |
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); |
41 | 45 |
IWorkbenchPage page = window.getActivePage(); |
42 |
// IEditorReference[] editorsReferences = page.findEditors(editorInput, editorId, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); |
|
43 |
// if(editorsReferences.length > 0) { |
|
44 |
// return editorsReferences[0].getEditor(false); |
|
45 |
// } |
|
46 |
// return null; |
|
47 |
|
|
46 |
|
|
48 | 47 |
return page.findEditor(new TXMResultEditorInput<TXMResult>(result)); |
49 | 48 |
} |
50 | 49 |
|
50 |
|
|
51 |
public static ArrayList<TXMEditor> getEditors(TXMResult result) { |
|
52 |
|
|
53 |
ArrayList<TXMEditor> editors = new ArrayList<TXMEditor>(); |
|
54 |
|
|
55 |
for (IEditorReference reference : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences()) { |
|
56 |
IEditorPart tmpEditor = reference.getEditor(false); |
|
57 |
|
|
58 |
if(tmpEditor instanceof TXMEditor && ((TXMEditor)tmpEditor).getResult() == result) { |
|
59 |
editors.add((TXMEditor) tmpEditor); |
|
60 |
} |
|
61 |
else if(tmpEditor instanceof TXMMultiPageEditor) { |
|
62 |
TXMMultiPageEditor txmMultipageEditor = ((TXMMultiPageEditor)tmpEditor); |
|
63 |
for (int i = 0; i < txmMultipageEditor.getEditors().size(); i++) { |
|
64 |
if(txmMultipageEditor.getEditors().get(i) instanceof TXMEditor) { |
|
65 |
TXMEditor txmEditor = ((TXMEditor)txmMultipageEditor.getEditors().get(i)); |
|
66 |
if(txmEditor.getResult() == result) { |
|
67 |
editors.add(txmEditor); |
|
68 |
} |
|
69 |
} |
|
70 |
} |
|
71 |
|
|
72 |
} |
|
73 |
} |
|
74 |
|
|
75 |
return editors; |
|
76 |
|
|
77 |
} |
|
78 |
|
|
79 |
// // FIXME: SJ: seems useless since page.findEditor() seem to return the multipage editor if a nested editor exists? |
|
80 |
// /*** |
|
81 |
// * Gets an editor for the specified result if its opened inside a TXMMultiPageEditor. |
|
82 |
// * @param result the result used by the editor to find |
|
83 |
// * @return the editor if its opened otherwise null |
|
84 |
// */ |
|
85 |
// public static IEditorPart getEditorInMultiPageEditor(TXMResult result) { |
|
86 |
// |
|
87 |
// IEditorPart editor = null; |
|
88 |
// |
|
89 |
// for (IEditorReference reference : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences()) { |
|
90 |
// IEditorPart tmpEditor = reference.getEditor(false); |
|
91 |
// |
|
92 |
// if(tmpEditor instanceof TXMMultiPageEditor) { |
|
93 |
// TXMMultiPageEditor txmMultipageEditor = ((TXMMultiPageEditor)tmpEditor); |
|
94 |
// for (int i = 0; i < txmMultipageEditor.getEditors().size(); i++) { |
|
95 |
// if(txmMultipageEditor.getEditors().get(i) instanceof TXMEditor) { |
|
96 |
// TXMEditor txmEditor = ((TXMEditor)txmMultipageEditor.getEditors().get(i)); |
|
97 |
// if(txmEditor.getResult() == result) { |
|
98 |
// editor = txmEditor; |
|
99 |
// break; |
|
100 |
// } |
|
101 |
// } |
|
102 |
// } |
|
103 |
// |
|
104 |
// } |
|
105 |
// } |
|
106 |
// |
|
107 |
// return editor; |
|
108 |
// } |
|
109 |
|
|
51 | 110 |
/** |
52 | 111 |
* Checks if the editor specified by its editor input is already open in the active page. |
53 | 112 |
* @param editorInput |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/ITXMPartEditor.java (revision 1444) | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import org.txm.core.results.TXMResult; |
4 | 4 |
|
5 |
// FIXME: SJ: no more in use, need to check if its really needed then update it to match the new TXMEditor methods or wipe this class |
|
6 |
@Deprecated |
|
5 | 7 |
public interface ITXMPartEditor { |
6 | 8 |
|
7 | 9 |
public boolean isDirty(); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1444) | ||
---|---|---|
56 | 56 |
import org.eclipse.ui.IWorkbenchWindow; |
57 | 57 |
import org.eclipse.ui.PartInitException; |
58 | 58 |
import org.eclipse.ui.PlatformUI; |
59 |
import org.eclipse.ui.internal.browser.SWTUtil; |
|
59 | 60 |
import org.eclipse.ui.menus.IMenuService; |
60 | 61 |
import org.eclipse.ui.part.EditorPart; |
61 | 62 |
import org.txm.core.messages.TXMCoreMessages; |
... | ... | |
730 | 731 |
* Synchronizes the result data from the editor data. |
731 | 732 |
*/ |
732 | 733 |
public void synchronizeResultFromEditor() { |
733 |
// FIXME: DEbug |
|
734 |
|
|
734 | 735 |
Log.finest("TXMEditor.syncrhonizeResultFromEditor(): " + this.getClass().getSimpleName() + ": manually updating result from editor."); //$NON-NLS-1$ |
735 | 736 |
this.updateResultFromEditor(); // subclasses manual result updating from editor fields |
736 |
// FIXME: DEbug |
|
737 |
Log.finest("TXMEditor.syncrhonizeResultFromEditor(): " + this.getClass().getSimpleName() + ": auto updating result from editor."); //$NON-NLS-1$ |
|
738 | 737 |
|
738 |
Log.finest("TXMEditor.syncrhonizeResultFromEditor(): " + this.getClass().getSimpleName() + ": auto updating result from editor."); //$NON-NLS-1$ |
|
739 | 739 |
this.autoUpdateResultFromEditorParameters(); // auto updating result from Parameter annotations in result <=> editor |
740 | 740 |
|
741 | 741 |
// Stores the last parameters before the computing to later auto-update the Widgets only if some parameters have changed |
... | ... | |
907 | 907 |
* @throws Exception |
908 | 908 |
*/ |
909 | 909 |
public final void refresh(boolean update) throws Exception { |
910 |
if (!createPartControlDoneSucessfully) return; // no refresh |
|
910 |
|
|
911 |
if (!createPartControlDoneSucessfully) { |
|
912 |
return; // no refresh |
|
913 |
} |
|
911 | 914 |
notifyExtensions("notifyStartOfRefresh"); //$NON-NLS-1$ |
912 | 915 |
|
913 | 916 |
TXMResult result = this.getResult(); |
914 | 917 |
|
915 |
// FIXME: debug test to not draw while updating the widgets |
|
916 | 918 |
this.getContainer().setRedraw(false); |
917 | 919 |
|
918 | 920 |
this.setPartName(result.getName()); |
919 |
this.firePropertyChange(TXMEditor.PROP_DIRTY); |
|
921 |
//this.firePropertyChange(TXMEditor.PROP_DIRTY);
|
|
920 | 922 |
|
921 | 923 |
//MD commented 'if (!update) {...}' |
922 | 924 |
// SJ need to check all works, it also was dedicated to not refresh the Editor from result after a computing, it's not needed since the computing has been done |
923 | 925 |
// from fields themselves |
924 | 926 |
//if (!update) { |
925 | 927 |
// FIXME: debug |
926 |
Log.finest("TXMEditor.refresh(): auto updating editor from result."); //$NON-NLS-1$ |
|
928 |
Log.finest("TXMEditor.refresh(): " + this.getClass().getSimpleName() + ": auto updating editor from result."); //$NON-NLS-1$
|
|
927 | 929 |
this.autoUpdateEditorFieldsFromResult(update); // auto update from Parameter annotations |
928 | 930 |
|
929 | 931 |
// FIXME: debug |
930 |
Log.finest("TXMEditor.refresh(): updating subclass editor (" + getClass().getSimpleName() + ") from result."); //$NON-NLS-1$ //$NON-NLS-2$
|
|
932 |
Log.finest("TXMEditor.refresh(): " + this.getClass().getSimpleName() + ": updating subclass editor from result."); //$NON-NLS-1$ //$NON-NLS-2$
|
|
931 | 933 |
this.updateEditorFromResult(update); // subclasses manual settings |
932 | 934 |
//} |
933 | 935 |
|
... | ... | |
943 | 945 |
CorporaView.refreshObject(this); |
944 | 946 |
TXMResultDebugView.refreshView(); |
945 | 947 |
|
946 |
// FIXME: debug test to not draw while updating the widgets |
|
947 | 948 |
this.getContainer().setRedraw(true); |
948 | 949 |
|
949 |
/// FIXME: SJ: dirty state tests |
|
950 | 950 |
this.setDirty(false); |
951 | 951 |
|
952 | 952 |
|
953 |
// FIXME: update all open editors of the children result |
|
954 |
// FIXME: prob here is that updateEditorFromResult() doesn't enough because the compute() method does some other stuff |
|
955 |
// so the cascade computing may be done here rather than in TXMResult.compute() or we need to move some stuff from TXMEditor.compute() to |
|
956 |
// TXMEditor.updateEditorFromResult(), eg. the chart loading |
|
957 |
// WARNING: At This moment, with this code, TXMResult.compute() of the children is called twice |
|
958 |
for (IEditorReference reference : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences()) { |
|
959 |
IEditorPart editor = reference.getEditor(false); |
|
953 |
// FIXME: update all open editors of the children result but also of the result itself |
|
954 |
// FIXME: debug |
|
955 |
Log.finest("TXMEditor.refresh(): " + this.getClass().getSimpleName() + ": synchronizing and refreshing editors that share this editor result but also result children editors."); //$NON-NLS-1$ //$NON-NLS-2$ |
|
960 | 956 |
|
961 |
// TXMEditor |
|
962 |
if(editor != null && editor instanceof TXMEditor && editor != this) { |
|
963 |
TXMEditor txmEditor = ((TXMEditor)editor); |
|
964 |
if(this.getResult().isChild(txmEditor.getResult())) { |
|
957 |
List<TXMResult> results = this.getResult().getDeepChildren(); |
|
958 |
//results.add(this.getResult()); |
|
965 | 959 |
|
966 |
|
|
967 |
|
|
968 |
// Log.finest("TXMEditor.refresh(): updating editor for result: " + txmEditor.getResult().getSimpleName()); |
|
969 |
// Log.finest("TXMEditor.refresh(): " + txmEditor.getClass().getSimpleName() + ": manually updating result from editor."); //$NON-NLS-1$ |
|
970 |
// txmEditor.updateResultFromEditor(); // subclasses manual result updating from editor fields |
|
971 |
// // FIXME: DEbug |
|
972 |
// Log.finest("TXMEditor.refresh(): " + txmEditor.getClass().getSimpleName() + ": auto updating result from editor."); //$NON-NLS-1$ |
|
973 |
// txmEditor.autoUpdateResultFromEditorParameters(); // auto updating result from Parameter annotations in result <=> editor |
|
974 |
|
|
960 |
|
|
961 |
for (int i = 0; i < results.size(); i++) { |
|
962 |
ArrayList<TXMEditor> editors = SWTEditorsUtils.getEditors(results.get(i)) ; |
|
963 |
for (int j = 0; j < editors.size(); j++) { |
|
964 |
TXMEditor txmEditor = editors.get(j); |
|
965 |
if(txmEditor != this |
|
966 |
//&& txmEditor.isDirty() |
|
967 |
) { |
|
975 | 968 |
txmEditor.synchronizeResultFromEditor(); |
976 |
|
|
977 |
//txmEditor.compute(false); |
|
978 |
//txmEditor.updateEditorFromResult(true); |
|
979 | 969 |
txmEditor.refresh(true); |
980 | 970 |
} |
981 | 971 |
} |
982 |
// TXMMultiPageEditor |
|
983 |
else if(editor != null && editor instanceof TXMMultiPageEditor && editor != this) { |
|
984 |
TXMMultiPageEditor txmMultipageEditor = ((TXMMultiPageEditor)editor); |
|
985 |
for (int i = 0; i < txmMultipageEditor.getEditors().size(); i++) { |
|
986 |
if(txmMultipageEditor.getEditors().get(i) instanceof TXMEditor && txmMultipageEditor.getEditors().get(i) != this) { |
|
987 |
TXMEditor txmEditor = ((TXMEditor)txmMultipageEditor.getEditors().get(i)); |
|
988 |
if(this.getResult().isChild(txmEditor.getResult())) { |
|
989 |
// Log.finest("TXMEditor.refresh(): updating editor for result: " + txmEditor.getResult().getSimpleName()); |
|
990 |
// Log.finest("TXMEditor.refresh(): " + txmEditor.getClass().getSimpleName() + ": manually updating result from editor."); //$NON-NLS-1$ |
|
991 |
// txmEditor.updateResultFromEditor(); // subclasses manual result updating from editor fields |
|
992 |
// // FIXME: DEbug |
|
993 |
// Log.finest("TXMEditor.refresh(): " + txmEditor.getClass().getSimpleName() + ": auto updating result from editor."); //$NON-NLS-1$ |
|
994 |
// txmEditor.autoUpdateResultFromEditorParameters(); // auto updating result from Parameter annotations in result <=> editor |
|
995 |
// //txmEditor.compute(false); |
|
996 |
// //txmEditor.updateEditorFromResult(true); |
|
997 |
|
|
998 |
txmEditor.synchronizeResultFromEditor(); |
|
999 |
|
|
1000 |
txmEditor.refresh(true); |
|
1001 |
} |
|
1002 |
} |
|
1003 |
} |
|
1004 |
|
|
1005 |
} |
|
1006 | 972 |
} |
1007 |
|
|
973 |
|
|
1008 | 974 |
notifyExtensions("notifyEndOfRefresh"); //$NON-NLS-1$ |
1009 | 975 |
} |
1010 | 976 |
|
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMMultiPageEditor.java (revision 1444) | ||
---|---|---|
27 | 27 |
// |
28 | 28 |
package org.txm.rcp.editors; |
29 | 29 |
|
30 |
import java.util.Iterator; |
|
30 | 31 |
import java.util.List; |
31 | 32 |
|
32 | 33 |
import org.eclipse.core.runtime.IProgressMonitor; |
33 |
import org.eclipse.osgi.util.NLS; |
|
34 | 34 |
import org.eclipse.ui.IEditorInput; |
35 |
import org.eclipse.ui.PartInitException;
|
|
35 |
import org.eclipse.ui.IEditorPart;
|
|
36 | 36 |
import org.eclipse.ui.part.EditorPart; |
37 | 37 |
import org.eclipse.ui.part.MultiPageEditorPart; |
38 | 38 |
import org.txm.rcp.editors.input.IProvidingMultiPageEditorInput; |
39 |
import org.txm.rcp.messages.TXMUIMessages; |
|
40 | 39 |
|
41 | 40 |
/** |
42 | 41 |
* A GenericMultiPageEditor is a MultiPageEditor whose content and behavior is |
... | ... | |
46 | 45 |
*/ |
47 | 46 |
//FIXME: the editors should not be retrieve from the editor input that should not itself store or create some UI components |
48 | 47 |
@Deprecated |
49 |
public abstract class TXMMultiPageEditor extends MultiPageEditorPart implements ITXMPartEditor {
|
|
48 |
public abstract class TXMMultiPageEditor extends MultiPageEditorPart { |
|
50 | 49 |
|
51 | 50 |
/** The Constant ID. */ |
52 | 51 |
public static final String ID = "org.txm.rcp.editors.GenericMultiPageEditor"; //$NON-NLS-1$ |
... | ... | |
63 | 62 |
/** The names. */ |
64 | 63 |
protected List<String> names; |
65 | 64 |
|
65 |
/** |
|
66 |
* A main editor can be defined and accessed if needed. |
|
67 |
*/ |
|
68 |
protected EditorPart mainEditor; |
|
69 |
|
|
66 | 70 |
// |
67 | 71 |
// |
68 | 72 |
// /* (non-Javadoc) |
... | ... | |
142 | 146 |
*/ |
143 | 147 |
@Override |
144 | 148 |
public void dispose() { |
149 |
// FIXME: SJ: useless? the parent method should already do that, need to test furthermore |
|
145 | 150 |
for (int i = 0; i < editors.size(); i++) { |
146 | 151 |
editors.get(i).dispose(); |
147 | 152 |
} |
... | ... | |
163 | 168 |
public List<EditorPart> getEditors() { |
164 | 169 |
return editors; |
165 | 170 |
} |
171 |
|
|
172 |
|
|
173 |
@Override |
|
174 |
public boolean isDirty() { |
|
175 |
// return true if one of the editors is dirty |
|
176 |
for (Iterator i = this.editors.iterator(); i.hasNext();) { |
|
177 |
IEditorPart editor = (IEditorPart) i.next(); |
|
178 |
if (editor.isDirty()) { |
|
179 |
return true; |
|
180 |
} |
|
181 |
} |
|
182 |
return super.isDirty(); |
|
183 |
} |
|
184 |
|
|
185 |
|
|
186 |
/** |
|
187 |
* Gets the main editor if defined otherwise null. |
|
188 |
* @return the main editor if defined otherwise null |
|
189 |
*/ |
|
190 |
public EditorPart getMainEditorPart() { |
|
191 |
return this.mainEditor; |
|
192 |
} |
|
193 |
|
|
194 |
|
|
195 |
/** |
|
196 |
* Sets the part name. |
|
197 |
*/ |
|
198 |
public void setPartName(String partName) { |
|
199 |
super.setPartName(partName); |
|
200 |
} |
|
201 |
|
|
166 | 202 |
} |
Formats disponibles : Unified diff