Search in sources :

Example 6 with IESBService

use of org.talend.core.IESBService in project tdi-studio-se by Talend.

the class EditPropertiesAction method doRun.

@Override
protected void doRun() {
    ISelection selection = getSelection();
    Object obj = ((IStructuredSelection) selection).getFirstElement();
    IRepositoryNode node = (IRepositoryNode) obj;
    // try {
    // ProxyRepositoryFactory.getInstance().initialize();
    // } catch (PersistenceException e1) {
    // ExceptionHandler.process(e1);
    // }
    IRepositoryViewObject object = node.getObject();
    IPath path = RepositoryNodeUtilities.getPath(node);
    String originalName = object.getLabel();
    final PropertiesWizard wizard;
    if (ERepositoryObjectType.ROUTINES == object.getRepositoryObjectType() || isInstanceofCamelBeans(object.getRepositoryObjectType())) {
        wizard = new EditRoutinePropertiesWizard(object, path, true);
    } else if (ERepositoryObjectType.PROCESS == object.getRepositoryObjectType()) {
        wizard = new EditProcessPropertiesWizard(object, path, true);
    } else {
        wizard = getPropertiesWizard(object, path);
    }
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
    if (dlg.open() == Window.OK) {
        refresh(node);
        // refresh the corresponding editor's name
        IEditorPart part = getCorrespondingEditor(node);
        if (part != null && part instanceof IUIRefresher) {
            ((IUIRefresher) part).refreshName();
        } else {
            processRoutineRenameOperation(originalName, node, path);
        }
        // rename the job launch, for bug 8878
        IDesignerCoreService designerCoreService = RepositoryPlugin.getDefault().getDesignerCoreService();
        if (designerCoreService != null) {
            designerCoreService.renameJobLaunch(node.getObject(), originalName);
            // TDI-24863:reset the job problem list if rename the job item
            designerCoreService.resetJobProblemList(node.getObject(), originalName);
        }
        // refresh ...
        IViewPart jobSettingView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IJobSettingsView.ID);
        if (jobSettingView != null && jobSettingView instanceof IJobSettingsView) {
            ((IJobSettingsView) jobSettingView).refreshCurrentViewTab();
        }
        if (node.getObjectType() == ERepositoryObjectType.ROUTINES) {
            RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
            if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
                IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
                ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
                if (talendProcessJavaProject != null) {
                    talendProcessJavaProject.updateRoutinesPom(true, true);
                }
            }
        }
        if (node.getObjectType().getType().equals("SERVICES")) {
            //$NON-NLS-1$
            ConnectionItem connectionItem = (ConnectionItem) node.getObject().getProperty().getItem();
            RepositoryUpdateManager.updateServices(connectionItem);
            if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
                IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
                if (service != null) {
                    service.refreshComponentView(connectionItem);
                }
            }
        }
    }
}
Also used : IJobSettingsView(org.talend.repository.ui.views.IJobSettingsView) IViewPart(org.eclipse.ui.IViewPart) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IPath(org.eclipse.core.runtime.IPath) EditRoutinePropertiesWizard(org.talend.repository.ui.wizards.routines.EditRoutinePropertiesWizard) ConnectionItem(org.talend.core.model.properties.ConnectionItem) IRunProcessService(org.talend.designer.runprocess.IRunProcessService) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IEditorPart(org.eclipse.ui.IEditorPart) EditProcessPropertiesWizard(org.talend.metadata.managment.ui.wizard.process.EditProcessPropertiesWizard) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) EditProcessPropertiesWizard(org.talend.metadata.managment.ui.wizard.process.EditProcessPropertiesWizard) EditRoutinePropertiesWizard(org.talend.repository.ui.wizards.routines.EditRoutinePropertiesWizard) PropertiesWizard(org.talend.metadata.managment.ui.wizard.PropertiesWizard) IESBService(org.talend.core.IESBService) ISelection(org.eclipse.jface.viewers.ISelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IDesignerCoreService(org.talend.designer.core.IDesignerCoreService) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IUIRefresher(org.talend.core.services.IUIRefresher)

Example 7 with IESBService

use of org.talend.core.IESBService in project tesb-studio-se by Talend.

the class WebServiceUI method serviceNodeSelected.

@Override
public void serviceNodeSelected(RepositoryNode serviceNode) {
    Item item = serviceNode.getObject().getProperty().getItem();
    IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
    String wsdlFilePath = service.getWsdlFilePath(item);
    if (wsdlFilePath != null) {
        wsdlFieldPart.setRawFieldValue(wsdlFilePath);
    }
}
Also used : Item(org.talend.core.model.properties.Item) IESBService(org.talend.core.IESBService)

Example 8 with IESBService

use of org.talend.core.IESBService in project tdi-studio-se by Talend.

the class DetecteViewImpactAction method init.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.commons.ui.swt.actions.ITreeContextualAction#init(org.eclipse.jface.viewers.TreeViewer,
     * org.eclipse.jface.viewers.IStructuredSelection)
     */
