org.eclipse.cdt.debug.mi.ui_6.1.1.201202111925

16:41:43.998 INFO  jd.cli.Main - Decompiling org.eclipse.cdt.debug.mi.ui_6.1.1.201202111925.jar
package org.eclipse.cdt.debug.mi.ui.console;

import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.event.MIEvent;

public class VerboseModeChangedEvent
  extends MIEvent
{
  private static final long serialVersionUID = 1L;
  
  public VerboseModeChangedEvent(MISession session, int token)
  {
    super(session, token);
    setPropagate(false);
  }
}

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

import java.util.Observable;
import java.util.Observer;
import org.eclipse.cdt.debug.mi.core.GDBProcess;
import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.ui.console.actions.MiConsoleSaveAction;
import org.eclipse.cdt.debug.mi.ui.console.actions.MiConsoleVerboseModeAction;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.console.IConsolePageParticipant;
import org.eclipse.ui.part.IPageBookViewPage;
import org.eclipse.ui.part.IPageSite;

public class MiConsolePageParticipant
  implements IConsolePageParticipant, IDebugEventSetListener, Observer
{
  private MiConsoleSaveAction fSaveConsole = null;
  private MiConsoleVerboseModeAction fVerboseMode = null;
  private org.eclipse.debug.ui.console.IConsole fConsole = null;
  private GDBProcess GDBProcess = null;
  
  public void activated() {}
  
  public void deactivated() {}
  
  public void dispose()
  {
    if (GDBProcess != null) {
      DebugPlugin.getDefault().removeDebugEventListener(this);
    }
    fSaveConsole = null;
    fVerboseMode = null;
    GDBProcess = null;
    fConsole = null;
  }
  
  public void init(IPageBookViewPage page, org.eclipse.ui.console.IConsole console)
  {
    if ((console instanceof org.eclipse.debug.ui.console.IConsole))
    {
      fConsole = ((org.eclipse.debug.ui.console.IConsole)console);
      if ((fConsole.getProcess() instanceof GDBProcess))
      {
        GDBProcess = ((GDBProcess)fConsole.getProcess());
        
        IActionBars bars = page.getSite().getActionBars();
        bars.getToolBarManager().appendToGroup("outputGroup", new Separator());
        fSaveConsole = new MiConsoleSaveAction(fConsole);
        bars.getToolBarManager().appendToGroup("outputGroup", fSaveConsole);
        fVerboseMode = new MiConsoleVerboseModeAction(fConsole);
        bars.getToolBarManager().appendToGroup("outputGroup", fVerboseMode);
        bars.getToolBarManager().appendToGroup("outputGroup", new Separator());
        
        DebugPlugin.getDefault().addDebugEventListener(this);
        
        fVerboseMode.updateStateAndEnablement();
        Target target = GDBProcess.getTarget();
        if (target != null) {
          target.getMISession().addObserver(this);
        }
      }
    }
  }
  
  public Object getAdapter(Class adapter)
  {
    return null;
  }
  
  public void handleDebugEvents(DebugEvent[] events)
  {
    for (int i = 0; i < events.length; i++)
    {
      DebugEvent event = events[i];
      if ((event.getSource().equals(GDBProcess)) && 
        (fVerboseMode != null))
      {
        fVerboseMode.updateStateAndEnablement();
        Target target = GDBProcess.getTarget();
        if (target != null) {
          target.getMISession().addObserver(this);
        }
      }
    }
  }
  
  public void update(Observable arg0, Object arg1)
  {
    if ((arg1 != null) && ((arg1 instanceof VerboseModeChangedEvent)) && (fVerboseMode != null)) {
      try
      {
        fVerboseMode.updateStateAndEnablement();
      }
      catch (Exception localException) {}
    }
  }
}

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

import org.eclipse.cdt.debug.mi.core.GDBProcess;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
import org.eclipse.debug.ui.console.IConsole;
import org.eclipse.jface.action.Action;

