/*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createDialogArea(Composite parent) {
    checkNetworkStatus();
    GridData layoutData = new GridData(GridData.FILL_BOTH);
    Composite composite = new Composite(parent, SWT.BORDER);
    GridLayout layout = new GridLayout();
    composite.setLayout(layout);
    composite.setLayoutData(layoutData);
    tableViewerCreator = new TableViewerCreator<ModuleToInstall>(composite);
    tableViewerCreator.setCheckboxInFirstColumn(false);
    tableViewerCreator.setColumnsResizableByDefault(true);
    tableViewerCreator.setLinesVisible(true);
    tableViewerCreator.setLayoutMode(LAYOUT_MODE.CONTINUOUS);

    tableViewerCreator.createTable();

    createJarNameColumn();
    createModuleNameColumn();
    createContextColumn();
    createRequiredColumn();
    createLicenseColumn();

    urlcolumn = createMoreInformationColumn();

    installcolumn = createActionColumn();

    tableViewerCreator.init(inputList);
    addInstallButtons();
    layoutData = new GridData(GridData.FILL_BOTH);
    tableViewerCreator.getTable().setLayoutData(layoutData);
    tableViewerCreator.getTable().pack();

    Composite footComposite = new Composite(composite, SWT.NONE);
    layoutData = new GridData(GridData.FILL_HORIZONTAL);
    footComposite.setLayoutData(layoutData);
    layout = new GridLayout();
    layout.numColumns = 2;
    footComposite.setLayout(layout);

    final Link moreInfor = new Link(footComposite, SWT.NONE);
    layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.widthHint = 200;
    moreInfor.setText(Messages.getString("ExternalModulesInstallDialog_MoreInfor")); // $NON-NLS-1$
    moreInfor.setLayoutData(layoutData);
    moreInfor.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            //
            // Program.launch(Messages.getString("download.external.dialog.help.url"));
            // //$NON-NLS-1$
            openURL(Messages.getString("download.external.dialog.help.url")); // $NON-NLS-1$
          }
        });
    setupColumnSortListener();
    createFooter(composite);
    setTitle(title);
    return composite;
  }
  /** @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite) */
  public void createControl(Composite parent) {
    Composite composite = createGridLayoutComposite(parent, 1);

    publishConfigRadioButton =
        createRadioButton(composite, PublishingUIResources.publishConfigRadioButton_text, 1, true);

    publishProcessesRadioButton =
        createRadioButton(
            composite, PublishingUIResources.publishProcessesRadioButton_text, 1, false);

    Composite processComposite = createChildGridLayoutComposite(composite, 1);

    processViewer = new CheckboxTreeViewer(processComposite);
    GridData gridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
    gridData.heightHint = 300;
    processViewer.getTree().setLayoutData(gridData);
    //		processViewer.setContentProvider(new ProcessViewerContentProvider());
    processViewer.setLabelProvider(new ProcessTreeLabelProvider());

    includeBaseProcessesCheckbox =
        createCheckbox(
            processComposite, PublishingUIResources.includeBaseProcessesCheckboxLabel_text);

    initControls();

    addListeners();

    setControl(composite);
  }
