Example #1
0
  public TreeMapLegend(
      Composite parent,
      TreeMap<TaxonomyNode> treeMap,
      TaxonomyModel model,
      TaxonomyNodeRenderer renderer) {
    super(parent, SWT.NONE);

    this.model = model;
    this.renderer = renderer;

    setBackground(parent.getBackground());

    RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.wrap = true;
    layout.pack = true;
    layout.justify = false;
    setLayout(layout);

    treeMap.addSelectionChangeListener(
        new ISelectionChangeListener<TaxonomyNode>() {
          @Override
          public void selectionChanged(
              ITreeModel<IRectangle<TaxonomyNode>> model,
              IRectangle<TaxonomyNode> rectangle,
              String label) {
            TreeMapLegend.this.selectionChanged(model);
          }
        });
  }
  /**
   * @param parent - the parent Composite of this group
   * @param name - the name of this group
   * @param tokenKind - the tokenkind which is represented by this group
   */
  private void createGroup(
      Composite parent, String name, int tokenKind, SelectionListener changeListener) {
    Group g = null;
    boolean first = true;

    for (int i = 0; i < this.tokentypes.length; i++) {
      if (this.tokentypes[i].getKind() == tokenKind) {
        if (first) {
          g = new Group(parent, SWT.NONE);
          g.setText(name);

          GridData gd = new GridData(SWT.FILL);
          gd.widthHint = 300;
          g.setLayoutData(gd);

          RowLayout layout = new RowLayout();
          layout.pack = false;
          g.setLayout(layout);
          first = false;
        }

        TokenTypesCheckBox t =
            new TokenTypesCheckBox(g, this.tokentypes[i].getType(), this.tokentypes[i].getName());

        t.addSelectionListener(changeListener);
        this.checkBoxes[i] = t;
      }
    }
  }
Example #3
0
  private void createButtonBarComposite(Composite parent) {
    Composite buttonBarComposite = new Composite(parent, SWT.NONE);

    GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.CENTER;
    buttonBarComposite.setLayoutData(gridData);

    RowLayout rowLayout = new RowLayout();
    rowLayout.pack = false;
    buttonBarComposite.setLayout(rowLayout);

    Button okButton = new Button(buttonBarComposite, SWT.PUSH);
    okButton.setText("OK");
    okButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            okPressed();
          }
        });

    this.shell.setDefaultButton(okButton);

    Button cancelButton = new Button(buttonBarComposite, SWT.PUSH);
    cancelButton.setText("Cancel");
    cancelButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            cancelPressed();
          }
        });
  }
