108 |
108 |
* ID defined in plugin.xml for the compute button contribution.
|
109 |
109 |
*/
|
110 |
110 |
public final static String TOP_TOOLBAR_COMPUTE_BUTTON_ID = "compute"; //$NON-NLS-1$
|
111 |
|
|
112 |
|
|
|
111 |
|
|
112 |
|
113 |
113 |
/**
|
114 |
114 |
* The editor main tool bar, positioned at the top of the editor.
|
115 |
115 |
*/
|
... | ... | |
174 |
174 |
* Linked editors.
|
175 |
175 |
*/
|
176 |
176 |
protected ArrayList<EditorPart> linkedEditors = null;
|
177 |
|
|
|
177 |
|
178 |
178 |
/**
|
179 |
179 |
* debug purpose variable -> easier to fetch information that the getResult() method
|
180 |
180 |
*/
|
181 |
181 |
private T result;
|
182 |
|
|
|
182 |
|
183 |
183 |
/**
|
184 |
184 |
* To store or edit the dirty state of the editor from widget.
|
185 |
185 |
*/
|
186 |
186 |
protected boolean dirty;
|
187 |
187 |
|
188 |
|
|
|
188 |
|
189 |
189 |
/**
|
190 |
190 |
*
|
191 |
191 |
*/
|
192 |
192 |
public TXMEditor() {
|
193 |
193 |
super();
|
194 |
194 |
}
|
195 |
|
|
|
195 |
|
196 |
196 |
/**
|
197 |
197 |
* Creates an editor and an editor input containing the specified result.
|
198 |
198 |
* @param result
|
... | ... | |
201 |
201 |
this();
|
202 |
202 |
this.setInput(new TXMResultEditorInput<TXMResult>(result));
|
203 |
203 |
}
|
204 |
|
|
205 |
|
|
|
204 |
|
|
205 |
|
206 |
206 |
@Override
|
207 |
207 |
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
|
208 |
208 |
this.setSite(site);
|
209 |
209 |
this.setInput(input);
|
210 |
210 |
this.result = this.getEditorInput().getResult(); // store result for debug purpose
|
211 |
|
// this.result.addResultListener(this);
|
|
211 |
// this.result.addResultListener(this);
|
212 |
212 |
// FIXME: see how to use the Adapters and AdapterFactory to define image and title of Editor in the contributing plug-ins
|
213 |
213 |
// another way is to use editors extension in plug-ins and redefine icon and name, using this solution the problem is that the name (which is also editor title) can not be dynamic according to the result data
|
214 |
214 |
// so it seems better to use Adapters if it's possible or keep this solution below
|
... | ... | |
218 |
218 |
this.initExtensions();
|
219 |
219 |
}
|
220 |
220 |
|
221 |
|
|
|
221 |
|
222 |
222 |
/**
|
223 |
223 |
* Initializes plug-ins extensions.
|
224 |
224 |
*/
|
225 |
225 |
public void initExtensions() {
|
226 |
|
|
|
226 |
|
227 |
227 |
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TXMEditorExtension.EXTENSION_ID);
|
228 |
|
Log.finest("Installing TXMEditorExtension..."); //$NON-NLS-1$
|
229 |
|
Log.finest(Arrays.toString(config));
|
|
228 |
if (config.length > 0) {
|
230 |
229 |
|
231 |
|
for (IConfigurationElement e : config) {
|
232 |
|
try {
|
233 |
|
Log.finest(" "+e.getName()+" from "+e.getContributor().getName()); //$NON-NLS-1$ //$NON-NLS-2$
|
234 |
|
final Object o = e.createExecutableExtension("class"); //$NON-NLS-1$
|
235 |
|
if (o instanceof TXMEditorExtension) {
|
236 |
|
ISafeRunnable runnable = new ISafeRunnable() {
|
|
230 |
for (IConfigurationElement e : config) {
|
|
231 |
try {
|
|
232 |
//Log.finest(" "+e.getName()+" from "+e.getContributor().getName()); //$NON-NLS-1$ //$NON-NLS-2$
|
|
233 |
final Object o = e.createExecutableExtension("class"); //$NON-NLS-1$
|
|
234 |
if (o instanceof TXMEditorExtension) {
|
|
235 |
ISafeRunnable runnable = new ISafeRunnable() {
|
237 |
236 |
|
238 |
|
@Override
|
239 |
|
public void handleException(Throwable exception) {
|
240 |
|
Log.severe("Error while installing: "+o+": "+ exception.getLocalizedMessage()); //$NON-NLS-1$ //$NON-NLS-2$
|
241 |
|
}
|
|
237 |
@Override
|
|
238 |
public void handleException(Throwable exception) {
|
|
239 |
Log.severe("Error while installing: "+o+": "+ exception.getLocalizedMessage()); //$NON-NLS-1$ //$NON-NLS-2$
|
|
240 |
}
|
242 |
241 |
|
243 |
|
@Override
|
244 |
|
public void run() throws Exception {
|
245 |
|
@SuppressWarnings("unchecked")
|
246 |
|
TXMEditorExtension<T> ext = ((TXMEditorExtension<T>) o);
|
247 |
|
ext.setEditor(TXMEditor.this);
|
248 |
|
extensions.add(ext);
|
249 |
|
}
|
250 |
|
};
|
251 |
|
SafeRunner.run(runnable);
|
|
242 |
@Override
|
|
243 |
public void run() throws Exception {
|
|
244 |
@SuppressWarnings("unchecked")
|
|
245 |
TXMEditorExtension<T> ext = ((TXMEditorExtension<T>) o);
|
|
246 |
if (ext.getTXMResultValidClasses()== null || ext.getTXMResultValidClasses().contains(getResult().getClass())) {
|
|
247 |
Log.finest("Installing TXMEditorExtension: "+ext.getName()); //$NON-NLS-1$
|
|
248 |
ext.setEditor(TXMEditor.this);
|
|
249 |
extensions.add(ext);
|
|
250 |
}
|
|
251 |
}
|
|
252 |
};
|
|
253 |
SafeRunner.run(runnable);
|
|
254 |
}
|
|
255 |
} catch (Exception ex) {
|
|
256 |
Log.severe("Exception while installing " + e.getName() + ": " + ex.getLocalizedMessage()); //$NON-NLS-1$ //$NON-NLS-2$
|
252 |
257 |
}
|
253 |
|
} catch (Exception ex) {
|
254 |
|
Log.severe("Exception while installing " + e.getName() + ": " + ex.getLocalizedMessage()); //$NON-NLS-1$ //$NON-NLS-2$
|
255 |
258 |
}
|
256 |
259 |
}
|
257 |
260 |
|
258 |
261 |
IPartListener2 pl = new IPartListener2() {
|
259 |
262 |
// ... Other methods
|
260 |
263 |
public void partClosed(IWorkbenchPartReference partRef) {
|
261 |
|
|
262 |
|
// if (getResult() != null) {
|
263 |
|
// getResult().removeResultListener(TXMEditor.this);
|
264 |
|
// }
|
265 |
|
|
|
264 |
|
|
265 |
// if (getResult() != null) {
|
|
266 |
// getResult().removeResultListener(TXMEditor.this);
|
|
267 |
// }
|
|
268 |
|
266 |
269 |
if (partRef.getId().equals(TXMEditor.this.getClass().getName())) { // called after this.doSave()
|
267 |
270 |
//System.out.println("EVENT partClosed");
|
268 |
271 |
for (TXMEditorExtension<T> b : extensions) {
|
... | ... | |
303 |
306 |
};
|
304 |
307 |
this.getEditorSite().getPage().addPartListener(pl);
|
305 |
308 |
}
|
306 |
|
|
|
309 |
|
307 |
310 |
/**
|
308 |
311 |
* the composite containing the main parameters, the top toolbar and eventually other top toolbars
|
309 |
312 |
* @return
|
... | ... | |
311 |
314 |
public GLComposite getFirstLineComposite() {
|
312 |
315 |
return firstLineComposite;
|
313 |
316 |
}
|
314 |
|
|
|
317 |
|
315 |
318 |
public boolean isDisposed() {
|
316 |
319 |
return resultArea == null || resultArea.isDisposed();
|
317 |
320 |
}
|
... | ... | |
402 |
405 |
if (this.bottomToolBar.getItems().length == 0) {
|
403 |
406 |
this.bottomToolBar.dispose();
|
404 |
407 |
}
|
405 |
|
|
|
408 |
|
406 |
409 |
// remove empty toolbar
|
407 |
410 |
//TODO SJ: Hack? MD: yeah -> need to find a way to not display the bottom toolbar on Windows instead
|
408 |
411 |
if (this.topToolBar.getItems().length == 0) {
|
... | ... | |
414 |
417 |
this.topToolBar.unInstallGroup(COMPUTING_PARAMETERS_GROUP_ID);
|
415 |
418 |
}
|
416 |
419 |
|
417 |
|
|
|
420 |
|
418 |
421 |
// disable the compute button, it will be re-enable or not later when the UI will check if the editor is dirty or not
|
419 |
422 |
ToolItem computeButton = this.topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID);
|
420 |
423 |
if (computeButton != null) {
|
421 |
424 |
computeButton.setEnabled(false);
|
422 |
425 |
}
|
423 |
|
|
|
426 |
|
424 |
427 |
} catch(Throwable e) {
|
425 |
428 |
Log.severe(TXMCoreMessages.bind("TXMEditor.createPartControl(): can not create the editor for result {0}.", this.getResult())); //$NON-NLS-1$
|
426 |
429 |
e.printStackTrace();
|
... | ... | |
559 |
562 |
/// FIXME: SJ: dirty state tests
|
560 |
563 |
if (parent != null && !parent.isDisposed()) {
|
561 |
564 |
parent.getDisplay().asyncExec(new Runnable() {
|
562 |
|
|
|
565 |
|
563 |
566 |
@Override
|
564 |
567 |
public void run() {
|
565 |
568 |
compute(true);
|
... | ... | |
567 |
570 |
}
|
568 |
571 |
});
|
569 |
572 |
}
|
570 |
|
|
|
573 |
|
571 |
574 |
notifyExtensions("notifyDoSave"); //$NON-NLS-1$
|
572 |
575 |
firePropertyChange(IEditorPart.PROP_DIRTY);
|
573 |
576 |
}
|
... | ... | |
592 |
595 |
*/
|
593 |
596 |
public void setDirty(boolean dirty) {
|
594 |
597 |
this.dirty = dirty;
|
595 |
|
|
|
598 |
|
596 |
599 |
// FIXME: old version
|
597 |
600 |
//this.result.setDirty(dirty);
|
598 |
|
|
599 |
|
// ToolBarManager manager = new ToolBarManager(this.topToolBar);
|
600 |
|
// IContributionItem[] items = manager.getItems();
|
601 |
601 |
|
602 |
|
|
|
602 |
// ToolBarManager manager = new ToolBarManager(this.topToolBar);
|
|
603 |
// IContributionItem[] items = manager.getItems();
|
|
604 |
|
|
605 |
|
603 |
606 |
// enable/disable the compute button according to dirty state of the editor
|
604 |
607 |
ToolItem computeButton = this.topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID); //$NON-NLS-1$
|
605 |
608 |
if (computeButton !=null) {
|
606 |
609 |
computeButton.setEnabled(dirty);
|
607 |
610 |
}
|
608 |
|
|
609 |
|
|
610 |
|
// for(Control c : this.topToolBar.getChildren()) {
|
611 |
|
// //c.setEnabled(enabled);
|
612 |
|
// System.out.println("TXMEditor.setDirty(): " + c);
|
613 |
|
// }
|
614 |
|
|
615 |
|
firePropertyChange(IEditorPart.PROP_DIRTY);
|
616 |
|
CorporaView.refreshObject(this.result);
|
617 |
|
}
|
618 |
|
|
|
611 |
|
|
612 |
|
|
613 |
// for(Control c : this.topToolBar.getChildren()) {
|
|
614 |
// //c.setEnabled(enabled);
|
|
615 |
// System.out.println("TXMEditor.setDirty(): " + c);
|
|
616 |
// }
|
|
617 |
|
|
618 |
firePropertyChange(IEditorPart.PROP_DIRTY);
|
|
619 |
CorporaView.refreshObject(this.result);
|
|
620 |
}
|
|
621 |
|
619 |
622 |
@Override
|
620 |
623 |
public boolean isDirty() {
|
621 |
624 |
|
622 |
625 |
boolean dirty = this.dirty;
|
623 |
|
|
|
626 |
|
624 |
627 |
//boolean dirty = false;
|
625 |
628 |
|
626 |
629 |
// if (this.getResult() != null) { //TODO see what to do with dirty results in TXMEditor
|
... | ... | |
630 |
633 |
|
631 |
634 |
// FIXME: SJ: tests
|
632 |
635 |
//dirty = this.getResult().isDirty() && this.getResult().hasBeenComputedOnce();
|
633 |
|
|
634 |
|
|
635 |
636 |
|
|
637 |
|
|
638 |
|
636 |
639 |
for (TXMEditorExtension<T> b : extensions) {
|
637 |
640 |
try {
|
638 |
641 |
dirty = dirty || b.isDirty();
|
... | ... | |
647 |
650 |
@Override
|
648 |
651 |
public void setFocus() {
|
649 |
652 |
// FIXME SJ: this code leads to a bug, the focus must not be regiven to the main parameter after each computing
|
650 |
|
// if (mainParametersComposite != null && !mainParametersComposite.isDisposed()) {
|
651 |
|
// mainParametersComposite.setFocus();
|
652 |
|
// }
|
|
653 |
// if (mainParametersComposite != null && !mainParametersComposite.isDisposed()) {
|
|
654 |
// mainParametersComposite.setFocus();
|
|
655 |
// }
|
653 |
656 |
CorporaView.focus(this.getResult());
|
654 |
657 |
}
|
655 |
658 |
|
... | ... | |
732 |
735 |
this.updateResultFromEditor(); // subclasses manual result updating from editor fields
|
733 |
736 |
// FIXME: DEbug
|
734 |
737 |
Log.finest("TXMEditor.syncrhonizeResultFromEditor(): " + this.getClass().getSimpleName() + ": auto updating result from editor."); //$NON-NLS-1$
|
735 |
|
|
|
738 |
|
736 |
739 |
this.autoUpdateResultFromEditorParameters(); // auto updating result from Parameter annotations in result <=> editor
|
737 |
740 |
|
738 |
741 |
// Stores the last parameters before the computing to later auto-update the Widgets only if some parameters have changed
|
739 |
742 |
this.setLastComputingParameters(this.getResult().getLastParametersFromHistory());
|
740 |
743 |
|
741 |
744 |
}
|
742 |
|
|
|
745 |
|
743 |
746 |
/**
|
744 |
747 |
* Computes the TXMResult if all necessary parameters are set then refreshes the editor UI.
|
745 |
748 |
* Also loads and savesd some parameters from result to Widgets fields and from Widgets fields to result.
|
... | ... | |
755 |
758 |
|
756 |
759 |
StatusLine.setMessage(TXMCoreMessages.bind(TXMUIMessages.computing, this.getResult().getName()));
|
757 |
760 |
|
758 |
|
|
|
761 |
|
759 |
762 |
JobHandler job = new JobHandler(TXMCoreMessages.bind(TXMUIMessages.computing, this.getResult().getName())) {
|
760 |
763 |
|
761 |
764 |
@Override
|
... | ... | |
769 |
772 |
@Override
|
770 |
773 |
public void run() {
|
771 |
774 |
if(update) {
|
772 |
|
|
|
775 |
|
773 |
776 |
if (TXMEditor.this.getResult().isAltered()) {
|
774 |
777 |
if (!MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Warning", "The result have been edited. Changes will be lost. Do you want to continue?")) {
|
775 |
778 |
setCanceled(true);
|
776 |
779 |
}
|
777 |
780 |
}
|
778 |
|
|
|
781 |
|
779 |
782 |
synchronizeResultFromEditor();
|
780 |
|
|
781 |
|
// // FIXME: DEbug
|
782 |
|
// Log.finest("TXMEditor.compute(): " + TXMEditor.this.getClass().getSimpleName() + ": manually updating result from editor."); //$NON-NLS-1$
|
783 |
|
// updateResultFromEditor(); // subclasses manual result updating from editor fields
|
784 |
|
// // FIXME: DEbug
|
785 |
|
// Log.finest("TXMEditor.compute(): " + TXMEditor.this.getClass().getSimpleName() + ": auto updating result from editor."); //$NON-NLS-1$
|
786 |
|
//
|
787 |
|
// autoUpdateResultFromEditorParameters(); // auto updating result from Parameter annotations in result <=> editor
|
788 |
|
//
|
789 |
|
// // Stores the last parameters before the computing to later auto-update the Widgets only if some parameters have changed
|
790 |
|
// setLastComputingParameters(TXMEditor.this.getResult().getLastParametersFromHistory());
|
|
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());
|
791 |
794 |
}
|
792 |
795 |
}
|
793 |
796 |
});
|
... | ... | |
795 |
798 |
if (this.isCanceled()) {
|
796 |
799 |
return Status.CANCEL_STATUS;
|
797 |
800 |
}
|
798 |
|
|
|
801 |
|
799 |
802 |
// computing result
|
800 |
803 |
monitor.beginTask(TXMUIMessages.computing_3, 100);
|
801 |
804 |
|
802 |
805 |
notifyExtensions("notifyStartOfCompute"); //$NON-NLS-1$
|
803 |
|
|
|
806 |
|
804 |
807 |
if (!TXMEditor.this.getResult().compute(monitor)) {
|
805 |
808 |
Log.finest("TXMEditor.compute(): " + TXMEditor.this.getClass().getSimpleName() + ": computing failed.");
|
806 |
809 |
}
|
... | ... | |
815 |
818 |
public void run() {
|
816 |
819 |
try {
|
817 |
820 |
/// FIXME: SJ: dirty state tests
|
818 |
|
// setDirty(false);
|
819 |
|
|
|
821 |
// setDirty(false);
|
|
822 |
|
820 |
823 |
refresh(update);
|
821 |
|
|
|
824 |
|
822 |
825 |
// focus in the main widget
|
823 |
826 |
setFocus();
|
824 |
827 |
|
... | ... | |
942 |
945 |
|
943 |
946 |
// FIXME: debug test to not draw while updating the widgets
|
944 |
947 |
this.getContainer().setRedraw(true);
|
945 |
|
|
|
948 |
|
946 |
949 |
/// FIXME: SJ: dirty state tests
|
947 |
950 |
this.setDirty(false);
|
948 |
951 |
|
949 |
|
|
|
952 |
|
950 |
953 |
// FIXME: update all open editors of the children result
|
951 |
954 |
// FIXME: prob here is that updateEditorFromResult() doesn't enough because the compute() method does some other stuff
|
952 |
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
|
953 |
956 |
// TXMEditor.updateEditorFromResult(), eg. the chart loading
|
954 |
957 |
// WARNING: At This moment, with this code, TXMResult.compute() of the children is called twice
|
955 |
|
for (IEditorReference reference : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences()) {
|
956 |
|
IEditorPart editor = reference.getEditor(false);
|
|
958 |
for (IEditorReference reference : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences()) {
|
|
959 |
IEditorPart editor = reference.getEditor(false);
|
957 |
960 |
|
958 |
|
// TXMEditor
|
959 |
|
if(editor != null && editor instanceof TXMEditor && editor != this) {
|
960 |
|
TXMEditor txmEditor = ((TXMEditor)editor);
|
961 |
|
if(this.getResult().isChild(txmEditor.getResult())) {
|
962 |
|
|
963 |
|
|
964 |
|
|
965 |
|
// Log.finest("TXMEditor.refresh(): updating editor for result: " + txmEditor.getResult().getSimpleName());
|
966 |
|
// Log.finest("TXMEditor.refresh(): " + txmEditor.getClass().getSimpleName() + ": manually updating result from editor."); //$NON-NLS-1$
|
967 |
|
// txmEditor.updateResultFromEditor(); // subclasses manual result updating from editor fields
|
968 |
|
// // FIXME: DEbug
|
969 |
|
// Log.finest("TXMEditor.refresh(): " + txmEditor.getClass().getSimpleName() + ": auto updating result from editor."); //$NON-NLS-1$
|
970 |
|
// txmEditor.autoUpdateResultFromEditorParameters(); // auto updating result from Parameter annotations in result <=> editor
|
971 |
|
|
972 |
|
txmEditor.synchronizeResultFromEditor();
|
973 |
|
|
974 |
|
//txmEditor.compute(false);
|
975 |
|
//txmEditor.updateEditorFromResult(true);
|
976 |
|
txmEditor.refresh(true);
|
977 |
|
}
|
978 |
|
}
|
979 |
|
// TXMMultiPageEditor
|
980 |
|
else if(editor != null && editor instanceof TXMMultiPageEditor && editor != this) {
|
981 |
|
TXMMultiPageEditor txmMultipageEditor = ((TXMMultiPageEditor)editor);
|
982 |
|
for (int i = 0; i < txmMultipageEditor.getEditors().size(); i++) {
|
983 |
|
if(txmMultipageEditor.getEditors().get(i) instanceof TXMEditor && txmMultipageEditor.getEditors().get(i) != this) {
|
984 |
|
TXMEditor txmEditor = ((TXMEditor)txmMultipageEditor.getEditors().get(i));
|
985 |
|
if(this.getResult().isChild(txmEditor.getResult())) {
|
986 |
|
// Log.finest("TXMEditor.refresh(): updating editor for result: " + txmEditor.getResult().getSimpleName());
|
987 |
|
// Log.finest("TXMEditor.refresh(): " + txmEditor.getClass().getSimpleName() + ": manually updating result from editor."); //$NON-NLS-1$
|
988 |
|
// txmEditor.updateResultFromEditor(); // subclasses manual result updating from editor fields
|
989 |
|
// // FIXME: DEbug
|
990 |
|
// Log.finest("TXMEditor.refresh(): " + txmEditor.getClass().getSimpleName() + ": auto updating result from editor."); //$NON-NLS-1$
|
991 |
|
// txmEditor.autoUpdateResultFromEditorParameters(); // auto updating result from Parameter annotations in result <=> editor
|
992 |
|
// //txmEditor.compute(false);
|
993 |
|
// //txmEditor.updateEditorFromResult(true);
|
994 |
|
|
995 |
|
txmEditor.synchronizeResultFromEditor();
|
996 |
|
|
997 |
|
txmEditor.refresh(true);
|
998 |
|
}
|
999 |
|
}
|
1000 |
|
}
|
1001 |
|
|
1002 |
|
}
|
1003 |
|
}
|
|
961 |
// TXMEditor
|
|
962 |
if(editor != null && editor instanceof TXMEditor && editor != this) {
|
|
963 |
TXMEditor txmEditor = ((TXMEditor)editor);
|
|
964 |
if(this.getResult().isChild(txmEditor.getResult())) {
|
1004 |
965 |
|
|
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 |
|
|
975 |
txmEditor.synchronizeResultFromEditor();
|
|
976 |
|
|
977 |
//txmEditor.compute(false);
|
|
978 |
//txmEditor.updateEditorFromResult(true);
|
|
979 |
txmEditor.refresh(true);
|
|
980 |
}
|
|
981 |
}
|
|
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 |
}
|
|
1007 |
|
1005 |
1008 |
notifyExtensions("notifyEndOfRefresh"); //$NON-NLS-1$
|
1006 |
1009 |
}
|
1007 |
1010 |
|
... | ... | |
1024 |
1027 |
public final void updateFromResult(final boolean update) throws Exception {
|
1025 |
1028 |
if (this.parent != null && !this.parent.isDisposed()) {
|
1026 |
1029 |
this.parent.getDisplay().syncExec(new Runnable() {
|
1027 |
|
|
|
1030 |
|
1028 |
1031 |
@Override
|
1029 |
1032 |
public void run() {
|
1030 |
1033 |
try {
|
... | ... | |
1037 |
1040 |
});
|
1038 |
1041 |
}
|
1039 |
1042 |
}
|
1040 |
|
|
|
1043 |
|
1041 |
1044 |
/**
|
1042 |
1045 |
* Synchronizes the editor with the result.
|
1043 |
1046 |
* Dedicated to dynamically change the editor components from the stored result.
|
... | ... | |
1073 |
1076 |
Parameter parameter = f.getAnnotation(Parameter.class);
|
1074 |
1077 |
if (parameter == null
|
1075 |
1078 |
|| parameter.key().isEmpty()
|
1076 |
|
|
1077 |
|
|
1078 |
|
|
|
1079 |
|
|
1080 |
|
|
1081 |
|
1079 |
1082 |
// FIXME: old version but doesn't not work with CA
|
1080 |
1083 |
//|| !this.getResult().hasParameterChanged(parameter.key(), this.lastComputingParameters)
|
1081 |
1084 |
// FIXME: new version
|
1082 |
1085 |
//|| !this.getResult().hasParameterChanged(parameter.key())
|
1083 |
|
|
1084 |
|
|
|
1086 |
|
|
1087 |
|
1085 |
1088 |
) {
|
1086 |
1089 |
continue;
|
1087 |
1090 |
}
|
1088 |
1091 |
|
1089 |
1092 |
Object object = null;
|
1090 |
1093 |
Object value = null;
|
1091 |
|
|
|
1094 |
|
1092 |
1095 |
try {
|
1093 |
1096 |
f.setAccessible(true);
|
1094 |
1097 |
object = f.get(this);
|
... | ... | |
1172 |
1175 |
}
|
1173 |
1176 |
}
|
1174 |
1177 |
else {
|
1175 |
|
// if(object != null) {
|
1176 |
|
f.set(this, value);
|
1177 |
|
// }
|
|
1178 |
// if(object != null) {
|
|
1179 |
f.set(this, value);
|
|
1180 |
// }
|
1178 |
1181 |
}
|
1179 |
1182 |
|
1180 |
1183 |
// FIXME: debug
|
... | ... | |
1473 |
1476 |
}
|
1474 |
1477 |
});
|
1475 |
1478 |
}
|
1476 |
|
|
1477 |
1479 |
|
|
1480 |
|
1478 |
1481 |
/**
|
1479 |
1482 |
* Adds a mouse adapter to the specified composite that executes a command link specified by its id on double click event.
|
1480 |
1483 |
* @param table
|
... | ... | |
1653 |
1656 |
return 1;
|
1654 |
1657 |
}
|
1655 |
1658 |
|
1656 |
|
|
|
1659 |
|
1657 |
1660 |
}
|