use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class LoginProjectPage method refreshUIFinishButtonEnable.
protected void refreshUIFinishButtonEnable() {
boolean enabled = true;
if (FINISH_ACTION_OPEN_PROJECT.equals(finishButtonAction)) {
Object input = projectViewer.getInput();
enabled = input != null && ((input instanceof Project[]) && ((Project[]) input).length > 0);
if (getErrorManager().hasError()) {
enabled = false;
}
} else if (FINISH_ACTION_UPDATE.equals(finishButtonAction)) {
enabled = true;
} else if (FINISH_ACTION_UPDATE_DETAILS.equals(finishButtonAction)) {
enabled = true;
} else if (FINISH_ACTION_RESTART.equals(finishButtonAction)) {
enabled = true;
} else {
enabled = false;
}
refreshUIFinishButtonEnable(enabled);
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class LoginProjectPage method createNewProject.
protected void createNewProject() {
IProxyRepositoryFactory repositoryFactory = ProxyRepositoryFactory.getInstance();
Context ctx = CorePlugin.getContext();
RepositoryContext repositoryContext = (RepositoryContext) ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
try {
Project projectInfor = //$NON-NLS-1$
ProjectHelper.createProject(//$NON-NLS-1$
newProjectName.getText().trim().replace(' ', '_'), //$NON-NLS-1$
"", ECodeLanguage.JAVA.getName(), repositoryContext.getUser());
Project project = repositoryFactory.createProject(projectInfor);
resetProjectOperationSelectionWithBusyCursor(false);
fillUIProjectListWithBusyCursor();
selectProject(project.getLabel());
checkErrors();
//$NON-NLS-1$
newProjectName.setText("");
} catch (PersistenceException e) {
MessageDialog.openError(getShell(), Messages.getString("NewProjectWizard.failureTitle"), //$NON-NLS-1$
Messages.getString(//$NON-NLS-1$
"NewProjectWizard.failureText"));
MessageBoxExceptionHandler.process(e);
} catch (JSONException e) {
// TODO Auto-generated catch block
ExceptionHandler.process(e);
}
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class VisibleComponentSettingsMigrationTask method execute.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.migration.AbstractItemMigrationTask#execute(org.talend.core.model.properties.Item)
*/
@Override
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
IDesignerCoreService designerCoreService = CorePlugin.getDefault().getDesignerCoreService();
Project currentProject = ProjectManager.getInstance().getCurrentProject();
List<ComponentSetting> componentsSettings = (List<ComponentSetting>) currentProject.getEmfProject().getComponentsSettings();
boolean modified = false;
if (processType != null) {
EList nodes = processType.getNode();
for (Object node : nodes) {
NodeType nodeType = (NodeType) node;
for (ComponentSetting setting : componentsSettings) {
if (setting.getName().equals(nodeType.getComponentName())) {
if (setting.isHidden()) {
setting.setHidden(false);
modified = true;
}
}
}
}
}
if (modified) {
IProxyRepositoryFactory prf = CorePlugin.getDefault().getProxyRepositoryFactory();
try {
prf.saveProject(currentProject);
} catch (Exception ex) {
ExceptionHandler.process(ex);
return ExecutionResult.FAILURE;
}
return ExecutionResult.SUCCESS_NO_ALERT;
}
return ExecutionResult.NOTHING_TO_DO;
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class ProjectSettingsWizard method addPages.
@Override
public void addPages() {
Project pro = ProjectManager.getInstance().getCurrentProject();
//$NON-NLS-1$
mainPage = new ProjectSettingsWizardPage("WizardPage", pro);
addPage(mainPage);
//$NON-NLS-1$
setWindowTitle(Messages.getString("ProjectSettingsWizard.EditProjectPageTitle"));
}
use of org.talend.core.model.general.Project in project tesb-studio-se by Talend.
the class CamelFeatureUtil method getJobProjectName.
private static String getJobProjectName(String jobId, String jobName, String defaultProject) {
if (jobId == null || jobId.isEmpty()) {
return defaultProject;
}
if (jobName == null || jobName.isEmpty()) {
return defaultProject;
}
IRepositoryNode referencedJobNode = null;
Project referenceProject = null;
try {
List<Project> projects = ProjectManager.getInstance().getAllReferencedProjects();
if (projects == null) {
return defaultProject;
}
for (Project p : projects) {
List<IRepositoryViewObject> jobs = ProxyRepositoryFactory.getInstance().getAll(p, ERepositoryObjectType.PROCESS);
if (jobs == null) {
continue;
}
for (IRepositoryViewObject job : jobs) {
if (job.getId().equals(jobId)) {
referencedJobNode = new RepositoryNode(job, null, IRepositoryNode.ENodeType.REPOSITORY_ELEMENT);
referenceProject = p;
break;
}
}
if (referenceProject != null) {
break;
}
}
} catch (PersistenceException e) {
return defaultProject;
}
if (referencedJobNode == null) {
return defaultProject;
}
Property p = referencedJobNode.getObject().getProperty();
String jobNameFound = p.getDisplayName();
String jobLabelFound = p.getLabel();
if ((jobNameFound == null || !jobNameFound.equals(jobName)) && (jobLabelFound == null || !jobNameFound.equals(jobName))) {
return defaultProject;
}
if (referenceProject != null) {
return referenceProject.getLabel().toLowerCase();
}
return defaultProject;
}
Aggregations