Révision 174
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java (revision 174) | ||
---|---|---|
39 | 39 |
import org.txm.chartsengine.rcp.editors.ChartEditorInput; |
40 | 40 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart; |
41 | 41 |
import org.txm.chartsengine.rcp.events.EventCallBack; |
42 |
import org.txm.chartsengine.rcp.events.EventCallBackHandler; |
|
43 | 42 |
import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages; |
44 | 43 |
import org.txm.chartsengine.rcp.preferences.___KeyboardBindingProperties; |
45 | 44 |
import org.txm.chartsengine.rcp.preferences.___MouseBindingProperties; |
... | ... | |
103 | 102 |
this.mouseBindingProperties = mouseBindingProperties; |
104 | 103 |
this.keyboardBindingProperties = keyboardBindingProperties; |
105 | 104 |
|
106 |
// FIXME: chart engine plugin split tests |
|
107 |
// this.chartEditorCreators = new HashMap<Class, ChartEditorCreator>(); |
|
108 |
|
|
109 |
|
|
110 | 105 |
// FIXME : see if we need to define the L&F as system for AWT/Swing components |
111 | 106 |
// If yes, we need to find a way to manage the GTK L&F/Linux bug, see ticket #761 |
112 | 107 |
// System Look and feel |
... | ... | |
153 | 148 |
*/ |
154 | 149 |
public ChartEditorPart createChartEditor(String editorInputName, TXMResult resultData, String preferencesNode, String chartType) { |
155 | 150 |
ChartEditorInput chartEditorInput = new ChartEditorInput(this, editorInputName, resultData, preferencesNode, chartType, null); |
151 |
|
|
152 |
// create the chart from the charts engine chart creator extension |
|
156 | 153 |
this.createChart(chartEditorInput, resultData, preferencesNode, chartType); |
154 |
|
|
157 | 155 |
ChartEditorPart editor = new ChartEditorPart(this, chartEditorInput); |
158 | 156 |
return editor; |
159 | 157 |
} |
... | ... | |
167 | 165 |
* @return |
168 | 166 |
*/ |
169 | 167 |
public ChartEditorPart createChartEditor(String editorInputName, TXMResult resultData, String preferencesNode) { |
170 |
return this.createChartEditor(editorInputName, resultData, preferencesNode, resultData.getClass().getName());
|
|
168 |
return this.createChartEditor(editorInputName, resultData, preferencesNode, null);
|
|
171 | 169 |
} |
172 | 170 |
|
173 | 171 |
/** |
... | ... | |
644 | 642 |
// page.closeEditor(openedChartEditorPart, false); |
645 | 643 |
// return openedChartEditorPart; |
646 | 644 |
// } |
647 |
|
|
648 | 645 |
|
649 |
|
|
650 | 646 |
// FIXME: tests with reuseEditor() |
651 | 647 |
//openedChartEditorPart = (ChartEditorPart) page.reuseEditor(editorPart, editorPart.getEditorInput()); |
652 | 648 |
|
653 | 649 |
|
654 |
// initialize the default shared context menus as Export, etc. |
|
655 |
// initDefaultContextMenus(openedChartEditorPart.getComposite()); |
|
656 |
|
|
657 |
|
|
658 |
|
|
659 |
// // registers user entries event call back extensions |
|
660 |
// String extensionPointId = "org.txm.chartsengine.eventcallback"; //$NON-NLS-1$ |
|
661 |
// IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointId); |
|
662 |
// |
|
663 |
// for(int i = 0; i < contributions.length; i++) { |
|
664 |
// if( |
|
665 |
// ( |
|
666 |
// contributions[i].getAttribute("chartsEngineName") == null || //$NON-NLS-1$ // for callback that can be used for all charts engine implementations |
|
667 |
// contributions[i].getAttribute("chartsEngineName").equals(this.chartsEngine.getName()) //$NON-NLS-1$ |
|
668 |
// ) |
|
669 |
// && |
|
670 |
// contributions[i].getAttribute("resultDataClass") != null && |
|
671 |
// contributions[i].getAttribute("resultDataClass").equals(openedChartEditorPart.getResultData().getClass().getName()) //$NON-NLS-1$ |
|
672 |
// ) { |
|
673 |
// try { |
|
674 |
// EventCallBack eventCallBack = (EventCallBack)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$ |
|
675 |
// |
|
676 |
// eventCallBack.setChartEditor(openedChartEditorPart); |
|
677 |
// |
|
678 |
// EventCallBackHandler mouseHandler = openedChartEditorPart.getComposite().getMouseCallBackHandler(); |
|
679 |
// if(mouseHandler != null && mouseHandler.getEventCallBack(eventCallBack.getClass()) == null) { |
|
680 |
// mouseHandler.registerEventCallBack(eventCallBack); |
|
681 |
// } |
|
682 |
// EventCallBackHandler keyboardHandler = openedChartEditorPart.getComposite().getKeyCallBackHandler(); |
|
683 |
// if(keyboardHandler != null && keyboardHandler.getEventCallBack(eventCallBack.getClass()) == null) { |
|
684 |
// keyboardHandler.registerEventCallBack(eventCallBack); |
|
685 |
// } |
|
686 |
// } |
|
687 |
// catch(CoreException e) { |
|
688 |
// e.printStackTrace(); |
|
689 |
// } |
|
690 |
// break; |
|
691 |
// } |
|
692 |
// } |
|
693 |
|
|
694 | 650 |
openedChartEditorPart.forceFocus(); |
695 | 651 |
|
696 | 652 |
} |
... | ... | |
747 | 703 |
* @return |
748 | 704 |
*/ |
749 | 705 |
public ChartEditorPart openEditor(String editorInputName, TXMResult resultData, String preferencesNode) { |
750 |
return this.openEditor(editorInputName, resultData, preferencesNode, resultData.getClass().getName());
|
|
706 |
return this.openEditor(editorInputName, resultData, preferencesNode, null);
|
|
751 | 707 |
} |
752 | 708 |
|
753 | 709 |
|
... | ... | |
758 | 714 |
* @return |
759 | 715 |
*/ |
760 | 716 |
public ChartEditorPart openEditor(ChartEditorPart editorPart) { |
761 |
return this.openEditor(editorPart, editorPart.getEditorInput().getResultData().getClass().getName());
|
|
717 |
return this.openEditor(editorPart, null);
|
|
762 | 718 |
} |
763 | 719 |
|
764 | 720 |
/** |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/events/EventCallBackHandler.java (revision 174) | ||
---|---|---|
57 | 57 |
return; |
58 | 58 |
} |
59 | 59 |
} |
60 |
System.out.println("EventCallBackHandler.registerEventCallBack(): call back of type " + eventCallBack.getClass() + " registered."); |
|
61 | 60 |
this.eventCallBacks.add(eventCallBack); |
62 | 61 |
eventCallBack.setSwtChartsComponentProvider(this.swtChartsComponentProvider); |
63 | 62 |
} |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/events/EventCallBack.java (revision 174) | ||
---|---|---|
67 | 67 |
public void setChartEditor(ChartEditorPart chartEditor) { |
68 | 68 |
this.chartEditor = chartEditor; |
69 | 69 |
} |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
/** |
|
74 |
* @return the chartEditor |
|
75 |
*/ |
|
76 |
public ChartEditorPart getChartEditor() { |
|
77 |
return chartEditor; |
|
78 |
} |
|
70 | 79 |
|
71 | 80 |
|
72 | 81 |
|
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorPart.java (revision 174) | ||
---|---|---|
36 | 36 |
import org.txm.functions.TXMResult; |
37 | 37 |
import org.txm.rcp.editors.TXMEditorPart; |
38 | 38 |
import org.txm.rcpapplication.Application; |
39 |
import org.txm.utils.logger.Log; |
|
39 | 40 |
|
40 | 41 |
/** |
41 | 42 |
* Base class of all charts SWT <code>EditorPart</code> subclasses. |
... | ... | |
283 | 284 |
contributions[i].getAttribute("resultDataClass") != null //$NON-NLS-1$ |
284 | 285 |
&& contributions[i].getAttribute("resultDataClass").equals(this.getResultData().getClass().getName()) //$NON-NLS-1$ |
285 | 286 |
|
286 |
&& (contributions[i].getAttribute("chartType") == null && this.getChartType().equals(this.getResultData().getClass().getName()) //$NON-NLS-1$
|
|
287 |
&& ((contributions[i].getAttribute("chartType") == null && this.getChartType() == null
|
|
287 | 288 |
|| |
288 |
contributions[i].getAttribute("chartType") != null && contributions[i].getAttribute("chartType").equals(this.getChartType()) //$NON-NLS-1$ //$NON-NLS-2$ |
|
289 |
contributions[i].getAttribute("chartType") != null && this.getChartType() != null && contributions[i].getAttribute("chartType").equals(this.getChartType()) |
|
290 |
) //$NON-NLS-1$ |
|
289 | 291 |
) |
290 | 292 |
|
291 | 293 |
) { |
... | ... | |
296 | 298 |
|
297 | 299 |
EventCallBackHandler mouseHandler = composite.getMouseCallBackHandler(); |
298 | 300 |
if(mouseHandler != null && mouseHandler.getEventCallBack(eventCallBack.getClass()) == null) { |
301 |
|
|
302 |
Log.info("ChartEditorPart.createPartControl(): call back of type " + eventCallBack.getClass() |
|
303 |
+ " registered in mouse handler (chart editor = " + this.getClass() |
|
304 |
+ ", result data class = " + this.getResultData().getClass() |
|
305 |
+ ", chart type = " + this.getChartType() |
|
306 |
+ ")."); |
|
307 |
|
|
299 | 308 |
mouseHandler.registerEventCallBack(eventCallBack); |
300 | 309 |
} |
301 | 310 |
EventCallBackHandler keyboardHandler = composite.getKeyCallBackHandler(); |
302 | 311 |
if(keyboardHandler != null && keyboardHandler.getEventCallBack(eventCallBack.getClass()) == null) { |
312 |
|
|
313 |
Log.info("ChartEditorPart.createPartControl(): call back of type " + eventCallBack.getClass() |
|
314 |
+ " registered in key handler (chart editor = " + this.getClass() |
|
315 |
+ ", result data class = " + this.getResultData().getClass() |
|
316 |
+ ", chart type = " + this.getChartType() |
|
317 |
+ ")."); |
|
318 |
|
|
303 | 319 |
keyboardHandler.registerEventCallBack(eventCallBack); |
304 | 320 |
} |
305 | 321 |
} |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorInput.java (revision 174) | ||
---|---|---|
65 | 65 |
* @param preferencesNodeQualifier |
66 | 66 |
*/ |
67 | 67 |
public ChartEditorInput(SWTChartsComponentsProvider swtComponentsProvider, TXMResult resultData, String preferencesNodeQualifier) { |
68 |
this(swtComponentsProvider, resultData, preferencesNodeQualifier, resultData.getClass().getName());
|
|
68 |
this(swtComponentsProvider, resultData, preferencesNodeQualifier, null);
|
|
69 | 69 |
} |
70 | 70 |
|
71 | 71 |
/** |
... | ... | |
285 | 285 |
* Synchronizes the local preferences node with the result data type, chart type, etc. |
286 | 286 |
*/ |
287 | 287 |
public void syncLocalPreferencesNode() { |
288 |
//this.preferencesNodeQualifier = TXMPreferences.getId(this.resultData); |
|
289 | 288 |
// FIXME: persistence test |
290 |
TXMPreferences.putLocalString(this.resultData, ChartsEnginePreferences.CHART_TYPE, this.chartType); |
|
289 |
if(this.chartType != null) { |
|
290 |
TXMPreferences.putLocalString(this.resultData, ChartsEnginePreferences.CHART_TYPE, this.chartType); |
|
291 |
} |
|
292 |
|
|
291 | 293 |
TXMPreferences.putLocalString(this.resultData, ChartsEnginePreferences.RESULT_DATA_TYPE, this.resultData.getClass().getName()); |
292 | 294 |
} |
293 | 295 |
|
Formats disponibles : Unified diff