Search in sources :

Example 91 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class JobLaunchShortcutManager method resetJobProblemList.

/**
     * 
     * ldong Comment method "resetJobProblemList".
     */
public static void resetJobProblemList(IRepositoryViewObject obj, String oldLabel) {
    if (obj == null) {
        return;
    }
    Property property = obj.getProperty();
    if (property == null || !(property.getItem() instanceof ProcessItem)) {
        return;
    }
    String newLabel = property.getLabel();
    if (!newLabel.equals(oldLabel)) {
        for (Iterator<Problem> iter = Problems.getProblemList().getProblemList().iterator(); iter.hasNext(); ) {
            Problem problem = iter.next();
            if (problem instanceof TalendProblem) {
                TalendProblem routineProblem = (TalendProblem) problem;
                if (routineProblem.getJavaUnitName() != null && (routineProblem.getJavaUnitName().equals(oldLabel))) {
                    // TDI-24683:if rename the jobItem,need clear the problem view to avoid use the old
                    // problem list
                    iter.remove();
                }
            }
        }
    }
}
Also used : ProcessItem(org.talend.core.model.properties.ProcessItem) TalendProblem(org.talend.core.model.process.TalendProblem) TalendProblem(org.talend.core.model.process.TalendProblem) Problem(org.talend.core.model.process.Problem) Property(org.talend.core.model.properties.Property)

Example 92 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class StandardJobStandaloneBuildProvider method createPomCreator.

@Override
public IMavenPomCreator createPomCreator(Map<String, Object> parameters) {
    if (parameters == null || parameters.isEmpty()) {
        return null;
    }
    final Object processor = parameters.get(PROCESSOR);
    if (processor == null || !(processor instanceof IProcessor)) {
        return null;
    }
    final Object pomFile = parameters.get(FILE_POM);
    if (pomFile == null || !(pomFile instanceof IFile)) {
        return null;
    }
    final Object item = parameters.get(ITEM);
    if (item == null || !(item instanceof Item)) {
        return null;
    }
    Object argumentsMap = parameters.get(ARGUMENTS_MAP);
    if (argumentsMap == null) {
        argumentsMap = Collections.emptyMap();
    }
    if (!(argumentsMap instanceof Map)) {
        return null;
    }
    Object overwrite = parameters.get(OVERWRITE_POM);
    if (overwrite == null) {
        overwrite = Boolean.FALSE;
    }
    final Object assemblyFile = parameters.get(FILE_ASSEMBLY);
    if (assemblyFile == null || !(assemblyFile instanceof IFile)) {
        return null;
    }
    final Object winClassPath = parameters.get(CP_WIN);
    if (winClassPath == null) {
        return null;
    }
    final Object linuxClassPath = parameters.get(CP_LINUX);
    if (linuxClassPath == null) {
        return null;
    }
    CreateMavenJobPom creator = new CreateMavenJobPom((IProcessor) processor, (IFile) pomFile);
    creator.setUnixClasspath(linuxClassPath.toString());
    creator.setWindowsClasspath(winClassPath.toString());
    creator.setAssemblyFile((IFile) assemblyFile);
    creator.setArgumentsMap((Map<String, Object>) argumentsMap);
    creator.setOverwrite(Boolean.parseBoolean(overwrite.toString()));
    final Property itemProperty = ((Item) item).getProperty();
    IPath itemLocationPath = ItemResourceUtil.getItemLocationPath(itemProperty);
    IFolder objectTypeFolder = ItemResourceUtil.getObjectTypeFolder(itemProperty);
    if (itemLocationPath != null && objectTypeFolder != null) {
        IPath itemRelativePath = itemLocationPath.removeLastSegments(1).makeRelativeTo(objectTypeFolder.getLocation());
        creator.setObjectTypeFolder(objectTypeFolder);
        creator.setItemRelativePath(itemRelativePath);
    }
    return creator;
}
Also used : ProcessItem(org.talend.core.model.properties.ProcessItem) Item(org.talend.core.model.properties.Item) IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) CreateMavenJobPom(org.talend.designer.maven.tools.creator.CreateMavenJobPom) IProcessor(org.talend.designer.runprocess.IProcessor) Map(java.util.Map) Property(org.talend.core.model.properties.Property) IFolder(org.eclipse.core.resources.IFolder)

Example 93 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class AbstractMultiPageTalendEditor method createPage2.

