Search in sources :

Example 6 with ResourceDependencyModel

use of org.talend.designer.camel.resource.core.model.ResourceDependencyModel in project tesb-studio-se by Talend.

the class ResourcesItemRelationshipHandler method collect.

@Override
protected Set<Relation> collect(Item baseItem) {
    if (baseItem.eClass() != CamelPropertiesPackage.Literals.CAMEL_PROCESS_ITEM && baseItem.eClass() != CamelPropertiesPackage.Literals.ROUTELET_PROCESS_ITEM) {
        return Collections.emptySet();
    }
    final Set<Relation> relationSet = new HashSet<Relation>();
    for (ResourceDependencyModel depModel : RouteResourceUtil.getResourceDependencies((ProcessItem) baseItem)) {
        final Relation addedRelation = new Relation();
        addedRelation.setId(depModel.getItem().getProperty().getId());
        addedRelation.setType(RelationshipItemBuilder.RESOURCE_RELATION);
        addedRelation.setVersion(RelationshipItemBuilder.LATEST_VERSION);
        relationSet.add(addedRelation);
    }
    return relationSet;
}
Also used : Relation(org.talend.core.model.relationship.Relation) ResourceDependencyModel(org.talend.designer.camel.resource.core.model.ResourceDependencyModel) HashSet(java.util.HashSet)

Example 7 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 8 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 9 with ResourceDependencyModel

use of org.talend.designer.camel.resource.core.model.ResourceDependencyModel in project tesb-studio-se by Talend.

the class ManageRouteResourcePanel method addData.

protected void addData() {
    RouteResourceSelectionDialog dialog = new RouteResourceSelectionDialog(getShell());
    if (Dialog.OK == dialog.open()) {
        Item item = dialog.getResult().getObject().getProperty().getItem();
        if (item instanceof RouteResourceItem) {
            for (ResourceDependencyModel rsmodel : getInput()) {
                if (rsmodel.getItem().getProperty().getId().equals(item.getProperty().getId())) {
                    resourcesTV.setSelection(new StructuredSelection(rsmodel));
                    return;
                }
            }
            ResourceDependencyModel model = new ResourceDependencyModel((RouteResourceItem) item);
            getInput().add(model);
            resourcesTV.refresh();
            resourcesTV.setSelection(new StructuredSelection(model));
            fireDependenciesChangedListener();
        }
    }
}
Also used : RouteResourceItem(org.talend.camel.core.model.camelProperties.RouteResourceItem) Item(org.talend.core.model.properties.Item) ToolItem(org.eclipse.swt.widgets.ToolItem) RouteResourceItem(org.talend.camel.core.model.camelProperties.RouteResourceItem) ResourceDependencyModel(org.talend.designer.camel.resource.core.model.ResourceDependencyModel) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RouteResourceSelectionDialog(org.talend.camel.designer.dialog.RouteResourceSelectionDialog)

Example 10 with ResourceDependencyModel

use of org.talend.designer.camel.resource.core.model.ResourceDependencyModel in project tesb-studio-se by Talend.

the class CheckRouteResourceDeleteReference method collect.

private Collection<ItemReferenceBean> collect(IProxyRepositoryFactory factory, IRepositoryViewObject object, ERepositoryObjectType type) {
    final Item nodeItem = object.getProperty().getItem();
    final Set<ItemReferenceBean> list = new HashSet<ItemReferenceBean>();
    try {
        for (IRepositoryViewObject obj : factory.getAll(type)) {
            final Property property = obj.getProperty();
            final Item routeItem = property.getItem();
            for (ResourceDependencyModel model : RouteResourceUtil.getResourceDependencies((ProcessItem) routeItem)) {
                if (nodeItem.getProperty().getId().equals(model.getItem().getProperty().getId())) {
                    final ItemReferenceBean bean = new ItemReferenceBean();
                    bean.setItemName(object.getProperty().getLabel());
                    bean.setItemVersion(model.getSelectedVersion());
                    bean.setItemType(CamelRepositoryNodeType.repositoryRouteResourceType);
                    bean.setItemDeleted(object.isDeleted());
                    bean.setReferenceItemName(property.getLabel());
                    bean.setReferenceItemVersion(property.getVersion());
                    bean.setReferenceItemType(type);
                    bean.setReferenceItemPath(routeItem.getState().getPath());
                    bean.setReferenceProjectName(obj.getProjectLabel());
                    bean.setReferenceItemDeleted(obj.isDeleted());
                    if (!list.add(bean)) {
                        for (ItemReferenceBean b : list) {
                            if (b.equals(bean)) {
                                b.addNodeNum();
                                break;
                            }
                        }
                    }
                }
            }
        }
    } catch (PersistenceException e) {
        ExceptionHandler.process(e);
    }
    return list;
}
Also used : ProcessItem(org.talend.core.model.properties.ProcessItem) Item(org.talend.core.model.properties.Item) ItemReferenceBean(org.talend.core.repository.model.ItemReferenceBean) ResourceDependencyModel(org.talend.designer.camel.resource.core.model.ResourceDependencyModel) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) Property(org.talend.core.model.properties.Property) HashSet(java.util.HashSet)

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