Beispiel #1
0
  /** reset the algorithm. Executed when pressed the plus or minus button */
  public void reset() {
    view.enableMenu(false);
    showDialog = false;
    execute = false;

    equationGroup.setEnabled(true);
    for (Equation equation : equations.getEquationSet()) {
      equation.setEquationEnable(true);
    }

    step1Text.setFont(FontService.getSmallBoldFont());
    step2Text.setFont(FontService.getSmallFont());
    step3Text.setFont(FontService.getSmallFont());
    step4Text.setFont(FontService.getSmallFont());
    resultText.setFont(FontService.getSmallFont());
    resultValueText.setFont(FontService.getSmallFont());
    resultMoreText.setFont(FontService.getSmallFont());
    resultXText.setFont(FontService.getSmallFont());

    step1Group.setEnabled(true);
    step2Group.setEnabled(false);
    step3Group.setEnabled(false);
    step4Group.setEnabled(false);
    resultGroup.setEnabled(false);

    step1Text.setEnabled(true);
    step2Text.setEnabled(false);
    step3Text.setEnabled(false);
    step4Text.setEnabled(false);

    step1nextButton.setEnabled(true);
    step2nextButton.setEnabled(false);
    step3nextButton.setEnabled(false);
    step4nextButton.setEnabled(false);

    resultText.setEnabled(false);
    resultMoreText.setEnabled(false);
    resultValueText.setEnabled(false);
    resultXText.setEnabled(false);
    resultValueText.setText(""); // $NON-NLS-1$

    nextButton.setEnabled(false);
    previousButton.setEnabled(false);

    /*
     * dispose the inverse and verify group for the next turn of calculating
     */
    for (Control elem : inverseGroup.getChildren()) {
      elem.dispose();
    }
    inverseGroup.pack();

    for (Control elem : verifyGroup.getChildren()) {
      elem.dispose();
    }
    verifyGroup.pack();
  }
