use of org.talend.commons.runtime.model.repository.ERepositoryStatus in project tmdm-studio-se by Talend.
the class OpenObjectAction method isLocked.
@Override
protected boolean isLocked() {
List<Object> selectedObject = getSelectedObject();
if (!selectedObject.isEmpty()) {
Object object = selectedObject.get(0);
if (object instanceof IRepositoryViewObject) {
IRepositoryViewObject viewObj = (IRepositoryViewObject) object;
ERepositoryStatus status = factory.getStatus(viewObj);
if (status == ERepositoryStatus.LOCK_BY_USER) {
return !status.isEditable();
} else if (status == ERepositoryStatus.LOCK_BY_OTHER) {
return false;
}
}
}
return false;
}
use of org.talend.commons.runtime.model.repository.ERepositoryStatus in project tmdm-studio-se by Talend.
the class AbstractBridgeLabelProvider method getRepositoryImage.
protected Image getRepositoryImage(IRepositoryViewObject object) {
// Item item = property.getItem();
ERepositoryObjectType itemType = object.getRepositoryObjectType();
Image img = null;
if (object instanceof RepositoryViewObject && ((RepositoryViewObject) object).getCustomImage() != null) {
img = ((RepositoryViewObject) object).getCustomImage();
} else {
img = CoreImageProvider.getImage(itemType);
}
ERepositoryStatus repositoryStatus = object.getRepositoryStatus();
// For offline mode,its item is locked by default but need show the default image.
if (editableAsReadOnly) {
if (repositoryStatus == ERepositoryStatus.LOCK_BY_USER) {
repositoryStatus = ERepositoryStatus.DEFAULT;
}
}
Image image = OverlayImageProvider.getImageWithStatus(img, repositoryStatus);
ERepositoryStatus informationStatus = object.getInformationStatus();
return OverlayImageProvider.getImageWithStatus(image, informationStatus);
}
use of org.talend.commons.runtime.model.repository.ERepositoryStatus in project tesb-studio-se by Talend.
the class OpenWSDLAction method init.
@Override
protected void init(RepositoryNode node) {
ERepositoryObjectType nodeType = (ERepositoryObjectType) node.getProperties(EProperties.CONTENT_TYPE);
if (!currentNodeType.equals(nodeType)) {
return;
}
this.setText(createLabel);
// IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (node.getType() != ENodeType.REPOSITORY_ELEMENT) {
return;
}
try {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
factory.updateLockStatus();
ERepositoryStatus status = factory.getStatus(node.getObject());
if (status.isEditable() || ERepositoryStatus.DEFAULT == status) {
setEnabled(isLastVersion(node));
} else {
setEnabled(false);
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
use of org.talend.commons.runtime.model.repository.ERepositoryStatus in project tesb-studio-se by Talend.
the class PublishMetadataAction method init.
/*
* (non-Javadoc)
*
* @see org.talend.repository.ui.actions.ITreeContextualAction#init(org.eclipse.jface.viewers.TreeViewer,
* org.eclipse.jface.viewers.IStructuredSelection)
*/
public void init(TreeViewer viewer, IStructuredSelection selection) {
setEnabled(false);
if (selection.size() != 1) {
return;
}
RepositoryNode node = (RepositoryNode) selection.iterator().next();
if (node.getType() == ENodeType.REPOSITORY_ELEMENT && node.getProperties(EProperties.CONTENT_TYPE) == ESBRepositoryNodeType.SERVICES && node.getObject() != null && ProxyRepositoryFactory.getInstance().getStatus(node.getObject()) != ERepositoryStatus.DELETED) {
serviceItem = (ServiceItem) node.getObject().getProperty().getItem();
if (viewer != null) {
shell = viewer.getTree().getShell();
} else {
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
}
try {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
factory.updateLockStatus();
ERepositoryStatus status = factory.getStatus(node.getObject());
if (!status.isEditable() && !status.isPotentiallyEditable()) {
setEnabled(false);
return;
}
} catch (PersistenceException e) {
e.printStackTrace();
}
setEnabled(true);
}
}
Aggregations