Search in sources :

Example 1 with IDebugModelPresentation

use of org.eclipse.debug.ui.IDebugModelPresentation in project generator by mybatis.

the class GeneratorLaunchShortcut method chooseConfiguration.

private ILaunchConfiguration chooseConfiguration(List<ILaunchConfiguration> candidates) {
    IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
    dialog.setElements(candidates.toArray());
    dialog.setTitle(Messages.LAUNCH_CONFIGURATION_SELECTOR_TITLE);
    dialog.setMessage(Messages.LAUNCH_CONFIGURATION_SELECTOR_MESSAGE);
    dialog.setMultipleSelection(false);
    int result = dialog.open();
    labelProvider.dispose();
    if (result == Window.OK) {
        return (ILaunchConfiguration) dialog.getFirstResult();
    }
    return null;
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ElementListSelectionDialog(org.eclipse.ui.dialogs.ElementListSelectionDialog) IDebugModelPresentation(org.eclipse.debug.ui.IDebugModelPresentation)

Example 2 with IDebugModelPresentation

use of org.eclipse.debug.ui.IDebugModelPresentation in project ow by vtst.

the class EasyLaunchShortcut method chooseConfiguration.

/**
   * Returns a configuration from the given collection of configurations that should be launched,
   * or <code>null</code> to cancel. Default implementation opens a selection dialog that allows
   * the user to choose one of the specified launch configurations.  Returns the chosen configuration,
   * or <code>null</code> if the user cancels.
   * 
   * @param configs list of configurations to choose from
   * @return configuration to launch or <code>null</code> to cancel
   */
protected ILaunchConfiguration chooseConfiguration(List<ILaunchConfiguration> configs) {
    IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(MiscUi.getShell(), labelProvider);
    dialog.setElements(configs.toArray());
    dialog.setTitle(messages.getString("choose_configuration_title"));
    dialog.setMessage(messages.getString("choose_configuration_message"));
    dialog.setMultipleSelection(false);
    int result = dialog.open();
    labelProvider.dispose();
    if (result == Window.OK) {
        return (ILaunchConfiguration) dialog.getFirstResult();
    }
    return null;
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ElementListSelectionDialog(org.eclipse.ui.dialogs.ElementListSelectionDialog) IDebugModelPresentation(org.eclipse.debug.ui.IDebugModelPresentation)

Example 3 with IDebugModelPresentation

use of org.eclipse.debug.ui.IDebugModelPresentation in project ow by vtst.

the class EasyLaunchShortcut method chooseConfiguration.

/**
   * Returns a configuration from the given collection of configurations that should be launched,
   * or <code>null</code> to cancel. Default implementation opens a selection dialog that allows
   * the user to choose one of the specified launch configurations.  Returns the chosen configuration,
   * or <code>null</code> if the user cancels.
   * 
   * @param configs list of configurations to choose from
   * @return configuration to launch or <code>null</code> to cancel
   */
protected ILaunchConfiguration chooseConfiguration(List<ILaunchConfiguration> configs) {
    IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(Utils.getShell(), labelProvider);
    dialog.setElements(configs.toArray());
    dialog.setTitle(messages.getString("choose_configuration_title"));
    dialog.setMessage(messages.getString("choose_configuration_message"));
    dialog.setMultipleSelection(false);
    int result = dialog.open();
    labelProvider.dispose();
    if (result == Window.OK) {
        return (ILaunchConfiguration) dialog.getFirstResult();
    }
    return null;
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ElementListSelectionDialog(org.eclipse.ui.dialogs.ElementListSelectionDialog) IDebugModelPresentation(org.eclipse.debug.ui.IDebugModelPresentation)

Example 4 with IDebugModelPresentation

use of org.eclipse.debug.ui.IDebugModelPresentation in project tdi-studio-se by Talend.

the class OpenDeclarationAction method run.

/*
     * @see Action#run()
     */
@Override
public void run() {
    if (className == null) {
        return;
    }
    // search source
    IType source = null;
    try {
        source = searchSource();
    } catch (InterruptedException e) {
        return;
    }
    if (source == null) {
        MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.errorLabel, Messages.openDeclarationFailedMsg);
        return;
    }
    // get editor input
    IDebugModelPresentation presentation = DebugUITools.newDebugModelPresentation(JDIDebugModel.getPluginIdentifier());
    if (presentation == null) {
        return;
    }
    IEditorInput editorInput = presentation.getEditorInput(source);
    if (editorInput == null) {
        return;
    }
    // open editor
    IEditorPart editorPart = null;
    try {
        editorPart = openEditor(editorInput, presentation, source);
    } catch (PartInitException e) {
        Activator.log(IStatus.ERROR, Messages.openEditorFailedMsg, e);
    }
    presentation.dispose();
    if (editorPart == null) {
        return;
    }
    // highlight method
    try {
        highlightMethod(editorInput, editorPart);
    } catch (CoreException e) {
        Activator.log(IStatus.ERROR, Messages.highlightMethodFailedMsg, e);
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) IDebugModelPresentation(org.eclipse.debug.ui.IDebugModelPresentation) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) IEditorInput(org.eclipse.ui.IEditorInput) IType(org.eclipse.jdt.core.IType)

Aggregations

IDebugModelPresentation (org.eclipse.debug.ui.IDebugModelPresentation)4 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)3 ElementListSelectionDialog (org.eclipse.ui.dialogs.ElementListSelectionDialog)3 CoreException (org.eclipse.core.runtime.CoreException)1 IType (org.eclipse.jdt.core.IType)1 IEditorInput (org.eclipse.ui.IEditorInput)1 IEditorPart (org.eclipse.ui.IEditorPart)1 PartInitException (org.eclipse.ui.PartInitException)1