Beispiel #2
0
  public void add(MUFModule module) {
    if (playing) {
      delayAdd.offer(module);
      return;
    }

    // set to true
    playing = true;
    adding = true;

    // initialize module and add it
    module.create(this);
    modules.put(module.getId(), module);

    if (content.isVisible()) {
      // play a animation
      frame = 1;
      Point moduleSize = module.getPreferredSize();
      dx = Math.max(0, (moduleSize.x - oldSize.x) / FRAMES);
      dy = Math.max(0, moduleSize.y / FRAMES);
      content.pack();
      Display.getCurrent().timerExec(0, runnable);
    } else {
      oldSize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);
      playing = false;
    }
  }
  @Override
  public void partActivated(IWorkbenchPart part) {
    if (part instanceof MapEditor) {
      MapEditor editor = (MapEditor) part;

      // deactive current viewer
      if (activeViewer != null) {
        // FIXME save state
      }

      // activate/create
      activeViewer = viewers.get(editor.getMap().id());
      if (activeViewer == null) {
        activeViewer = new ToolingViewer(editor);
        activeViewer.createControl(parent);
        viewers.put(editor.getMap().id(), activeViewer);
      }
      layout.topControl = activeViewer.getControl();

      // activeViewer.getControl().pack( true );
      parent.pack(true);
      Polymap.getSessionDisplay()
          .asyncExec(
              new Runnable() {
                public void run() {
                  if (!parent.isDisposed() && !parent.getParent().isDisposed()) {
                    parent.getParent().layout(true);
                  }
                }
              });
    }
  }
  /**
   * Refreshes the contents of the {@link #type} selection widget. If the {@link #tree} is not an
   * {@link AdaptiveTreeComposite}, then the entire {@link #typeComposite} is hidden.
   */
  private void refreshTypeWidgets() {

    // Set the default empty list of types and the default empty selection.
    List<String> types = new ArrayList<String>(1);
    ISelection selection = new StructuredSelection();

    // Get the list of adaptive types if possible.
    if (tree != null && isAdaptive) {
      // Update the available types in the type Combo widget.
      AdaptiveTreeComposite adaptiveTree = (AdaptiveTreeComposite) tree;
      types = adaptiveTree.getTypes();
      String adaptiveType = adaptiveTree.getType();
      if (adaptiveType != null) {
        selection = new StructuredSelection(adaptiveType);
      }
    }

    // Set the ComboViewer's contents to the List of type Strings.
    type.setInput(types);
    type.setSelection(selection);

    // Hide the type selection widgets if the List is empty.
    boolean hide = types.isEmpty();
    typeComposite.setVisible(!hide);
    ((GridData) typeComposite.getLayoutData()).exclude = hide;

    // Re-adjust the size of the type Composite.
    typeComposite.pack();
    typeComposite.getParent().layout();

    return;
  }
  private void constructBooleanWidgets() {
    if (rdbTrue == null) {
      rdbTrue = new Button(pnlBoolean, SWT.RADIO);
      rdbTrue.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.CENTER));
      rdbTrue.setText(Util.getString(PREFIX + "rdbTrue")); // $NON-NLS-1$
      rdbTrue.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent theEvent) {
              handleTrueSelected();
            }
          });
      rdbTrue.setSelection(true);

      rdbFalse = new Button(pnlBoolean, SWT.RADIO);
      rdbFalse.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.CENTER));
      rdbFalse.setText(Util.getString(PREFIX + "rdbFalse")); // $NON-NLS-1$
      rdbFalse.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent theEvent) {
              handleFalseSelected();
            }
          });

      pnlBoolean.pack();
    }
  }
  /**
   * {@inheritDoc} This method should be called after <code>setConfiguration</code> has been invoked
   * on this object.
   */
  @Override
  protected void setup() {
    final TabFolder _tabFolder = new TabFolder(parent, SWT.TOP | SWT.BORDER);

    final TabItem _sliceInfoTab = new TabItem(_tabFolder, SWT.NONE);
    final Composite _sliceInfoTabComposite = new Composite(_tabFolder, SWT.NONE);
    setupSliceInfoUI(_sliceInfoTabComposite);
    _sliceInfoTabComposite.pack();
    _sliceInfoTab.setControl(_sliceInfoTabComposite);
    _sliceInfoTab.setText("Slice");
    _sliceInfoTab.setToolTipText("Configure slice properties.");

    final TabItem _dependenceDATab = new TabItem(_tabFolder, SWT.NONE);
    final Composite _dependenceDAComposite = new Composite(_tabFolder, SWT.NONE);
    setupDependenceDepUI(_dependenceDAComposite);
    _dependenceDAComposite.pack();
    _dependenceDATab.setControl(_dependenceDAComposite);
    _dependenceDATab.setText("General Dependence");
    _dependenceDATab.setToolTipText("Configure control and synchronization dependences.");

    final TabItem _divergenceDATab = new TabItem(_tabFolder, SWT.NONE);
    final Composite _divergenceDAComposite = new Composite(_tabFolder, SWT.NONE);
    setupDivergenceDepUI(_divergenceDAComposite);
    _divergenceDAComposite.pack();
    _divergenceDATab.setControl(_divergenceDAComposite);
    _divergenceDATab.setText("Divergence");
    _divergenceDATab.setToolTipText("Configure divergence dependences.");

    final TabItem _interferenceDATab = new TabItem(_tabFolder, SWT.NONE);
    final Composite _interferenceDATabComposite = new Composite(_tabFolder, SWT.NONE);
    setupInteferenceDepUI(_interferenceDATabComposite);
    _interferenceDATabComposite.pack();
    _interferenceDATab.setControl(_interferenceDATabComposite);
    _interferenceDATab.setText("Intereference");
    _interferenceDATab.setToolTipText("Configure interference dependences.");

    final TabItem _readyDATab = new TabItem(_tabFolder, SWT.NONE);
    final Composite _readyDATabComposite = new Composite(_tabFolder, SWT.NONE);
    setupReadyDepUI(_readyDATabComposite);
    _readyDATabComposite.pack();
    _readyDATab.setControl(_readyDATabComposite);
    _readyDATab.setText("Ready");
    _readyDATab.setToolTipText("Configure ready dependences.");

    _tabFolder.pack();
    parent.pack();
  }
  private void constructNullWidgets() {
    if (lblNull == null) {
      lblNull = new Label(pnlNull, SWT.BORDER);
      lblNull.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      lblNull.setText(Util.getString(PREFIX + "txfNull")); // $NON-NLS-1$

      pnlNull.pack();
    }
  }
  void displayTimestampTypeUi() {
    normalizeTypes();
    constructDateWidgets();

    dateWidget.setValue(model.getTimestamp());
    dateWidget.showCalendar(true);
    dateWidget.showTime(true);
    pnlDate.pack();
    showControl(pnlDate);
  }
  @Override
  protected Control createContents(Composite parent) {
    Table table = new Table(parent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
    String[] titles = {
      UIText.RepositoryStatistics_Description,
      UIText.RepositoryStatistics_LooseObjects,
      UIText.RepositoryStatistics_PackedObjects
    };
    for (int i = 0; i < titles.length; i++) {
      TableColumn column = new TableColumn(table, SWT.NONE);
      column.setText(titles[i]);
    }

    Repository repo = AdapterUtils.adapt(getElement(), Repository.class);
    if (repo == null) {
      return table;
    }
    try (Git git = new Git(repo)) {
      GarbageCollectCommand gc = git.gc();
      Properties stats = gc.getStatistics();

      table.setLinesVisible(true);
      table.setHeaderVisible(true);
      GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
      data.heightHint = 200;
      table.setLayoutData(data);

      TableItem item = new TableItem(table, SWT.NONE);
      item.setText(0, UIText.RepositoryStatistics_NrOfObjects);
      item.setText(1, getStatsAsString(stats, "numberOfLooseObjects")); // $NON-NLS-1$
      item.setText(2, getStatsAsString(stats, "numberOfPackedObjects")); // $NON-NLS-1$

      item = new TableItem(table, SWT.NONE);
      item.setText(0, UIText.RepositoryStatistics_NrOfPackfiles);
      item.setText(2, getStatsAsString(stats, "numberOfPackFiles")); // $NON-NLS-1$

      item = new TableItem(table, SWT.NONE);
      item.setText(0, UIText.RepositoryStatistics_NrOfRefs);
      item.setText(1, getStatsAsString(stats, "numberOfLooseRefs")); // $NON-NLS-1$
      item.setText(2, getStatsAsString(stats, "numberOfPackedRefs")); // $NON-NLS-1$

      item = new TableItem(table, SWT.NONE);
      item.setText(0, UIText.RepositoryStatistics_SpaceNeededOnFilesystem);
      item.setText(1, describeSize(getStatsAsLong(stats, "sizeOfLooseObjects"))); // $NON-NLS-1$
      item.setText(2, describeSize(getStatsAsLong(stats, "sizeOfPackedObjects"))); // $NON-NLS-1$

      for (int i = 0; i < titles.length; i++) {
        table.getColumn(i).pack();
      }
      parent.pack();
    } catch (GitAPIException e) {
      Activator.handleError(e.getMessage(), e, false);
    }
    return table;
  }
 private void hideCustomPanelChildren() {
   Control[] children = customUIPanel.getChildren();
   for (Control child : children) {
     if (child instanceof Composite && "donotremove".equals(((Composite) child).getData())) {
       // skip
     } else {
       child.setParent(fakeShell);
     }
   }
   customUIPanel.pack();
 }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets
   * .Composite)
   */
  @Override
  protected Control createDialogArea(Composite parent) {

    final int gridDataSizeSubtrahend = 20;

    Composite comp = (Composite) super.createDialogArea(parent);

    Label dirLabel = new Label(comp, SWT.NONE);
    dirLabel.setText(Messages.IconSelectDialog_5);
    dirCombo = new Combo(comp, SWT.VERTICAL | SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
    GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false);
    dirCombo.setLayoutData(gd);
    dirCombo.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            dirComboModel.setSelectedIndex(dirCombo.getSelectionIndex());
            directory = dirComboModel.getSelectedObject();
            loadIcons(directory.getPath());
          }
        });
    showComboValues();

    Group group = new Group(comp, SWT.NONE);
    group.setText(Messages.IconSelectDialog_6);
    GridLayout groupOrganizationLayout = new GridLayout(1, true);
    group.setLayout(groupOrganizationLayout);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.minimumWidth = SIZE_Y - gridDataSizeSubtrahend;
    gd.heightHint = SIZE_X - gridDataSizeSubtrahend;
    group.setLayoutData(gd);

    createTable(group);

    group.layout();

    final Button defaultCheckbox = new Button(comp, SWT.CHECK);
    defaultCheckbox.setText(Messages.IconSelectDialog_7);
    defaultCheckbox.setSelection(false);
    defaultCheckbox.addSelectionListener(
        new SelectionListener() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            defaultIcon = defaultCheckbox.isEnabled();
          }

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

    comp.pack();
    return comp;
  }
