Search in sources :

Example 36 with Process

use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.

the class StatsAndLogsTabPropertySection method setInput.

public void setInput(final IWorkbenchPart workbenchPart, final ISelection selection) {
    Object input = ((IStructuredSelection) selection).getFirstElement();
    if (input instanceof RepositoryNode) {
        // This is the only RepositoryNode that displays the Job.
        Process process = StatsAndLogsSectionFilter.getProcessPartByRepositoryNode((RepositoryNode) input);
        if (process == null) {
            return;
        }
        // make a mock processPart here for super.setInput();
        ProcessPart part = new ProcessPart();
        part.setModel(process);
        StructuredSelection sel = new StructuredSelection(part);
        super.setInput(workbenchPart, sel);
    } else {
        super.setInput(workbenchPart, selection);
    }
}
Also used : IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Process(org.talend.designer.core.ui.editor.process.Process) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 37 with Process

use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.

the class SubjobContainerLayoutEditPolicy method getCreateCommand.

// ------------------------------------------------------------------------
// Abstract methods from LayoutEditPolicy
/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
     */
protected Command getCreateCommand(final CreateRequest request) {
    if (((SubjobContainer) getHost().getModel()).isReadOnly()) {
        return null;
    }
    Rectangle constraint = (Rectangle) getConstraintFor(request);
    Process linkedProcess = (Process) ((SubjobContainer) getHost().getModel()).getProcess();
    Command command = null;
    if (Note.class.equals(request.getNewObjectType())) {
        command = new CreateNoteCommand(linkedProcess, (Note) request.getNewObject(), constraint.getLocation());
    } else if (request.getNewObject() instanceof Node) {
        Node node = (Node) request.getNewObject();
        NodeContainer nodeContainer = ((Process) node.getProcess()).loadNodeContainer(node, false);
        command = new CreateNodeContainerCommand(linkedProcess, nodeContainer, constraint.getLocation());
    }
    return command;
}
Also used : CreateNodeContainerCommand(org.talend.designer.core.ui.editor.cmd.CreateNodeContainerCommand) CreateNodeContainerCommand(org.talend.designer.core.ui.editor.cmd.CreateNodeContainerCommand) MoveNodeLabelCommand(org.talend.designer.core.ui.editor.cmd.MoveNodeLabelCommand) MoveNodeCommand(org.talend.designer.core.ui.editor.cmd.MoveNodeCommand) CreateNoteCommand(org.talend.designer.core.ui.editor.cmd.CreateNoteCommand) MoveNoteCommand(org.talend.designer.core.ui.editor.cmd.MoveNoteCommand) Command(org.eclipse.gef.commands.Command) Note(org.talend.designer.core.ui.editor.notes.Note) Node(org.talend.designer.core.ui.editor.nodes.Node) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Process(org.talend.designer.core.ui.editor.process.Process) CreateNoteCommand(org.talend.designer.core.ui.editor.cmd.CreateNoteCommand) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)

Example 38 with Process

use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.

the class JobSettingsView method getCategories.

/**
     * set the category.
     */
