Search in sources :

Example 1 with IDynamicProperty

use of org.talend.core.ui.properties.tab.IDynamicProperty in project tdi-studio-se by Talend.

the class JobSettingsView method getSelection.

/*
     * (non-Javadoc)
     *
     * @see org.talend.designer.core.ui.views.properties.IJobSettingsView#getSelection()
     */
@Override
public ISelection getSelection() {
    ISVNUiProviderService service = null;
    if (PluginChecker.isSVNProviderPluginLoaded()) {
        service = (ISVNUiProviderService) GlobalServiceRegister.getDefault().getService(ISVNUiProviderService.class);
    }
    if (currentSelectedTab == null) {
        return null;
    }
    IDynamicProperty dc = currentSelectedTab.getPropertyComposite();
    if (dc instanceof ProcessVersionComposite) {
        return ((ProcessVersionComposite) dc).getSelection();
    } else if (service != null && service.isSVNHistoryComposite(dc)) {
        return service.getSVNHistorySelection(dc);
    } else if (CorePlugin.getDefault().getDiagramModelService().isInstanceOfBusinessAssignmentComposite(dc)) {
        IRepositoryView repositoryView = RepositoryManagerHelper.findRepositoryView();
        if (repositoryView != null) {
            return repositoryView.getViewer().getSelection();
        }
    }
    return null;
}
Also used : ProcessVersionComposite(org.talend.designer.core.ui.views.jobsettings.tabs.ProcessVersionComposite) IDynamicProperty(org.talend.core.ui.properties.tab.IDynamicProperty) ISVNUiProviderService(org.talend.core.ui.services.ISVNUiProviderService) IRepositoryView(org.talend.repository.ui.views.IRepositoryView)

Example 2 with IDynamicProperty

use of org.talend.core.ui.properties.tab.IDynamicProperty in project tdi-studio-se by Talend.

the class JobSettingsView method createPartControl.

@Override
public void createPartControl(Composite parent) {
    // tabFactory = new HorizontalTabFactory();
    this.parent = parent;
    tabFactory.initComposite(parent, false);
    tabFactory.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            TalendPropertyTabDescriptor descriptor = (TalendPropertyTabDescriptor) selection.getFirstElement();
            if (descriptor == null) {
                return;
            }
            if (currentSelectedTab != null) {
                if ((!currentSelectedTab.getData().equals(descriptor.getData()) || currentSelectedTab.getData() != descriptor.getData() || currentSelectedTab.getCategory() != descriptor.getCategory())) {
                    for (Control curControl : tabFactory.getTabComposite().getChildren()) {
                        curControl.dispose();
                    }
                }
            }
            if (element == null || !element.equals(descriptor.getData()) || currentSelectedTab == null || currentSelectedTab.getCategory() != descriptor.getCategory() || selectedPrimary) {
                Object data = descriptor.getData();
                if (data instanceof Element) {
                    element = (Element) data;
                    currentSelectedTab = descriptor;
                    IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), element, descriptor.getCategory());
                } else if (data instanceof IRepositoryViewObject) {
                    IRepositoryViewObject viewObject = (IRepositoryViewObject) data;
                    IProcess process = getProcess(viewObject);
                    if (process != null && process instanceof Element && process.getId().equals(viewObject.getId()) && process.getVersion().equals(viewObject.getVersion())) {
                        data = process;
                    }
                    currentSelectedTab = descriptor;
                    IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), data, descriptor.getCategory());
                } else if (data instanceof IEditorPart) {
                    currentSelectedTab = descriptor;
                    IRepositoryViewObject repObj = retrieveBusiness((IEditorPart) data);
                    if (repObj != null) {
                        IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), repObj, descriptor.getCategory());
                    }
                } else {
                    currentSelectedTab = descriptor;
                    IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), null, descriptor.getCategory());
                }
                selectedPrimary = false;
            }
        }
    });
}
Also used : Control(org.eclipse.swt.widgets.Control) IDynamicProperty(org.talend.core.ui.properties.tab.IDynamicProperty) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Element(org.talend.core.model.process.Element) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) EmptyRepositoryObject(org.talend.core.model.repository.EmptyRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) TalendPropertyTabDescriptor(org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor) IEditorPart(org.eclipse.ui.IEditorPart) IProcess(org.talend.core.model.process.IProcess)

Example 3 with IDynamicProperty