Beispiel #12
0
  private void changeTemplateSize() {
    templateCode.pack();
    Font font;
    if (templateCode.getBounds().height > templateCodeGroup.getBounds().height)
      font = new Font(mainPageComposite.getDisplay(), "Courier New", 10, SWT.NORMAL);
    else font = new Font(mainPageComposite.getDisplay(), "Courier New", 14, SWT.NORMAL);

    templateCode.setFont(font);
    templateCode.setBounds(
        10, this.getLowerRightCoordinate(checkbox_HighlightSmellCode).y + 5, 500, 170);
    selectComposite.pack();
  }
  @Override
  protected void createResultSection(Composite parent) {
    resultSection =
        createSection(
            form,
            parent,
            DefaultMessagesImpl.getString("ColumnAnalysisResultPage.analysisResult"),
            null); //$NON-NLS-1$
    chartTableComposite = toolkit.createComposite(resultSection);
    chartTableComposite.setLayout(new GridLayout());
    chartTableComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

    final ModelElementIndicator[] modelElementIndicatores =
        masterPage.getCurrentModelElementIndicators();

    // ~ MOD mzhao 2009-04-20, Do pagination. Bug 6512.
    uiPagination = new UIPagination(toolkit, chartTableComposite);
    int pageSize = IndicatorPaginationInfo.getPageSize();
    int totalPages = modelElementIndicatores.length / pageSize;
    List<ModelElementIndicator> modelElementIndLs = null;
    for (int index = 0; index < totalPages; index++) {
      modelElementIndLs = new ArrayList<ModelElementIndicator>();
      for (int idx = 0; idx < pageSize; idx++) {
        modelElementIndLs.add(modelElementIndicatores[index * pageSize + idx]);
      }
      IndicatorPaginationInfo pginfo =
          new ResultPaginationInfo(form, modelElementIndLs, masterPage, uiPagination);
      uiPagination.addPage(pginfo);
    }

    int left = modelElementIndicatores.length % pageSize;
    if (left != 0) {
      modelElementIndLs = new ArrayList<ModelElementIndicator>();
      for (int leftIdx = 0; leftIdx < left; leftIdx++) {
        modelElementIndLs.add(modelElementIndicatores[totalPages * pageSize + leftIdx]);
      }
      IndicatorPaginationInfo pginfo =
          new ResultPaginationInfo(form, modelElementIndLs, masterPage, uiPagination);
      uiPagination.addPage(pginfo);
    }
    chartComposite = toolkit.createComposite(chartTableComposite);
    chartComposite.setLayout(new GridLayout());
    chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    // ~
    resultSection.setClient(chartTableComposite);

    uiPagination.setChartComposite(chartComposite);
    uiPagination.init();
    chartComposite.layout();
    chartComposite.pack();
    form.reflow(true);
  }
  void configureAssetType(AssetType type) {
    showGroup(type.needsForegroundScaling(), mScalingLabel, mScalingComposite);
    showGroup(type.needsShape(), mShapeLabel, mShapeComposite);
    showGroup(type.needsTheme(), mThemeLabel, mThemeComposite);
    showGroup(type.needsColors(), mBgColorLabel, mBgButton);
    showGroup(type.needsColors(), mFgColorLabel, mFgButton);
    if (SUPPORT_LAUNCHER_ICON_TYPES) {
      showGroup(type.needsEffects(), mEffectsLabel, mEffectsComposite);
    }

    Composite parent = mScalingLabel.getParent();
    parent.pack();
    parent.layout();
  }
  private void constructDateWidgets() {
    if (dateWidget == null) {
      dateWidget = new CalendarWidget(pnlDate, SWT.NONE, false);
      dateWidget.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              handleDateChanged();
            }
          });
      dateWidget.setLayoutData(new GridData());

      pnlDate.pack();
    }
  }
  private void constructTextWidgets() {
    if (txfValue == null) {
      txfValue = new Text(pnlText, SWT.BORDER);
      txfValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      txfValue.addModifyListener(
          new ModifyListener() {
            @Override
            public void modifyText(ModifyEvent theEvent) {
              handleTextChange();
            }
          });

      txfValue.addVerifyListener(
          new VerifyListener() {
            @Override
            public void verifyText(VerifyEvent theEvent) {
              String text = theEvent.text;

              if ((text != null) && (text.length() > 0)) {
                for (int size = text.length(), i = 0; i < size; i++) {
                  if ((validChars != null) && (validChars.indexOf(text.charAt(i)) == -1)) {
                    theEvent.doit = false;
                    break;
                  } else if (!model.isValidValue(text)) {
                    theEvent.doit = false;
                    break;
                  }
                }
              }
            }
          });

      txfValue.addTraverseListener(
          new TraverseListener() {
            @Override
            public void keyTraversed(TraverseEvent theEvent) {
              // stops the enter key from putting in invisible characters
              if (theEvent.detail == SWT.TRAVERSE_RETURN) {
                theEvent.detail = SWT.TRAVERSE_NONE;
                theEvent.doit = true;
              }
            }
          });

      pnlText.pack();
    }
  }
  private void handleOptionSelection() {
    // Get the selection from the tree list
    if (fTree == null) return;
    IStructuredSelection selection = (IStructuredSelection) fTree.getSelection();
    ToolListElement element = (ToolListElement) selection.getFirstElement();
    if (element != null) {
      displayPageForElement(element);
    }

    ScrollBar sb = containerSC.getHorizontalBar();
    if (sb != null && sb.isVisible()) {
      settingsPageContainer.pack(true);
      containerSC.setMinSize(settingsPageContainer.getSize());
      ((AbstractPage) page).resize();
    }
  }
 private void selectCustomUI() {
   hideCustomPanelChildren();
   String desiredScheme = customUIPicker.getText();
   for (CustomVfsUiPanel panel : customUIPanels) {
     if (desiredScheme.equals(panel.getVfsSchemeDisplayText())) {
       panel.setParent(customUIPanel);
       panel.activate();
       currentPanel = panel;
     }
   }
   if (currentPanel == null) {
     currentPanel = customUIPanels.get(0);
     currentPanel.setParent(customUIPanel);
     currentPanel.activate();
   }
   customUIPanel.pack();
   dialog.layout();
 }