示例#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();
          }
        });
  }
  private void createFileContentsGroup(Composite parent) {
    Group theGroup =
        WidgetFactory.createGroup(
            parent, getString("fileContentsGroup"), SWT.NONE, 1, 4); // $NON-NLS-1$
    GridData groupGD = new GridData(GridData.FILL_BOTH);
    groupGD.heightHint = GROUP_HEIGHT_190;
    groupGD.widthHint = 400;
    theGroup.setLayoutData(groupGD);

    this.fileContentsViewer = new ListViewer(theGroup, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 4;
    this.fileContentsViewer.getControl().setFont(JFaceResources.getTextFont());
    this.fileContentsViewer.getControl().setLayoutData(data);

    if (this.dataFileInfo != null) {
      for (String row : this.dataFileInfo.getCachedFirstLines()) {
        if (row != null) {
          this.fileContentsViewer.add(row);
        }
      }
    }

    // Add a Context Menu
    final MenuManager columnMenuManager = new MenuManager();
    this.fileContentsViewer.getControl().setMenu(columnMenuManager.createContextMenu(parent));
  }
  /**
   * Creates the project name specification controls.
   *
   * @param parent the parent composite
   */
  private final void createProjectNameGroup(Composite parent) {

    Font dialogFont = parent.getFont();

    // project specification group
    Composite projectGroup = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    projectGroup.setFont(dialogFont);
    projectGroup.setLayout(layout);
    projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // new project label
    Label projectLabel = new Label(projectGroup, SWT.NONE);
    projectLabel.setText(DataTransferMessages.WizardExternalProjectImportPage_nameLabel);
    projectLabel.setFont(dialogFont);

    // new project name entry field
    projectNameField = new Text(projectGroup, SWT.BORDER | SWT.READ_ONLY);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    projectNameField.setLayoutData(data);
    projectNameField.setFont(dialogFont);
    projectNameField.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
  }
  /**
   * @param parent
   * @return
   */
  public Control createContents(Composite parent) {
    final FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    ScrolledForm sf = toolkit.createScrolledForm(parent);
    Composite comp = sf.getForm().getBody();
    comp.setLayout(new GridLayout(1, true));
    comp.setBackground(parent.getBackground());

    Section brandSection = toolkit.createSection(comp, Section.TITLE_BAR);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    brandSection.setLayoutData(gridData);
    brandSection.setText("Supported Interaction Types");

    Table table = new Table(comp, SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK | SWT.SINGLE);
    table.setHeaderVisible(true);
    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1));
    table.setLayout(layout);
    TableColumn column = new TableColumn(table, SWT.NONE);
    column.setText("Interaction Type");
    column.setWidth(100);
    column.setResizable(true);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.heightHint = 200;
    table.setLayoutData(gd);

    viewer = new CheckboxTableViewer(table);
    viewer.setContentProvider(new InteractionTypeContentProvider());
    InteractionTypeLabelProvider labelProvider = new InteractionTypeLabelProvider();
    viewer.setLabelProvider(labelProvider);
    viewer.setCheckStateProvider(labelProvider);
    viewer.addCheckStateListener(this);
    viewer.setInput(this);

    return comp;
  }