Example #4
0
  /** Creates a new instance of Triggers */
  public Triggers(Composite parent, int style) {
    super(parent, style);
    setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));
    final RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.fill = true;
    layout.wrap = false;
    layout.spacing = 0;
    setLayout(layout);
    action =
        new SpherePanel(this, SWT.DOUBLE_BUFFERED, DemoResources.YELLOW_SPHERE, "B-Click", true);
    focus = new SpherePanel(this, SWT.DOUBLE_BUFFERED, DemoResources.BLUE_SPHERE, "Key-Foc", false);
    armed = new SpherePanel(this, SWT.DOUBLE_BUFFERED, DemoResources.RED_SPHERE, "M-Press", true);
    over = new SpherePanel(this, SWT.DOUBLE_BUFFERED, DemoResources.GREEN_SPHERE, "M-Enter", false);
    timing = new SpherePanel(this, SWT.DOUBLE_BUFFERED, DemoResources.GRAY_SPHERE, "1-Stop", true);

    /*
     * Add triggers for each sphere, depending on what we want to trigger them.
     */
    TriggerUtility.addEventTrigger(triggerButton, SWT.Selection, action.getAnimator());
    TriggerUtility.addFocusTrigger(triggerButton, focus.getAnimator(), FocusTriggerEvent.IN, true);
    TriggerUtility.addMouseTrigger(triggerButton, armed.getAnimator(), MouseTriggerEvent.PRESS);
    TriggerUtility.addMouseTrigger(
        triggerButton, over.getAnimator(), MouseTriggerEvent.ENTER, true);
    TriggerUtility.addTimingTrigger(
        action.getAnimator(), timing.getAnimator(), TimingTriggerEvent.STOP);
  }
  /*
   * (non-Javadoc)
   *
   * @see net.refractions.udig.style.sld.SLDEditorPart#createPartControl(org.eclipse.swt.widgets.Composite)
   */
  protected Control createPartControl(Composite parent) {
    myparent = parent;
    RowLayout layout = new RowLayout();
    myparent.setLayout(layout);
    layout.pack = false;
    layout.wrap = true;
    layout.type = SWT.HORIZONTAL;

    /* Border Opacity */
    Group borderOpacityArea = new Group(myparent, SWT.NONE);
    borderOpacityArea.setLayout(new GridLayout(2, false));
    borderOpacityArea.setText("Raster Opacity"); // $NON-NLS-1$

    opacityScale = new Scale(borderOpacityArea, SWT.HORIZONTAL);
    opacityScale.setMinimum(0);
    opacityScale.setMaximum(100);
    opacityScale.setPageIncrement(10);
    opacityScale.setBounds(0, 0, 10, SWT.DEFAULT);
    opacityScale.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            opacityText.setText(String.valueOf(opacityScale.getSelection()) + "%"); // $NON-NLS-1$
            opacityText.pack(true);
          }
        });
    opacityScale.addSelectionListener(this);

    opacityText = new Text(borderOpacityArea, SWT.BORDER | SWT.READ_ONLY);
    opacityText.pack(true);

    return parent;
  }
  private void createFeaturesToolbar(FormToolkit toolkit, Section section) {
    Composite headerComposite = toolkit.createComposite(section, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.marginTop = 0;
    rowLayout.marginBottom = 0;
    headerComposite.setLayout(rowLayout);
    headerComposite.setBackground(null);

    toolBarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
    toolBarManager.createControl(headerComposite);

    installAction = new InstallAction();
    installAction.setEnabled(false);
    toolBarManager.add(installAction);

    toolBarManager.add(new CheckForUpdatesAction());

    CommandContributionItem item =
        JBossCentralActivator.createContributionItem(
            getSite(), "org.jboss.tools.central.refreshDiscovery");
    toolBarManager.add(item);

    toolBarManager.update(true);

    section.setTextClient(headerComposite);
  }
Example #7
0
  /** Create contents of the window. */
  protected void createContents() {
    shell = new Shell(SWT.NO_TRIM | SWT.BORDER);
    shell.setSize(850, 560);
    shell.setLayout(new FillLayout(SWT.HORIZONTAL));
    LayoutUtil.centerShell(Display.getCurrent(), shell);
    Composite composite = new Composite(shell, SWT.NONE);
    composite.setBackgroundImage(SWTResourceManager.getImage(getClass(), "/res/bg.jpg"));
    composite.setBackgroundMode(SWT.INHERIT_FORCE);
    RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
    rowLayout.marginTop = 0;
    rowLayout.marginRight = 0;
    rowLayout.marginLeft = 0;
    rowLayout.spacing = 5;
    composite.setLayout(rowLayout);

    winTitle = createWinTitle(composite);
    winToolbar = createWinToolBar(composite);

    Composite winMainContent = new Composite(composite, SWT.NONE);
    winMainContent.setLayout(new StackLayout());
    winMainContent.setLayoutData(new RowData(850, 407));

    winStatusbar = createWinStatusBar(composite);
    addShellListener(winTitle, winToolbar, winStatusbar);
  }
    public Setting(Composite comp, String title) {
      final Composite settingComp = new Composite(comp, SWT.BORDER);
      settingComp.setLayout(new FillLayout(SWT.VERTICAL));

      final RowLayout infoLayout = new RowLayout();
      infoLayout.center = true;

      final Composite infoComp = new Composite(settingComp, SWT.NONE);
      infoComp.setLayout(infoLayout);

      final Label settingLabel = new Label(infoComp, SWT.CENTER);
      settingLabel.setText(title);

      settingValue = new Text(infoComp, SWT.BORDER | SWT.SINGLE);
      settingValue.setText("000");

      settingScale = new Scale(settingComp, SWT.BORDER);
      settingScale.setSize(200, 64);
      settingScale.setMaximum(50);
      settingScale.addListener(
          SWT.Selection,
          new Listener() {
            @Override
            public void handleEvent(Event e) {
              settingValue.setText("" + settingScale.getSelection());
            }
          });
    }
Example #9
0
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new GridLayout());
    Composite composite = new Composite(shell, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.wrap = true;
    layout.fill = false;
    fTerminalModel = TerminalTextDataFactory.makeTerminalTextData();
    fHeight = 24;
    fWidth = 80;
    fTerminalModel.setDimensions(fHeight, fWidth);
    fTerminalModel.setMaxHeight(fHeight);
    ITerminalTextDataSnapshot snapshot = fTerminalModel.makeSnapshot();
    // TODO how to get the initial size correctly!
    snapshot.updateSnapshot(false);
    fgModel = new PollingTextCanvasModel(snapshot);
    fgTextCanvas =
        new TextCanvas(shell, fgModel, SWT.NONE, new TextLineRenderer(fgTextCanvas, fgModel));
    fgTextCanvas.setLayoutData(new GridData(GridData.FILL_BOTH));

    composite.setLayout(layout);
    addAutorevealCursorButton(composite);
    Text maxHeightText = addMaxHeightInput(composite);
    addHeightInput(composite, maxHeightText);
    addWidthText(composite);
    Text throttleText = addThrottleText(composite);

    IStatus status = new Status();
    DataReader reader =
        new DataReader("Line Count", fTerminalModel, new LineCountingDataSource(), status);
    addDataReader(composite, reader);
    reader = new DataReader("Fast", fTerminalModel, new FastDataSource(), status);
    addDataReader(composite, reader);
    reader = new DataReader("Random", fTerminalModel, new RandomDataSource(), status);
    addDataReader(composite, reader);
    for (int i = 0; i < args.length; i++) {
      File file = new File(args[i]);
      reader = new DataReader(file.getName(), fTerminalModel, new VT100DataSource(args[i]), status);
      addDataReader(composite, reader);
    }
    addStopAllButton(composite, reader);

    fStatusLabel = new Label(shell, SWT.NONE);
    fStatusLabel.setLayoutData(new GridData(250, 15));
    throttleText.setText("100");
    setThrottleForAll(100);

    if (args.length == 0) addLabel(composite, "[Files can be added via commandline]");
    shell.setSize(600, 300);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
Example #10
0
  /** This method initializes portsTab */
  private void createPortsTab() {
    RowLayout rowLayout = createRowLayout();
    portsTab = new Composite(tabFolder, SWT.NONE);
    portsTab.setLayout(rowLayout);

    GridLayout groupLayout = new GridLayout();
    groupLayout.numColumns = 2;
    Group timingGroup = new Group(portsTab, SWT.NONE);
    timingGroup.setText(Labels.getLabel("preferences.ports.timing"));
    timingGroup.setLayout(groupLayout);

    GridData gridData = new GridData();
    gridData.widthHint = 50;

    Label label = new Label(timingGroup, SWT.NONE);
    label.setText(Labels.getLabel("preferences.ports.timing.timeout"));
    portTimeoutText = new Text(timingGroup, SWT.BORDER);
    portTimeoutText.setLayoutData(gridData);

    GridData gridData1 = new GridData();
    gridData1.horizontalSpan = 2;
    adaptTimeoutCheckbox = new Button(timingGroup, SWT.CHECK);
    adaptTimeoutCheckbox.setText(Labels.getLabel("preferences.ports.timing.adaptTimeout"));
    adaptTimeoutCheckbox.setLayoutData(gridData1);
    adaptTimeoutCheckbox.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            minPortTimeoutText.setEnabled(adaptTimeoutCheckbox.getSelection());
          }
        });

    label = new Label(timingGroup, SWT.NONE);
    label.setText(Labels.getLabel("preferences.ports.timing.minTimeout"));
    minPortTimeoutText = new Text(timingGroup, SWT.BORDER);
    minPortTimeoutText.setLayoutData(gridData);

    RowLayout portsLayout = new RowLayout(SWT.VERTICAL);
    portsLayout.fill = true;
    portsLayout.marginHeight = 2;
    portsLayout.marginWidth = 2;
    Group portsGroup = new Group(portsTab, SWT.NONE);
    portsGroup.setText(Labels.getLabel("preferences.ports.ports"));
    portsGroup.setLayout(portsLayout);

    label = new Label(portsGroup, SWT.WRAP);
    label.setText(Labels.getLabel("preferences.ports.portsDescription"));
    // label.setLayoutData(new RowData(300, SWT.DEFAULT));
    portsText = new Text(portsGroup, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
    portsText.setLayoutData(new RowData(SWT.DEFAULT, 60));
    portsText.addKeyListener(new PortsTextValidationListener());

    addRequestedPortsCheckbox = new Button(portsGroup, SWT.CHECK);
    addRequestedPortsCheckbox.setText(Labels.getLabel("preferences.ports.addRequested"));
    addRequestedPortsCheckbox.setToolTipText(
        Labels.getLabel("preferences.ports.addRequested.info"));
  }
