From 5f96c8b22e48e5afb0ae3a6e55cc93cf0439399e Mon Sep 17 00:00:00 2001
From: Markus Schorn <markus.schorn@windriver.com>
Date: Fri, 19 Jan 2007 14:24:29 +0000
Subject: [PATCH] Fixes warnings.

---
 .../model/org/eclipse/cdt/core/model/ICElement.java   | 11 +++++++++--
 .../org/eclipse/cdt/core/model/util/Signature.java    |  6 +++---
 .../org/eclipse/cdt/internal/core/model/Binary.java   |  6 +++---
 .../eclipse/cdt/internal/core/model/BinaryRunner.java |  2 +-
 .../org/eclipse/cdt/internal/core/model/Buffer.java   |  4 ++--
 .../cdt/internal/core/model/CModelBuilder.java        |  6 +++---
 .../cdt/internal/core/model/CModelBuilder2.java       |  6 +++---
 .../eclipse/cdt/internal/core/model/CShiftData.java   |  4 ++--
 .../internal/core/model/CreateNamespaceOperation.java |  4 ++--
 .../model/PathEntryContainerUpdatesOperation.java     |  3 +--
 .../cdt/internal/core/model/PathEntryUtil.java        |  6 +++---
 .../core/model/SetPathEntryContainerOperation.java    |  4 +---
 12 files changed, 33 insertions(+), 29 deletions(-)

diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java
index 4f3e5b2bdb2..d35b7487b98 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
+ * Copyright (c) 2000, 2007 QNX Software Systems and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     QNX Software Systems - Initial API and implementation
+ *     Markus Schorn (Wind River Systems)
  *******************************************************************************/
 package org.eclipse.cdt.core.model;
 
