Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java')
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java78
1 files changed, 35 insertions, 43 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java
index a23dad182..4b31689e3 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -24,9 +24,9 @@ import org.eclipse.equinox.p2.ui.Policy;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
- * Element class that represents an element that gets its children
- * by using a query.
- *
+ * Element class that represents an element that gets its children by using a
+ * query.
+ *
* @since 3.4
*
*/
@@ -37,8 +37,8 @@ public abstract class QueriedElement extends ProvElement {
// that want to eliminate duplicates from the parent hierarchy.
// This cache is *not* used as a general purpose child cache.
private Collection<?> cachedChildren;
- private static final Object[] EMPTY= new Object[0];
-
+ private static final Object[] EMPTY = new Object[0];
+
protected QueriedElement(Object parent) {
super(parent);
}
@@ -55,7 +55,7 @@ public abstract class QueriedElement extends ProvElement {
if (parent instanceof QueriedElement)
return ((QueriedElement) parent).getProvisioningUI();
// if we really can't find a UI then get the default. In general this should
- // not happen though. Turn on tracing in getDefaultUI() to see places where
+ // not happen though. Turn on tracing in getDefaultUI() to see places where
// it is happening.
return ProvisioningUI.getDefaultUI();
@@ -73,27 +73,25 @@ public abstract class QueriedElement extends ProvElement {
return fetchChildren(o, new NullProgressMonitor());
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
@Override
public String getLabel(Object o) {
return null;
}
/**
- * Return the query type that is appropriate for this element when there
- * is no query context.
- * @return The integer query type
+ * Return the query type that is appropriate for this element when there is no
+ * query context.
+ *
+ * @return The integer query type
*/
protected abstract int getDefaultQueryType();
/**
- * Return the query type that should be used for this element.
- * Depending on the element, the query type may take the query context
- * into account. Subclasses should override this method if there are
- * context-dependent decisions to be made to determine the query.
+ * Return the query type that should be used for this element. Depending on the
+ * element, the query type may take the query context into account. Subclasses
+ * should override this method if there are context-dependent decisions to be
+ * made to determine the query.
+ *
* @return The integer query type
*/
public int getQueryType() {
@@ -112,8 +110,8 @@ public abstract class QueriedElement extends ProvElement {
Collection<Object> returnedChildren = new HashSet<>();
returnedChildren.addAll(results);
Object[] siblings = getSiblings();
- for (int i = 0; i < siblings.length; i++) {
- returnedChildren.remove(siblings[i]);
+ for (Object sibling : siblings) {
+ returnedChildren.remove(sibling);
}
return returnedChildren.toArray();
}
@@ -129,35 +127,29 @@ public abstract class QueriedElement extends ProvElement {
}
/**
- * Return a boolean indicating whether the receiver
- * has enough information to get its queryable. This is used in lieu
- * of {{@link #getQueryable()} when lazy initialization
- * of the queryable is not desired, and a client wishes
- * to know whether the queryable could be obtained. Subclasses
- * that cache information needed to retrieve the queryable rather
- * than the queryable itself should
- * override this.
- *
- * @return <code>true</code> if the receiver has enough
- * information to retrieve its queryable, <code>false</code>
- * if it does not.
+ * Return a boolean indicating whether the receiver has enough information to
+ * get its queryable. This is used in lieu of {{@link #getQueryable()} when lazy
+ * initialization of the queryable is not desired, and a client wishes to know
+ * whether the queryable could be obtained. Subclasses that cache information
+ * needed to retrieve the queryable rather than the queryable itself should
+ * override this.
+ *
+ * @return <code>true</code> if the receiver has enough information to retrieve
+ * its queryable, <code>false</code> if it does not.
*/
public boolean knowsQueryable() {
return queryable != null;
}
/**
- * Return a boolean indicating whether the receiver
- * actually has its queryable. This is used in lieu
- * of {{@link #getQueryable()} when lazy initialization
- * of the queryable is not desired. For example, when
- * working with an element whose queryable may be
- * expensive to obtain, clients may check this before
- * actually getting the queryable. Subclasses
- * should typically not need to override this.
- *
- * @return <code>true</code> if the receiver has its
- * queryable, <code>false</code> if it does not yet.
+ * Return a boolean indicating whether the receiver actually has its queryable.
+ * This is used in lieu of {{@link #getQueryable()} when lazy initialization of
+ * the queryable is not desired. For example, when working with an element whose
+ * queryable may be expensive to obtain, clients may check this before actually
+ * getting the queryable. Subclasses should typically not need to override this.
+ *
+ * @return <code>true</code> if the receiver has its queryable,
+ * <code>false</code> if it does not yet.
*/
public boolean hasQueryable() {
return queryable != null;

Back to the top