KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > refactoring > util > CodeAnalyzer


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.corext.refactoring.util;
12
13 import org.eclipse.jdt.core.ICompilationUnit;
14 import org.eclipse.jdt.core.JavaModelException;
15 import org.eclipse.jdt.core.dom.ASTNode;
16 import org.eclipse.jdt.core.dom.ArrayInitializer;
17
18 import org.eclipse.jdt.internal.corext.dom.Selection;
19 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
20 import org.eclipse.jdt.internal.corext.refactoring.base.JavaStatusContext;
21 import org.eclipse.ltk.core.refactoring.RefactoringStatus;
22
23 public class CodeAnalyzer extends StatementAnalyzer {
24
25     public CodeAnalyzer(ICompilationUnit cunit, Selection selection, boolean traverseSelectedNode) throws JavaModelException {
26         super(cunit, selection, traverseSelectedNode);
27     }
28     
29     protected final void checkSelectedNodes() {
30         super.checkSelectedNodes();
31         RefactoringStatus status= getStatus();
32         if (status.hasFatalError())
33             return;
34         ASTNode node= getFirstSelectedNode();
35         if (node instanceof ArrayInitializer) {
36             status.addFatalError(RefactoringCoreMessages.CodeAnalyzer_array_initializer, JavaStatusContext.create(fCUnit, node));
37         }
38     }
39 }
40
Popular Tags