Example #11
0
  private static void createFramesHolder(Composite parent, EmoticonImage icon) {
    Label label = new Label(parent, SWT.NONE);
    label.setText("Frame:");

    icon.emoticon.frames = new Composite(parent, SWT.NONE);
    icon.emoticon.frames.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
    rowLayout.wrap = true;
    icon.emoticon.frames.setLayout(rowLayout);

    fillFramesHolder(icon, true);
  }
 ToolBar createToolbar(final MUIElement element, Composite intermediate) {
   int orientation = getOrientation(element);
   RowLayout layout =
       RowLayoutFactory.fillDefaults().wrap(false).spacing(0).type(orientation).create();
   layout.marginLeft = 3;
   layout.center = true;
   intermediate.setLayout(layout);
   ToolBar separatorToolBar =
       new ToolBar(intermediate, orientation | SWT.WRAP | SWT.FLAT | SWT.RIGHT);
   new ToolItem(separatorToolBar, SWT.SEPARATOR);
   return new ToolBar(intermediate, orientation | SWT.WRAP | SWT.FLAT | SWT.RIGHT);
 }
    public OrCondition(
        final FilterAdvancedComposite filterAdvancedComposite, final CTabFolder tabFolder) {
      // fields
      this.filterAdvancedComposite = filterAdvancedComposite;
      this.tabItem = new CTabItem(tabFolder, SWT.NULL);
      this.tabItem.setText(Messages.a_condition);
      this.tabContent = new Composite(tabFolder, SWT.NONE);
      this.tabItem.setControl(this.tabContent);

      // widgets
      this.addAssertionComposite = new AddAssertionComposite(this, this.tabContent);
      this.assertionScrolledComposite =
          new ScrolledComposite(this.tabContent, SWT.V_SCROLL | SWT.NONE);
      this.assertionComposite = new Composite(this.assertionScrolledComposite, SWT.NONE);
      this.assertionScrolledComposite.setContent(this.assertionComposite);

      // layout
      final GridLayout layout = new GridLayout();
      layout.marginLeft = 6;
      layout.marginRight = 6;
      layout.marginTop = 6;
      layout.marginBottom = 6;
      layout.verticalSpacing = 12;
      this.tabContent.setLayout(layout);

      final GridData addAssertionCompositeLayoutData = new GridData();
      addAssertionCompositeLayoutData.grabExcessHorizontalSpace = true;
      addAssertionCompositeLayoutData.horizontalAlignment = GridData.FILL;
      this.addAssertionComposite.setLayoutData(addAssertionCompositeLayoutData);

      final GridData assertionCompositeLayoutData = new GridData();
      assertionCompositeLayoutData.grabExcessHorizontalSpace = true;
      assertionCompositeLayoutData.horizontalAlignment = GridData.FILL;
      assertionCompositeLayoutData.grabExcessVerticalSpace = true;
      assertionCompositeLayoutData.verticalAlignment = GridData.FILL;
      this.assertionScrolledComposite.setLayoutData(assertionCompositeLayoutData);
      this.assertionScrolledComposite.setExpandHorizontal(true);

      final RowLayout innerlayout = new RowLayout(SWT.VERTICAL);
      innerlayout.wrap = false;
      this.assertionComposite.setLayout(innerlayout);
      this.assertionComposite.addListener(
          SWT.Resize,
          new Listener() {
            public void handleEvent(final org.eclipse.swt.widgets.Event event) {
              final Point s =
                  OrCondition.this.assertionComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
              OrCondition.this.assertionComposite.setSize(s.x, s.y);
              refreshGUI();
            }
          });
    }
