Search in sources :

Example 1 with AbstractRepositoryAction

use of org.talend.mdm.repository.core.AbstractRepositoryAction in project tmdm-studio-se by Talend.

the class RepositoryNodeActionProviderAdapter method getActions.

@Override
public List<AbstractRepositoryAction> getActions(IRepositoryViewObject viewObj) {
    List<AbstractRepositoryAction> actions = new LinkedList<AbstractRepositoryAction>();
    // 
    Item item = viewObj.getProperty().getItem();
    if (item instanceof MDMItem) {
        if (item instanceof ContainerItem) {
            FolderType type = ((FolderItem) item).getType();
            switch(type.getValue()) {
                case FolderType.SYSTEM_FOLDER:
                    addAction(actions, createFolderAction, viewObj);
                    addAction(actions, pasteAction, viewObj);
                    actions.add(importServerObjectAction);
                    actions.add(importObjectAction);
                    break;
                case FolderType.STABLE_SYSTEM_FOLDER:
                    break;
                case FolderType.FOLDER:
                    addAction(actions, createFolderAction, viewObj);
                    if (!((ContainerItem) item).getRepObjType().equals(ERepositoryObjectType.PROCESS)) {
                        actions.add(removeFromRepositoryAction);
                    }
                    addAction(actions, pasteAction, viewObj);
                    break;
            }
        } else if (item instanceof MDMServerObjectItem) {
            addAction(actions, removeFromRepositoryAction, viewObj);
            addAction(actions, mdmEditPropertyAction, viewObj);
            addAction(actions, openVersionAction, viewObj);
            addAction(actions, copyAction, viewObj);
            addAction(actions, pasteAction, viewObj);
            addAction(actions, duplicateAction, viewObj);
            if (exAdapter != null) {
                exAdapter.addActions(actions, viewObj);
            }
        } else if (item instanceof WorkspaceRootItem) {
            // fix bug TMDM-3168
            actions.add(importObjectAction);
        }
    }
    if (enableDebug) {
        // for debug digestValue
        addAction(actions, debugDigestValueAction, viewObj);
    }
    // 
    actions.add(refreshAction);
    actions.add(exportObjectAction);
    // action provider
    for (IRepositoryNodeActionProvider provider : getExtendActionProviders()) {
        List<AbstractRepositoryAction> providerActions = provider.getActions(viewObj);
        if (providerActions != null) {
            actions.addAll(providerActions);
        }
    }
    if (viewObj.getRepositoryObjectType() != null && IServerObjectRepositoryType.TYPE_EVENTMANAGER.equals(viewObj.getRepositoryObjectType())) {
        actions.add(emAction);
    }
    // 
    return actions;
}
Also used : MDMItem(org.talend.mdm.repository.model.mdmproperties.MDMItem) AbstractRepositoryAction(org.talend.mdm.repository.core.AbstractRepositoryAction) WorkspaceRootItem(org.talend.mdm.repository.model.mdmproperties.WorkspaceRootItem) Item(org.talend.core.model.properties.Item) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) FolderItem(org.talend.core.model.properties.FolderItem) MDMItem(org.talend.mdm.repository.model.mdmproperties.MDMItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) WorkspaceRootItem(org.talend.mdm.repository.model.mdmproperties.WorkspaceRootItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) FolderItem(org.talend.core.model.properties.FolderItem) IRepositoryNodeActionProvider(org.talend.mdm.repository.core.IRepositoryNodeActionProvider) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) LinkedList(java.util.LinkedList) FolderType(org.talend.core.model.properties.FolderType)

Example 2 with AbstractRepositoryAction

use of org.talend.mdm.repository.core.AbstractRepositoryAction in project tmdm-studio-se by Talend.

the class TISProcessActionProvider method getActions.

