Révision 1529
| tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditor.java (revision 1529) | ||
|---|---|---|
| 78 | 78 |
*/ |
| 79 | 79 |
private CA ca; |
| 80 | 80 |
|
| 81 |
public static String SEPARATOR = ""; //$NON-NLS-1$ |
|
| 82 | 81 |
|
| 83 |
public static String COL_TYPE = "Double"; //$NON-NLS-1$ |
|
| 84 |
|
|
| 85 |
|
|
| 86 |
|
|
| 87 | 82 |
@Override |
| 88 | 83 |
protected void createPages() {
|
| 89 | 84 |
|
| ... | ... | |
| 136 | 131 |
editors = new ArrayList<EditorPart>(); |
| 137 | 132 |
inputs = new ArrayList<IEditorInput>(); |
| 138 | 133 |
|
| 139 |
TXMResultEditorInput caInput = (TXMResultEditorInput) this.getEditorInput(); |
|
| 140 |
this.ca = (CA) caInput.getResult(); |
|
| 134 |
this.ca = ((TXMResultEditorInput<CA>) this.getEditorInput()).getResult(); |
|
| 141 | 135 |
|
| 142 | 136 |
// Initialize the editor parts and editor inputs |
| 143 | 137 |
this.initCAFactorialMapEditor(); |
| tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/ColsRowsInfosEditor.java (revision 1529) | ||
|---|---|---|
| 27 | 27 |
// |
| 28 | 28 |
package org.txm.ca.rcp.editors; |
| 29 | 29 |
|
| 30 |
import java.util.ArrayList; |
|
| 31 |
import java.util.List; |
|
| 32 |
|
|
| 33 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
| 34 |
import org.eclipse.jface.action.MenuManager; |
|
| 35 | 30 |
import org.eclipse.jface.viewers.ArrayContentProvider; |
| 36 |
import org.eclipse.jface.viewers.IStructuredContentProvider; |
|
| 37 |
import org.eclipse.jface.viewers.LabelProvider; |
|
| 38 | 31 |
import org.eclipse.jface.viewers.TableViewer; |
| 39 | 32 |
import org.eclipse.jface.viewers.TableViewerColumn; |
| 40 |
import org.eclipse.jface.viewers.Viewer; |
|
| 41 | 33 |
import org.eclipse.osgi.util.NLS; |
| 42 | 34 |
import org.eclipse.swt.SWT; |
| 43 |
import org.eclipse.swt.events.SelectionAdapter; |
|
| 44 |
import org.eclipse.swt.events.SelectionEvent; |
|
| 45 |
import org.eclipse.swt.layout.FillLayout; |
|
| 46 | 35 |
import org.eclipse.swt.layout.GridData; |
| 47 |
import org.eclipse.swt.widgets.Composite; |
|
| 48 |
import org.eclipse.swt.widgets.Menu; |
|
| 49 | 36 |
import org.eclipse.swt.widgets.Table; |
| 50 |
import org.eclipse.swt.widgets.TableColumn; |
|
| 51 | 37 |
import org.eclipse.swt.widgets.TableItem; |
| 52 |
import org.eclipse.ui.IEditorInput; |
|
| 53 |
import org.eclipse.ui.IEditorSite; |
|
| 54 |
import org.eclipse.ui.PartInitException; |
|
| 55 | 38 |
import org.txm.Toolbox; |
| 56 |
import org.txm.ca.core.functions.CA; |
|
| 57 | 39 |
import org.txm.ca.rcp.messages.CAUIMessages; |
| 58 | 40 |
import org.txm.core.results.TXMResult; |
| 59 |
import org.txm.rcp.StatusLine; |
|
| 60 |
import org.txm.rcp.editors.ITablableEditorInput; |
|
| 61 | 41 |
import org.txm.rcp.editors.TXMEditor; |
| 62 | 42 |
import org.txm.rcp.editors.TXMResultEditorInput; |
| 63 | 43 |
import org.txm.rcp.editors.TableKeyListener; |
| 64 | 44 |
import org.txm.rcp.editors.TableLinesViewerComparator; |
| 65 |
import org.txm.rcp.editors.TableSorter; |
|
| 66 |
import org.txm.rcp.editors.input.AbstractTablableEditorInput; |
|
| 67 |
import org.txm.rcp.messages.TXMUIMessages; |
|
| 68 | 45 |
import org.txm.rcp.swt.GLComposite; |
| 69 | 46 |
|
| 70 | 47 |
/** |
| ... | ... | |
| 115 | 92 |
|
| 116 | 93 |
String[] titles = this.getTableTitles(); |
| 117 | 94 |
|
| 118 |
List<String> coltypes = new ArrayList<String>(); |
|
| 119 |
coltypes.add(TXMUIMessages.integer); |
|
| 120 |
coltypes.add("");
|
|
| 121 |
coltypes.add(CAEditor.COL_TYPE); |
|
| 122 |
coltypes.add(CAEditor.COL_TYPE); |
|
| 123 |
coltypes.add(CAEditor.COL_TYPE); |
|
| 124 |
coltypes.add(CAEditor.COL_TYPE); |
|
| 125 |
coltypes.add(CAEditor.COL_TYPE); |
|
| 126 |
for (int c = 0; c < 3; c++)// seulement les 3 premiers axes |
|
| 127 |
{
|
|
| 128 |
coltypes.add(CAEditor.SEPARATOR); |
|
| 129 |
coltypes.add(CAEditor.COL_TYPE); |
|
| 130 |
coltypes.add(CAEditor.COL_TYPE); |
|
| 131 |
} |
|
| 132 |
coltypes.add(CAEditor.SEPARATOR); |
|
| 133 |
coltypes.add(CAEditor.COL_TYPE); |
|
| 134 |
coltypes.add(CAEditor.COL_TYPE); |
|
| 135 |
coltypes.add(CAEditor.COL_TYPE); |
|
| 136 |
coltypes.add(CAEditor.SEPARATOR); |
|
| 95 |
//List<String> coltypes = new ArrayList<String>(); |
|
| 96 |
// coltypes.add(TXMUIMessages.integer); |
|
| 97 |
// coltypes.add("");
|
|
| 98 |
// coltypes.add(CAEditor.COL_TYPE); |
|
| 99 |
// coltypes.add(CAEditor.COL_TYPE); |
|
| 100 |
// coltypes.add(CAEditor.COL_TYPE); |
|
| 101 |
// coltypes.add(CAEditor.COL_TYPE); |
|
| 102 |
// coltypes.add(CAEditor.COL_TYPE); |
|
| 103 |
// for (int c = 0; c < 3; c++)// seulement les 3 premiers axes |
|
| 104 |
// {
|
|
| 105 |
// coltypes.add(CAEditor.SEPARATOR); |
|
| 106 |
// coltypes.add(CAEditor.COL_TYPE); |
|
| 107 |
// coltypes.add(CAEditor.COL_TYPE); |
|
| 108 |
// } |
|
| 109 |
// coltypes.add(CAEditor.SEPARATOR); |
|
| 110 |
// coltypes.add(CAEditor.COL_TYPE); |
|
| 111 |
// coltypes.add(CAEditor.COL_TYPE); |
|
| 112 |
// coltypes.add(CAEditor.COL_TYPE); |
|
| 113 |
// coltypes.add(CAEditor.SEPARATOR); |
|
| 114 |
// |
|
| 115 |
//String[] types = coltypes.toArray(new String[] {});
|
|
| 137 | 116 |
|
| 138 |
String[] types = coltypes.toArray(new String[] {});
|
|
| 139 | 117 |
|
| 140 |
|
|
| 141 | 118 |
for (int i = 0; i < titles.length; i++) {
|
| 142 | 119 |
final int index = i; |
| 143 | 120 |
final TableViewerColumn column; |
| tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1529) | ||
|---|---|---|
| 135 | 135 |
private Semaphore progressSemaphore = new Semaphore(1); |
| 136 | 136 |
|
| 137 | 137 |
/** |
| 138 |
* To keep track of the parameters used for the last computing and to determine if the result is dirty. |
|
| 138 |
* To keep track of the parameters used for the last computing and to determine if the result is dirty. |
|
| 139 |
* Also permits to optimize computing by testing if a specific parameter value has changed since last computing and skip or not some computing steps. |
|
| 139 | 140 |
*/ |
| 140 | 141 |
// FIXME: SJ: actually only used by the chart results. Purpose here is that the chart creators need to know if a computing parameter has changed to recreate or not some entity. |
| 141 | 142 |
// The problem is since the result is already computing, the parameters are already updated and the method hasParameterChanged() will always return false. Using this stack fix the problem. |
| ... | ... | |
| 2196 | 2197 |
this.updateLastParameters(); |
| 2197 | 2198 |
|
| 2198 | 2199 |
|
| 2199 |
if(!skipComputing |
|
| 2200 |
|| this.altered // FIXME: SJ: fix for computing LexicalTable children even if the LT is not dirty but only altered, need to define if it's a temporary fix or not |
|
| 2201 |
) {
|
|
| 2200 |
if(!skipComputing) {
|
|
| 2202 | 2201 |
|
| 2203 | 2202 |
// store last used parameters |
| 2204 | 2203 |
// this.updateLastParameters(); |
| ... | ... | |
| 2228 | 2227 |
this.altered = false; |
| 2229 | 2228 |
|
| 2230 | 2229 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing of result type " + this.getClass() + " done.");
|
| 2231 |
|
|
| 2230 |
} |
|
| 2231 |
|
|
| 2232 |
|
|
| 2233 |
// Children computing |
|
| 2234 |
if(!skipComputing |
|
| 2235 |
|| this.altered // FIXME: SJ: fix for computing LexicalTable children even if the LT is not dirty but only altered, need to define if it's a temporary fix or not |
|
| 2236 |
) {
|
|
| 2237 |
|
|
| 2232 | 2238 |
// set the children as dirty since the result has changed |
| 2233 | 2239 |
for (int i = 0; i < this.children.size(); i++) {
|
| 2234 | 2240 |
this.children.get(i).setDirty(); |
| 2235 | 2241 |
} |
| 2236 |
|
|
| 2242 |
|
|
| 2237 | 2243 |
// Children cascade computing (if parent == null then it is the Workspace (Tree root)) |
| 2238 | 2244 |
if (deepComputing && this.parent != null) {
|
| 2239 |
|
|
| 2245 |
|
|
| 2240 | 2246 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": cascade computing of " + this.children.size() + " child(ren).");
|
| 2241 |
|
|
| 2247 |
|
|
| 2242 | 2248 |
for (int i = 0; i < this.children.size(); i++) {
|
| 2243 | 2249 |
this.children.get(i).compute(monitor, deepComputing); |
| 2244 | 2250 |
} |
| 2245 |
|
|
| 2251 |
|
|
| 2246 | 2252 |
// FIXME: SJ: this code generates concurrent modification exceptions when deep computing |
| 2247 | 2253 |
// here for tests purpose, the code above does not generates exceptions |
| 2248 | 2254 |
// for (TXMResult child : this.getChildren()) {
|
| 2249 | 2255 |
// // recompute only children that has been opened once |
| 2250 | 2256 |
// child.compute(monitor, deepComputing); |
| 2251 | 2257 |
// } |
| 2252 |
|
|
| 2258 |
|
|
| 2253 | 2259 |
} |
| 2254 | 2260 |
} |
| 2261 |
|
|
| 2255 | 2262 |
} |
| 2256 | 2263 |
catch (Exception e) {
|
| 2257 | 2264 |
e.printStackTrace(); |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1529) | ||
|---|---|---|
| 821 | 821 |
if(update) {
|
| 822 | 822 |
|
| 823 | 823 |
// popup alert to inform user that the result has been manually edited |
| 824 |
if (TXMEditor.this.getResult().isAltered() && !MessageDialog.openQuestion(getShell(), "Warning", "The result have been edited. Changes will be lost. Do you want to continue?")) {
|
|
| 824 |
if (TXMEditor.this.getResult().isAltered() && !MessageDialog.openQuestion(getShell(), "Warning", TXMCoreMessages.bind("The {0} has been edited. Its changes will be lost. Do you want to continue?", TXMEditor.this.getResult().getResultype()))) {
|
|
| 825 | 825 |
setCanceled(true); |
| 826 | 826 |
} |
| 827 | 827 |
else {
|
| 828 |
|
|
| 828 |
|
|
| 829 |
// FIXME: SJ: this code doesn't work well, commented because a rendering parameter change in CA display the popup because of the Eigenvalues children |
|
| 829 | 830 |
// popup alert to inform user that children results will be recomputed |
| 830 |
if(!TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER) |
|
| 831 |
&& TXMEditor.this.getResult().hasChildren() && !MessageDialog.openQuestion(getShell(), "Warning", "All children results based on this one will be recomputed. Do you want to continue?")) {
|
|
| 832 |
setCanceled(true); |
|
| 833 |
} |
|
| 831 |
// if(!TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)
|
|
| 832 |
// && TXMEditor.this.getResult().hasChildren() && !MessageDialog.openQuestion(getShell(), "Warning", "All descendant results will be updated. Do you want to continue?")) {
|
|
| 833 |
// setCanceled(true);
|
|
| 834 |
// }
|
|
| 834 | 835 |
|
| 835 | 836 |
|
| 836 | 837 |
// subclasses manual result updating from editor fields |
| tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/DeleteLines.java (revision 1529) | ||
|---|---|---|
| 38 | 38 |
import org.eclipse.ui.handlers.HandlerUtil; |
| 39 | 39 |
import org.txm.lexicaltable.rcp.editors.LexicalTableEditor; |
| 40 | 40 |
import org.txm.rcp.messages.TXMUIMessages; |
| 41 |
|
|
| 41 | 42 |
/** |
| 42 |
* Allow the user to delete lines in a Lexical Table. |
|
| 43 |
* Allows the user to delete lines in a Lexical Table.
|
|
| 43 | 44 |
* |
| 44 | 45 |
* @author mdecorde |
| 45 | 46 |
* @author sjacquot |
| ... | ... | |
| 70 | 71 |
return null; |
| 71 | 72 |
} |
| 72 | 73 |
|
| 73 |
public static void deleteLexicalTableLines(LexicalTableEditor LTeditor) throws Exception {
|
|
| 74 |
int[] selection = LTeditor.getlineTableViewer().getTable() |
|
| 75 |
.getSelectionIndices(); |
|
| 74 |
/** |
|
| 75 |
* |
|
| 76 |
* @param editor |
|
| 77 |
* @throws Exception |
|
| 78 |
*/ |
|
| 79 |
public static void deleteLexicalTableLines(LexicalTableEditor editor) throws Exception {
|
|
| 80 |
int[] selection = editor.getlineTableViewer().getTable().getSelectionIndices(); |
|
| 76 | 81 |
if (selection.length == 0) |
| 77 | 82 |
return; |
| 78 | 83 |
|
| 79 |
if (selection.length == LTeditor.getLexicalTable().getNRows()) {
|
|
| 84 |
if (selection.length == editor.getLexicalTable().getNRows()) {
|
|
| 80 | 85 |
System.out.println(TXMUIMessages.theTableMustContainAtLeastOneLine); |
| 81 | 86 |
return; |
| 82 | 87 |
} |
| ... | ... | |
| 84 | 89 |
Display d = Display.getCurrent(); |
| 85 | 90 |
if (d != null) {
|
| 86 | 91 |
Shell shell = d.getActiveShell(); |
| 87 |
MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION |
|
| 88 |
| SWT.YES | SWT.NO); |
|
| 92 |
MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO); |
|
| 89 | 93 |
messageBox.setMessage(TXMUIMessages.common_areYouSure); |
| 90 |
int response = messageBox.open(); |
|
| 91 |
if (response != SWT.YES) |
|
| 94 |
if (messageBox.open() != SWT.YES) |
|
| 92 | 95 |
return; |
| 93 | 96 |
} |
| 94 | 97 |
|
| 95 |
LTeditor.getLexicalTable().getData().removeRows(selection);
|
|
| 96 |
LTeditor.getLexicalTable().setAltered();
|
|
| 97 |
LTeditor.compute(false);
|
|
| 98 |
editor.getLexicalTable().getData().removeRows(selection); |
|
| 99 |
editor.getLexicalTable().setAltered(); |
|
| 100 |
editor.compute(false); |
|
| 98 | 101 |
} |
| 99 | 102 |
|
| 100 | 103 |
} |
Formats disponibles : Unified diff