Révision 2315
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 2315) | ||
---|---|---|
34 | 34 |
import org.eclipse.swt.layout.RowLayout; |
35 | 35 |
import org.eclipse.swt.widgets.Button; |
36 | 36 |
import org.eclipse.swt.widgets.Composite; |
37 |
import org.eclipse.swt.widgets.Control; |
|
38 | 37 |
import org.eclipse.swt.widgets.Display; |
39 | 38 |
import org.eclipse.swt.widgets.Group; |
40 | 39 |
import org.eclipse.swt.widgets.Menu; |
... | ... | |
62 | 61 |
import org.txm.core.preferences.TBXPreferences; |
63 | 62 |
import org.txm.core.results.Parameter; |
64 | 63 |
import org.txm.core.results.TXMResult; |
65 |
import org.txm.rcp.IImageKeys; |
|
66 | 64 |
import org.txm.rcp.JobsTimer; |
67 | 65 |
import org.txm.rcp.StatusLine; |
68 | 66 |
import org.txm.rcp.TXMWindows; |
69 | 67 |
import org.txm.rcp.editors.listeners.BaseAbstractComputeListener; |
70 |
import org.txm.rcp.editors.listeners.ComputeSelectionListener; |
|
71 | 68 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
72 | 69 |
import org.txm.rcp.messages.TXMUIMessages; |
73 | 70 |
import org.txm.rcp.preferences.RCPPreferences; |
... | ... | |
411 | 408 |
this.topToolBar = new TXMEditorToolBar(this, this.firstLineComposite, this.extendedParametersComposite, SWT.FLAT | SWT.RIGHT, TOP_TOOLBAR_ID); |
412 | 409 |
|
413 | 410 |
// store the Compute button to access if later, especially from subclasses |
414 |
this.computeButton = topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID); |
|
411 |
this.computeButton = this.topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID);
|
|
415 | 412 |
|
416 | 413 |
// this.computeButton = new ToolItem(topToolBar, SWT.PUSH);//.topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID); |
417 | 414 |
// this.computeButton.setImage(IImageKeys.getImage(IImageKeys.START)); |
... | ... | |
854 | 851 |
return this.getEditorInput().getResult().getStringParameterValue(key); |
855 | 852 |
} |
856 | 853 |
|
857 |
// FIXME: SJ: tests to enable/disable when computing
|
|
854 |
// FIXME: SJ: tests to enable/disable widget controls while computing
|
|
858 | 855 |
// public void recursiveSetEnabled(boolean enabled) { |
859 | 856 |
// this.recursiveSetEnabled(this.parent, enabled); |
860 | 857 |
// } |
861 | 858 |
|
862 |
// FIXME: SJ: tests to enable/disable when computing
|
|
859 |
// FIXME: SJ: tests to enable/disable widget controls while computing
|
|
863 | 860 |
// public void recursiveSetEnabled(Control ctrl, boolean enabled) { |
864 | 861 |
// if (ctrl instanceof Composite) { |
865 | 862 |
// Composite comp = (Composite) ctrl; |
... | ... | |
881 | 878 |
|
882 | 879 |
StatusLine.setMessage(TXMCoreMessages.bind(TXMUIMessages.computing, this.getResult().getName())); |
883 | 880 |
|
881 |
// FIXME: SJ: long process simulation to test the Job cancelation or UI progress dialog visibility |
|
882 |
// try { |
|
883 |
// IWorkbench wb = PlatformUI.getWorkbench(); |
|
884 |
// IProgressService ps = wb.getProgressService(); |
|
885 |
// ps.busyCursorWhile(new IRunnableWithProgress() { |
|
886 |
// public void run(IProgressMonitor pm) { |
|
887 |
// pm.beginTask("long process simulation test", 10); |
|
888 |
// for (int i = 0; i < 12; i++) { |
|
889 |
// try { |
|
890 |
// Thread.sleep(25); |
|
891 |
// } |
|
892 |
// catch (InterruptedException e) { |
|
893 |
// // TODO Auto-generated catch block |
|
894 |
// e.printStackTrace(); |
|
895 |
// } |
|
896 |
// pm.worked(1); |
|
897 |
// } |
|
898 |
// |
|
899 |
// } |
|
900 |
// }); |
|
901 |
// } |
|
902 |
// catch (InvocationTargetException e1) { |
|
903 |
// // TODO Auto-generated catch block |
|
904 |
// e1.printStackTrace(); |
|
905 |
// } |
|
906 |
// catch (InterruptedException e1) { |
|
907 |
// // TODO Auto-generated catch block |
|
908 |
// e1.printStackTrace(); |
|
909 |
// } |
|
910 |
|
|
911 |
|
|
912 |
|
|
913 |
// UIJob j = new UIJob("test") { |
|
914 |
// |
|
915 |
// @Override |
|
916 |
// public IStatus runInUIThread(IProgressMonitor monitor) { |
|
917 |
// monitor.beginTask("long process simulation test", 10); |
|
918 |
// for (int i = 0; i < 10; i++) { |
|
919 |
// try { |
|
920 |
// Thread.sleep(1000); |
|
921 |
// } |
|
922 |
// catch (InterruptedException e) { |
|
923 |
// // TODO Auto-generated catch block |
|
924 |
// e.printStackTrace(); |
|
925 |
// } |
|
926 |
// monitor.worked(1); |
|
927 |
// } |
|
928 |
// |
|
929 |
// |
|
930 |
// |
|
931 |
// return null; |
|
932 |
// } |
|
933 |
// }; |
|
934 |
// j.setUser(true); |
|
935 |
// j.schedule(); |
|
936 |
|
|
884 | 937 |
JobHandler job = new JobHandler(TXMCoreMessages.bind(TXMUIMessages.computing, this.getResult().getName())) { |
885 | 938 |
|
886 | 939 |
@Override |
887 | 940 |
protected IStatus run(IProgressMonitor monitor) { |
888 | 941 |
|
942 |
// monitor.beginTask("long process simulation test", 10); |
|
943 |
// for (int i = 0; i < 12; i++) { |
|
944 |
// try { |
|
945 |
// Thread.sleep(25); |
|
946 |
// } |
|
947 |
// catch (InterruptedException e) { |
|
948 |
// // TODO Auto-generated catch block |
|
949 |
// e.printStackTrace(); |
|
950 |
// } |
|
951 |
// monitor.worked(1); |
|
952 |
// } |
|
953 |
|
|
889 | 954 |
this.runInit(monitor); |
890 | 955 |
|
891 | 956 |
if (isLocked()) { |
... | ... | |
1006 | 1071 |
} |
1007 | 1072 |
// for user direct canceling |
1008 | 1073 |
catch (ThreadDeath td) { |
1009 |
// FIXME should call clean() and/or set the result as dirty? |
|
1074 |
// FIXME: SJ: should call clean() and/or set the result as dirty?
|
|
1010 | 1075 |
return Status.CANCEL_STATUS; |
1011 | 1076 |
// FIXME: SJ tests |
1012 | 1077 |
// throw td; |
... | ... | |
1021 | 1086 |
return Status.OK_STATUS; |
1022 | 1087 |
} |
1023 | 1088 |
}; |
1089 |
|
|
1090 |
// FIXME: SJ: tests to show busy cursor |
|
1091 |
// IProgressService ps = PlatformUI.getWorkbench().getProgressService(); |
|
1092 |
// ps.showInDialog(null, job); |
|
1093 |
// ps.busyCursorWhile(job); |
|
1094 |
|
|
1095 |
|
|
1024 | 1096 |
job.setPriority(Job.DECORATE); |
1025 | 1097 |
// FIXME: SJ tests |
1026 | 1098 |
// job.setPriority(Job.INTERACTIVE); |
... | ... | |
1183 | 1255 |
|
1184 | 1256 |
/** |
1185 | 1257 |
* Synchronizes the result parameters with editor widgets. |
1186 |
* <p>
|
|
1258 |
* |
|
1187 | 1259 |
* It should be called or called itself in the UI thread when accessing Widget parameters. |
1188 | 1260 |
*/ |
1189 | 1261 |
public abstract void updateResultFromEditor(); |
Formats disponibles : Unified diff