use of org.talend.mdm.repository.core.IRepositoryNodeActionProvider in project tmdm-studio-se by Talend.
the class RepositoryNodeActionProviderAdapter method getExtendActionProviders.
private IRepositoryNodeActionProvider[] getExtendActionProviders() {
if (extendActionProviders == null) {
boolean isLocalProj = ProjectManager.getInstance().getCurrentProject().isLocal();
boolean isOffline = ProxyRepositoryFactory.getInstance().getRepositoryContext().isOffline();
if (!isLocalProj && !isOffline) {
IRepositoryNodeActionProvider svnProvider = ActionProviderManager.getActionProvider(SVN_ACTION_PROVIDER_ID);
IRepositoryNodeActionProvider gitProvider = ActionProviderManager.getActionProvider(GIT_ACTION_PROVIDER_ID);
if (svnProvider != null && gitProvider != null) {
extendActionProviders = new IRepositoryNodeActionProvider[] { svnProvider, gitProvider };
} else if (svnProvider != null) {
extendActionProviders = new IRepositoryNodeActionProvider[] { svnProvider };
} else if (gitProvider != null) {
extendActionProviders = new IRepositoryNodeActionProvider[] { gitProvider };
}
}
if (extendActionProviders == null) {
extendActionProviders = new IRepositoryNodeActionProvider[0];
}
}
return extendActionProviders;
}
use of org.talend.mdm.repository.core.IRepositoryNodeActionProvider 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;
}
use of org.talend.mdm.repository.core.IRepositoryNodeActionProvider in project tmdm-studio-se by Talend.
the class MDMRepositoryActionProvider method init.
@Override
public void init(ICommonActionExtensionSite aSite) {
CommonViewer commonViewer = (CommonViewer) aSite.getStructuredViewer();
for (IRepositoryNodeConfiguration conf : RepositoryNodeConfigurationManager.getConfigurations()) {
IRepositoryNodeActionProvider actionProvider = conf.getActionProvider();
if (actionProvider != null) {
actionProvider.setRepositoryViewGlobalActionHandler(this);
actionProvider.initCommonViewer(commonViewer);
}
}
initCommonViewerForActions(commonViewer);
}
use of org.talend.mdm.repository.core.IRepositoryNodeActionProvider 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);
}
}
}
}
use of org.talend.mdm.repository.core.IRepositoryNodeActionProvider in project tmdm-studio-se by Talend.
the class RepositoryNodeActionProviderAdapter method initCommonViewer.
@Override
public void initCommonViewer(CommonViewer commonViewer) {
importObjectAction = initRepositoryAction(ImportObjectAction.createImportAction(), commonViewer);
exportObjectAction = initRepositoryAction(new ExportObjectAction(), commonViewer);
createFolderAction = initRepositoryAction(new CreateFolderAction(), commonViewer);
removeFromRepositoryAction = initRepositoryAction(new RemoveFromRepositoryAction(), commonViewer);
renameAction = initRepositoryAction(new RenameObjectAction(), commonViewer);
duplicateAction = initRepositoryAction(new DuplicateAction(), commonViewer);
deployToAction = initRepositoryAction(new DeployToAction(), commonViewer);
deployAnotherToAction = initRepositoryAction(new DeployAnotherVersionAction(), commonViewer);
deployToLastServerAction = initRepositoryAction(new DeployToLastServerAction(), commonViewer);
undeployAction = initRepositoryAction(new UndeployAction(), commonViewer);
deployAllAction = initRepositoryAction(new DeployAllAction(false), commonViewer);
emAction = initRepositoryAction(new MDMEventManagerAction(), commonViewer);
importServerObjectAction = initRepositoryAction(new ImportServerObjectAction(), commonViewer);
mdmEditPropertyAction = initRepositoryAction(new MDMEditPropertyAction(), commonViewer);
openVersionAction = initRepositoryAction(new MDMOpenExistVersionProcessAction(), commonViewer);
// for debug digestValue
debugDigestValueAction = initRepositoryAction(new DebugDigestValueAction(), commonViewer);
//
if (hasValidateService()) {
validateAction = initRepositoryAction(new ValidateAction(), commonViewer);
}
//
refreshAction = globalActionHandler.getGlobalAction(IRepositoryViewGlobalActionHandler.REFRESH);
copyAction = globalActionHandler.getGlobalAction(IRepositoryViewGlobalActionHandler.COPY);
if (exAdapter != null) {
exAdapter.initCommonViewer(commonViewer);
}
pasteAction = globalActionHandler.getGlobalAction(IRepositoryViewGlobalActionHandler.PASTE);
// action provider
for (IRepositoryNodeActionProvider provider : getExtendActionProviders()) {
provider.initCommonViewer(commonViewer);
}
// recycle
RepositoryNodeConfigurationManager.getRecycleBinNodeConfiguration().getActionProvider().initCommonViewer(commonViewer);
}
Aggregations