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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.corext.refactoring.util;
13 import org.eclipse.core.runtime.CoreException;
15 import org.eclipse.ltk.core.refactoring.RefactoringStatus;
17 import org.eclipse.jdt.core.ICompilationUnit;
18 import org.eclipse.jdt.core.dom.ASTNode;
19 import org.eclipse.jdt.core.dom.ArrayInitializer;
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;
25 public class CodeAnalyzer extends StatementAnalyzer {
27 public CodeAnalyzer(ICompilationUnit cunit, Selection selection, boolean traverseSelectedNode) throws CoreException {
28 super(cunit, selection, traverseSelectedNode);
32 protected final void checkSelectedNodes() {
33 super.checkSelectedNodes();
34 RefactoringStatus status= getStatus();
35 if (status.hasFatalError())
37 ASTNode node= getFirstSelectedNode();
38 if (node instanceof ArrayInitializer) {
39 status.addFatalError(RefactoringCoreMessages.CodeAnalyzer_array_initializer, JavaStatusContext.create(fCUnit, node));