use of org.talend.core.model.repository.EmptyRepositoryObject in project tdi-studio-se by Talend.
the class AbstractSection method setInput.
@Override
public void setInput(IWorkbenchPart part, ISelection selection) {
super.setInput(part, selection);
Assert.isTrue(selection instanceof IStructuredSelection);
Object input = ((IStructuredSelection) selection).getFirstElement();
if (!(input instanceof RepositoryNode)) {
if (input instanceof IAdaptable) {
// see ProcessPart.getAdapter()
IAdaptable adaptable = (IAdaptable) input;
input = adaptable.getAdapter(RepositoryNode.class);
}
}
Assert.isTrue(input instanceof RepositoryNode);
repositoryNode = (RepositoryNode) input;
repositoryObject = repositoryNode.getObject();
if (repositoryObject == null) {
repositoryObject = new EmptyRepositoryObject();
enableControls(false);
showControls(false);
return;
}
manageLock();
ERepositoryObjectType type = repositoryObject.getRepositoryObjectType();
showControls(type != ERepositoryObjectType.METADATA_CON_TABLE);
}
use of org.talend.core.model.repository.EmptyRepositoryObject in project tdi-studio-se by Talend.
the class JobSettingsView method selectionChanged.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.
* SelectionChangedEvent )
*/
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
if (selection instanceof StructuredSelection) {
Object input = ((IStructuredSelection) selection).getFirstElement();
if (!(input instanceof RepositoryNode)) {
if (input instanceof IAdaptable) {
// see ProcessPart.getAdapter()
IAdaptable adaptable = (IAdaptable) input;
input = adaptable.getAdapter(RepositoryNode.class);
}
}
if (input instanceof RepositoryNode) {
RepositoryNode repositoryNode = (RepositoryNode) input;
Object obj = repositoryNode.getProperties(EProperties.CONTENT_TYPE);
String type = null;
if (obj != null) {
type = obj.toString();
if (obj instanceof ERepositoryObjectType) {
ERepositoryObjectType objType = (ERepositoryObjectType) obj;
if (objType == ERepositoryObjectType.PROCESS) {
type = getViewNameLable();
} else if (objType == ERepositoryObjectType.JOBLET) {
type = VIEW_NAME_JOBLET;
}
}
} else {
return;
}
IRepositoryViewObject repositoryObject = repositoryNode.getObject();
if (repositoryObject == null) {
repositoryObject = new EmptyRepositoryObject();
return;
}
String title = repositoryObject.getLabel();
if (allowVerchange) {
if (repositoryObject.getVersion() != null) {
//$NON-NLS-1$
title = repositoryObject.getLabel() + " " + repositoryObject.getVersion();
}
}
Image jobSettingImage = null;
ERepositoryObjectType repositoryObjectType = repositoryNode.getObjectType();
if (repositoryObjectType == ERepositoryObjectType.PROCESS_MR || repositoryObjectType == ERepositoryObjectType.PROCESS_STORM) {
jobSettingImage = getImage(repositoryObject);
}
if (jobSettingImage == null) {
jobSettingImage = getImageFromFramework(repositoryObjectType);
}
if (jobSettingImage == null) {
jobSettingImage = ImageProvider.getImage(repositoryNode.getIcon());
}
setElement(repositoryObject, type + SEPARATOR + title, jobSettingImage);
}
}
}
Aggregations