1 /*******************************************************************************
2 * Copyright (c) 2008, 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.base;
13 import java.util.ArrayList;
14 import java.util.List;
16 import org.eclipse.ltk.core.refactoring.RefactoringStatus;
17 import org.eclipse.ltk.core.refactoring.RefactoringStatusContext;
19 import org.eclipse.jdt.core.search.SearchMatch;
21 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
23 public class ReferencesInBinaryContext extends RefactoringStatusContext {
25 private List<SearchMatch> fMatches= new ArrayList<SearchMatch>();
27 private final String fDescription;
29 public ReferencesInBinaryContext(String description) {
30 fDescription= description;
33 public String getDescription() {
38 public void add(SearchMatch match) {
42 public List<SearchMatch> getMatches() {
47 * @see org.eclipse.ltk.core.refactoring.RefactoringStatusContext#getCorrespondingElement()
50 public Object getCorrespondingElement() {
54 public void addErrorIfNecessary(RefactoringStatus status) {
55 if (getMatches().size() != 0) {
56 status.addError(RefactoringCoreMessages.ReferencesInBinaryContext_binaryRefsNotUpdated, this);
61 public String toString() {
62 return fDescription + " (" + fMatches.size() + " matches)"; //$NON-NLS-1$ //$NON-NLS-2$