private void layout() {
   boolean isLoggedOut = isLoggedOut();
   loginComposite.setVisible(isLoggedOut);
   ((GridData) loginComposite.getLayoutData()).exclude = !isLoggedOut;
   logoutComposite.setVisible(!isLoggedOut);
   ((GridData) logoutComposite.getLayoutData()).exclude = isLoggedOut;
   main.getParent().layout(true, true);
 }
 private void showLoadFromFileComponents(boolean b, String fileName) {
   if (b) {
     GridData ldata = (GridData) compFileInputDetails.getLayoutData();
     ldata.exclude = !b;
     compFileInputDetails.setVisible(b);
     lblFilenametxt.setText(fileName);
     pageComposite.layout(new Control[] {lblFilenametxt, linkChangeFile, compFileInputDetails});
   } else {
     GridData ldata = (GridData) compFileInputDetails.getLayoutData();
     ldata.exclude = !b;
     compFileInputDetails.setVisible(b);
     pageComposite.layout(new Control[] {lblFilenametxt, linkChangeFile, compFileInputDetails});
   }
 }
  @Override
  public void createUI(FormToolkit formToolkit) {
    super.createUI(formToolkit);
    GridBuilder widgetBuilder = new GridBuilder(formToolkit, getClientComposite(), 3);
    picker.setState(EControlState.MANDATORY, true);
    Composite composite = getClientComposite();
    GridLayout gl = (GridLayout) composite.getLayout();
    gl.marginWidth = 0;
    gl.marginHeight = 0;
    gl.marginTop = 0;
    gl.marginBottom = 0;
    composite.setLayout(gl);

    GridData gd = (GridData) composite.getLayoutData();
    if (gd == null) gd = GridLayoutFactory.createDefaultLayoutData();
    // calculate horizontal indent for the first widget. take care of the margin width of the grid
    // layout
    // if margin width is greater than indent -> set indent to 0
    //        gd.horizontalIndent = GridLayoutFactory.INDENT_FOR_DECORATORS < gl.marginWidth ? 0 :
    // GridLayoutFactory.INDENT_FOR_DECORATORS - gl.marginWidth;
    gd.horizontalIndent = 0;
    composite.setLayoutData(gd);
    widgetBuilder.add(picker);
    picker.getText().getRCPHyperlink().setVisible(false);
  }
  private void checkPage() {
    try {
      upstreamConfigComponent.setUpstreamConfig(upstreamConfig);

      boolean showUpstreamConfig =
          sourceRefName.startsWith(Constants.R_HEADS)
              || sourceRefName.startsWith(Constants.R_REMOTES);
      Composite container = upstreamConfigComponent.getContainer();
      GridData gd = (GridData) container.getLayoutData();
      if (gd.exclude == showUpstreamConfig) {
        gd.exclude = !showUpstreamConfig;
        container.setVisible(showUpstreamConfig);
        container.getParent().layout(true);
        ensurePreferredHeight(getShell());
      }

      boolean basedOnLocalBranch = sourceRefName.startsWith(Constants.R_HEADS);
      if (basedOnLocalBranch && upstreamConfig != UpstreamConfig.NONE)
        setMessage(UIText.CreateBranchPage_LocalBranchWarningMessage, IMessageProvider.INFORMATION);

      if (sourceRefName.length() == 0) {
        setErrorMessage(UIText.CreateBranchPage_MissingSourceMessage);
        return;
      }
      String message = this.myValidator.isValid(nameText.getText());
      if (message != null) {
        setErrorMessage(message);
        return;
      }

      setErrorMessage(null);
    } finally {
      setPageComplete(getErrorMessage() == null && nameText.getText().length() > 0);
    }
  }
  @Override
  protected void createSearchControl(
      Composite searchComposite, HashMap<String, Control> bindedControls) {
    searchComposite.setLayout(new FormLayout());

    FormData searchCompositeData = (FormData) searchComposite.getLayoutData();
    searchCompositeData.bottom = new FormAttachment(0, 65);
    searchComposite.setLayoutData(searchCompositeData);

    Composite mainSearch = new Composite(searchComposite, SWT.NONE);
    FormData formData = new FormData();
    formData.left = new FormAttachment(0, 0);
    formData.top = new FormAttachment(0, 0);
    formData.right = new FormAttachment(100, 0);
    formData.bottom = new FormAttachment(100, 0);
    mainSearch.setLayoutData(formData);

    String modelFilePath = "com/hhh/platform/ops/ui/run/LogRunViewSearcher.xml";

    InputStream xmlis = getClass().getClassLoader().getResourceAsStream(modelFilePath);
    XMLModelControlsCreator controlsCreator = new XMLModelControlsCreator(xmlis);

    controlsCreator.createContents(mainSearch);
    bindedControls.putAll(controlsCreator.getBindedControls());
  }
  /**
   * 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;
  }
 protected void showTextOnly(boolean show) {
   treeText.setVisible(show);
   ((GridData) treeText.getLayoutData()).exclude = !show;
   dateComposite.setVisible(!show);
   ((GridData) dateComposite.getLayoutData()).exclude = show;
   treeText.getParent().layout(true, true);
 }
  public void createControl(Composite parent) {

    Composite pageContent = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    pageContent.setLayout(layout);
    pageContent.setLayoutData(new GridData(GridData.FILL_BOTH));

    // variable never used ... is pageContent.getLayoutData() needed?
    // GridData outerFrameGridData = (GridData)
    pageContent.getLayoutData();

    //		outerFrameGridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL;
    //		outerFrameGridData.verticalAlignment = GridData.VERTICAL_ALIGN_FILL;

    //    WorkbenchHelp.setHelp(
    //        pageContent,
    //        B2BGUIContextIds.BTBG_SELECT_MULTI_FILE_PAGE);

    createLabels(pageContent);
    createSourceViewer(pageContent);
    createButtonPanel(pageContent);
    createSelectedListBox(pageContent);
    createImportButton(pageContent);

    setControl(pageContent);
    if (isFileMandatory) setPageComplete(false);
  }
 @Override
 protected Control createDialogArea(Composite parent) {
   Composite dialogAreaComposite = (Composite) super.createDialogArea(parent);
   ((GridData) dialogAreaComposite.getLayoutData()).horizontalSpan = 2;
   createMessageArea(dialogAreaComposite);
   createStrategyGroup(dialogAreaComposite);
   return dialogAreaComposite;
 }
 public static boolean hide(Composite section) {
   GridData data = (GridData) section.getLayoutData();
   if (data.exclude == false || data.heightHint != 0 || section.getVisible()) {
     data.heightHint = 0;
     data.exclude = true;
     section.setVisible(false);
     return true;
   }
   return false;
 }
 public static boolean show(Composite section) {
   GridData data = (GridData) section.getLayoutData();
   if (data.exclude == true || data.heightHint != -1 || !section.getVisible()) {
     data.heightHint = -1;
     data.exclude = false;
     section.setVisible(true);
     return true;
   }
   return false;
 }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
   */
  @Override
  protected void adjustForNumColumns(int numColumns) {
    // Adjust the Layout for the given number of columns.
    // The button will get one column, the table all other columns

    GridData buttonsData = (GridData) fButtons.getLayoutData();
    buttonsData.horizontalSpan = 1;

    GridData tableData = (GridData) fTable.getLayoutData();
    tableData.horizontalSpan = numColumns - 1;
  }