private EComponentCategory[] getCategories(Object obj) {
    List<EComponentCategory> category = new ArrayList<EComponentCategory>();
    boolean isOfflineMode = CorePlugin.getDefault().getProxyRepositoryFactory().getRepositoryContext().isOffline();
    if (obj instanceof Process) {
        Process process = (Process) obj;
        category.add(EComponentCategory.MAIN);
        boolean isJoblet = AbstractProcessProvider.isExtensionProcessForJoblet(process);
        if (process.getComponentsType().equals(ComponentCategory.CATEGORY_4_DI.getName())) {
            category.add(EComponentCategory.EXTRA);
        }
        if (!isJoblet && process.getComponentsType().equals(ComponentCategory.CATEGORY_4_DI.getName())) {
            category.add(EComponentCategory.STATSANDLOGS);
        }
        if (allowVerchange) {
            category.add(EComponentCategory.VERSIONS);
        }
        if (!isJoblet && !ProcessUtils.isTestContainer(process) && ERepositoryObjectType.getItemType(process.getProperty().getItem()) != ERepositoryObjectType.PROCESS_ROUTELET) {
            category.add(EComponentCategory.DEPLOYMENT);
        }
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IHeaderFooterProviderService.class)) {
            IHeaderFooterProviderService headerFooterService = (IHeaderFooterProviderService) GlobalServiceRegister.getDefault().getService(IHeaderFooterProviderService.class);
            if (headerFooterService.isVisible()) {
                category.add(EComponentCategory.HEADERFOOTER);
            }
        }
        // if svn remote connection, added by nma
        if (svnService != null && svnService.isProjectInSvnMode() && !isOfflineMode) {
            category.add(EComponentCategory.SVNHISTORY);
        }
        if (gitService != null && gitService.isProjectInGitMode() && !isOfflineMode) {
            category.add(EComponentCategory.GITHISTORY);
        }
    } else if (obj instanceof IRepositoryViewObject) {
        category.add(EComponentCategory.MAIN);
        if (allowVerchange) {
            category.add(EComponentCategory.VERSIONS);
        }
        if (svnService != null && svnService.isProjectInSvnMode() && !isOfflineMode && (((IRepositoryViewObject) obj).getRepositoryObjectType() == ERepositoryObjectType.JOBLET || ERepositoryObjectType.getAllTypesOfProcess().contains(((IRepositoryViewObject) obj).getRepositoryObjectType()))) {
            category.add(EComponentCategory.SVNHISTORY);
        } else if (gitService != null && gitService.isProjectInGitMode() && !isOfflineMode && (((IRepositoryViewObject) obj).getRepositoryObjectType() == ERepositoryObjectType.JOBLET || ERepositoryObjectType.getAllTypesOfProcess().contains(((IRepositoryViewObject) obj).getRepositoryObjectType()))) {
            category.add(EComponentCategory.GITHISTORY);
        }
    } else if (obj instanceof IEditorPart) {
        if (CorePlugin.getDefault().getDiagramModelService().isBusinessDiagramEditor((IEditorPart) obj)) {
            category.add(EComponentCategory.MAIN);
            category.add(EComponentCategory.APPEARANCE);
            category.add(EComponentCategory.RULERS_AND_GRID);
            if (allowVerchange) {
                category.add(EComponentCategory.VERSIONS);
            }
        }
    } else {
        BusinessType type = CorePlugin.getDefault().getDiagramModelService().getBusinessModelType(obj);
        if (BusinessType.SHAP.equals(type) || BusinessType.CONNECTION.equals(type)) {
            category.add(EComponentCategory.APPEARANCE);
            category.add(EComponentCategory.ASSIGNMENT);
        } else if (BusinessType.NOTE.equals(type)) {
            category.add(EComponentCategory.APPEARANCE);
        }
    }
    return category.toArray(new EComponentCategory[0]);
}
Also used : IHeaderFooterProviderService(org.talend.core.ui.IHeaderFooterProviderService) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) BusinessType(org.talend.core.model.business.BusinessType) IProcess(org.talend.core.model.process.IProcess) Process(org.talend.designer.core.ui.editor.process.Process) IEditorPart(org.eclipse.ui.IEditorPart) EComponentCategory(org.talend.core.model.process.EComponentCategory)

Example 39 with Process

use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.

the class JobSettingsView method createTabComposite.