@@ -227,16 +228,19 @@ public interface ICElement extends IAdaptable {
 
 	/**
 	 * Modifier indicating a class constructor
+	 * @deprecated use {@link IMethodDeclaration#isConstructor()}
 	 */
 	static final int C_CLASS_CTOR = 0x100;
 	
 	/**
 	 * Modifier indicating a class destructor
+	 * @deprecated use {@link IMethodDeclaration#isDestructor()}
 	 */
 	static final int C_CLASS_DTOR = 0x200;
 		
 	/**
 	 * Modifier indicating a static storage attribute
+	 * @deprecated use {@link IDeclaration#isStatic()}
 	 */
 	static final int C_STORAGE_STATIC = 0x400;
 		
@@ -247,21 +251,24 @@ public interface ICElement extends IAdaptable {
 
 	/**
 	 * Modifier indicating a private class
+	 * @deprecated use {@link IMember#getVisibility()}
 	 */
 	static final int CPP_PRIVATE = 0x1000;
 
 	/**
 	 * Modifier indicating a public class
+	 * @deprecated use {@link IMember#getVisibility()}
 	 */
-
 	static final int CPP_PUBLIC = 0x2000;
 
 	/**
 	 * Modifier indicating a protected class
+	 * @deprecated use {@link IMember#getVisibility()}
 	 */
 	static final int CPP_PROTECTED = 0x4000;
 	/**
 	 * Modifier indicating a friend class
+	 * @deprecated use {@link IMethodDeclaration#isFriend()}
 	 */
 	static final int CPP_FRIEND = 0x8000;
 
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/util/Signature.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/util/Signature.java
index 3ecf3180f45..7cfe88ed243 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/util/Signature.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/util/Signature.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -942,7 +942,7 @@ private static int scanArrayTypeSignature(char[] string, int start) {
 		throw new IllegalArgumentException();
 	}
 	char c = string[start];
-	if (c != C_ARRAY) { //$NON-NLS-1$
+	if (c != C_ARRAY) {
 		throw new IllegalArgumentException();
 	}
 	return scanTypeSignature(string, start + 1);
@@ -1691,7 +1691,7 @@ private static int appendArrayTypeSignature(char[] string, int start, boolean fu
 		throw new IllegalArgumentException();
 	}
 	char c = string[start];
-	if (c != C_ARRAY) { //$NON-NLS-1$
+	if (c != C_ARRAY) {
 		throw new IllegalArgumentException();
 	}
 	int e = appendTypeSignature(string, start + 1, fullyQualifyTypeNames, buffer);
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java
index 075bd7e3e63..b0864d540bc 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java
@@ -296,7 +296,7 @@ public class Binary extends Openable implements IBinary {
 					File file = new File(filename);
 					if (file.exists()) {
 						filename = file.getCanonicalPath();
-					} else if (filename.startsWith(".")) {
+					} else if (filename.startsWith(".")) { //$NON-NLS-1$
 						file = new File(obj.getPath().removeLastSegments(1).toOSString(), filename);
 						filename = file.getCanonicalPath();
 					}
@@ -346,7 +346,7 @@ public class Binary extends Openable implements IBinary {
 	}
 	
 	private void addFunction(OpenableInfo info, ISymbol symbol, Map hash) throws CModelException {
-		IPath filename = filename = symbol.getFilename();
+		IPath filename= symbol.getFilename();
 		BinaryFunction function = null;
 
 		if (filename != null && !filename.isEmpty()) {
@@ -376,7 +376,7 @@ public class Binary extends Openable implements IBinary {
 	}
 
 	private void addVariable(OpenableInfo info, ISymbol symbol, Map hash) throws CModelException {
-		IPath filename = filename = symbol.getFilename();
+		IPath filename= symbol.getFilename();
 		BinaryVariable variable = null;
 		if (filename != null && !filename.isEmpty()) {
 			BinaryModule module = null;
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java
index bb8baece698..5f33cdb3ff4 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java
@@ -83,7 +83,7 @@ public class BinaryRunner {
 
 	public void start() {
 		String taskName = CCorePlugin.getResourceString("CoreModel.BinaryRunner.Binary_Search_Thread"); //$NON-NLS-1$
-		taskName += " (" + cproject.getElementName() + ")";
+		taskName += " (" + cproject.getElementName() + ")";  //$NON-NLS-1$//$NON-NLS-2$
 		runner = new Job(taskName) {
 
 			/*
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Buffer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Buffer.java
index 581c00f81aa..a566af42b33 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Buffer.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Buffer.java
@@ -27,7 +27,7 @@ import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SafeRunner;
 
 /**
   * @see IBuffer
@@ -226,7 +226,7 @@ public class Buffer implements IBuffer {
 		if (this.changeListeners != null) {
 			for (int i = 0, size = this.changeListeners.size(); i < size; ++i) {
 				final IBufferChangedListener listener = (IBufferChangedListener) this.changeListeners.get(i);
-				Platform.run(new ISafeRunnable() {
+				SafeRunner.run(new ISafeRunnable() {
 					public void handleException(Throwable exception) {
 						Util.log(exception, "Exception occurred in listener of buffer change notification", ICLogConstants.CDT); //$NON-NLS-1$
 					}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java
index 368974bacb6..148db2dd999 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2007 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -105,7 +105,7 @@ public class CModelBuilder {
 	{
 		IProject currentProject = null;
 		boolean hasCppNature = true;
-		char[] code = EMPTY_CHAR_ARRAY; //$NON-NLS-1$
+		char[] code = EMPTY_CHAR_ARRAY;
 		
 		// get the current project
 		if (translationUnit != null && translationUnit.getCProject() != null) {
@@ -209,7 +209,7 @@ public class CModelBuilder {
 		}
 		Util.debugLog("CModelBuilder: parsing " //$NON-NLS-1$
 				+ translationUnit.getElementName()
-				+ " mode="+ (quickParseMode ? "quick " : "structural ") //$NON-NLS-1$ //$NON-NLS-2$
+				+ " mode="+ (quickParseMode ? "quick " : "structural ") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 				+ " time="+ ( System.currentTimeMillis() - startTime ) + "ms", //$NON-NLS-1$ //$NON-NLS-2$
 				IDebugLogConstants.MODEL, false);
 		
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder2.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder2.java
index 8cf70f56df3..b92843744ec 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder2.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder2.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2006 Wind River Systems, Inc. and others.
+ * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -248,7 +248,7 @@ public class CModelBuilder2 implements IContributedModelBuilder {
 			final IASTTranslationUnit ast= fTranslationUnit.getAST(index, ITranslationUnit.AST_SKIP_ALL_HEADERS);
 			Util.debugLog("CModelBuilder2: parsing " //$NON-NLS-1$
 					+ fTranslationUnit.getElementName()
-					+ " mode="+ (quickParseMode ? "fast " : "full ") //$NON-NLS-1$ //$NON-NLS-2$
+					+ " mode="+ (quickParseMode ? "fast " : "full ") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 					+ " time="+ ( System.currentTimeMillis() - startTime ) + "ms", //$NON-NLS-1$ //$NON-NLS-2$
 					IDebugLogConstants.MODEL, false);
 
@@ -781,7 +781,7 @@ public class CModelBuilder2 implements IContributedModelBuilder {
 		}
 
 		final IASTName astClassName= compositeTypeSpecifier.getName();
-		final String className= ASTStringUtil.getSimpleName(astClassName);;
+		final String className= ASTStringUtil.getSimpleName(astClassName);
 
 		final Structure element;
 		if (!isTemplate) {
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CShiftData.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CShiftData.java
index 6ce5317da7f..3f9d1d2a928 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CShiftData.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CShiftData.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2006 Intel Corporation and others.
+ * Copyright (c) 2006, 2007 Intel Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -117,6 +117,6 @@ public class CShiftData implements ICElementDelta {
 	}
 
 	public String toString() {
-		return ("CShiftData: offset=" + offset + ", size=" + size + ", lines=" + lines);
+		return ("CShiftData: offset=" + offset + ", size=" + size + ", lines=" + lines);   //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
 	}
 }
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateNamespaceOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateNamespaceOperation.java
index 56f8515cf9f..af03a4ad3aa 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateNamespaceOperation.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CreateNamespaceOperation.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
+ * Copyright (c) 2000, 2007 QNX Software Systems and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -77,7 +77,7 @@ public class CreateNamespaceOperation extends CreateElementInTUOperation {
 		sb.append("namespace "); //$NON-NLS-1$;
 		sb.append(fNamespace).append(' ').append('{');
 		sb.append(Util.LINE_SEPARATOR);
-		sb.append('}'); //$NON-NLS-1$;
+		sb.append('}'); //;
 		sb.append(Util.LINE_SEPARATOR);
 		return sb.toString();
 	}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryContainerUpdatesOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryContainerUpdatesOperation.java
index 448a8d79795..8e25429fe01 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryContainerUpdatesOperation.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryContainerUpdatesOperation.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005 QnX Software Systems and others.
+ * Copyright (c) 2005, 2007 QnX Software Systems and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -87,7 +87,6 @@ public class PathEntryContainerUpdatesOperation extends CModelOperation {
 		if (list.size() > 0) {
 			final ICElementDelta[] deltas = new ICElementDelta[list.size()];
 			list.toArray(deltas);
-			CModelManager manager = CModelManager.getDefault();
 			for (int i = 0; i < deltas.length; i++) {
 				addDelta(deltas[i]);
 			}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryUtil.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryUtil.java
index 625d270e2f2..6b258187800 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryUtil.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryUtil.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
+ * Copyright (c) 2000, 2007 QNX Software Systems and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -409,7 +409,7 @@ public class PathEntryUtil {
 							} else {
 								StringBuffer errMesg = new StringBuffer(
 										CCorePlugin.getResourceString("CoreModel.PathEntry.NestedEntry")); //$NON-NLS-1$
-								return new CModelStatus(ICModelStatusConstants.INVALID_PATHENTRY, errMesg.toString()); //$NON-NLS-1$
+								return new CModelStatus(ICModelStatusConstants.INVALID_PATHENTRY, errMesg.toString()); 
 							}
 						}
 					}
@@ -439,7 +439,7 @@ public class PathEntryUtil {
 				IPath includePath = include.getFullIncludePath();
 				if (!isValidExternalPath(includePath)) {
 					return new CModelStatus(ICModelStatusConstants.INVALID_PATHENTRY,
-							CoreModelMessages.getFormattedString("PathEntryManager.2", includePath.toOSString())); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+							CoreModelMessages.getFormattedString("PathEntryManager.2", includePath.toOSString())); //$NON-NLS-1$
 				}
 				if (!isValidBasePath(include.getBasePath())) {
 					return new CModelStatus(ICModelStatusConstants.INVALID_PATHENTRY,
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SetPathEntryContainerOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SetPathEntryContainerOperation.java
index 6d5ebddadaa..ea43334d664 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SetPathEntryContainerOperation.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SetPathEntryContainerOperation.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005 QnX Software Systems and others.
+ * Copyright (c) 2005, 2007 QnX Software Systems and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -94,8 +94,6 @@ public class SetPathEntryContainerOperation extends CModelOperation {
 		}
 
 		// trigger model refresh
-
-		CModelManager mgr = CModelManager.getDefault();
 		for (int i = 0; i < projectLength; i++) {
 			if (isCanceled()) {
 				return;