copyright: update license
[fedora-idea.git] / plugins / Copyright / src / com / maddyhome / idea / copyright / util / NewFileTracker.java
blob84a3b7d01015c58697b4e5d8660f87586d8ce621
1 /*
2 * Copyright 2000-2007 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.maddyhome.idea.copyright.util;
19 import com.intellij.openapi.vfs.VirtualFile;
20 import com.intellij.openapi.vfs.VirtualFileAdapter;
21 import com.intellij.openapi.vfs.VirtualFileEvent;
22 import com.intellij.openapi.vfs.VirtualFileManager;
24 import java.util.HashSet;
25 import java.util.Set;
27 public class NewFileTracker
29 public static NewFileTracker getInstance()
31 return instance;
34 public boolean contains(VirtualFile file)
36 synchronized (newfiles)
38 return newfiles.contains(file);
42 public void remove(VirtualFile file)
44 synchronized (newfiles)
46 newfiles.remove(file);
50 private NewFileTracker()
52 VirtualFileManager manager = VirtualFileManager.getInstance();
53 manager.addVirtualFileListener(new VirtualFileAdapter()
55 public void fileCreated(VirtualFileEvent event)
57 synchronized (newfiles)
59 newfiles.add(event.getFile());
62 });
65 private Set<VirtualFile> newfiles = new HashSet<VirtualFile>();
67 private static NewFileTracker instance = new NewFileTracker();