Exemple #13
0
  protected void slideRightTo(final int index) {
    if (isMoving == true) return;
    isMoving = true;
    performPreSlideActions(index);
    notifyListeners(SlideEventType.PRE_SLIDE, myCurrentSlideIndex, index);
    final Composite currentSlide = getCurrentSlide();
    final Composite leftComp = getSlide(index);
    final int oldIndex = myCurrentSlideIndex;
    // leftComp.setLayoutData( FormDataMaker.makeFormData(0, 0, 100, 0, 0,
    // -SlideDeck.this.getBounds().width, currentSlide, 0 ) );
    leftComp.setLayoutData(makeSlideRightFormData(currentSlide));
    ((FormData) leftComp.getLayoutData()).width = this.getBounds().width;

    leftComp.setVisible(true);
    final int width = currentSlide.getBounds().width;

    Runnable slideRightAction =
        new Runnable() {
          private int numFrames = 0;

          @Override
          public void run() {
            Display.getDefault()
                .syncExec(
                    new Runnable() {
                      @Override
                      public void run() {
                        FormData fd = (FormData) currentSlide.getLayoutData();
                        fd.right.offset = fd.right.offset + width / 5;
                        fd.left.offset = fd.left.offset + width / 5;
                        if (numFrames == 4) {
                          myFuture.cancel(true);
                          fd.right.offset =
                              currentSlide.getBounds().width + currentSlide.getBounds().width;
                          fd.left.offset = currentSlide.getBounds().width;
                          leftComp.setLayoutData(makeFullFormData());
                          currentSlide.setVisible(false);
                          SlideDeck.this.layout();
                          myCurrentSlideIndex = index;
                          isMoving = false;
                          performPostSlideActions(oldIndex);
                          notifyListeners(SlideEventType.POST_SLIDE, myCurrentSlideIndex, index);
                          return;
                        } else SlideDeck.this.layout();
                        numFrames++;
                      }
                    });
          }
        };
    myFuture =
        myAnimationExecutor.scheduleAtFixedRate(
            slideRightAction, 0, DEFAULT_FRAME_DISPLAY_TIME, TimeUnit.MILLISECONDS);
  }
  /**
   * @inheritDoc このクラスではパネルを正方形に使います。
   * @see IgoOutlinePanel#setSizeHint(Point)
   */
  public void setSizeHint(Point boardSize) {
    ArgumentChecker.throwIfNull(boardSize);

    GridData gridData;
    gridData = (GridData) frame_.getLayoutData();
    gridData.widthHint = boardSize.x;

    int margin = ((GridLayout) frame_.getLayout()).marginWidth;
    gridData = (GridData) boardControl_.getLayoutData();
    gridData.widthHint = boardSize.x - frame_.getBorderWidth() * 2 - margin * 2;
    gridData.heightHint = boardSize.y - frame_.getBorderWidth() * 2 - margin * 2;

    gridData = (GridData) annotationLabel_.getLayoutData();
    gridData.widthHint = boardSize.x - frame_.getBorderWidth() * 2 - margin * 2;
  }
  protected void manageResized() {

    try {

      final RowData layoutData = (RowData) compositeCharts.getLayoutData();
      int size = Math.min(form.getClientArea().width - 40, form.getClientArea().height - 40);
      // not working for this chart !
      //   Point prefered = chartComposites.computeSize(size, SWT.DEFAULT);
      layoutData.width = size;
      layoutData.height = size;

      form.reflow(true);

    } catch (RuntimeException e) {
      // ignore
      e.printStackTrace();
    }
  }
 protected VirtualSourceViewer createViewer(
     Composite parent, IVerticalRuler vertRuler, IOverviewRuler ovRuler) {
   int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION;
   VirtualSourceViewer viewer =
       new VirtualSourceViewer(parent, fVerticalRuler, fOverviewRuler, true, styles);
   viewer.getControl().setLayoutData(parent.getLayoutData());
   viewer.setEditable(false);
   viewer
       .getTextWidget()
       .setFont(JFaceResources.getFont(IInternalCDebugUIConstants.DISASSEMBLY_FONT));
   viewer.setRangeIndicator(new DefaultRangeIndicator());
   getSourceViewerDecorationSupport(viewer);
   viewer.configure(new SourceViewerConfiguration());
   JFaceResources.getFontRegistry().addListener(this);
   JFaceResources.getColorRegistry().addListener(this);
   getEditorPreferenceStore().addPropertyChangeListener(this);
   return viewer;
 }
  /**
   * Resizes the Section's client and updates the Property Viewer's {@link ScrolledComposite} to
   * account for GridLayouts in the client.
   */
  private void resizePropertyView() {
    // Disable re-drawing for the ScrolledComposite.
    scrollComposite.setRedraw(false);

    int verticalPadding = scrollComposite.getHorizontalBar().getSize().y;
    int horizontalPadding = scrollComposite.getVerticalBar().getSize().x;
    Rectangle clientArea = scrollComposite.getClientArea();
    Point clientAreaSize =
        new Point(clientArea.width - horizontalPadding, clientArea.height - verticalPadding);

    // Recompute the size of the first Composite in the ScrolledComposite
    // based on the width of the ScrolledComposite's client area.
    Point size = scrollCompositeClient.computeSize(clientAreaSize.x, clientAreaSize.y);

    // Update the size of the ScrolledComposite's client.
    scrollCompositeClient.setSize(size);

    // Set the minimum size at which the ScrolledComposite will start
    // drawing scroll bars. This should be the size of its client area minus
    // the spaces the scroll bars would consume.
    scrollComposite.setMinSize(clientAreaSize.x + 1, clientAreaSize.y + 1);

    // We need to call layout() so the ScrolledComposite will update.
    scrollComposite.layout();

    // Set the height hint for the Section's parent Composite. This keeps
    // the TableViewer from going beyond the bottom edge of the Properties
    // Viewer. We want to keep the add and delete buttons visible, and the
    // TableViewer already has its own scroll bars!
    Composite sectionParent = section.getParent();
    GridData gridData = (GridData) sectionParent.getLayoutData();
    GridLayout gridLayout = (GridLayout) sectionParent.getParent().getLayout();
    gridData.heightHint = sectionParent.getParent().getSize().y - gridLayout.marginTop;

    // The parent of the Section has a FillLayout. Its parent has a
    // GridLayout, but sometimes it does not update. Tell it to layout so
    // the Section's parent will update its size.
    section.getParent().getParent().layout();

    // Enable re-drawing for the ScrolledComposite.
    scrollComposite.setRedraw(true);

    return;
  }
 private void setOutputInfo() {
   if (allRadio.getSelection()
       && (((GridData) allContainer.getLayoutData()).heightHint == 0
           || ((GridData) specContainer.getLayoutData()).heightHint != 0)) {
     group.setText(All_Title);
     ((GridData) specContainer.getLayoutData()).heightHint = 0;
     ((GridData) allContainer.getLayoutData()).heightHint = SWT.DEFAULT;
     group.layout();
     group.getParent().layout();
   }
   if (specRadio.getSelection()
       && (((GridData) specContainer.getLayoutData()).heightHint == 0
           || ((GridData) allContainer.getLayoutData()).heightHint != 0)) {
     group.setText(Spec_Title);
     ((GridData) specContainer.getLayoutData()).heightHint = SWT.DEFAULT;
     ((GridData) allContainer.getLayoutData()).heightHint = 0;
     group.layout();
     group.getParent().layout();
   }
   dealParentLayout(container);
 }
  private void createContentsForFormattingGroup(Composite parent) {
    Group formattingGroup = createGroup(parent, 2);
    formattingGroup.setText(HTMLUIMessages.Formatting_UI_);

    createLabel(formattingGroup, HTMLUIMessages.Line_width__UI_);
    fLineWidthText = new Text(formattingGroup, SWT.SINGLE | SWT.BORDER);
    GridData gData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.BEGINNING);
    gData.widthHint = 25;
    fLineWidthText.setLayoutData(gData);
    fLineWidthText.addModifyListener(this);

    fSplitMultiAttrs = createCheckBox(formattingGroup, HTMLUIMessages.Split_multiple_attributes);
    ((GridData) fSplitMultiAttrs.getLayoutData()).horizontalSpan = 2;
    fAlignEndBracket = createCheckBox(formattingGroup, HTMLUIMessages.Align_final_bracket);
    ((GridData) fAlignEndBracket.getLayoutData()).horizontalSpan = 2;
    fClearAllBlankLines = createCheckBox(formattingGroup, HTMLUIMessages.Clear_all_blank_lines_UI_);
    ((GridData) fClearAllBlankLines.getLayoutData()).horizontalSpan = 2;

    // [269224] - Place the indent controls in their own composite for proper tab ordering
    Composite indentComposite = createComposite(formattingGroup, 1);
    ((GridData) indentComposite.getLayoutData()).horizontalSpan = 2;
    ((GridLayout) indentComposite.getLayout()).marginWidth = 0;
    ((GridLayout) indentComposite.getLayout()).marginHeight = 0;

    fIndentUsingTabs = createRadioButton(indentComposite, HTMLUIMessages.Indent_using_tabs);
    ((GridData) fIndentUsingTabs.getLayoutData()).horizontalSpan = 1;

    fIndentUsingSpaces = createRadioButton(indentComposite, HTMLUIMessages.Indent_using_spaces);
    ((GridData) fIndentUsingSpaces.getLayoutData()).horizontalSpan = 1;

    createLabel(formattingGroup, HTMLUIMessages.Indentation_size);
    fIndentationSize = new Spinner(formattingGroup, SWT.BORDER);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    fIndentationSize.setLayoutData(gd);
    fIndentationSize.setToolTipText(HTMLUIMessages.Indentation_size_tip);
    fIndentationSize.setMinimum(MIN_INDENTATION_SIZE);
    fIndentationSize.setMaximum(MAX_INDENTATION_SIZE);
    fIndentationSize.setIncrement(1);
    fIndentationSize.setPageIncrement(4);
    fIndentationSize.addModifyListener(this);

    GridData data;

    Composite inlineGroup = new Composite(formattingGroup, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    inlineGroup.setLayout(layout);

    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    inlineGroup.setLayoutData(data);

    Label label = createLabel(inlineGroup, HTMLUIMessages.Inline_elements_table_label);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    label.setLayoutData(data);

    final TableViewer viewer =
        new TableViewer(
            inlineGroup, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 1;
    data.verticalAlignment = SWT.BEGINNING;
    data.heightHint = convertHeightInCharsToPixels(10);
    viewer.getTable().setLayoutData(data);

    Composite buttonContainer = new Composite(inlineGroup, SWT.NONE);
    data = new GridData(GridData.FILL_VERTICAL);
    buttonContainer.setLayoutData(data);
    layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttonContainer.setLayout(layout);

    fAddButton = new Button(buttonContainer, SWT.PUSH);
    fAddButton.setText(HTMLUIMessages.Add_inline);
    fAddButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            HTMLElementDialog dialog = new HTMLElementDialog(getShell());
            dialog.setMessage(HTMLUIMessages.Elements_Dialog_message);
            dialog.setTitle(HTMLUIMessages.Elements_Dialog_title);
            dialog.setMultipleSelection(true);
            dialog.setAllowDuplicates(false);
            dialog.open();
            Object[] result = dialog.getResult();
            if (result != null) {
              for (int i = 0; i < result.length; i++) {
                fContentProvider.addElement(result[i].toString());
              }
              fViewer.refresh();
            }
          }
        });
    data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    data.widthHint = Math.max(widthHint, fAddButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    data.horizontalSpan = 1;
    fAddButton.setLayoutData(data);

    fRemoveButton = new Button(buttonContainer, SWT.PUSH);
    fRemoveButton.setText(HTMLUIMessages.Remove_inline);
    fRemoveButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            ISelection selection = viewer.getSelection();
            if (selection != null
                && !selection.isEmpty()
                && selection instanceof StructuredSelection) {
              Object[] remove = ((StructuredSelection) selection).toArray();
              for (int i = 0; i < remove.length; i++) {
                fContentProvider.removeElement(remove[i].toString());
              }
              if (remove.length > 0) {
                fViewer.refresh();
              }
            }
          }
        });
    data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
    data.horizontalSpan = 1;
    fRemoveButton.setLayoutData(data);

    fViewer = viewer;
    fContentProvider = new ContentProvider();
    viewer.setContentProvider(fContentProvider);
    viewer.setInput(this);
    viewer.setComparator(new ViewerComparator(Collator.getInstance()));
  }
