Package xvrengine.ui

Source Code of xvrengine.ui.XVRModelPresentation

package xvrengine.ui;

import org.eclipse.core.resources.IFile;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.ILineBreakpoint;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IValueDetailListener;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.part.FileEditorInput;

import xvrengine.XVRPlugin;
import xvrengine.debug.XVRStackFrame;
import xvrengine.debug.XVRValue;
import xvrengine.debug.XVRVariable;

public class XVRModelPresentation extends LabelProvider implements IDebugModelPresentation {

  @Override
  public void computeDetail(IValue value, IValueDetailListener listener) {
    // TODO Auto-generated method stub
  }

  @Override
  public void setAttribute(String attribute, Object value) {
    // TODO Auto-generated method stub
  }

  public Image getImage(Object element) {
    if(element instanceof XVRVariable){
      XVRVariable variable = (XVRVariable)element;
      try {
        if(variable.getValue() instanceof XVRValue) return XVRPlugin.getImageDescriptor("icons/variable_obj.gif").createImage();
      } catch (DebugException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }else if(element instanceof XVRStackFrame){
      XVRStackFrame frame = (XVRStackFrame)element;
      if(frame.isMethod()){
        return XVRPlugin.getImageDescriptor("icons/method_public_obj.gif").createImage();
      }else{
        return XVRPlugin.getImageDescriptor("icons/method_protected_obj.gif").createImage();
      }
    }
   
    return null;
  }

  public String getText(Object element) {
    return null;
  }

  @Override
  public String getEditorId(IEditorInput input, Object element) {
    if (element instanceof IFile || element instanceof ILineBreakpoint) return "org.xvr.S3D";
    return null;
  }

  @Override
  public IEditorInput getEditorInput(Object element) {
    if(element instanceof IFile){
      return new FileEditorInput((IFile)element);
    }
    if(element instanceof ILineBreakpoint){
      return new FileEditorInput((IFile)((ILineBreakpoint)element).getMarker().getResource());
    }
    return null;
  }
}
TOP

Related Classes of xvrengine.ui.XVRModelPresentation

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.