update copyright
[fedora-idea.git] / java / java-impl / src / com / intellij / psi / impl / source / tree / java / ImplementsListElement.java
blob32eefda0d66a83416943fd076c7844ff942c5d6d
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.source.tree.java;
18 import com.intellij.openapi.diagnostic.Logger;
19 import com.intellij.psi.PsiKeyword;
20 import com.intellij.psi.tree.IElementType;
21 import com.intellij.psi.tree.ChildRoleBase;
22 import com.intellij.psi.impl.source.tree.ChildRole;
23 import com.intellij.lang.ASTNode;
25 /**
26 * @author dsl
28 public class ImplementsListElement extends ReferenceListElement {
29 private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.java.ImplementsListElement");
31 public ImplementsListElement() {
32 super(IMPLEMENTS_LIST);
35 protected String getKeywordText() {
36 return PsiKeyword.IMPLEMENTS;
39 protected IElementType getKeywordType() {
40 return IMPLEMENTS_KEYWORD;
43 public ASTNode findChildByRole(int role) {
44 LOG.assertTrue(ChildRole.isUnique(role));
45 switch(role){
46 default:
47 return null;
49 case ChildRole.EXTENDS_KEYWORD:
50 return findChildByType(EXTENDS_KEYWORD);
54 public int getChildRole(ASTNode child) {
55 LOG.assertTrue(child.getTreeParent() == this);
56 IElementType i = child.getElementType();
57 if (i == IMPLEMENTS_KEYWORD) {
58 return ChildRole.IMPLEMENTS_KEYWORD;
60 else if (i == COMMA) {
61 return ChildRole.COMMA;
63 else if (i == JAVA_CODE_REFERENCE) {
64 return ChildRole.REFERENCE_IN_LIST;
66 else {
67 return ChildRoleBase.NONE;