Beispiel #19
0
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
   */
  @Override
  public void createControl(Composite parent) {
    final int marginWidth = 10;
    final Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout(1, true);
    layout.marginWidth = marginWidth;
    composite.setLayout(layout);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    composite.setLayoutData(gd);

    addFormElements(composite);

    composite.pack();

    // Required to avoid an error in the system
    setControl(composite);
    setPageComplete(false);
  }
    private void createAccessControl(Composite parent) throws JavaModelException {
      Composite access = new Composite(parent, SWT.NONE);
      GridLayout layout = new GridLayout();
      layout.marginHeight = 0;
      layout.marginWidth = 0;
      access.setLayout(layout);

      final int[] availableVisibilities =
          getChangeMethodSignatureProcessor().getAvailableVisibilities();
      int currentVisibility = getChangeMethodSignatureProcessor().getVisibility();

      Label label = new Label(access, SWT.NONE);
      label.setText(RefactoringMessages.ChangeSignatureInputPage_access_modifier);

      final Combo combo = new Combo(access, SWT.DROP_DOWN | SWT.READ_ONLY);
      if (availableVisibilities.length == 0) {
        combo.setEnabled(false);
      } else {
        for (int i = 0; i < availableVisibilities.length; i++) {
          combo.add(getAccessModifierString(availableVisibilities[i]));
        }
        combo.addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                int newVisibility = availableVisibilities[combo.getSelectionIndex()];
                getChangeMethodSignatureProcessor().setVisibility(newVisibility);
                update(true);
              }
            });
      }
      combo.setText(getAccessModifierString(currentVisibility));
      combo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

      // ensure that "Access modifier:" and "Return type:" Labels are not too close:
      Dialog.applyDialogFont(access);
      access.pack();
      int minLabelWidth = label.getSize().x + 3 * layout.horizontalSpacing;
      if (minLabelWidth > combo.getSize().x)
        label.setLayoutData(new GridData(minLabelWidth, label.getSize().y));
    }
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.swt.widgets.Control#pack(boolean)
  */
 @Override
 public void pack(boolean changed) {
   if (changed) {
     RootContainer root = RootContainer.getRoot(project);
     root.update();
     table.clearAll(true);
     table.setItemCount(0);
     if (tableSelectionListener != null) {
       table.removeSelectionListener(tableSelectionListener);
     }
     setupClasspathInfo(table, root);
     makeChecksConsistentWithChildren();
     expandAll(table.getItems());
     if (tableSelectionListener == null) {
       tableSelectionListener = new TableSelectionListener();
       table.addSelectionListener(tableSelectionListener);
     }
   }
   table.pack(changed);
   super.pack(changed);
 }
