private void deletePressed() {
   if (nameList.getSelection() == null || nameList.getSelection().length == 0) {
     messageLabel.setText(
         Messages.getString("dialogs.OrganizeTestTextDialog.messageLabel.text5")); // $NON-NLS-1$
     messageLabel.redraw();
     return;
   } else {
     QuickRExPlugin.getDefault().deleteTestTextByName(nameList.getSelection()[0]);
     testTextField.setText(""); // $NON-NLS-1$
     nameList.setItems(QuickRExPlugin.getDefault().getTestTextNames());
     messageLabel.setText(
         Messages.getString("dialogs.OrganizeTestTextDialog.messageLabel.text6")); // $NON-NLS-1$
     messageLabel.redraw();
   }
 }
 /* (non-Javadoc)
  * @see org.eclipse.jface.dialogs.Dialog#okPressed()
  */
 protected void okPressed() {
   okPressed = true;
   if (type == TYPE_SAVE) {
     if (nameText.getText() == null || nameText.getText().trim().length() == 0) {
       messageLabel.setText(
           Messages.getString("dialogs.OrganizeTestTextDialog.messageLabel.text7")); // $NON-NLS-1$
       messageLabel.redraw();
       return;
     } else {
       this.nameToSave = nameText.getText();
     }
   } else if (type == TYPE_LOAD) {
     if (this.selectedPath != null) {
       try {
         this.selectedText = getFileContents(this.selectedPath);
       } catch (Exception e) {
         messageLabel.setText(e.getMessage());
         messageLabel.redraw();
         return;
       }
     } else if (nameList.getSelection() == null || nameList.getSelection().length == 0) {
       messageLabel.setText(
           Messages.getString("dialogs.OrganizeTestTextDialog.messageLabel.text8")); // $NON-NLS-1$
       messageLabel.redraw();
       return;
     } else {
       this.selectedText =
           QuickRExPlugin.getDefault().getTestTextByName(nameList.getSelection()[0]);
     }
   }
   this.close();
 }
 public LoadTestTextAction() {
   super(""); // $NON-NLS-1$
   this.setText(Messages.getString("views.QuickRExView.loadTextAction.text")); // $NON-NLS-1$
   this.setToolTipText(
       Messages.getString("views.QuickRExView.loadTextAction.tooltip")); // $NON-NLS-1$
   this.setImageDescriptor(
       ((PluginImageRegistry) QuickRExPlugin.getDefault().getImageRegistry())
           .getImageDescriptor(PluginImageRegistry.IMG_LOAD_TT));
   this.setId("de.babe.eclipse.plugins.quickREx.actions.LoadTestTextAction"); // $NON-NLS-1$
 }
  private Control createDialogAreaContentsForLoad(Composite p_composite) {
    messageLabel = new Label(p_composite, SWT.NULL);
    messageLabel.setText(
        Messages.getString("dialogs.OrganizeTestTextDialog.messageLabel.text1")); // $NON-NLS-1$
    GridData gd = new GridData(GridData.VERTICAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    gd.widthHint = 400;
    messageLabel.setLayoutData(gd);
    Label nameLabel = new Label(p_composite, SWT.NULL);
    nameLabel.setText(
        Messages.getString("dialogs.OrganizeTestTextDialog.nameLabel.text2")); // $NON-NLS-1$
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    gd.grabExcessHorizontalSpace = false;
    nameLabel.setLayoutData(gd);
    nameList = new List(p_composite, SWT.V_SCROLL);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    gd.heightHint = 100;
    nameList.setLayoutData(gd);
    nameList.setItems(QuickRExPlugin.getDefault().getTestTextNames());
    nameList.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            if (nameList.getSelection() != null && nameList.getSelection().length > 0) {
              testTextField.setText(
                  QuickRExPlugin.getDefault()
                      .getTestTextByName(nameList.getSelection()[0])
                      .getText());
              selectedPath = null;
            }
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });
    Label textLabel = new Label(p_composite, SWT.NULL);
    textLabel.setText(
        Messages.getString("dialogs.OrganizeTestTextDialog.textLabel.text2")); // $NON-NLS-1$
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    gd.grabExcessHorizontalSpace = false;
    textLabel.setLayoutData(gd);
    testTextField =
        new Text(
            p_composite,
            SWT.READ_ONLY | SWT.LEAD | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.RESIZE);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.heightHint = 250;
    gd.widthHint = 400;
    testTextField.setLayoutData(gd);
    testTextField.setBackground(new Color(getShell().getDisplay(), new RGB(255, 255, 255)));
    return p_composite;
  }
 private void handleNameTextModified() {
   getButton(IDialogConstants.OK_ID)
       .setEnabled((nameText.getText() != null && nameText.getText().trim().length() > 0));
   if (QuickRExPlugin.getDefault().testTextNameExists(nameText.getText())) {
     messageLabel.setText(
         Messages.getString("dialogs.OrganizeTestTextDialog.messageLabel.text3")); // $NON-NLS-1$
   } else if (nameText.getText() == null || nameText.getText().trim().length() == 0) {
     messageLabel.setText(
         Messages.getString("dialogs.OrganizeTestTextDialog.messageLabel.text4")); // $NON-NLS-1$
   } else {
     messageLabel.setText(""); // $NON-NLS-1$
   }
 }