Exemplo n.º 1
0
  @Override
  public void createPartControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    {
      textField = new Text(container, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.MULTI);
      textField.addMouseListener(
          new MouseAdapter() {

            @Override
            public void mouseDoubleClick(MouseEvent e) {
              TextEditor editor =
                  (TextEditor)
                      Perspective.getView(
                          PlatformUI.getWorkbench().getActiveWorkbenchWindow(), TextEditor.ID);

              String selectedText = ((Text) e.widget).getSelectionText();
              String textOfTextEditor = editor.getTextField().getText().toLowerCase();
              if (textOfTextEditor.contains(selectedText)) {
                // TODO change this selection with MyItemTree.getPosition
                int start = textOfTextEditor.indexOf(selectedText);
                int end = start + selectedText.length();
                editor.getTextField().setSelection(start, end);
              }
            }
          });
      textField.setEditable(true);
      textField.setBounds(10, 10, 370, 225);
    }
  }
Exemplo n.º 2
0
  /** Creates a new DoubleField. */
  public DoubleField(Composite parent, int style, IPrintPreferences prefs, int index) {
    super(parent, style);
    _preferences = prefs;
    _index = index;
    FillLayout fill = new FillLayout();
    setLayout(fill);
    _text = new Text(this, SWT.SINGLE | SWT.BORDER);
    updateControl();

    _text.addModifyListener(this);
    _text.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseDown(MouseEvent e) {
            _text.selectAll();
          }

          @Override
          public void mouseUp(MouseEvent e) {
            // _text.selectAll();
          }
        });

    GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gridData.widthHint = 50;
    // setLayoutData(gridData);
  }
  /** @see IDialogPage#createControl(Composite) */
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 3;
    layout.verticalSpacing = 9;
    Label label = new Label(container, SWT.NULL);
    label.setText("&Container:");

    containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    containerText.setLayoutData(gd);
    containerText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            dialogChanged();
          }
        });

    Button button = new Button(container, SWT.PUSH);
    button.setText("Browse...");
    button.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleBrowse();
          }
        });
    label = new Label(container, SWT.NULL);
    label.setText("&File name:");

    fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    fileText.setLayoutData(gd);
    fileText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            dialogChanged();
          }
        });
    fileText.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusGained(FocusEvent e) {
            selectFileName();
          }
        });
    fileText.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseUp(MouseEvent e) {
            selectFileName();
          }
        });
    initialize();
    //		dialogChanged();
    setControl(container);
  }
Exemplo n.º 4
0
  protected void createFilterText(Composite parent) {
    filterText = doCreateFilterText(parent);

    filterText.addModifyListener(
        new ModifyListener() {

          @Override
          public void modifyText(ModifyEvent e) {
            if (filterText.getText().length() > 0) {
              updateToolbar(true);
            } else {
              updateToolbar(false);
            }
          }
        });

    filterText.addFocusListener(
        new FocusAdapter() {
          public void focusGained(FocusEvent e) {}

          public void focusLost(FocusEvent e) {
            if (filterText.getText().equals(initialText)) {
              setFilterText(""); // $NON-NLS-1$
            }
          }
        });

    filterText.addMouseListener(
        new MouseAdapter() {
          public void mouseDown(MouseEvent e) {
            if (filterText.getText().equals(initialText)) {
              // We cannot call clearText() due to
              // [url]https://bugs.eclipse.org/bugs/show_bug.cgi?id=260664[/url]
              setFilterText(""); // $NON-NLS-1$
            }
          }
        });

    // if we're using a field with built in cancel we need to listen for
    // default selection changes (which tell us the cancel button has been
    // pressed)
    if ((filterText.getStyle() & SWT.ICON_CANCEL) != 0) {
      filterText.addSelectionListener(
          new SelectionAdapter() {
            public void widgetDefaultSelected(SelectionEvent e) {
              if (e.detail == SWT.ICON_CANCEL) clearText();
            }
          });
    }

    GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    // if the text widget supported cancel then it will have it's own
    // integrated button. We can take all of the space.
    if ((filterText.getStyle() & SWT.ICON_CANCEL) != 0) gridData.horizontalSpan = 2;
    filterText.setLayoutData(gridData);
  }
