protected void export(ISecurePreferences node, PrintStream stream) { if (IStorageConst.PROVIDER_NODE.equals(node.absolutePath())) return; // skip internal node String[] keys = node.keys(); if (keys.length > 0) { String header = '[' + node.absolutePath() + ']'; stream.println(header); for (int i = 0; i < keys.length; i++) { try { String data = keys[i] + " := " + node.get(keys[i], ""); //$NON-NLS-1$ //$NON-NLS-2$ stream.println(data); } catch (StorageException e) { Activator.log(IStatus.ERROR, SecUIMessages.failedDecrypt, null, e); } } } String[] children = node.childrenNames(); for (int i = 0; i < children.length; i++) { export(node.node(children[i]), stream); } }
protected void export(ISecurePreferences node, PrintStream stream) { if (IStorageConst.PROVIDER_NODE.equals(node.absolutePath())) return; // skip internal node String[] keys = node.keys(); if (keys.length > 0) { String header = '[' + node.absolutePath() + ']'; stream.println(header); for (int i = 0; i < keys.length; i++) { try { String data = keys[i] + " := " + node.get(keys[i], ""); //$NON-NLS-1$ //$NON-NLS-2$ stream.println(data); } catch (StorageException e) { Activator.log(IStatus.ERROR, SecUIMessages.failedDecrypt, null, e); } } } String[] children = node.childrenNames(); for (int i = 0; i < children.length; i++) { export(node.node(children[i]), stream); } }
} catch (StorageException e) { String msg = NLS.bind(SecAuthMessages.decryptingError, keys[i], node.absolutePath()); AuthPlugin.getDefault().logError(msg, e); processedOK = false; elements.add(new TmpElement(node.absolutePath(), map));
} catch (StorageException e) { String msg = NLS.bind(SecAuthMessages.decryptingError, keys[i], node.absolutePath()); AuthPlugin.getDefault().logError(msg, e); processedOK = false; elements.add(new TmpElement(node.absolutePath(), map));
public void menuAboutToShow(IMenuManager manager) { boolean canRemove = false; boolean canAdd = false; TreeSelection selection = (TreeSelection) nodeTreeViewer.getSelection(); Object selected = selection.getFirstElement(); if (selected instanceof ISecurePreferences) { ISecurePreferences node = (ISecurePreferences) selected; boolean isRoot = (node.parent() == null); boolean isInternal = node.absolutePath().startsWith(IStorageConst.PROVIDER_NODE); canRemove = (!isRoot && !isInternal); canAdd = !isInternal; } removeNodeAction.setEnabled(canRemove); addNodeAction.setEnabled(canAdd); } });
} catch (StorageException e) { String msg = NLS.bind(SecAuthMessages.encryptingError, key, node.absolutePath()); AuthPlugin.getDefault().logError(msg, e); result = false;
} catch (StorageException e) { String msg = NLS.bind(SecAuthMessages.encryptingError, key, node.absolutePath()); AuthPlugin.getDefault().logError(msg, e); result = false;
private void hookContextMenu() { MenuManager menuMgr = new MenuManager(SecUIMessages.nodesContextMenu); menuMgr.addMenuListener(manager -> { boolean canRemove = false; boolean canAdd = false; TreeSelection selection = (TreeSelection) nodeTreeViewer.getSelection(); Object selected = selection.getFirstElement(); if (selected instanceof ISecurePreferences) { ISecurePreferences node = (ISecurePreferences) selected; boolean isRoot = (node.parent() == null); boolean isInternal = node.absolutePath().startsWith(IStorageConst.PROVIDER_NODE); canRemove = (!isRoot && !isInternal); canAdd = !isInternal; } removeNodeAction.setEnabled(canRemove); addNodeAction.setEnabled(canAdd); }); Menu menu = menuMgr.createContextMenu(nodeTreeViewer.getControl()); nodeTreeViewer.getControl().setMenu(menu); // fill context menu menuMgr.add(refreshNodesAction); menuMgr.add(new Separator()); menuMgr.add(addNodeAction); menuMgr.add(removeNodeAction); }
return; boolean isInternal = selectedNode.absolutePath().startsWith(IStorageConst.PROVIDER_NODE); addValueAction.setEnabled(!isInternal); removeValueAction.setEnabled(!isInternal);
return; boolean isInternal = selectedNode.absolutePath().startsWith(IStorageConst.PROVIDER_NODE); addValueAction.setEnabled(!isInternal); removeValueAction.setEnabled(!isInternal);