@Override
public void init(TreeViewer viewer, IStructuredSelection selection) {
    // try to check via extension point first.
    boolean canWork = UpdateManagerProviderDetector.INSTANCE.validateAction(viewer, selection);
    if (canWork) {
        setEnabled(true);
        return;
    }
    canWork = !selection.isEmpty() && selection.size() == 1;
    if (canWork) {
        IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
        if (factory.isUserReadOnlyOnCurrentProject()) {
            canWork = false;
        } else {
            Object o = selection.getFirstElement();
            RepositoryNode node = (RepositoryNode) o;
            ENodeType nodeType = node.getType();
            switch(nodeType) {
                case REPOSITORY_ELEMENT:
                    ERepositoryObjectType objectType = node.getObjectType();
                    /*
                     * TESB-6415 if it's "CAMEL" product, then is disable
                     */
                    if (objectType != null) {
                        String[] products = objectType.getProducts();
                        if (products != null && products.length == 1 && "CAMEL".equals(products[0])) {
                            setEnabled(false);
                            return;
                        }
                    }
                    if (objectType == ERepositoryObjectType.METADATA_CON_TABLE) {
                        IRepositoryViewObject repositoryObject = node.getObject();
                        if (repositoryObject != null) {
                            Item item2 = repositoryObject.getProperty().getItem();
                            if (item2 instanceof DatabaseConnectionItem) {
                                DatabaseConnectionItem item = (DatabaseConnectionItem) repositoryObject.getProperty().getItem();
                                DatabaseConnection connection = (DatabaseConnection) item.getConnection();
                                CDCConnection cdcConns = connection.getCdcConns();
                                if (cdcConns != null) {
                                    if (repositoryObject instanceof MetadataTableRepositoryObject) {
                                        MetadataTable table = ((MetadataTableRepositoryObject) repositoryObject).getTable();
                                        String tableType = table.getTableType();
                                        canWork = RepositoryConstants.TABLE.equals(tableType);
                                        break;
                                    }
                                }
                            }
                        }
                        canWork = true;
                    } else if (objectType == ERepositoryObjectType.METADATA_CON_QUERY || objectType == ERepositoryObjectType.METADATA_CONNECTIONS || objectType == ERepositoryObjectType.METADATA_FILE_DELIMITED || objectType == ERepositoryObjectType.METADATA_FILE_POSITIONAL || objectType == ERepositoryObjectType.METADATA_FILE_REGEXP || objectType == ERepositoryObjectType.METADATA_FILE_XML || objectType == ERepositoryObjectType.METADATA_FILE_LDIF || objectType == ERepositoryObjectType.METADATA_FILE_EXCEL || objectType == ERepositoryObjectType.METADATA_SAPCONNECTIONS || objectType == ERepositoryObjectType.METADATA_FILE_EBCDIC || objectType == ERepositoryObjectType.METADATA_FILE_HL7 || objectType == ERepositoryObjectType.METADATA_VALIDATION_RULES || objectType == ERepositoryObjectType.METADATA_FILE_FTP || objectType == ERepositoryObjectType.METADATA_FILE_BRMS || objectType == ERepositoryObjectType.METADATA_MDMCONNECTION || objectType == ERepositoryObjectType.CONTEXT || objectType == ERepositoryObjectType.JOBLET) {
                        canWork = true;
                    } else if (objectType == ERepositoryObjectType.BUSINESS_PROCESS || objectType == ERepositoryObjectType.PROCESS || objectType == ERepositoryObjectType.ROUTINES || objectType == ERepositoryObjectType.PIG_UDF || objectType == ERepositoryObjectType.JOB_SCRIPT || objectType == ERepositoryObjectType.SQLPATTERNS || objectType == ERepositoryObjectType.JOB_DOC || objectType == ERepositoryObjectType.JOBLET_DOC || objectType == ERepositoryObjectType.DOCUMENTATION || objectType == ERepositoryObjectType.PROCESS_MR || objectType == ERepositoryObjectType.METADATA_CON_COLUMN || (ERepositoryObjectType.TEST_CONTAINER != null && objectType == ERepositoryObjectType.TEST_CONTAINER)) {
                        canWork = false;
                    } else {
                        Object obj = selection.getFirstElement();
                        RepositoryNode nodeObj = (RepositoryNode) obj;
                        Item item = nodeObj.getObject().getProperty().getItem();
                        if (item instanceof ConnectionItem) {
                            if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
                                IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
                                if (service != null) {
                                    boolean flag = service.isServiceItem(item.eClass().getClassifierID());
                                    if (flag) {
                                        canWork = false;
                                        break;
                                    }
                                }
                            }
                        }
                        for (IRepositoryContentHandler handler : RepositoryContentManager.getHandlers()) {
                            ERepositoryObjectType stype = handler.getRepositoryObjectType(item);
                            if (stype == objectType) {
                                canWork = true;
                                break;
                            }
                        }
                        if (RepositoryContentManager.getHandlers().size() < 0) {
                            canWork = false;
                        }
                    }
                    break;
                default:
                    canWork = false;
            }
            RepositoryNode parent = node.getParent();
            if (canWork && parent != null && parent.isBin()) {
                canWork = false;
            }
            if (canWork && !ProjectManager.getInstance().isInCurrentMainProject(node)) {
                canWork = false;
            }
        }
    }
    setEnabled(canWork);
}
Also used : ConnectionItem(org.talend.core.model.properties.ConnectionItem) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) CDCConnection(org.talend.core.model.metadata.builder.connection.CDCConnection) RepositoryNode(org.talend.repository.model.RepositoryNode) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject) IRepositoryContentHandler(org.talend.core.model.repository.IRepositoryContentHandler) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) IESBService(org.talend.core.IESBService) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) ENodeType(org.talend.repository.model.IRepositoryNode.ENodeType) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Aggregations

IESBService (org.talend.core.IESBService)8 ConnectionItem (org.talend.core.model.properties.ConnectionItem)5 Item (org.talend.core.model.properties.Item)5 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)5 PersistenceException (org.talend.commons.exception.PersistenceException)4 DatabaseConnectionItem (org.talend.core.model.properties.DatabaseConnectionItem)4 ITDQPatternService (org.talend.core.ITDQPatternService)3 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)3 CDCConnection (org.talend.core.model.metadata.builder.connection.CDCConnection)2 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)2 IElementParameter (org.talend.core.model.process.IElementParameter)2 INode (org.talend.core.model.process.INode)2 FileItem (org.talend.core.model.properties.FileItem)2 LinkRulesItem (org.talend.core.model.properties.LinkRulesItem)2 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 HashedMap (org.apache.commons.collections.map.HashedMap)1