|
Lines 4-10
Link Here
|
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* $Id: DatapoolTable.java,v 1.45 2008/01/21 19:09:13 paules Exp $ |
7 |
* $Id: DatapoolTable.java,v 1.45 2008/02/27 19:09:13 huangxy Exp $ |
| 8 |
* |
8 |
* |
| 9 |
* Contributors: |
9 |
* Contributors: |
| 10 |
* IBM Corporation - initial API and implementation |
10 |
* IBM Corporation - initial API and implementation |
|
Lines 25-38
Link Here
|
| 25 |
import org.eclipse.hyades.edit.datapool.IDatapoolRecord; |
25 |
import org.eclipse.hyades.edit.datapool.IDatapoolRecord; |
| 26 |
import org.eclipse.hyades.edit.datapool.IDatapoolSuggestedType; |
26 |
import org.eclipse.hyades.edit.datapool.IDatapoolSuggestedType; |
| 27 |
import org.eclipse.hyades.edit.datapool.IDatapoolVariable; |
27 |
import org.eclipse.hyades.edit.datapool.IDatapoolVariable; |
|
|
28 |
import org.eclipse.hyades.models.common.datapool.DPLDatapool; |
| 29 |
import org.eclipse.hyades.models.common.datapool.DPLVariable; |
| 30 |
import org.eclipse.hyades.models.common.datapool.util.DatapoolEncryptManager; |
| 31 |
import org.eclipse.hyades.models.common.util.EncryptionManager; |
| 28 |
import org.eclipse.hyades.test.ui.UiPlugin; |
32 |
import org.eclipse.hyades.test.ui.UiPlugin; |
|
|
33 |
import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolChangeKeyDialog; |
| 29 |
import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolColumnDialog; |
34 |
import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolColumnDialog; |
|
|
35 |
import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolConstant; |
| 30 |
import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolDeleteColumnDialog; |
36 |
import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolDeleteColumnDialog; |
|
|
37 |
import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolInputKeyDialog; |
| 31 |
import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolRowDialog; |
38 |
import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolRowDialog; |
| 32 |
import org.eclipse.hyades.test.ui.datapool.internal.interfaces.IDatapoolPart; |
39 |
import org.eclipse.hyades.test.ui.datapool.internal.interfaces.IDatapoolPart; |
| 33 |
import org.eclipse.hyades.test.ui.datapool.internal.interfaces.IValidateValueClass; |
40 |
import org.eclipse.hyades.test.ui.datapool.internal.interfaces.IValidateValueClass; |
| 34 |
import org.eclipse.hyades.test.ui.datapool.internal.interfaces.IValueClassFactory; |
41 |
import org.eclipse.hyades.test.ui.datapool.internal.interfaces.IValueClassFactory; |
| 35 |
import org.eclipse.hyades.test.ui.datapool.internal.util.DatapoolUtil; |
42 |
import org.eclipse.hyades.test.ui.datapool.internal.util.DatapoolUtil; |
|
|
43 |
import org.eclipse.hyades.test.ui.datapool.internal.util.EncryptedValueObject; |
| 36 |
import org.eclipse.hyades.test.ui.datapool.internal.util.TypeChecker; |
44 |
import org.eclipse.hyades.test.ui.datapool.internal.util.TypeChecker; |
| 37 |
import org.eclipse.hyades.test.ui.datapool.internal.util.ValueClassMap; |
45 |
import org.eclipse.hyades.test.ui.datapool.internal.util.ValueClassMap; |
| 38 |
import org.eclipse.hyades.test.ui.datapool.internal.util.ValueObject; |
46 |
import org.eclipse.hyades.test.ui.datapool.internal.util.ValueObject; |
|
Lines 135-140
Link Here
|
| 135 |
private boolean showRecords = true; |
143 |
private boolean showRecords = true; |
| 136 |
private boolean isF2Mode = false; |
144 |
private boolean isF2Mode = false; |
| 137 |
private int previousMultiRowSelectionIndex = -1; // only used for deselecting when multi-selection in place. |
145 |
private int previousMultiRowSelectionIndex = -1; // only used for deselecting when multi-selection in place. |
|
|
146 |
private String cellkey; |
| 147 |
private boolean passwordExist = false; |
| 148 |
private String password = null; |
| 138 |
|
149 |
|
| 139 |
private String vendorID = null; |
150 |
private String vendorID = null; |
| 140 |
|
151 |
|
|
Lines 1379-1397
Link Here
|
| 1379 |
if(rawValue == null) |
1390 |
if(rawValue == null) |
| 1380 |
{ |
1391 |
{ |
| 1381 |
String typeName = suggestedType.getSuggestedClassName(); |
1392 |
String typeName = suggestedType.getSuggestedClassName(); |
| 1382 |
if(typeName == null || typeName.length() == 0) |
1393 |
if (typeName == null || typeName.length() == 0) { |
| 1383 |
{ |
|
|
| 1384 |
rawValue = new String(); |
1394 |
rawValue = new String(); |
| 1385 |
} |
1395 |
} else { |
| 1386 |
else |
|
|
| 1387 |
{ |
| 1388 |
rawValue = createEmptyCellObject(typeName); |
1396 |
rawValue = createEmptyCellObject(typeName); |
| 1389 |
} |
1397 |
} |
| 1390 |
} |
1398 |
} |
| 1391 |
|
1399 |
if(DatapoolEncryptManager.isVariabelEncrypted(variable)) |
| 1392 |
theValueObject = new ValueObject(rawValue); |
1400 |
{ |
| 1393 |
cellEditor = (CellEditor)theValueObject.getPropertyDisplay(tableCursor); |
1401 |
boolean errorKey = true; |
| 1394 |
} |
1402 |
boolean isCancelChange = false; |
|
|
1403 |
String key = null; |
| 1404 |
if(passwordExist){ |
| 1405 |
key = password; |
| 1406 |
cellkey = key; |
| 1407 |
}else{ |
| 1408 |
DatapoolInputKeyDialog logOnDialog = new DatapoolInputKeyDialog( |
| 1409 |
Display.getCurrent().getActiveShell(), |
| 1410 |
UiPluginResourceBundle.DatapoolDialog_INPUTKEYDIALGOTITLE, |
| 1411 |
datapool); |
| 1412 |
|
| 1413 |
|
| 1414 |
while (errorKey) { |
| 1415 |
int openValue = logOnDialog.open(); |
| 1416 |
if (openValue == IDialogConstants.OK_ID) { |
| 1417 |
key = logOnDialog.getKey(); |
| 1418 |
cellkey = key; |
| 1419 |
if (DatapoolEncryptManager.isKeyCorrect(datapool, key)) { |
| 1420 |
errorKey = false; |
| 1421 |
password = key; |
| 1422 |
passwordExist = true; |
| 1423 |
} else {//the input key is incorrect |
| 1424 |
showErrMes(Display.getCurrent() |
| 1425 |
.getActiveShell(), |
| 1426 |
UiPluginResourceBundle.DatapoolDialog_WRONGLOGONKEYMES); |
| 1427 |
} |
| 1428 |
} else if (openValue == IDialogConstants.CANCEL_ID) {// click cancel button |
| 1429 |
isCancelChange = true; |
| 1430 |
errorKey = false; |
| 1431 |
|
| 1432 |
} |
| 1433 |
} |
| 1434 |
|
| 1435 |
if(isCancelChange) |
| 1436 |
{ |
| 1437 |
return; |
| 1438 |
} |
| 1439 |
} |
| 1440 |
rawValue = EncryptionManager.decrypt(rawValue.toString(), key); |
| 1441 |
theValueObject = new EncryptedValueObject(rawValue); |
| 1442 |
cellEditor = (CellEditor) theValueObject |
| 1443 |
.getEncryptedDisplay(tableCursor); |
| 1444 |
}else{ |
| 1445 |
theValueObject = new ValueObject(rawValue); |
| 1446 |
cellEditor = (CellEditor) theValueObject.getPropertyDisplay(tableCursor); |
| 1447 |
} |
| 1448 |
// cellEditor = new TextCellEditor(tableCursor,SWT.PASSWORD); |
| 1449 |
// cellEditor.setValue(rawValue.toString()); |
| 1450 |
// int oldStyle = cellEditor.getStyle(); |
| 1451 |
// cellEditor.setStyle(SWT.PASSWORD|oldStyle); |
| 1452 |
// oldStyle = cellEditor.getStyle(); |
| 1453 |
} |
| 1395 |
|
1454 |
|
| 1396 |
if(cellEditor != null && cellEditor.getControl() != null) |
1455 |
if(cellEditor != null && cellEditor.getControl() != null) |
| 1397 |
{ |
1456 |
{ |
|
Lines 1491-1498
Link Here
|
| 1491 |
} |
1550 |
} |
| 1492 |
} |
1551 |
} |
| 1493 |
|
1552 |
|
| 1494 |
if(update) |
1553 |
if (update) { |
| 1495 |
{ |
1554 |
if(DatapoolEncryptManager.isVariabelEncrypted(cell.getCellVariable())) |
|
|
1555 |
{ |
| 1556 |
String value = String.valueOf(updatedValue); |
| 1557 |
String encryptValue = DatapoolEncryptManager.encrypt(value, cellkey); |
| 1558 |
updatedValue = (Object)encryptValue; |
| 1559 |
|
| 1560 |
} |
| 1496 |
cell.setCellValue(updatedValue); |
1561 |
cell.setCellValue(updatedValue); |
| 1497 |
selectedTableItem.setText(selectedColumnIndex, newDescription); |
1562 |
selectedTableItem.setText(selectedColumnIndex, newDescription); |
| 1498 |
tableCursor.setSelection(table.getSelectionIndex(), selectedColumnIndex); |
1563 |
tableCursor.setSelection(table.getSelectionIndex(), selectedColumnIndex); |
|
Lines 1501-1506
Link Here
|
| 1501 |
} |
1566 |
} |
| 1502 |
|
1567 |
|
| 1503 |
if(dispose) |
1568 |
if(dispose) |
|
|
1569 |
refreshRows(); |
| 1504 |
clearCellEditor(); |
1570 |
clearCellEditor(); |
| 1505 |
} |
1571 |
} |
| 1506 |
} |
1572 |
} |
|
Lines 1838-1852
Link Here
|
| 1838 |
|
1904 |
|
| 1839 |
IDatapool datapool = getDatapool(); |
1905 |
IDatapool datapool = getDatapool(); |
| 1840 |
DatapoolColumnDialog dialog = new DatapoolColumnDialog(Display.getCurrent().getActiveShell(), datapool, null, previousVariable, UiPluginResourceBundle.DATA_COL_DLG_TITLE_INS); |
1906 |
DatapoolColumnDialog dialog = new DatapoolColumnDialog(Display.getCurrent().getActiveShell(), datapool, null, previousVariable, UiPluginResourceBundle.DATA_COL_DLG_TITLE_INS); |
| 1841 |
if ( dialog.open() == IDialogConstants.OK_ID) |
1907 |
if (dialog.open() == IDialogConstants.OK_ID) { |
| 1842 |
{ |
1908 |
if(dialog.isEncrypted()){ |
|
|
1909 |
String key = null; |
| 1910 |
if(isKeyExist()) |
| 1911 |
{ |
| 1912 |
boolean errorKey = true; |
| 1913 |
if(passwordExist && !dialog.isKeyChanged()){ |
| 1914 |
key = password; |
| 1915 |
}else{ |
| 1916 |
DatapoolInputKeyDialog logOnDialog = new DatapoolInputKeyDialog( |
| 1917 |
Display.getCurrent().getActiveShell(), |
| 1918 |
UiPluginResourceBundle.DatapoolDialog_INPUTKEYDIALGOTITLE, |
| 1919 |
datapool); |
| 1920 |
while (errorKey) { |
| 1921 |
int openValue = logOnDialog.open(); |
| 1922 |
if (openValue == IDialogConstants.OK_ID) { |
| 1923 |
key = logOnDialog.getKey(); |
| 1924 |
if (DatapoolEncryptManager.isKeyCorrect(datapool,key)) { |
| 1925 |
errorKey = false; |
| 1926 |
password = key; |
| 1927 |
passwordExist = true; |
| 1928 |
} else { |
| 1929 |
showErrMes(Display.getCurrent() |
| 1930 |
.getActiveShell(), |
| 1931 |
UiPluginResourceBundle.DatapoolDialog_WRONGLOGONKEYMES); |
| 1932 |
} |
| 1933 |
} else if (openValue == IDialogConstants.CANCEL_ID) { |
| 1934 |
errorKey = false; |
| 1935 |
} |
| 1936 |
} |
| 1937 |
} |
| 1938 |
} |
| 1939 |
else |
| 1940 |
{ |
| 1941 |
Shell shell = Display.getCurrent().getActiveShell(); |
| 1942 |
DatapoolChangeKeyDialog assignKeyDialog = new DatapoolChangeKeyDialog( |
| 1943 |
shell, datapool, |
| 1944 |
UiPluginResourceBundle.DatapoolDialog_ASSIGNKEYDIALOGTITLE); |
| 1945 |
boolean errorKey = true; |
| 1946 |
while (errorKey) { |
| 1947 |
if (assignKeyDialog.open() == IDialogConstants.OK_ID) { |
| 1948 |
key = assignKeyDialog.getNewKey(); |
| 1949 |
int ret = assignKeyDialog.isKeyAssignSuccess(); |
| 1950 |
switch (ret) { |
| 1951 |
case DatapoolConstant.NEW_KEY_NULL: |
| 1952 |
showErrMes(shell, |
| 1953 |
UiPluginResourceBundle.DatapoolDialog_NEWKEYNULLMES); |
| 1954 |
break; |
| 1955 |
case DatapoolConstant.NEW_KEY_NOT_CONFIRM: |
| 1956 |
showErrMes( |
| 1957 |
shell, |
| 1958 |
UiPluginResourceBundle.DatapoolDialog_NEWKEYNOTCONFIRMMES); |
| 1959 |
break; |
| 1960 |
case DatapoolConstant.CHANGE_KEY_SUCCESS: |
| 1961 |
try{ |
| 1962 |
DatapoolEncryptManager.changeKey(EncryptionManager.EncoderByMd5(key), |
| 1963 |
datapool); |
| 1964 |
// |
| 1965 |
errorKey = false; |
| 1966 |
password = key; |
| 1967 |
passwordExist = true; |
| 1968 |
}catch(Exception e){} |
| 1969 |
break; |
| 1970 |
default:// error |
| 1971 |
} |
| 1972 |
} else { |
| 1973 |
errorKey = false; |
| 1974 |
} |
| 1975 |
} |
| 1976 |
} |
| 1977 |
} |
| 1978 |
|
| 1843 |
setWaitCursor(); |
1979 |
setWaitCursor(); |
| 1844 |
IDatapoolVariable variable = datapool.constructVariable(); |
1980 |
IDatapoolVariable variable = datapool.constructVariable(); |
| 1845 |
variable.setName(dialog.getName()); |
1981 |
variable.setName(dialog.getName()); |
| 1846 |
IDatapoolSuggestedType suggestedType = (IDatapoolSuggestedType)variable.getSuggestedType(); |
1982 |
IDatapoolSuggestedType suggestedType = (IDatapoolSuggestedType)variable.getSuggestedType(); |
| 1847 |
setVariableType(suggestedType, dialog.getType()); |
1983 |
setVariableType(suggestedType, dialog.getType()); |
| 1848 |
variable.setSuggestedType(suggestedType); |
1984 |
variable.setSuggestedType(suggestedType); |
| 1849 |
int insertionIndex = findColumnIndex(dialog.getInsertionVariableName()); |
1985 |
|
|
|
1986 |
((DPLVariable)variable).setEncrypted(dialog.isEncrypted()); |
| 1987 |
|
| 1988 |
int insertionIndex = findColumnIndex(dialog |
| 1989 |
.getInsertionVariableName()); |
| 1850 |
if(insertionIndex == -1) |
1990 |
if(insertionIndex == -1) |
| 1851 |
insertionIndex = 0; |
1991 |
insertionIndex = 0; |
| 1852 |
|
1992 |
|
|
Lines 1858-1863
Link Here
|
| 1858 |
if (tableCursor != null && !tableCursor.isDisposed() && !(row < 0 || row >= table.getItemCount() || insertionIndex < 0 || insertionIndex > maxColumnIndex)) { |
1998 |
if (tableCursor != null && !tableCursor.isDisposed() && !(row < 0 || row >= table.getItemCount() || insertionIndex < 0 || insertionIndex > maxColumnIndex)) { |
| 1859 |
tableCursor.setSelection(row, insertionIndex + 1); |
1999 |
tableCursor.setSelection(row, insertionIndex + 1); |
| 1860 |
} |
2000 |
} |
|
|
2001 |
refreshRows(); |
| 1861 |
} |
2002 |
} |
| 1862 |
} |
2003 |
} |
| 1863 |
|
2004 |
|
|
Lines 1922-1927
Link Here
|
| 1922 |
* Function that actually does the editing of the variable/column. |
2063 |
* Function that actually does the editing of the variable/column. |
| 1923 |
*/ |
2064 |
*/ |
| 1924 |
private void editColumnAux(TableColumn tableColumn) { |
2065 |
private void editColumnAux(TableColumn tableColumn) { |
|
|
2066 |
boolean isVariableEncrypted = false; |
| 1925 |
try { |
2067 |
try { |
| 1926 |
if (showVariables == false) return; |
2068 |
if (showVariables == false) return; |
| 1927 |
|
2069 |
|
|
Lines 1932-1939
Link Here
|
| 1932 |
IDatapoolVariable previousVariable = null; |
2074 |
IDatapoolVariable previousVariable = null; |
| 1933 |
if (previousTableColumn != null) previousVariable = (IDatapoolVariable) previousTableColumn.getData(TAG_VARIABLE); |
2075 |
if (previousTableColumn != null) previousVariable = (IDatapoolVariable) previousTableColumn.getData(TAG_VARIABLE); |
| 1934 |
IDatapoolVariable variable = (IDatapoolVariable) tableColumn.getData(TAG_VARIABLE); |
2076 |
IDatapoolVariable variable = (IDatapoolVariable) tableColumn.getData(TAG_VARIABLE); |
| 1935 |
DatapoolColumnDialog dialog = new DatapoolColumnDialog(Display.getCurrent().getActiveShell(), datapool, variable, previousVariable, UiPluginResourceBundle.DATA_COL_DLG_TITLE_EDIT); //$NON-NLS-1$ |
2077 |
DatapoolColumnDialog dialog = new DatapoolColumnDialog(Display |
| 1936 |
if (dialog.open() == IDialogConstants.OK_ID) { |
2078 |
.getCurrent().getActiveShell(), datapool, variable, |
|
|
2079 |
previousVariable, |
| 2080 |
UiPluginResourceBundle.DATA_COL_DLG_TITLE_EDIT); //$NON-NLS-1$ |
| 2081 |
isVariableEncrypted = DatapoolEncryptManager.isVariabelEncrypted(variable); |
| 2082 |
String key = null; |
| 2083 |
if (dialog.open() == IDialogConstants.OK_ID) { |
| 2084 |
if (isNeedKeyVerify(dialog,isVariableEncrypted)) {//need to confrim key or assign a new key |
| 2085 |
boolean isCancelChange = false; |
| 2086 |
if(isKeyExist())//key exists means it needs to confirm key |
| 2087 |
{ |
| 2088 |
//if(dialog.isKeyChanged()) |
| 2089 |
//{ |
| 2090 |
//key = dialog.getKey(); |
| 2091 |
//} |
| 2092 |
boolean errorKey = true; |
| 2093 |
|
| 2094 |
if(passwordExist && !dialog.isKeyChanged()){ |
| 2095 |
key = password; |
| 2096 |
}else { |
| 2097 |
if(dialog.isKeyChanged()){ |
| 2098 |
key = dialog.getNewKey(); |
| 2099 |
password = dialog.getNewKey(); |
| 2100 |
passwordExist = true; |
| 2101 |
}else{ |
| 2102 |
DatapoolInputKeyDialog logOnDialog = new DatapoolInputKeyDialog( |
| 2103 |
Display.getCurrent().getActiveShell(), |
| 2104 |
UiPluginResourceBundle.DatapoolDialog_INPUTKEYDIALGOTITLE, |
| 2105 |
datapool); |
| 2106 |
while (errorKey) { |
| 2107 |
int openValue = logOnDialog.open(); |
| 2108 |
if (openValue == IDialogConstants.OK_ID) { |
| 2109 |
key = logOnDialog.getKey(); |
| 2110 |
if (DatapoolEncryptManager.isKeyCorrect(datapool,key)) { |
| 2111 |
errorKey = false; |
| 2112 |
password = key; |
| 2113 |
passwordExist = true; |
| 2114 |
} else {//the input key is incorrect |
| 2115 |
showErrMes(Display.getCurrent() |
| 2116 |
.getActiveShell(), |
| 2117 |
UiPluginResourceBundle.DatapoolDialog_WRONGLOGONKEYMES); |
| 2118 |
} |
| 2119 |
} else if (openValue == IDialogConstants.CANCEL_ID) {// click cancel button |
| 2120 |
isCancelChange = true; |
| 2121 |
errorKey = false; |
| 2122 |
} |
| 2123 |
} |
| 2124 |
} |
| 2125 |
|
| 2126 |
} |
| 2127 |
} |
| 2128 |
else//it should assing a new key |
| 2129 |
{ |
| 2130 |
Shell shell = Display.getCurrent().getActiveShell(); |
| 2131 |
DatapoolChangeKeyDialog assignKeyDialog = new DatapoolChangeKeyDialog( |
| 2132 |
shell, datapool, |
| 2133 |
UiPluginResourceBundle.DatapoolDialog_ASSIGNKEYDIALOGTITLE); |
| 2134 |
boolean errorKey = true; |
| 2135 |
|
| 2136 |
while (errorKey) { |
| 2137 |
|
| 2138 |
if (assignKeyDialog.open() == IDialogConstants.OK_ID) { |
| 2139 |
key = assignKeyDialog.getNewKey(); |
| 2140 |
int ret = assignKeyDialog.isKeyAssignSuccess(); |
| 2141 |
switch (ret) { |
| 2142 |
case DatapoolConstant.NEW_KEY_NULL: |
| 2143 |
showErrMes(shell, |
| 2144 |
UiPluginResourceBundle.DatapoolDialog_NEWKEYNULLMES); |
| 2145 |
break; |
| 2146 |
case DatapoolConstant.NEW_KEY_NOT_CONFIRM: |
| 2147 |
showErrMes( |
| 2148 |
shell, |
| 2149 |
UiPluginResourceBundle.DatapoolDialog_NEWKEYNOTCONFIRMMES); |
| 2150 |
break; |
| 2151 |
case DatapoolConstant.CHANGE_KEY_SUCCESS: |
| 2152 |
try{ |
| 2153 |
DatapoolEncryptManager.changeKey(EncryptionManager.EncoderByMd5(key), |
| 2154 |
datapool); |
| 2155 |
// encryptedCellInVarible(variable,newKey); |
| 2156 |
errorKey = false; |
| 2157 |
|
| 2158 |
password = key; |
| 2159 |
passwordExist = true; |
| 2160 |
}catch(Exception e){} |
| 2161 |
break; |
| 2162 |
default:// error |
| 2163 |
} |
| 2164 |
|
| 2165 |
} else { |
| 2166 |
isCancelChange = true; |
| 2167 |
errorKey = false; |
| 2168 |
} |
| 2169 |
} |
| 2170 |
} |
| 2171 |
if(!isCancelChange)//input the correct key |
| 2172 |
{ |
| 2173 |
if (dialog.isEncrypted()) { |
| 2174 |
if (!isVariableEncrypted) {//encrypted a varible which didn't encrypted |
| 2175 |
DatapoolEncryptManager.encryptedCellInVarible(variable,key,datapool); |
| 2176 |
if(variable instanceof DPLVariable) |
| 2177 |
((DPLVariable)variable).setEncrypted(true); |
| 2178 |
} |
| 2179 |
|
| 2180 |
} else { |
| 2181 |
if (isVariableEncrypted) {//deencrypted a encrypted variable |
| 2182 |
DatapoolEncryptManager.decryptedCellInVarible(variable,key,datapool); |
| 2183 |
if(variable instanceof DPLVariable) |
| 2184 |
((DPLVariable)variable).setEncrypted(false); |
| 2185 |
} |
| 2186 |
} |
| 1937 |
setWaitCursor(); |
2187 |
setWaitCursor(); |
| 1938 |
String name = dialog.getName(); |
2188 |
String name = dialog.getName(); |
| 1939 |
String insertionVariableID = dialog.getInsertionVariableID(); |
2189 |
String insertionVariableID = dialog.getInsertionVariableID(); |
|
Lines 1945-1952
Link Here
|
| 1945 |
variable.setName(dialog.getName()); |
2195 |
variable.setName(dialog.getName()); |
| 1946 |
setVariableType(suggestedType, dialog.getType()); |
2196 |
setVariableType(suggestedType, dialog.getType()); |
| 1947 |
variable.setSuggestedType(suggestedType); |
2197 |
variable.setSuggestedType(suggestedType); |
|
|
2198 |
int insertionIndex = findColumnIndex(dialog |
| 2199 |
.getInsertionVariableName()); |
| 2200 |
if (insertionIndex == columnIndex - 1) { |
| 2201 |
refresh(); |
| 2202 |
return; |
| 2203 |
} |
| 2204 |
if (insertionIndex == -1) |
| 2205 |
datapool.moveVariable(columnIndex - 1, 0); |
| 2206 |
else if (insertionIndex > columnIndex) |
| 2207 |
datapool.moveVariable(columnIndex - 1, |
| 2208 |
insertionIndex - 1); |
| 2209 |
else |
| 2210 |
datapool.moveVariable(columnIndex - 1, insertionIndex); |
| 1948 |
|
2211 |
|
| 1949 |
int insertionIndex = findColumnIndex(dialog.getInsertionVariableName()); |
2212 |
refreshRows();//needs to refresh row |
|
|
2213 |
tableCursor.setSelection(0, 0); |
| 2214 |
} |
| 2215 |
|
| 2216 |
} else { |
| 2217 |
setWaitCursor(); |
| 2218 |
|
| 2219 |
String name = dialog.getName(); |
| 2220 |
String insertionVariableID = dialog |
| 2221 |
.getInsertionVariableID(); |
| 2222 |
|
| 2223 |
IDatapoolSuggestedType suggestedType = (IDatapoolSuggestedType) variable |
| 2224 |
.getSuggestedType(); |
| 2225 |
if (name.equals(variable.getName()) |
| 2226 |
&& insertionVariableID.equals(variable.getId())) { |
| 2227 |
return; |
| 2228 |
} |
| 2229 |
variable.setName(dialog.getName()); |
| 2230 |
setVariableType(suggestedType, dialog.getType()); |
| 2231 |
variable.setSuggestedType(suggestedType); |
| 2232 |
|
| 2233 |
int insertionIndex = findColumnIndex(dialog |
| 2234 |
.getInsertionVariableName()); |
| 1950 |
if (insertionIndex == columnIndex - 1) { |
2235 |
if (insertionIndex == columnIndex - 1) { |
| 1951 |
return; |
2236 |
return; |
| 1952 |
} |
2237 |
} |
|
Lines 1956-1963
Link Here
|
| 1956 |
datapool.moveVariable(columnIndex - 1, insertionIndex - 1); |
2241 |
datapool.moveVariable(columnIndex - 1, insertionIndex - 1); |
| 1957 |
else |
2242 |
else |
| 1958 |
datapool.moveVariable(columnIndex - 1, insertionIndex); |
2243 |
datapool.moveVariable(columnIndex - 1, insertionIndex); |
|
|
2244 |
tableCursor.setSelection(0, 0); |
| 1959 |
} |
2245 |
} |
| 1960 |
} finally { |
2246 |
}} finally { |
| 1961 |
unsetWaitCursor(); |
2247 |
unsetWaitCursor(); |
| 1962 |
} |
2248 |
} |
| 1963 |
} |
2249 |
} |
|
Lines 2890-2896
Link Here
|
| 2890 |
IDatapoolVariable cellVariable = (IDatapoolVariable)cell.getCellVariable(); |
3176 |
IDatapoolVariable cellVariable = (IDatapoolVariable)cell.getCellVariable(); |
| 2891 |
int index = findColumnIndex(cellVariable.getName()); |
3177 |
int index = findColumnIndex(cellVariable.getName()); |
| 2892 |
String cellValue = cell.getStringValue(); |
3178 |
String cellValue = cell.getStringValue(); |
| 2893 |
ValueObject valueObject = new ValueObject(cell.getCellValue()); |
3179 |
if(DatapoolEncryptManager.isVariabelEncrypted(cell.getCellVariable())) |
|
|
3180 |
{ |
| 3181 |
cellValue = DatapoolConstant.DatapoolDialog_ENCRYPTEDDISPLAYVALUE; |
| 3182 |
} |
| 3183 |
// ValueObject valueObject = new ValueObject(cell.getCellValue()); |
| 3184 |
ValueObject valueObject = new ValueObject(cellValue); |
| 2894 |
if(valueObject != null) |
3185 |
if(valueObject != null) |
| 2895 |
cellValue = valueObject.getDescription(); |
3186 |
cellValue = valueObject.getDescription(); |
| 2896 |
rowContents[index] = cellValue; |
3187 |
rowContents[index] = cellValue; |
|
Lines 3013-3016
Link Here
|
| 3013 |
setMenuMode(datapoolMenuManager); |
3304 |
setMenuMode(datapoolMenuManager); |
| 3014 |
} |
3305 |
} |
| 3015 |
|
3306 |
|
|
|
3307 |
public void setPassword(String password){ |
| 3308 |
this.password = password; |
| 3309 |
} |
| 3310 |
private void showErrMes(Shell shell, String mes) { |
| 3311 |
MessageDialog.openError(shell, UiPluginResourceBundle.DatapoolDialog_ERRORDIALOGTITLE, mes); |
| 3312 |
} |
| 3313 |
|
| 3314 |
private boolean isNeedKeyVerify(DatapoolColumnDialog dialog,boolean isVariableEncrypted) |
| 3315 |
{ |
| 3316 |
return dialog.isEncrypted() || isVariableEncrypted; |
| 3317 |
} |
| 3318 |
private boolean isKeyExist() |
| 3319 |
{ |
| 3320 |
return (datapool instanceof DPLDatapool)?(((DPLDatapool)datapool).getChallenge()!=null):false; |
| 3321 |
} |
| 3016 |
} |
3322 |
} |