mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
2004-12-22 Alain Magloire
On going work to clean cdt.ui from misc. warnings and removing the deprecated interfaces in Eclipse-3.1
This commit is contained in:
parent
cc17803d62
commit
2588a0df58
21 changed files with 86 additions and 63 deletions
|
@ -1,3 +1,8 @@
|
|||
2004-12-22 Alain Magloire
|
||||
|
||||
On going work to clean cdt.ui from misc. warnings
|
||||
and removing the deprecated interfaces in Eclipse-3.1
|
||||
|
||||
2004-12-21 Alain Magloire
|
||||
purpose: using charset from 'file' to encode in-memory String object into bytes
|
||||
modifer: Wu Zhi Qiang
|
||||
|
|
|
@ -751,9 +751,8 @@ public static int getParameterCount(char[] methodSignature) throws IllegalArgume
|
|||
int i = CharOperation.indexOf(C_PARAM_START, methodSignature);
|
||||
if (i < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
for (;;) {
|
||||
if (methodSignature[i] == C_PARAM_END) {
|
||||
return count;
|
||||
|
@ -761,9 +760,8 @@ public static int getParameterCount(char[] methodSignature) throws IllegalArgume
|
|||
int e= scanTypeSignature(methodSignature, i);
|
||||
if (e < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
} else {
|
||||
i = e + 1;
|
||||
}
|
||||
i = e + 1;
|
||||
count++;
|
||||
}
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
|
@ -920,9 +918,8 @@ private static int scanBaseTypeSignature(char[] string, int start) {
|
|||
char c = string[start];
|
||||
if ("BCDFIJSVZ".indexOf(c) >= 0) { //$NON-NLS-1$
|
||||
return start;
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -978,9 +975,8 @@ private static int scanTypeVariableSignature(char[] string, int start) {
|
|||
c = string[id + 1];
|
||||
if (c == C_SEMICOLON) {
|
||||
return id + 1;
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1131,9 +1127,8 @@ private static int scanTypeArgumentSignature(char[] string, int start) {
|
|||
}
|
||||
if (c == '+' || c == '-') {
|
||||
return scanTypeSignature(string, start + 1);
|
||||
} else {
|
||||
return scanTypeSignature(string, start);
|
||||
}
|
||||
return scanTypeSignature(string, start);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1168,9 +1163,8 @@ public static char[][] getParameterTypes(char[] methodSignature) throws IllegalA
|
|||
int i = CharOperation.indexOf(C_PARAM_START, methodSignature);
|
||||
if (i < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
int t = 0;
|
||||
for (;;) {
|
||||
if (methodSignature[i] == C_PARAM_END) {
|
||||
|
|
|
@ -83,9 +83,8 @@ public class TypeReference implements ITypeReference {
|
|||
IResource resource = fWorkingCopy.getUnderlyingResource();
|
||||
if (resource != null) {
|
||||
return resource.getLocation();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
} else if (fResource != null) {
|
||||
return fResource.getLocation();
|
||||
} else if (fPath != null) {
|
||||
|
@ -108,19 +107,17 @@ public class TypeReference implements ITypeReference {
|
|||
public IProject getProject() {
|
||||
if (fProject != null) {
|
||||
return fProject;
|
||||
} else {
|
||||
if (fWorkingCopy != null) {
|
||||
ICProject cProject = fWorkingCopy.getCProject();
|
||||
if (cProject != null) {
|
||||
return cProject.getProject();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else if (fResource != null) {
|
||||
return fResource.getProject();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if (fWorkingCopy != null) {
|
||||
ICProject cProject = fWorkingCopy.getCProject();
|
||||
if (cProject != null) {
|
||||
return cProject.getProject();
|
||||
}
|
||||
return null;
|
||||
} else if (fResource != null) {
|
||||
return fResource.getProject();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,12 +210,10 @@ public class TypeReference implements ITypeReference {
|
|||
if (path != null) {
|
||||
if (fLength == 0 && fOffset == 0) {
|
||||
return path.toString();
|
||||
} else {
|
||||
return path.toString() + ":" + fOffset + "-" + (fOffset + fLength); //$NON-NLS-1$//$NON-NLS-2$
|
||||
}
|
||||
} else {
|
||||
return ""; //$NON-NLS-1$
|
||||
return path.toString() + ":" + fOffset + "-" + (fOffset + fLength); //$NON-NLS-1$//$NON-NLS-2$
|
||||
}
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
|
|
|
@ -169,9 +169,8 @@ public class TypeSearchScope implements ITypeSearchScope {
|
|||
public IProject[] getEnclosingProjects() {
|
||||
if (isWorkspaceScope()) {
|
||||
return getAllProjects();
|
||||
} else {
|
||||
return (IProject[]) fEnclosingProjectSet.toArray(new IProject[fEnclosingProjectSet.size()]);
|
||||
}
|
||||
return (IProject[]) fEnclosingProjectSet.toArray(new IProject[fEnclosingProjectSet.size()]);
|
||||
}
|
||||
|
||||
private static boolean projectContainsPath(IProject project, IPath path, boolean checkIncludePaths) {
|
||||
|
@ -247,11 +246,10 @@ public class TypeSearchScope implements ITypeSearchScope {
|
|||
if (count > 0) {
|
||||
if (count == allProjects.length) {
|
||||
return cProjects;
|
||||
} else {
|
||||
IProject[] newProjects = new IProject[count];
|
||||
System.arraycopy(cProjects, 0, newProjects, 0, count);
|
||||
return newProjects;
|
||||
}
|
||||
IProject[] newProjects = new IProject[count];
|
||||
System.arraycopy(cProjects, 0, newProjects, 0, count);
|
||||
return newProjects;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -345,7 +345,7 @@ public class ChangeCollector {
|
|||
case ICElement.C_CLASS:
|
||||
case ICElement.C_STRUCT:
|
||||
// types = ((ICElement)element).getTypes();
|
||||
types = TypeUtil.getTypes((ICElement)element);
|
||||
types = TypeUtil.getTypes(element);
|
||||
for (int i = 0, length = types.length; i < length; i++) {
|
||||
ICElement type = types[i];
|
||||
allTypes.add(type);
|
||||
|
|
|
@ -76,9 +76,8 @@ public abstract class IndexerJob implements IJob {
|
|||
|
||||
if (progressMonitor.isCanceled()) {
|
||||
throw new OperationCanceledException();
|
||||
} else {
|
||||
progressMonitor.worked(1);
|
||||
}
|
||||
progressMonitor.worked(1);
|
||||
|
||||
return success;
|
||||
} catch (InterruptedException e) {
|
||||
|
|
|
@ -47,13 +47,13 @@ public class TypeCache implements ITypeCache {
|
|||
|
||||
private static final int INITIAL_TYPE_COUNT = 100;
|
||||
private final Map fTypeKeyMap = new HashMap(INITIAL_TYPE_COUNT);
|
||||
private final IProject fProject;
|
||||
final IProject fProject;
|
||||
private final IWorkingCopyProvider fWorkingCopyProvider;
|
||||
final Collection fDeltas = new ArrayList();
|
||||
final ITypeInfo fGlobalNamespace;
|
||||
private final Map fTypeToSubTypes = new HashMap();
|
||||
private final Map fTypeToSuperTypes = new HashMap();
|
||||
private ITypeCacheChangedListener fChangeListener = null;
|
||||
ITypeCacheChangedListener fChangeListener = null;
|
||||
|
||||
private static final class SuperTypeEntry {
|
||||
ITypeInfo superType;
|
||||
|
|
|
@ -116,11 +116,10 @@ public class TypeCacheManager implements ITypeCacheChangedListener {
|
|||
if (unit.isWorkingCopy()) {
|
||||
deltaCount += processWorkingCopyDelta(delta);
|
||||
return deltaCount;
|
||||
} else {
|
||||
if (added || removed || pathEntryChanged || contentChanged) {
|
||||
addCacheDelta(project, delta);
|
||||
++deltaCount;
|
||||
}
|
||||
}
|
||||
if (added || removed || pathEntryChanged || contentChanged) {
|
||||
addCacheDelta(project, delta);
|
||||
++deltaCount;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -47,6 +47,11 @@ import java.util.EventObject;
|
|||
*/
|
||||
|
||||
public class BufferChangedEvent extends EventObject {
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
*/
|
||||
private static final long serialVersionUID = 3979268036526355761L;
|
||||
|
||||
/**
|
||||
* The length of text that has been modified in the buffer.
|
||||
*/
|
||||
|
|
|
@ -24,6 +24,11 @@ import org.eclipse.cdt.internal.core.model.CModelStatus;
|
|||
* @see ICModelStatusConstants
|
||||
*/
|
||||
public class CModelException extends CoreException {
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
*/
|
||||
private static final long serialVersionUID = 3546638828312998451L;
|
||||
|
||||
/**
|
||||
* Creates a C model exception that wrappers the given <code>Throwable</code>.
|
||||
* The exception contains a C-specific status object with severity
|
||||
|
|
|
@ -15,6 +15,10 @@ import java.util.EventObject;
|
|||
* @see ICElementDelta
|
||||
*/
|
||||
public class ElementChangedEvent extends EventObject {
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
*/
|
||||
private static final long serialVersionUID = 3257572793326252855L;
|
||||
/**
|
||||
* Event type constant (bit mask) indicating an after-the-fact
|
||||
* report of creations, deletions, and modifications
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.core.model.ISourceRange;
|
|||
import org.eclipse.cdt.core.model.ISourceReference;
|
||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ResourceAttributes;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -164,7 +165,8 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
|||
public boolean isReadOnly () {
|
||||
IResource r = getUnderlyingResource();
|
||||
if (r != null) {
|
||||
return r.isReadOnly();
|
||||
ResourceAttributes attributes = r.getResourceAttributes();
|
||||
return attributes.isReadOnly();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -486,14 +486,14 @@ public class CModelBuilder {
|
|||
return element;
|
||||
}
|
||||
|
||||
private Enumerator createEnumerator(Parent enum, IASTEnumerator enumDef) throws CModelException{
|
||||
Enumerator element = new Enumerator (enum, enumDef.getName().toString());
|
||||
private Enumerator createEnumerator(Parent enumarator, IASTEnumerator enumDef) throws CModelException{
|
||||
Enumerator element = new Enumerator (enumarator, enumDef.getName().toString());
|
||||
IASTExpression initialValue = enumDef.getInitialValue();
|
||||
if(initialValue != null){
|
||||
element.setConstantExpression( ASTUtil.getExpressionString( initialValue ) );
|
||||
}
|
||||
// add to parent
|
||||
enum.addChild(element);
|
||||
enumarator.addChild(element);
|
||||
// set enumerator position
|
||||
element.setIdPos(enumDef.getStartingOffset(), (enumDef.getNameEndOffset() - enumDef.getNameOffset()));
|
||||
element.setPos(enumDef.getStartingOffset(), enumDef.getEndingOffset() - enumDef.getStartingOffset());
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.cdt.core.model.ICElement;
|
|||
import org.eclipse.cdt.core.model.ICModelStatusConstants;
|
||||
import org.eclipse.cdt.core.model.IOpenable;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ResourceAttributes;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -304,7 +305,15 @@ public abstract class Openable extends Parent implements IOpenable, IBufferChang
|
|||
* @see org.eclipse.cdt.core.model.IOpenable#save(IProgressMonitor, boolean)
|
||||
*/
|
||||
public void save(IProgressMonitor pm, boolean force) throws CModelException {
|
||||
if (isReadOnly() || this.getResource().isReadOnly()) {
|
||||
IResource res = getResource();
|
||||
if (res != null) {
|
||||
ResourceAttributes attributes = res.getResourceAttributes();
|
||||
if (attributes.isReadOnly()) {
|
||||
throw new CModelException(new CModelStatus(ICModelStatusConstants.READ_ONLY, this));
|
||||
}
|
||||
}
|
||||
// check also the underlying resource
|
||||
if (isReadOnly()) {
|
||||
throw new CModelException(new CModelStatus(ICModelStatusConstants.READ_ONLY, this));
|
||||
}
|
||||
IBuffer buf = getBuffer();
|
||||
|
|
|
@ -14,6 +14,10 @@ import java.util.EventObject;
|
|||
|
||||
public class CDescriptorEvent extends EventObject {
|
||||
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
*/
|
||||
private static final long serialVersionUID = 3257009869059143225L;
|
||||
public static final int CDTPROJECT_CHANGED = 1;
|
||||
public static final int CDTPROJECT_ADDED = 2;
|
||||
public static final int CDTPROJECT_REMOVED = 3;
|
||||
|
|
|
@ -18,6 +18,10 @@ import java.util.List;
|
|||
|
||||
public class ResolverChangeEvent extends EventObject {
|
||||
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
*/
|
||||
private static final long serialVersionUID = 4121128156301178929L;
|
||||
private List fDeltas = new ArrayList();
|
||||
private ICFileTypeResolver fNewResolver;
|
||||
private ICFileTypeResolver fOldResolver;
|
||||
|
|
|
@ -12,7 +12,6 @@ package org.eclipse.cdt.core.formatter;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.text.edits.TextEdit;
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,6 +20,10 @@ import org.eclipse.core.resources.IProject;
|
|||
*/
|
||||
public class PathEntryStoreChangedEvent extends EventObject {
|
||||
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
*/
|
||||
private static final long serialVersionUID = 4051048549254706997L;
|
||||
public static final int CONTENT_CHANGED = 1;
|
||||
public static final int STORE_CLOSED = 2;
|
||||
|
||||
|
|
|
@ -60,9 +60,9 @@ public class DebugType {
|
|||
sb.append(type.toString());
|
||||
sb.append(" (*())"); //$NON-NLS-1$
|
||||
} else if (this instanceof DebugEnumType) {
|
||||
DebugEnumType enum = (DebugEnumType)this;
|
||||
DebugEnumField[] fields = enum.getDebugEnumFields();
|
||||
sb.append("enum ").append(enum.getName()).append(" {"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
DebugEnumType enumarator = (DebugEnumType)this;
|
||||
DebugEnumField[] fields = enumarator.getDebugEnumFields();
|
||||
sb.append("enum ").append(enumarator.getName()).append(" {"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
if (i > 0) {
|
||||
sb.append(',');
|
||||
|
|
|
@ -35,9 +35,8 @@ public class ERandomAccessFile extends RandomAccessFile {
|
|||
throw new EOFException();
|
||||
if ( isle ) {
|
||||
return (short)((val[1] << 8) + val[0]);
|
||||
} else {
|
||||
return (short)((val[0] << 8) + val[1]);
|
||||
}
|
||||
return (short)((val[0] << 8) + val[1]);
|
||||
}
|
||||
|
||||
public final int readIntE() throws IOException
|
||||
|
@ -50,9 +49,8 @@ public class ERandomAccessFile extends RandomAccessFile {
|
|||
throw new EOFException();
|
||||
if ( isle ) {
|
||||
return ((val[3] << 24) + (val[2] << 16) + (val[1] << 8) + val[0]);
|
||||
} else {
|
||||
return ((val[0] << 24) + (val[1] << 16) + (val[2] << 8) + val[3]);
|
||||
}
|
||||
return ((val[0] << 24) + (val[1] << 16) + (val[2] << 8) + val[3]);
|
||||
}
|
||||
|
||||
public final long readLongE() throws IOException
|
||||
|
|
|
@ -28,9 +28,9 @@ public class MachO {
|
|||
private Symbol[] symbols; /* symbols from SymtabCommand */
|
||||
private Symbol[] local_symbols; /* local symbols from DySymtabCommand */
|
||||
private boolean dynsym = false; /* set if DynSymtabCommand is present */
|
||||
private Line[] lines; /* line table */
|
||||
Line[] lines; /* line table */
|
||||
private Section[] sections; /* sections from SegmentCommand */
|
||||
private SymtabCommand symtab; /* SymtabCommand that contains the symbol table */
|
||||
SymtabCommand symtab; /* SymtabCommand that contains the symbol table */
|
||||
|
||||
protected String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||
|
||||
|
@ -185,9 +185,8 @@ public class MachO {
|
|||
throw new IOException();
|
||||
if ( isle ) {
|
||||
return (short)(((val[offset + 1] & 0xff) << 8) + (val[offset + 0] & 0xff));
|
||||
} else {
|
||||
return (short)(((val[offset + 0] & 0xff) << 8) + (val[offset + 1] & 0xff));
|
||||
}
|
||||
return (short)(((val[offset + 0] & 0xff) << 8) + (val[offset + 1] & 0xff));
|
||||
}
|
||||
|
||||
private final int makeInt(byte [] val, int offset, boolean isle) throws IOException
|
||||
|
|
Loading…
Add table
Reference in a new issue