Exemple #20
0
  /**
   * Set whether this is the last item in the breadcrumb item chain or not.
   *
   * @param isLast <code>true</code> if this is the last item, <code>false</code> otherwise
   */
  void setIsLastItem(boolean isLast) {
    fIsLast = isLast;

    GridData data = (GridData) fContainer.getLayoutData();
    data.grabExcessHorizontalSpace = isLast;
  }
Exemple #21
0
  @Override
  protected Control createDialogArea(final Composite parent) {
    final Composite contents = (Composite) super.createDialogArea(parent);

    final GridLayout contentsGridLayout = (GridLayout) contents.getLayout();
    contentsGridLayout.numColumns = LoadCustomizationsDialog.NUM_COLUMNS;

    final GridData contentsGridData = (GridData) contents.getLayoutData();
    contentsGridData.horizontalAlignment = SWT.FILL;
    contentsGridData.verticalAlignment = SWT.FILL;

    createLeftPane(contents);
    createMiddleButtonsPane(contents);
    createRightPane(contents);
    createRightButtonsPane(contents);
    createLoadRequiredFacetsCheckbox(contents);

    this.availableCustomizationsTreeViewer.addDoubleClickListener(
        new IDoubleClickListener() {

          public void doubleClick(final DoubleClickEvent event) {
            loadSelectedCustoms();
          }
        });

    this.selectedCustomizationsTreeViewer.addDoubleClickListener(
        new IDoubleClickListener() {
          public void doubleClick(final DoubleClickEvent event) {
            unloadSelectedCustoms();
          }
        });

    this.upButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent event) {
            upButtonClicked();
          }
        });

    this.downButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent event) {
            downButtonClicked();
          }
        });

    this.addButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent event) {
            loadSelectedCustoms();
          }
        });

    this.addAllButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent event) {
            addAllButtonClicked();
          }
        });

    this.removeButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent event) {
            unloadSelectedCustoms();
          }
        });

    this.removeAllButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent event) {
            removeAllButtonClicked();
          }
        });

    return contents;
  }
 private Composite getCurrentContainer() {
   return ((GridData) allContainer.getLayoutData()).heightHint != 0 ? allContainer : specContainer;
 }
 public void setLocationBarVisible(boolean visible) {
   locationRow.setVisible(visible);
   ((GridData) locationRow.getLayoutData()).exclude = !visible;
   parent.layout();
 }
  private void checkPage() {
    boolean createBranchSelected = createBranch.getSelection();
    branchText.setEnabled(createBranchSelected);
    branchText.setVisible(createBranchSelected);
    branchTextlabel.setVisible(createBranchSelected);
    GridData gd = (GridData) branchText.getLayoutData();
    gd.exclude = !createBranchSelected;
    gd = (GridData) branchTextlabel.getLayoutData();
    gd.exclude = !createBranchSelected;

    boolean createTagSelected = createTag.getSelection();
    tagText.setEnabled(createTagSelected);
    tagText.setVisible(createTagSelected);
    tagTextlabel.setVisible(createTagSelected);
    gd = (GridData) tagText.getLayoutData();
    gd.exclude = !createTagSelected;
    gd = (GridData) tagTextlabel.getLayoutData();
    gd.exclude = !createTagSelected;
    branchText.getParent().layout(true);

    boolean showActivateAdditionalRefs = false;
    showActivateAdditionalRefs =
        (checkout.getSelection() || dontCheckout.getSelection())
            && !Activator.getDefault()
                .getPreferenceStore()
                .getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_ADDITIONAL_REFS);

    gd = (GridData) warningAdditionalRefNotActive.getLayoutData();
    gd.exclude = !showActivateAdditionalRefs;
    warningAdditionalRefNotActive.setVisible(showActivateAdditionalRefs);
    warningAdditionalRefNotActive.getParent().layout(true);

    setErrorMessage(null);
    try {
      if (refText.getText().length() > 0) {
        Change change = Change.fromRef(refText.getText());
        if (change == null) {
          setErrorMessage(UIText.FetchGerritChangePage_MissingChangeMessage);
          return;
        }
      } else {
        setErrorMessage(UIText.FetchGerritChangePage_MissingChangeMessage);
        return;
      }

      boolean emptyRefName =
          (createBranchSelected && branchText.getText().length() == 0)
              || (createTagSelected && tagText.getText().length() == 0);
      if (emptyRefName) {
        setErrorMessage(UIText.FetchGerritChangePage_ProvideRefNameMessage);
        return;
      }

      boolean existingRefName =
          (createBranchSelected && repository.getRef(branchText.getText()) != null)
              || (createTagSelected && repository.getRef(tagText.getText()) != null);
      if (existingRefName) {
        setErrorMessage(
            NLS.bind(UIText.FetchGerritChangePage_ExistingRefMessage, branchText.getText()));
        return;
      }
    } catch (IOException e1) {
      // ignore here
    } finally {
      setPageComplete(getErrorMessage() == null);
    }
  }