Beispiel #22
0
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
   */
  @Override
  public void createControl(Composite parent) {
    final Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout(1, true);
    layout.marginWidth = 10;
    composite.setLayout(layout);
    // layout.marginHeight = 10;
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    composite.setLayoutData(gd);

    addFormElements(composite);

    // Build the separator line
    // Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
    // separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    composite.pack();

    // Required to avoid an error in the system
    setControl(composite);
    setPageComplete(false);
  }
  @Override
  public void partClosed(IWorkbenchPart part) {
    if (part instanceof MapEditor) {
      MapEditor editor = (MapEditor) part;

      ToolingViewer viewer = viewers.remove(editor.getMap().id());
      viewer.dispose();

      if (viewer == activeViewer) {
        activeViewer = null;
      }

      parent.pack(true);
      Polymap.getSessionDisplay()
          .asyncExec(
              new Runnable() {
                public void run() {
                  parent.getParent().layout(true);
                }
              });
    }
  }
    public void createControl(final Composite parent) {
      Composite panel = new Composite(parent, SWT.NONE);
      GridLayout layout = new GridLayout(3, false);
      panel.setLayout(layout);

      Label mapperLabel = new Label(panel, SWT.NONE);
      mapperLabel.setText("Mapper");
      mapperClass = new Text(panel, SWT.SINGLE | SWT.BORDER);
      createRow(parent, panel, mapperClass);

      Label reducerLabel = new Label(panel, SWT.NONE);
      reducerLabel.setText("Reducer");
      reducerClass = new Text(panel, SWT.SINGLE | SWT.BORDER);
      createRow(parent, panel, reducerClass);

      Label combinerLabel = new Label(panel, SWT.NONE);
      combinerLabel.setText("Combiner");
      combinerClass = new Text(panel, SWT.SINGLE | SWT.BORDER);
      createRow(parent, panel, combinerClass);

      panel.pack();
      setControl(panel);
    }
  protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    Label label = new Label(composite, SWT.SHADOW_IN | SWT.LEFT);
    label.setText("Select dialog with specific layout: ");

    combo = new Combo(composite, SWT.READ_ONLY | SWT.DROP_DOWN);

    for (LayoutType type : LayoutType.values()) {
      combo.add(type.toString());
    }

    combo.select(1);

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

    combo.setLayoutData(gridData);

    composite.pack();
    return composite;
  }