Exemplo n.º 5
0
  @NotNull
  public static Text createOutputFolderChooser(
      final Composite parent, @Nullable String label, @Nullable ModifyListener changeListener) {
    UIUtils.createControlLabel(
        parent, label != null ? label : CoreMessages.data_transfer_wizard_output_label_directory);
    Composite chooserPlaceholder = UIUtils.createPlaceholder(parent, 2);
    chooserPlaceholder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    final Text directoryText = new Text(chooserPlaceholder, SWT.BORDER);
    directoryText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (changeListener != null) {
      directoryText.addModifyListener(changeListener);
    }

    final Runnable folderChooser =
        new Runnable() {
          @Override
          public void run() {
            DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.NONE);
            dialog.setMessage(CoreMessages.data_transfer_wizard_output_dialog_directory_message);
            dialog.setText(CoreMessages.data_transfer_wizard_output_dialog_directory_text);
            String directory = directoryText.getText();
            if (!CommonUtils.isEmpty(directory)) {
              dialog.setFilterPath(directory);
            }
            directory = dialog.open();
            if (directory != null) {
              directoryText.setText(directory);
            }
          }
        };
    directoryText.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseUp(MouseEvent e) {
            folderChooser.run();
          }
        });

    Button openFolder = new Button(chooserPlaceholder, SWT.PUSH | SWT.FLAT);
    openFolder.setImage(DBeaverIcons.getImage(DBIcon.TREE_FOLDER));
    openFolder.setLayoutData(
        new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_CENTER));
    openFolder.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            folderChooser.run();
          }
        });
    return directoryText;
  }
Exemplo n.º 6
0
  protected void createContents() {
    setText("DateTime");
    setSize(471, 140);
    text = new Text(this, SWT.BORDER);
    text.setEditable(false);
    text.setBackground(new Color(display, 255, 255, 255));
    text.setBounds(122, 41, 228, 25);

    text.addMouseListener(
        new MouseAdapter() {
          public void mouseUp(MouseEvent e) {
            DTDialog dialog = DTDialog.getInstance(DateTimeDemo.this);
            dialog.open();
          }
        });
  }
 public TextNavigable(Text text) {
   fText = text;
   // workaround for bug 106024:
   if (BUG_106024_TEXT_SELECTION) {
     fLastSelection = getSelection();
     fCaretPosition = fLastSelection.y;
     fText.addKeyListener(
         new KeyAdapter() {
           public void keyReleased(KeyEvent e) {
             selectionChanged();
           }
         });
     fText.addMouseListener(
         new MouseAdapter() {
           public void mouseUp(MouseEvent e) {
             selectionChanged();
           }
         });
   }
 }
