]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-before/core refactoring/org/eclipse/jdt/internal/corext/refactoring/util/CodeAnalyzer.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-before / core refactoring / org / eclipse / jdt / internal / corext / refactoring / util / CodeAnalyzer.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 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.core.runtime.CoreException;
14
15 import org.eclipse.ltk.core.refactoring.RefactoringStatus;
16
17 import org.eclipse.jdt.core.ICompilationUnit;
18 import org.eclipse.jdt.core.dom.ASTNode;
19 import org.eclipse.jdt.core.dom.ArrayInitializer;
20
21 import org.eclipse.jdt.internal.corext.dom.Selection;
22 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
23 import org.eclipse.jdt.internal.corext.refactoring.base.JavaStatusContext;
24
25 public class CodeAnalyzer extends StatementAnalyzer {
26
27         public CodeAnalyzer(ICompilationUnit cunit, Selection selection, boolean traverseSelectedNode) throws CoreException {
28                 super(cunit, selection, traverseSelectedNode);
29         }
30
31         @Override
32         protected final void checkSelectedNodes() {
33                 super.checkSelectedNodes();
34                 RefactoringStatus status= getStatus();
35                 if (status.hasFatalError())
36                         return;
37                 ASTNode node= getFirstSelectedNode();
38                 if (node instanceof ArrayInitializer) {
39                         status.addFatalError(RefactoringCoreMessages.CodeAnalyzer_array_initializer, JavaStatusContext.create(fCUnit, node));
40                 }
41         }
42 }