Package org.eclipse.jface.layout

Examples of org.eclipse.jface.layout.PixelConverter


  }
 
 
  @Override
  public void createContents(Composite topControl) {
    PixelConverter pc = new PixelConverter(topControl);
   
    GridData gd;
    gd = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).create();
    gd.heightHint = pc.convertHeightInCharsToPixels(1) / 2;
    SWTFactoryUtil.createLabel(topControl, SWT.LEFT, "", gd);
   
    SWTFactoryUtil.createLabel(topControl, SWT.LEFT, PreferencesMessages.EditorPreferencePage_title1,
      GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).create());
   
    Composite editorComposite = new Composite(topControl, SWT.NONE);
    editorComposite.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).margins(0, 0).create());
    editorComposite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).span(2, 1).create());
   
    colorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
    gd.heightHint = pc.convertHeightInCharsToPixels(12);
    colorList.setLayoutData(gd);
    for(int i = 0; i < editorColorItems.length; i++) {
      colorList.add(editorColorItems[i].label);
    }
    colorList.addSelectionListener(new SelectionAdapter() {
View Full Code Here


 
  @Override
  protected void createContents_layout() {
    GridData textGD = layout2Controls(label, text, false);
   
    PixelConverter pixelConverter = new PixelConverter(text.getParent());
    textGD.widthHint = pixelConverter.convertWidthInCharsToPixels(textLimit + 1);
  }
View Full Code Here

  public Composite createComponent(Composite parent) {
    componentComposite = new Composite(parent, SWT.NULL);
    componentComposite.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).margins(0, 0).create());
   
    Composite tableComposite = createTable(componentComposite);
    PixelConverter conv = new PixelConverter(componentComposite);
    tableComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).
      hint(conv.convertWidthInCharsToPixels(80), SWT.DEFAULT).create());
   
    elementsTableViewer = new CheckboxTableViewerExt<E>(table);
    elementsTableViewer.setContentProvider0(new TableContentProvider());
    elementsTableViewer.setLabelProvider0(createLabelProvider());
   