Example #14
0
  private void createContents(final Shell shell) {
    shell.setText("Choose one");
    RowLayout rl1 = new RowLayout();
    rl1.type = SWT.VERTICAL;
    shell.setLayout(rl1);
    final Composite composite = new Composite(shell, getStyle());
    RowLayout rl2 = new RowLayout();
    rl2.type = SWT.VERTICAL;
    composite.setLayout(rl2);

    for (String choice : choices) {
      Button radio = new Button(composite, SWT.RADIO);
      radio.setText(choice);
    }

    Composite buttons = new Composite(shell, getStyle());
    buttons.setLayout(new RowLayout());

    Button ok = new Button(buttons, SWT.PUSH);
    ok.setText("OK");
    // ok.setLayoutData(data);
    ok.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            choiceMade = -1;
            int index = 0;
            for (Control child : composite.getChildren()) {
              if (child instanceof Button) {
                if (((Button) child).getSelection()) {
                  choiceMade = index;
                  break;
                }
              }
              index++;
            }
            log.log(Level.INFO, "User clicked on OK and selected option {0}", index);
            shell.close();
          }
        });

    Button cancel = new Button(buttons, SWT.PUSH);
    cancel.setText("Cancel");
    cancel.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            log.info("User clicked on Cancel");
            shell.close();
          }
        });

    shell.setDefaultButton(ok);
  }