Beispiel #26
0
  /**
   * ************************************************************************* Set the table font
   * ************************************************************************
   */
  private void updateFontFromSize() {
    if (m_myFont != null) {
      m_myFont.dispose();
    }
    setRedraw(false);
    m_myFont = new Font(Display.getDefault(), "Courier New", m_fontSize, SWT.NORMAL);
    m_promptText.setFont(m_myFont);
    m_textInput.setFont(m_myFont);

    try {
      if (m_optionContainer != null && !m_optionContainer.isDisposed()) {
        for (Button opt : m_optionsRadio) {
          opt.setFont(m_myFont);
        }
        m_optionContainer.pack();
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    setRedraw(true);
    m_parent.layout();
  }
Beispiel #27
0
  /**
   * ************************************************************************* Update the available
   * options
   *
   * @param options
   * @param expectedValues ************************************************************************
   */
  private boolean updateOptions(
      Vector<String> options, Vector<String> expectedValues, String defaultOption) {
    if (options == null || options.size() == 0) return false;

    m_optionScroll = new ScrolledComposite(this, SWT.H_SCROLL | SWT.V_SCROLL);
    // DO NOT PUT LAYOUT DATA FOR THE SCROLLED: IT IS ADJUSTED WITH THE SASH
    // EVENTS!

    m_optionContainer = new Composite(m_optionScroll, SWT.NONE);
    m_optionContainer.setLayout(new GridLayout(1, true));

    boolean defaultOptionSet = false;

    if (m_promptDisplayType == PromptDisplayType.RADIO) {
      defaultOptionSet = setupRadioOptions(options, expectedValues, defaultOption);
    } else {
      defaultOptionSet = setupComboOptions(options, expectedValues, defaultOption);
    }
    m_optionContainer.pack();
    m_optionScroll.setContent(m_optionContainer);

    return defaultOptionSet;
  }
Beispiel #28
0
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    parent.getShell().setText(UIText.CommitDialog_CommitChanges);

    container = toolkit.createComposite(container);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
    toolkit.paintBordersFor(container);
    GridLayoutFactory.swtDefaults().applyTo(container);

    final SashForm sashForm = new SashForm(container, SWT.VERTICAL | SWT.FILL);
    toolkit.adapt(sashForm, true, true);
    sashForm.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    createMessageAndPersonArea(sashForm);
    filesSection = createFileSection(sashForm);
    sashForm.setWeights(new int[] {50, 50});

    applyDialogFont(container);
    container.pack();
    commitText.setFocus();
    Image titleImage = UIIcons.WIZBAN_CONNECT_REPO.createImage();
    UIUtils.hookDisposal(parent, titleImage);
    setTitleImage(titleImage);
    setTitle(UIText.CommitDialog_Title);
    setMessage(UIText.CommitDialog_Message, IMessageProvider.INFORMATION);

    filesViewer.addCheckStateListener(
        new ICheckStateListener() {

          public void checkStateChanged(CheckStateChangedEvent event) {
            updateMessage();
          }
        });

    updateFileSectionText();
    return container;
  }
  protected Control createContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, false);
    layout.verticalSpacing = 10;
    composite.setLayout(layout);

    Group grpLocation = new Group(composite, SWT.NONE);
    grpLocation.setText(RM.getLabel("shrtc.location.label"));
    GridLayout grpLayout = new GridLayout(2, false);
    grpLocation.setLayout(grpLayout);
    grpLocation.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    location = new Text(grpLocation, SWT.BORDER);
    GridData mainData2 = new GridData(SWT.FILL, SWT.CENTER, true, false);
    mainData2.widthHint = AbstractWindow.computeWidth(400);
    location.setLayoutData(mainData2);
    location.setText(
        FileSystemManager.getAbsolutePath(new File(initialDirectory, initialFileNameSelected)));
    monitorControl(location);

    Button btnBrowse = new Button(grpLocation, SWT.PUSH);
    btnBrowse.setText(RM.getLabel("common.browseaction.label"));
    btnBrowse.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            File f = new File(location.getText());
            String path =
                application.showFileDialog(
                    FileSystemManager.getParent(f),
                    BackupShortcutWizardWindow.this,
                    FileSystemManager.getName(f),
                    RM.getLabel("app.buildbatch.label"),
                    SWT.SAVE);
            if (path != null) {
              location.setText(path);
            }
          }
        });
    btnBrowse.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));

    Group grpType = new Group(composite, SWT.NONE);
    grpType.setText(RM.getLabel("shrtc.type.label"));
    grpType.setLayout(new GridLayout(1, false));
    grpType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    radIncremental = new Button(grpType, SWT.RADIO);
    radIncremental.setText(RM.getLabel("archivedetail.incremental.label"));
    radIncremental.setToolTipText(RM.getLabel("archivedetail.incremental.tooltip"));
    radIncremental.setSelection(true);

    radDifferential = new Button(grpType, SWT.RADIO);
    radDifferential.setText(RM.getLabel("archivedetail.differential.label"));
    radDifferential.setToolTipText(RM.getLabel("archivedetail.differential.tooltip"));

    radFull = new Button(grpType, SWT.RADIO);
    radFull.setText(RM.getLabel("archivedetail.full.label"));
    radFull.setToolTipText(RM.getLabel("archivedetail.full.tooltip"));

    Group grpScope = new Group(composite, SWT.NONE);
    grpScope.setText(RM.getLabel("shrtc.scope.label"));
    grpScope.setLayout(new GridLayout(1, false));
    grpScope.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    radSelectedOnly = new Button(grpScope, SWT.RADIO);
    radSelectedOnly.setText(RM.getLabel("shrtc.forselected.label"));
    radSelectedOnly.setLayoutData(new GridData());
    radSelectedOnly.setSelection(true);
    radSelectedOnly.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            File loc = new File(location.getText());
            if (FileSystemManager.getName(loc).equals(initialFileNameAll)) {
              location.setText(
                  FileSystemManager.getAbsolutePath(
                      new File(FileSystemManager.getParentFile(loc), initialFileNameSelected)));
            }
          }
        });
    monitorControl(SWT.Selection, radSelectedOnly);

    radAll = new Button(grpScope, SWT.RADIO);
    radAll.setText(RM.getLabel("shrtc.forall.label"));
    radAll.setLayoutData(new GridData());
    radAll.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            File loc = new File(location.getText());
            if (FileSystemManager.getName(loc).equals(initialFileNameSelected)) {
              location.setText(
                  FileSystemManager.getAbsolutePath(
                      new File(FileSystemManager.getParentFile(loc), initialFileNameAll)));
            }
          }
        });
    monitorControl(SWT.Selection, radAll);

    Group grpCheckArchive = new Group(composite, SWT.NONE);
    grpCheckArchive.setText(RM.getLabel("archivedetail.checkgroup.label"));
    grpCheckArchive.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    grpCheckArchive.setLayout(new GridLayout(1, false));

    chkCheckArchive = new Button(grpCheckArchive, SWT.CHECK);
    chkCheckArchive.setText(RM.getLabel("archivedetail.checkarchive.label"));
    chkCheckArchive.setToolTipText(RM.getLabel("archivedetail.checkarchive.tooltip"));
    chkCheckArchive.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
    chkCheckArchive.setSelection(true);
    monitorControl(chkCheckArchive);

    SavePanel pnlSave = new SavePanel(this);
    pnlSave.buildComposite(composite).setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, true));
    saveButton = pnlSave.getBtnSave();

    composite.pack();
    return composite;
  }