@Override
public List<AbstractRepositoryAction> getActions(IRepositoryViewObject viewObj) {
    List<AbstractRepositoryAction> actions = super.getActions(viewObj);
    Item item = viewObj.getProperty().getItem();
    if (item instanceof ContainerItem) {
        FolderType type = ((FolderItem) item).getType();
        switch(type.getValue()) {
            case FolderType.SYSTEM_FOLDER:
                addAction(actions, createProcessAction, viewObj);
                break;
            case FolderType.STABLE_SYSTEM_FOLDER:
                break;
            case FolderType.FOLDER:
                addAction(actions, createProcessAction, viewObj);
                addAction(actions, renameFolderAction, viewObj);
                addAction(actions, deleteAction, viewObj);
                break;
        }
    } else if (item instanceof ProcessItem) {
        addAction(actions, editProcessAction, viewObj);
        addAction(actions, readProcessAction, viewObj);
        addAction(actions, runProcessAction, viewObj);
        addAction(actions, openExistVersionProcessAction, viewObj);
        addAction(actions, editPropAction, viewObj);
        addAction(actions, deleteAction, viewObj);
        addAction(actions, generateTransformerAction, viewObj);
        addAction(actions, generateTriggerAction, viewObj);
        // deploy
        actions.add(deployToAction);
        addAction(actions, deployToLastServerAction, viewObj);
        addAction(actions, deployAnotherToAction, viewObj);
        addAction(actions, undeployAction, viewObj);
    }
    actions.add(deployAllAction);
    return actions;
}
Also used : AbstractRepositoryAction(org.talend.mdm.repository.core.AbstractRepositoryAction) ProcessItem(org.talend.core.model.properties.ProcessItem) Item(org.talend.core.model.properties.Item) FolderItem(org.talend.core.model.properties.FolderItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) FolderItem(org.talend.core.model.properties.FolderItem) ProcessItem(org.talend.core.model.properties.ProcessItem) FolderType(org.talend.core.model.properties.FolderType)

Example 3 with AbstractRepositoryAction

use of org.talend.mdm.repository.core.AbstractRepositoryAction in project tmdm-studio-se by Talend.

the class DataModelActionProvider method getActions.

@Override
public List<AbstractRepositoryAction> getActions(IRepositoryViewObject viewObj) {
    List<AbstractRepositoryAction> actions = super.getActions(viewObj);
    if (RepositoryResourceUtil.hasContainerItem(viewObj, FolderType.SYSTEM_FOLDER_LITERAL, FolderType.FOLDER_LITERAL)) {
        addAction(actions, addAction, viewObj);
    }
    if (viewObj.getProperty().getItem() instanceof MDMServerObjectItem) {
        addAction(actions, renameAction, viewObj);
        // validate
        if (validateAction != null) {
            addAction(actions, validateAction, viewObj);
        }
        // deploy
        addAction(actions, deployToAction, viewObj);
        addAction(actions, deployToLastServerAction, viewObj);
        addAction(actions, deployAnotherToAction, viewObj);
        addAction(actions, undeployAction, viewObj);
        IDataModelActionProviderExAdapter exAdapter = getExAdapter();
        if (exAdapter != null && exAdapter.getActions() != null) {
            for (AbstractRepositoryAction action : exAdapter.getActions()) {
                addAction(actions, action, viewObj);
            }
        }
    }
    addAction(actions, deployAllAction, viewObj);
    return actions;
}
Also used : AbstractRepositoryAction(org.talend.mdm.repository.core.AbstractRepositoryAction) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)

Example 4 with AbstractRepositoryAction

use of org.talend.mdm.repository.core.AbstractRepositoryAction in project tmdm-studio-se by Talend.

the class TreeViewerListener method fillLocalToolBar.

private void fillLocalToolBar(IToolBarManager manager) {
    RefreshAction refreshViewAction = new RefreshAction(true);
    refreshViewAction.initCommonViewer(((CommonNavigator) this).getCommonViewer());
    manager.add(new Separator());
    manager.add(refreshViewAction);
    manager.add(new Separator());
    deployAll = new DeployAllAction(true);
    deployAll.initCommonViewer(((CommonNavigator) this).getCommonViewer());
    manager.add(deployAll);
    manager.add(new Separator());
    AbstractRepositoryAction importObject = ImportObjectAction.createImportAction();
    importObject.initCommonViewer(((CommonNavigator) this).getCommonViewer());
    manager.add(importObject);
    // manager.add(new Separator());
    ExportObjectAction exportObject = new ExportObjectAction();
    exportObject.initCommonViewer(((CommonNavigator) this).getCommonViewer());
    manager.add(exportObject);
    // manager.add(new Separator());
    ImportServerObjectAction importServerObject = new ImportServerObjectAction();
    importServerObject.initCommonViewer(((CommonNavigator) this).getCommonViewer());
    manager.add(importServerObject);
    manager.add(new Separator());
}
Also used : DeployAllAction(org.talend.mdm.repository.ui.actions.DeployAllAction) AbstractRepositoryAction(org.talend.mdm.repository.core.AbstractRepositoryAction) ExportObjectAction(org.talend.mdm.repository.ui.actions.ExportObjectAction) ImportServerObjectAction(org.talend.mdm.repository.ui.actions.ImportServerObjectAction) RefreshAction(org.talend.mdm.repository.ui.actions.RefreshAction) Separator(org.eclipse.jface.action.Separator)