View Full Code Here

    topControl.setLayout(GridLayoutFactory.fillDefaults().spacing(0, 5).create());
  }
 
  @Override
  protected void createContents(final Composite topControl) {
    PixelConverter pc = new PixelConverter(topControl);
   
    Link openPrefsLink = createOpenPreferencesDialogLink(topControl,
      PreferencesMessages.DLTKEditorColoringConfigurationBlock_link);
    openPrefsLink.setLayoutData(
      gdFillDefaults().hint(pc.convertWidthInCharsToPixels(50), SWT.DEFAULT).create());
   
    createHorizontalSpacer(topControl, 1, pc);
   
    SWTFactoryUtil.createLabel(topControl, SWT.LEFT,
      PreferencesMessages.DLTKEditorPreferencePage_coloring_element,
      gdFillDefaults().create());
   
    Composite editorComposite = createComposite(topControl);
    editorComposite.setLayoutData(
      gdFillDefaults().grab(true, false).create());
    editorComposite.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).margins(0, 0).create());
   
    treeViewer = new TreeViewerExt(editorComposite, SWT.SINGLE | SWT.BORDER);
    treeViewer.setContentProvider(new ElementContentProvider2());
    treeViewer.setLabelProvider(new LabeledTreeElementLabelProvider());
    treeViewer.getTree().setLayoutData(
      gdFillDefaults().hint(pc.convertWidthInCharsToPixels(40), pc.convertHeightInCharsToPixels(10)).create());
    treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      @Override
      public void selectionChanged(SelectionChangedEvent event) {
        handleAppearanceColorListSelectionChanged();
      }
    });
    treeViewer.setInput(coloringOptionsList);
    treeViewer.setExpandedElements(getTreeElements());
   
   
    Composite itemEditorComposite = new Composite(editorComposite, SWT.NONE);
    itemEditorComposite.setLayoutData(
      gdFillDefaults().create());
    itemEditorComposite.setLayout(GridLayoutFactory.swtDefaults().extendedMargins(5, 20, 5, 5).create());
   
    enableField = new CheckBoxField(PreferencesMessages.DLTKEditorPreferencePage_enable);
    enableField.createComponent(itemEditorComposite, gdFillDefaults().create());
   
    colorField = new ColorField(PreferencesMessages.DLTKEditorPreferencePage_color);
    colorField.createComponent(itemEditorComposite, gdFillDefaults().indent(20, 0).create());
    boldCheckboxField = new CheckBoxField(PreferencesMessages.DLTKEditorPreferencePage_bold);
    boldCheckboxField.createComponent(itemEditorComposite, gdFillDefaults().indent(20, 0).create());
    italicCheckboxField = new CheckBoxField(PreferencesMessages.DLTKEditorPreferencePage_italic);
    italicCheckboxField.createComponent(itemEditorComposite, gdFillDefaults().indent(20, 0).create());
    striketroughCheckboxField = new CheckBoxField(PreferencesMessages.DLTKEditorPreferencePage_strikethrough);
    striketroughCheckboxField.createComponent(itemEditorComposite, gdFillDefaults().indent(20, 0).create());
    underlineCheckboxField = new CheckBoxField(PreferencesMessages.DLTKEditorPreferencePage_underline);
    underlineCheckboxField.createComponent(itemEditorComposite, gdFillDefaults().indent(20, 0).create());
   
    enableField.addValueChangedListener(new IFieldValueListener() {
      @Override
      public void fieldValueChanged() {
        SourceColoringElement item = getSelectedColoringItem();
        boolean enabled = enableField.getBooleanFieldValue();
        getOverlayPrefStore().setValue(item.getEnableKey(), enabled);
       
        setColoringEditorControlsEnabled(enabled);
      }
    });
   
    colorField.addValueChangedListener(new IFieldValueListener() {
      @Override
      public void fieldValueChanged() {
        SourceColoringElement item = getSelectedColoringItem();
        PreferenceConverter.setValue(getOverlayPrefStore(), item.getColorKey(), colorField.getFieldValue());
      }
    });
    boldCheckboxField.addValueChangedListener(new IFieldValueListener() {
      @Override
      public void fieldValueChanged() {
        SourceColoringElement item = getSelectedColoringItem();
        getOverlayPrefStore().setValue(item.getBoldKey(), boldCheckboxField.getBooleanFieldValue());
      }
    });
    italicCheckboxField.addValueChangedListener(new IFieldValueListener() {
      @Override
      public void fieldValueChanged() {
        SourceColoringElement item = getSelectedColoringItem();
        getOverlayPrefStore().setValue(item.getItalicKey(), italicCheckboxField.getBooleanFieldValue());
      }
    });
    striketroughCheckboxField.addValueChangedListener(new IFieldValueListener() {
      @Override
      public void fieldValueChanged() {
        SourceColoringElement item = getSelectedColoringItem();
        getOverlayPrefStore().setValue(item.getStrikethroughKey(),
          striketroughCheckboxField.getBooleanFieldValue());
      }
    });
    underlineCheckboxField.addValueChangedListener(new IFieldValueListener() {
      @Override
      public void fieldValueChanged() {
        SourceColoringElement item = getSelectedColoringItem();
        getOverlayPrefStore().setValue(item.getUnderlineKey(), underlineCheckboxField.getBooleanFieldValue());
      }
    });
   
    SWTFactoryUtil.createLabel(topControl, SWT.LEFT,
      PreferencesMessages.DLTKEditorPreferencePage_preview,
      gdFillDefaults().create());
   
   
    Control previewViewerControl = createPreviewViewer(topControl);
    previewViewerControl.setLayoutData(
      gdFillDefaults().hint(pc.convertWidthInCharsToPixels(50), pc.convertHeightInCharsToPixels(15)).
      grab(true, true).
      create());
  }
View Full Code Here

  /**
   * Returns a width hint for a button control.
   */
  public static int getButtonWidthHint(Button button) {
    /*button.setFont(JFaceResources.getDialogFont());*/
    PixelConverter converter= new PixelConverter(button);
    int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
  }
View Full Code Here

*/
class SWTFactory {

  public static int getButtonWidthHint(Button button) {
    button.setFont(JFaceResources.getDialogFont());
    PixelConverter converter = new PixelConverter(button);
    int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
  }
View Full Code Here

*/
class SWTFactory {

  public static int getButtonWidthHint(Button button) {
    button.setFont(JFaceResources.getDialogFont());
    PixelConverter converter = new PixelConverter(button);
    int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.layout.PixelConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.