Beispiel #1
0
  @NotNull
  public static Button createLabelCheckbox(
      @NotNull Composite parent,
      @NotNull String label,
      @Nullable String tooltip,
      boolean checked,
      int style) {
    Label labelControl = createControlLabel(parent, label);
    // labelControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    final Button button = new Button(parent, SWT.CHECK | style);
    if (checked) {
      button.setSelection(true);
    }
    labelControl.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseUp(MouseEvent e) {
            if (!button.isDisposed() && button.isVisible() && button.isEnabled()) {
              button.setSelection(!button.getSelection());
              button.notifyListeners(SWT.Selection, new Event());
            }
          }
        });

    if (tooltip != null) {
      labelControl.setToolTipText(tooltip);
      button.setToolTipText(tooltip);
    }
    return button;
  }
 public static void labelTab() {
   TabItem tab = new TabItem(folder, SWT.CLOSE);
   tab.setText("A Label"); // Text on the tab
   tab.setToolTipText("A simple label");
   Label label = new Label(folder, SWT.CENTER);
   label.setText("Label text");
   tab.setControl(label);
 }
  void createRTFTransfer(Composite copyParent, Composite pasteParent) {
    //	RTF Transfer
    Label l = new Label(copyParent, SWT.NONE);
    l.setText("RTFTransfer:"); // $NON-NLS-1$
    copyRtfText = new Text(copyParent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    copyRtfText.setText("some\nrtf\ntext");
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = data.widthHint = SIZE;
    copyRtfText.setLayoutData(data);
    Button b = new Button(copyParent, SWT.PUSH);
    b.setText("Copy");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            String data = copyRtfText.getText();
            if (data.length() > 0) {
              status.setText("");
              data = "{\\rtf1{\\colortbl;\\red255\\green0\\blue0;}\\uc1\\b\\i " + data + "}";
              clipboard.setContents(
                  new Object[] {data}, new Transfer[] {RTFTransfer.getInstance()});
            } else {
              status.setText("nothing to copy");
            }
          }
        });

    l = new Label(pasteParent, SWT.NONE);
    l.setText("RTFTransfer:"); // $NON-NLS-1$
    pasteRtfText =
        new Text(pasteParent, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = data.widthHint = SIZE;
    pasteRtfText.setLayoutData(data);
    b = new Button(pasteParent, SWT.PUSH);
    b.setText("Paste");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            String data = (String) clipboard.getContents(RTFTransfer.getInstance());
            if (data != null && data.length() > 0) {
              status.setText("");
              pasteRtfText.setText("start paste>" + data + "<end paste");
            } else {
              status.setText("nothing to paste");
            }
          }
        });
  }
  void createHTMLTransfer(Composite copyParent, Composite pasteParent) {
    //	HTML Transfer
    Label l = new Label(copyParent, SWT.NONE);
    l.setText("HTMLTransfer:"); // $NON-NLS-1$
    copyHtmlText = new Text(copyParent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    copyHtmlText.setText("<b>Hello World</b>");
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = data.widthHint = SIZE;
    copyHtmlText.setLayoutData(data);
    Button b = new Button(copyParent, SWT.PUSH);
    b.setText("Copy");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            String data = copyHtmlText.getText();
            if (data.length() > 0) {
              status.setText("");
              clipboard.setContents(
                  new Object[] {data}, new Transfer[] {HTMLTransfer.getInstance()});
            } else {
              status.setText("nothing to copy");
            }
          }
        });

    l = new Label(pasteParent, SWT.NONE);
    l.setText("HTMLTransfer:"); // $NON-NLS-1$
    pasteHtmlText =
        new Text(pasteParent, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = data.widthHint = SIZE;
    pasteHtmlText.setLayoutData(data);
    b = new Button(pasteParent, SWT.PUSH);
    b.setText("Paste");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            String data = (String) clipboard.getContents(HTMLTransfer.getInstance());
            if (data != null && data.length() > 0) {
              status.setText("");
              pasteHtmlText.setText("start paste>" + data + "<end paste");
            } else {
              status.setText("nothing to paste");
            }
          }
        });
  }
 public static void browserTab() {
   TabItem tab = new TabItem(folder, SWT.CLOSE);
   tab.setText("A Browser");
   tab.setToolTipText("A Web browser");
   Browser browser = null;
   try {
     browser = new Browser(folder, SWT.NONE);
   } catch (SWTError e) {
     Label label = new Label(folder, SWT.BORDER);
     label.setText("Could not initialize browser");
     tab.setControl(label);
   }
   if (browser != null) {
     browser.setUrl("http://www.mindview.net");
     tab.setControl(browser);
   }
 }