示例#7
0
  protected void createTextboxArea(final Shell parent) {
    fAddText = new Text(parent, SWT.BORDER | SWT.SINGLE);

    GridData gdText = new GridData(GridData.FILL_HORIZONTAL);
    gdText.widthHint = 400;
    fAddText.setLayoutData(gdText);
  }
 public QualifiedNameComponent(
     Composite parent,
     int style,
     final IQualifiedNameUpdating refactoring,
     IDialogSettings settings) {
   super(parent, style);
   GridLayout layout = new GridLayout();
   layout.marginWidth = 0;
   layout.marginHeight = 0;
   layout.numColumns = 2;
   setLayout(layout);
   Label label = new Label(this, SWT.NONE);
   label.setText(RefactoringMessages.QualifiedNameComponent_patterns_label);
   fPatterns = new Text(this, SWT.BORDER);
   fPatterns.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   label = new Label(this, SWT.NONE);
   label.setText(RefactoringMessages.QualifiedNameComponent_patterns_description);
   GridData gd = new GridData(GridData.FILL_HORIZONTAL);
   gd.horizontalSpan = 2;
   label.setLayoutData(gd);
   String text = refactoring.getFilePatterns();
   if (text == null) text = settings.get(PATTERNS);
   if (text != null) {
     fPatterns.setText(text);
     refactoring.setFilePatterns(text);
   }
   fPatterns.addModifyListener(
       new ModifyListener() {
         public void modifyText(ModifyEvent e) {
           refactoring.setFilePatterns(fPatterns.getText());
         }
       });
 }
  private void createTitleGroup(Composite parent) {
    Composite group = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout(2, false);
    group.setLayout(layout);

    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    group.setLayoutData(gd);

    Label label = new Label(group, SWT.NONE);
    label.setText(Messages.WebQueryWizardPage_Query_Title_);

    title = new Text(group, SWT.BORDER);
    title.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    title.setText(
        getQuery() == null ? getDefaultQueryTitle(getTaskRepository()) : getQuery().getSummary());
    title.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            setPageComplete(isPageComplete());
          }
        });
    title.setFocus();
  }
  private Composite createAvailableList(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container.setLayout(layout);
    container.setLayoutData(new GridData());

    Label label = new Label(container, SWT.NONE);
    label.setText(PDEUIMessages.ImportWizard_DetailedPage_availableList);

    Table table = new Table(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 200;
    gd.widthHint = 225;
    table.setLayoutData(gd);

    fAvailableListViewer = new TableViewer(table);
    fAvailableListViewer.setLabelProvider(new PluginImportLabelProvider());
    fAvailableListViewer.setContentProvider(new ContentProvider());
    fAvailableListViewer.setInput(PDECore.getDefault().getModelManager());
    fAvailableListViewer.setComparator(ListUtil.PLUGIN_COMPARATOR);

    return container;
  }
 /* (non-Javadoc)
  * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
  */
 @Override
 protected Control createDialogArea(Composite parent) {
   Composite composite = (Composite) super.createDialogArea(parent);
   Label label = new Label(composite, SWT.WRAP);
   label.setText(MessagesForDetailPane.PaneMaxLengthDialog_MaxCharactersToDisplay);
   GridData data =
       new GridData(
           GridData.GRAB_HORIZONTAL
               | GridData.GRAB_VERTICAL
               | GridData.HORIZONTAL_ALIGN_FILL
               | GridData.VERTICAL_ALIGN_CENTER);
   data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
   label.setLayoutData(data);
   label.setFont(parent.getFont());
   fTextWidget = new Text(composite, SWT.SINGLE | SWT.BORDER);
   fTextWidget.setLayoutData(
       new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
   fTextWidget.setText(fValue);
   fTextWidget.addModifyListener(
       new ModifyListener() {
         public void modifyText(ModifyEvent e) {
           validateInput();
           fValue = fTextWidget.getText();
         }
       });
   fErrorTextWidget = new Text(composite, SWT.READ_ONLY);
   fErrorTextWidget.setLayoutData(
       new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
   fErrorTextWidget.setBackground(
       fErrorTextWidget.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
   setErrorMessage(fErrorMessage);
   applyDialogFont(composite);
   return composite;
 }
  public ClasspathTypeComposite(Composite parent, int style, IProject project) {
    super(parent, style);
    setLayout(new GridLayout(1, false));

    Label label = new Label(this, SWT.NONE);
    label.setText("Build the classpath with:");

    Composite buttons = new Composite(this, SWT.NONE);
    buttons.setLayout(new GridLayout(1, false));
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.horizontalIndent = INDENT_BUTTONS;
    buttons.setLayoutData(gridData);

    selectCache = new Button(buttons, SWT.RADIO);
    selectCache.setText("Ivy's cache");

    selectRetrieve = new Button(buttons, SWT.RADIO);
    selectRetrieve.setText("retrieved artifacts");

    retrieveComposite = new RetrieveComposite(this, SWT.NONE, false, project);
    gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.horizontalIndent = INDENT_RETRIEVE;
    retrieveComposite.setLayoutData(gridData);

    selectRetrieve.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            retrieveComposite.setEnabled(selectRetrieve.getSelection());
          }
        });
  }
  private void createUriPanel(final Composite parent) {
    if (configuredRemotes != null) {
      uriButton = new Button(parent, SWT.RADIO);
      uriButton.setText(UIText.RepositorySelectionPage_uriChoice + ":"); // $NON-NLS-1$
      uriButton.addSelectionListener(
          new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
              // occurs either on selection or unselection event
              updateRemoteAndURIPanels();
              checkPage();
            }
          });
    }

    uriPanel = new Composite(parent, SWT.NULL);
    uriPanel.setLayout(new GridLayout());
    final GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    uriPanel.setLayoutData(gd);

    createLocationGroup(uriPanel);
    createConnectionGroup(uriPanel);
    authGroup = createAuthenticationGroup(uriPanel);
  }
