Search in sources :

Example 1 with IRepositoryObject

use of org.talend.core.model.repository.IRepositoryObject in project tdi-studio-se by Talend.

the class OpenRepositoryJobHierarchyAction method doRun.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
protected void doRun() {
    ISelection selection = getSelection();
    Object obj = ((IStructuredSelection) selection).getFirstElement();
    RepositoryNode node = (RepositoryNode) obj;
    Property property = (Property) node.getObject().getProperty();
    Property updatedProperty = null;
    try {
        updatedProperty = ProxyRepositoryFactory.getInstance().getLastVersion(new Project(ProjectManager.getInstance().getProject(property.getItem())), property.getId()).getProperty();
    } catch (PersistenceException e) {
        ExceptionHandler.process(e);
    }
    // update the property of the node repository object
    if (node.getObject() instanceof IRepositoryObject) {
        IRepositoryObject iobject = (IRepositoryObject) node.getObject();
        iobject.setProperty(updatedProperty);
    }
    Assert.isTrue(property.getItem() instanceof ProcessItem);
    // TODO should use a fake Process here to replace the real Process.
    // Process loadedProcess = new Process(property);
    // loadedProcess.loadXmlFile();
    IDesignerCoreService designerCoreService = CorePlugin.getDefault().getDesignerCoreService();
    Process loadedProcess = (Process) designerCoreService.getProcessFromProcessItem((ProcessItem) updatedProperty.getItem());
    OpenJobHierarchyAction openAction = new OpenJobHierarchyAction(this.getViewPart());
    openAction.run(loadedProcess);
}
Also used : Project(org.talend.core.model.general.Project) ProcessItem(org.talend.core.model.properties.ProcessItem) ISelection(org.eclipse.jface.viewers.ISelection) PersistenceException(org.talend.commons.exception.PersistenceException) IRepositoryObject(org.talend.core.model.repository.IRepositoryObject) Process(org.talend.designer.core.ui.editor.process.Process) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IDesignerCoreService(org.talend.designer.core.IDesignerCoreService) RepositoryNode(org.talend.repository.model.RepositoryNode) Property(org.talend.core.model.properties.Property) IRepositoryObject(org.talend.core.model.repository.IRepositoryObject)

Example 2 with IRepositoryObject

use of org.talend.core.model.repository.IRepositoryObject in project tdi-studio-se by Talend.

the class BusinessDeleteListener method propertyChange.

/*
     * (non-Javadoc)
     * 
     * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
     */
@Override
public void propertyChange(PropertyChangeEvent event) {
    boolean isDeleteBusinessLogical = event.getPropertyName().equals(ERepositoryActionName.DELETE_TO_RECYCLE_BIN.getName());
    boolean isDeleteBusinessPhysical = event.getPropertyName().equals(ERepositoryActionName.DELETE_FOREVER.getName());
    if (!isDeleteBusinessLogical && !isDeleteBusinessPhysical) {
        return;
    }
    if (!(event.getNewValue() instanceof IRepositoryObject)) {
        return;
    }
    IRepositoryObject object = (IRepositoryObject) event.getNewValue();
    if (object.getRepositoryObjectType() != ERepositoryObjectType.BUSINESS_PROCESS) {
        return;
    }
    object = (IRepositoryObject) event.getNewValue();
    if (object != null) {
        try {
            deleteSVGObjectLogicalOrPhysical(object, isDeleteBusinessLogical);
        } catch (PersistenceException e) {
            ExceptionHandler.process(e);
        }
    }
}
Also used : PersistenceException(org.talend.commons.exception.PersistenceException) IRepositoryObject(org.talend.core.model.repository.IRepositoryObject)

Example 3 with IRepositoryObject

use of org.talend.core.model.repository.IRepositoryObject in project tdi-studio-se by Talend.

the class ProblemsView method propertyChange.

/*
     * (non-Javadoc)
     * 
     * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
     */
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (!(evt.getNewValue() instanceof IRepositoryObject)) {
        return;
    }
    IRepositoryObject object = (IRepositoryObject) evt.getNewValue();
    if (object.getRepositoryObjectType() != ERepositoryObjectType.ROUTINES) {
        return;
    }
    if (evt.getPropertyName().equals(ERepositoryActionName.DELETE_TO_RECYCLE_BIN.getName()) || evt.getPropertyName().equals(ERepositoryActionName.DELETE_FOREVER.getName())) {
        String routineLabel = object.getProperty().getLabel();
        Problems.removeProblemsByRoutine(routineLabel);
    }
    if (evt.getPropertyName().equals(ERepositoryActionName.RESTORE.getName())) {
        RoutineItem item = (RoutineItem) object.getProperty().getItem();
        restoreProblem(item);
    }
}
Also used : RoutineItem(org.talend.core.model.properties.RoutineItem) IRepositoryObject(org.talend.core.model.repository.IRepositoryObject)

Aggregations

IRepositoryObject (org.talend.core.model.repository.IRepositoryObject)3 PersistenceException (org.talend.commons.exception.PersistenceException)2 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 Project (org.talend.core.model.general.Project)1 ProcessItem (org.talend.core.model.properties.ProcessItem)1 Property (org.talend.core.model.properties.Property)1 RoutineItem (org.talend.core.model.properties.RoutineItem)1 IDesignerCoreService (org.talend.designer.core.IDesignerCoreService)1 Process (org.talend.designer.core.ui.editor.process.Process)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1