use of org.talend.mdm.repository.core.IRepositoryNodeActionProvider 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();
}
}
}
}
}
use of org.talend.mdm.repository.core.IRepositoryNodeActionProvider in project tmdm-studio-se by Talend.
the class ActionProviderManager method initProviderDefine.
private static void initProviderDefine() {
if (!inited) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
//
IExtensionPoint extensionPoint = registry.getExtensionPoint(RepositoryPlugin.PLUGIN_ID, EXTENSION_POINT_TEMPLATE);
if (extensionPoint != null && extensionPoint.isValid()) {
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension s : extensions) {
IConfigurationElement[] elements = s.getConfigurationElements();
for (IConfigurationElement element : elements) {
String id = element.getAttribute(ID);
if (id != null && element.getAttribute(PROP_CLASS) != null) {
try {
IRepositoryNodeActionProvider actionProvider = (IRepositoryNodeActionProvider) element.createExecutableExtension(PROP_CLASS);
providerMap.put(id, actionProvider);
} catch (CoreException e) {
log.error(e.getMessage(), e);
}
}
}
}
}
inited = true;
}
}
Aggregations