// create jobscript editor
protected void createPage2() {
    if (!GlobalServiceRegister.getDefault().isServiceRegistered(ICreateXtextProcessService.class)) {
        return;
    }
    String scriptValue = "";
    try {
        IProject currentProject = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject());
        String jobScriptVersion = "";
        if (getEditorInput() != null && getEditorInput() instanceof RepositoryEditorInput) {
            Item item = ((RepositoryEditorInput) getEditorInput()).getItem();
            if (item != null) {
                Property property = item.getProperty();
                if (property != null) {
                    jobScriptVersion = "_" + property.getVersion();
                }
            }
        }
        IFile file = currentProject.getFolder("temp").getFile(getEditorInput().getName() + jobScriptVersion + "_job" + ".jobscript");
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(scriptValue.getBytes());
        if (file.exists()) {
            file.delete(true, null);
            file.create(byteArrayInputStream, true, null);
            file.setContents(byteArrayInputStream, 0, null);
        } else {
            file.create(byteArrayInputStream, true, null);
        }
        String pointId = "org.talend.metalanguage.jobscript.JobScriptForMultipage";
        // the way to get the xtextEditor programmly
        IEditorInput editorInput = new FileEditorInput(file);
        IExtensionPoint ep = RegistryFactory.getRegistry().getExtensionPoint("org.eclipse.ui.editors");
        IExtension[] extensions = ep.getExtensions();
        IExtension ex;
        IConfigurationElement confElem = null;
        for (IExtension extension : extensions) {
            ex = extension;
            if (ex.getContributor().getName().equals("org.talend.metalanguage.jobscript.ui")) {
                for (IConfigurationElement c : ex.getConfigurationElements()) {
                    if (c.getName().equals("editor") && c.getAttribute("id").equals(pointId)) {
                        confElem = c;
                        break;
                    }
                }
            }
        }
        if (confElem != null) {
            jobletEditor = (AbstractDecoratedTextEditor) confElem.createExecutableExtension("class");
            if (jobletEditor != null) {
                int index = addPage(jobletEditor, editorInput);
                setPageText(index, "Jobscript");
            }
        }
    } catch (PartInitException e) {
        ExceptionHandler.process(e);
    } catch (PersistenceException e) {
        ExceptionHandler.process(e);
    } catch (CoreException e) {
        ExceptionHandler.process(e);
    }
}
Also used : RepositoryEditorInput(org.talend.core.repository.ui.editor.RepositoryEditorInput) IFile(org.eclipse.core.resources.IFile) ICreateXtextProcessService(org.talend.core.services.ICreateXtextProcessService) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IProject(org.eclipse.core.resources.IProject) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) ProcessItem(org.talend.core.model.properties.ProcessItem) Item(org.talend.core.model.properties.Item) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) CoreException(org.eclipse.core.runtime.CoreException) ByteArrayInputStream(java.io.ByteArrayInputStream) IExtension(org.eclipse.core.runtime.IExtension) FileEditorInput(org.eclipse.ui.part.FileEditorInput) PersistenceException(org.talend.commons.exception.PersistenceException) PartInitException(org.eclipse.ui.PartInitException) IDynamicProperty(org.talend.core.ui.properties.tab.IDynamicProperty) Property(org.talend.core.model.properties.Property) IEditorInput(org.eclipse.ui.IEditorInput)

Example 94 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class MultiPageTalendEditor method setName.

/**
     * DOC smallet Comment method "setName".
     * 
     * @param label
     */
@Override
public void setName() {
    if (getEditorInput() == null) {
        return;
    }
    super.setName();
    IProcess2 process2 = this.getProcess();
    if (process2 == null) {
        return;
    }
    Property property = process2.getProperty();
    if (property == null) {
        return;
    }
    String label = property.getDisplayName();
    //$NON-NLS-1$
    String jobVersion = "0.1";
    if (process2 != null) {
        jobVersion = process2.getVersion();
    }
    // if (getActivePage() == 1) {
    ISVNProviderService service = null;
    if (PluginChecker.isSVNProviderPluginLoaded()) {
        service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
        if (revisionChanged && service.isProjectInSvnMode()) {
            revisionNumStr = service.getCurrentSVNRevision(process2);
            revisionChanged = false;
            if (revisionNumStr != null) {
                //$NON-NLS-1$
                revisionNumStr = ".r" + revisionNumStr;
            }
        }
    }
    //$NON-NLS-1$
    String title = "MultiPageTalendEditor.Job";
    if (process2 != null) {
        Item item = process2.getProperty().getItem();
        if (item instanceof JobletProcessItem) {
            //$NON-NLS-1$
            title = "MultiPageTalendEditor.Joblet";
        }
    }
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    boolean allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
    if (allowVerchange) {
        if (revisionNumStr != null) {
            setPartName(Messages.getString(title, label, jobVersion) + revisionNumStr);
        } else {
            setPartName(Messages.getString(title, label, jobVersion));
        }
    } else {
        if (revisionNumStr != null) {
            //$NON-NLS-1$
            setPartName(Messages.getString(title, label, "") + revisionNumStr);
        } else {
            //$NON-NLS-1$
            setPartName(Messages.getString(title, label, ""));
        }
    }
}
Also used : Item(org.talend.core.model.properties.Item) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) IProcess2(org.talend.core.model.process.IProcess2) ISVNProviderService(org.talend.core.services.ISVNProviderService) IBrandingService(org.talend.core.ui.branding.IBrandingService) Property(org.talend.core.model.properties.Property)

Example 95 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class AbstractMultiPageTalendEditor method updateTitleImage.

protected void updateTitleImage() {
    if (getProcess() == null) {
        return;
    }
    Property property = getProcess().getProperty();
    updateTitleImage(property);
}
Also used : IDynamicProperty(org.talend.core.ui.properties.tab.IDynamicProperty) Property(org.talend.core.model.properties.Property)

Aggregations

Property (org.talend.core.model.properties.Property)147 PersistenceException (org.talend.commons.exception.PersistenceException)56 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)48 Item (org.talend.core.model.properties.Item)46 ProcessItem (org.talend.core.model.properties.ProcessItem)39 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)36 Node (org.talend.designer.core.ui.editor.nodes.Node)28 Process (org.talend.designer.core.ui.editor.process.Process)23 RepositoryNode (org.talend.repository.model.RepositoryNode)22 IElementParameter (org.talend.core.model.process.IElementParameter)21 ConnectionItem (org.talend.core.model.properties.ConnectionItem)21 IDynamicProperty (org.talend.core.ui.properties.tab.IDynamicProperty)21 ArrayList (java.util.ArrayList)20 Test (org.junit.Test)19 INode (org.talend.core.model.process.INode)19 IComponent (org.talend.core.model.components.IComponent)15 Connection (org.talend.core.model.metadata.builder.connection.Connection)14 IProcess2 (org.talend.core.model.process.IProcess2)14 List (java.util.List)12 IFile (org.eclipse.core.resources.IFile)12