Example #15
0
  /** This method initializes composite */
  private void createComposite() {
    RowLayout rowLayout1 = new RowLayout();
    //	rowLayout1.marginHeight = 5;
    rowLayout1.marginTop = 2;
    rowLayout1.marginBottom = 2;
    // rowLayout1.marginWidth = 5;
    rowLayout1.type = SWT.VERTICAL;
    composite = new Composite(composite1, SWT.NONE);
    composite.setLayout(rowLayout1);

    SelectionAdapter hexTextSelectionAdapter =
        new SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            text.setText(text.getText()); // generate event
            lastHexButtonSelected = e.widget == hexRadioButton;
            /* Crashes when the text is not a number
            			if (lastHexButtonSelected) return;
            			String textNew = text.getText();
            			textNew = Integer.toHexString(Integer.parseInt(textNew)).toUpperCase();
            			text.setText(textNew);  // generate event
            			lastHexButtonSelected = true;
            */
          }
        };
    /* Crashes when the text is not radix 16
    	SelectionAdapter decTextSelectionAdapter = new SelectionAdapter() {
    		public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
    			if (!lastHexButtonSelected) return;
    			String textNew = text.getText();
    			textNew = Integer.toString(Integer.parseInt(textNew, 16));
    			text.setText(textNew);  // generate event
    			lastHexButtonSelected = false;
    		}
    	};
    */
    // Besides the crashes: the user always knows which number is entering, don't need any automatic
    // conversion. What does sometimes happen is one enters the right number and the wrong hex or
    // dec was
    // selected. In that case automatic conversion is the wrong thing to do and very annoying.
    hexRadioButton = new Button(composite, SWT.RADIO);
    hexRadioButton.setText("Hex");
    hexRadioButton.addSelectionListener(defaultSelectionAdapter);
    hexRadioButton.addSelectionListener(hexTextSelectionAdapter);

    decRadioButton = new Button(composite, SWT.RADIO);
    decRadioButton.setText("Dec");
    decRadioButton.addSelectionListener(defaultSelectionAdapter);
    decRadioButton.addSelectionListener(hexTextSelectionAdapter); // decTextSelectionAdapter);
  }
  /**
   * Create a zoomable nodedisplay decorated with buttons to allow zooming.
   *
   * @param nodedisplay the decorated nodedisplay
   * @param parent parent composite for this new created nodedisplay
   */
  public NodedisplayViewZoomButtons(AbstractNodedisplayView nodedisplay, Composite parent) {

    super(nodedisplay, parent);

    north = new Composite(this, SWT.None);
    north.setLayoutData(new BorderData(BorderLayout.NFIELD));
    final RowLayout layout = new RowLayout();
    layout.spacing = 0;
    layout.center = true;
    north.setLayout(layout);

    font = new Font(Display.getCurrent(), "Monospaced", 12, SWT.BOLD); // $NON-NLS-1$
    // Make buttons as small as possible but identically sized
    minus = new Button(north, SWT.PUSH);
    minus.setText("-"); // $NON-NLS-1$
    minus.setFont(font);
    minus.pack();
    final int min = Math.min(minus.getSize().x, minus.getSize().y);

    addRectangleSizeComp();

    plus = new Button(north, SWT.PUSH);
    plus.setText("+"); // $NON-NLS-1$
    plus.setFont(font);
    plus.pack();
    final int min2 = Math.min(plus.getSize().x, plus.getSize().y);
    final int max = Math.max(min, min2);
    plus.setLayoutData(new RowData(max, max));
    minus.setLayoutData(new RowData(max, max));

    plus.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            setRectangleSize(getRectangleSize() + 1);
          }
        });

    minus.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (getRectangleSize() > 1) {
              setRectangleSize(getRectangleSize() - 1);
            }
          }
        });
  }