示例#14
0
 protected void setButtonLayoutData(Button button) {
   GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
   int widthHint = getDialog().convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
   Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
   data.widthHint = Math.max(widthHint, minSize.x);
   button.setLayoutData(data);
 }
  protected Text createFilterText(Composite parent) {
    fFilterText = new Text(parent, SWT.NONE);
    Dialog.applyDialogFont(fFilterText);

    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalAlignment = GridData.FILL;
    data.verticalAlignment = GridData.CENTER;
    fFilterText.setLayoutData(data);

    fFilterText.addKeyListener(
        new KeyListener() {
          public void keyPressed(KeyEvent e) {
            if (e.keyCode == 0x0D) // return
            gotoSelectedElement();
            if (e.keyCode == SWT.ARROW_DOWN) getfTreeViewer().getTree().setFocus();
            if (e.keyCode == SWT.ARROW_UP) getfTreeViewer().getTree().setFocus();
            if (e.character == 0x1B) // ESC
            dispose();
          }

          public void keyReleased(KeyEvent e) {
            // do nothing
          }
        });

    return fFilterText;
  }
示例#16
0
 /**
  * excludes a control from the Layout calculation
  *
  * @param that
  * @param hideit
  */
 private void hideObject(final Control that, final boolean hideit) {
   GridData GData = (GridData) that.getLayoutData();
   GData.exclude = true && hideit;
   that.setVisible(true && !hideit);
   Control[] myArray = {that};
   layout(myArray);
 }
 private static void createLabel(Composite parent, int ncol, String t) {
   Label line = new Label(parent, SWT.HORIZONTAL | SWT.BOLD);
   line.setText(t);
   GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
   gridData.horizontalSpan = ncol;
   line.setLayoutData(gridData);
 }
示例#18
0
  public ParamBoolean(Composite parent, int style, String key, String label, boolean labelFirst) {
    super(parent, style);

    this.key = key;
    this.label = label;

    this.setLayout(new GridLayout(2, false));
    if (labelFirst) {
      labelItem = new Label(this, SWT.NONE);
      labelItem.setText(label);

      check = new Button(this, SWT.CHECK);
      check.addSelectionListener(new SelectionCheck());
    } else {
      check = new Button(this, SWT.CHECK);
      check.addSelectionListener(new SelectionCheck());

      labelItem = new Label(this, SWT.NONE);
      labelItem.setText(label);
    }
    GridData gdata = new GridData();
    // gdata.minimumWidth=20;
    gdata.grabExcessHorizontalSpace = false;
    // text.setLayoutData(gdata);
  }
