diff options
author | Alain Magloire | 2002-11-18 15:49:21 +0000 |
---|---|---|
committer | Alain Magloire | 2002-11-18 15:49:21 +0000 |
commit | ab56b495b3765443c08fd18142bf1b556e3d2c4c (patch) | |
tree | 67b51b82ef5549c3658452a700c2a58788d632c0 | |
parent | f0948f1cb3b3d09a236e7dc058e8928a5ece944e (diff) | |
download | org.eclipse.cdt-ab56b495b3765443c08fd18142bf1b556e3d2c4c.tar.gz org.eclipse.cdt-ab56b495b3765443c08fd18142bf1b556e3d2c4c.tar.xz org.eclipse.cdt-ab56b495b3765443c08fd18142bf1b556e3d2c4c.zip |
New File implement IMarker
-rw-r--r-- | core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Marker.java | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Marker.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Marker.java new file mode 100644 index 00000000000..765dbc2d71d --- /dev/null +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Marker.java @@ -0,0 +1,125 @@ +package org.eclipse.cdt.internal.core.model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.PlatformObject; + +public class Marker extends PlatformObject implements IMarker { + private long id; + private IResource resource; + private HashMap attributes; + private String type; + + public Marker(IResource res, String t) { + resource = res; + type = t; + attributes = new HashMap(); + id = System.currentTimeMillis(); + } + + public void delete() throws CoreException { + } + + public boolean equals(Object object) { + return (this == object); + } + + public boolean exists() { + return true; + } + + public Object getAttribute(String attributeName) { + return attributes.get(attributeName); + } + + public int getAttribute(String attributeName, int defaultValue) { + Integer loc = (Integer) getAttribute(attributeName); + if (loc != null) { + return loc.intValue(); + } + return defaultValue; + } + + public String getAttribute(String attributeName, String defaultValue) { + String result = (String) getAttribute(attributeName); + if (result != null) { + return result; + } + return defaultValue; + } + + public boolean getAttribute(String attributeName, boolean defaultValue) { + Boolean result = (Boolean) getAttribute(attributeName); + if (result != null) { + return true; + } + return defaultValue; + } + + public Map getAttributes() throws CoreException { + return attributes; + } + + public Object[] getAttributes(String[] attributeNames) throws CoreException { + ArrayList results = new ArrayList(); + for (int i = 0; i < attributeNames.length; i++) { + Object attribute = getAttribute(attributeNames[i]); + if (attribute != null) { + results.add(attribute); + } + } + return results.toArray(); + } + + public long getId() { + return id; + } + + public IResource getResource() { + return resource; + } + + public String getType() throws CoreException { + return type; + } + + public boolean isSubtypeOf(String superType) throws CoreException { + return true; + } + + public void setAttribute(String attributeName, Object value) + throws CoreException { + attributes.put(attributeName, value); + } + + public void setAttribute(String attributeName, int value) + throws CoreException { + setAttribute(attributeName, new Integer(value)); + } + + public void setAttribute(String attributeName, boolean value) + throws CoreException { + setAttribute(attributeName, new Boolean(value)); + } + + public void setAttributes(String[] attributeNames, Object[] values) + throws CoreException { + for (int i = 0; i < attributeNames.length; i++) { + attributes.put(attributeNames[i], values[i]); + } + } + + public void setAttributes(Map attributes) throws CoreException { + attributes = (HashMap) attributes; + } + + public void setId(long i) { + id = i; + } + +} |