Beispiel #6
0
 public static Label createHorizontalLine(Composite parent) {
   Label horizontalLine = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
   horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1));
   return horizontalLine;
 }
Beispiel #7
0
  public static Label createImageLabel(Composite parent, DBPImage image) {
    Label imageLabel = new Label(parent, SWT.NONE);
    imageLabel.setImage(DBeaverIcons.getImage(image));

    return imageLabel;
  }
Beispiel #8
0
  public static Label createTextLabel(Composite parent, String label) {
    Label textLabel = new Label(parent, SWT.NONE);
    textLabel.setText(label);

    return textLabel;
  }
Beispiel #9
0
  public static Label createControlLabel(Composite parent, String label) {
    Label textLabel = new Label(parent, SWT.NONE);
    textLabel.setText(label + ": "); // $NON-NLS-1$

    return textLabel;
  }
  public static void main(String[] args) {
    Shell shell = new Shell();
    Display display = shell.getDisplay();
    shell.setLayout(new FillLayout());
    shell.setText("ExpandBar Example");

    Menu menubar = new Menu(shell, SWT.BAR);
    shell.setMenuBar(menubar);
    MenuItem fileItem = new MenuItem(menubar, SWT.CASCADE);
    fileItem.setText("&File");
    Menu submenu = new Menu(shell, SWT.DROP_DOWN);
    fileItem.setMenu(submenu);
    item = new MenuItem(submenu, SWT.PUSH);
    item.setText("New ExpandItem");

    bar = new ExpandBar(shell, SWT.V_SCROLL);
    image = display.getSystemImage(SWT.ICON_QUESTION);

    // First item
    Composite composite = new Composite(bar, SWT.NONE);
    Menu popupmenu = new Menu(shell, SWT.POP_UP);
    MenuItem popupItem = new MenuItem(popupmenu, SWT.PUSH);
    popupItem.setText("Popup");
    composite.setMenu(popupmenu);

    GridLayout layout = new GridLayout(2, false);
    layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
    layout.verticalSpacing = 10;
    composite.setLayout(layout);
    Label label = new Label(composite, SWT.NONE);
    label.setImage(display.getSystemImage(SWT.ICON_ERROR));
    label = new Label(composite, SWT.NONE);
    label.setText("SWT.ICON_ERROR");
    label = new Label(composite, SWT.NONE);
    label.setImage(display.getSystemImage(SWT.ICON_INFORMATION));
    label = new Label(composite, SWT.NONE);
    label.setText("SWT.ICON_INFORMATION");
    label = new Label(composite, SWT.NONE);
    label.setImage(display.getSystemImage(SWT.ICON_WARNING));
    label = new Label(composite, SWT.NONE);
    label.setText("SWT.ICON_WARNING");
    label = new Label(composite, SWT.NONE);
    label.setImage(display.getSystemImage(SWT.ICON_QUESTION));
    label = new Label(composite, SWT.NONE);
    label.setText("SWT.ICON_QUESTION");
    ExpandItem item1 = new ExpandItem(bar, SWT.NONE);
    item1.setText("What is your favorite icon");
    item1.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
    item1.setControl(composite);
    item1.setImage(image);

    // Second item
    composite = new Composite(bar, SWT.NONE);
    layout = new GridLayout(2, true);
    layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
    layout.verticalSpacing = 10;
    composite.setLayout(layout);
    Button button1 = new Button(composite, SWT.PUSH);
    button1.setText("Button 1");
    Button button2 = new Button(composite, SWT.PUSH);
    button2.setText("Button 2");

    ExpandItem item0 = new ExpandItem(bar, SWT.NONE);
    item0.setText("What is your favorite button");
    item0.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
    item0.setControl(composite);
    item0.setImage(image);
    item0.setExpanded(false);

    item.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event e) {
            ExpandItem item2 = new ExpandItem(bar, SWT.NONE);
            Composite composite = new Composite(bar, SWT.NONE);
            GridLayout layout = new GridLayout(2, false);
            composite.setLayout(layout);
            Label label = new Label(composite, SWT.NONE);
            label.setText("What is your name?");
            Composite pcomposite = new Composite(composite, SWT.NONE);
            Text text = new Text(pcomposite, SWT.NONE);
            item2.setText("New Question");
            text.pack();
            composite.pack();
            Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
            item2.setHeight(size.y);
            item2.setControl(composite);
            item2.setImage(image);
            item2.setExpanded(true);
          }
        });

    bar.setSpacing(8);
    shell.setSize(400, 550);
    shell.open();
    System.out.println("------------------------------");
    System.out.println("getSize: " + button1.getSize());
    System.out.println("getBounds: " + button1.getBounds());
    System.out.println("computeSize: " + button1.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    System.out.println("getLocation: " + button1.getLocation());

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    image.dispose();
    display.dispose();
  }
  public Shell open(Display display) {
    clipboard = new Clipboard(display);
    shell = new Shell(display);
    shell.setText("SWT Clipboard");
    shell.setLayout(new FillLayout());

    ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);
    Composite parent = new Composite(sc, SWT.NONE);
    sc.setContent(parent);
    parent.setLayout(new GridLayout(2, true));

    Group copyGroup = new Group(parent, SWT.NONE);
    copyGroup.setText("Copy From:");
    GridData data = new GridData(GridData.FILL_BOTH);
    copyGroup.setLayoutData(data);
    copyGroup.setLayout(new GridLayout(3, false));

    Group pasteGroup = new Group(parent, SWT.NONE);
    pasteGroup.setText("Paste To:");
    data = new GridData(GridData.FILL_BOTH);
    pasteGroup.setLayoutData(data);
    pasteGroup.setLayout(new GridLayout(3, false));

    Group controlGroup = new Group(parent, SWT.NONE);
    controlGroup.setText("Control API:");
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    controlGroup.setLayoutData(data);
    controlGroup.setLayout(new GridLayout(5, false));

    Group typesGroup = new Group(parent, SWT.NONE);
    typesGroup.setText("Available Types");
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    typesGroup.setLayoutData(data);
    typesGroup.setLayout(new GridLayout(2, false));

    status = new Label(parent, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    data.heightHint = 60;
    status.setLayoutData(data);

    createTextTransfer(copyGroup, pasteGroup);
    createRTFTransfer(copyGroup, pasteGroup);
    createHTMLTransfer(copyGroup, pasteGroup);
    createFileTransfer(copyGroup, pasteGroup);
    createMyTransfer(copyGroup, pasteGroup);
    createControlTransfer(controlGroup);
    createAvailableTypes(typesGroup);

    sc.setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);

    Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    Rectangle monitorArea = shell.getMonitor().getClientArea();
    shell.setSize(
        Math.min(size.x, monitorArea.width - 20), Math.min(size.y, monitorArea.height - 20));
    shell.open();
    return shell;
  }
  void createControlTransfer(Composite parent) {
    Label l = new Label(parent, SWT.NONE);
    l.setText("Text:");
    Button b = new Button(parent, SWT.PUSH);
    b.setText("Cut");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            text.cut();
          }
        });
    b = new Button(parent, SWT.PUSH);
    b.setText("Copy");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            text.copy();
          }
        });
    b = new Button(parent, SWT.PUSH);
    b.setText("Paste");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            text.paste();
          }
        });
    text = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = data.widthHint = SIZE;
    text.setLayoutData(data);

    l = new Label(parent, SWT.NONE);
    l.setText("Combo:");
    b = new Button(parent, SWT.PUSH);
    b.setText("Cut");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            combo.cut();
          }
        });
    b = new Button(parent, SWT.PUSH);
    b.setText("Copy");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            combo.copy();
          }
        });
    b = new Button(parent, SWT.PUSH);
    b.setText("Paste");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            combo.paste();
          }
        });
    combo = new Combo(parent, SWT.NONE);
    combo.setItems(new String[] {"Item 1", "Item 2", "Item 3", "A longer Item"});

    l = new Label(parent, SWT.NONE);
    l.setText("StyledText:");
    l = new Label(parent, SWT.NONE);
    l.setVisible(false);
    b = new Button(parent, SWT.PUSH);
    b.setText("Copy");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            styledText.copy();
          }
        });
    b = new Button(parent, SWT.PUSH);
    b.setText("Paste");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            styledText.paste();
          }
        });
    styledText = new StyledText(parent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = data.widthHint = SIZE;
    styledText.setLayoutData(data);
  }
  void createFileTransfer(Composite copyParent, Composite pasteParent) {
    // File Transfer
    Label l = new Label(copyParent, SWT.NONE);
    l.setText("FileTransfer:"); // $NON-NLS-1$

    Composite c = new Composite(copyParent, SWT.NONE);
    c.setLayout(new GridLayout(2, false));
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    c.setLayoutData(data);

    copyFileTable = new Table(c, SWT.MULTI | SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = data.widthHint = SIZE;
    data.horizontalSpan = 2;
    copyFileTable.setLayoutData(data);

    Button b = new Button(c, SWT.PUSH);
    b.setText("Select file(s)");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
            String result = dialog.open();
            if (result != null && result.length() > 0) {
              // copyFileTable.removeAll();
              String separator = System.getProperty("file.separator");
              String path = dialog.getFilterPath();
              String[] names = dialog.getFileNames();
              for (int i = 0; i < names.length; i++) {
                TableItem item = new TableItem(copyFileTable, SWT.NONE);
                item.setText(path + separator + names[i]);
              }
            }
          }
        });
    b = new Button(c, SWT.PUSH);
    b.setText("Select directory");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN);
            String result = dialog.open();
            if (result != null && result.length() > 0) {
              // copyFileTable.removeAll();
              TableItem item = new TableItem(copyFileTable, SWT.NONE);
              item.setText(result);
            }
          }
        });

    b = new Button(copyParent, SWT.PUSH);
    b.setText("Copy");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            TableItem[] items = copyFileTable.getItems();
            if (items.length > 0) {
              status.setText("");
              String[] data = new String[items.length];
              for (int i = 0; i < data.length; i++) {
                data[i] = items[i].getText();
              }
              clipboard.setContents(
                  new Object[] {data}, new Transfer[] {FileTransfer.getInstance()});
            } else {
              status.setText("nothing to copy");
            }
          }
        });

    l = new Label(pasteParent, SWT.NONE);
    l.setText("FileTransfer:"); // $NON-NLS-1$
    pasteFileTable = new Table(pasteParent, SWT.MULTI | SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = data.widthHint = SIZE;
    pasteFileTable.setLayoutData(data);
    b = new Button(pasteParent, SWT.PUSH);
    b.setText("Paste");
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            String[] data = (String[]) clipboard.getContents(FileTransfer.getInstance());
            if (data != null && data.length > 0) {
              status.setText("");
              pasteFileTable.removeAll();
              for (int i = 0; i < data.length; i++) {
                TableItem item = new TableItem(pasteFileTable, SWT.NONE);
                item.setText(data[i]);
              }
            } else {
              status.setText("nothing to paste");
            }
          }
        });
  }
