Search in sources :

Example 6 with AbstractRepositoryAction

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

the class ViewActionProvider method getActions.

@Override
public List<AbstractRepositoryAction> getActions(IRepositoryViewObject viewObj) {
    List<AbstractRepositoryAction> actions = super.getActions(viewObj);
    Item item = viewObj.getProperty().getItem();
    String path = item.getState().getPath();
    if (path.isEmpty()) {
        actions.remove(createFolderAction);
    }
    if ((item instanceof ContainerItem) && (path.equals(IPath.SEPARATOR + IViewNodeConstDef.PATH_SEARCHFILTER) || path.equals(IPath.SEPARATOR + IViewNodeConstDef.PATH_WEBFILTER))) {
        actions.remove(removeFromRepositoryAction);
    }
    if (RepositoryResourceUtil.hasContainerItem(viewObj, FolderType.SYSTEM_FOLDER_LITERAL, FolderType.FOLDER_LITERAL)) {
        addAction(actions, addAction, viewObj);
    }
    if (viewObj.getProperty().getItem() instanceof MDMServerObjectItem) {
        int index = actions.indexOf(mdmEditPropertyAction);
        if (index != -1) {
            actions.add(index, editViewProcessPropertyAction);
            actions.remove(mdmEditPropertyAction);
        }
        addAction(actions, renameViewAction, viewObj);
        addAction(actions, browseViewAction, viewObj);
        // deploy
        addAction(actions, deployToAction, viewObj);
        addAction(actions, deployToLastServerAction, viewObj);
        addAction(actions, deployAnotherToAction, viewObj);
        addAction(actions, undeployAction, viewObj);
    }
    addAction(actions, deployAllAction, viewObj);
    return actions;
}
Also used : AbstractRepositoryAction(org.talend.mdm.repository.core.AbstractRepositoryAction) Item(org.talend.core.model.properties.Item) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)

Example 7 with AbstractRepositoryAction

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

the class OpenObjectAction method openItem.

private void openItem(IRepositoryViewObject viewObject) {
    Item item = viewObject.getProperty().getItem();
    item = RepositoryResourceUtil.assertItem(item);
    IRepositoryNodeConfiguration configuration = RepositoryNodeConfigurationManager.getConfiguration(item);
    if (configuration != null) {
        IRepositoryNodeActionProvider actionProvider = configuration.getActionProvider();
        if (actionProvider != null) {
            IRepositoryViewEditorInput editorInput = actionProvider.getOpenEditorInput(viewObject);
            if (editorInput != null) {
                if (page == null) {
                    this.page = getCommonViewer().getCommonNavigator().getSite().getWorkbenchWindow().getActivePage();
                }
                // do extra action
                MDMServerObject serverObject = ((MDMServerObjectItem) item).getMDMServerObject();
                if (!checkMissingJar(serverObject)) {
                    return;
                }
                boolean selected = doSelectServer(item, editorInput);
                if (!selected) {
                    return;
                }
                try {
                    // svn lock
                    ERepositoryStatus status = factory.getStatus(item);
                    boolean isEditable = factory.isEditableAndLockIfPossible(item);
                    if (isEditable) {
                        getCommonViewer().refresh(viewObject);
                    }
                    // 
                    editorInput.setReadOnly(status == ERepositoryStatus.LOCK_BY_OTHER || status == ERepositoryStatus.READ_ONLY || !isEditable);
                    if (!editorInput.isReadOnly()) {
                        editorInput.setReadOnly(item.getState().isDeleted());
                    }
                    updateEditorInputVersionInfo(editorInput, viewObject);
                    activeEditor = this.page.openEditor(editorInput, editorInput.getEditorId());
                    if (marker != null) {
                        IDE.gotoMarker(activeEditor, marker);
                    }
                } catch (PartInitException e) {
                    log.error(e.getMessage(), e);
                }
            } else {
                AbstractRepositoryAction openAction = actionProvider.getOpenAction(viewObject);
                if (openAction != null) {
                    openAction.selectionChanged(getStructuredSelection());
                    openAction.run();
                }
            }
        }
    }
}
Also used : Item(org.talend.core.model.properties.Item) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) AbstractRepositoryAction(org.talend.mdm.repository.core.AbstractRepositoryAction) ERepositoryStatus(org.talend.commons.runtime.model.repository.ERepositoryStatus) IRepositoryViewEditorInput(org.talend.mdm.repository.ui.editors.IRepositoryViewEditorInput) IRepositoryNodeActionProvider(org.talend.mdm.repository.core.IRepositoryNodeActionProvider) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IRepositoryNodeConfiguration(org.talend.mdm.repository.core.IRepositoryNodeConfiguration) PartInitException(org.eclipse.ui.PartInitException) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)

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