update copyright
[fedora-idea.git] / java / java-impl / src / com / intellij / psi / impl / beanProperties / BeanPropertyElement.java
blobf80963d93f4a137b992e192800291191bbd895ab
1 /*
2 * Copyright 2000-2009 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.
16 package com.intellij.psi.impl.beanProperties;
18 import com.intellij.ide.IdeBundle;
19 import com.intellij.openapi.util.TextRange;
20 import com.intellij.psi.PsiElement;
21 import com.intellij.psi.PsiManager;
22 import com.intellij.psi.PsiMethod;
23 import com.intellij.psi.PsiType;
24 import com.intellij.psi.util.PropertyUtil;
25 import com.intellij.psi.impl.FakePsiElement;
26 import com.intellij.psi.meta.PsiMetaData;
27 import com.intellij.psi.meta.PsiMetaOwner;
28 import com.intellij.psi.meta.PsiPresentableMetaData;
29 import com.intellij.util.ArrayUtil;
30 import org.jetbrains.annotations.NonNls;
31 import org.jetbrains.annotations.NotNull;
32 import org.jetbrains.annotations.Nullable;
34 import javax.swing.*;
36 /**
37 * @author peter
39 public class BeanPropertyElement extends FakePsiElement implements PsiMetaOwner, PsiPresentableMetaData {
40 private final PsiMethod myMethod;
41 private final String myName;
43 public BeanPropertyElement(final PsiMethod method, final String name) {
44 myMethod = method;
45 myName = name;
48 @Nullable
49 public PsiType getPropertyType() {
50 return PropertyUtil.getPropertyType(myMethod);
53 @NotNull
54 public PsiMethod getMethod() {
55 return myMethod;
58 public PsiElement getNavigationElement() {
59 return myMethod;
62 public PsiManager getManager() {
63 return myMethod.getManager();
66 public PsiElement getDeclaration() {
67 return this;
70 @NonNls
71 public String getName(PsiElement context) {
72 return getName();
75 @NotNull
76 public String getName() {
77 return myName;
80 public void init(PsiElement element) {
84 public Object[] getDependences() {
85 return ArrayUtil.EMPTY_OBJECT_ARRAY;
88 @Nullable
89 public Icon getIcon(boolean flags) {
90 return BeanProperty.ICON;
93 public PsiElement getParent() {
94 return myMethod;
97 @Nullable
98 public PsiMetaData getMetaData() {
99 return this;
102 public String getTypeName() {
103 return IdeBundle.message("bean.property");
106 @Nullable
107 public Icon getIcon() {
108 return getIcon(0);
111 public TextRange getTextRange() {
112 return TextRange.from(0, 0);