Search in sources :

Example 1 with ResourceDependencyModel

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());
    }
}
Also used : ResourceDependencyModel(org.talend.designer.camel.resource.core.model.ResourceDependencyModel) Element(org.dom4j.Element)

Example 2 with ResourceDependencyModel

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();
    }
}
Also used : ResourceDependencyModel(org.talend.designer.camel.resource.core.model.ResourceDependencyModel)

Example 3 with ResourceDependencyModel

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()));
    }
}
Also used : ResourceDependencyModel(org.talend.designer.camel.resource.core.model.ResourceDependencyModel) Clipboard(org.eclipse.swt.dnd.Clipboard)

Example 4 with ResourceDependencyModel

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;
}
Also used : ResourceDependencyModel(org.talend.designer.camel.resource.core.model.ResourceDependencyModel) IElementParameter(org.talend.core.model.process.IElementParameter)

Example 5 with ResourceDependencyModel

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;
}
Also used : ResourceDependencyModel(org.talend.designer.camel.resource.core.model.ResourceDependencyModel) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException)

Aggregations

ResourceDependencyModel (org.talend.designer.camel.resource.core.model.ResourceDependencyModel)11 HashSet (java.util.HashSet)2 PersistenceException (org.talend.commons.exception.PersistenceException)2 IElementParameter (org.talend.core.model.process.IElementParameter)2 Item (org.talend.core.model.properties.Item)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 Element (org.dom4j.Element)1 IFile (org.eclipse.core.resources.IFile)1 IFolder (org.eclipse.core.resources.IFolder)1 CoreException (org.eclipse.core.runtime.CoreException)1 IPath (org.eclipse.core.runtime.IPath)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 Clipboard (org.eclipse.swt.dnd.Clipboard)1 ToolItem (org.eclipse.swt.widgets.ToolItem)1 CamelProcessItem (org.talend.camel.core.model.camelProperties.CamelProcessItem)1 RouteResourceItem (org.talend.camel.core.model.camelProperties.RouteResourceItem)1