Example #17
0
  /** This method initializes composite2 */
  private void createComposite2() {
    RowLayout rowLayout1 = new RowLayout();
    rowLayout1.type = org.eclipse.swt.SWT.VERTICAL;
    rowLayout1.marginHeight = 10;
    rowLayout1.marginWidth = 10;
    rowLayout1.fill = true;

    composite2 = new Composite(sShell, SWT.NONE);
    FormData formData = new FormData();
    formData.left = new FormAttachment(composite1);
    formData.right = new FormAttachment(100);
    composite2.setLayoutData(formData);
    composite2.setLayout(rowLayout1);

    showButton = new Button(composite2, SWT.NONE);
    showButton.setText("Show location");
    showButton.addSelectionListener(defaultSelectionAdapter);
    showButton.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            buttonPressed = 1;
            saveResultAndClose();
          }
        });

    gotoButton = new Button(composite2, SWT.NONE);
    gotoButton.setText("Go to location");
    gotoButton.addSelectionListener(defaultSelectionAdapter);
    gotoButton.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            buttonPressed = 2;
            saveResultAndClose();
          }
        });

    closeButton = new Button(composite2, SWT.NONE);
    closeButton.setText("Close");
    closeButton.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            sShell.close();
          }
        });

    sShell.setDefaultButton(showButton);
  }
  public PerspectiveSwitcherBuilder(final Composite parent, final String subSetId) {
    super(parent, subSetId);
    GridLayout glayout = new GridLayout();
    glayout.marginBottom = 0;
    glayout.marginHeight = 0;

    parent.setLayout(glayout);
    background = new Composite(parent, SWT.NONE);
    background.setData(RWT.CUSTOM_VARIANT, ICSSConstants.COMP_TRANS); // $NON-NLS-1$
    background.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true, 1, 1));
    RowLayout layout = new RowLayout();
    background.setLayout(layout);
    layout.spacing = 4;
    layout.marginBottom = 0;
    layout.marginRight = 10;
    layout.marginTop = 0;
    layout.wrap = false;
    layout.pack = false;
    perspectiveButtonMap = new HashMap<IPerspectiveDescriptor, Button>();
    buttonPerspectiveMap = new HashMap<Button, IPerspectiveDescriptor>();
    buttonList = new ArrayList<Button>();
    perspectiveList = new ArrayList<String>();
    // images
    bgActive = getImage(ILayoutSetConstants.PERSP_BG_ACTIVE);
  }
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.wrap = true;
    layout.fill = false;
    layout.justify = true;
    shell.setLayout(layout);

    Button b = new Button(shell, SWT.PUSH);
    b.setText("Button 1");
    b = new Button(shell, SWT.PUSH);

    b.setText("Button 2");

    b = new Button(shell, SWT.PUSH);
    b.setText("Button 3");

    b = new Button(shell, SWT.PUSH);
    b.setText("Not shown");
    b.setVisible(false);
    RowData data = new RowData();
    data.exclude = true;
    b.setLayoutData(data);

    b = new Button(shell, SWT.PUSH);
    b.setText("Button 200 high");
    data = new RowData();
    data.height = 200;
    b.setLayoutData(data);

    b = new Button(shell, SWT.PUSH);
    b.setText("Button 200 wide");
    data = new RowData();
    data.width = 200;
    b.setLayoutData(data);

    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
