Search in sources :

Example 1 with ElementListSelectionDialog

use of org.eclipse.ui.dialogs.ElementListSelectionDialog 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 ElementListSelectionDialog

use of org.eclipse.ui.dialogs.ElementListSelectionDialog in project tdi-studio-se by Talend.

the class BusinessModelingAssistantProvider method selectElement.

/**
     * @generated NOT
     */
protected EObject selectElement(EObject[] elements) {
    Shell shell = Display.getCurrent().getActiveShell();
    ILabelProvider labelProvider = new AdapterFactoryLabelProvider(BusinessDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);
    //$NON-NLS-1$
    dialog.setMessage(Messages.getString("BusinessModelingAssistantProvider.AvaiableDomainModelElements"));
    //$NON-NLS-1$
    dialog.setTitle(Messages.getString("BusinessModelingAssistantProvider.SelectDomainModelElement"));
    dialog.setMultipleSelection(false);
    dialog.setElements(elements);
    EObject selected = null;
    if (dialog.open() == Window.OK) {
        selected = (EObject) dialog.getFirstResult();
    }
    return selected;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ElementListSelectionDialog(org.eclipse.ui.dialogs.ElementListSelectionDialog) EObject(org.eclipse.emf.ecore.EObject) AdapterFactoryLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider) ILabelProvider(org.eclipse.jface.viewers.ILabelProvider)

Example 3 with ElementListSelectionDialog

use of org.eclipse.ui.dialogs.ElementListSelectionDialog in project tesb-studio-se by Talend.

the class InitFinishMessageDialog method createMessageArea.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.dialogs.IconAndMessageDialog#createMessageArea(org.eclipse.swt.widgets.Composite)
     */
@Override
protected Control createMessageArea(Composite composite) {
    // create image
    Image image = getImage();
    if (image != null) {
        imageLabel = new Label(composite, SWT.NULL);
        image.setBackground(imageLabel.getBackground());
        imageLabel.setImage(image);
        GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel);
    }
    Link link = new Link(composite, SWT.WRAP);
    link.setText("Local runtime serview has been started, totally installed bundles: <a href=\"#\">" + bundlesName.length + "</a>.");
    link.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ElementListSelectionDialog report = new ElementListSelectionDialog(getShell(), new LabelProvider());
            report.setTitle("Installed bundles:");
            report.setMessage("Search bundle (? = any character, * = any string):");
            report.setElements(bundlesName);
            report.open();
        }
    });
    return composite;
}
Also used : ElementListSelectionDialog(org.eclipse.ui.dialogs.ElementListSelectionDialog) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Image(org.eclipse.swt.graphics.Image) LabelProvider(org.eclipse.jface.viewers.LabelProvider) Link(org.eclipse.swt.widgets.Link)

Example 4 with ElementListSelectionDialog

use of org.eclipse.ui.dialogs.ElementListSelectionDialog 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 5 with ElementListSelectionDialog

use of org.eclipse.ui.dialogs.ElementListSelectionDialog 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)

Aggregations

ElementListSelectionDialog (org.eclipse.ui.dialogs.ElementListSelectionDialog)7 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)3 IDebugModelPresentation (org.eclipse.debug.ui.IDebugModelPresentation)3 IProject (org.eclipse.core.resources.IProject)1 EObject (org.eclipse.emf.ecore.EObject)1 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)1 IJavaElement (org.eclipse.jdt.core.IJavaElement)1 IPackageFragment (org.eclipse.jdt.core.IPackageFragment)1 IPackageFragmentRoot (org.eclipse.jdt.core.IPackageFragmentRoot)1 JavaModelException (org.eclipse.jdt.core.JavaModelException)1 JavaElementLabelProvider (org.eclipse.jdt.ui.JavaElementLabelProvider)1 ILabelProvider (org.eclipse.jface.viewers.ILabelProvider)1 LabelProvider (org.eclipse.jface.viewers.LabelProvider)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Image (org.eclipse.swt.graphics.Image)1 Label (org.eclipse.swt.widgets.Label)1 Link (org.eclipse.swt.widgets.Link)1 Shell (org.eclipse.swt.widgets.Shell)1 WorkbenchLabelProvider (org.eclipse.ui.model.WorkbenchLabelProvider)1