private IDynamicProperty createTabComposite(Composite parent, Object data, EComponentCategory category) {
    final int style = SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS;
    IDynamicProperty dynamicComposite = null;
    if (EComponentCategory.EXTRA.equals(category)) {
        // achen modify to fix bug 0006241
        Process process = getElement();
        boolean isJoblet = AbstractProcessProvider.isExtensionProcessForJoblet(process);
        if (isJoblet) {
            dynamicComposite = new MultipleThreadDynamicComposite(parent, style, category, (Element) data, true);
        } else {
            dynamicComposite = new ExtraComposite(parent, style, category, (Element) data, true);
            CoreUIPlugin.setCSSId(dynamicComposite.getComposite(), //$NON-NLS-1$
            "org-talend-designer-core-ui-views-jobsettings-JobSettingsView-ExtraComposite");
        }
    } else if (EComponentCategory.STATSANDLOGS.equals(category)) {
        dynamicComposite = new StatsAndLogsComposite(parent, style, category, (Element) data);
        CoreUIPlugin.setCSSId(dynamicComposite.getComposite(), //$NON-NLS-1$
        "org-talend-designer-core-ui-views-jobsettings-JobSettingsView-StatsAndLogsComposite");
    } else if (EComponentCategory.CONTEXT.equals(category)) {
    // TODO
    // dynamicComposite = new ContextDynamicComposite(parent, style, category, element);
    } else if (EComponentCategory.MAIN.equals(category)) {
        dynamicComposite = new MainComposite(parent, SWT.NONE, tabFactory, (IRepositoryViewObject) data);
    } else if (EComponentCategory.VERSIONS.equals(category)) {
        if (allowVerchange) {
            dynamicComposite = new ProcessVersionComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
        }
    } else if (EComponentCategory.HEADERFOOTER.equals(category)) {
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IHeaderFooterProviderService.class)) {
            IHeaderFooterProviderService headerFooterService = (IHeaderFooterProviderService) GlobalServiceRegister.getDefault().getService(IHeaderFooterProviderService.class);
            if (headerFooterService.isVisible()) {
                dynamicComposite = new HeaderFooterComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
            }
        }
    } else if (EComponentCategory.SVNHISTORY.equals(category) && svnUIService != null) {
        dynamicComposite = svnUIService.createProcessSVNHistoryComposite(parent, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
    } else if (EComponentCategory.GITHISTORY.equals(category) && gitUIService != null) {
        dynamicComposite = gitUIService.createProcessGitHistoryComposite(parent, this, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
    } else if (EComponentCategory.APPEARANCE.equals(category)) {
        dynamicComposite = (IDynamicProperty) CorePlugin.getDefault().getDiagramModelService().getBusinessAppearanceComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), selectedModel);
    } else if (EComponentCategory.RULERS_AND_GRID.equals(category)) {
        dynamicComposite = (IDynamicProperty) CorePlugin.getDefault().getDiagramModelService().getBusinessRulersAndGridComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), null);
    } else if (EComponentCategory.ASSIGNMENT.equals(category)) {
        dynamicComposite = (IDynamicProperty) CorePlugin.getDefault().getDiagramModelService().getBusinessAssignmentComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), selectedModel);
    } else if (EComponentCategory.DEPLOYMENT.equals(category)) {
        dynamicComposite = new DeploymentComposite(parent, SWT.NONE, tabFactory.getWidgetFactory(), (IRepositoryViewObject) data);
    }
    if (dynamicComposite != null) {
        dynamicComposite.refresh();
    }
    currentSelectedTab.setPropertyComposite(dynamicComposite);
    return dynamicComposite;
}
Also used : IDynamicProperty(org.talend.core.ui.properties.tab.IDynamicProperty) Element(org.talend.core.model.process.Element) IProcess(org.talend.core.model.process.IProcess) Process(org.talend.designer.core.ui.editor.process.Process) StatsAndLogsComposite(org.talend.designer.core.ui.views.statsandlogs.StatsAndLogsComposite) MultipleThreadDynamicComposite(org.talend.designer.core.ui.views.properties.MultipleThreadDynamicComposite) ProcessVersionComposite(org.talend.designer.core.ui.views.jobsettings.tabs.ProcessVersionComposite) HeaderFooterComposite(org.talend.designer.core.ui.views.jobsettings.tabs.HeaderFooterComposite) DeploymentComposite(org.talend.designer.core.ui.views.jobsettings.tabs.DeploymentComposite) IHeaderFooterProviderService(org.talend.core.ui.IHeaderFooterProviderService) MainComposite(org.talend.designer.core.ui.views.jobsettings.tabs.MainComposite) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 40 with Process

use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.

the class JobSettingsView method setElement.

/**
     *
     * DOC ggu Comment method "setElement".
     *
     * @param obj
     */
