Search in sources :

Example 86 with IProxyRepositoryFactory

use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.

the class AbstractJobSettingsPage method createContents.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
     */
@Override
protected Control createContents(Composite parent) {
    Composite composite = widgetFactory.createComposite(parent, SWT.NONE);
    composite.setLayout(new FormLayout());
    FormData data = createFormData();
    composite.setLayoutData(data);
    //
    checkSettingExisted();
    elem = checkAndCreateElement();
    if (getParametersType() != null) {
        ElementParameter2ParameterType.loadElementParameters(elem, getParametersType(), getPropertyTypeName());
    }
    // update connection from repository if needed
    updateProjectSetting();
    mComposite = new ProjectSettingMultipleThreadDynamicComposite(composite, SWT.V_SCROLL | SWT.BORDER, getCategory(), elem, true, getRepositoryPropertyName());
    mComposite.setLayoutData(createFormData());
    IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    if (factory.isUserReadOnlyOnCurrentProject()) {
        composite.setEnabled(false);
    }
    return composite;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 87 with IProxyRepositoryFactory

use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.

the class JobSettingProjectSettingPage method createImplicitGroup.

protected Composite createImplicitGroup(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    group.setLayout(new GridLayout(3, false));
    Composite composite = new Composite(group, SWT.NONE);
    GridLayout gridLayout = new GridLayout(3, false);
    composite.setLayout(gridLayout);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalSpan = 3;
    composite.setLayoutData(gridData);
    //$NON-NLS-1$
    group.setText(Messages.getString("JobSettingProjectSettingPage.implictLabel"));
    implicitBtn = new Button(composite, SWT.CHECK);
    //$NON-NLS-1$
    implicitBtn.setText(Messages.getString("JobSettingProjectSettingPage.UseProjectsetting"));
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = 8;
    composite.setLayout(layout);
    IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    if (factory.isUserReadOnlyOnCurrentProject()) {
        parent.setEnabled(false);
    }
    return group;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 88 with IProxyRepositoryFactory

use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.

the class MultipleThreadDynamicComposite method updateRepositoryList.

public void updateRepositoryList() {
    ProgressDialog progressDialog = new ProgressDialog(this.getShell(), 1000) {

        private IProgressMonitor monitorWrap;

        @Override
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            monitorWrap = new EventLoopProgressMonitor(monitor);
            IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
            List<IRepositoryViewObject> repositoryObjects = getAllRepositoryMetadata();
            // + elem.getElementParameters().size();
            int total = repositoryObjects.size();
            //$NON-NLS-1$
            monitorWrap.beginTask(Messages.getString("MultipleThreadDynamicComposite.gatherInformation"), total);
            IElementParameter propertyParam = elem.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE, section);
            String repositoryValue = null;
            if (propertyParam != null) {
                repositoryValue = propertyParam.getRepositoryValue();
            }
            if (repositoryObjects != null && (repositoryObjects.size() != 0)) {
                tableIdAndDbTypeMap.clear();
                tableIdAndDbSchemaMap.clear();
                for (IRepositoryViewObject curObject : repositoryObjects) {
                    Item item = curObject.getProperty().getItem();
                    if (item instanceof ConnectionItem) {
                        ConnectionItem connectionItem = (ConnectionItem) item;
                        Connection connection = connectionItem.getConnection();
                        if (connection == null || connection.isReadOnly()) {
                            continue;
                        }
                        for (Object tableObj : ConnectionHelper.getTables(connection)) {
                            org.talend.core.model.metadata.builder.connection.MetadataTable table;
                            table = (org.talend.core.model.metadata.builder.connection.MetadataTable) tableObj;
                            if (factory.getStatus(connectionItem) != ERepositoryStatus.DELETED) {
                                if (!factory.isDeleted(table)) {
                                    IMetadataTable newTable = ConvertionHelper.convert(table);
                                    // newTable);
                                    if (connection instanceof DatabaseConnection) {
                                        String dbType = ((DatabaseConnection) connection).getDatabaseType();
                                        String schema = ((DatabaseConnection) connection).getUiSchema();
                                        tableIdAndDbTypeMap.put(newTable.getId(), dbType);
                                        if (schema != null && !schema.equals("")) {
                                            //$NON-NLS-1$
                                            tableIdAndDbSchemaMap.put(newTable.getId(), schema);
                                        }
                                    }
                                }
                            }
                        }
                        monitorWrap.worked(1);
                    }
                    // hywang add for feature 6484
                    if (item instanceof FileItem) {
                        FileItem FileItem = (FileItem) item;
                        if (repositoryValue != null) {
                            if (repositoryValue.equals("RULE")) {
                                //$NON-NLS-1$
                                repositoryFileItemMap.put(FileItem.getProperty().getId(), FileItem);
                            }
                        }
                        monitorWrap.worked(1);
                    }
                    if (item instanceof LinkRulesItem) {
                        LinkRulesItem linkItem = (LinkRulesItem) item;
                        if (repositoryValue != null) {
                            if (repositoryValue.equals("RULE")) {
                                //$NON-NLS-1$
                                repositoryLinkRulesItemMap.put(linkItem.getProperty().getId(), linkItem);
                            }
                        }
                        monitorWrap.worked(1);
                    }
                }
            }
            monitorWrap.done();
        }
    };
    try {
        progressDialog.executeProcess();
    } catch (InvocationTargetException e) {
        ExceptionHandler.process(e);
        return;
    } catch (Exception e) {
        ExceptionHandler.process(e);
        return;
    }
}
Also used : ConnectionItem(org.talend.core.model.properties.ConnectionItem) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) EventLoopProgressMonitor(org.talend.commons.ui.swt.dialogs.EventLoopProgressMonitor) ProgressDialog(org.talend.commons.ui.swt.dialogs.ProgressDialog) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException) PersistenceException(org.talend.commons.exception.PersistenceException) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) LinkRulesItem(org.talend.core.model.properties.LinkRulesItem) Item(org.talend.core.model.properties.Item) ConnectionItem(org.talend.core.model.properties.ConnectionItem) LinkRulesItem(org.talend.core.model.properties.LinkRulesItem) FileItem(org.talend.core.model.properties.FileItem) FileItem(org.talend.core.model.properties.FileItem) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IElementParameter(org.talend.core.model.process.IElementParameter) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 89 with IProxyRepositoryFactory

