本文整理汇总了Java中org.eclipse.core.resources.IMarkerDelta.getAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java IMarkerDelta.getAttribute方法的具体用法?Java IMarkerDelta.getAttribute怎么用?Java IMarkerDelta.getAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.resources.IMarkerDelta
的用法示例。
在下文中一共展示了IMarkerDelta.getAttribute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isProblemDelta
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
private boolean isProblemDelta(IResourceDelta delta) {
if ((delta.getFlags() & IResourceDelta.MARKERS) == 0) {
return false;
}
for (IMarkerDelta markerDelta : delta.getMarkerDeltas()) {
if (markerDelta.isSubtypeOf(IMarker.PROBLEM)) {
// Detect added/removed problem markers
int kind = markerDelta.getKind();
if (kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED) {
return true;
}
// Detect changes in problem marker severity
int oldSeverity = markerDelta.getAttribute(IMarker.SEVERITY, -1);
int newSeverity = markerDelta.getMarker().getAttribute(IMarker.SEVERITY, -1);
if (newSeverity != oldSeverity) {
return true;
}
}
}
return false;
}
示例2: isErrorDelta
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
private boolean isErrorDelta(IResourceDelta delta) {
if ((delta.getFlags() & IResourceDelta.MARKERS) != 0) {
IMarkerDelta[] markerDeltas = delta.getMarkerDeltas();
for (int i = 0; i < markerDeltas.length; i++) {
IMarkerDelta iMarkerDelta = markerDeltas[i];
if (iMarkerDelta.isSubtypeOf(IMarker.PROBLEM)) {
int kind = iMarkerDelta.getKind();
if (kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED) {
return true;
}
int severity = iMarkerDelta.getAttribute(IMarker.SEVERITY, -1);
int newSeverity = iMarkerDelta.getMarker().getAttribute(IMarker.SEVERITY, -1);
if (newSeverity != severity) {
return true;
}
}
}
}
return false;
}
示例3: breakpointChanged
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*
* @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint,
* org.eclipse.core.resources.IMarkerDelta)
*/
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
try {
if (breakpoint instanceof DSLBreakpoint && delta.getAttribute(IBreakpoint.ENABLED) != null
&& breakpoint.isEnabled() != ((Boolean)delta.getAttribute(IBreakpoint.ENABLED))
.booleanValue()) {
final DSLBreakpoint dslBreakpoint = (DSLBreakpoint)breakpoint;
final Set<URI> instructionURIs = new HashSet<URI>();
instructionURIs.add(dslBreakpoint.getURI());
notifySirius(instructionURIs, dslBreakpoint.getModelIdentifier());
}
} catch (CoreException e) {
// ignore
}
}
示例4: breakpointChanged
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*
* @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint,
* org.eclipse.core.resources.IMarkerDelta)
*/
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
try {
if (breakpoint instanceof DSLBreakpoint
&& breakpoint.getModelIdentifier().equals(getModelIdentifier())
&& delta.getAttribute(IBreakpoint.ENABLED) != null
&& breakpoint.isEnabled() != ((Boolean)delta.getAttribute(IBreakpoint.ENABLED))
.booleanValue()) {
fireLabelProviderChanged(breakpoint);
}
} catch (CoreException e) {
// ignore
}
}
示例5: processMarkerDelta
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
protected void processMarkerDelta(final IResourceDelta delta) {
final IMarkerDelta[] markerDeltas = getSortedMarkerDelta(delta);
for (final IMarkerDelta markerDelta : markerDeltas) {
final Object elementID = markerDelta
.getAttribute(SCTMarkerType.SEMANTIC_ELEMENT_ID);
if (elementID == null) {
continue;
}
dispatchMarkerDelta(markerDelta, elementID.toString());
}
}
示例6: getChangedProperty
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
/**
* Returns set of properties that have changed comparing to the state saved in delta parameter.
* Doesn't enumerate properties that were changed 'silently'
* (see {@link #silentlyResetIgnoreCount()}).
*/
public Set<MutableProperty> getChangedProperty(IMarkerDelta delta) {
Set<MutableProperty> result = EnumSet.noneOf(MutableProperty.class);
IMarker marker = getMarker();
if (marker.getAttribute(IBreakpoint.ENABLED, Boolean.TRUE) !=
delta.getAttribute(IBreakpoint.ENABLED, Boolean.TRUE)) {
result.add(MutableProperty.ENABLED);
}
if (!BasicUtil.eq(marker.getAttribute(CONDITION_ATTR, (String) null),
delta.getAttribute(CONDITION_ATTR, (String) null))) {
result.add(MutableProperty.CONDITION);
}
{
IgnoreCountData currentData =
IgnoreCountData.parseString(marker.getAttribute(IGNORE_COUNT_ATTR, ""));
IgnoreCountData oldData =
IgnoreCountData.parseString(delta.getAttribute(IGNORE_COUNT_ATTR, ""));
boolean differs;
if (currentData.getState() == IgnoreCountData.State.RESET) {
// Ignore all changes while we are in reset state.
differs = false;
} else {
differs = currentData.getEffectiveValue() != oldData.getEffectiveValue();
}
if (differs) {
result.add(MutableProperty.IGNORE_COUNT);
}
}
return result;
}
示例7: getCulprits
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
/**
* Returns the culprits for a marker delta, or the empty list if none found.
*
* @param marker
* @return a list of the culprits for the marker delta (not null)
*/
@SuppressWarnings("unchecked")
public static List<EPlanElement> getCulprits(IMarkerDelta delta) {
List<EPlanElement> list = (List<EPlanElement>)delta.getAttribute(CULPRITS);
if (list != null) {
return list;
}
return Collections.<EPlanElement>emptyList();
}
示例8: isReferencedBy
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
/**
* Returns whether the given marker delta references the given Java element.
* Used for markers deltas, which denote a Java element rather than a resource.
*
* @param element the element
* @param markerDelta the marker delta
* @return <code>true</code> if the marker delta references the element
* @exception CoreException if the <code>IMarkerDelta.getAttribute</code> on the marker delta fails
*/
public static boolean isReferencedBy(IJavaElement element, IMarkerDelta markerDelta) throws CoreException {
// only match units or classfiles
if (element instanceof IMember){
IMember member = (IMember) element;
if (member.isBinary()){
element = member.getClassFile();
} else {
element = member.getCompilationUnit();
}
}
if (element == null) return false;
if (markerDelta == null) return false;
String markerDeltarHandleId = (String)markerDelta.getAttribute(ATT_HANDLE_ID);
if (markerDeltarHandleId == null) return false;
IJavaElement markerElement = JavaCore.create(markerDeltarHandleId);
while (true){
if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs.
// cycle through enclosing types in case marker is associated with a classfile (15568)
if (markerElement instanceof IClassFile){
IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType();
if (enclosingType != null){
markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile
continue;
}
}
break;
}
return false;
}
示例9: breakpointChanged
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
@Override
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
if (delta == null) {//Ignore non marker events which come from BfBreakpoint.setInstalled
return;
}
if (this.isTerminated()) {
return;
}
try {
if (breakpoint instanceof BfWatchpoint) {
BfWatchpoint wp = (BfWatchpoint) breakpoint;
if (wp.isEnabled() && DebugPlugin.getDefault().getBreakpointManager().isEnabled()) {
this.process.getInterpreter().addWatchpoint(wp);
}
else {
this.process.getInterpreter().removeWatchpoint(wp);
}
return;
}
BfBreakpoint bp = this.getValidBreakpoint(breakpoint);
if (bp == null) {
return;
}
if (delta.getKind() != IResourceDelta.CHANGED) {
DbgActivator.getDefault().logError("Unexpected marker delta: " + delta, null);
return;
}
int newLocation = bp.getCharStart();
int oldLocation = delta.getAttribute(IMarker.CHAR_START, newLocation);
if (bp.isEnabled() && DebugPlugin.getDefault().getBreakpointManager().isEnabled()) {
if (!this.installedBreakpoints.contains(breakpoint)) {
this.process.getInterpreter().addBreakpoint(newLocation);
this.addInstalledBreakpoint(bp);
}
else if (newLocation != oldLocation) {
this.process.getInterpreter().removeBreakpoint(oldLocation);
this.process.getInterpreter().addBreakpoint(newLocation);
}
}
else {
this.process.getInterpreter().removeBreakpoint(oldLocation);
this.removeInstalledBreakpoint(bp);
}
}
catch (CoreException ex) {
DbgActivator.getDefault().logError("Breakpoint could not be added", ex);
}
}
示例10: resourceChanged
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
@Override
public void resourceChanged(IResourceChangeEvent event) {
IResource resource = CommonUtils.getAdapter(timeline, IResource.class);
if (resource == null) {
return;
}
Resource eResource = model.eResource();
if (eResource == null) {
return;
}
String uriFragment = eResource.getURIFragment(model);
URI modelFragmentURI = URI.createURI(uriFragment.toString());
boolean refresh = false;
final boolean includeSubTypes = true;
IMarkerDelta[] markerDeltas = event.findMarkerDeltas(IMarker.MARKER, includeSubTypes);
for (IMarkerDelta delta : markerDeltas) {
IResource markerResource = delta.getResource();
if (CommonUtils.equals(resource, markerResource)) {
try {
Object attribute = null;
if(delta.getKind() == IResourceDelta.REMOVED) {
// get the old value of location, since the new value doesn't exist (marker deleted)
attribute = delta.getAttribute(IMarker.LOCATION);
} else {
IMarker marker = delta.getMarker();
attribute = marker.getAttribute(IMarker.LOCATION);
}
if (attribute != null) {
String foreignFragment = attribute.toString();
if (foreignFragment.startsWith(modelFragmentURI.toString())) {
refresh = true;
break;
}
}
} catch (CoreException e) {
String message = e.getMessage();
if (!message.contains("Marker id") || !message.contains(" not found.")) {
LogUtil.warn(e);
}
}
}
}
if (refresh) {
WidgetUtils.runInDisplayThread(timeline.getControl(), new Runnable() {
@Override
public void run() {
updateTitleVisual();
}
});
}
}