/*
 *  Copyright 2000-2007 JetBrains s.r.o.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package com.maddyhome.idea.copyright.psi;

import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiComment;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiWhiteSpace;
import com.maddyhome.idea.copyright.CopyrightProfile;

public class UpdatePropertiesFileCopyright extends UpdatePsiFileCopyright
{
    public UpdatePropertiesFileCopyright(Project project, Module module, VirtualFile root, CopyrightProfile options)
    {
        super(project, module, root, options);
    }

    protected void scanFile()
    {
        PsiElement first = getFile().getFirstChild(); // PropertiesList
        if (first != null)
        {
            first = first.getFirstChild(); // First member of properties list
        }
        PsiElement last = first;
        PsiElement next = first;
        while (next != null)
        {
            if (next instanceof PsiComment || next instanceof PsiWhiteSpace)
            {
                next = getNextSibling(next);
            }
            else
            {
                break;
            }
            last = next;
        }

        if (first != null)
        {
            checkComments(first, last, true);
        }
        else
        {
            first = getFile().getFirstChild();
            checkComments(first, first, true);
        }
    }
}

@@ -1024,13 +1024,11 @@
 ight
-%0A
+ 
 %7B%0A
-  
   pu
@@ -1137,27 +1137,19 @@
 options)
-%0A    %7B%0A    
+ %7B%0A
     supe
@@ -1185,23 +1185,19 @@
 ons);%0A  
- 
- 
 %7D%0A%0A
-  
   protec
@@ -1219,19 +1219,11 @@
 le()
-%0A    %7B%0A    
+ %7B%0A
     
@@ -1290,137 +1290,8 @@
 ist%0A
-        if (first != null)%0A        %7B%0A            first = first.getFirstChild(); // First member of properties list%0A        %7D%0A    
     
@@ -1319,20 +1319,16 @@
 st;%0A    
-  
-  
 PsiEleme
@@ -1344,20 +1344,16 @@
  first;%0A
-    
     whil
@@ -1368,39 +1368,25 @@
 != null)
-%0A        %7B%0A    
+ %7B%0A
       
-  
 if (next
@@ -1441,39 +1441,19 @@
 teSpace)
-%0A            %7B%0A        
+ %7B%0A
         
@@ -1491,58 +1491,31 @@
     
-  
-    %7D%0A   
+%7D%0A
       
-   
 else
-%0A            %7B%0A   
+ %7B%0A
         
     
@@ -1510,21 +1510,16 @@
         
-     
 break;%0A 
@@ -1527,28 +1527,16 @@
     
-  
-    %7D%0A  
+%7D%0A
       
-    
 last
@@ -1552,19 +1552,11 @@
     
-    %7D%0A%0A    
+%7D%0A%0A
     
@@ -1573,33 +1573,19 @@
 != null)
-%0A        %7B%0A      
+ %7B%0A
       ch
@@ -1624,143 +1624,10 @@
     
-    %7D%0A        else%0A        %7B%0A            first = getFile().getFirstChild();%0A            checkComments(first, first, true);%0A        %7D%0A  
+%7D%0A
   %7D%0A

fix properties file copyright update (IDEADEV-33156)