use of org.talend.core.context.RepositoryContext in project tmdm-studio-se by Talend.
the class AbstractBridgeLabelProvider method isEditableAsReadOnly.
private void isEditableAsReadOnly() {
Context ctx = CoreRuntimePlugin.getInstance().getContext();
RepositoryContext rc = (RepositoryContext) ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
this.editableAsReadOnly = rc.isEditableAsReadOnly();
}
use of org.talend.core.context.RepositoryContext in project tmdm-studio-se by Talend.
the class ServerDefService method createServerDef.
public static String createServerDef(MDMServerDef serverDef) {
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
RepositoryContext context = factory.getRepositoryContext();
MDMServerDefItem item = MdmpropertiesFactory.eINSTANCE.createMDMServerDefItem();
item.setServerDef(serverDef);
Property prop = PropertiesFactory.eINSTANCE.createProperty();
item.setProperty(prop);
try {
String nextId = factory.getNextId();
Property property = item.getProperty();
property.setId(nextId);
property.setVersion(VersionUtils.DEFAULT_VERSION);
property.setAuthor(context.getUser());
property.setLabel(item.getServerDef().getName());
// $NON-NLS-1$
factory.create(item, new Path(""));
return nextId;
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
}
return null;
}
use of org.talend.core.context.RepositoryContext in project tesb-studio-se by Talend.
the class CreateMavenBundlePom method getProcessor.
public static IProcessor getProcessor(JobInfo jobInfo) {
if (jobInfo.getProcessor() != null) {
return jobInfo.getProcessor();
}
IProcess process = null;
ProcessItem processItem;
processItem = jobInfo.getProcessItem();
if (processItem == null && jobInfo.getJobVersion() == null) {
processItem = ItemCacheManager.getProcessItem(jobInfo.getJobId());
}
if (processItem == null && jobInfo.getJobVersion() != null) {
processItem = ItemCacheManager.getProcessItem(jobInfo.getJobId(), jobInfo.getJobVersion());
}
if (processItem == null && jobInfo.getProcess() == null) {
return null;
}
if (jobInfo.getProcess() == null) {
if (processItem != null) {
IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
process = service.getProcessFromProcessItem(processItem);
if (process instanceof IProcess2) {
((IProcess2) process).setProperty(processItem.getProperty());
}
}
if (process == null) {
return null;
}
} else {
process = jobInfo.getProcess();
}
Property curProperty = processItem.getProperty();
if (processItem.getProperty() == null && process instanceof IProcess2) {
curProperty = ((IProcess2) process).getProperty();
}
IRunProcessService service = CorePlugin.getDefault().getRunProcessService();
IProcessor processor = service.createCodeProcessor(process, curProperty, ((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getProject().getLanguage(), true);
jobInfo.setProcessor(processor);
return processor;
}
Aggregations