private void setElement(Object obj, final String title, Image image) {
    EComponentCategory[] categories = null;
    if (obj != null && obj instanceof Process) {
        process = (Process) obj;
        if (currentSelectedTab != null && currentSelectedTab.getData().equals(process) && !cleaned) {
            return;
        }
        categories = getCategories(process);
    } else if (obj != null && obj instanceof IRepositoryViewObject) {
        categories = getCategories(obj);
        IRepositoryViewObject viewObject = (IRepositoryViewObject) obj;
        IProcess process = getProcess(viewObject);
        if (process != null && process instanceof Element && process.getId().equals(viewObject.getId()) && process.getVersion().equals(viewObject.getVersion())) {
            categories = getCategories(process);
        }
    } else if (obj instanceof IEditorPart) {
        if (CorePlugin.getDefault().getDiagramModelService().isBusinessDiagramEditor((IEditorPart) obj)) {
            categories = getCategories(obj);
        }
    } else {
        BusinessType type = CorePlugin.getDefault().getDiagramModelService().getBusinessModelType(obj);
        if (BusinessType.NOTE.equals(type) || BusinessType.SHAP.equals(type) || BusinessType.CONNECTION.equals(type)) {
            categories = getCategories(obj);
        } else {
            cleanDisplay();
            return;
        }
    }
    final List<TalendPropertyTabDescriptor> descriptors = new ArrayList<TalendPropertyTabDescriptor>();
    for (EComponentCategory category : categories) {
        TalendPropertyTabDescriptor d = new TalendPropertyTabDescriptor(category);
        d.setData(obj);
        descriptors.add(d);
    }
    tabFactory.setInput(descriptors);
    setPartName(title, image);
    cleaned = false;
    tabFactory.setSelection(new IStructuredSelection() {

        @Override
        public Object getFirstElement() {
            return null;
        }

        @Override
        public Iterator iterator() {
            return null;
        }

        @Override
        public int size() {
            return 0;
        }

        @Override
        public Object[] toArray() {
            return null;
        }

        @Override
        public List toList() {
            List<TalendPropertyTabDescriptor> d = new ArrayList<TalendPropertyTabDescriptor>();
            if (descriptors.size() > 0) {
                if (currentSelectedTab != null) {
                    for (TalendPropertyTabDescriptor ds : descriptors) {
                        if (ds.getCategory() == currentSelectedTab.getCategory()) {
                            d.add(ds);
                            return d;
                        }
                    }
                }
                d.add(descriptors.get(0));
            }
            return d;
        }

        @Override
        public boolean isEmpty() {
            return false;
        }
    });
}
Also used : Element(org.talend.core.model.process.Element) BusinessType(org.talend.core.model.business.BusinessType) ArrayList(java.util.ArrayList) IProcess(org.talend.core.model.process.IProcess) Process(org.talend.designer.core.ui.editor.process.Process) IEditorPart(org.eclipse.ui.IEditorPart) TalendPropertyTabDescriptor(org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Iterator(java.util.Iterator) EmptyRepositoryObject(org.talend.core.model.repository.EmptyRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) List(java.util.List) ArrayList(java.util.ArrayList) IProcess(org.talend.core.model.process.IProcess) EComponentCategory(org.talend.core.model.process.EComponentCategory)

Aggregations

Process (org.talend.designer.core.ui.editor.process.Process)119 Node (org.talend.designer.core.ui.editor.nodes.Node)69 INode (org.talend.core.model.process.INode)48 ArrayList (java.util.ArrayList)45 IComponent (org.talend.core.model.components.IComponent)36 IElementParameter (org.talend.core.model.process.IElementParameter)28 Test (org.junit.Test)26 List (java.util.List)25 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)25 IProcess (org.talend.core.model.process.IProcess)24 Connection (org.talend.designer.core.ui.editor.connections.Connection)24 Property (org.talend.core.model.properties.Property)23 INodeConnector (org.talend.core.model.process.INodeConnector)22 IConnection (org.talend.core.model.process.IConnection)20 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)20 FakePropertyImpl (org.talend.core.model.repository.FakePropertyImpl)15 ProcessItem (org.talend.core.model.properties.ProcessItem)12 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)11 HashMap (java.util.HashMap)10 Before (org.junit.Before)9