summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2009-03-05 10:31:08 (EST)
committer sefftinge2009-03-05 10:31:08 (EST)
commit4df266ae8ddcc6eeed4c50bf3d105126234c25e1 (patch)
treeffc40055482e1a23f031e3f812e02bd199e9d118
parentea066a2e89a233942ac9d895f863a5d659e11335 (diff)
downloadorg.eclipse.xtext-4df266ae8ddcc6eeed4c50bf3d105126234c25e1.zip
org.eclipse.xtext-4df266ae8ddcc6eeed4c50bf3d105126234c25e1.tar.gz
org.eclipse.xtext-4df266ae8ddcc6eeed4c50bf3d105126234c25e1.tar.bz2
Fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=267193
Sugar and minor fixes for Xtext outline
-rw-r--r--plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/XtextResourceChecker.java16
-rw-r--r--plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/model/XtextDocumentProvider.java14
2 files changed, 17 insertions, 13 deletions
diff --git a/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/XtextResourceChecker.java b/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/XtextResourceChecker.java
index e5cfd2e..72021da 100644
--- a/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/XtextResourceChecker.java
+++ b/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/XtextResourceChecker.java
@@ -37,7 +37,7 @@ import org.eclipse.xtext.resource.XtextResource;
/**
* @author Dennis Hübner - Initial contribution and API
- *
+ *
*/
public class XtextResourceChecker {
@@ -49,16 +49,16 @@ public class XtextResourceChecker {
/**
* @author Sven Efftinge - Initial contribution and API
- *
+ *
*/
public static final class AddMarkersOperation extends WorkspaceModifyOperation {
/**
- *
+ *
*/
private final List<Map<String, Object>> issues;
- private IFile file;
- private String markerId;
- private boolean deleteMarkers;
+ private final IFile file;
+ private final String markerId;
+ private final boolean deleteMarkers;
/**
* @param rule
@@ -76,6 +76,8 @@ public class XtextResourceChecker {
@Override
protected void execute(final IProgressMonitor monitor) throws CoreException, InvocationTargetException,
InterruptedException {
+ if (!file.exists())
+ return;
if (deleteMarkers)
file.deleteMarkers(markerId, true, IResource.DEPTH_INFINITE);
if (!issues.isEmpty()) {
@@ -107,7 +109,7 @@ public class XtextResourceChecker {
/**
* Checks an {@link XtextResource}
- *
+ *
* @param resource
* @return a {@link List} of {@link IMarker} attributes
*/
diff --git a/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/model/XtextDocumentProvider.java b/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/model/XtextDocumentProvider.java
index 4d9f43f..638315d 100644
--- a/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/model/XtextDocumentProvider.java
+++ b/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/model/XtextDocumentProvider.java
@@ -82,17 +82,19 @@ public class XtextDocumentProvider extends FileDocumentProvider {
switch (delta.getKind()) {
case IResourceDelta.REMOVED:
// UNLOAD
- document.modify(new UnitOfWork<Object>() {
- public Object exec(XtextResource arg) throws Exception {
+ document.modify(new UnitOfWork<Void>() {
+ public Void exec(XtextResource arg) throws Exception {
emfResource.unload();
return null;
}
});
+ if (emfResource.getResourceSet() != null)
+ set.getResources().remove(emfResource);
break;
case IResourceDelta.CHANGED:
// RELOAD
- document.modify(new UnitOfWork<Object>() {
- public Object exec(XtextResource arg) throws Exception {
+ document.modify(new UnitOfWork<Void>() {
+ public Void exec(XtextResource arg) throws Exception {
emfResource.unload();
try {
emfResource.load(null);
@@ -145,7 +147,7 @@ public class XtextDocumentProvider extends FileDocumentProvider {
}
}
- private List<IResourceChangeListener> resourceChangeListener = new ArrayList<IResourceChangeListener>();
+ private final List<IResourceChangeListener> resourceChangeListener = new ArrayList<IResourceChangeListener>();
@Override
protected IDocument createEmptyDocument() {
@@ -154,7 +156,7 @@ public class XtextDocumentProvider extends FileDocumentProvider {
resourceChangeListener.add(listener);
ResourcesPlugin.getWorkspace().addResourceChangeListener(listener,
IResourceChangeEvent.POST_CHANGE);
-
+
return xtextDocument;
}