Exemple #25
0
  private void initialize(Composite composite, int wHint, int hHint) {
    //		System.out.println("size we got is 11111111111 "+wHint+" "+hHint);

    sizes = new Point[composite.getChildren().length];
    layoutDatas = new Style[composite.getChildren().length];
    childrenBounds = new Rectangle[composite.getChildren().length];
    myLayout = (Style) composite.getLayoutData();

    int marginTop = myLayout.marginTop();
    int marginBottom = myLayout.marginBottom();
    int marginLeft = myLayout.marginLeft();
    int marginRight = myLayout.marginRight();

    totalWidth = marginLeft + marginRight;
    totalHeight = marginTop + marginBottom;

    int currentX = marginLeft, currentY = marginTop;

    boolean startNewRow = true;
    double remainingFraction = 1.0;
    int remainingWidthPixels = totalWidth - marginLeft - marginRight;

    if (wHint != SWT.DEFAULT) {
      remainingWidthPixels = wHint - marginLeft - marginRight;
    }

    for (int i = 0; i < composite.getChildren().length; i++) {
      layoutDatas[i] = (Style) composite.getChildren()[i].getLayoutData();

      int suggestedWidth = SWT.DEFAULT, suggestedHeight = SWT.DEFAULT;

      // width calculations
      if (layoutDatas[i] != null && layoutDatas[i].width() != null) {
        Length width = layoutDatas[i].width();
        if (!width.isFractional() && !width.isNegative()) {
          suggestedWidth = (int) width.getNumber();
          startNewRow = false;
          remainingWidthPixels -= suggestedWidth;
          if (wHint != SWT.DEFAULT) {
            if (remainingWidthPixels <= 0) {
              startNewRow = true;
            }
          }
        } else if (width.isNegative()) {
          // if a new row has just started a negative width doesn't make sense
          if (startNewRow) {
            System.err.println(
                "Warning : we have to start a new row; so negative widths don't make sense. You entered "
                    + width);
            startNewRow = false;
          } else {
            startNewRow = true;
            //        				suggestedWidth = (int) (totalWidth - marginLeft - marginRight -
            // width.getNumber());
            suggestedWidth = remainingWidthPixels;
          }
        } else if (width.isFractional()) { // only remaining case
          // place where ever
          remainingFraction -= width.getNumber();
          startNewRow = false;
          if (wHint != SWT.DEFAULT || totalWidth > marginLeft + marginRight) {
            suggestedWidth =
                (int)
                    (width.getNumber() * (Math.max(wHint, totalWidth) - marginLeft - marginRight));
            remainingWidthPixels -= suggestedWidth;
          }
          if (remainingFraction <= 0) {
            startNewRow = true;
            if (remainingFraction < 0) {
              System.err.println(
                  "Warning : the sum of fractions exceeded 100%. Some portions might be cutoff. "
                      + width);
            }
          }
        }
        //        		System.out.println("suggesting "+suggestedWidth+ " "+suggestedHeight);
        sizes[i] = composite.getChildren()[i].computeSize(suggestedWidth, suggestedHeight, true);
      } else {
        //        		System.out.println("suggesting "+suggestedWidth+ " "+suggestedHeight);
        sizes[i] = composite.getChildren()[i].computeSize(suggestedWidth, suggestedHeight, true);
        if (wHint != SWT.DEFAULT) {
          // we can suggest something
          if (remainingWidthPixels < sizes[i].x) {
            // we don't have that kind of width
            // either ask this one to fit or move to next line
            if (startNewRow) {
              // we are starting a new row. Will have to ask this composite to try to fit
              sizes[i] =
                  composite.getChildren()[i].computeSize(
                      remainingWidthPixels, suggestedHeight, true);
            } else {
              // we should try and fit to the next row
              remainingWidthPixels = Math.max(wHint, totalWidth) - marginLeft - marginRight;
              if (remainingWidthPixels > sizes[i].x) suggestedWidth = SWT.DEFAULT;
              else suggestedWidth = remainingWidthPixels;
              sizes[i] =
                  composite.getChildren()[i].computeSize(suggestedWidth, suggestedHeight, true);
              currentX = marginLeft;
              currentY = totalHeight - marginBottom;
              remainingFraction = 1.0;
            }
          }
        }
        remainingWidthPixels -= sizes[i].x;
        startNewRow = false;
      }

      //            System.out.println("getting "+sizes[i].x+ " "+sizes[i].y);
      childrenBounds[i] = new Rectangle(currentX, currentY, sizes[i].x, sizes[i].y);

      if (startNewRow) {
        totalWidth = Math.max(totalWidth, currentX + sizes[i].x + marginRight);
        currentX = marginLeft;
        totalHeight = Math.max(totalHeight, currentY + sizes[i].y + marginBottom);
        currentY = totalHeight - marginBottom;
        remainingFraction = 1.0;
        remainingWidthPixels = Math.max(wHint, totalWidth) - marginLeft - marginRight;
      } else {
        currentX += sizes[i].x;
        totalWidth = Math.max(totalWidth, currentX + marginRight);
        totalHeight = Math.max(totalHeight, currentY + sizes[i].y + marginBottom);
      }
    }
  }