Beispiel #14
0
 private void setStatus(String message) {
   statusText.setText(message);
 }
Beispiel #15
0
  /** Initializes the GUI. */
  private void initGUI() {
    try {
      getShell()
          .addDisposeListener(
              new DisposeListener() {
                public void widgetDisposed(DisposeEvent evt) {
                  shellWidgetDisposed(evt);
                }
              });

      getShell()
          .addControlListener(
              new ControlAdapter() {
                public void controlResized(ControlEvent evt) {
                  shellControlResized(evt);
                }
              });

      getShell()
          .addControlListener(
              new ControlAdapter() {
                public void controlMoved(ControlEvent evt) {
                  shellControlMoved(evt);
                }
              });

      GridLayout thisLayout = new GridLayout();
      this.setLayout(thisLayout);
      {
        GridData toolBarLData = new GridData();
        toolBarLData.grabExcessHorizontalSpace = true;
        toolBarLData.horizontalAlignment = GridData.FILL;
        toolBar = new ToolBar(this, SWT.FLAT);
        toolBar.setLayoutData(toolBarLData);
        toolBar.setBackgroundImage(SWTResourceManager.getImage("images/ToolbarBackground.gif"));
        {
          newToolItem = new ToolItem(toolBar, SWT.NONE);
          newToolItem.setImage(SWTResourceManager.getImage("images/new.gif"));
          newToolItem.setToolTipText("New");
        }
        {
          openToolItem = new ToolItem(toolBar, SWT.NONE);
          openToolItem.setToolTipText("Open");
          openToolItem.setImage(SWTResourceManager.getImage("images/open.gif"));
          openToolItem.addSelectionListener(
              new SelectionAdapter() {
                public void widgetSelected(SelectionEvent evt) {
                  openToolItemWidgetSelected(evt);
                }
              });
        }
        {
          saveToolItem = new ToolItem(toolBar, SWT.NONE);
          saveToolItem.setToolTipText("Save");
          saveToolItem.setImage(SWTResourceManager.getImage("images/save.gif"));
        }
      }
      {
        clientArea = new Composite(this, SWT.NONE);
        GridData clientAreaLData = new GridData();
        clientAreaLData.grabExcessHorizontalSpace = true;
        clientAreaLData.grabExcessVerticalSpace = true;
        clientAreaLData.horizontalAlignment = GridData.FILL;
        clientAreaLData.verticalAlignment = GridData.FILL;
        clientArea.setLayoutData(clientAreaLData);
        clientArea.setLayout(null);
      }
      {
        statusArea = new Composite(this, SWT.NONE);
        GridLayout statusAreaLayout = new GridLayout();
        statusAreaLayout.makeColumnsEqualWidth = true;
        statusAreaLayout.horizontalSpacing = 0;
        statusAreaLayout.marginHeight = 0;
        statusAreaLayout.marginWidth = 0;
        statusAreaLayout.verticalSpacing = 0;
        statusAreaLayout.marginLeft = 3;
        statusAreaLayout.marginRight = 3;
        statusAreaLayout.marginTop = 3;
        statusAreaLayout.marginBottom = 3;
        statusArea.setLayout(statusAreaLayout);
        GridData statusAreaLData = new GridData();
        statusAreaLData.horizontalAlignment = GridData.FILL;
        statusAreaLData.grabExcessHorizontalSpace = true;
        statusArea.setLayoutData(statusAreaLData);
        statusArea.setBackground(SWTResourceManager.getColor(239, 237, 224));
        {
          statusText = new Label(statusArea, SWT.BORDER);
          statusText.setText(" Ready");
          GridData txtStatusLData = new GridData();
          txtStatusLData.horizontalAlignment = GridData.FILL;
          txtStatusLData.grabExcessHorizontalSpace = true;
          txtStatusLData.verticalIndent = 3;
          statusText.setLayoutData(txtStatusLData);
        }
      }
      thisLayout.verticalSpacing = 0;
      thisLayout.marginWidth = 0;
      thisLayout.marginHeight = 0;
      thisLayout.horizontalSpacing = 0;
      thisLayout.marginTop = 3;
      this.setSize(474, 312);
      {
        menu1 = new Menu(getShell(), SWT.BAR);
        getShell().setMenuBar(menu1);
        {
          fileMenuItem = new MenuItem(menu1, SWT.CASCADE);
          fileMenuItem.setText("&File");
          {
            fileMenu = new Menu(fileMenuItem);
            {
              newFileMenuItem = new MenuItem(fileMenu, SWT.PUSH);
              newFileMenuItem.setText("&New");
              newFileMenuItem.setImage(SWTResourceManager.getImage("images/new.gif"));
            }
            {
              openFileMenuItem = new MenuItem(fileMenu, SWT.PUSH);
              openFileMenuItem.setText("&Open");
              openFileMenuItem.setImage(SWTResourceManager.getImage("images/open.gif"));
              openFileMenuItem.addSelectionListener(
                  new SelectionAdapter() {
                    public void widgetSelected(SelectionEvent evt) {
                      openFileMenuItemWidgetSelected(evt);
                    }
                  });
            }
            {
              closeFileMenuItem = new MenuItem(fileMenu, SWT.CASCADE);
              closeFileMenuItem.setText("Close");
            }
            {
              fileMenuSep1 = new MenuItem(fileMenu, SWT.SEPARATOR);
            }
            {
              saveFileMenuItem = new MenuItem(fileMenu, SWT.PUSH);
              saveFileMenuItem.setText("&Save");
              saveFileMenuItem.setImage(SWTResourceManager.getImage("images/save.gif"));
              saveFileMenuItem.addSelectionListener(
                  new SelectionAdapter() {
                    public void widgetSelected(SelectionEvent evt) {
                      saveFileMenuItemWidgetSelected(evt);
                    }
                  });
            }
            {
              fileMenuSep2 = new MenuItem(fileMenu, SWT.SEPARATOR);
            }
            {
              exitMenuItem = new MenuItem(fileMenu, SWT.CASCADE);
              exitMenuItem.setText("E&xit");
              exitMenuItem.addSelectionListener(
                  new SelectionAdapter() {
                    public void widgetSelected(SelectionEvent evt) {
                      exitMenuItemWidgetSelected(evt);
                    }
                  });
            }
            fileMenuItem.setMenu(fileMenu);
          }
        }
        {
          helpMenuItem = new MenuItem(menu1, SWT.CASCADE);
          helpMenuItem.setText("&Help");
          {
            helpMenu = new Menu(helpMenuItem);
            {
              aboutMenuItem = new MenuItem(helpMenu, SWT.CASCADE);
              aboutMenuItem.setText("&About");
              aboutMenuItem.addSelectionListener(
                  new SelectionAdapter() {
                    public void widgetSelected(SelectionEvent evt) {
                      aboutMenuItemWidgetSelected(evt);
                    }
                  });
            }
            helpMenuItem.setMenu(helpMenu);
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }