use of org.talend.designer.camel.resource.core.model.ResourceDependencyModel in project tesb-studio-se by Talend.
the class CamelDesignerCoreService method addResourcesContent.
private void addResourcesContent(Item item, Element jobElement) {
Element resourcesElement = jobElement.addElement("RouteResources");
for (ResourceDependencyModel resource : RouteResourceUtil.getResourceDependencies((ProcessItem) item)) {
Element resourceElement = resourcesElement.addElement("Resource");
resourceElement.addAttribute("name", resource.toString());
resourceElement.addAttribute("version", resource.getSelectedVersion());
resourceElement.addAttribute("path", resource.getClassPathUrl());
}
}
use of org.talend.designer.camel.resource.core.model.ResourceDependencyModel in project tesb-studio-se by Talend.
the class ManageRouteResourcePanel method deleteData.
protected void deleteData() {
ResourceDependencyModel item = getSelectedItem();
if (item != null) {
getInput().remove(item);
resourcesTV.refresh();
fireDependenciesChangedListener();
}
}
use of org.talend.designer.camel.resource.core.model.ResourceDependencyModel in project tesb-studio-se by Talend.
the class ManageRouteResourcePanel method copyPath.
/**
* Copy class path
*/
protected void copyPath() {
final ResourceDependencyModel item = getSelectedItem();
if (item != null) {
Clipboard clipboard = new Clipboard(getDisplay());
clipboard.setContents(new String[] { item.getClassPathUrl() }, new Transfer[] { TextTransfer.getInstance() });
MessageDialog.openInformation(getShell(), Messages.ManageRouteResourceDialog_copyTitle, MessageFormat.format(Messages.ManageRouteResourceDialog_copyMsg, item.getClassPathUrl()));
}
}
use of org.talend.designer.camel.resource.core.model.ResourceDependencyModel in project tesb-studio-se by Talend.
the class RouteResourceUtil method createDenpendencyModel.
/**
* Create ResourceDependencyModel
*
* @param paramName
* @param node
* @return
*/
private static ResourceDependencyModel createDenpendencyModel(final INode node) {
if (!node.isActivate()) {
return null;
}
final IElementParameter idParam = node.getElementParameterFromField(EParameterFieldType.ROUTE_RESOURCE_TYPE);
if (null == idParam || !idParam.isShow(node.getElementParameters())) {
return null;
}
final IElementParameter versionParam = node.getElementParameter(idParam.getName() + ':' + EParameterName.ROUTE_RESOURCE_TYPE_VERSION);
final ResourceDependencyModel model = RouteResourceUtil.createDependency((String) idParam.getValue(), (String) versionParam.getValue());
if (null != model) {
model.setBuiltIn(true);
model.getRefNodes().add(node.getUniqueName());
}
return model;
}
use of org.talend.designer.camel.resource.core.model.ResourceDependencyModel in project tesb-studio-se by Talend.
the class RouteResourceUtil method createDependency.
/**
*
* @param id
* @param version
* @return
*/
public static ResourceDependencyModel createDependency(String id, String version) {
try {
final IRepositoryViewObject rvo;
if (ResourceDependencyModel.LATEST_VERSION.equals(version)) {
rvo = ProxyRepositoryFactory.getInstance().getLastVersion(id);
} else {
rvo = ProxyRepositoryFactory.getInstance().getSpecificVersion(id, version, true);
}
if (rvo != null) {
final ResourceDependencyModel model = new ResourceDependencyModel((RouteResourceItem) rvo.getProperty().getItem());
model.setSelectedVersion(version);
return model;
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
return null;
}
Aggregations