org.eclipse.cdt.debug.ui_7.1.2.201202111925

16:41:44.684 INFO  jd.cli.Main - Decompiling org.eclipse.cdt.debug.ui_7.1.2.201202111925.jar
package org.eclipse.cdt.debug.ui.breakpoints;

import java.util.Map;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.swt.widgets.Composite;

public abstract interface ICBreakpointsUIContribution
{
  public abstract String getId();
  
  public abstract String getLabel();
  
  public abstract FieldEditor getFieldEditor(String paramString1, String paramString2, Composite paramComposite);
  
  public abstract String getFieldEditorClassName();
  
  public abstract String[] getPossibleValues();
  
  public abstract String getLabelForValue(String paramString);
  
  public abstract String getType();
  
  public abstract String getMarkerType();
  
  public abstract String getDebugModelId();
  
  public abstract boolean isApplicable(Map paramMap);
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointsUIContribution
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.debug.ui.breakpoints;

import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

class CEventBreakpointsLabelProviderFactory$1
  extends LabelProvider
{
  public String getText(Object element)
  {
    if ((element instanceof ICEventBreakpoint)) {
      try
      {
        ICEventBreakpoint breakpoint = (ICEventBreakpoint)element;
        
        ICBreakpointsUIContribution[] bscs = CBreakpointUIContributionFactory.getInstance()
          .getBreakpointUIContributions(breakpoint);
        if (bscs.length == 0) {
          return null;
        }
        StringBuffer buffer = new StringBuffer();
        ICBreakpointsUIContribution[] arrayOfICBreakpointsUIContribution1;
        int j = (arrayOfICBreakpointsUIContribution1 = bscs).length;
        for (int i = 0; i < j; i++)
        {
          ICBreakpointsUIContribution con = arrayOfICBreakpointsUIContribution1[i];
          Object attValue = breakpoint.getMarker().getAttribute(con.getId());
          if (con.getId().equals("org.eclipse.cdt.debug.core.eventbreakpoint_event_id"))
          {
            buffer.append(con.getLabelForValue((String)attValue));
          }
          else if ((attValue != null) && (attValue.toString().length() > 0))
          {
            buffer.append(" [");
            buffer.append(con.getLabel());
            buffer.append(": ");
            if ((attValue instanceof String)) {
              buffer.append(con.getLabelForValue((String)attValue));
            } else {
              buffer.append(attValue);
            }
            buffer.append(']');
          }
        }
        CEventBreakpointsLabelProviderFactory.appendIgnoreCount(breakpoint, buffer);
        CEventBreakpointsLabelProviderFactory.appendCondition(breakpoint, buffer);
        return buffer.toString();
      }
      catch (CoreException e)
      {
        CDebugUIPlugin.log(e);
      }
    }
    return null;
  }
  
  public Image getImage(Object element)
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.debug.ui.breakpoints.CEventBreakpointsLabelProviderFactory.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.debug.ui.breakpoints;

import com.ibm.icu.text.MessageFormat;
import org.eclipse.cdt.debug.core.DebugCoreMessages;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.internal.ui.model.elements.BreakpointLabelProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

public class CEventBreakpointsLabelProviderFactory
  implements IAdapterFactory
{
  private static ILabelProvider fLabelProvider = new LabelProvider()
  {
    public String getText(Object element)
    {
      if ((element instanceof ICEventBreakpoint)) {
        try
        {
          ICEventBreakpoint breakpoint = (ICEventBreakpoint)element;
          
          ICBreakpointsUIContribution[] bscs = CBreakpointUIContributionFactory.getInstance()
            .getBreakpointUIContributions(breakpoint);
          if (bscs.length == 0) {
            return null;
          }
          StringBuffer buffer = new StringBuffer();
          ICBreakpointsUIContribution[] arrayOfICBreakpointsUIContribution1;
          int j = (arrayOfICBreakpointsUIContribution1 = bscs).length;
          for (int i = 0; i < j; i++)
          {
            ICBreakpointsUIContribution con = arrayOfICBreakpointsUIContribution1[i];
            Object attValue = breakpoint.getMarker().getAttribute(con.getId());
            if (con.getId().equals("org.eclipse.cdt.debug.core.eventbreakpoint_event_id"))
            {
              buffer.append(con.getLabelForValue((String)attValue));
            }
            else if ((attValue != null) && (attValue.toString().length() > 0))
            {
              buffer.append(" [");
              buffer.append(con.getLabel());
              buffer.append(": ");
              if ((attValue instanceof String)) {
                buffer.append(con.getLabelForValue((String)attValue));
              } else {
                buffer.append(attValue);
              }
              buffer.append(']');
            }
          }
          CEventBreakpointsLabelProviderFactory.appendIgnoreCount(breakpoint, buffer);
          CEventBreakpointsLabelProviderFactory.appendCondition(breakpoint, buffer);
          return buffer.toString();
        }
        catch (CoreException e)
        {
          CDebugUIPlugin.log(e);
        }
      }
      return null;
    }
    
    public Image getImage(Object element)
    {
      return null;
    }
  };
  
  protected static StringBuffer appendIgnoreCount(ICBreakpoint breakpoint, StringBuffer label)
    throws CoreException
  {
    int ignoreCount = breakpoint.getIgnoreCount();
    if (ignoreCount > 0)
    {
      label.append(' ');
      label.append(MessageFormat.format(
        DebugCoreMessages.getString("CDebugUtils.3"), new String[] { Integer.toString(ignoreCount) }));
    }
    return label;
  }
  
  protected static void appendCondition(ICBreakpoint breakpoint, StringBuffer buffer)
    throws CoreException
  {
    String condition = breakpoint.getCondition();
    if ((condition != null) && (condition.length() > 0))
    {
      buffer.append(' ');
      buffer.append(
        MessageFormat.format(DebugCoreMessages.getString("CDebugUtils.4"), new String[] { condition }));
    }
  }
  
  private static IElementLabelProvider fElementLabelProvider = new BreakpointLabelProvider();
  
  public Object getAdapter(Object adaptableObject, Class adapterType)
  {
    if ((adapterType.equals(IElementLabelProvider.class)) && 
      ((adaptableObject instanceof ICEventBreakpoint))) {
      return fElementLabelProvider;
    }
    if ((adapterType.equals(ILabelProvider.class)) && 
      ((adaptableObject instanceof ICEventBreakpoint))) {
      return fLabelProvider;
    }
    return null;
  }
  
  public Class[] getAdapterList()
  {
    return new Class[] { IElementLabelProvider.class, ILabelProvider.class };
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.debug.ui.breakpoints.CEventBreakpointsLabelProviderFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.debug.ui.breakpoints;

import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.preferences.ReadOnlyFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.swt.widgets.Composite;

class DefaultCBreakpointUIContribution
  implements ICBreakpointsUIContribution
{
  private String attLabel;
  private String attId;
  private String fieldEditorClassName;
  private String markerType;
  private String modelId;
  private String attType;
  private Map<String, String> valueLabels = new LinkedHashMap();
  private Map<String, String> conditions = new HashMap();
  
  public String getId()
  {
    return attId;
  }
  
  public String getLabel()
  {
    return attLabel;
  }
  
  public String getDebugModelId()
  {
    return modelId;
  }
  
  private static Class[] fieldSignature = { String.class, String.class, 
    Composite.class };
  
  public FieldEditor getFieldEditor(String name, String labelText, Composite parent)
  {
    String className = fieldEditorClassName;
    if (fieldEditorClassName == null) {
      className = ReadOnlyFieldEditor.class.getName();
    }
    try
    {
      Class cclass = Class.forName(className);
      Constructor constructor = cclass.getConstructor(fieldSignature);
      FieldEditor editor = (FieldEditor)constructor.newInstance(new Object[] { name, labelText, parent });
      if ((editor instanceof ICBreakpointsUIContributionUser)) {
        ((ICBreakpointsUIContributionUser)editor).setContribution(this);
      }
      return editor;
    }
    catch (Exception e)
    {
      CDebugUIPlugin.log(e);
    }
    return null;
  }
  
  public String getLabelForValue(String value)
  {
    if (valueLabels.containsKey(value)) {
      return (String)valueLabels.get(value);
    }
    return value;
  }
  
  public String getMarkerType()
  {
    return markerType;
  }
  
  public String[] getPossibleValues()
  {
    Set<String> set = valueLabels.keySet();
    return (String[])set.toArray(new String[set.size()]);
  }
  
  public String getType()
  {
    return attType;
  }
  
  public boolean isApplicable(Map properties)
  {
    for (Object key : properties.keySet())
    {
      String value = (String)conditions.get(key);
      if (value != null)
      {
        String realValue = (String)properties.get(key);
        if (!value.equals(realValue)) {
          return false;
        }
      }
    }
    return true;
  }
  
  public void setLabel(String attLabel)
  {
    this.attLabel = attLabel;
  }
  
  public void setId(String attId)
  {
    this.attId = attId;
  }
  
  public void setControlClass(String controlClass)
  {
    fieldEditorClassName = controlClass;
  }
  
  public void setMarkerType(String markerId)
  {
    markerType = markerId;
  }
  
  public void setDebugModelId(String modelId)
  {
    this.modelId = modelId;
  }
  
  public void setType(String attType)
  {
    this.attType = attType;
  }
  
  public void addValue(String value, String valueLabel)
  {
    valueLabels.put(value, valueLabel);
  }
  
  public void addContionEquals(String property, String value)
  {
    conditions.put(property, value);
  }
  
  public void setVisible(boolean visible) {}
  
  public Map<String, String> getConditions()
  {
    return conditions;
  }
  
  public void addContionsAll(Map<String, String> conditions2)
  {
    conditions.putAll(conditions2);
  }
  
  public String toString()
  {
    return attId + " " + attLabel;
  }
  
  public String getFieldEditorClassName()
  {
    return fieldEditorClassName;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.debug.ui.breakpoints.DefaultCBreakpointUIContribution
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.debug.ui.breakpoints;

import java.util.ArrayList;
import java.util.Map;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.internal.resources.MarkerManager;
import org.eclipse.core.internal.resources.Workspace;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.model.IBreakpoint;

public class CBreakpointUIContributionFactory
{
  private static final String EXTENSION_POINT_NAME = "breakpointContribution";
  private static final String MAIN_ELEMENT = "breakpointLabels";
  private static CBreakpointUIContributionFactory instance;
  protected ArrayList<ICBreakpointsUIContribution> contributions;
  
  private CBreakpointUIContributionFactory()
  {
    contributions = new ArrayList();
    loadSubtypeContributions();
  }
  
  public ICBreakpointsUIContribution[] getBreakpointUIContributions(IBreakpoint breakpoint)
    throws CoreException
  {
    String debugModelId = breakpoint.getModelIdentifier();
    IMarker bmarker = breakpoint.getMarker();
    Map attributes = bmarker.getAttributes();
    String markerType = bmarker.getType();
    return getBreakpointUIContributions(debugModelId, markerType, attributes);
  }
  
  public ICBreakpointsUIContribution[] getBreakpointUIContributions(String debugModelId, String markerType, Map attributes)
  {
    ArrayList<ICBreakpointsUIContribution> list = new ArrayList();
    for (ICBreakpointsUIContribution con : contributions) {
      try
      {
        if ((debugModelId == null) || (con.getDebugModelId() == null) || (debugModelId.equals(con.getDebugModelId())))
        {
          String contributedMarkerType = con.getMarkerType();
          if ((isMarkerSubtypeOf(markerType, contributedMarkerType)) && (
            (attributes == null) || (con.isApplicable(attributes)))) {
            list.add(con);
          }
        }
      }
      catch (Exception e)
      {
        CDebugUIPlugin.log(e);
      }
    }
    return (ICBreakpointsUIContribution[])list.toArray(new ICBreakpointsUIContribution[list.size()]);
  }
  
  public boolean isMarkerSubtypeOf(String currentType, String type)
    throws CoreException
  {
    return getWorkspace().getMarkerManager().isSubtype(currentType, type);
  }
  
  private Workspace getWorkspace()
  {
    return (Workspace)CDebugUIPlugin.getWorkspace();
  }
  
  private void loadSubtypeContributions()
  {
    IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(CDebugUIPlugin.getUniqueIdentifier(), 
      "breakpointContribution");
    if (ep == null) {
      return;
    }
    IConfigurationElement[] elements = ep.getConfigurationElements();
    for (int i = 0; i < elements.length; i++)
    {
      IConfigurationElement configurationElement = elements[i];
      if (configurationElement.getName().equals("breakpointLabels"))
      {
        String modelId = configurationElement.getAttribute("debugModelId");
        String markerType = getRequired(configurationElement, "markerType");
        if (markerType != null)
        {
          IConfigurationElement[] children = configurationElement.getChildren("attribute");
          IConfigurationElement[] arrayOfIConfigurationElement1;
          int j = (arrayOfIConfigurationElement1 = children).length;
          for (int i = 0; i < j; i++)
          {
            IConfigurationElement att = arrayOfIConfigurationElement1[i];
            
            DefaultCBreakpointUIContribution adapter = new DefaultCBreakpointUIContribution();
            adapter.setMarkerType(markerType);
            adapter.setDebugModelId(modelId);
            if (processAttribute(att, adapter)) {}
          }
        }
      }
    }
  }
  
  private boolean processAttribute(IConfigurationElement attrElement, DefaultCBreakpointUIContribution adapter)
  {
    String attrId = getRequired(attrElement, "name");
    String attrLabel = getRequired(attrElement, "label");
    String className = attrElement.getAttribute("fieldEditor");
    String type = attrElement.getAttribute("type");
    String svisible = attrElement.getAttribute("visible");
    if (attrId == null) {
      return false;
    }
    if (attrLabel == null) {
      return false;
    }
    if (type == null) {
      type = "string";
    }
    boolean visible = true;
    if ((svisible != null) && (svisible.equalsIgnoreCase("false"))) {
      visible = false;
    }
    adapter.setId(attrId);
    adapter.setLabel(attrLabel);
    adapter.setControlClass(className);
    adapter.setType(type);
    adapter.setVisible(visible);
    addContribution(adapter);
    
    IConfigurationElement[] children = attrElement.getChildren("value");
    IConfigurationElement[] arrayOfIConfigurationElement1;
    int j = (arrayOfIConfigurationElement1 = children).length;
    for (int i = 0; i < j; i++)
    {
      IConfigurationElement value = arrayOfIConfigurationElement1[i];
      processValue(value, adapter);
    }
    return true;
  }
  
  private void processValue(IConfigurationElement valueElement, DefaultCBreakpointUIContribution adapter)
  {
    String valueId = getRequired(valueElement, "value");
    String valueLabel = getRequired(valueElement, "label");
    if (valueId == null) {
      return;
    }
    if (valueLabel == null) {
      return;
    }
    adapter.addValue(valueId, valueLabel);
    IConfigurationElement[] children = valueElement.getChildren("attribute");
    IConfigurationElement[] arrayOfIConfigurationElement1;
    int j = (arrayOfIConfigurationElement1 = children).length;
    for (int i = 0; i < j; i++)
    {
      IConfigurationElement att = arrayOfIConfigurationElement1[i];
      DefaultCBreakpointUIContribution adapter2 = new DefaultCBreakpointUIContribution();
      
      adapter2.setMarkerType(adapter.getMarkerType());
      adapter2.setDebugModelId(adapter.getDebugModelId());
      adapter2.addContionsAll(adapter.getConditions());
      
      adapter2.addContionEquals(adapter.getId(), valueId);
      if (processAttribute(att, adapter2)) {}
    }
  }
  
  public void addContribution(ICBreakpointsUIContribution contribution)
  {
    contributions.add(contribution);
  }
  
  public static CBreakpointUIContributionFactory getInstance()
  {
    if (instance == null) {
      instance = new CBreakpointUIContributionFactory();
    }
    return instance;
  }
  
  private static String getRequired(IConfigurationElement configurationElement, String name)
  {
    String elementValue = configurationElement.getAttribute(name);
    if (elementValue == null) {
      CDebugUIPlugin.log(new Status(4, CDebugUIPlugin.getUniqueIdentifier(), 
        120, "Extension " + 
        configurationElement.getDeclaringExtension().getUniqueIdentifier() + 
        " missing required attribute: " + name, null));
    }
    return elementValue;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.debug.ui.breakpoints.CBreakpointUIContributionFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.debug.ui.breakpoints;

public abstract interface ICBreakpointsUIContributionUser
{
  public abstract void setContribution(ICBreakpointsUIContribution paramICBreakpointsUIContribution);
  
  public abstract ICBreakpointsUIContribution getContribution();
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointsUIContributionUser
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.debug.ui;

import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.model.ICDebugElement;
import org.eclipse.cdt.debug.internal.ui.CBreakpointUpdater;
import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry;
import org.eclipse.cdt.debug.internal.ui.CDebugModelPresentation;
import org.eclipse.cdt.debug.internal.ui.CDebuggerPageAdapter;
import org.eclipse.cdt.debug.internal.ui.CRegisterManagerProxies;
import org.eclipse.cdt.debug.internal.ui.ColorManager;
import org.eclipse.cdt.debug.internal.ui.EvaluationContextManager;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyBackendCdiFactory;
import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorManager;
import org.eclipse.cdt.debug.internal.ui.pinclone.ViewIDCounterManager;
import org.eclipse.cdt.debug.ui.sourcelookup.DefaultSourceLocator;
import org.eclipse.cdt.debug.ui.sourcelookup.OldDefaultSourceLocator;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.model.IPersistableSourceLocator;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.text.source.ISharedTextColors;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.progress.WorkbenchJob;
import org.osgi.framework.BundleContext;

public class CDebugUIPlugin
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.eclipse.cdt.debug.ui";
  public static final String CDEBUGGER_PAGE_EXTENSION_POINT_ID = "CDebuggerPage";
  public static final String DEBUGGER_PAGE_ELEMENT = "debuggerPage";
  private static CDebugUIPlugin plugin;
  protected Map<String, IConfigurationElement> fDebuggerPageMap;
  private CDebugImageDescriptorRegistry fImageDescriptorRegistry;
  private DisassemblyEditorManager fDisassemblyEditorManager;
  
  public CDebugUIPlugin()
  {
    plugin = this;
  }
  
  public static CDebugUIPlugin getDefault()
  {
    return plugin;
  }
  
  public static IWorkspace getWorkspace()
  {
    return ResourcesPlugin.getWorkspace();
  }
  
  public static String getUniqueIdentifier()
  {
    return "org.eclipse.cdt.debug.ui";
  }
  
  public static Color getPreferenceColor(String type)
  {
    return ColorManager.getDefault().getColor(PreferenceConverter.getColor(getDefault().getPreferenceStore(), type));
  }
  
  public static CDebugModelPresentation getDebugModelPresentation()
  {
    return CDebugModelPresentation.getDefault();
  }
  
  public static void log(IStatus status)
  {
    getDefault().getLog().log(status);
  }
  
  public static void log(Throwable e)
  {
    log(new Status(4, getUniqueIdentifier(), 150, "Internal Error", e));
  }
  
  public static void logErrorMessage(String message)
  {
    log(new Status(4, getUniqueIdentifier(), 150, message, null));
  }
  
  public ICDebuggerPage getDebuggerPage(String debuggerID)
    throws CoreException
  {
    if (fDebuggerPageMap == null) {
      initializeDebuggerPageMap();
    }
    IConfigurationElement configElement = (IConfigurationElement)fDebuggerPageMap.get(debuggerID);
    ICDebuggerPage tab = null;
    if (configElement != null)
    {
      Object o = configElement.createExecutableExtension("class");
      if ((o instanceof ICDebuggerPage))
      {
        tab = (ICDebuggerPage)o;
        tab.init(debuggerID);
      }
      else if ((o instanceof ILaunchConfigurationTab))
      {
        tab = new CDebuggerPageAdapter((ILaunchConfigurationTab)o);
        tab.init(debuggerID);
      }
    }
    return tab;
  }
  
  protected void initializeDebuggerPageMap()
  {
    fDebuggerPageMap = new HashMap(10);
    IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.cdt.debug.ui", "CDebuggerPage");
    IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
    for (int i = 0; i < infos.length; i++)
    {
      IConfigurationElement info = infos[i];
      if (info.getName().equals("debuggerPage"))
      {
        String id = info.getAttribute("debuggerID");
        if (id != null) {
          fDebuggerPageMap.put(id, info);
        }
      }
    }
  }
  
  public static void errorDialog(String message, IStatus status)
  {
    log(status);
    Shell shell = getActiveWorkbenchShell();
    if (shell != null) {
      ErrorDialog.openError(shell, UIMessages.getString("CDebugUIPlugin.0"), message, status);
    }
  }
  
  public static void errorDialog(String message, Throwable t)
  {
    log(t);
    Shell shell = getActiveWorkbenchShell();
    if (shell != null)
    {
      IStatus status = new Status(4, getUniqueIdentifier(), 150, t.getMessage(), null);
      ErrorDialog.openError(shell, UIMessages.getString("CDebugUIPlugin.0"), message, status);
    }
  }
  
  public static IWorkbenchWindow getActiveWorkbenchWindow()
  {
    return getDefault().getWorkbench().getActiveWorkbenchWindow();
  }
  
  public static IWorkbenchPage getActivePage()
  {
    IWorkbenchWindow w = getActiveWorkbenchWindow();
    if (w != null) {
      return w.getActivePage();
    }
    return null;
  }
  
  public static Shell getActiveWorkbenchShell()
  {
    IWorkbenchWindow window = getActiveWorkbenchWindow();
    if (window == null)
    {
      IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
      if (windows.length > 0) {
        return windows[0].getShell();
      }
    }
    else
    {
      return window.getShell();
    }
    return null;
  }
  
  public static Display getStandardDisplay()
  {
    Display display = Display.getCurrent();
    if (display == null) {
      display = Display.getDefault();
    }
    return display;
  }
  
  public static CDebugImageDescriptorRegistry getImageDescriptorRegistry()
  {
    if (getDefaultfImageDescriptorRegistry == null) {
      getDefaultfImageDescriptorRegistry = new CDebugImageDescriptorRegistry();
    }
    return getDefaultfImageDescriptorRegistry;
  }
  
  public static IPersistableSourceLocator createDefaultSourceLocator()
  {
    return new DefaultSourceLocator();
  }
  
  public static String getDefaultSourceLocatorID()
  {
    return OldDefaultSourceLocator.ID_DEFAULT_SOURCE_LOCATOR;
  }
  
  public static String getDefaultSourceLocatorOldID()
  {
    return "org.eclipse.cdt.launch.DefaultSourceLocator";
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    fDisassemblyEditorManager = new DisassemblyEditorManager();
    CDebugCorePlugin.getDefault().addCBreakpointListener(CBreakpointUpdater.getInstance());
    
    Platform.getAdapterManager().registerAdapters(new DisassemblyBackendCdiFactory(), ICDebugElement.class);
    
    WorkbenchJob wjob = new WorkbenchJob("Initializing CDT Debug UI")
    {
      public IStatus runInUIThread(IProgressMonitor monitor)
      {
        CDebugUIPlugin.this.startupInUIThread();
        return Status.OK_STATUS;
      }
    };
    wjob.schedule();
  }
  
  private void startupInUIThread()
  {
    EvaluationContextManager.startup();
    ViewIDCounterManager.getInstance().init();
    
    IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
    IWorkbenchWindow[] arrayOfIWorkbenchWindow1;
    int j = (arrayOfIWorkbenchWindow1 = windows).length;
    for (int i = 0; i < j; i++)
    {
      IWorkbenchWindow window = arrayOfIWorkbenchWindow1[i];
      IWorkbenchPage[] pages = window.getPages();
      IWorkbenchPage[] arrayOfIWorkbenchPage1;
      int m = (arrayOfIWorkbenchPage1 = pages).length;
      for (int k = 0; k < m; k++)
      {
        IWorkbenchPage page = arrayOfIWorkbenchPage1[k];
        IViewReference viewRef = page.findViewReference("org.eclipse.debug.ui.VariableView");
        if (viewRef != null)
        {
          IViewPart part = viewRef.getView(false);
          if ((part instanceof IDebugView))
          {
            Viewer viewer = ((IDebugView)part).getViewer();
            if (viewer != null) {
              viewer.setSelection(viewer.getSelection());
            }
          }
        }
      }
    }
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    CDebugCorePlugin.getDefault().removeCBreakpointListener(CBreakpointUpdater.getInstance());
    CRegisterManagerProxies.getInstance().dispose();
    fDisassemblyEditorManager.dispose();
    if (fImageDescriptorRegistry != null) {
      fImageDescriptorRegistry.dispose();
    }
    super.stop(context);
  }
  
  public ISharedTextColors getSharedTextColors()
  {
    return EditorsUI.getSharedTextColors();
  }
  
  public DisassemblyEditorManager getDisassemblyEditorManager()
  {
    return fDisassemblyEditorManager;
  }
  
  public static ImageDescriptor getImageDescriptor(String path)
  {
    return imageDescriptorFromPlugin("org.eclipse.cdt.debug.ui", path);
  }
  
  public Image getImage(String key)
  {
    ImageRegistry registry = getImageRegistry();
    Image image = registry.get(key);
    if (image == null)
    {
      ImageDescriptor descriptor = imageDescriptorFromPlugin("org.eclipse.cdt.debug.ui", key);
      if (descriptor == null)
      {
        ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
        return sharedImages.getImage(key);
      }
      registry.put(key, descriptor);
      image = registry.get(key);
    }
    return image;
  }
  
  public Image getImage(String key, ImageDescriptor desc)
  {
    ImageRegistry registry = getImageRegistry();
    Image image = registry.get(key);
    if (image == null)
    {
      registry.put(key, desc);
      image = registry.get(key);
    }
    return image;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.debug.ui.CDebugUIPlugin
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.debug.ui.editors;

import java.util.EmptyStackException;
import java.util.Stack;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTComment;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTImageLocation;
import org.eclipse.cdt.core.dom.ast.IASTMacroExpansionLocation;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorElifStatement;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorElseStatement;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorEndifStatement;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIfStatement;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIfdefStatement;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIfndefStatement;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroExpansion;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.debug.internal.ui.CDebugUIMessages;
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.ui.CDTUITools;
import org.eclipse.cdt.ui.text.SharedASTJob;
import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextHoverExtension;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITypedRegion;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.TextUtilities;
import org.eclipse.ui.IEditorPart;

public abstract class AbstractDebugTextHover
  implements ICEditorTextHover, ITextHoverExtension
{
  private static final int MAX_HOVER_INFO_SIZE = 100;
  private IEditorPart fEditor;
  protected abstract boolean canEvaluate();
  
  protected abstract String evaluateExpression(String paramString);
  
  private static class ExpressionChecker
    extends ASTVisitor
  {
    private boolean fValid;
    
    private ExpressionChecker()
    {
      shouldVisitExpressions = true;
    }
    
    private boolean check(IASTNode node)
    {
      fValid = true;
      node.accept(this);
      return fValid;
    }
    
    public int visit(IASTExpression expression)
    {
      if ((expression instanceof IASTFunctionCallExpression))
      {
        fValid = false;
      }
      else if ((expression instanceof IASTUnaryExpression))
      {
        IASTUnaryExpression unaryExpression = (IASTUnaryExpression)expression;
        switch (unaryExpression.getOperator())
        {
        case 0: 
        case 1: 
        case 9: 
        case 10: 
          fValid = false;
        }
      }
      else if ((expression instanceof IASTBinaryExpression))
      {
        IASTBinaryExpression binaryExpression = (IASTBinaryExpression)expression;
        switch (binaryExpression.getOperator())
        {
        case 17: 
        case 18: 
        case 19: 
        case 20: 
        case 21: 
        case 22: 
        case 23: 
        case 24: 
        case 25: 
        case 26: 
        case 27: 
          fValid = false;
        }
      }
      else if ((expression instanceof ICPPASTNewExpression))
      {
        fValid = false;
      }
      else if ((expression instanceof ICPPASTDeleteExpression))
      {
        fValid = false;
      }
      else if ((expression instanceof IGNUASTCompoundStatementExpression))
      {
        fValid = false;
      }
      if (!fValid) {
        return 2;
      }
      return 3;
    }
  }
  
  public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion)
  {
    if (canEvaluate())
    {
      String expression = getExpressionText(textViewer, hoverRegion);
      if (expression != null)
      {
        String result = evaluateExpression(expression);
        if (result == null) {
          return null;
        }
        try
        {
          StringBuilder buffer = new StringBuilder();
          appendVariable(buffer, makeHTMLSafe(expression), makeHTMLSafe(result.trim()));
          if (buffer.length() > 0) {
            return buffer.toString();
          }
        }
        catch (DebugException x)
        {
          CDebugUIPlugin.log(x);
        }
      }
    }
    return null;
  }
  
  public IRegion getHoverRegion(ITextViewer viewer, int offset)
  {
    if (viewer != null) {
      return CDebugUIUtils.findWord(viewer.getDocument(), offset);
    }
    return null;
  }
  
  public final void setEditor(IEditorPart editor)
  {
    if (editor != null) {
      fEditor = editor;
    }
  }
  
  public IInformationControlCreator getHoverControlCreator()
  {
    return null;
  }
  
  protected String getExpressionText(ITextViewer textViewer, IRegion hoverRegion)
  {
    IDocument document = textViewer.getDocument();
    if (document == null) {
      return null;
    }
    String expression = getExpressionTextFromAST(document, hoverRegion);
    if (expression == null) {
      try
      {
        return document.get(hoverRegion.getOffset(), hoverRegion.getLength());
      }
      catch (BadLocationException localBadLocationException) {}
    } else if (expression.length() == 0) {
      return null;
    }
    return expression;
  }
  
  private String getExpressionTextFromAST(IDocument document, final IRegion hoverRegion)
  {
    ICElement cElement = CDTUITools.getEditorInputCElement(getEditor().getEditorInput());
    if (!(cElement instanceof ITranslationUnit)) {
      return null;
    }
    final Position expressionPosition = new Position(0);
    SharedASTJob job = new SharedASTJob(CDebugUIMessages.getString("AbstractDebugTextHover.jobName"), (ITranslationUnit)cElement)
    {
      public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast)
        throws CoreException
      {
        if (ast == null) {
          return Status.CANCEL_STATUS;
        }
        int offset = hoverRegion.getOffset();
        int length = hoverRegion.getLength();
        IASTName name = ast.getNodeSelector(null).findEnclosingName(offset, length);
        if (name != null)
        {
          IASTImageLocation imageLoc = name.getImageLocation();
          int kind = imageLoc.getLocationKind();
          switch (kind)
          {
          case 3: 
            computeMacroArgumentExtent(name, expressionPosition);
            break;
          default: 
            if ((name.getParent() instanceof IASTPreprocessorMacroExpansion))
            {
              IASTNode node = ast.getNodeSelector(null).findEnclosingNodeInExpansion(imageLoc.getNodeOffset(), imageLoc.getNodeLength());
              if ((node instanceof IASTExpression))
              {
                IASTFileLocation exprLoc = node.getFileLocation();
                if (exprLoc.getNodeOffset() == imageLoc.getNodeOffset()) {
                  computeExpressionExtent(node, expressionPosition);
                }
              }
            }
            else
            {
              computeExpressionExtent(name, expressionPosition);
            }
            break;
          }
        }
        else
        {
          IASTNode node = ast.getNodeSelector(null).findEnclosingNode(offset, length);
          if (!(node instanceof IASTExpression)) {
            node = ast.getNodeSelector(null).findFirstContainedNode(offset, length);
          }
          if ((node instanceof IASTExpression)) {
            computeExpressionExtent(node, expressionPosition);
          } else if ((node == null) && (insideInactiveCode(ast, offset)) && (!insideComment(ast, offset))) {
            return Status.CANCEL_STATUS;
          }
        }
        return Status.OK_STATUS;
      }
      
      private void computeMacroArgumentExtent(IASTName name, Position pos)
      {
        IASTImageLocation imageLoc = name.getImageLocation();
        int startOffset = imageLoc.getNodeOffset();
        int endOffset = startOffset + imageLoc.getNodeLength();
        
        IASTNode expr = name.getParent();
        int macroOffset = name.getFileLocation().getNodeOffset();
        if ((expr instanceof IASTFieldReference))
        {
          IASTExpression ownerExpr = ((IASTFieldReference)expr).getFieldOwner();
          while ((
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd