use of org.talend.core.model.properties.Project in project tdq-studio-se by Talend.
the class ExportWizardPage method canFinish.
/**
* check if the output path is correct.
*
* @return
*/
public boolean canFinish() {
String lastPath = writer.getBasePath().toString();
if (lastPath == null || PluginConstant.EMPTY_STRING.equals(lastPath)) {
// $NON-NLS-1$//$NON-NLS-2$
MessageDialog.openError(getShell(), "Error", Messages.getString("ExportWizardPage.emptyPath"));
return false;
}
ProjectManager pManager = ProjectManager.getInstance();
Project project = pManager.getCurrentProject().getEmfProject();
// $NON-NLS-1$
File outputDir = new File(lastPath + File.separator + project.getTechnicalLabel());
// if the file exists,pop an dialog to ask that it will override the old file.
if ((dirBTN.getSelection() && outputDir.exists()) || (archBTN.getSelection() && new File(archTxt.getText().trim()).exists())) {
File oldFile = outputDir.exists() ? outputDir : new File(archTxt.getText().trim());
if (MessageDialogWithToggle.openConfirm(null, Messages.getString("ExportWizard.waring"), Messages.getString("ExportWizard.fileAlreadyExist"))) {
// $NON-NLS-1$ //$NON-NLS-2$
FileUtils.deleteQuietly(oldFile);
} else {
return false;
}
}
return true;
}
Aggregations