org.chromium.debug.core/src/org/chromium/debug/core/model/DebugElementImpl.java
author Eugene Ostroukhov <eugeneo@symbian.org>
Thu, 18 Mar 2010 11:56:59 -0700
changeset 276 f2f4a1259de8
parent 52 f577ea64429e
permissions -rw-r--r--
Bug 2065 - Pull updated Chrome Developer Tools into the workspace

// Copyright (c) 2009 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.model;

import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IDebugElement;

/**
 * A generic IDebugElement implementation.
 */
public class DebugElementImpl extends PlatformObject implements IDebugElement {

  /**
   * Instance of {@link DebugTargetImpl} or {@code null} if this is {@link DebugTargetImpl}.
   * TODO(peter.rybin): Do we really need this null value?
   */
  private final DebugTargetImpl debugTarget;

  public DebugElementImpl(DebugTargetImpl debugTarget) {
    this.debugTarget = debugTarget;
  }

  public DebugTargetImpl getDebugTarget() {
    return debugTarget;
  }

  public ILaunch getLaunch() {
    return getDebugTarget().getLaunch();
  }

  public String getModelIdentifier() {
    return getDebugTarget().getChromiumModelIdentifier();
  }

  @Override
  @SuppressWarnings("unchecked")
  public Object getAdapter(Class adapter) {
    if (adapter == IDebugElement.class) {
      return this;
    }
    return super.getAdapter(adapter);
  }

}