Exemplo n.º 8
0
  private void create(Shell parent, final SymitarFile file) {
    FormLayout layout = new FormLayout();
    layout.marginTop = 5;
    layout.marginBottom = 5;
    layout.marginLeft = 5;
    layout.marginRight = 5;
    layout.spacing = 5;

    shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
    shell.setText("Line Printer Options");
    shell.setLayout(layout);

    Label queueLabel = new Label(shell, SWT.NONE);
    queueLabel.setText("LPT Queue");

    Label overrideLabel = new Label(shell, SWT.NONE);
    overrideLabel.setText("Forms Override");

    Label lengthLabel = new Label(shell, SWT.NONE);
    lengthLabel.setText("Form Length");

    Label startLabel = new Label(shell, SWT.NONE);
    startLabel.setText("Start Page");

    Label endLabel = new Label(shell, SWT.NONE);
    endLabel.setText("End Page");

    Label copiesLabel = new Label(shell, SWT.NONE);
    copiesLabel.setText("Copies");

    Label landscapeLabel = new Label(shell, SWT.NONE);
    landscapeLabel.setText("Landscape");

    Label duplexLabel = new Label(shell, SWT.NONE);
    duplexLabel.setText("Duplex");

    Label priorityLabel = new Label(shell, SWT.NONE);
    priorityLabel.setText("Queue Priority");

    // Select All when tabbing through
    FocusListener selectAllFocuser =
        new FocusListener() {

          public void focusGained(FocusEvent e) {
            if (e.widget instanceof Text) ((Text) e.widget).selectAll();
          }

          public void focusLost(FocusEvent e) {}
        };

    MouseListener mouseFocuser =
        new MouseAdapter() {

          public void mouseDown(MouseEvent e) {
            if (e.widget instanceof Text) ((Text) e.widget).selectAll();
          }
        };

    final Text queueText = new Text(shell, SWT.BORDER);
    queueText.setText("0");
    queueText.selectAll();
    queueText.addFocusListener(selectAllFocuser);
    queueText.addMouseListener(mouseFocuser);

    final Combo overrideCombo = new Combo(shell, SWT.READ_ONLY);
    overrideCombo.add("No");
    overrideCombo.add("Yes");
    overrideCombo.select(0);

    final Text lengthText = new Text(shell, SWT.BORDER);
    lengthText.setText("0");
    lengthText.addFocusListener(selectAllFocuser);
    lengthText.addMouseListener(mouseFocuser);

    final Text startText = new Text(shell, SWT.BORDER);
    startText.setText("0");
    startText.addFocusListener(selectAllFocuser);
    startText.addMouseListener(mouseFocuser);

    final Text endText = new Text(shell, SWT.BORDER);
    endText.setText("0");
    endText.addFocusListener(selectAllFocuser);
    endText.addMouseListener(mouseFocuser);

    final Text copiesText = new Text(shell, SWT.BORDER);
    copiesText.setText("1");
    copiesText.addFocusListener(selectAllFocuser);
    copiesText.addMouseListener(mouseFocuser);

    final Combo landscapeCombo = new Combo(shell, SWT.READ_ONLY);
    landscapeCombo.add("No");
    landscapeCombo.add("Yes");
    landscapeCombo.select(0);

    final Combo duplexCombo = new Combo(shell, SWT.READ_ONLY);
    duplexCombo.add("No");
    duplexCombo.add("Yes");
    duplexCombo.select(0);

    final Text priorityText = new Text(shell, SWT.BORDER);
    priorityText.setText("4");
    priorityText.addFocusListener(selectAllFocuser);
    priorityText.addMouseListener(mouseFocuser);

    Button okButton = new Button(shell, SWT.PUSH);
    okButton.setText("Print");

    Button cancelButton = new Button(shell, SWT.PUSH);
    cancelButton.setText("Cancel");

    shell.setDefaultButton(okButton);
    queueText.setFocus();

    FormData data = new FormData();
    data.left = new FormAttachment(0);
    data.top = new FormAttachment(0);
    data.width = 120;
    queueLabel.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(overrideLabel);
    data.top = new FormAttachment(0);
    data.right = new FormAttachment(100);
    data.width = 80;
    queueText.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(0);
    data.top = new FormAttachment(queueText);
    data.width = 120;
    overrideLabel.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(overrideLabel);
    data.top = new FormAttachment(queueText);
    data.right = new FormAttachment(100);
    data.width = 80;
    overrideCombo.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(0);
    data.top = new FormAttachment(overrideCombo);
    data.width = 120;
    lengthLabel.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(lengthLabel);
    data.top = new FormAttachment(overrideCombo);
    data.right = new FormAttachment(100);
    data.width = 80;
    lengthText.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(0);
    data.top = new FormAttachment(lengthText);
    data.width = 120;
    startLabel.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(startLabel);
    data.top = new FormAttachment(lengthText);
    data.right = new FormAttachment(100);
    data.width = 80;
    startText.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(0);
    data.top = new FormAttachment(startText);
    data.width = 120;
    endLabel.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(endLabel);
    data.top = new FormAttachment(startText);
    data.right = new FormAttachment(100);
    data.width = 80;
    endText.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(0);
    data.top = new FormAttachment(endText);
    data.width = 120;
    copiesLabel.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(copiesLabel);
    data.top = new FormAttachment(endText);
    data.right = new FormAttachment(100);
    data.width = 80;
    copiesText.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(0);
    data.top = new FormAttachment(copiesText);
    data.width = 120;
    landscapeLabel.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(landscapeLabel);
    data.top = new FormAttachment(copiesText);
    data.right = new FormAttachment(100);
    data.width = 80;
    landscapeCombo.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(0);
    data.top = new FormAttachment(landscapeCombo);
    data.width = 120;
    duplexLabel.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(duplexLabel);
    data.top = new FormAttachment(landscapeCombo);
    data.right = new FormAttachment(100);
    data.width = 80;
    duplexCombo.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(0);
    data.top = new FormAttachment(duplexCombo);
    data.width = 120;
    priorityLabel.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(priorityLabel);
    data.top = new FormAttachment(duplexCombo);
    data.right = new FormAttachment(100);
    data.width = 80;
    priorityText.setLayoutData(data);

    data = new FormData();
    data.top = new FormAttachment(priorityText);
    data.right = new FormAttachment(100);
    cancelButton.setLayoutData(data);
    cancelButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            result = false;
            shell.dispose();
          }
        });

    data = new FormData();
    data.right = new FormAttachment(cancelButton);
    data.top = new FormAttachment(priorityText);
    okButton.setLayoutData(data);
    okButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            result = true;

            SessionError result = SessionError.INPUT_ERROR;

            try {
              result =
                  RepDevMain.SYMITAR_SESSIONS
                      .get(file.getSym())
                      .printFileLPT(
                          file,
                          Integer.parseInt(queueText.getText()),
                          false,
                          0,
                          Integer.parseInt(startText.getText()),
                          Integer.parseInt(endText.getText()),
                          Integer.parseInt(copiesText.getText()),
                          landscapeCombo.getSelectionIndex() == 1,
                          duplexCombo.getSelectionIndex() == 1,
                          Integer.parseInt(priorityText.getText()));
            } catch (NumberFormatException e1) {

            }

            if (result != SessionError.NONE) {
              MessageBox dialog = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
              dialog.setText("Print Error");
              dialog.setMessage(result.toString());
              dialog.open();
            }

            shell.dispose();
          }
        });

    shell.pack();
    shell.open();
  }