Example #20
0
  public CameraFragment(Composite parent) {
    super(parent, SWT.NONE);

    RowLayout layout = new RowLayout(SWT.VERTICAL);
    layout.fill = true;
    this.setLayout(layout);

    EngineManager engineManager = EngineManager.getInstance();

    controller = engineManager.getController();

    createViewSettings();
    createProjectionSettings();

    createFromSettings();
    createToSettings();
    createRotateSettings();
    createFocalLengthSettings();
  }
  /** 填充对话框 @Override */
  protected Control createDialogArea(Composite parent) {

    Composite composite = new Composite(parent, SWT.NONE);
    RowLayout layout = new RowLayout(SWT.VERTICAL);
    layout.marginTop = 10;
    layout.marginLeft = 30;
    layout.marginRight = 30;
    layout.marginHeight = 10;
    composite.setLayout(layout);

    label = new Label(composite, SWT.NONE);
    label_1 = new Label(composite, SWT.NONE);
    label_2 = new Label(composite, SWT.NONE);
    label_3 = new Label(composite, SWT.NONE);
    label_4 = new Label(composite, SWT.NONE);

    setLabelContent();

    return parent;
  }
  public PerspectiveSwitcherBuilder(final Composite parent, final String subSetId) {
    super(parent, subSetId);
    background = new Composite(parent, SWT.NONE);
    background.setData(RWT.CUSTOM_VARIANT, "compTrans"); // $NON-NLS-1$
    RowLayout layout = new RowLayout();
    background.setLayout(layout);
    layout.spacing = 3;
    layout.marginBottom = 0;
    layout.marginTop = 0;

    perspectiveButtonMap = new HashMap();
    buttonPerspectiveMap = new HashMap();
    buttonList = new ArrayList();
    perspectiveList = new ArrayList();
    // images
    left = getImage(ILayoutSetConstants.PERSP_LEFT_ACTIVE);
    right = getImage(ILayoutSetConstants.PERSP_RIGHT_ACTIVE);
    bg = getImage(ILayoutSetConstants.PERSP_BG);
    bgActive = getImage(ILayoutSetConstants.PERSP_BG_ACTIVE);
  }
    protected void createButtonBar(Composite parent) {
      parent.setLayout(new GridLayout(1, true));

      Composite buttons = new Composite(parent, SWT.NONE);
      buttons.setBackground(parent.getBackground());

      GridData buttonsData = new GridData(GridData.FILL_BOTH);
      buttonsData.horizontalAlignment = SWT.RIGHT;
      buttons.setLayoutData(buttonsData);

      RowLayout rl = new RowLayout();
      rl.pack = false;
      rl.spacing = 5;
      buttons.setLayout(rl);

      final Button okButton = new Button(buttons, SWT.PUSH);
      okButton.setText("Ok");
      okButton.addSelectionListener(
          new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
              okPressed();
            }

            public void widgetDefaultSelected(SelectionEvent e) {}
          });

      final Button cancelButton = new Button(buttons, SWT.PUSH);
      cancelButton.setText("Cancel");
      cancelButton.addSelectionListener(
          new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
              cancelPressed();
            }

            public void widgetDefaultSelected(SelectionEvent e) {}
          });
      if (Display.getCurrent().getDismissalAlignment() == SWT.RIGHT) {
        cancelButton.moveAbove(okButton);
      }
      this.getShell().setDefaultButton(okButton);
    }
  /* (non-Javadoc)
   * @see org.eclipse.jface.action.ControlContribution#createControl(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createControl(Composite parent) {
    // adjust layout in order to produce space to the left
    Composite mainComposite = new Composite(parent, SWT.NONE);
    RowLayout layout = new RowLayout(SWT.FILL);
    layout.center = true;
    layout.marginLeft = 10;
    mainComposite.setLayout(layout);

    // create the check box button
    showToolTipButton = new Button(mainComposite, SWT.CHECK);
    showToolTipButton.setText(AndroidSnippetsNLS.TooltipDisplayConfigContriutionItem_ShowPreview);
    showToolTipButton.addSelectionListener(new TooltipSelectionListener());

    // set the selection persisted
    IEclipsePreferences preferences = getEclipsePreferences();
    boolean isTooltipDisplayed =
        preferences.getBoolean(DIALOG_SETTINGS__IS_TOOLTIP_DISPLAYED, true);
    showToolTipButton.setSelection(isTooltipDisplayed);
    performButtonSelection();

    return mainComposite;
  }
Example #25
0
  FunctionGroup(final Composite parent, final ErlangFileWizardPage wizPage) {
    final Group root = new Group(parent, SWT.NULL);
    fWizPage = wizPage;
    root.setText("Functions ");
    GridData gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
    root.setLayoutData(gd);
    final GridLayout layout = new GridLayout(1, true);
    root.setLayout(layout);

    final Composite container = new Composite(root, SWT.NULL);
    gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    container.setLayoutData(gd);
    final RowLayout rlayout = new RowLayout(SWT.HORIZONTAL);
    rlayout.fill = true;
    container.setLayout(rlayout);

    createTable(container);
    createButtons(container);

    createInputField(root);

    dialogChanged();
  }
Example #26
0
 /** @return a pre-initialized RowLayout suitable for option tabs. */
 private RowLayout createRowLayout() {
   RowLayout rowLayout = new RowLayout();
   rowLayout.type = org.eclipse.swt.SWT.VERTICAL;
   rowLayout.spacing = 9;
   rowLayout.marginHeight = 9;
   rowLayout.marginWidth = 11;
   rowLayout.fill = true;
   return rowLayout;
 }
    public AssertionComposite(
        final OrCondition orCondition,
        final Composite parent,
        final String attribute,
        final Type type) {
      // final fields
      super(parent, SWT.NONE);
      this.orCondition = orCondition;

      // widgets
      this.notCheck = createNotCheck();
      this.attributeText = createAttributeText(attribute);
      createFieldTypeLabel(type);
      this.assertionCombo = createAssertionCombo();
      this.valueText = createValueText();
      createRemoveButton();

      // layout
      final RowLayout layout = new RowLayout();
      layout.center = true;
      this.setLayout(layout);

      parent.notifyListeners(SWT.Resize, new org.eclipse.swt.widgets.Event());
    }
Example #28
0
  private void createStatusbar(Composite parent) {

    statusbar = new Composite(parent, SWT.BORDER);

    // 设置工具栏在Shell中的形状为水平抢占充满,并高19像素

    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);

    gridData.heightHint = 19;

    statusbar.setLayoutData(gridData);
    // 设置为用行列式布局管理状态栏里的组件

    RowLayout layout = new RowLayout();

    layout.marginLeft = layout.marginTop = 0; // 无边距

    statusbar.setLayout(layout);
    // 创建一个用于显示文字的标签

    statusbarLabel = new Label(statusbar, SWT.BORDER);

    statusbarLabel.setLayoutData(new RowData(70, -1));
  }
Example #29
0
  /** This method initializes compButtons */
  protected void createCompButtons() {
    compButton = new Composite(getShell(), SWT.NONE);
    compButton.setBounds(new Rectangle(100, 520, 700, 40));
    RowLayout rowLayout = new RowLayout();
    rowLayout.wrap = false;
    rowLayout.pack = false;
    rowLayout.justify = true;
    rowLayout.type = SWT.HORIZONTAL;
    rowLayout.spacing = 0;
    compButton.setLayout(rowLayout);
    btnIedeaExport = new Button(compButton, SWT.NONE);
    btnIedeaExport.setText(Messages.getString("NewReports.button.export.iedea")); // $NON-NLS-1$
    btnIedeaExport.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    btnIedeaExport.setLayoutData(new RowData(200, 30));
    btnIedeaExport.setToolTipText(
        Messages.getString("NewReports.button.export.tooltip.iedea")); // $NON-NLS-1$
    btnIedeaExport.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          @Override
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            cmdIedeaExportsSelected();
          }
        });

    btnDataExport = new Button(compButton, SWT.NONE);
    btnDataExport.setText(Messages.getString("NewReports.button.export")); // $NON-NLS-1$
    btnDataExport.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    btnDataExport.setLayoutData(new RowData(200, 30));
    btnDataExport.setToolTipText(
        Messages.getString("NewReports.button.export.tooltip")); // $NON-NLS-1$
    btnDataExport.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          @Override
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            cmdDataExportsSelected();
          }
        });

    btnDataQuality = new Button(compButton, SWT.NONE);
    btnDataQuality.setText(Messages.getString("NewReports.button.dataQuality")); // $NON-NLS-1$
    btnDataQuality.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    btnDataQuality.setLayoutData(new RowData(200, 30));
    btnDataQuality.setToolTipText(
        Messages.getString("NewReports.button.dataQuality.tooltip")); // $NON-NLS-1$
    btnDataQuality.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          @Override
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            cmdDataQualitySelected();
          }
        });
    compButton.layout();
  }
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 2;
    layout.verticalSpacing = 20;
    Label label = new Label(container, SWT.NULL);
    label.setText("&Nombre del projecto:");

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

    // Combo box
    label = new Label(container, SWT.NULL);
    label.setText("&Dispositivo:");

    board = new Combo(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    board.setLayoutData(gd);

    // Radio button
    label = new Label(container, SWT.NULL);
    label.setText(" ");

    group1 = new Group(container, SWT.SHADOW_IN);
    group1.setText("Tipo de proyecto:");
    RowLayout row = new RowLayout(SWT.HORIZONTAL);
    row.marginTop = 10;
    row.marginRight = 20;
    row.marginLeft = 20;
    row.marginBottom = 10;
    row.spacing = 15;
    group1.setLayout(row);
    botonGenerico = new Button(group1, SWT.RADIO);
    botonGenerico.setText("Generico");
    new Button(group1, SWT.RADIO).setText("BareMetal");

    gd = new GridData(GridData.FILL_HORIZONTAL);
    group1.setLayoutData(gd);

    initialize();
    dialogChanged();
    setControl(container);
  }