示例#19
0
 public static Label addLabel(Composite parent, String text, int horizontalSpan) {
   Label label = new Label(parent, SWT.WRAP | SWT.LEFT);
   label.setText(text);
   GridData gd = SWTHelper.setGridData(label, SWT.FILL, true, SWT.CENTER, false);
   gd.horizontalSpan = horizontalSpan;
   return label;
 }
 private void addSeparator(Composite parent) {
   Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
   GridData gridData = new GridData();
   gridData.horizontalAlignment = GridData.FILL;
   gridData.grabExcessHorizontalSpace = true;
   separator.setLayoutData(gridData);
 }
  private void createFilePreviewOptionsGroup(Composite parent) {
    Group theGroup =
        WidgetFactory.createGroup(
            parent, getString("filePreviewOptionsGroup"), SWT.NONE, 1, 5); // $NON-NLS-1$
    theGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label numberLinesInFileLabel = new Label(theGroup, SWT.NONE);
    numberLinesInFileLabel.setText(getString("numberOfLinesLabel")); // $NON-NLS-1$

    numberLinesInFileText = WidgetFactory.createTextField(theGroup, SWT.NONE);
    numberLinesInFileText.setEditable(false);
    numberLinesInFileText.setBackground(
        Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
    GridData gd = new GridData();
    gd.minimumWidth = 50;

    Label spacer = new Label(theGroup, SWT.NONE);
    spacer.setText("                    "); // $NON-NLS-1$

    Label prefixLabel = new Label(theGroup, SWT.NONE);
    prefixLabel.setText(getString("numberOfPreviewLines")); // $NON-NLS-1$
    prefixLabel.setLayoutData(new GridData()); // new GridData(GridData.FILL_HORIZONTAL));

    this.numberPreviewLinesText = WidgetFactory.createTextField(theGroup, SWT.NONE);
    gd = new GridData();
    gd.minimumWidth = 50;

    this.numberPreviewLinesText.setLayoutData(gd);
    this.numberPreviewLinesText.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(final ModifyEvent event) {
            if (!synchronizing) {
              if (!numberPreviewLinesText.getText().isEmpty()) {
                try {
                  int nLines = Integer.parseInt(numberPreviewLinesText.getText());
                  if (nLines == 0) {
                    setErrorMessage(getString("numberOfLinesCannotBeNullOrZero")); // $NON-NLS-1$
                    return;
                  }
                  if (nLines != dataFileInfo.getNumberOfCachedFileLines()) {
                    dataFileInfo.setNumberOfCachedFileLines(nLines);
                    handleInfoChanged(true);
                  }
                  setErrorMessage(null);
                } catch (NumberFormatException ex) {
                  setErrorMessage(
                      getString(
                          "numberOfLinesMustBeInteger",
                          numberPreviewLinesText.getText())); // $NON-NLS-1$
                  return;
                }
              } else {
                setErrorMessage(getString("numberOfLinesCannotBeNullOrZero")); // $NON-NLS-1$
                return;
              }
            }
          }
        });
  }
  public void createProjectControls(Composite parent, int nColumns) {

    Label locationLabel = new Label(parent, SWT.NONE);
    locationLabel.setText("Project:");
    locationLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));

    projectCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
    GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    data.horizontalSpan = 2;
    projectCombo.setLayoutData(data);
    projectCombo.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            projectText = projectCombo.getText();
            projectChanged();
          }
        });
    gwtProjects = Util.getGwtProjects();
    for (int i = 0; i < gwtProjects.length; i++) {
      IJavaProject gwtProject = gwtProjects[i];
      String name = gwtProject.getProject().getName();
      projectCombo.add(name);
      if (name.equals(selectedProject)) projectCombo.select(i);
    }
    if (projectCombo.getSelectionIndex() == -1) projectCombo.select(0);

    new Label(parent, SWT.NONE);
  }
示例#23
0
  private Composite addOrderEntryChoices(Composite buttonComposite) {
    Label enterLabel = new Label(buttonComposite, SWT.NONE);
    enterLabel.setText(CodeInsertionDialog.insertionPoint);
    if (!enableInsertPosition) enterLabel.setEnabled(false);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    enterLabel.setLayoutData(gd);

    final Combo enterCombo = new Combo(buttonComposite, SWT.READ_ONLY);
    enterCombo.setVisibleItemCount(COMBO_VISIBLE_ITEM_COUNT);
    if (!enableInsertPosition) enterCombo.setEnabled(false);
    enterCombo.setItems(fLabels.toArray(new String[fLabels.size()]));
    enterCombo.select(currentPositionIndex);

    gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertWidthInCharsToPixels(60);
    enterCombo.setLayoutData(gd);
    enterCombo.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            int index = enterCombo.getSelectionIndex();
            setInsertPosition(index);
            System.out.println(getElementPosition().toString());
          }
        });

    return buttonComposite;
  }
 private void createLabel(Composite c, String text) {
   Label l = new Label(c, SWT.NONE);
   l.setText(text);
   GridData gd = new GridData();
   gd.horizontalAlignment = SWT.RIGHT;
   l.setLayoutData(gd);
 }
  /**
   * Creates the project location specification controls.
   *
   * @param projectGroup the parent composite
   */
  private void createUserSpecifiedProjectLocationGroup(Composite projectGroup) {

    Font dialogFont = projectGroup.getFont();

    // project location entry field
    this.locationPathField = new Text(projectGroup, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    this.locationPathField.setLayoutData(data);
    this.locationPathField.setFont(dialogFont);

    // browse button
    this.browseButton = new Button(projectGroup, SWT.PUSH);
    this.browseButton.setText(DataTransferMessages.DataTransfer_browse);
    this.browseButton.setFont(dialogFont);
    setButtonLayoutData(this.browseButton);

    this.browseButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent event) {
            handleLocationBrowseButtonPressed();
          }
        });

    locationPathField.addListener(SWT.Modify, locationModifyListener);
  }