Exemplo n.º 9
0
  /** Create contents of the dialog. */
  private void createContents() {
    shlBundler = new Shell(getParent(), getStyle());
    shlBundler.setSize(626, 447);
    shlBundler.setText("Bundler");
    shlBundler.setLayout(new FormLayout());

    listViewerFiles = new ListViewer(shlBundler, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
    list = listViewerFiles.getList();
    FormData fd_list = new FormData();
    fd_list.left = new FormAttachment(0, 10);
    list.setLayoutData(fd_list);
    listViewerFiles.setContentProvider(
        new IStructuredContentProvider() {
          public Object[] getElements(Object inputElement) {
            Vector v = (Vector) inputElement;
            return v.toArray();
          }

          public void dispose() {}

          public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
        });
    listViewerFiles.setLabelProvider(
        new LabelProvider() {
          public Image getImage(Object element) {
            return null;
          }

          public String getText(Object element) {
            return ((File) element).getName();
          }
        });
    listViewerFiles.setSorter(
        new ViewerSorter() {
          public int compare(Viewer viewer, Object e1, Object e2) {
            return ((File) e1).getName().compareTo(((File) e2).getName());
          }
        });
    lblNewLabel_3 = new Label(shlBundler, SWT.NONE);
    fd_list.top = new FormAttachment(lblNewLabel_3, 6);
    fd_lblNewLabel = new FormData();
    fd_lblNewLabel.left = new FormAttachment(0, 10);
    lblNewLabel_3.setLayoutData(fd_lblNewLabel);
    lblNewLabel_3.setText("folder list :");

    composite_5 = new Composite(shlBundler, SWT.NONE);
    fd_list.bottom = new FormAttachment(composite_5, 0, SWT.BOTTOM);
    composite_5.setLayout(new TreeColumnLayout());
    FormData fd_composite_5 = new FormData();
    fd_composite_5.top = new FormAttachment(lblNewLabel_3, 6);
    fd_composite_5.right = new FormAttachment(100, -10);
    composite_5.setLayoutData(fd_composite_5);

    treeViewerCategories = new TreeViewer(composite_5, SWT.BORDER | SWT.MULTI);
    Tree treeCategories = treeViewerCategories.getTree();
    treeCategories.setHeaderVisible(true);
    treeCategories.setLinesVisible(true);
    treeViewerCategories.setContentProvider(new CategoriesContentProvider());
    treeViewerCategories.setLabelProvider(new SinfilesLabelProvider());
    treeViewerCategories.setSorter(
        new ViewerSorter() {
          public int compare(Viewer viewer, Object e1, Object e2) {
            int cat1 = category(e1);
            int cat2 = category(e2);
            if (cat1 != cat2) return cat1 - cat2;
            if ((e1 instanceof Category) && (e2 instanceof Category))
              return ((Category) e1).getName().compareTo(((Category) e2).getName());
            else return ((File) e1).getName().compareTo(((File) e2).getName());
          }
        });
    // Expand the tree
    treeViewerCategories.setAutoExpandLevel(2);
    // Provide the input to the ContentProvider
    treeViewerCategories.setInput(new CategoriesModel(meta));
    treeViewerCategories.refresh();

    Button btnCancel = new Button(shlBundler, SWT.NONE);
    fd_composite_5.bottom = new FormAttachment(btnCancel, -5);
    fd_composite_5.bottom = new FormAttachment(btnCancel, -5);
    btnCancel.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            result = new String("Cancel");
            shlBundler.dispose();
          }
        });
    FormData fd_btnCancel = new FormData();
    fd_btnCancel.right = new FormAttachment(100, -10);
    fd_btnCancel.bottom = new FormAttachment(100, -10);
    btnCancel.setLayoutData(fd_btnCancel);
    btnCancel.setText("Cancel");

    Button btnCreate = new Button(shlBundler, SWT.NONE);
    btnCreate.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (sourceFolder.getText().length() == 0) {
              showErrorMessageBox("You must point to a folder containing sin files");
              return;
            }
            if ((device.getText().length() == 0)
                || (version.getText().length() == 0)
                || (branding.getText().length() == 0)) {
              showErrorMessageBox("Device, Versio, Branding : all fields must be set");
              return;
            }
            File f =
                new File(
                    OS.getWorkDir()
                        + File.separator
                        + "firmwares"
                        + File.separator
                        + _variant
                        + "_"
                        + version.getText()
                        + "_"
                        + branding.getText()
                        + ".ftf");
            if (f.exists()) {
              showErrorMessageBox("This bundle name already exists");
              return;
            }
            Bundle b = new Bundle();
            b.setMeta(meta);
            b.setDevice(_variant);
            b.setVersion(version.getText());
            b.setBranding(branding.getText());
            b.setCmd25(btnNoFinalVerification.getSelection() ? "true" : "false");
            if (!b.hasLoader()) {
              String result = Devices.getIdFromVariant(_variant);
              DeviceEntry ent = new DeviceEntry(result);
              System.out.println(ent.getLoader());
              if (ent.hasUnlockedLoader()) {
                String res = WidgetTask.openLoaderSelect(shlBundler);
                if (res.equals("U")) b.setLoader(new File(ent.getLoaderUnlocked()));
                else if (res.equals("L")) b.setLoader(new File(ent.getLoader()));
                else {
                  showErrorMessageBox("This bundle must contain a loader");
                  return;
                }

              } else {
                b.setLoader(new File(ent.getLoader()));
              }
            }
            createFTFJob j = new createFTFJob("Create FTF");
            j.setBundle(b);
            j.schedule();
            shlBundler.dispose();
          }
        });
    FormData fd_btnCreate = new FormData();
    fd_btnCreate.bottom = new FormAttachment(btnCancel, 0, SWT.BOTTOM);
    fd_btnCreate.right = new FormAttachment(btnCancel, -6);
    btnCreate.setLayoutData(fd_btnCreate);
    btnCreate.setText("Create");

    btnNewButton_1 = new Button(shlBundler, SWT.NONE);
    fd_list.right = new FormAttachment(btnNewButton_1, -6);
    fd_composite_5.left = new FormAttachment(btnNewButton_1, 6);
    btnNewButton_1.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) listViewerFiles.getSelection();
            Iterator i = selection.iterator();
            while (i.hasNext()) {
              File f = (File) i.next();
              files.remove(f);
              try {
                meta.process(f.getName(), f.getAbsolutePath());
                model.refresh(meta);
                treeViewerCategories.setInput(model);
              } catch (Exception ex) {
                ex.printStackTrace();
              }
              treeViewerCategories.setAutoExpandLevel(2);
              treeViewerCategories.refresh();
              listViewerFiles.refresh();
            }
          }
        });
    fd_btnNewButton_1 = new FormData();
    fd_btnNewButton_1.left = new FormAttachment(0, 353);
    fd_btnNewButton_1.right = new FormAttachment(100, -224);
    btnNewButton_1.setLayoutData(fd_btnNewButton_1);
    btnNewButton_1.setText("->");

    Button btnNewButton_2 = new Button(shlBundler, SWT.NONE);
    fd_btnNewButton_1.bottom = new FormAttachment(100, -143);
    btnNewButton_2.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection =
                (IStructuredSelection) treeViewerCategories.getSelection();
            Iterator i = selection.iterator();
            while (i.hasNext()) {
              Object o = i.next();
              if (o instanceof Category) {
                Category c = (Category) o;
                Iterator<File> j = c.getSinfiles().iterator();
                while (j.hasNext()) {
                  File f = j.next();
                  files.add(f);
                  meta.remove(f.getName());
                  model.refresh(meta);
                  treeViewerCategories.setAutoExpandLevel(2);
                  treeViewerCategories.refresh();
                  listViewerFiles.refresh();
                }
              }
              if (o instanceof File) {
                String internal = ((File) o).getName();
                files.add(new File(meta.getPath(internal)));
                meta.remove(internal);
                model.refresh(meta);
                treeViewerCategories.setAutoExpandLevel(2);
                treeViewerCategories.refresh();
                listViewerFiles.refresh();
              }
            }
          }
        });
    FormData fd_btnNewButton_2 = new FormData();
    fd_btnNewButton_2.top = new FormAttachment(btnNewButton_1, 23);
    fd_btnNewButton_2.right = new FormAttachment(btnNewButton_1, 0, SWT.RIGHT);
    fd_btnNewButton_2.left = new FormAttachment(0, 353);
    btnNewButton_2.setLayoutData(fd_btnNewButton_2);
    btnNewButton_2.setText("<-");
    Composite composite = new Composite(shlBundler, SWT.NONE);
    composite.setLayout(new GridLayout(3, false));
    FormData fd_composite = new FormData();
    fd_composite.left = new FormAttachment(0, 10);
    fd_composite.right = new FormAttachment(100, -10);
    fd_composite.top = new FormAttachment(0, 10);
    composite.setLayoutData(fd_composite);

    lblSelectSourceFolder = new Label(composite, SWT.NONE);
    GridData gd_lblSelectSourceFolder = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblSelectSourceFolder.widthHint = 121;
    lblSelectSourceFolder.setLayoutData(gd_lblSelectSourceFolder);
    lblSelectSourceFolder.setText("Select source folder :");

    sourceFolder = new Text(composite, SWT.BORDER);
    sourceFolder.setEditable(false);
    GridData gd_sourceFolder = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_sourceFolder.widthHint = 428;
    sourceFolder.setLayoutData(gd_sourceFolder);

    btnNewButton = new Button(composite, SWT.NONE);
    btnNewButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    btnNewButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dlg = new DirectoryDialog(shlBundler);

            // Set the initial filter path according
            // to anything they've selected or typed in
            dlg.setFilterPath(sourceFolder.getText());

            // Change the title bar text
            dlg.setText("Directory chooser");

            // Customizable message displayed in the dialog
            dlg.setMessage("Select a directory");

            // Calling open() will open and run the dialog.
            // It will return the selected directory, or
            // null if user cancels
            String dir = dlg.open();
            if (dir != null) {
              // Set the text box to the new selection
              if (!sourceFolder.getText().equals(dir)) {
                sourceFolder.setText(dir);
                meta.clear();
                files = new Vector();
                File srcdir = new File(sourceFolder.getText());
                File[] chld = srcdir.listFiles();
                for (int i = 0; i < chld.length; i++) {
                  if (chld[i].getName().toUpperCase().endsWith("SIN")
                      || (chld[i].getName().toUpperCase().endsWith("TA")
                          && !chld[i].getName().toUpperCase().contains("SIMLOCK"))
                      || (chld[i].getName().toUpperCase().endsWith("XML")
                          && !chld[i].getName().toUpperCase().contains("UPDATE"))) {
                    files.add(chld[i]);
                  }
                }
                srcdir = new File(sourceFolder.getText() + File.separator + "boot");
                if (srcdir.exists()) {
                  chld = srcdir.listFiles();
                  for (int i = 0; i < chld.length; i++) {
                    if (chld[i].getName().toUpperCase().endsWith("XML")) {
                      files.add(chld[i]);
                    }
                  }
                }
                model.refresh(meta);
                treeViewerCategories.setInput(model);
                listViewerFiles.setInput(files);
              }
            }
          }
        });
    btnNewButton.setText("...");

    Composite composite_1 = new Composite(shlBundler, SWT.NONE);
    fd_lblNewLabel.top = new FormAttachment(0, 154);
    composite_1.setLayout(new GridLayout(3, false));
    FormData fd_composite_1 = new FormData();
    fd_composite_1.bottom = new FormAttachment(lblNewLabel_3, -6);
    fd_composite_1.right = new FormAttachment(composite_5, 0, SWT.RIGHT);
    fd_composite_1.top = new FormAttachment(composite, 2);
    fd_composite_1.left = new FormAttachment(0, 10);
    composite_1.setLayoutData(fd_composite_1);

    lblNewLabel = new Label(composite_1, SWT.NONE);
    GridData gd_lblNewLabel = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
    gd_lblNewLabel.widthHint = 68;
    lblNewLabel.setLayoutData(gd_lblNewLabel);
    lblNewLabel.setText("Device :");

    device = new Text(composite_1, SWT.BORDER);
    device.setToolTipText("Double click to get list of devices");
    device.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseDoubleClick(MouseEvent e) {
            String result = WidgetTask.openDeviceSelector(shlBundler);
            if (result.length() > 0) {
              DeviceEntry ent = new DeviceEntry(result);
              String variant = WidgetTask.openVariantSelector(ent.getId(), shlBundler);
              device.setText(ent.getName() + " (" + variant + ")");
              _variant = variant;
            }
          }
        });
    device.setEditable(false);
    GridData gd_device = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_device.widthHint = 355;
    device.setLayoutData(gd_device);
    new Label(composite_1, SWT.NONE);

    lblNewLabel_2 = new Label(composite_1, SWT.NONE);
    lblNewLabel_2.setText("Branding :");

    branding = new Text(composite_1, SWT.BORDER);
    GridData gd_branding = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_branding.widthHint = 355;
    branding.setLayoutData(gd_branding);

    btnNoFinalVerification = new Button(composite_1, SWT.CHECK);
    btnNoFinalVerification.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1));
    btnNoFinalVerification.setText("No final verification");

    Label lblNewLabel_1 = new Label(composite_1, SWT.NONE);
    lblNewLabel_1.setText("Version :");

    version = new Text(composite_1, SWT.BORDER);
    GridData gd_version = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_version.widthHint = 355;
    version.setLayoutData(gd_version);
    new Label(composite_1, SWT.NONE);
    Label lblFirmwareContent = new Label(shlBundler, SWT.NONE);
    fd_lblNewLabel.right = new FormAttachment(lblFirmwareContent, -67);
    FormData fd_lblFirmwareContent = new FormData();
    fd_lblFirmwareContent.right = new FormAttachment(composite_5, 0, SWT.RIGHT);
    fd_lblFirmwareContent.bottom = new FormAttachment(composite_5, -6);
    fd_lblFirmwareContent.left = new FormAttachment(composite_5, 0, SWT.LEFT);
    lblFirmwareContent.setLayoutData(fd_lblFirmwareContent);
    lblFirmwareContent.setText("Firmware content :");

    branding.setText(_branding);
    version.setText(_version);
    if (_deviceName.length() > 0) device.setText(_deviceName + " (" + _variant + ")");
  }