public class MiConsoleVerboseModeAction
  extends Action
{
  private IConsole fConsole;
  
  public MiConsoleVerboseModeAction(IConsole console)
  {
    setToolTipText(MiConsoleMessages.verboseActionTooltip);
    setImageDescriptor(MIUIPlugin.imageDescriptorFromPlugin("org.eclipse.cdt.debug.mi.ui", "icons/obj16/verbose_mode_co.gif"));
    fConsole = console;
  }
  
  public void updateStateAndEnablement()
  {
    GDBProcess gdbProcess = (GDBProcess)fConsole.getProcess();
    setEnabled(!gdbProcess.isTerminated());
    Target target = gdbProcess.getTarget();
    if (target != null) {
      setChecked(target.isVerboseModeEnabled());
    } else {
      setChecked(false);
    }
  }
  
  public void run()
  {
    GDBProcess fProcess = (GDBProcess)fConsole.getProcess();
    fProcess.getTarget().enableVerboseMode(isChecked());
  }
}

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

class MiConsoleSaveAction$1
  implements Runnable
{
  MiConsoleSaveAction$1(MiConsoleSaveAction paramMiConsoleSaveAction) {}
  
  public void run()
  {
    this$0.saveContent();
  }
}

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

public abstract interface IMiConsoleImagesConst
{
  public static final String IMG_SAVE_CONSOLE = "icons/obj16/save_console.gif";
  public static final String IMG_VERBOSE_CONSOLE = "icons/obj16/verbose_mode_co.gif";
}

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

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
import org.eclipse.debug.ui.console.IConsole;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;

public class MiConsoleSaveAction
  extends Action
{
  private IConsole fConsole;
  private String fileName;
  
  public MiConsoleSaveAction(IConsole console)
  {
    setToolTipText(MiConsoleMessages.saveActionTooltip);
    setImageDescriptor(MIUIPlugin.imageDescriptorFromPlugin("org.eclipse.cdt.debug.mi.ui", "icons/obj16/save_console.gif"));
    fConsole = console;
  }
  
  public void run()
  {
    FileDialog fileDialog = new FileDialog(Display.getCurrent().getActiveShell(), 8192);
    fileName = fileDialog.open();
    if (fileName == null) {
      return;
    }
    Runnable saveJob = new Runnable()
    {
      public void run()
      {
        saveContent();
      }
    };
    BusyIndicator.showWhile(Display.getCurrent(), saveJob);
  }
  
  protected void saveContent()
  {
    boolean confirmed = true;
    try
    {
      File f = new File(fileName);
      if (f.exists()) {
        confirmed = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Confirm overwrite", MiConsoleMessages.confirmOverWrite);
      }
      if (confirmed)
      {
        BufferedWriter out = new BufferedWriter(new FileWriter(fileName));
        out.write(fConsole.getDocument().get());
        out.close();
      }
    }
    catch (IOException localIOException)
    {
      MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", MiConsoleMessages.infoIOError);
    }
  }
}

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

import org.eclipse.osgi.util.NLS;

public class MiConsoleMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.ui.console.actions.MiConsoleMessages";
  public static String saveActionTooltip;
  public static String verboseActionTooltip;
  public static String confirmOverWrite;
  public static String infoIOError;
  
  static
  {
    NLS.initializeMessages("org.eclipse.cdt.debug.mi.ui.console.actions.MiConsoleMessages", MiConsoleMessages.class);
  }
}

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

import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

public abstract interface IMILaunchConfigurationComponent
{
  public abstract void createControl(Composite paramComposite);
  
  public abstract Control getControl();
  
  public abstract void setDefaults(ILaunchConfigurationWorkingCopy paramILaunchConfigurationWorkingCopy);
  
  public abstract void initializeFrom(ILaunchConfiguration paramILaunchConfiguration);
  
  public abstract void dispose();
  
  public abstract void performApply(ILaunchConfigurationWorkingCopy paramILaunchConfigurationWorkingCopy);
  
  public abstract boolean isValid(ILaunchConfiguration paramILaunchConfiguration);
}

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

