private static void tryRemoveSecureProperties(String serverNodeName) { ISecurePreferences secureServersNode = getSecureServersNode(); if (secureServersNode.nodeExists(serverNodeName)) { secureServersNode.node(serverNodeName).removeNode(); } }
public boolean flush(String newServerId) { String oldServerId = getServerId(); if (oldServerId != null && !oldServerId.equals(newServerId)) { initialize(); ISecurePreferences preferences = getSecurePreferences(); if (preferences != null) { preferences.removeNode(); } } this.serverId = newServerId; ISecurePreferences preferences = getSecurePreferences(); if (preferences != null) { try { preferences.put(KEY_USERNAME, username, true); preferences.put(KEY_PASSWORD, password, true); return true; } catch (StorageException e) { disableSecurePreferences(e); } } return false; }
public void run() { TreeSelection selection = (TreeSelection) nodeTreeViewer.getSelection(); Object selected = selection.getFirstElement(); if (selected instanceof ISecurePreferences) { ISecurePreferences node = (ISecurePreferences) selected; ISecurePreferences parentNode = node.parent(); if (parentNode == null) return; // can't remove root node node.removeNode(); parentView.modified(); // refresh parent node and select it nodeTreeViewer.refresh(parentNode, false); nodeTreeViewer.setSelection(new StructuredSelection(parentNode), true); } } };
public void run() { TreeSelection selection = (TreeSelection) nodeTreeViewer.getSelection(); Object selected = selection.getFirstElement(); if (selected instanceof ISecurePreferences) { ISecurePreferences node = (ISecurePreferences) selected; ISecurePreferences parentNode = node.parent(); if (parentNode == null) return; // can't remove root node node.removeNode(); parentView.modified(); // refresh parent node and select it nodeTreeViewer.refresh(parentNode, false); nodeTreeViewer.setSelection(new StructuredSelection(parentNode), true); } } };
protected void deteleDefaultStorage() { URL location = InternalExchangeUtils.defaultStorageLocation(); if (location == null) return; MessageBox messageBox = new MessageBox(shell, SWT.YES | SWT.NO); messageBox.setText(SecUIMessages.generalDialogTitle); messageBox.setMessage(SecUIMessages.confirmDeleteMsg); if (messageBox.open() != SWT.YES) return; // clear the data structure itself in case somebody holds on to it ISecurePreferences defaultStorage = SecurePreferencesFactory.getDefault(); defaultStorage.clear(); defaultStorage.removeNode(); // clear it from the list of open storages, delete the file InternalExchangeUtils.defaultStorageDelete(); if (nodesView != null) nodesView.postDeleted(); // suggest restart in case somebody holds on to the deleted storage MessageBox postDeletionBox = new MessageBox(shell, SWT.YES | SWT.NO); postDeletionBox.setText(SecUIMessages.generalDialogTitle); postDeletionBox.setMessage(SecUIMessages.postDeleteMsg); int result = postDeletionBox.open(); if (result == SWT.YES) PlatformUI.getWorkbench().restart(); }
protected void deteleDefaultStorage() { URL location = InternalExchangeUtils.defaultStorageLocation(); if (location == null) return; MessageBox messageBox = new MessageBox(shell, SWT.YES | SWT.NO); messageBox.setText(SecUIMessages.generalDialogTitle); messageBox.setMessage(SecUIMessages.confirmDeleteMsg); if (messageBox.open() != SWT.YES) return; // clear the data structure itself in case somebody holds on to it ISecurePreferences defaultStorage = SecurePreferencesFactory.getDefault(); defaultStorage.clear(); defaultStorage.removeNode(); // clear it from the list of open storages, delete the file InternalExchangeUtils.defaultStorageDelete(); if (nodesView != null) nodesView.postDeleted(); // suggest restart in case somebody holds on to the deleted storage MessageBox postDeletionBox = new MessageBox(shell, SWT.YES | SWT.NO); postDeletionBox.setText(SecUIMessages.generalDialogTitle); postDeletionBox.setMessage(SecUIMessages.postDeleteMsg); int result = postDeletionBox.open(); if (result == SWT.YES) PlatformUI.getWorkbench().restart(); }
prefNode.removeNode(); try { prefNode.flush();
prefNode.removeNode(); try { prefNode.flush();