copyright: update license
[fedora-idea.git] / plugins / Copyright / src / com / maddyhome / idea / copyright / util / FileInfo.java
blob139a41d45715b686b2f1cde9450365f884f3a6d2
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.psi.PsiFile;
21 import com.intellij.psi.PsiJavaFile;
23 public class FileInfo
25 public FileInfo(PsiFile file)
27 this.file = file;
30 public String getPathName()
32 return getVirtualFile() != null ? getVirtualFile().getPath() : "";
35 public String getFileName()
37 return getVirtualFile() != null ? getVirtualFile().getName() : "";
40 public String getClassName()
42 if (file instanceof PsiJavaFile)
44 return ((PsiJavaFile)file).getClasses()[0].getName();
46 else
48 return getFileName();
52 public String getQualifiedClassName()
54 if (file instanceof PsiJavaFile)
56 return ((PsiJavaFile)file).getClasses()[0].getQualifiedName();
58 else
60 return getPathName();
64 public DateInfo getLastModified()
66 if (getVirtualFile() != null)
68 return new DateInfo(getVirtualFile().getTimeStamp());
70 else
72 return new DateInfo();
76 private VirtualFile getVirtualFile()
78 return file.getVirtualFile();
81 private PsiFile file;