Example 5 with AbstractRepositoryAction

use of org.talend.mdm.repository.core.AbstractRepositoryAction in project tmdm-studio-se by Talend.

the class MDMRepositoryActionProvider method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    if (ProxyRepositoryFactory.getInstance().isUserReadOnlyOnCurrentProject()) {
        return;
    }
    IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
    List<AbstractRepositoryAction> finalActions = null;
    for (Iterator il = selection.iterator(); il.hasNext(); ) {
        Object obj = il.next();
        if (obj instanceof IRepositoryViewObject) {
            IRepositoryViewObject viewObj = (IRepositoryViewObject) obj;
            IRepositoryNodeConfiguration conf = RepositoryNodeConfigurationManager.getConfiguration(viewObj);
            IRepositoryNodeActionProvider actionProvider = conf.getActionProvider();
            if (conf != null && actionProvider != null) {
                actionProvider.updateSelection(selection);
                List<AbstractRepositoryAction> actions = actionProvider.getActions(viewObj);
                if (actions != null) {
                    if (finalActions == null) {
                        finalActions = actions;
                    }
                    finalActions = combineActions(finalActions, actions);
                    if (finalActions.size() == 0) {
                        return;
                    }
                }
            }
        }
    }
    // hook action to menu
    for (IAction action : finalActions) {
        if (action instanceof AbstractRepositoryAction) {
            AbstractRepositoryAction groupAction = (AbstractRepositoryAction) action;
            groupAction.selectionChanged(selection);
            if (groupAction.getGroupName() != null) {
                menu.appendToGroup(groupAction.getGroupName(), action);
            } else {
                menu.add(action);
            }
        }
    }
}
Also used : AbstractRepositoryAction(org.talend.mdm.repository.core.AbstractRepositoryAction) IAction(org.eclipse.jface.action.IAction) IRepositoryNodeActionProvider(org.talend.mdm.repository.core.IRepositoryNodeActionProvider) Iterator(java.util.Iterator) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryNodeConfiguration(org.talend.mdm.repository.core.IRepositoryNodeConfiguration) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

AbstractRepositoryAction (org.talend.mdm.repository.core.AbstractRepositoryAction)7 Item (org.talend.core.model.properties.Item)4 ContainerItem (org.talend.mdm.repository.model.mdmproperties.ContainerItem)4 MDMServerObjectItem (org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)4 IRepositoryNodeActionProvider (org.talend.mdm.repository.core.IRepositoryNodeActionProvider)3 FolderItem (org.talend.core.model.properties.FolderItem)2 FolderType (org.talend.core.model.properties.FolderType)2 IRepositoryNodeConfiguration (org.talend.mdm.repository.core.IRepositoryNodeConfiguration)2 Iterator (java.util.Iterator)1 LinkedList (java.util.LinkedList)1 IAction (org.eclipse.jface.action.IAction)1 Separator (org.eclipse.jface.action.Separator)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 PartInitException (org.eclipse.ui.PartInitException)1 ERepositoryStatus (org.talend.commons.runtime.model.repository.ERepositoryStatus)1 ProcessItem (org.talend.core.model.properties.ProcessItem)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 MDMItem (org.talend.mdm.repository.model.mdmproperties.MDMItem)1 WorkspaceRootItem (org.talend.mdm.repository.model.mdmproperties.WorkspaceRootItem)1 MDMServerObject (org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)1