import org.eclipse.cdt.debug.mi.internal.ui.GDBSolibBlock;
import org.eclipse.cdt.debug.mi.internal.ui.SolibSearchPathBlock;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.IListAdapter;

public class MIUIUtils
{
  public static IMILaunchConfigurationComponent createGDBSolibBlock(IMILaunchConfigurationComponent solibSearchBlock, boolean autoSolib, boolean stopOnSolibEvents)
  {
    return new GDBSolibBlock(solibSearchBlock, autoSolib, stopOnSolibEvents);
  }
  
  public static IMILaunchConfigurationComponent createGDBSolibBlock(boolean autoSolib, boolean stopOnSolibEvents)
  {
    return new GDBSolibBlock(new SolibSearchPathBlock(), autoSolib, stopOnSolibEvents);
  }
  
  public static IMILaunchConfigurationComponent createSolibSearchPathBlock(String[] customButtonLabels, IListAdapter listAdapter)
  {
    return new SolibSearchPathBlock(customButtonLabels, listAdapter);
  }
}

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

import java.util.HashSet;
import java.util.Set;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

class SolibSearchPathBlock$3
  implements ITreeContentProvider
{
  SolibSearchPathBlock$3(SolibSearchPathBlock paramSolibSearchPathBlock, HashSet paramHashSet) {}
  
  public Object[] getChildren(Object parentElement)
  {
    return getElements(parentElement);
  }
  
  public Object getParent(Object element)
  {
    if (val$libs.contains(element)) {
      return val$libs;
    }
    return null;
  }
  
  public boolean hasChildren(Object element)
  {
    return false;
  }
  
  public Object[] getElements(Object inputElement)
  {
    if ((inputElement instanceof Set)) {
      return ((Set)inputElement).toArray();
    }
    return new Object[0];
  }
  
  public void dispose() {}
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
}

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

import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.ui.plugin.AbstractUIPlugin;

public class MIUIPlugin
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.eclipse.cdt.debug.mi.ui";
  private static MIUIPlugin plugin;
  
  public MIUIPlugin()
  {
    plugin = this;
  }
  
  public static MIUIPlugin getDefault()
  {
    return plugin;
  }
  
  public static IWorkspace getWorkspace()
  {
    return ResourcesPlugin.getWorkspace();
  }
  
  public static String getUniqueIdentifier()
  {
    return "org.eclipse.cdt.debug.mi.ui";
  }
}

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

import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.dialogs.PropertyPage;

public class OptionsPropertyPage
  extends PropertyPage
{
  private Button fRefreshSolibsButton;
  
  public OptionsPropertyPage()
  {
    noDefaultAndApplyButton();
  }
  
  protected Control createContents(Composite parent)
  {
    Composite comp = ControlFactory.createComposite(parent, 1);
    fRefreshSolibsButton = createCheckButton(comp, PropertyMessages.getString("OptionsPropertyPage.1"));
    initialize();
    return comp;
  }
  
  private Button createCheckButton(Composite parent, String label)
  {
    Button button = new Button(parent, 16416);
    button.setText(label);
    
    GridData data = new GridData();
    button.setLayoutData(data);
    return button;
  }
  
  private void initialize()
  {
    boolean solibUpdate = true;
    ICDISession session = (ICDISession)getElement().getAdapter(ICDISession.class);
    if ((session instanceof Session)) {
      solibUpdate = ((Session)session).getSharedLibraryManager().isAutoUpdate();
    }
    fRefreshSolibsButton.setSelection(solibUpdate);
  }
  
  protected void performApply()
  {
    storeValues();
    super.performApply();
  }
  
  public boolean performOk()
  {
    storeValues();
    return super.performOk();
  }
  
  private void storeValues()
  {
    ICDISession session = (ICDISession)getElement().getAdapter(ICDISession.class);
    final ICDITarget target = (ICDITarget)getElement().getAdapter(ICDITarget.class);
    if ((session instanceof Session))
    {
      final boolean solibUpdate = fRefreshSolibsButton.getSelection();
      final Session miSession = (Session)session;
      miSession.getSharedLibraryManager().setAutoUpdate(solibUpdate);
      if ((target.isSuspended()) && (solibUpdate)) {
        DebugPlugin.getDefault().asyncExec(new Runnable()
        {
          public void run()
          {
            if ((target.isSuspended()) && 
              (solibUpdate)) {
              try
              {
                miSession.getSharedLibraryManager().update();
              }
              catch (CDIException localCDIException) {}
            }
          }
        });
      }
    }
  }
}

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

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class PropertyMessages
{
  private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.internal.ui.propertypages.PropertyMessages";
  private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("org.eclipse.cdt.debug.mi.internal.ui.propertypages.PropertyMessages");
  
  public static String getString(String key)
  {
    try
    {
      return RESOURCE_BUNDLE.getString(key);
    }
    catch (MissingResourceException localMissingResourceException) {}
    return '!' + key + '!';
  }
}

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

