Search in sources :

Example 56 with Project

use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.

the class StandAloneTalendJavaEditor method resetItem.

public void resetItem() throws PersistenceException {
    if (item.getProperty().eResource() == null || item.eResource() == null) {
        IRepositoryService service = CoreRuntimePlugin.getInstance().getRepositoryService();
        IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
        //
        // Property updated = factory.getUptodateProperty(getItem().getProperty());
        Property updatedProperty = null;
        try {
            factory.initialize();
            IRepositoryViewObject repositoryViewObject = factory.getLastVersion(new Project(ProjectManager.getInstance().getProject(item.getProperty().getItem())), item.getProperty().getId());
            if (repositoryViewObject != null) {
                updatedProperty = repositoryViewObject.getProperty();
                item = (FileItem) updatedProperty.getItem();
            }
        } catch (PersistenceException e) {
            ExceptionHandler.process(e);
        }
    }
}
Also used : Project(org.talend.core.model.general.Project) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) IProject(org.eclipse.core.resources.IProject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) Property(org.talend.core.model.properties.Property) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) IRepositoryService(org.talend.repository.model.IRepositoryService)

Example 57 with Project

use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.

the class ExchangeService method openExchangeEditor.

@Override
public void openExchangeEditor() {
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    if (activePage != null) {
        Project proj = ProjectManager.getInstance().getCurrentProject();
        if (proj.getExchangeUser() == null || checkUserAndPass(proj.getExchangeUser().getUsername(), proj.getExchangeUser().getPassword()) != null) {
            if (proj != null) {
                if (proj.getExchangeUser().getUsername() == "" && proj.getExchangeUser().getPassword() == "") {
                    String userEmail = null;
                    if (proj.getAuthor() != null) {
                        userEmail = proj.getAuthor().getLogin();
                    }
                    TalendForgeDialog tfDialog = new TalendForgeDialog(DisplayUtils.getDefaultShell(), userEmail);
                    tfDialog.open();
                }
                // MessageDialog.openError(null, "Exchange", Messages.getString("Exchange.logon.error"));
                return;
            }
        }
        try {
            ExchangeEditorInput input = new ExchangeEditorInput();
            IEditorPart findEditor = activePage.findEditor(input);
            if (findEditor == null) {
                activePage.openEditor(input, "org.talend.designer.components.exchange.ui.views.ExchangeView");
            } else {
                activePage.activate(findEditor);
            }
        } catch (PartInitException e) {
            ExceptionHandler.process(e);
        }
    }
}
Also used : Project(org.talend.core.model.general.Project) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ExchangeEditorInput(org.talend.designer.components.exchange.ui.views.ExchangeEditorInput) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) TalendForgeDialog(org.talend.registration.wizards.register.TalendForgeDialog)

Example 58 with Project

use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.

the class SetupProcessDependenciesRoutinesDialog method init.

@SuppressWarnings("unchecked")
private void init(ProcessType process) {
    allRoutineItems.clear();
    ProjectManager projectManager = ProjectManager.getInstance();
    Project currentProject = projectManager.getCurrentProject();
    initModels(currentProject);
    Set<Project> referenceProjects = new HashSet<Project>();
    this.getAllReferenceProjects(currentProject, referenceProjects);
    initRefProjects(referenceProjects);
    List<RoutinesParameterType> routinesDependencies = process.getParameters().getRoutinesParameter();
    List<String> typeNames = new ArrayList<String>();
    for (RoutinesParameterType type : routinesDependencies) {
        RoutineItemRecord record = new RoutineItemRecord();
        record.setName(type.getName());
        Property property = findObject(type.getId(), type.getName());
        if (property != null) {
            // if system, id is not used
            record.setId(property.getId());
            record.setLabel(property.getLabel());
        } else {
            record.setHasProblem(true);
            // use the record
            record.setLabel(type.getName());
        }
        if (!record.hasProblem()) {
            // if lost, willn't display
            if (((RoutineItem) property.getItem()).isBuiltIn()) {
                systemRoutines.add(record);
            } else {
                if (typeNames.contains(type.getName())) {
                    break;
                } else {
                    typeNames.add(type.getName());
                    userRoutines.add(record);
                }
            }
        }
    }
}
Also used : Project(org.talend.core.model.general.Project) RoutinesParameterType(org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType) ArrayList(java.util.ArrayList) RoutineItem(org.talend.core.model.properties.RoutineItem) Property(org.talend.core.model.properties.Property) ProjectManager(org.talend.repository.ProjectManager) HashSet(java.util.HashSet)

Example 59 with Project

use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.

the class ShowRoutineItemsDialog method updateButtons.

@SuppressWarnings("unchecked")
private void updateButtons() {
    IStructuredSelection selection = (IStructuredSelection) routineViewer.getSelection();
    boolean enabled = !selection.isEmpty();
    Iterator iterator = selection.iterator();
    while (iterator.hasNext()) {
        Object element = iterator.next();
        if (element instanceof Property && labelProvider.existed(element) || element instanceof Project) {
            enabled = false;
            break;
        }
    }
    Button button = getButton(IDialogConstants.OK_ID);
    if (button != null && !button.isDisposed()) {
        button.setEnabled(enabled);
    }
}
Also used : Project(org.talend.core.model.general.Project) Button(org.eclipse.swt.widgets.Button) Iterator(java.util.Iterator) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Property(org.talend.core.model.properties.Property)

Example 60 with Project

use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.

the class SetupProcessDependenciesRoutinesDialog method findObject.

private Property findObject(String idOrName, String name) {
    for (Project p : allRoutineItems.keySet()) {
        List<Property> list = allRoutineItems.get(p);
        if (list != null) {
            for (Property property : list) {
                String objIdOrName = property.getId();
                String objName = property.getLabel();
                // objIdOrName = property.getLabel();
                if (objIdOrName != null && objIdOrName.equals(idOrName) && property.getItem() instanceof RoutineItem) {
                    return property;
                } else if (objName != null && objName.equals(name) && property.getItem() instanceof RoutineItem) {
                    return property;
                }
            }
        }
    }
    return null;
}
Also used : Project(org.talend.core.model.general.Project) RoutineItem(org.talend.core.model.properties.RoutineItem) 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