use of org.talend.core.ui.properties.tab.IDynamicProperty 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 4 with IDynamicProperty

use of org.talend.core.ui.properties.tab.IDynamicProperty in project tdi-studio-se by Talend.

the class AbstractMultiPageTalendEditor method refreshJobSettingsView.

/**
     * Added by Marvin Wang on July 30, 2012 for refreshing the tab of Job view.
     */
protected void refreshJobSettingsView() {
    IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IJobSettingsView.ID);
    if (viewPart != null && viewPart instanceof JobSettingsView) {
        JobSettingsView jobView = (JobSettingsView) viewPart;
        TalendPropertyTabDescriptor currentSelectedTab = jobView.getCurrentSelectedTab();
        if (currentSelectedTab != null) {
            IDynamicProperty dc = currentSelectedTab.getPropertyComposite();
            if (dc != null) {
                dc.refresh();
            }
        }
    }
}
Also used : IJobSettingsView(org.talend.repository.ui.views.IJobSettingsView) JobSettingsView(org.talend.designer.core.ui.views.jobsettings.JobSettingsView) IViewPart(org.eclipse.ui.IViewPart) IDynamicProperty(org.talend.core.ui.properties.tab.IDynamicProperty) TalendPropertyTabDescriptor(org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor)

Example 5 with IDynamicProperty

use of org.talend.core.ui.properties.tab.IDynamicProperty in project tdi-studio-se by Talend.

the class StatsAndLogsViewHelper method applySettings.

/**
     * yzhang Comment method "applySettings".
     * 
     * @param element
     * @param dynamicProperty
     */
public static void applySettings(IElement element, IElement applyTo, IDynamicProperty dynamicProperty) {
    List<? extends IElementParameter> elementParameters = applyTo.getElementParameters();
    for (IElementParameter elementParameterType : elementParameters) {
        String parameterName = elementParameterType.getName();
        if (parameterName.equals(EParameterName.ON_STATCATCHER_FLAG.getName())) {
            elementParameterType.setValue(element.getElementParameter(EParameterName.ON_STATCATCHER_FLAG.getName()).getValue());
            continue;
        }
        if (parameterName.equals(EParameterName.ON_LOGCATCHER_FLAG.getName())) {
            elementParameterType.setValue(element.getElementParameter(EParameterName.ON_LOGCATCHER_FLAG.getName()).getValue());
            continue;
        }
        if (parameterName.equals(EParameterName.ON_METERCATCHER_FLAG.getName())) {
            elementParameterType.setValue(element.getElementParameter(EParameterName.ON_METERCATCHER_FLAG.getName()).getValue());
            continue;
        }
        if (parameterName.equals(EParameterName.ON_FILES_FLAG.getName())) {
            elementParameterType.setValue(element.getElementParameter(EParameterName.ON_FILES_FLAG.getName()).getValue());
            continue;
        }
        if (parameterName.equals(EParameterName.FILE_PATH.getName())) {
            elementParameterType.setValue(element.getElementParameter(EParameterName.FILE_PATH.getName()).getValue());
            continue;
        }
        if (parameterName.equals(EParameterName.FILENAME_STATS.getName())) {
            elementParameterType.setValue(element.getElementParameter(EParameterName.FILENAME_STATS.getName()).getValue());
            continue;
        }
        if (parameterName.equals(EParameterName.FILENAME_LOGS.getName())) {
            elementParameterType.setValue(element.getElementParameter(EParameterName.FILENAME_LOGS.getName()).getValue());
            continue;
        }
        if (parameterName.equals(EParameterName.FILENAME_METTER.getName())) {
            elementParameterType.setValue(element.getElementParameter(EParameterName.FILENAME_METTER.getName()).getValue());
            continue;
        }
        if (parameterName.equals(EParameterName.ON_DATABASE_FLAG.getName())) {
            elementParameterType.setValue(element.getElementParameter(EParameterName.ON_DATABASE_FLAG.getName()).getValue());
            continue;
        }
        if (parameterName.equals(EParameterName.PROPERTY_TYPE.getName())) {
            String id = (String) element.getElementParameter(//$NON-NLS-1$
            EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName()).getValue();
            String propertyType = (String) element.getElementParameter(EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.PROPERTY_TYPE.getName()).getValue();
            /* 16969 */
            Connection repositoryConnection = null;
            // Map<String, ConnectionItem> repositoryConnectionItemMap =
            // dynamicProperty.getRepositoryConnectionItemMap();
            IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
            Item item = null;
            try {
                IRepositoryViewObject repobj = factory.getLastVersion(id);
                if (repobj != null) {
                    Property tmpproperty = repobj.getProperty();
                    if (tmpproperty != null) {
                        item = tmpproperty.getItem();
                    }
                }
            } catch (PersistenceException e) {
                ExceptionHandler.process(e);
            }
            if (item != null && item instanceof ConnectionItem) {
                repositoryConnection = ((ConnectionItem) item).getConnection();
            } else {
                repositoryConnection = null;
            }
            // if (repositoryConnectionItemMap.containsKey(id)) {
            // repositoryConnection = repositoryConnectionItemMap.get(id).getConnection();
            // } else {
            // repositoryConnection = null;
            // }
            ChangeValuesFromRepository cmd1 = new ChangeValuesFromRepository(applyTo, repositoryConnection, EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.PROPERTY_TYPE.getName(), //$NON-NLS-1$
            propertyType);
            ChangeValuesFromRepository cmd2 = new ChangeValuesFromRepository(applyTo, repositoryConnection, EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), //$NON-NLS-1$
            id);
            CompoundCommand cc = new CompoundCommand();
            cc.add(cmd1);
            cc.add(cmd2);
            boolean executed = false;
            if (applyTo instanceof IGEFProcess) {
                IDesignerCoreUIService designerCoreUIService = CoreUIPlugin.getDefault().getDesignerCoreUIService();
                if (designerCoreUIService != null) {
                    executed = designerCoreUIService.executeCommand((IGEFProcess) applyTo, cc);
                }
            }
            if (!executed) {
                cc.execute();
            }
            continue;
        }
        if (PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.PROPERTY_TYPE.getName()).equals(EmfComponent.BUILTIN)) {
            if (parameterName.equals(EParameterName.DB_TYPE.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.DB_TYPE.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.HOST.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.HOST.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.PORT.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.PORT.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.DBNAME.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.DBNAME.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.PROPERTIES.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.PROPERTIES.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.DBFILE.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.DBFILE.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.SCHEMA_DB.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.SCHEMA_DB.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.USER.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.USER.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.PASS.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.PASS.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.TABLE_STATS.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.TABLE_STATS.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.TABLE_LOGS.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.TABLE_LOGS.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.TABLE_METER.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.TABLE_METER.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.CATCH_RUNTIME_ERRORS.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.CATCH_RUNTIME_ERRORS.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.CATCH_USER_ERRORS.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.CATCH_USER_ERRORS.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.CATCH_USER_WARNING.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.CATCH_USER_WARNING.getName()).getValue());
                continue;
            }
            if (parameterName.equals(EParameterName.CATCH_REALTIME_STATS.getName())) {
                elementParameterType.setValue(element.getElementParameter(EParameterName.CATCH_REALTIME_STATS.getName()).getValue());
                continue;
            }
        }
    }
}
Also used : ChangeValuesFromRepository(org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Connection(org.talend.core.model.metadata.builder.connection.Connection) IDesignerCoreUIService(org.talend.core.ui.services.IDesignerCoreUIService) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) IGEFProcess(org.talend.core.ui.process.IGEFProcess) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) IElementParameter(org.talend.core.model.process.IElementParameter) IDynamicProperty(org.talend.core.ui.properties.tab.IDynamicProperty) Property(org.talend.core.model.properties.Property) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Aggregations

IDynamicProperty (org.talend.core.ui.properties.tab.IDynamicProperty)6 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)4 PersistenceException (org.talend.commons.exception.PersistenceException)2 Connection (org.talend.core.model.metadata.builder.connection.Connection)2 Element (org.talend.core.model.process.Element)2 IElementParameter (org.talend.core.model.process.IElementParameter)2 IProcess (org.talend.core.model.process.IProcess)2 ConnectionItem (org.talend.core.model.properties.ConnectionItem)2 Item (org.talend.core.model.properties.Item)2 Property (org.talend.core.model.properties.Property)2 TalendPropertyTabDescriptor (org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor)2 ChangeValuesFromRepository (org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository)2 ProcessVersionComposite (org.talend.designer.core.ui.views.jobsettings.tabs.ProcessVersionComposite)2 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)2 CommandStack (org.eclipse.gef.commands.CommandStack)1 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 Control (org.eclipse.swt.widgets.Control)1