import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager;

class OptionsPropertyPage$1
  implements Runnable
{
  OptionsPropertyPage$1(OptionsPropertyPage paramOptionsPropertyPage, ICDITarget paramICDITarget, boolean paramBoolean, Session paramSession) {}
  
  public void run()
  {
    if ((val$target.isSuspended()) && 
      (val$solibUpdate)) {
      try
      {
        val$miSession.getSharedLibraryManager().update();
      }
      catch (CDIException localCDIException) {}
    }
  }
}

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

import java.io.File;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Text;

class StandardGDBDebuggerPage$3
  extends SelectionAdapter
{
  StandardGDBDebuggerPage$3(StandardGDBDebuggerPage paramStandardGDBDebuggerPage) {}
  
  public void widgetSelected(SelectionEvent evt)
  {
    handleGDBButtonSelected();
    this$0.updateLaunchConfigurationDialog();
  }
  
  private void handleGDBButtonSelected()
  {
    FileDialog dialog = new FileDialog(this$0.getShell(), 0);
    dialog.setText(MIUIMessages.getString("StandardGDBDebuggerPage.5"));
    String gdbCommand = this$0.fGDBCommandText.getText().trim();
    int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
    if (lastSeparatorIndex != -1) {
      dialog.setFilterPath(gdbCommand.substring(0, lastSeparatorIndex));
    }
    String res = dialog.open();
    if (res == null) {
      return;
    }
    this$0.fGDBCommandText.setText(res);
  }
}

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

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;

class GDBDebuggerPage$3
  implements ModifyListener
{
  GDBDebuggerPage$3(GDBDebuggerPage paramGDBDebuggerPage) {}
  
  public void modifyText(ModifyEvent evt)
  {
    if (!this$0.isInitializing()) {
      this$0.updateLaunchConfigurationDialog();
    }
  }
}

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

import java.io.File;
import java.util.Observable;
import java.util.Observer;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.core.MIPlugin;
import org.eclipse.cdt.debug.mi.ui.IMILaunchConfigurationComponent;
import org.eclipse.cdt.debug.mi.ui.MIUIUtils;
import org.eclipse.cdt.debug.ui.AbstractCDebuggerPage;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;

