use of org.eclipse.core.runtime.Status in project tdi-studio-se by Talend.
the class NewImportProjectWizardPage method checkFieldsValue.
/**
* DOC ocarbone Comment method "checkField".
*/
protected void checkFieldsValue() {
// Field Name
if (nameText.getText().length() == 0) {
nameStatus = new Status(IStatus.ERROR, RepositoryPlugin.PLUGIN_ID, IStatus.OK, Messages.getString("NewProjectWizardPage.nameEmpty"), //$NON-NLS-1$
null);
} else {
// for bug 11214
if (!nameText.getText().endsWith(" ")) {
//$NON-NLS-1$
technicalNameText.setText(Project.createTechnicalName(nameText.getText()));
}
if (ProjectUtils.isNotValidProjectName(nameText.getText())) {
nameStatus = new Status(IStatus.ERROR, RepositoryPlugin.PLUGIN_ID, IStatus.OK, Messages.getString("NewProjectWizardPage.illegalCharacter"), //$NON-NLS-1$
null);
} else {
if (isProjectNameAlreadyUsed(nameText.getText())) {
nameStatus = new Status(IStatus.ERROR, RepositoryPlugin.PLUGIN_ID, IStatus.OK, Messages.getString("NewProjectWizardPage.projectNameAlredyExists"), //$NON-NLS-1$
null);
} else {
nameStatus = createOkStatus();
// Field description
descriptionStatus = createOkStatus();
// Combo language
if (!languageJavaRadio.getSelection() && !languagePerlRadio.getSelection()) {
languageStatus = new Status(IStatus.ERROR, RepositoryPlugin.PLUGIN_ID, IStatus.OK, //$NON-NLS-1$
Messages.getString("NewProjectWizardPage.languageEmpty"), null);
} else if (!languageEnable(getLanguage())) {
languageStatus = new Status(IStatus.ERROR, RepositoryPlugin.PLUGIN_ID, IStatus.WARNING, //$NON-NLS-1$
Messages.getString("NewProjectWizard.error.languageNotSupported", getLanguage()), null);
} else {
languageStatus = createOkStatus();
}
}
}
}
updatePageStatus();
}
use of org.eclipse.core.runtime.Status in project tdi-studio-se by Talend.
the class ImportProjectAsWizardPage method evaluateSpecifiedPath.
private void evaluateSpecifiedPath(String path) {
if (path.equals(lastPath)) {
return;
}
// on an empty path empty selectedProjects
if (path == null || path.length() == 0) {
checkFieldsValue();
return;
}
final boolean dirSelected = this.projectFromDirectoryRadio.getSelection();
File directory = new File(path);
Collection projectFiles = new ArrayList();
Collection talendProjectFiles = new ArrayList();
if (!dirSelected && ArchiveFileManipulations.isTarFile(path)) {
TarFile sourceTarFile = getSpecifiedTarSourceFile(path);
if (sourceTarFile == null) {
return;
}
TarLeveledStructureProvider provider = new TarLeveledStructureProvider(sourceTarFile);
Object child = provider.getRoot();
if (!ImportProjectsUtilities.collectProjectFilesFromProvider(projectFiles, provider, child, 0, null, IProjectDescription.DESCRIPTION_FILE_NAME)) {
return;
}
if (!ImportProjectsUtilities.collectProjectFilesFromProvider(talendProjectFiles, provider, child, 0, null, FileConstants.LOCAL_PROJECT_FILENAME)) {
return;
}
if (!ImportProjectsUtilities.collectProjectFilesFromProvider(talendProjectFiles, provider, child, 0, null, FileConstants.OLD_TALEND_PROJECT_FILENAME)) {
return;
}
} else if (!dirSelected && ArchiveFileManipulations.isZipFile(path)) {
ZipFile sourceFile = getSpecifiedZipSourceFile(path);
if (sourceFile == null) {
return;
}
ZipLeveledStructureProvider provider = new ZipLeveledStructureProvider(sourceFile);
Object child = provider.getRoot();
if (!ImportProjectsUtilities.collectProjectFilesFromProvider(projectFiles, provider, child, 0, null, IProjectDescription.DESCRIPTION_FILE_NAME)) {
return;
}
if (!ImportProjectsUtilities.collectProjectFilesFromProvider(talendProjectFiles, provider, child, 0, null, FileConstants.LOCAL_PROJECT_FILENAME)) {
return;
}
if (!ImportProjectsUtilities.collectProjectFilesFromProvider(talendProjectFiles, provider, child, 0, null, FileConstants.OLD_TALEND_PROJECT_FILENAME)) {
return;
}
} else if (dirSelected && directory.isDirectory()) {
if (!ImportProjectsUtilities.collectProjectFilesFromDirectory(projectFiles, directory, null, IProjectDescription.DESCRIPTION_FILE_NAME)) {
return;
}
if (!ImportProjectsUtilities.collectProjectFilesFromDirectory(talendProjectFiles, directory, null, FileConstants.LOCAL_PROJECT_FILENAME)) {
return;
}
if (!ImportProjectsUtilities.collectProjectFilesFromDirectory(talendProjectFiles, directory, null, FileConstants.OLD_TALEND_PROJECT_FILENAME)) {
return;
}
}
lastPath = path;
if (projectFiles.size() != 1 || talendProjectFiles.size() != 1) {
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
String string = //$NON-NLS-1$
Messages.getString(//$NON-NLS-1$
"ImportProjectAsWizardPage.error.notATalendProject", brandingService.getShortProductName());
fileContentStatus = new Status(IStatus.ERROR, RepositoryPlugin.PLUGIN_ID, IStatus.OK, string, null);
} else {
fileContentStatus = createOkStatus();
}
checkFieldsValue();
}
use of org.eclipse.core.runtime.Status in project tdi-studio-se by Talend.
the class NewProjectWizardPage method checkFieldsValue.
/**
* DOC ocarbone Comment method "checkField".
*/
protected void checkFieldsValue() {
// Field Name
if (nameText.getText().length() == 0) {
// for bug TDI-6993
technicalNameText.setText("");
nameStatus = new Status(IStatus.ERROR, RepositoryPlugin.PLUGIN_ID, IStatus.OK, Messages.getString("NewProjectWizardPage.nameEmpty"), //$NON-NLS-1$
null);
} else {
// for bug 11214
if (!nameText.getText().endsWith(" ")) {
//$NON-NLS-1$
technicalNameText.setText(Project.createTechnicalName(nameText.getText()));
}
if (ProjectUtils.isNotValidProjectName(nameText.getText())) {
//$NON-NLS-1$
nameStatus = new Status(IStatus.ERROR, RepositoryPlugin.PLUGIN_ID, IStatus.OK, Messages.getString("NewProjectWizardPage.illegalCharacter"), //$NON-NLS-1$
null);
} else {
if (isProjectNameAlreadyUsed(nameText.getText())) {
nameStatus = new Status(IStatus.ERROR, RepositoryPlugin.PLUGIN_ID, IStatus.OK, Messages.getString("NewProjectWizardPage.projectNameAlredyExists"), //$NON-NLS-1$
null);
} else {
nameStatus = createOkStatus();
// Field description
descriptionStatus = createOkStatus();
// Combo language
if (!languageJavaRadio.getSelection() && !languagePerlRadio.getSelection()) {
languageStatus = new Status(IStatus.ERROR, RepositoryPlugin.PLUGIN_ID, IStatus.OK, //$NON-NLS-1$
Messages.getString("NewProjectWizardPage.languageEmpty"), null);
} else if (!languageEnable(getLanguage())) {
languageStatus = new Status(IStatus.ERROR, RepositoryPlugin.PLUGIN_ID, IStatus.WARNING, //$NON-NLS-1$
Messages.getString("NewProjectWizard.error.languageNotSupported", getLanguage()), null);
} else {
languageStatus = createOkStatus();
}
}
}
}
updatePageStatus();
}
use of org.eclipse.core.runtime.Status in project tesb-studio-se by Talend.
the class Activator method copyConfigs.
private void copyConfigs() throws CoreException, IOException, URISyntaxException {
// find ESB configuration files folder in plug-in
URL esbConfigsFolderUrl = FileLocator.find(getBundle(), new Path("esb"), null);
if (null == esbConfigsFolderUrl) {
getLog().log(new Status(IStatus.WARNING, getBundle().getSymbolicName(), "cannot find ESB configuration files"));
return;
}
// resolve plug-in ESB config folder URL into file protocol URL
esbConfigsFolderUrl = FileLocator.toFileURL(esbConfigsFolderUrl);
// create ESB configuration folder under Studio instalation
IFileSystem fileSystem = EFS.getLocalFileSystem();
IFileStore esbConfigsTargetFolder = fileSystem.getStore(EsbConfigUtils.getEclipseEsbFolder().toURI());
esbConfigsTargetFolder = esbConfigsTargetFolder.mkdir(EFS.SHALLOW, null);
// retrieve all ESB configuration files packed inside plug-in
File fileEsbConfigFolder = new File(esbConfigsFolderUrl.getPath());
IFileStore esbConfigsFolderStore = fileSystem.getStore(fileEsbConfigFolder.toURI());
IFileStore[] esbConfigsFolderStoreChildren = esbConfigsFolderStore.childStores(EFS.NONE, null);
if (0 == esbConfigsFolderStoreChildren.length) {
getLog().log(new Status(IStatus.WARNING, getBundle().getSymbolicName(), "cannot find any ESB configuration files"));
return;
}
// try to copy ESB configuration files (without overwriting)
for (IFileStore esbConfigFileStore : esbConfigsFolderStoreChildren) {
if (!esbConfigFileStore.fetchInfo().isDirectory()) {
String esbConfigFileName = esbConfigFileStore.fetchInfo().getName();
try {
esbConfigFileStore.copy(esbConfigsTargetFolder.getChild(esbConfigFileName), EFS.NONE, null);
} catch (CoreException e) {
// ignore to do not overwrite possible user changes in configuration files
return;
}
} else {
String esbConfigFileName = esbConfigFileStore.fetchInfo().getName();
if ("microservice".equals(esbConfigFileName) && PluginChecker.isTIS()) {
try {
esbConfigFileStore.copy(esbConfigsTargetFolder.getChild(esbConfigFileName), EFS.NONE, null);
} catch (CoreException e) {
// ignore to do not overwrite possible user changes in configuration files
return;
}
}
}
}
}
use of org.eclipse.core.runtime.Status in project tdi-studio-se by Talend.
the class ShadowFilePreview method preview.
/*
* (non-Javadoc)
*
* @see org.talend.repository.preview.filedelimited.IFileDelimitedPreview#
* preview(org.talend.repository.preview.filedelimited.ProcessDescription)
*/
public CsvArray preview(IProcessDescription description, String type) throws CoreException {
CsvArray res = null;
EShadowProcessType typeShadow = EShadowProcessType.valueOf(type);
shadowProcess = new ShadowProcess<IProcessDescription>(description, typeShadow);
try {
res = shadowProcess.run();
} catch (ProcessorException e) {
Status status = new Status(Status.ERROR, RunProcessPlugin.PLUGIN_ID, Status.OK, e.getMessage(), e);
RunProcessPlugin.getDefault().getLog().log(status);
throw new CoreException(status);
}
return res;
}
Aggregations