Exemple #26
0
  protected void updateControls() {
    setMessage(null);
    setErrorMessage(null);
    if (!internalMode) {
      setDescription(UIText.ExistingOrNewPage_DescriptionExternalMode);
      if (this.selectedRepository != null) {
        workDir.setText(this.selectedRepository.getWorkTree().getPath());
        String relativePath = relPath.getText();
        File testFile = new File(this.selectedRepository.getWorkTree(), relativePath);
        if (!testFile.exists())
          setMessage(
              NLS.bind(UIText.ExistingOrNewPage_FolderWillBeCreatedMessage, relativePath),
              IMessageProvider.WARNING);
        IPath targetPath = new Path(selectedRepository.getWorkTree().getPath());
        targetPath = targetPath.append(relPath.getText());
        moveProjectsLabelProvider.targetFolder = targetPath;
        projectMoveViewer.refresh(true);
        browseRepository.setEnabled(true);
        for (Object checked : projectMoveViewer.getCheckedElements()) {
          IProject prj = (IProject) checked;
          IPath projectMoveTarget = targetPath.append(prj.getName());
          boolean mustMove = !prj.getLocation().equals(projectMoveTarget);
          File targetTest = new File(projectMoveTarget.toOSString());
          if (mustMove && targetTest.exists()) {
            setErrorMessage(
                NLS.bind(UIText.ExistingOrNewPage_ExistingTargetErrorMessage, prj.getName()));
            break;
          }
          File parent = targetTest.getParentFile();
          while (parent != null) {
            if (new File(parent, ".project").exists()) { // $NON-NLS-1$
              setErrorMessage(
                  NLS.bind(
                      UIText.ExistingOrNewPage_NestedProjectErrorMessage,
                      new String[] {prj.getName(), targetTest.getPath(), parent.getPath()}));
              break;
            }
            parent = parent.getParentFile();
          }
          // break after the first error
          if (getErrorMessage() != null) break;
        }
      } else workDir.setText(UIText.ExistingOrNewPage_NoRepositorySelectedMessage);
      setPageComplete(
          getErrorMessage() == null
              && selectedRepository != null
              && projectMoveViewer.getCheckedElements().length > 0);
    } else {
      setDescription(UIText.ExistingOrNewPage_description);
      IPath p = proposeNewRepositoryPath(tree.getSelection());
      minumumPath = p;
      if (p != null) {
        repositoryToCreate.setText(p.toOSString());
      } else {
        repositoryToCreate.setText(""); // $NON-NLS-1$
      }
      createRepo.setEnabled(p != null);
      repositoryToCreate.setEnabled(p != null);
      dotGitSegment.setEnabled(p != null);

      boolean pageComplete = viewer.getCheckedElements().length > 0;
      for (Object checkedElement : viewer.getCheckedElements()) {
        String path = ((ProjectAndRepo) checkedElement).getRepo();
        if (((ProjectAndRepo) checkedElement).getRepo() != null && path.equals("")) { // $NON-NLS-1$
          pageComplete = false;
        }
      }
      setPageComplete(pageComplete);
      // provide a warning if Repository is created in workspace
      for (IProject project : myWizard.projects) {
        if (createRepo.isEnabled()
            && ResourcesPlugin.getWorkspace()
                .getRoot()
                .getLocation()
                .isPrefixOf(project.getLocation())) {
          setMessage(
              UIText.ExistingOrNewPage_RepoCreationInWorkspaceCreationWarning,
              IMessageProvider.WARNING);
          break;
        }
      }
    }

    externalComposite.setVisible(!internalMode);
    parentRepoComposite.setVisible(internalMode);
    GridData gd;
    gd = (GridData) parentRepoComposite.getLayoutData();
    gd.exclude = !internalMode;

    gd = (GridData) externalComposite.getLayoutData();
    gd.exclude = internalMode;

    ((Composite) getControl()).layout(true);
  }