use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.

the class MultipleThreadDynamicComposite method getAllRepositoryMetadata.

/**
     * 
     * cli Comment method "getAllRepositoryMetadata".
     * 
     * fixed for 8971
     */
private List<IRepositoryViewObject> getAllRepositoryMetadata() {
    IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
    ProjectManager pManager = ProjectManager.getInstance();
    // retrieve reference project.
    pManager.getReferencedProjects();
    List<IRepositoryViewObject> repositoryObjects;
    try {
        repositoryObjects = retrieveMetadataFromProject(factory, pManager, pManager.getCurrentProject());
    } catch (PersistenceException e) {
        throw new RuntimeException(e);
    }
    return repositoryObjects;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) ProjectManager(org.talend.repository.ProjectManager)

Example 90 with IProxyRepositoryFactory

use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.

the class CreateDiagramAction method run.

/*
     * added by wchen for intro
     * 
     * @see org.eclipse.ui.intro.config.IIntroAction#run(org.eclipse.ui.intro.IIntroSite, java.util.Properties)
     */
@Override
public void run(IIntroSite site, Properties params) {
    IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    if (factory.isUserReadOnlyOnCurrentProject()) {
        MessageDialog.openWarning(null, "User Authority", "Can't create Business Model! Current user is read-only on this project!");
    } else {
        PlatformUI.getWorkbench().getIntroManager().closeIntro(PlatformUI.getWorkbench().getIntroManager().getIntro());
        setRepositoryNode(params);
        doRun();
    }
}
Also used : IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Aggregations

IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)251 PersistenceException (org.talend.commons.exception.PersistenceException)154 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)96 Item (org.talend.core.model.properties.Item)67 Property (org.talend.core.model.properties.Property)58 ArrayList (java.util.ArrayList)42 ConnectionItem (org.talend.core.model.properties.ConnectionItem)34 RepositoryNode (org.talend.repository.model.RepositoryNode)32 ProcessItem (org.talend.core.model.properties.ProcessItem)29 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)28 CoreException (org.eclipse.core.runtime.CoreException)23 LoginException (org.talend.commons.exception.LoginException)22 IRepositoryService (org.talend.repository.model.IRepositoryService)22 ERepositoryStatus (org.talend.commons.runtime.model.repository.ERepositoryStatus)21 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)21 IElementParameter (org.talend.core.model.process.IElementParameter)21 Connection (org.talend.core.model.metadata.builder.connection.Connection)20 List (java.util.List)18 IFile (org.eclipse.core.resources.IFile)18 Project (org.talend.core.model.general.Project)18