Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Piskarev2016-08-18 05:59:49 +0000
committerVladimir Piskarev2016-08-18 05:59:49 +0000
commit5b448a9c79f954cb2843223c3b2aa387adaf7bb4 (patch)
tree2f712ef8278535c7a2cf00c4d93f5ff54c82d904
parenteb99e2e5b2660a3459eb19de34ec7e5b7da76b71 (diff)
downloadorg.eclipse.handly-5b448a9c79f954cb2843223c3b2aa387adaf7bb4.tar.gz
org.eclipse.handly-5b448a9c79f954cb2843223c3b2aa387adaf7bb4.tar.xz
org.eclipse.handly-5b448a9c79f954cb2843223c3b2aa387adaf7bb4.zip
Bug 499879 - Remove SimpleSourceElementInfo
-rw-r--r--org.eclipse.handly.examples.javamodel/src/org/eclipse/handly/internal/examples/javamodel/JavaWorkingCopyInfo.java2
-rw-r--r--org.eclipse.handly/src/org/eclipse/handly/model/Elements.java66
-rw-r--r--org.eclipse.handly/src/org/eclipse/handly/model/impl/SimpleSourceElementInfo.java61
3 files changed, 53 insertions, 76 deletions
diff --git a/org.eclipse.handly.examples.javamodel/src/org/eclipse/handly/internal/examples/javamodel/JavaWorkingCopyInfo.java b/org.eclipse.handly.examples.javamodel/src/org/eclipse/handly/internal/examples/javamodel/JavaWorkingCopyInfo.java
index 3aa5b520..dcc1e238 100644
--- a/org.eclipse.handly.examples.javamodel/src/org/eclipse/handly/internal/examples/javamodel/JavaWorkingCopyInfo.java
+++ b/org.eclipse.handly.examples.javamodel/src/org/eclipse/handly/internal/examples/javamodel/JavaWorkingCopyInfo.java
@@ -35,7 +35,7 @@ public class JavaWorkingCopyInfo
}
@Override
- public void reconcile(NonExpiringSnapshot snapshot, boolean forced,
+ protected void reconcile(NonExpiringSnapshot snapshot, boolean forced,
Object arg, IProgressMonitor monitor) throws CoreException
{
ReconcileInfo info = (ReconcileInfo)arg;
diff --git a/org.eclipse.handly/src/org/eclipse/handly/model/Elements.java b/org.eclipse.handly/src/org/eclipse/handly/model/Elements.java
index 61b9576c..00d2be43 100644
--- a/org.eclipse.handly/src/org/eclipse/handly/model/Elements.java
+++ b/org.eclipse.handly/src/org/eclipse/handly/model/Elements.java
@@ -25,9 +25,10 @@ import org.eclipse.handly.internal.Activator;
import org.eclipse.handly.model.impl.IElementImpl;
import org.eclipse.handly.model.impl.ISourceElementImpl;
import org.eclipse.handly.model.impl.ISourceFileImpl;
-import org.eclipse.handly.model.impl.SimpleSourceElementInfo;
import org.eclipse.handly.snapshot.ISnapshot;
import org.eclipse.handly.snapshot.StaleSnapshotException;
+import org.eclipse.handly.util.Property;
+import org.eclipse.handly.util.TextRange;
/**
* Provides methods for generic access to elements of a Handly-based model.
@@ -48,17 +49,6 @@ import org.eclipse.handly.snapshot.StaleSnapshotException;
public class Elements
{
/**
- * A 'null object' indicating that no info is available for source element.
- * <p>
- * The instance's methods return either <code>null</code> (if allowed
- * by the method contract) or an appropriate 'null object' (such as
- * a zero-length array).
- * </p>
- */
- public static final ISourceElementInfo NO_SOURCE_INFO =
- new SimpleSourceElementInfo();
-
- /**
* Returns the name of the element, or <code>null</code>
* if the element has no name. This is a handle-only method.
*
@@ -325,7 +315,7 @@ public class Elements
/**
* Returns an object holding cached structure and properties for the
- * source element, or {@link #NO_SOURCE_INFO} if source info is not
+ * source element, or {@link #NO_SOURCE_ELEMENT_INFO} if source info is not
* available.
*
* @param element not <code>null</code>
@@ -346,10 +336,58 @@ public class Elements
else
Activator.log(e.getStatus());
}
- return NO_SOURCE_INFO;
+ return NO_SOURCE_ELEMENT_INFO;
}
/**
+ * A 'null object' indicating that no info is available for source element.
+ * <p>
+ * The instance methods return either <code>null</code> (if allowed
+ * by the method contract) or an appropriate 'null object' (such as
+ * a zero-length array).
+ * </p>
+ * @see ISourceElementInfo
+ */
+ public static final ISourceElementInfo NO_SOURCE_ELEMENT_INFO =
+ new NoSourceElementInfo();
+
+ private static class NoSourceElementInfo
+ implements ISourceElementInfo
+ {
+ static final ISourceConstruct[] NO_CHILDREN = new ISourceConstruct[0];
+
+ @Override
+ public ISnapshot getSnapshot()
+ {
+ return null;
+ }
+
+ @Override
+ public <T> T get(Property<T> property)
+ {
+ return null;
+ }
+
+ @Override
+ public ISourceConstruct[] getChildren()
+ {
+ return NO_CHILDREN;
+ }
+
+ @Override
+ public TextRange getFullRange()
+ {
+ return null;
+ }
+
+ @Override
+ public TextRange getIdentifyingRange()
+ {
+ return null;
+ }
+ };
+
+ /**
* Returns the source file that contains the given element,
* or <code>null</code> if the given element is not contained in a
* source file. Returns the given element itself if it is a source file.
diff --git a/org.eclipse.handly/src/org/eclipse/handly/model/impl/SimpleSourceElementInfo.java b/org.eclipse.handly/src/org/eclipse/handly/model/impl/SimpleSourceElementInfo.java
deleted file mode 100644
index 4c047979..00000000
--- a/org.eclipse.handly/src/org/eclipse/handly/model/impl/SimpleSourceElementInfo.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015, 2016 1C-Soft LLC.
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vladimir Piskarev (1C) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.handly.model.impl;
-
-import org.eclipse.handly.model.ISourceConstruct;
-import org.eclipse.handly.model.ISourceElementInfo;
-import org.eclipse.handly.snapshot.ISnapshot;
-import org.eclipse.handly.util.Property;
-import org.eclipse.handly.util.TextRange;
-
-/**
- * The simplest possible implementation of {@link ISourceElementInfo}.
- * <p>
- * Clients can use this class as it stands or subclass it
- * as circumstances warrant.
- * </p>
- */
-public class SimpleSourceElementInfo
- implements ISourceElementInfo
-{
- private static final ISourceConstruct[] NO_CHILDREN =
- new ISourceConstruct[0];
-
- @Override
- public ISnapshot getSnapshot()
- {
- return null;
- }
-
- @Override
- public <T> T get(Property<T> property)
- {
- return null;
- }
-
- @Override
- public ISourceConstruct[] getChildren()
- {
- return NO_CHILDREN;
- }
-
- @Override
- public TextRange getFullRange()
- {
- return null;
- }
-
- @Override
- public TextRange getIdentifyingRange()
- {
- return null;
- }
-}

Back to the top