public class GDBDebuggerPage
  extends AbstractCDebuggerPage
  implements Observer
{
  private static final String DEFAULT_MI_PROTOCOL = MIUIMessages.getString("GDBDebuggerPage.12");
  protected final String[] protocolItems = { DEFAULT_MI_PROTOCOL, "mi1", "mi2", "mi3" };
  protected TabFolder fTabFolder;
  protected Text fGDBCommandText;
  protected Text fGDBInitText;
  protected Combo fProtocolCombo;
  private IMILaunchConfigurationComponent fSolibBlock;
  private boolean fIsInitializing = false;
  private Button fBreakpointsFullPath;
  
  public void createControl(Composite parent)
  {
    Composite comp = new Composite(parent, 0);
    comp.setLayout(new GridLayout());
    comp.setLayoutData(new GridData(1808));
    fTabFolder = new TabFolder(comp, 0);
    fTabFolder.setLayoutData(new GridData(1808));
    createTabs(fTabFolder);
    fTabFolder.setSelection(0);
    setControl(parent);
  }
  
  public void setDefaults(ILaunchConfigurationWorkingCopy configuration)
  {
    configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
    configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
    configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi");
    if (fSolibBlock != null) {
      fSolibBlock.setDefaults(configuration);
    }
  }
  
  public boolean isValid(ILaunchConfiguration launchConfig)
  {
    boolean valid = fGDBCommandText.getText().length() != 0;
    if (valid)
    {
      setErrorMessage(null);
      setMessage(null);
    }
    else
    {
      setErrorMessage(MIUIMessages.getString("GDBDebuggerPage.0"));
      setMessage(null);
    }
    return valid;
  }
  
  public void initializeFrom(ILaunchConfiguration configuration)
  {
    setInitializing(true);
    String gdbCommand = "gdb";
    String gdbInit = ".gdbinit";
    try
    {
      gdbCommand = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
    }
    catch (CoreException localCoreException1) {}
    try
    {
      gdbInit = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
    }
    catch (CoreException localCoreException2) {}
    String miVersion = MIPlugin.getMIVersion(configuration);
    if (miVersion.compareTo("mi") == 0) {
      miVersion = DEFAULT_MI_PROTOCOL;
    }
    if (fSolibBlock != null) {
      fSolibBlock.initializeFrom(configuration);
    }
    fGDBCommandText.setText(gdbCommand);
    fGDBInitText.setText(gdbInit);
    int index = 0;
    if (miVersion.length() > 0) {
      for (int i = 0; i < protocolItems.length; i++) {
        if (protocolItems[i].equals(miVersion))
        {
          index = i;
          break;
        }
      }
    }
    fProtocolCombo.select(index);
    
    boolean useFullPath = false;
    try
    {
      useFullPath = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_FULLPATH_BREAKPOINTS, useFullPath);
    }
    catch (CoreException localCoreException3) {}
    fBreakpointsFullPath.setSelection(useFullPath);
    
    setInitializing(false);
  }
  
  public void performApply(ILaunchConfigurationWorkingCopy configuration)
  {
    String str = fGDBCommandText.getText();
    str.trim();
    configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, str);
    str = fGDBInitText.getText();
    str.trim();
    configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, str);
    str = fProtocolCombo.getText();
    if (str.compareTo(DEFAULT_MI_PROTOCOL) == 0) {
      str = "mi";
    }
    configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, str);
    configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_FULLPATH_BREAKPOINTS, fBreakpointsFullPath.getSelection());
    if (fSolibBlock != null) {
      fSolibBlock.performApply(configuration);
    }
  }
  
  public String getName()
  {
    return MIUIMessages.getString("GDBDebuggerPage.1");
  }
  
  protected Shell getShell()
  {
    return super.getShell();
  }
  
  protected void updateLaunchConfigurationDialog()
  {
    super.updateLaunchConfigurationDialog();
  }
  
  public void update(Observable o, Object arg)
  {
    if (!isInitializing()) {
      updateLaunchConfigurationDialog();
    }
  }
  
  public IMILaunchConfigurationComponent createSolibBlock(Composite parent)
  {
    IMILaunchConfigurationComponent block = MIUIUtils.createGDBSolibBlock(true, true);
    block.createControl(parent);
    return block;
  }
  
  public void createTabs(TabFolder tabFolder)
  {
    createMainTab(tabFolder);
    createSolibTab(tabFolder);
  }
  
  public void createMainTab(TabFolder tabFolder)
  {
    TabItem tabItem = new TabItem(tabFolder, 0);
    tabItem.setText(MIUIMessages.getString("GDBDebuggerPage.2"));
    Composite comp = ControlFactory.createCompositeEx(tabFolder, 1, 1808);
    getLayoutmakeColumnsEqualWidth = false;
    comp.setFont(tabFolder.getFont());
    tabItem.setControl(comp);
    Composite subComp = ControlFactory.createCompositeEx(comp, 3, 768);
    getLayoutmakeColumnsEqualWidth = false;
    subComp.setFont(tabFolder.getFont());
    Label label = ControlFactory.createLabel(subComp, MIUIMessages.getString("GDBDebuggerPage.3"));
    GridData gd = new GridData();
    
    label.setLayoutData(gd);
    fGDBCommandText = ControlFactory.createTextField(subComp, 2052);
    fGDBCommandText.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent evt)
      {
        if (!isInitializing()) {
          updateLaunchConfigurationDialog();
        }
      }
    });
    Button button = createPushButton(subComp, MIUIMessages.getString("GDBDebuggerPage.4"), null);
    button.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent evt)
      {
        handleGDBButtonSelected();
        updateLaunchConfigurationDialog();
      }
      
      private void handleGDBButtonSelected()
      {
        FileDialog dialog = new FileDialog(getShell(), 0);
        dialog.setText(MIUIMessages.getString("GDBDebuggerPage.5"));
        String gdbCommand = fGDBCommandText.getText().trim();
        int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
        if (lastSeparatorIndex != -1) {
          dialog.setFilterPath(gdbCommand.substring(0, lastSeparatorIndex));
        }
        String res = dialog.open();
        if (res == null) {
          return;
        }
        fGDBCommandText.setText(res);
      }
    });
    label = ControlFactory.createLabel(subComp, MIUIMessages.getString("GDBDebuggerPage.6"));
    gd = new GridData();
    
    label.setLayoutData(gd);
    fGDBInitText = ControlFactory.createTextField(subComp, 2052);
    gd = new GridData(768);
    fGDBInitText.setLayoutData(gd);
    fGDBInitText.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent evt)
      {
        if (!isInitializing()) {
          updateLaunchConfigurationDialog();
        }
      }
    });
    button = createPushButton(subComp, MIUIMessages.getString("GDBDebuggerPage.7"), null);
    button.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent evt)
      {
        handleGDBInitButtonSelected();
        updateLaunchConfigurationDialog();
      }
      
      private void handleGDBInitButtonSelected()
      {
        FileDialog dialog = new FileDialog(getShell(), 0);
        dialog.setText(MIUIMessages.getString("GDBDebuggerPage.8"));
        String gdbCommand = fGDBInitText.getText().trim();
        int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
        if (lastSeparatorIndex != -1) {
          dialog.setFilterPath(gdbCommand.substring(0, lastSeparatorIndex));
        }
        String res = dialog.open();
        if (res == null) {
          return;
        }
        fGDBInitText.setText(res);
      }
    });
    label = ControlFactory.createLabel(subComp, MIUIMessages.getString("GDBDebuggerPage.9"), 
      200, -1, 64);
    gd = new GridData(768);
    horizontalSpan = 3;
    widthHint = 200;
    label.setLayoutData(gd);
    
    createProtocolCombo(subComp);
    
    createBreakpointFullPathName(subComp);
    GridData gd2 = new GridData();
    horizontalSpan = 3;
    fBreakpointsFullPath.setLayoutData(gd2);
  }
  
  public void createSolibTab(TabFolder tabFolder)
  {
    TabItem tabItem = new TabItem(tabFolder, 0);
    tabItem.setText(MIUIMessages.getString("GDBDebuggerPage.10"));
    Composite comp = ControlFactory.createCompositeEx(fTabFolder, 1, 1808);
    comp.setFont(tabFolder.getFont());
    tabItem.setControl(comp);
    fSolibBlock = createSolibBlock(comp);
    if ((fSolibBlock instanceof Observable)) {
      ((Observable)fSolibBlock).addObserver(this);
    }
  }
  
  public void dispose()
  {
    if (fSolibBlock != null)
    {
      if ((fSolibBlock instanceof Observable)) {
        ((Observable)fSolibBlock).deleteObserver(this);
      }
      fSolibBlock.dispose();
    }
    super.dispose();
  }
  
  public void activated(ILaunchConfigurationWorkingCopy workingCopy) {}
  
  protected boolean isInitializing()
  {
    return fIsInitializing;
  }
  
  private void setInitializing(boolean isInitializing)
  {
    fIsInitializing = isInitializing;
  }
  
  protected void createProtocolCombo(Composite parent)
  {
    Label label = new Label(parent, 0);
    label.setText(MIUIMessages.getString("GDBDebuggerPage.11"));
    fProtocolCombo = new Combo(parent, 12);
    fProtocolCombo.setItems(protocolItems);
    fProtocolCombo.addSelectionListener(new SelectionListener()
    {
      public void widgetDefaultSelected(SelectionEvent e)
      {
        if (!isInitializing()) {
          updateLaunchConfigurationDialog();
        }
      }
      
      public void widgetSelected(SelectionEvent e)
      {
        if (!isInitializing()) {
          updateLaunchConfigurationDialog();
        }
      }
    });
  }
  
  protected void createBreakpointFullPathName(Composite parent)
  {
    fBreakpointsFullPath = createCheckButton(parent, MIUIMessages.getString("StandardGDBDebuggerPage.14"));
    fBreakpointsFullPath.addSelectionListener(new SelectionListener()
    {
      public void widgetDefaultSelected(SelectionEvent e)
      {
        if (!isInitializing()) {
          updateLaunchConfigurationDialog();
        }
      }
      
      public void widgetSelected(SelectionEvent e)
      {
        if (!isInitializing()) {
          updateLaunchConfigurationDialog();
        }
      }
    });
  }
}

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

