Search in sources :

Example 1 with IHeaderFooterProviderService

use of org.talend.core.ui.IHeaderFooterProviderService 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 2 with IHeaderFooterProviderService

use of org.talend.core.ui.IHeaderFooterProviderService 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)

Aggregations

IProcess (org.talend.core.model.process.IProcess)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 IHeaderFooterProviderService (org.talend.core.ui.IHeaderFooterProviderService)2 Process (org.talend.designer.core.ui.editor.process.Process)2 ArrayList (java.util.ArrayList)1 IEditorPart (org.eclipse.ui.IEditorPart)1 BusinessType (org.talend.core.model.business.BusinessType)1 EComponentCategory (org.talend.core.model.process.EComponentCategory)1 Element (org.talend.core.model.process.Element)1 IDynamicProperty (org.talend.core.ui.properties.tab.IDynamicProperty)1 DeploymentComposite (org.talend.designer.core.ui.views.jobsettings.tabs.DeploymentComposite)1 HeaderFooterComposite (org.talend.designer.core.ui.views.jobsettings.tabs.HeaderFooterComposite)1 MainComposite (org.talend.designer.core.ui.views.jobsettings.tabs.MainComposite)1 ProcessVersionComposite (org.talend.designer.core.ui.views.jobsettings.tabs.ProcessVersionComposite)1 MultipleThreadDynamicComposite (org.talend.designer.core.ui.views.properties.MultipleThreadDynamicComposite)1 StatsAndLogsComposite (org.talend.designer.core.ui.views.statsandlogs.StatsAndLogsComposite)1