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;
}
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();
}
}
}
}
}
Aggregations