Search in sources :

Example 1 with InformationLevel

use of org.talend.core.model.properties.InformationLevel in project tdi-studio-se by Talend.

the class Problems method computePropertyMaxInformationLevel.

/**
     * See also AbstractEMFRepositoryFactory.computePropertyMaxInformationLevel
     * 
     * @param property
     */
public static void computePropertyMaxInformationLevel(Property property, boolean allowUpdateProperty) {
    EList<Information> informations = property.getInformations();
    InformationLevel maxLevel = null;
    for (int i = 0; i < informations.size(); i++) {
        Information information = informations.get(i);
        if (i == 0) {
            maxLevel = information.getLevel();
            continue;
        }
        int value = information.getLevel().getValue();
        if (maxLevel == null || value > maxLevel.getValue()) {
            maxLevel = information.getLevel();
        }
    }
    // TDI-22098
    // after run the job , if the modified the property ,should be save .
    InformationLevel propertyMaxLevel = property.getMaxInformationLevel();
    boolean isModified = false;
    if (maxLevel != null) {
        if (!maxLevel.equals(propertyMaxLevel)) {
            property.setMaxInformationLevel(maxLevel);
            isModified = true;
        }
    } else if (!InformationLevel.DEBUG_LITERAL.equals(propertyMaxLevel)) {
        property.setMaxInformationLevel(InformationLevel.DEBUG_LITERAL);
        isModified = true;
    }
    // save the property
    if (isModified && allowUpdateProperty) {
        IRepositoryService service = CorePlugin.getDefault().getRepositoryService();
        IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
        Item item = property.getItem();
        try {
            factory.save(item, false);
        } catch (PersistenceException e) {
            ExceptionHandler.process(e);
        }
    }
}
Also used : Item(org.talend.core.model.properties.Item) RoutineItem(org.talend.core.model.properties.RoutineItem) ProcessItem(org.talend.core.model.properties.ProcessItem) PersistenceException(org.talend.commons.exception.PersistenceException) InformationLevel(org.talend.core.model.properties.InformationLevel) Information(org.talend.core.model.properties.Information) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) IRepositoryService(org.talend.repository.model.IRepositoryService)

Example 2 with InformationLevel

use of org.talend.core.model.properties.InformationLevel in project tdi-studio-se by Talend.

the class AbstractMultiPageTalendEditor method updateTitleImage.

private void updateTitleImage(Property property) {
    Image image = null;
    InformationLevel level = property.getMaxInformationLevel();
    image = ImageProvider.getImage(getEditorTitleImage());
    if (level.equals(InformationLevel.ERROR_LITERAL)) {
        image = OverlayImageProvider.getImageWithError(image).createImage();
    }
    setTitleImage(image);
}
Also used : InformationLevel(org.talend.core.model.properties.InformationLevel) IImage(org.talend.commons.ui.runtime.image.IImage) ECoreImage(org.talend.commons.ui.runtime.image.ECoreImage) Image(org.eclipse.swt.graphics.Image)

Example 3 with InformationLevel

use of org.talend.core.model.properties.InformationLevel in project tesb-studio-se by Talend.

the class ESBRepositoryContentHandler method computePropertyMaxInformationLevel.

private void computePropertyMaxInformationLevel(Property property) {
    EList<Information> informations = property.getInformations();
    InformationLevel maxLevel = null;
    for (Information information : informations) {
        int value = information.getLevel().getValue();
        if (maxLevel == null || value > maxLevel.getValue()) {
            maxLevel = information.getLevel();
        }
    }
    property.setMaxInformationLevel(maxLevel);
}
Also used : InformationLevel(org.talend.core.model.properties.InformationLevel) Information(org.talend.core.model.properties.Information)

Aggregations

InformationLevel (org.talend.core.model.properties.InformationLevel)3 Information (org.talend.core.model.properties.Information)2 Image (org.eclipse.swt.graphics.Image)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 ECoreImage (org.talend.commons.ui.runtime.image.ECoreImage)1 IImage (org.talend.commons.ui.runtime.image.IImage)1 Item (org.talend.core.model.properties.Item)1 ProcessItem (org.talend.core.model.properties.ProcessItem)1 RoutineItem (org.talend.core.model.properties.RoutineItem)1 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)1 IRepositoryService (org.talend.repository.model.IRepositoryService)1