Beispiel #30
0
  @Override
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    setControl(container);
    GridLayoutFactory.fillDefaults().numColumns(3).applyTo(container);

    Label lblAcc = new Label(container, SWT.NULL);
    lblAcc.setText(Messages.ColumnAccount);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(lblAcc);

    final Text accountName = new Text(container, SWT.BORDER | SWT.SINGLE);
    GridDataFactory.fillDefaults()
        .grab(true, false)
        .align(SWT.FILL, SWT.CENTER)
        .applyTo(accountName);

    Button button = new Button(container, SWT.PUSH);
    button.setText(Messages.NewFileWizardButtonAdd);
    GridDataFactory.fillDefaults().applyTo(button);

    Composite tableContainer = new Composite(container, SWT.NONE);
    GridDataFactory.fillDefaults().span(3, 1).grab(true, true).applyTo(tableContainer);
    TableColumnLayout layout = new TableColumnLayout();
    tableContainer.setLayout(layout);

    tViewer = new TableViewer(tableContainer);

    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            String acnName = accountName.getText();
            if (acnName.length() > 0) {
              Account currentAccount = new Account();
              currentAccount.setName(acnName);
              client.addAccount(currentAccount);
              tViewer.refresh();

              accountName.setText(""); // $NON-NLS-1$
              accountName.setFocus();
            }
          }
        });

    Table table = tViewer.getTable();
    table.setHeaderVisible(true);
    table.setEnabled(false);

    tViewer.setContentProvider(ArrayContentProvider.getInstance());
    tViewer.setInput(client.getAccounts());
    TableViewerColumn aCol = new TableViewerColumn(tViewer, SWT.NONE);
    layout.setColumnData(aCol.getColumn(), new ColumnWeightData(50));
    aCol.getColumn().setText(Messages.ColumnAccount);
    aCol.setLabelProvider(
        new ColumnLabelProvider() {
          @Override
          public String getText(Object element) {
            return ((Account) element).getName();
          }

          @Override
          public Image getImage(Object element) {
            return PortfolioPlugin.image(PortfolioPlugin.IMG_ACCOUNT);
          }
        });
    container.pack();
    setPageComplete(true);
  }