/*****************************************************************************
 * Copyright (c) 2010 Communication & Systems
 * 
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors : Maxime AUDRAIN (CS) - initial API and implementation
 * 
 *****************************************************************************/
package org.topcased.requirement.merge.testers;

import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IFile;
import org.topcased.modeler.utils.Utils;

/**
 * A simple property tester to check if the current IFile selected is a ".di" file,
 * And also check that no currentModeler is opened (prevent problems when modifying requirement file while opened)
 * 
 * @author <a href="mailto:maxime.audrain@c-s.fr">Maxime AUDRAIN</a>
 *
 */
public class CanMergePropertyTester extends PropertyTester
{

    /**
     * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
     */
    public boolean test(Object receiver, String property, Object[] args, Object expectedValue)
    {
        if (Utils.getCurrentModeler() == null)
        {
            if (receiver instanceof IFile)
            {
                IFile file = (IFile) receiver;
                return file != null && file.getFileExtension() != null && file.getFileExtension().endsWith("di"); //$NON-NLS-1$
            }
        }
        return false;
    }

}

@@ -799,19 +799,16 @@
 i%22 file,
-%0A *
  And als
@@ -822,16 +822,19 @@
  that no
+%0A *
  current
@@ -990,16 +990,17 @@
 N%3C/a%3E%0A *
+ 
 %0A */%0Apub
@@ -1061,17 +1061,16 @@
 r%0A%7B%0A
-%0A
     /**%0A
     
@@ -1065,16 +1065,16 @@
     /**%0A
-
      * @
@@ -1182,16 +1182,28 @@
 bject%5B%5D,
+%0A     *     
  java.la
@@ -1663,11 +1663,10 @@
 ;%0A    %7D%0A
-%0A
 %7D%0A

format code