Exemple #27
0
 public void fullScreen(boolean isFullScreen) {
   topPanel.setVisible(false == isFullScreen);
   ((GridData) topPanel.getLayoutData()).exclude = isFullScreen;
   shell.layout(true, true);
 }
  /** Create the tableViewer Panel */
  @SuppressWarnings("unused")
  private void createTableViewerPanel(Composite theParent) {
    Composite tablePanel = new Composite(theParent, SWT.NONE);

    // Set the layout
    GridLayout gridLayout = new GridLayout();
    tablePanel.setLayout(gridLayout);

    GridData gridData = new GridData(GridData.FILL_BOTH);
    tablePanel.setLayoutData(gridData);

    // Add header panel

    HEADER_PANEL:
    {
      Composite headerPanel = WidgetFactory.createPanel(tablePanel);
      // ------------------------------
      // Set layout for the Composite
      // ------------------------------
      headerPanel.setLayout(new GridLayout());
      ((GridLayout) headerPanel.getLayout()).numColumns = 3;
      headerPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
      ((GridData) headerPanel.getLayoutData()).minimumHeight = 80;
      // ((GridData)headerPanel.getLayoutData()).grabExcessHorizontalSpace = true;

      // Add general info/instructions text box
      {
        helpText = new Text(headerPanel, SWT.WRAP | SWT.READ_ONLY);
        helpText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
        helpText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
        helpText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
        ((GridData) helpText.getLayoutData()).horizontalSpan = 3;
        ((GridData) helpText.getLayoutData()).heightHint = 40;
        ((GridData) helpText.getLayoutData()).widthHint = 360;

        helpText.setText(Messages.datatypeReconciler_helpText);
      }

      // Add button bar containing:
      // [CHANGE ALL COLUMN DATATYPES] - or - [CONVERT ALL SQL SYMBOLS]
      this.convertAllSqlSymbolsButton =
          WidgetFactory.createButton(
              headerPanel, Messages.datatypeReconciler_convertAllSqlSymbolsLabel);
      this.convertAllSqlSymbolsButton.setToolTipText(
          Messages.datatypeReconciler_convertAllSqlSymbolsTooltip);
      this.convertAllSqlSymbolsButton.setImage(
          UiPlugin.getDefault().getImage(PluginConstants.Images.ARROW_LEFT_ICON));

      this.convertAllSqlSymbolsButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent event) {
              changeAllColumnDatatypesButtonPressed();
            }
          });

      WidgetFactory.createLabel(headerPanel, "   - or -   "); // $NON-NLS-1$

      this.changeAllColumnDatatypesButton =
          WidgetFactory.createButton(
              headerPanel, Messages.datatypeReconciler_convertAllColumnDatatypesLabel);
      this.changeAllColumnDatatypesButton.setToolTipText(
          Messages.datatypeReconciler_convertAllColumnDatatypesTooltip);
      this.changeAllColumnDatatypesButton.setImage(
          UiPlugin.getDefault().getImage(PluginConstants.Images.ARROW_RIGHT_ICON));
      this.changeAllColumnDatatypesButton.setEnabled(false);
      this.changeAllColumnDatatypesButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent event) {
              changeAllColumnDatatypesPressed();
            }
          });
    }

    BINDING_TABLE:
    {
      table = new Table(tablePanel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
      table.setHeaderVisible(true);
      table.setLinesVisible(true);
      table.setLayout(new TableLayout());
      GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
      gd.heightHint = 200;
      table.setLayoutData(gd);

      this.bindingTableViewer = new TableViewer(table);
      this.bindingTableViewer.getControl().setLayoutData(gd);

      this.bindingContentProvider = new BindingContentProvider();

      // create columns

      // | status icon | Source SQL Symbol | <-- | Matched Datatype | ->  | Target Column

      // COLUMN 0 :  STATUS ICON Button
      TableViewerColumn column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT);
      column.setLabelProvider(new TheBindingColumnLabelProvider(0));
      column.getColumn().setText(getSpaces(8));
      column.getColumn().pack();

      // COLUMN 1 : SOURCE SQL SYMBOL
      column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT);
      column.getColumn().setText(Messages.datatypeReconciler_sourceSqlSymbolLabel + getSpaces(100));
      column.setLabelProvider(new TheBindingColumnLabelProvider(1));
      column.getColumn().pack();

      // COLUMN 2 :  LEFT ARROW Button
      column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT);
      column.getColumn().setText(getSpaces(8));
      column.setLabelProvider(new TheBindingColumnLabelProvider(2));
      column.setEditingSupport(new ConvertSymbolEditingSupport(this.bindingTableViewer));
      column.getColumn().pack();
      column.getColumn().setToolTipText(Messages.datatypeReconciler_convertSourceDatatypeTooltip);

      // COLUMN 3 : Matched datatype
      column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT);
      column.getColumn().setText(Messages.datatypeReconciler_matchedTypeLabel + getSpaces(60));
      column.setLabelProvider(new TheBindingColumnLabelProvider(3));
      column.setEditingSupport(new ChangeProposedDatatypeEditingSupport(this.bindingTableViewer));
      column.getColumn().pack();
      column.getColumn().setToolTipText(Messages.datatypeReconciler_matchedDatatypeTooltip);

      // COLUMN 4 : RIGHT ARROW Button
      column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT);
      column.getColumn().setText(getSpaces(8));
      column.setLabelProvider(new TheBindingColumnLabelProvider(4));
      column.setEditingSupport(new ChangeDatatypeEditingSupport(this.bindingTableViewer));
      column.getColumn().pack();
      column.getColumn().setToolTipText(Messages.datatypeReconciler_changeTargetDatatypeTooltip);

      // COLUMN 5 :  Target Column Definition
      column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT);
      column.getColumn().setText(Messages.datatypeReconciler_targetColumnLabel + getSpaces(25));
      column.setLabelProvider(new TheBindingColumnLabelProvider(5));
      column.getColumn().pack();

      bindingTableViewer.setUseHashlookup(true);
      bindingTableViewer.setContentProvider(this.bindingContentProvider);
      bindingTableViewer.setInput(this.bindingListInput);

      updateRowColors();
    }

    // Panel to display selection details
    SELECTION_STATUS_PANEL:
    {
      Composite selectionPanel =
          WidgetFactory.createGroup(
              tablePanel, Messages.datatypeReconciler_selectionPanelInfoLabel);
      // ------------------------------
      // Set layout for the Composite
      // ------------------------------
      selectionPanel.setLayout(new GridLayout());
      ((GridLayout) selectionPanel.getLayout()).numColumns = 2;
      selectionPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
      ((GridData) selectionPanel.getLayoutData()).minimumHeight = 80;

      //			Label selectedSymbolLabel = new Label(selectionPanel, SWT.NONE);
      //			selectedSymbolLabel.setText("Selected Symbol: ");

      symbolConversionLabel = new Label(selectionPanel, SWT.NONE);
      symbolConversionLabel.setText(PluginConstants.EMPTY_STRING);
      symbolConversionLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      symbolConversionLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));

      Label messageLabel = new Label(selectionPanel, SWT.NONE);
      //			messageLabel.setText("Status: ");

      symbolWarningLabel = new Label(selectionPanel, SWT.NONE);
      symbolWarningLabel.setText(PluginConstants.EMPTY_STRING);
      symbolWarningLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      symbolWarningLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
    }
  }