|
Lines 31-36
Link Here
|
| 31 |
public class ValuesView { |
31 |
public class ValuesView { |
| 32 |
|
32 |
|
| 33 |
/** |
33 |
/** |
|
|
34 |
* The default value of this variable (false, meaning "not in debug of secure storage" |
| 35 |
* removes showValueAction, encryptValueAction, and decryptValueAction. |
| 36 |
*/ |
| 37 |
static private boolean inDevelopmentMode = false; |
| 38 |
|
| 39 |
/** |
| 34 |
* Line to show for encrypted values |
40 |
* Line to show for encrypted values |
| 35 |
*/ |
41 |
*/ |
| 36 |
private final static String ENCRYPTED_SUBSTITUTE = "**********"; //$NON-NLS-1$ |
42 |
private final static String ENCRYPTED_SUBSTITUTE = "**********"; //$NON-NLS-1$ |
|
Lines 42-50
Link Here
|
| 42 |
|
48 |
|
| 43 |
protected Action addValueAction; |
49 |
protected Action addValueAction; |
| 44 |
protected Action removeValueAction; |
50 |
protected Action removeValueAction; |
| 45 |
protected Action showValueAction; |
51 |
protected Action showValueAction = null; |
| 46 |
protected Action encryptValueAction; |
52 |
protected Action encryptValueAction = null; |
| 47 |
protected Action decryptValueAction; |
53 |
protected Action decryptValueAction = null; |
| 48 |
|
54 |
|
| 49 |
protected Shell shell; |
55 |
protected Shell shell; |
| 50 |
|
56 |
|
|
Lines 180-188
Link Here
|
| 180 |
boolean isInternal = selectedNode.absolutePath().startsWith(IStorageConst.PROVIDER_NODE); |
186 |
boolean isInternal = selectedNode.absolutePath().startsWith(IStorageConst.PROVIDER_NODE); |
| 181 |
addValueAction.setEnabled(!isInternal); |
187 |
addValueAction.setEnabled(!isInternal); |
| 182 |
removeValueAction.setEnabled(!isInternal); |
188 |
removeValueAction.setEnabled(!isInternal); |
| 183 |
encryptValueAction.setEnabled(!isInternal); |
189 |
if (encryptValueAction != null) |
| 184 |
decryptValueAction.setEnabled(!isInternal); |
190 |
encryptValueAction.setEnabled(!isInternal); |
| 185 |
showValueAction.setEnabled(false); |
191 |
if (decryptValueAction != null) |
|
|
192 |
decryptValueAction.setEnabled(!isInternal); |
| 193 |
if (showValueAction != null) |
| 194 |
showValueAction.setEnabled(false); |
| 186 |
|
195 |
|
| 187 |
// enablement of encrypted/decrypted |
196 |
// enablement of encrypted/decrypted |
| 188 |
StructuredSelection selection = (StructuredSelection) tableViewer.getSelection(); |
197 |
StructuredSelection selection = (StructuredSelection) tableViewer.getSelection(); |
|
Lines 191-199
Link Here
|
| 191 |
String key = ((TableValuesElement) selected).getKey(); |
200 |
String key = ((TableValuesElement) selected).getKey(); |
| 192 |
try { |
201 |
try { |
| 193 |
boolean encrypted = selectedNode.isEncrypted(key); |
202 |
boolean encrypted = selectedNode.isEncrypted(key); |
| 194 |
encryptValueAction.setEnabled(!isInternal && !encrypted); |
203 |
if (encryptValueAction != null) |
| 195 |
decryptValueAction.setEnabled(!isInternal && encrypted); |
204 |
encryptValueAction.setEnabled(!isInternal && !encrypted); |
| 196 |
showValueAction.setEnabled(encrypted); |
205 |
if (decryptValueAction != null) |
|
|
206 |
decryptValueAction.setEnabled(!isInternal && encrypted); |
| 207 |
if (showValueAction != null) |
| 208 |
showValueAction.setEnabled(encrypted); |
| 197 |
} catch (StorageException e) { |
209 |
} catch (StorageException e) { |
| 198 |
Activator.log(IStatus.ERROR, SecUIMessages.failedDecrypt, null, e); |
210 |
Activator.log(IStatus.ERROR, SecUIMessages.failedDecrypt, null, e); |
| 199 |
} |
211 |
} |
|
Lines 206-216
Link Here
|
| 206 |
// fill context menu |
218 |
// fill context menu |
| 207 |
menuMgr.add(addValueAction); |
219 |
menuMgr.add(addValueAction); |
| 208 |
menuMgr.add(removeValueAction); |
220 |
menuMgr.add(removeValueAction); |
| 209 |
menuMgr.add(new Separator()); |
221 |
if (showValueAction != null) { |
| 210 |
menuMgr.add(showValueAction); |
222 |
menuMgr.add(new Separator()); |
| 211 |
menuMgr.add(new Separator()); |
223 |
menuMgr.add(showValueAction); |
| 212 |
menuMgr.add(encryptValueAction); |
224 |
} |
| 213 |
menuMgr.add(decryptValueAction); |
225 |
if (encryptValueAction != null) { |
|
|
226 |
menuMgr.add(new Separator()); |
| 227 |
menuMgr.add(encryptValueAction); |
| 228 |
} |
| 229 |
if (decryptValueAction != null) |
| 230 |
menuMgr.add(decryptValueAction); |
| 214 |
} |
231 |
} |
| 215 |
|
232 |
|
| 216 |
private void makeActions() { |
233 |
private void makeActions() { |
|
Lines 264-269
Link Here
|
| 264 |
removeValueAction.setToolTipText(SecUIMessages.removeValueCommandTmp); |
281 |
removeValueAction.setToolTipText(SecUIMessages.removeValueCommandTmp); |
| 265 |
removeValueAction.setImageDescriptor(ImageDescriptor.createFromFile(NodesView.class, "/icons/storage/value_delete.gif")); //$NON-NLS-1$ |
282 |
removeValueAction.setImageDescriptor(ImageDescriptor.createFromFile(NodesView.class, "/icons/storage/value_delete.gif")); //$NON-NLS-1$ |
| 266 |
|
283 |
|
|
|
284 |
if (inDevelopmentMode) |
| 285 |
addDevelopmentMenuOptions(); |
| 286 |
} |
| 287 |
|
| 288 |
private void addDevelopmentMenuOptions() { |
| 267 |
showValueAction = new Action() { |
289 |
showValueAction = new Action() { |
| 268 |
public void run() { |
290 |
public void run() { |
| 269 |
if (selectedNode == null) |
291 |
if (selectedNode == null) |