Search in sources :

Example 11 with EResourceConstant

use of org.talend.resource.EResourceConstant in project tdq-studio-se by Talend.

the class ActionHandleFactory method createDuplicateHandle.

public IDuplicateHandle createDuplicateHandle(IRepositoryNode node) throws BusinessException {
    IDuplicateHandle handle = null;
    EResourceConstant typedConstant = EResourceConstant.getTypedConstant(node.getObject().getProperty().getItem());
    if (typedConstant == null) {
        BusinessException createBusinessException = ExceptionFactory.getInstance().createBusinessException(// $NON-NLS-1$
        DefaultMessagesImpl.getString("ActionHandleFactory.duplicateFail", node.getLabel()));
        throw createBusinessException;
    } else {
        switch(typedConstant) {
            case DB_CONNECTIONS:
                handle = new DBConnectionDuplicateHandle();
                break;
            case JRXML_TEMPLATE:
                handle = new JrxmlFileDuplicateHandle(node);
                break;
            case ANALYSIS:
                handle = new AnalysisDuplicateHandle();
                break;
            case REPORTS:
                handle = new ReportDuplicateHandle();
                break;
            case PATTERNS:
            case RULES_PARSER:
            case RULES_SQL:
            case RULES_MATCHER:
                handle = new ModelElementDuplicateHandle();
                break;
            case INDICATORS:
                handle = new IndicatorDuplicateHandle();
                break;
            case SOURCE_FILES:
                handle = new SourceFileDuplicateHandle(node);
                break;
            case CONTEXT:
                handle = new ContextDuplicateHandle(node);
            default:
                break;
        }
    }
    return handle;
}
Also used : EResourceConstant(org.talend.resource.EResourceConstant) BusinessException(org.talend.commons.exception.BusinessException)

Aggregations

EResourceConstant (org.talend.resource.EResourceConstant)11 ArrayList (java.util.ArrayList)5 File (java.io.File)4 IFile (org.eclipse.core.resources.IFile)3 IPath (org.eclipse.core.runtime.IPath)3 Path (org.eclipse.core.runtime.Path)3 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)3 Item (org.talend.core.model.properties.Item)3 Property (org.talend.core.model.properties.Property)3 FilenameFilter (java.io.FilenameFilter)2 IFolder (org.eclipse.core.resources.IFolder)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 DatabaseConnectionItem (org.talend.core.model.properties.DatabaseConnectionItem)2 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)2 IOException (java.io.IOException)1 CoreException (org.eclipse.core.runtime.CoreException)1 URI (org.eclipse.emf.common.util.URI)1 EObject (org.eclipse.emf.ecore.EObject)1 ISelection (org.eclipse.jface.viewers.ISelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1