Examples of ElementListSelectionDialog


Examples of org.eclipse.ui.dialogs.ElementListSelectionDialog

        return "Cover";
    }

    private void createModuleGroup(final Composite comp) {

        final ElementListSelectionDialog projectDialog = new ElementListSelectionDialog(
                getShell(), new ProjectLabelProvider());

        final Object[] elements = createProjectArray();

        projectDialog.setElements(elements);
        projectDialog.setTitle("Select project");
        projectDialog.setMessage("Select Erlang project: ");

        moduleDialog = new ElementListSelectionDialog(getShell(),
                new ProjectLabelProvider());

        moduleDialog.setElements(new Object[0]);
        moduleDialog.setTitle("Select module");
        moduleDialog.setMessage("Select Erlang module: ");
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementListSelectionDialog

        return array;
    }

    private void createAllTestsGroup(final Composite comp) {

        final ElementListSelectionDialog projectDialog = new ElementListSelectionDialog(
                getShell(), new ProjectLabelProvider());

        final Object[] elements = createProjectArray();

        projectDialog.setElements(elements);
        projectDialog.setTitle("Select project");
        projectDialog.setMessage("Select Erlang project: ");

        fileBr = new ItemBrowser(comp, SWT.SINGLE | SWT.BORDER, projectDialog);
        fileBr.setFiledLength(600);
        fileBr.getTextGridData().horizontalSpan = 2;
        fileBr.addModifyListener(basicModifyListener);
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementListSelectionDialog

                .getImage(ISharedImages.IMG_OBJ_FOLDER));
        loadConfigButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                final ElementListSelectionDialog dialog = new SelectConfigurationDialog(
                        parent.getShell(), new LabelProvider());
                dialog.setElements(ConfigurationManager.getTPConfigs());
                dialog.open();
                final String result = (String) dialog.getFirstResult();
                if (result != null) {
                    patternsConfigName = result;
                    configNameLabel.setText(patternsConfigName);
                    TraceBackend.getInstance().loadTracePatterns(
                            ConfigurationManager.loadTPConfig(patternsConfigName));
                }
            }
        });

        // "Delete patterns" button
        deleteConfigButton.setToolTipText("Delete current pattern set...");
        deleteConfigButton.setImage(PlatformUI.getWorkbench().getSharedImages()
                .getImage(ISharedImages.IMG_ELCL_REMOVE));
        deleteConfigButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                if (patternsConfigName != null) {
                    final MessageBox messageBox = new MessageBox(parent.getShell(),
                            SWT.ICON_QUESTION | SWT.YES | SWT.NO);
                    messageBox.setMessage("Delete \"" + patternsConfigName + "\"?");
                    messageBox.setText("Delete configuration");
                    if (messageBox.open() == SWT.YES) {
                        ConfigurationManager.removeTPConfig(patternsConfigName);
                        patternsConfigName = null;
                        configNameLabel.setText("");
                    }
                }
            }
        });

        // "Save patterns" button
        saveConfigButton.setToolTipText("Save current pattern set");
        saveConfigButton.setImage(PlatformUI.getWorkbench().getSharedImages()
                .getImage(ISharedImages.IMG_ETOOL_SAVE_EDIT));
        saveConfigButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                if (patternsConfigName != null) {
                    if (!ConfigurationManager.saveTPConfig(patternsConfigName)) {
                        final MessageBox messageBox = new MessageBox(parent.getShell(),
                                SWT.ICON_ERROR | SWT.OK);
                        messageBox.setMessage("Unable to save configuration: "
                                + patternsConfigName);
                        messageBox.setText("Error");
                        messageBox.open();
                    }
                }
            }
        });

        // "Save patterns as..." button
        saveAsConfigButton.setToolTipText("Save current pattern set as...");
        saveAsConfigButton.setImage(PlatformUI.getWorkbench().getSharedImages()
                .getImage(ISharedImages.IMG_ETOOL_SAVEAS_EDIT));
        saveAsConfigButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                final String[] configurations = ConfigurationManager.getTPConfigs();
                final Set<String> existingNames = new HashSet<String>(Arrays
                        .asList(configurations));
                final InputDialog dialog = new ConfigurationSaveAsDialog(parent
                        .getShell(), "Save trace pattern configuration",
                        "Enter name for configuration:", patternsConfigName,
                        existingNames);

                if (dialog.open() == Window.OK) {
                    if (ConfigurationManager.saveTPConfig(dialog.getValue())) {
                        patternsConfigName = dialog.getValue();
                        configNameLabel.setText(patternsConfigName);
                    } else {
                        final MessageBox messageBox = new MessageBox(parent.getShell(),
                                SWT.ICON_ERROR | SWT.OK);
                        messageBox.setMessage("Unable to save configuration: "
                                + dialog.getValue());
                        messageBox.setText("Error");
                        messageBox.open();
                    }
                }
            }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementListSelectionDialog

                .getImage(ISharedImages.IMG_OBJ_FOLDER));
        loadConfigButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                final ElementListSelectionDialog dialog = new SelectConfigurationDialog(
                        parent.getShell(), new LabelProvider());
                dialog.setElements(ConfigurationManager.getNodesConfig());
                dialog.open();
                final String result = (String) dialog.getFirstResult();
                if (result != null) {
                    nodesConfigName = result;
                    configNameLabel.setText(nodesConfigName);
                    TraceBackend.getInstance().loadTracedNodes(
                            ConfigurationManager.loadNodesConfig(nodesConfigName));
                    nodesTableViewer.refresh();
                }
            }
        });

        // "Delete nodes configuration" button
        deleteConfigButton.setToolTipText("Delete current node configuration...");
        deleteConfigButton.setImage(PlatformUI.getWorkbench().getSharedImages()
                .getImage(ISharedImages.IMG_ELCL_REMOVE));
        deleteConfigButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                if (nodesConfigName != null) {
                    final MessageBox messageBox = new MessageBox(parent.getShell(),
                            SWT.ICON_QUESTION | SWT.YES | SWT.NO);
                    messageBox.setMessage("Delete \"" + nodesConfigName + "\"?");
                    messageBox.setText("Delete configuration");
                    if (messageBox.open() == SWT.YES) {
                        ConfigurationManager.removeNodesConfig(nodesConfigName);
                        nodesConfigName = null;
                        configNameLabel.setText("");
                    }
                }
            }
        });

        // "Save nodes configuration" button
        saveConfigButton.setToolTipText("Save current nodes configuration");
        saveConfigButton.setImage(PlatformUI.getWorkbench().getSharedImages()
                .getImage(ISharedImages.IMG_ETOOL_SAVE_EDIT));
        saveConfigButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                if (nodesConfigName != null) {
                    if (!ConfigurationManager.saveNodesConfig(nodesConfigName)) {
                        final MessageBox messageBox = new MessageBox(parent.getShell(),
                                SWT.ICON_ERROR | SWT.OK);
                        messageBox.setMessage("Unable to save configuration: "
                                + nodesConfigName);
                        messageBox.setText("Error");
                        messageBox.open();
                    }
                }
            }
        });

        // "Save nodes configuration as..." button
        saveAsConfigButton.setToolTipText("Save current nodes configuration as...");
        saveAsConfigButton.setImage(PlatformUI.getWorkbench().getSharedImages()
                .getImage(ISharedImages.IMG_ETOOL_SAVEAS_EDIT));
        saveAsConfigButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                final String[] configurations = ConfigurationManager.getNodesConfig();
                final Set<String> existingNames = new HashSet<String>(Arrays
                        .asList(configurations));
                final InputDialog dialog = new ConfigurationSaveAsDialog(parent
                        .getShell(), "Save nodes configuration",
                        "Enter name for configuration:", nodesConfigName, existingNames);

                if (dialog.open() == Window.OK) {
                    if (ConfigurationManager.saveNodesConfig(dialog.getValue())) {
                        nodesConfigName = dialog.getValue();
                        configNameLabel.setText(nodesConfigName);
                    } else {
                        final MessageBox messageBox = new MessageBox(parent.getShell(),
                                SWT.ICON_ERROR | SWT.OK);
                        messageBox.setMessage("Unable to save configuration: "
                                + dialog.getValue());
                        messageBox.setText("Error");
                        messageBox.open();
                    }
                }
            }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementListSelectionDialog

  protected EObject selectElement(EObject[] elements) {
    Shell shell = Display.getCurrent().getActiveShell();
    ILabelProvider labelProvider = new AdapterFactoryLabelProvider(
        OntoUML.diagram.part.OntoUMLDiagramEditorPlugin.getInstance()
            .getItemProvidersAdapterFactory());
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(
        shell, labelProvider);
    dialog
        .setMessage(OntoUML.diagram.part.Messages.OntoUMLModelingAssistantProviderMessage);
    dialog
        .setTitle(OntoUML.diagram.part.Messages.OntoUMLModelingAssistantProviderTitle);
    dialog.setMultipleSelection(false);
    dialog.setElements(elements);
    EObject selected = null;
    if (dialog.open() == Window.OK) {
      selected = (EObject) dialog.getFirstResult();
    }
    return selected;
  }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementListSelectionDialog

        DebugUITools.launch(config, mode);
    }

    private IType chooseType(IType[] types, String mode) throws InterruptedException
    {
        ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_POST_QUALIFIED));

        dialog.setElements(types);
        dialog.setTitle(JUnitMessages.JUnitLaunchShortcut_dialog_title2);
        if (mode.equals(ILaunchManager.DEBUG_MODE))
        {
            dialog.setMessage(JUnitMessages.JUnitLaunchShortcut_message_selectTestToDebug);
        }
        else
        {
            dialog.setMessage(JUnitMessages.JUnitLaunchShortcut_message_selectTestToRun);
        }
        dialog.setMultipleSelection(false);
        if (dialog.open() == Window.OK)
        {
            return (IType) dialog.getFirstResult();
        }
        throw new InterruptedException(); // cancelled by user
    }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementListSelectionDialog

     * @throws InterruptedException if cancelled by the user
     */
    private ILaunchConfiguration chooseConfiguration(List configList, String mode) throws InterruptedException
    {
        IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
        ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
        dialog.setElements(configList.toArray());
        dialog.setTitle(JUnitMessages.JUnitLaunchShortcut_message_selectConfiguration);
        if (mode.equals(ILaunchManager.DEBUG_MODE))
        {
            dialog.setMessage(JUnitMessages.JUnitLaunchShortcut_message_selectDebugConfiguration);
        }
        else
        {
            dialog.setMessage(JUnitMessages.JUnitLaunchShortcut_message_selectRunConfiguration);
        }
        dialog.setMultipleSelection(false);
        int result = dialog.open();
        if (result == Window.OK)
        {
            return (ILaunchConfiguration) dialog.getFirstResult();
        }
        throw new InterruptedException(); // cancelled by user
    }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementListSelectionDialog

        }
        if (packages == null) {
            packages = new IJavaElement[0];
        }

        ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT));
        dialog.setIgnoreCase(false);
        dialog.setTitle(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_title);
        dialog.setMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_description);
        dialog.setEmptyListMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_empty);
        dialog.setElements(packages);
        dialog.setHelpAvailable(false);

        IPackageFragment pack = getPackageFragment();
        if (pack != null) {
            dialog.setInitialSelections(new Object[] {
                pack
            });
        }

        if (dialog.open() == Window.OK) {
            return (IPackageFragment) dialog.getFirstResult();
        }
        return null;
    }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementListSelectionDialog

    browseProject.setText("Browse ...");
    browseProject.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        ILabelProvider labelProvider = new WorkbenchLabelProvider();

        ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(),
                labelProvider);
        dialog.setTitle("Project Selection");
        dialog.setMessage("Select a project");
        dialog.setElements(getWorkspaceRoot().getProjects());
        IProject project = getSelectedProject();
        if (project != null) {
          dialog.setInitialSelections(new Object[] { project });
        }
       
        if (dialog.open() == Window.OK) {
          IProject selectedProject = (IProject) dialog.getFirstResult();
          projectText.setText(selectedProject.getName());
        }
      }
    });
   
    // Descriptor Group
    Group descriptorGroup = new Group(projectComposite, SWT.None);
    descriptorGroup.setText("Descriptor:");
   
    GridData descriptorGroupData = new GridData();
    descriptorGroupData.grabExcessHorizontalSpace = true;
    descriptorGroupData.horizontalAlignment = SWT.FILL;
    descriptorGroup.setLayoutData(projectGroupData);
   
    GridLayout descriptorGroupLayout = new GridLayout(2, false);
    descriptorGroup.setLayout(descriptorGroupLayout);
   
    descriptorText = new Text(descriptorGroup, SWT.BORDER);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
            grab(true, false).applyTo(descriptorText);
    descriptorText.addModifyListener(new ModifyListener() {
     
      public void modifyText(ModifyEvent event) {
        updateLaunchConfigurationDialog();
      }
    });
    Button browseDescriptor = new Button(descriptorGroup, SWT.NONE);
    browseDescriptor.setText("Browse ...");
    browseDescriptor.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
                new WorkbenchLabelProvider(), new WorkbenchContentProvider());
        dialog.setTitle("Select descriptor");
        dialog.setMessage("Select descriptor");
        dialog.setInput(getWorkspaceRoot());
        dialog.setInitialSelection(getWorkspaceRoot().findMember(descriptorText.getText()));
        if (dialog.open() == IDialogConstants.OK_ID) {
          IResource resource = (IResource) dialog.getFirstResult();
          if (resource != null) {
            String fileLoc = resource.getFullPath().toString();
            descriptorText.setText(fileLoc);
          }
        }
      }
    });
   
    // Input Resource Group
    Group inputResourceGroup = new Group(projectComposite, SWT.None);
    inputResourceGroup.setText("Input Resource:");
   
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
            grab(true, false).applyTo(inputResourceGroup);
   
    GridLayout inputResourceGroupLayout = new GridLayout(2, false);
    inputResourceGroup.setLayout(inputResourceGroupLayout);
   
    inputText = new Text(inputResourceGroup, SWT.BORDER);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
            grab(true, false).applyTo(inputText);
    inputText.addModifyListener(new ModifyListener() {
     
      public void modifyText(ModifyEvent event) {
        updateLaunchConfigurationDialog();
      }
    });
   
    Button browseInputResource = new Button(inputResourceGroup, SWT.NONE);
    browseInputResource.setText("Browse ...");
    browseInputResource.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
                new WorkbenchLabelProvider(), new WorkbenchContentProvider());
        dialog.setTitle("Select input folder or file");
        dialog.setMessage("Select input folder or file");
        dialog.setInput(getSelectedProject());
        dialog.setInitialSelection(getWorkspaceRoot().findMember(inputText.getText()));
        if (dialog.open() == IDialogConstants.OK_ID) {
          IResource resource = (IResource) dialog.getFirstResult();
          if (resource != null) {
            String fileLoc = resource.getFullPath().toString();
            inputText.setText(fileLoc);
          }
        }
      }
    });
   
    recursivelyButton = new Button(inputResourceGroup, SWT.CHECK);
    recursivelyButton.setText("Recursively, read all files under each directory");
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
            grab(true, false).applyTo(recursivelyButton);
    recursivelyButton.addSelectionListener(new SelectionListener() {
     
      public void widgetSelected(SelectionEvent event) {
        updateLaunchConfigurationDialog();
      }
     
      public void widgetDefaultSelected(SelectionEvent event) {
      }
    });
   
    Group inputFormatGroup = new Group(projectComposite, SWT.None);
    inputFormatGroup.setText("Input Format:");
   
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
            grab(true, false).applyTo(inputFormatGroup);
   
    GridLayout inputFormatGroupLayout = new GridLayout(4, false);
    inputFormatGroup.setLayout(inputFormatGroupLayout);
   
    casButton = new Button(inputFormatGroup, SWT.RADIO);
    casButton.setText("CASes (XMI or XCAS format)");
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
            grab(true, false).span(4, 1).applyTo(casButton);
    casButton.addSelectionListener(new SelectionListener() {
     
      public void widgetSelected(SelectionEvent event) {
        updateLaunchConfigurationDialog();
      }
     
      public void widgetDefaultSelected(SelectionEvent event) {
      }
    });
   
    plainTextButton = new Button(inputFormatGroup, SWT.RADIO);
    GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).
            grab(false, false).applyTo(plainTextButton);
    plainTextButton.addSelectionListener(new SelectionListener() {
     
      public void widgetSelected(SelectionEvent event) {
        encodingCombo.setEnabled(plainTextButton.getSelection());
        languageText.setEnabled(plainTextButton.getSelection());
        updateLaunchConfigurationDialog();
      }
     
      public void widgetDefaultSelected(SelectionEvent event) {
      }
    });
    plainTextButton.setText("Plain Text, encoding:");
   
    encodingCombo = new Combo(inputFormatGroup, SWT.NONE);
    GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).
        grab(false, false).applyTo(encodingCombo);
   
    encodingCombo.addModifyListener(new ModifyListener() {
     
      public void modifyText(ModifyEvent event) {
        updateLaunchConfigurationDialog();
      }
    });
 
    String defaultEncoding = Charset.defaultCharset().displayName();
   
    Set<String> charsets = new HashSet<String>();
    charsets.add("US-ASCII");
    charsets.add("ISO-8859-1");
    charsets.add("UTF-8");
    charsets.add("UTF-16BE");
    charsets.add("UTF-16LE");
    charsets.add("UTF-16");
    charsets.add(defaultEncoding);
   
    encodingCombo.setItems(charsets.toArray(new String[charsets.size()]));
    // Will be enabled by initializeForm if format is plain text
    encodingCombo.setEnabled(false);
   
    // Add language label
    Label languageLabel = new Label(inputFormatGroup, SWT.NONE);
    languageLabel.setText("Language:");
   
    // Add language text field
   languageText = new Text(inputFormatGroup, SWT.BORDER);
   GridDataFactory.swtDefaults().hint(250, SWT.DEFAULT).align(SWT.LEFT, SWT.CENTER).
            grab(true, false).applyTo(languageText);
   
   languageText.addModifyListener(new ModifyListener() {
    
     public void modifyText(ModifyEvent event) {
       updateLaunchConfigurationDialog();
     }
   });
  
    // Output Folder
    Group outputFolderGroup = new Group(projectComposite, SWT.None);
    outputFolderGroup.setText("Output Folder:");
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
            grab(true, false).applyTo(outputFolderGroup);
    GridLayout outputFolderGroupLayout = new GridLayout(2, false);
    outputFolderGroup.setLayout(outputFolderGroupLayout);
    outputFolderText = new Text(outputFolderGroup, SWT.BORDER);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
            grab(true, false).applyTo(outputFolderText);
    outputFolderText.addModifyListener(new ModifyListener() {
     
      public void modifyText(ModifyEvent event) {
        updateLaunchConfigurationDialog();
      }
    });
   
    Button browseOutputFolderButton = new Button(outputFolderGroup, SWT.NONE);
    browseOutputFolderButton.setText("Browse ...");
    browseOutputFolderButton.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
     // TODO: Only select elements within project
        String currentContainerString = outputFolderText.getText();
        IContainer currentContainer = getContainer(currentContainerString);
        ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(),
                currentContainer, false, "Select output folder");
        dialog.showClosedProjects(false);
        dialog.open();
        Object[] results = dialog.getResult();
        if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) {
          IPath path = (IPath) results[0];
          String containerName = path.toOSString();
          outputFolderText.setText(containerName);
        }
View Full Code Here

Examples of org.eclipse.ui.dialogs.ElementListSelectionDialog

    }
    return ArrayUtil.createFrom(list, IResource.class);
  }
 
  protected IResource chooseLaunchable(IResource[] scripts) {
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new WorkbenchLabelProvider());
    dialog.setElements(scripts);
    dialog.setTitle(LangUIMessages.LaunchShortcut_selectLaunchableToLaunch);
    dialog.setMessage(LangUIMessages.LaunchShortcut_selectLaunchableToLaunch);
    if (dialog.open() == Window.OK) {
      return (IResource) dialog.getResult()[0];
    }
    return null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.