| Index: plugins/org.chromium.debug.core/src/org/chromium/debug/core/ReverseLookupContainer.java
|
| diff --git a/plugins/org.chromium.debug.core/src/org/chromium/debug/core/ReverseLookupContainer.java b/plugins/org.chromium.debug.core/src/org/chromium/debug/core/ReverseLookupContainer.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2632a225773859b4a39c7207ff502e689ca2b3c3
|
| --- /dev/null
|
| +++ b/plugins/org.chromium.debug.core/src/org/chromium/debug/core/ReverseLookupContainer.java
|
| @@ -0,0 +1,46 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +package org.chromium.debug.core;
|
| +
|
| +import org.eclipse.debug.core.sourcelookup.ISourceContainer;
|
| +
|
| +/**
|
| + * A kind of source container that explicitly supports reverse look-up, i.e. mapping
|
| + * from a source file to element name.
|
| + * Custom container implementation may also implement this interface.
|
| + * <p>This interface is used in {@link ReverseSourceLookup} class. The class also provides
|
| + * reverse look-up for certain standard containers.
|
| + * <p>Possible downcasting {@link ISourceContainer} to {@link ReverseLookupContainer} is a regular
|
| + * operation. Since raw "instanceof" is considered anti-typesafe operation, it was incapsulated in
|
| + * {@link Cast} class.
|
| + */
|
| +public interface ReverseLookupContainer extends ISourceContainer {
|
| + /**
|
| + * Returns a container wrapper instance that will be used for actual look-up. This method
|
| + * may also be called from UI to check whether container is properly configured for reverse
|
| + * look-up. The return object is considered light-weight and the method is called
|
| + * for each look-up.
|
| + * <p>
|
| + * If container has inner containers, it is supposed to prepare similar wrapper for them
|
| + * by calling {@link ReverseSourceLookup#wrapSourceContainer} method.
|
| + *
|
| + * @return a container wrapper instance or null if reverse look-up is not (currently) available
|
| + */
|
| + ReverseSourceLookup.ContainerWrapper getReveseLookupImpl();
|
| +
|
| + /**
|
| + * A utility class that legalizes one particular downcast. Manual instanceof/cast operations are
|
| + * discouraged, because they are not declared and thus not type-safe.
|
| + */
|
| + class Cast {
|
| + public static ReverseLookupContainer fromContainer(ISourceContainer sourceContainer) {
|
| + if (sourceContainer instanceof ReverseLookupContainer) {
|
| + return (ReverseLookupContainer) sourceContainer;
|
| + } else {
|
| + return null;
|
| + }
|
| + }
|
| + }
|
| +}
|
|
|