示例#26
0
 private Text newText(Composite parent) {
   Text t = new Text(parent, SWT.BORDER);
   GridData gd = new GridData(GridData.FILL_HORIZONTAL);
   gd.widthHint = SIZING_TEXT_FIELD_WIDTH;
   t.setLayoutData(gd);
   return t;
 }
示例#27
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);
  }
示例#28
0
  public void remove(MUFModule module) {
    if (playing) {
      delayRemove.offer(module);
      return;
    }

    // set to true
    playing = true;
    adding = false;
    moduleToBeRemoved = module;

    // exclude from layout
    modules.remove(module.getId());
    GridData data = (GridData) module.self.getLayoutData();
    data.exclude = true;
    module.self.setLayoutData(data);
    module.self.setVisible(false);

    if (content.isVisible()) {
      // get destination size
      frame = 1;
      Point newSize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);
      dx = Math.min(0, (newSize.x - oldSize.x) / FRAMES);
      dy = Math.min(0, (newSize.y - oldSize.y) / FRAMES);
      Display.getCurrent().timerExec(0, runnable);
    } else {
      oldSize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);
      playing = false;
      delayDispose.offer(module.self);
    }
    module.dispose();
  }
示例#29
0
  private void createControls() {
    GridLayout gLayout = new GridLayout();
    gLayout.marginHeight = 0;
    gLayout.marginWidth = 0;
    gLayout.verticalSpacing = 0;
    shell.setLayout(gLayout);
    Utils.setShellIcon(shell);

    topPanel = new Composite(shell, SWT.NONE);
    topPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    GridLayout gLayout1 = new GridLayout();
    gLayout1.marginBottom = 10;
    topPanel.setLayout(gLayout1);
    topPanel.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    topPanel.setBackgroundMode(SWT.INHERIT_FORCE);

    Label separator1 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
    separator1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    contentPanel = new Composite(shell, SWT.NONE);
    contentPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    contentStackLayout = new StackLayout();
    contentPanel.setLayout(contentStackLayout);

    titleLabel = new Label(topPanel, SWT.NONE);
    titleLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    Utils.setFontHeight(titleLabel, 16, SWT.NORMAL);

    descriptionLabel = new Label(topPanel, SWT.WRAP);
    GridData gData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gData.horizontalIndent = 10;
    descriptionLabel.setLayoutData(gData);

    shell.layout(true, true);
  }
示例#30
0
文件: View.java 项目: shader/gdr
  /**
   * Initialize the toolbar with icons and selection listeners in the appropriate part of the window
   */
  public void initToolbar() {

    Device dev = shell.getDisplay();
    try {
      exitImg = new Image(dev, "img/exit.png");
      //            openImg = new Image(dev, "img/open.png");
      playImg = new Image(dev, "img/play.png");
      //            pauseImg = new Image(dev, "img/pause.png");

    } catch (Exception e) {
      System.out.println("Cannot load images");
      System.out.println(e.getMessage());
      System.exit(1);
    }

    ToolBar toolBar = new ToolBar(shell, SWT.BORDER);

    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    toolBar.setLayoutData(gridData);

    ToolItem exit = new ToolItem(toolBar, SWT.PUSH);
    exit.setImage(exitImg);

    // ToolItem open = new ToolItem(toolBar, SWT.PUSH);
    // exit.setImage(openImg);

    ToolItem play = new ToolItem(toolBar, SWT.PUSH);
    play.setImage(playImg);

    //        ToolItem pause = new ToolItem(toolBar, SWT.PUSH);
    //        pause.setImage(pauseImg);

    toolBar.pack();

    exit.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            System.exit(0);
          }
        });

    // open.addSelectionListener(new SelectionAdapter() {
    //     @Override
    //     public void widgetSelected(SelectionEvent e) {
    //         FileDialog dialog = new FileDialog(shell, SWT.NULL);
    //         String path = dialog.open();
    //     }
    // });

    play.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            controller.RunAnimation();
          }
        });
  }