private void handleDeleteFile() { Object selection = ((TreeSelection) fileTree.getSelection()).getFirstElement(); if (!(selection instanceof IFile)) return; IFile file = (IFile) selection; int option = new MessageDialog( getShell(), "Delete " + file.getName() + "?", null, "Are you sure you want to delete " + "the configuration file: " + file.getName() + "?", MessageDialog.QUESTION, new String[] {"Yes", "No"}, 1) .open(); if (option != 0) return; try { file.delete(true, true, null); } catch (CoreException e) { VJP.logError("Could not delete file.", e); } updateTree(); }
/** Handles the verify action. Checks whether is can be done or not. */ private void handleVerify(boolean step) { if (!shouldVerify()) return; TreeSelection s = ((TreeSelection) (fileTree.getSelection())); TreeProject p = (TreeProject) s.getPaths()[0].getFirstSegment(); Object o = s.getFirstElement(); if (!(o instanceof IFile)) return; VerifyJob.verify((IFile) o, p.java_project, step); close(); }