Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Piskarev2015-04-15 14:37:20 +0000
committerVladimir Piskarev2015-04-15 14:39:25 +0000
commitd4f021ece72f4e49c423c4de9c6508113f10d955 (patch)
tree50562ca5626b01c2008dc9f71d976f126d4d02ae
parent876d3dda679bb469fcca0d3599ac6015b53bd46b (diff)
downloadorg.eclipse.handly-d4f021ece72f4e49c423c4de9c6508113f10d955.tar.gz
org.eclipse.handly-d4f021ece72f4e49c423c4de9c6508113f10d955.tar.xz
org.eclipse.handly-d4f021ece72f4e49c423c4de9c6508113f10d955.zip
Generalized ProblemMarkerListenerContribution implementation a bit
-rw-r--r--org.eclipse.handly.ui/src/org/eclipse/handly/ui/outline/ProblemMarkerListenerContribution.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/org.eclipse.handly.ui/src/org/eclipse/handly/ui/outline/ProblemMarkerListenerContribution.java b/org.eclipse.handly.ui/src/org/eclipse/handly/ui/outline/ProblemMarkerListenerContribution.java
index ca654493..ccafc3f8 100644
--- a/org.eclipse.handly.ui/src/org/eclipse/handly/ui/outline/ProblemMarkerListenerContribution.java
+++ b/org.eclipse.handly.ui/src/org/eclipse/handly/ui/outline/ProblemMarkerListenerContribution.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 1C LLC.
+ * Copyright (c) 2014, 2015 1C-Soft LLC 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
@@ -12,17 +12,17 @@ package org.eclipse.handly.ui.outline;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.handly.model.ISourceElement;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.handly.model.IHandle;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.ui.PlatformUI;
/**
- * A basic class for problem marker listener contributions. This implementation
- * refreshes the outline of an <code>ISourceElement</code> when problem markers
- * attached to the underlying resource change. Subclasses may provide
- * a more elaborate implementation.
+ * Refreshes the outline when problem markers attached to the underlying
+ * resource change.
*/
public class ProblemMarkerListenerContribution
extends ResourceChangeListenerContribution
@@ -46,11 +46,18 @@ public class ProblemMarkerListenerContribution
@Override
protected boolean affects(IResourceChangeEvent event, Object inputElement)
{
- if (!(inputElement instanceof ISourceElement))
+ IResource resource = null;
+ if (inputElement instanceof IHandle)
+ resource = ((IHandle)inputElement).getResource();
+ else if (inputElement instanceof IAdaptable)
+ {
+ IAdaptable adaptable = (IAdaptable)inputElement;
+ resource = (IResource)adaptable.getAdapter(IResource.class);
+ }
+ if (resource == null)
return false;
IResourceDelta delta =
- event.getDelta().findMember(
- ((ISourceElement)inputElement).getPath());
+ event.getDelta().findMember(resource.getFullPath());
if (delta == null)
return false;
return hasProblemMarkerChanges(delta);

Back to the top