public abstract interface IMIUIConstants
{
  public static final String PLUGIN_ID = ;
}

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

import java.io.File;
import org.eclipse.jface.viewers.LabelProvider;

class SolibSearchPathBlock$4
  extends LabelProvider
{
  SolibSearchPathBlock$4(SolibSearchPathBlock paramSolibSearchPathBlock) {}
  
  public String getText(Object element)
  {
    if ((element instanceof File)) {
      return ((File)element).getName();
    }
    return super.getText(element);
  }
}

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

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;

class SolibSearchPathBlock$AddDirectoryDialog$1
  implements ModifyListener
{
  SolibSearchPathBlock$AddDirectoryDialog$1(SolibSearchPathBlock.AddDirectoryDialog paramAddDirectoryDialog) {}
  
  public void modifyText(ModifyEvent e)
  {
    this$1.updateOKButton();
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class GDBSolibBlock$1
  extends SelectionAdapter
{
  GDBSolibBlock$1(GDBSolibBlock paramGDBSolibBlock) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.updateButtons();
    this$0.changed();
  }
}

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

import java.util.Observable;
import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.ComboDialogField;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.DialogField;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.IDialogFieldListener;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.LayoutUtil;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.StringDialogField;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.layout.PixelConverter;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

public class SerialPortSettingsBlock
  extends Observable
{
  private static final String DEFAULT_ASYNC_DEVICE = "/dev/ttyS0";
  private static final String DEFAULT_ASYNC_DEVICE_SPEED = "115200";
  private Shell fShell;
  private StringDialogField fDeviceField;
  private ComboDialogField fSpeedField;
  private String[] fSpeedChoices = { "9600", "19200", "38400", "57600", "115200" };
  private Control fControl;
  private String fErrorMessage = null;
  
  public SerialPortSettingsBlock()
  {
    fDeviceField = createDeviceField();
    fSpeedField = createSpeedField();
  }
  
  public void createBlock(Composite parent)
  {
    fShell = parent.getShell();
    Composite comp = ControlFactory.createCompositeEx(parent, 2, 1808);
    getLayoutmakeColumnsEqualWidth = false;
    getLayoutmarginHeight = 0;
    getLayoutmarginWidth = 0;
    comp.setFont(parent.getFont());
    PixelConverter converter = new PixelConverter(comp);
    fDeviceField.doFillIntoGrid(comp, 2);
    LayoutUtil.setWidthHint(fDeviceField.getTextControl(null), converter.convertWidthInCharsToPixels(20));
    fSpeedField.doFillIntoGrid(comp, 2);
    fSpeedField.getComboControl(null).getLayoutData()).horizontalAlignment = 1;
    setControl(comp);
  }
  
  protected Shell getShell()
  {
    return fShell;
  }
  
  public void dispose()
  {
    deleteObservers();
  }
  
  public void initializeFrom(ILaunchConfiguration configuration)
  {
    initializeDevice(configuration);
    initializeSpeed(configuration);
  }
  
  public void setDefaults(ILaunchConfigurationWorkingCopy configuration)
  {
    configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV, "/dev/ttyS0");
    configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, "115200");
  }
  
  public void performApply(ILaunchConfigurationWorkingCopy configuration)
  {
    if (fDeviceField != null) {
      configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV, fDeviceField.getText().trim());
    }
    if (fSpeedField != null)
    {
      int index = fSpeedField.getSelectionIndex();
      configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, getSpeedItem(index));
    }
  }
  
  private StringDialogField createDeviceField()
  {
    StringDialogField field = new StringDialogField();
    field.setLabelText(MIUIMessages.getString("SerialPortSettingsBlock.0"));
    field.setDialogFieldListener(new IDialogFieldListener()
    {
      public void dialogFieldChanged(DialogField f)
      {
        deviceFieldChanged();
      }
    });
    return field;
  }
  
  private ComboDialogField createSpeedField()
  {
    ComboDialogField field = new ComboDialogField(12);
    field.setLabelText(MIUIMessages.getString("SerialPortSettingsBlock.1"));
    field.setItems(fSpeedChoices);
    field.setDialogFieldListener(new IDialogFieldListener()
    {
      public void dialogFieldChanged(DialogField f)
      {
        speedFieldChanged();
      }
    });
    return field;
  }
  
  protected void deviceFieldChanged()
  {
    updateErrorMessage();
    setChanged();
    notifyObservers();
  }
  
  protected void speedFieldChanged()
  {
    updateErrorMessage();
    setChanged();
    notifyObservers();
  }
  
  private void initializeDevice(ILaunchConfiguration configuration)
  {
    if (fDeviceField != null) {
      try
      {
        fDeviceField.setText(configuration.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV, "/dev/ttyS0"));
      }
      catch (CoreException localCoreException) {}
    }
  }
  
  private void initializeSpeed(ILaunchConfiguration configuration)
  {
    if (fSpeedField != null)
    {
      int index = 0;
      try
      {
        index = getSpeedItemIndex(configuration.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, "115200"));
      }
      catch (CoreException localCoreException) {}
      fSpeedField.selectItem(index);
    }
  }
  
  private String getSpeedItem(int index)
  {
    return (index >= 0) && (index < fSpeedChoices.length) ? fSpeedChoices[index] : null;
  }
  
  private int getSpeedItemIndex(String item)
  {
    for (int i = 0; i < fSpeedChoices.length; i++) {
      if (fSpeedChoices[i].equals(item)) {
        return i;
      }
    }
    return 0;
  }
  
  public Control getControl()
  {
    return fControl;
  }
  
  protected void setControl(Control control)
  {
    fControl = control;
  }
  
  public boolean isValid(ILaunchConfiguration configuration)
  {
    updateErrorMessage();
    return getErrorMessage() == null;
  }
  
  private void updateErrorMessage()
  {
    setErrorMessage(null);
    if ((fDeviceField != null) && (fSpeedField != null)) {
      if (fDeviceField.getText().trim().length() == 0) {
        setErrorMessage(MIUIMessages.getString("SerialPortSettingsBlock.2"));
      } else if (!deviceIsValid(fDeviceField.getText().trim())) {
        setErrorMessage(MIUIMessages.getString("SerialPortSettingsBlock.3"));
      } else if (fSpeedField.getSelectionIndex() < 0) {
        setErrorMessage(MIUIMessages.getString("SerialPortSettingsBlock.4"));
      }
    }
  }
  
  public String getErrorMessage()
  {
    return fErrorMessage;
  }
  
  private void setErrorMessage(String string)
  {
    fErrorMessage = string;
  }
  
  private boolean deviceIsValid(String hostName)
  {
    return true;
  }
}

/* Location
1 2 3 4 5 6

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