Search in sources :

Example 76 with Project

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);
}
Also used : Project(org.talend.core.model.general.Project) JSONObject(org.talend.utils.json.JSONObject)

Example 77 with Project

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);
    }
}
Also used : RepositoryContext(org.talend.core.context.RepositoryContext) Context(org.talend.core.context.Context) Project(org.talend.core.model.general.Project) RepositoryContext(org.talend.core.context.RepositoryContext) PersistenceException(org.talend.commons.exception.PersistenceException) JSONException(org.talend.utils.json.JSONException) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 78 with Project

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;
}
Also used : Project(org.talend.core.model.general.Project) ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) EList(org.eclipse.emf.common.util.EList) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) EList(org.eclipse.emf.common.util.EList) List(java.util.List) IDesignerCoreService(org.talend.designer.core.IDesignerCoreService) ComponentSetting(org.talend.core.model.properties.ComponentSetting) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 79 with Project

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"));
}
Also used : Project(org.talend.core.model.general.Project)

Example 80 with Project

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;
}
Also used : Project(org.talend.core.model.general.Project) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Property(org.talend.core.model.properties.Property)

Aggregations

Project (org.talend.core.model.general.Project)94 PersistenceException (org.talend.commons.exception.PersistenceException)47 IProject (org.eclipse.core.resources.IProject)38 File (java.io.File)18 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)18 ArrayList (java.util.ArrayList)17 IOException (java.io.IOException)13 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)13 RepositoryContext (org.talend.core.context.RepositoryContext)12 Property (org.talend.core.model.properties.Property)12 CoreException (org.eclipse.core.runtime.CoreException)10 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)10 List (java.util.List)9 IFolder (org.eclipse.core.resources.IFolder)8 Path (org.eclipse.core.runtime.Path)8 SystemException (org.talend.commons.exception.SystemException)8 JSONException (org.talend.utils.json.JSONException)8 InvocationTargetException (java.lang.reflect.InvocationTargetException)7 ConnectionBean (org.talend.core.model.general.ConnectionBean)7 ITalendProcessJavaProject (org.talend.core.runtime.process.ITalendProcessJavaProject)7