Пример #1
0
  /** Creates the control for this page of the wizard. */
  public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new FormLayout());

    // creates a label for the title field
    CLabel titleLabel = new CLabel(composite, SWT.LEFT);
    titleLabel.setText("Title: ");
    FormData data = new FormData();
    data.left = new FormAttachment(0, 5);
    data.right = new FormAttachment(33, 0);
    data.top = new FormAttachment(0, 20);
    titleLabel.setLayoutData(data);
    // creates the title input field
    titleText = new Text(composite, SWT.BORDER | SWT.SINGLE);
    data = new FormData();
    data.left = new FormAttachment(titleLabel, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, 20);
    titleText.setLayoutData(data);
    // adds a modify listener to know when its valid to go to the next page
    titleText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            title = titleText.getText();
            setPageComplete(title.length() > 0 && author.length() > 0);
          }
        });
    // creates a label for the author field
    CLabel authorLabel = new CLabel(composite, SWT.LEFT);
    authorLabel.setText("Author: ");
    data = new FormData();
    data.top = new FormAttachment(titleLabel, 10);
    data.left = new FormAttachment(0, 5);
    data.right = new FormAttachment(33, 0);
    authorLabel.setLayoutData(data);
    // creates an author input field
    authorText = new Text(composite, SWT.BORDER | SWT.SINGLE);
    data = new FormData();
    data.top = new FormAttachment(titleText, 10);
    data.left = new FormAttachment(authorLabel, 0);
    data.right = new FormAttachment(100, 0);
    authorText.setLayoutData(data);
    // adds a listener to enable the ability to go to the next page
    authorText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            author = authorText.getText();
            setPageComplete(title.length() > 0 && author.length() > 0);
          }
        });

    setControl(composite);
  }
  /*
   * @see IContributionItem#fill(Composite)
   */
  public void fill(Composite parent) {

    Label sep = new Label(parent, SWT.SEPARATOR);
    fLabel = new CLabel(parent, SWT.SHADOW_NONE);

    fLabel.addDisposeListener(
        new DisposeListener() {
          public void widgetDisposed(DisposeEvent e) {
            fMouseListener = null;
          }
        });
    if (fActionHandler != null) {
      fMouseListener = new Listener();
      fLabel.addMouseListener(fMouseListener);
    }

    StatusLineLayoutData data = new StatusLineLayoutData();
    data.widthHint = getWidthHint(parent);
    fLabel.setLayoutData(data);

    data = new StatusLineLayoutData();
    data.heightHint = getHeightHint(parent);
    sep.setLayoutData(data);

    updateMessageLabel();
  }
Пример #3
0
  protected Control createDialogArea(Composite parent) {
    Composite comp;
    Composite subComp;
    ValidationHandler validationHandler;
    Label label;

    comp = (Composite) super.createDialogArea(parent);
    subComp = new Composite(comp, SWT.NONE);
    subComp.setLayout(new GridLayout(1, false));
    validationHandler = new ValidationHandler();

    // Create pool group.
    createPoolGroup(subComp, validationHandler);

    // Create vertical spacer.
    label = new Label(subComp, SWT.NONE);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Create tab folder.
    tabFolder = new TabFolder(subComp, SWT.NONE);
    tabFolder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    createSignalTab(tabFolder, validationHandler);
    createStackTab(tabFolder, validationHandler);

    // Create error message label.
    errorMessageLabel = new CLabel(subComp, SWT.NONE);
    errorMessageLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Create separator line.
    label = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    applyDialogFont(comp);
    return comp;
  }
  /**
   * @see
   *     org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite,
   *     org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory)
   */
  public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) {
    super.createControls(parent, factory);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);

    // Create label first then attach other control to it
    CLabel nameLabel = getWidgetFactory().createCLabel(composite, NAME);

    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106
    Point p = nameLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
    int labelWidth = Math.max(p.x, 98);
    FormData data = new FormData(labelWidth, SWT.DEFAULT);
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(0, 0);
    nameLabel.setLayoutData(data);

    nameText = getWidgetFactory().createText(composite, ""); // $NON-NLS-1$
    data = new FormData();
    data.left = new FormAttachment(nameLabel, -ITabbedPropertyConstants.HSPACE);
    data.right = new FormAttachment(100);
    data.top = new FormAttachment(nameLabel, 0, SWT.CENTER);
    nameText.setLayoutData(data);
    nameText.addListener(SWT.Modify, this);

    // listener.startListeningForEnter(nameText);
    // listener.startListeningTo(nameText);
  }
Пример #5
0
  public StereotypeImageEditor(Composite parent, int style) {

    TabbedPropertySheetWidgetFactory factory = AbstractEditor.factory;

    composite = factory.createFlatFormComposite(parent);
    FormData data;

    browseButton = factory.createButton(composite, "", SWT.PUSH); // $NON-NLS-1$
    browseButton.setImage(Activator.getDefault().getImage(addImagePath));
    removeButton = factory.createButton(composite, "", SWT.PUSH); // $NON-NLS-1$
    removeButton.setImage(Activator.getDefault().getImage("/icons/delete.gif")); // $NON-NLS-1$
    CLabel iconLabel = factory.createCLabel(composite, "Content: ");

    // browseButton layout
    data = new FormData();
    data.left = new FormAttachment(0, 85);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.HSPACE);
    browseButton.setLayoutData(data);

    // removeButton layout
    data = new FormData();
    data.left = new FormAttachment(browseButton, ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(browseButton, 0, SWT.CENTER);
    removeButton.setLayoutData(data);

    // iconLabel layout
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(browseButton, 0, SWT.CENTER);
    iconLabel.setLayoutData(data);

    browseButton.addSelectionListener(this);

    removeButton.addSelectionListener(this);
  }
Пример #6
0
  /**
   * Provide layout and listeners for the controls.
   *
   * @param parent
   */
  private void addLayout(Composite parent) {
    FormData data;

    // http://www.eclipse.org/forums/index.php/t/202738/
    final FormLayout layout = new FormLayout();
    layout.marginWidth = 4;
    layout.marginHeight = 0;
    layout.spacing = 10; // 100;
    parent.setLayout(layout);

    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(nameTextVal, 0, SWT.CENTER);
    valueLabel.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(valueLabel, 0);
    // data.right = new FormAttachment(100, 0);
    // data.right = new FormAttachment(50, 0);
    data.width = 200;
    data.top = new FormAttachment(0, VSPACE);
    // data.width = SWT.BORDER;
    nameTextVal.setLayoutData(data);

    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.width = 200;
    // data.right = new FormAttachment(100, 0);
    // data.right = new FormAttachment(50, 0);
    data.top = new FormAttachment(nameTextVal, VSPACE);
    // data.width = SWT.BORDER;
    allowedModes.setLayoutData(data);
  }
  /** {@inheritDoc} */
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);
    /*
     * We set the color as it's a InterpretedExpression
     */
    text.setBackground(SiriusEditor.getColorRegistry().get("yellow"));

    text.setToolTipText(getToolTipText());

    help = getWidgetFactory().createCLabel(composite, "");
    FormData data = new FormData();
    data.top = new FormAttachment(text, 0, SWT.TOP);
    data.left = new FormAttachment(nameLabel);
    help.setLayoutData(data);
    help.setImage(getHelpIcon());
    help.setToolTipText(getToolTipText());
    nameLabel.setFont(SiriusEditor.getFontRegistry().get("required"));

    TypeContentProposalProvider.bindPluginsCompletionProcessors(this, text);

    // Start of user code create controls

    // End of user code create controls

  }
  /**
   * Constructor for TabbedPropertyTitle.
   *
   * @param parent the parent composite.
   * @param factory the widget factory for the tabbed property sheet
   */
  public TabbedPropertyTitle(Composite parent, TabbedPropertySheetWidgetFactory factory) {
    super(parent, SWT.NO_FOCUS);
    this.factory = factory;

    // RAP not suppported
    //		this.addPaintListener(new PaintListener() {
    //
    //			public void paintControl(PaintEvent e) {
    //				if (image == null && (text == null || text.equals(BLANK))) {
    //					label.setVisible(false);
    //				} else {
    //					label.setVisible(true);
    //					drawTitleBackground(e);
    //				}
    //			}
    //		});
    // /RAP

    factory.getColors().initializeSectionToolBarColors();
    setBackground(factory.getColors().getBackground());
    setForeground(factory.getColors().getForeground());

    FormLayout layout = new FormLayout();
    layout.marginWidth = 1;
    layout.marginHeight = 2;
    setLayout(layout);

    Font font;
    if (!JFaceResources.getFontRegistry().hasValueFor(TITLE_FONT)) {
      FontData[] fontData =
          JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT).getFontData();
      /* title font is 2pt larger than that used in the tabs. */
      fontData[0].setHeight(fontData[0].getHeight() + 2);
      JFaceResources.getFontRegistry().put(TITLE_FONT, fontData);
    }
    font = JFaceResources.getFont(TITLE_FONT);

    label = factory.createCLabel(this, BLANK);
    //		label.setBackground(new Color[] {
    //				factory.getColors().getColor(IFormColors.H_GRADIENT_END),
    //				factory.getColors().getColor(IFormColors.H_GRADIENT_START) },
    //				new int[] { 100 }, true);
    label.setFont(font);
    label.setForeground(factory.getColors().getColor(IFormColors.TITLE));
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    label.setLayoutData(data);

    /*
     * setImage(PlatformUI.getWorkbench().getSharedImages().getImage(
     * ISharedImages.IMG_OBJ_ELEMENT));
     */
  }
 private CLabel createLabel(
     Composite parent, String text, Control control, TabbedPropertySheetWidgetFactory factory) {
   CLabel label = factory.createCLabel(parent, text); // $NON-NLS-1$
   FormData data = new FormData();
   data.left = new FormAttachment(0, 0);
   data.right = new FormAttachment(control, -HSPACE);
   data.top = new FormAttachment(control, 0, SWT.TOP);
   label.setLayoutData(data);
   return label;
 }
  public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);

    CLabel nameLabel = getWidgetFactory().createCLabel(composite, label);
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, 0);
    nameLabel.setLayoutData(data);
  }
 private CLabel createLabel(Composite parent, String text, Control control) {
   CLabel label = new CLabel(parent, SWT.NONE);
   label.setText(text);
   FormData data = new FormData();
   data.left = new FormAttachment(0, 0);
   data.right = new FormAttachment(control, -HSPACE);
   data.top = new FormAttachment(control, 0, SWT.TOP);
   label.setLayoutData(data);
   label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
   return label;
 }
    @Override
    public Control createDialogArea(Composite parent) {
      super.createDialogArea(parent);

      errorMessageLabel = new CLabel(parent, SWT.LEFT_TO_RIGHT);
      errorMessageLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
      errorMessageLabel.setImage(
          PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK));
      errorMessageLabel.setVisible(false);

      return parent;
    }
Пример #13
0
  public TagLabel(Composite parent, int style, String tagName) {
    super(parent, style);
    if (tagName == null || tagName.length() == 0) {
      throw new IllegalArgumentException("tag name is empty");
    }
    this.tagName = tagName;
    GridLayout gl = new GridLayout(2, false);
    GUIUtil.resetGridLayout(gl);
    super.setLayout(gl);

    final CLabel cross = new CLabel(this, 0);
    cross.setText("×");
    GridData data = new GridData(SWT.LEFT, SWT.TOP, false, true);
    cross.setLayoutData(data);
    data = new GridData(SWT.RIGHT, SWT.TOP, true, true);
    CLabel tagText = new CLabel(this, 0);
    tagText.setText(tagName);

    plainFont = cross.getFont();
    FontData fd = plainFont.getFontData()[0];
    boldFont = new Font(cross.getDisplay(), fd.getName(), fd.getHeight(), SWT.BOLD);
    cross.addListener(
        SWT.MouseEnter,
        new Listener() {

          @Override
          public void handleEvent(Event event) {
            cross.setFont(boldFont);
            cross.setCursor(handCursor);
          }
        });
    cross.addListener(
        SWT.MouseExit,
        new Listener() {

          @Override
          public void handleEvent(Event event) {
            cross.setFont(plainFont);
            cross.setCursor(defaultCursor);
          }
        });
    cross.addListener(
        SWT.MouseDown,
        new Listener() {

          @Override
          public void handleEvent(Event event) {
            if (delegate != null) {
              delegate.tagLabelClicked(TagLabel.this);
            }
          }
        });
  }
  /**
   * @see
   *     org.eclipse.ui.views.properties.tabbed.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite,
   *     org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
   */
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    parent =
        getWidgetFactory().createSection(parent, Messages.LocationSection_locationLabel, true, 4);
    section = (ExpandableComposite) parent.getParent();

    ASPropertyWidget pw = createWidget4Property(parent, JRDesignElement.PROPERTY_X);
    CLabel lbl = pw.getLabel();
    lbl.setText(Messages.LocationSection_xCoordinateLabel);
    lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    pw = createWidget4Property(parent, JRDesignElement.PROPERTY_Y);
    lbl = pw.getLabel();
    lbl.setText(Messages.LocationSection_yCoordinateLabel);
    lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    ASPropertyWidget w = createWidget4Property(parent, JRDesignElement.PROPERTY_POSITION_TYPE);
    GridData gd = new GridData();
    gd.horizontalSpan = 3;
    w.getControl().setLayoutData(gd);
  }
  /**
   * @see
   *     org.eclipse.emf.ecoretools.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
   */
  protected void setSectionData(Composite composite) {
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(fileChooser, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    labelText.setLayoutData(data);

    data = new FormData();
    data.left =
        new FormAttachment(0, getStandardLabelWidth(composite, new String[] {getLabelText()}));
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(labelText, 0, SWT.CENTER);
    fileChooser.setLayoutData(data);
  }
Пример #16
0
 /**
  * Creates a new <code>CLabel</code> that will wrap at the specified width and has the specified
  * image
  *
  * @param parent the parent to add this label to
  * @param text the text for the label
  * @param image the image for the label
  * @param hspan the h span to take up in the parent
  * @param wrapwidth the with to wrap at
  * @return a new <code>CLabel</code>
  * @since 3.3
  */
 public static CLabel createWrapCLabel(
     Composite parent, String text, Image image, int hspan, int wrapwidth) {
   CLabel label = new CLabel(parent, SWT.NONE | SWT.WRAP);
   label.setFont(parent.getFont());
   if (text != null) {
     label.setText(text);
   }
   if (image != null) {
     label.setImage(image);
   }
   GridData gd = new GridData(GridData.FILL_HORIZONTAL);
   gd.horizontalSpan = hspan;
   gd.widthHint = wrapwidth;
   label.setLayoutData(gd);
   return label;
 }
  /** {@inheritDoc} */
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);
    combo.setToolTipText(
        "Tool to call when the user ask for deletion. If you don't set this reference then\nthe default behavior is to remove all the associated semantic elements.");

    CLabel help = getWidgetFactory().createCLabel(composite, "");
    FormData data = new FormData();
    data.top = new FormAttachment(combo, 0, SWT.TOP);
    data.left = new FormAttachment(nameLabel);
    help.setLayoutData(data);
    help.setImage(getHelpIcon());
    help.setToolTipText(
        "Tool to call when the user ask for deletion. If you don't set this reference then\nthe default behavior is to remove all the associated semantic elements.");
    // Start of user code create controls

    // End of user code create controls
  }
Пример #18
0
  public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);

    nameText = getWidgetFactory().createText(composite, "");
    FormData data = new FormData();
    data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    nameText.setLayoutData(data);
    nameText.addModifyListener(this);

    CLabel labelLabel = getWidgetFactory().createCLabel(composite, "Name:");
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(nameText, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(nameText, 0, SWT.CENTER);
    labelLabel.setLayoutData(data);
  }
  /** {@inheritDoc} */
  @Override
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    final TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
    final Composite composite = factory.createFlatFormComposite(parent);
    FormData data;

    nameWidget = factory.createText(composite, "");
    data = new FormData();
    data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, VSPACE);
    nameWidget.setLayoutData(data);

    CLabel valueLabel = factory.createCLabel(composite, "Name");
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(nameWidget, -HSPACE);
    data.top = new FormAttachment(nameWidget, 0, SWT.CENTER);
    valueLabel.setLayoutData(data);
  }
  @Override
  public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
    Composite composite = factory.createFlatFormComposite(parent);
    FormData data;

    Group transactionGroup = factory.createGroup(composite, "Policy Details");
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, VSPACE);
    transactionGroup.setLayoutData(data);
    transactionGroup.setLayout(new FormLayout());

    _interactionCombo =
        factory.createCCombo(transactionGroup, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
    _interactionCombo.add("None");
    for (String label : _supportedInteractionPolicies) {
      _interactionCombo.add(label);
    }
    data = new FormData();
    data.left = new FormAttachment(5, 100);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, VSPACE);
    _interactionCombo.setLayoutData(data);

    _interactionComboLabel = factory.createCLabel(transactionGroup, "Transaction Policy:");
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(_interactionCombo, -HSPACE);
    data.top = new FormAttachment(_interactionCombo, 0, SWT.CENTER);
    _interactionComboLabel.setLayoutData(data);

    _interactionCombo.addSelectionListener(new ComboSelectionListener());

    addDomainListener();
  }
  private void createGroupLow(Composite container) {
    // private void createGroupLow() {
    GridData gridData1 = new GridData();
    gridData1.grabExcessHorizontalSpace = true;
    gridData1.verticalAlignment = GridData.CENTER;
    gridData1.horizontalAlignment = GridData.FILL;
    GridData gridData2 = new GridData();
    gridData2.horizontalAlignment = GridData.FILL;
    gridData2.verticalAlignment = GridData.CENTER;
    gridData2.grabExcessHorizontalSpace = true;
    GridData gridData3 = new GridData();
    gridData3.horizontalIndent = 10;
    GridData gridData4 = new GridData();
    gridData4.horizontalIndent = 26;
    GridData gridData5 = new GridData();
    gridData5.horizontalIndent = 26;
    GridData gridData6 = new GridData();
    gridData6.horizontalIndent = 26;

    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    gridLayout.horizontalSpacing = 25;
    gridLayout.marginWidth = 6;
    gridLayout.verticalSpacing = 10;

    groupLow = new Group(container, SWT.SHADOW_OUT);
    groupLow.setLayout(gridLayout);
    groupLow.setLayoutData(gridData1);

    cLabel = new CLabel(groupLow, SWT.NONE);
    cLabel.setText(
        "Selezionare delle seguenti voci per indicare gli elementi da visualizzare sul grafo:");
    cLabel.setLayoutData(gridData2);

    chkAllPath = new Button(groupLow, SWT.CHECK);
    chkAllPath.setText("Visualizza tutti i percorsi");
    chkAllPath.setLayoutData(gridData3);
    chkAllPath.setSelection(true);

    chkAllPath.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // super.widgetSelected(e);
            if (!chkAllPath.getSelection()) {
              chkOnlyObject.setEnabled(true);
              chkOnlyAspect.setEnabled(true);
            } else {
              chkOnlyObject.setEnabled(false);
              chkOnlyAspect.setEnabled(false);
            }
            dialogChanged();
          }
        });

    chkOnlyObject = new Button(groupLow, SWT.CHECK);
    chkOnlyObject.setText("Includi i percorsi di soli nodi object");
    chkOnlyObject.setLayoutData(gridData4);
    chkOnlyObject.setSelection(true);
    chkOnlyObject.setEnabled(false);
    chkOnlyObject.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            dialogChanged();
          }
        });

    chkOnlyAspect = new Button(groupLow, SWT.CHECK);
    chkOnlyAspect.setText("Includi i percorsi di soli nodi aspect");
    chkOnlyAspect.setLayoutData(gridData5);
    chkOnlyAspect.setSelection(true);
    chkOnlyAspect.setEnabled(false);
    chkOnlyAspect.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            dialogChanged();
          }
        });
  }
  /**
   * Create the composite
   *
   * @param parent
   * @param style
   */
  public PigCategoryComposite(Composite parent, int style, CategoryManager manager) {
    super(parent, style);
    this.manager = manager;
    setLayout(new FillLayout());

    final SashForm sashForm = new SashForm(this, SWT.NONE);
    final SashForm sashForm1 = new SashForm(sashForm, SWT.HORIZONTAL);

    final Composite composite = new Composite(sashForm1, SWT.BORDER);
    final GridLayout gridLayout = new GridLayout();
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    gridLayout.verticalSpacing = 0;
    gridLayout.horizontalSpacing = 0;
    composite.setLayout(gridLayout);

    final CLabel categoryLabel = new CLabel(composite, SWT.SHADOW_OUT);
    categoryLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    categoryLabel.setText(Messages.getString("CategoryComposite.category")); // $NON-NLS-1$

    final ListViewer categoryViewer = new ListViewer(composite, SWT.V_SCROLL | SWT.H_SCROLL);
    categoryViewer.setLabelProvider(
        new LabelProvider() {

          @Override
          public String getText(Object element) {
            return ((Category) element).getName();
          }
        });
    categoryViewer.setContentProvider(new ArrayContentProvider());
    categoryViewer.setSorter(new ViewerSorter());
    categoryList = categoryViewer.getList();
    categoryList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    final Composite composite1 = new Composite(sashForm1, SWT.BORDER);
    final GridLayout gridLayout1 = new GridLayout();
    gridLayout1.verticalSpacing = 0;
    gridLayout1.horizontalSpacing = 0;
    gridLayout1.marginWidth = 0;
    gridLayout1.marginHeight = 0;
    composite1.setLayout(gridLayout1);

    final CLabel functionLabel = new CLabel(composite1, SWT.SHADOW_OUT);
    functionLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    functionLabel.setText(Messages.getString("CategoryComposite.functions")); // $NON-NLS-1$

    functionViewer = new ListViewer(composite1, SWT.V_SCROLL | SWT.H_SCROLL);
    functionViewer.setContentProvider(new ArrayContentProvider());
    functionViewer.setLabelProvider(
        new LabelProvider() {

          @Override
          public String getText(Object element) {
            return ((Function) element).getName();
          }
        });
    functionViewer.setSorter(new ViewerSorter());
    functionList = functionViewer.getList();
    functionList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    // create DND in Expression Editor. This is CategoryComposite drag.
    DragSource source = new DragSource(functionList, DND.DROP_MOVE | DND.DROP_COPY);
    source.setTransfer(new Transfer[] {textTransfer});
    source.addDragListener(
        new DragSourceListener() {

          @Override
          public void dragStart(DragSourceEvent event) {
            if (functionList.getSelection().equals("")) {
              event.doit = false;
            }
          }

          @Override
          public void dragSetData(DragSourceEvent event) {
            if (textTransfer.isSupportedType(event.dataType)) {
              Function function =
                  (Function)
                      ((IStructuredSelection) functionViewer.getSelection()).getFirstElement();
              VirtualMetadataColumn column = new VirtualMetadataColumn();
              column.setTalendType(function.getTalendType().getName());
              column.setFunction(function);
              if (function.isUserDefined()) {
                event.data = (JavaUtils.JAVA_PIGUDF_DIRECTORY + "." + function.getName() + "()");
              } else {
                event.data = (FunctionManagerExt.getOneColData(column, false));
              }
            }
          }

          @Override
          public void dragFinished(DragSourceEvent event) {}
        });

    sashForm1.setWeights(new int[] {1, 1});

    Composite docComposite = new Composite(sashForm, SWT.BORDER);
    GridLayout docLayout = new GridLayout();
    docLayout.marginTop = 0;
    docLayout.marginBottom = 0;
    docLayout.marginHeight = 0;
    docLayout.marginLeft = 0;
    docLayout.marginWidth = 0;
    docLayout.marginHeight = 0;
    docComposite.setLayout(docLayout);

    Label docLabel = new Label(docComposite, SWT.NONE);
    docLabel.setText(Messages.getString("CategoryComposite.Help")); // $NON-NLS-1$

    if (TalendPropertiesUtil.isEnabledUseBrowser()) {
      final Browser docDisplayer = new Browser(docComposite, SWT.BORDER);
      docDisplayer.setText(
          Messages.getString("CategoryComposite.SelectCategoryAndFunction")); // $NON-NLS-1$
      docDisplayer.setLayoutData(new GridData(GridData.FILL_BOTH));
      sashForm.setWeights(new int[] {2, 1});
      new UIRelationShipLinker(categoryViewer, functionViewer, docDisplayer);
    } else {
      final Text descriptionText = new Text(docComposite, SWT.BORDER | SWT.WRAP);
      descriptionText.setText(
          Messages.getString("CategoryComposite.SelectCategoryAndFunction")); // $NON-NLS-1$
      GridData gd = new GridData(GridData.FILL_BOTH);
      descriptionText.setLayoutData(gd);
      sashForm.setWeights(new int[] {2, 1});
      new UIRelationShipLinker(categoryViewer, functionViewer, descriptionText);
    }
    initializeData(categoryViewer);
    categoryViewer.getList().setFocus();
  }
  public void display() throws Exception {
    /*
     * Create the display and shell.
     */
    display = new Display();
    final Shell shell = new Shell(display);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.verticalSpacing = 3;
    shell.setLayout(layout);
    /*
     * Create a toolbar
     */
    {
      ToolBar toolbar = new ToolBar(shell, SWT.FLAT | SWT.RIGHT | SWT.NO_FOCUS);
      toolbar.setForeground(display.getSystemColor(SWT.COLOR_RED));
      toolbar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
      ToolItem item = new ToolItem(toolbar, SWT.PUSH);
      item.setText("File");
      item = new ToolItem(toolbar, SWT.PUSH);
      item.setText("Edit");
      item = new ToolItem(toolbar, SWT.PUSH);
      item.setText("Help");
    }

    if (styleSheetStream == null) {
      // Create Styles themes
      createThemesStyleComposite(shell);
    }

    /*
     * Create a sash form.
     */
    SashForm form = new SashForm(shell, SWT.NONE);
    form.setLayoutData(new GridData(GridData.FILL_BOTH));
    /*
     * Create the buddylist tree.
     */
    {
      tree = new Tree(form, SWT.SINGLE);
      tree.addSelectionListener(
          new SelectionListener() {
            public void widgetDefaultSelected(SelectionEvent e) {
              if (((TreeItem) e.item).getParentItem() != null) {
                try {
                  createChatControl(e.item);
                } catch (Exception ex) {
                  ex.printStackTrace();
                }
              }
            }

            public void widgetSelected(SelectionEvent e) {}
          });
      for (int i = 0; i < GROUPS.length; i++) {
        String g = GROUPS[i];
        TreeItem parentItem = new TreeItem(tree, SWT.NONE);
        parentItem.setText(g);
        for (int j = 0; j < NAMES.length; j++) {
          String n = NAMES[j];
          TreeItem item = new TreeItem(parentItem, SWT.NONE);
          item.setText(n);
        }
        parentItem.setExpanded(true);
      }
    }
    /*
     * Add the tabfolder
     */
    {
      tabFolder = new CTabFolder(form, SWT.CLOSE);
      tabFolder.setUnselectedCloseVisible(true);
      tabFolder.setUnselectedImageVisible(true);
      form.setWeights(new int[] {30, 70});
      // open a couple chats
      createChatControl(tree.getItem(0).getItems()[0]);
      createChatControl(tree.getItem(0).getItems()[1]);
      tabFolder.setSelection(tabFolder.getItem(0));
    }
    /*
     * Create a statusbar
     */
    {
      CLabel statusbar = new CLabel(shell, SWT.NONE);
      GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
      statusbar.setLayoutData(gd);
      statusbar.setText("Samantha Daryn is online");
    }
    /*
     * StyleHelper is used to parse and apply styles.
     */
    engine = getCSSEngine();
    if (styleSheetStream != null) {
      engine.parseStyleSheet(styleSheetStream);
      engine.applyStyles(shell, true);
    }
    /*
     * Now we open the shell.
     */
    shell.setSize(new Point(600, 600));
    shell.open();
    shell.setText("CSS Instant Messaging");
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
Пример #24
0
  @Override
  protected void createAdvanced(final Composite parent) {

    final File source = new File(getSourcePath(context));
    setPath(source.getParent() + File.separator + "output");

    final ExpandableComposite advancedComposite = new ExpandableComposite(parent, SWT.NONE);
    advancedComposite.setExpanded(false);
    advancedComposite.setText("Advanced");
    advancedComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1));

    final Composite advanced = new Composite(parent, SWT.NONE);
    advanced.setLayout(new GridLayout(3, false));
    advanced.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1));

    Label label = new Label(advanced, SWT.NULL);
    label.setLayoutData(new GridData());
    label.setText("Image Format");

    final CCombo imf = new CCombo(advanced, SWT.READ_ONLY | SWT.BORDER);
    imf.setItems(IMAGE_FORMATS);
    imf.select(0);
    imageFormat = "tif";
    imf.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    label = new Label(advanced, SWT.NULL);
    label.setLayoutData(new GridData());
    label.setText("Bit Depth");

    final CCombo bd = new CCombo(advanced, SWT.READ_ONLY | SWT.BORDER);
    bd.setItems(getStringArray(BIT_DEPTHS.get(imageFormat)));
    bd.select(0);
    bitDepth = 32;
    bd.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    bd.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            final String str = bd.getItem(bd.getSelectionIndex());
            bitDepth = Integer.parseInt(str);
            GridUtils.setVisible(warningLabel, bitDepth < 32);
            warningLabel.getParent().layout();
            pathChanged();
          }
        });
    imf.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            imageFormat = imf.getItem(imf.getSelectionIndex());

            final int[] depths = BIT_DEPTHS.get(imageFormat);
            final String[] sa = getStringArray(depths);
            bd.setItems(sa);
            bitDepth = depths[0];
            bd.select(0);
            GridUtils.setVisible(warningLabel, bitDepth < 32);
            warningLabel.getParent().layout();
            pathChanged();
          }
        });

    this.warningLabel = new CLabel(advanced, SWT.NONE);
    warningLabel.setImage(Activator.getImage("icons/warning.gif"));
    warningLabel.setText("Lower dit depths will not support larger data values.");
    warningLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
    GridUtils.setVisible(warningLabel, false);

    label = new Label(advanced, SWT.NULL);
    label.setLayoutData(new GridData());
    label.setText("Image Prefix");

    this.imagePrefixBox = new Text(advanced, SWT.BORDER);
    imagePrefixBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    imagePrefixBox.setText("image");

    label = new Label(advanced, SWT.NULL);
    label.setLayoutData(new GridData());
    label.setText("Slice Index Format");

    this.sliceIndexFormat = new Text(advanced, SWT.BORDER);
    sliceIndexFormat.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    sliceIndexFormat.setText("#000");
    label = new Label(advanced, SWT.NULL);
    label.setLayoutData(new GridData());

    GridUtils.setVisible(advanced, false);
    ExpansionAdapter expansionListener =
        new ExpansionAdapter() {
          @Override
          public void expansionStateChanged(ExpansionEvent e) {
            GridUtils.setVisible(advanced, !advanced.isVisible());
            parent.layout(new Control[] {advanced, advancedComposite});
            Composite comp = parent.getParent();
            if (comp instanceof ScrolledComposite) {
              Rectangle r = ((ScrolledComposite) comp).getClientArea();
              ((ScrolledComposite) comp).setMinSize(parent.computeSize(r.width, SWT.DEFAULT));
              parent.layout();
            } else {
              parent.layout();
              parent.getParent().layout();
            }
          }
        };
    advancedComposite.addExpansionListener(expansionListener);
  }
  /** Create the Panel for resolving sql symbols */
  private void createResolveSqlPanel(Composite parent) {
    Group newGroup = WidgetFactory.createGroup(parent, RESOLVE_SQL_GROUP_NAME);
    GridLayout gridLayout = new GridLayout();
    newGroup.setLayout(gridLayout);
    gridLayout.numColumns = 3;
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    gridLayout.marginLeft = 5;
    gridLayout.marginBottom = 5;
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    newGroup.setLayoutData(gridData);
    newGroup.setText(SQL_SYMBOL_TXT);
    // SQL Symbol Label
    // --------------------------------------
    sqlSymbolLabel =
        WidgetFactory.createLabel(newGroup, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // $NON-NLS-1$
    GridData gdSSL =
        new GridData(
            GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_FILL, false, false, 3, 1);
    sqlSymbolLabel.setLayoutData(gdSSL);
    sqlSymbolLabel.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLUE));

    // Symbol RuntimeType Label
    // --------------------------------------
    Label rtTypeLabel = WidgetFactory.createLabel(newGroup, RUNTIME_TYPE_TXT);
    GridData gdRT =
        new GridData(
            GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_FILL, false, false, 2, 1);
    rtTypeLabel.setLayoutData(gdRT);
    // WidgetFactory.createLabel(newGroup, "");

    Binding binding = bindingList.get(0);
    Object symbol = binding.getCurrentSymbol();
    String text = getLabelText(symbol);
    symbolRuntimeTypeLabel =
        WidgetFactory.createLabel(
            newGroup, text, GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL);

    // Available Conversion Title Label
    // --------------------------------------
    Label cvLabel =
        WidgetFactory.createLabel(
            newGroup, GridData.HORIZONTAL_ALIGN_BEGINNING, CONVERTED_SYMBOL_TXT);
    GridData gdCV =
        new GridData(
            GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_FILL, false, false, 2, 1);
    cvLabel.setLayoutData(gdCV);

    // Available Sql Conversion Text
    // --------------------------------------

    String convertedSymbol = binding.getSqlConversionText();
    int lossOfPrecIndex = convertedSymbol.indexOf('\n');
    String warningText = CoreStringUtil.Constants.EMPTY_STRING;
    if (lossOfPrecIndex > -1) {
      warningText = convertedSymbol.substring(lossOfPrecIndex + 1, convertedSymbol.length());
      convertedSymbol = convertedSymbol.substring(0, lossOfPrecIndex);
    }

    symbolConversionLabel =
        WidgetFactory.createLabel(newGroup, convertedSymbol, GridData.FILL_BOTH);

    symbolWarningLabel = WidgetFactory.createLabel(newGroup, warningText, GridData.FILL_BOTH);
    GridData gdWarning =
        new GridData(
            GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_FILL, false, false, 3, 1);
    symbolWarningLabel.setLayoutData(gdWarning);

    // Conversion Buttons Panel
    // --------------------------------------

    // Create the changeSelectedSql Button
    this.convertSelectedSqlButton =
        WidgetFactory.createButton(
            newGroup, CONVERT_SELECTED_SQL_BUTTON, GridData.HORIZONTAL_ALIGN_BEGINNING);
    this.convertSelectedSqlButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent event) {
            convertSelectedSqlPressed();
          }
        });

    // Create the changeAllSql Button
    this.convertAllSqlButton =
        WidgetFactory.createButton(
            newGroup, CONVERT_ALL_SQL_BUTTON, GridData.HORIZONTAL_ALIGN_BEGINNING);
    this.convertAllSqlButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent event) {
            convertAllSqlPressed();
          }
        });
    sqlGroup = newGroup;
  }
  private void createGroupHigh(Composite container) {
    // private void createGroupHigh() {
    GridLayout gridLayout1 = new GridLayout();
    gridLayout1.numColumns = 2;
    gridLayout1.makeColumnsEqualWidth = false;
    gridLayout1.verticalSpacing = 5;
    GridLayout gridLayout2 = new GridLayout();
    gridLayout2.marginHeight = 1;
    gridLayout2.verticalSpacing = 2;

    GridData gridData1 = new GridData();
    gridData1.horizontalAlignment = GridData.FILL;
    gridData1.grabExcessHorizontalSpace = true;
    gridData1.verticalAlignment = GridData.CENTER;
    GridData gridData2 = new GridData();
    gridData2.horizontalSpan = 2;
    gridData2.horizontalIndent = 3;
    GridData gridData3 = new GridData();
    gridData3.horizontalAlignment = GridData.FILL;
    gridData3.grabExcessHorizontalSpace = true;
    gridData3.widthHint = -1;
    gridData3.heightHint = 17;
    gridData3.verticalAlignment = GridData.CENTER;
    GridData gridData4 = new GridData();
    gridData4.horizontalAlignment = GridData.CENTER;
    gridData4.heightHint = 25;
    gridData4.widthHint = 80;
    gridData4.verticalAlignment = GridData.CENTER;
    GridData gridData5 = new GridData();
    gridData5.horizontalSpan = 2;
    gridData5.horizontalIndent = 4;
    GridData gridData6 = new GridData();
    gridData6.grabExcessHorizontalSpace = true;
    gridData6.verticalAlignment = GridData.CENTER;
    gridData6.heightHint = 17;
    gridData6.horizontalAlignment = GridData.FILL;
    GridData gridData7 = new GridData();
    gridData7.horizontalAlignment = GridData.CENTER;
    gridData7.heightHint = 25;
    gridData7.widthHint = 80;
    gridData7.verticalAlignment = GridData.CENTER;
    GridData gridData8 = new GridData();
    gridData8.horizontalSpan = 2;
    gridData8.horizontalIndent = 3;
    GridData gridData9 = new GridData();
    gridData9.horizontalIndent = 0;
    gridData9.horizontalAlignment = GridData.FILL;
    gridData9.verticalAlignment = GridData.FILL;
    gridData9.grabExcessHorizontalSpace = true;
    GridData gridData10 = new GridData();
    gridData10.horizontalAlignment = GridData.CENTER;
    gridData10.verticalAlignment = GridData.CENTER;
    GridData gridData11 = new GridData();
    gridData11.horizontalSpan = 2;
    gridData11.verticalAlignment = GridData.CENTER;
    gridData11.horizontalIndent = 10;
    gridData11.horizontalAlignment = GridData.BEGINNING;
    GridData gridData12 = new GridData();
    gridData12.horizontalAlignment = GridData.CENTER;
    gridData12.heightHint = 25;
    gridData12.widthHint = 80;
    gridData12.verticalAlignment = GridData.CENTER;
    GridData gridData13 = new GridData();
    gridData13.heightHint = 25;
    gridData13.widthHint = 80;

    groupHigh = new Group(container, SWT.SHADOW_OUT);
    groupHigh.setLayout(gridLayout1);
    groupHigh.setLayoutData(gridData1);
    lblSource = new CLabel(groupHigh, SWT.NONE);
    lblSource.setText("Nodo sorgente:");
    lblSource.setLayoutData(gridData2);
    txtSource = new Text(groupHigh, SWT.BORDER);
    txtSource.setLayoutData(gridData3);
    txtSource.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            dialogChanged();
          }
        });
    txtSource.setEditable(false);

    bttChooseSource = new Button(groupHigh, SWT.NONE);
    bttChooseSource.setText("Sfoglia");
    bttChooseSource.setLayoutData(gridData4);

    bttChooseSource.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            BrowseElementDialog dialog = openBrowserElementDialog();

            Object[] result = dialog.getResult();

            if (result != null && result.length > 0) {
              // txtSource.setText(((IJavaElement)
              // result[0]).getElementName());
              sourceNode = (Node) result[0];
              txtSource.setText(getQualifiedName(sourceNode));
            }
            dialogChanged();
          }
        });

    lblIntermediary = new CLabel(groupHigh, SWT.NONE);
    lblIntermediary.setText("Nodi intermedi:");
    lblIntermediary.setLayoutData(gridData8);
    lstIntermediary = new ListNodes(groupHigh, SWT.BORDER);
    lstIntermediary.setLayoutData(gridData9);
    lstIntermediary.addDisposeListener(
        new DisposeListener() {
          public void widgetDisposed(DisposeEvent e) {
            bttUp.setEnabled(false);
            bttDown.setEnabled(false);
          }
        });
    lstIntermediary.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (lstIntermediary.getSelectionIndex() >= 0) {
              bttUp.setEnabled(true);
              bttDown.setEnabled(true);
            }
          }
        });

    commandIntermediary = new Composite(groupHigh, SWT.NONE);
    commandIntermediary.setLayoutData(gridData10);
    commandIntermediary.setLayout(gridLayout2);

    chkOrderValid = new Button(groupHigh, SWT.CHECK);
    chkOrderValid.setText("Considera l'ordine dei nodi intermedi");
    chkOrderValid.setLayoutData(gridData11);
    chkOrderValid.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            dialogChanged();
          }
        });

    bttChooseIntermediary = new Button(commandIntermediary, SWT.NONE);
    bttChooseIntermediary.setText("Sfoglia");
    bttChooseIntermediary.setLayoutData(gridData12);
    bttChooseIntermediary.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            BrowseElementDialog dialog = openBrowserElementDialog();

            Object[] result = dialog.getResult();

            if (result != null && result.length > 0) {
              // String resultStr = ((IJavaElement)
              // result[0]).getElementName();
              // String resultStr = ((Node)result[0]).getName();
              Node resultNode = (Node) result[0];
              if (lstIntermediary.indexOf(resultNode) < 0) lstIntermediary.add(resultNode);

              dialogChanged();
            }
          }
        });

    bttRemoveIntermediary = new Button(commandIntermediary, SWT.NONE);
    bttRemoveIntermediary.setText("Rimuovi");
    bttRemoveIntermediary.setLayoutData(gridData13);

    bttRemoveIntermediary.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            Node[] items = lstIntermediary.getItems();

            if (items != null) {
              int selIndex = lstIntermediary.getSelectionIndex();

              lstIntermediary.remove(selIndex);

              dialogChanged();
            }
          }
        });

    createUpAndDown(commandIntermediary);

    lblTarget = new CLabel(groupHigh, SWT.NONE);
    lblTarget.setText("Nodo destinazione:");
    lblTarget.setLayoutData(gridData5);

    txtTarget = new Text(groupHigh, SWT.BORDER);
    txtTarget.setLayoutData(gridData6);
    txtTarget.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            dialogChanged();
          }
        });
    txtTarget.setEditable(false);

    bttChooseTarget = new Button(groupHigh, SWT.NONE);
    bttChooseTarget.setText("Sfoglia");
    bttChooseTarget.setLayoutData(gridData7);
    bttChooseTarget.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            BrowseElementDialog dialog = openBrowserElementDialog();

            Object[] result = dialog.getResult();

            if (result != null && result.length > 0) {
              // txtTarget.setText(((IJavaElement)
              // result[0]).getElementName());
              targetNode = (Node) result[0];
              txtTarget.setText(getQualifiedName(targetNode));
            }
            dialogChanged();
          }
        });
  }
  /**
   * Create the composite.
   *
   * @param parent
   * @param style
   */
  public ComputingInfrastructureServiceComposite(Composite parent, int style) {
    super(parent, style);
    setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    setLayout(new FormLayout());

    Label lblTitle = new Label(this, SWT.NONE);
    lblTitle.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblTitle.setFont(SWTResourceManager.getFont("Ubuntu", 13, SWT.NORMAL));
    FormData fd_lblTitle = new FormData();
    fd_lblTitle.bottom = new FormAttachment(0, 21);
    fd_lblTitle.top = new FormAttachment(0);
    fd_lblTitle.left = new FormAttachment(0);
    lblTitle.setLayoutData(fd_lblTitle);
    lblTitle.setText("Instance name:");

    Composite composite = new Composite(this, SWT.BORDER);
    FormData fd_composite = new FormData();
    fd_composite.bottom = new FormAttachment(lblTitle, 210, SWT.BOTTOM);
    fd_composite.top = new FormAttachment(lblTitle, 6);
    fd_composite.left = new FormAttachment(lblTitle, 10, SWT.LEFT);
    fd_composite.right = new FormAttachment(100, -11);
    composite.setLayoutData(fd_composite);

    CLabel label_1 = new CLabel(composite, SWT.NONE);
    label_1.setText("Instance");
    label_1.setBounds(10, 36, 115, 23);

    CLabel label_2 = new CLabel(composite, SWT.NONE);
    label_2.setText("CPU (MHz)");
    label_2.setLeftMargin(10);
    label_2.setBounds(10, 71, 115, 23);

    CLabel label_3 = new CLabel(composite, SWT.NONE);
    label_3.setText("CPU (Units)");
    label_3.setLeftMargin(10);
    label_3.setBounds(10, 100, 89, 23);

    CLabel label_4 = new CLabel(composite, SWT.NONE);
    label_4.setText("Memory (MB)");
    label_4.setLeftMargin(10);
    label_4.setBounds(10, 129, 104, 23);

    txtCpu = new Text(composite, SWT.BORDER);
    txtCpu.setText("0");
    // txtCpu.setEnabled(false);
    txtCpu.setBounds(141, 73, 70, 21);

    txtCpuUnits = new Text(composite, SWT.BORDER);
    txtCpuUnits.setText("0");
    // txtCpuUnits.setEnabled(false);
    txtCpuUnits.setBounds(141, 102, 70, 21);

    txtMemory = new Text(composite, SWT.BORDER);
    txtMemory.setText("0");
    // txtMemory.setEnabled(false);
    txtMemory.setBounds(141, 131, 70, 21);

    CLabel label_5 = new CLabel(composite, SWT.NONE);
    label_5.setText("Storage (GB)");
    label_5.setLeftMargin(10);
    label_5.setBounds(10, 158, 97, 23);

    txtStorage = new Text(composite, SWT.BORDER);
    txtStorage.setText("0");
    // txtStorage.setEnabled(false);
    txtStorage.setBounds(141, 160, 70, 21);

    Label lblHardware = new Label(composite, SWT.NONE);
    lblHardware.setBounds(10, 10, 311, 17);
    lblHardware.setText("Hardware specification");

    Composite composite_1 = new Composite(this, SWT.BORDER);
    composite_1.setLayout(new FormLayout());
    FormData fd_composite_1 = new FormData();
    fd_composite_1.bottom = new FormAttachment(100, -10);
    fd_composite_1.top = new FormAttachment(composite, 6);
    fd_composite_1.right = new FormAttachment(100, -11);
    fd_composite_1.left = new FormAttachment(0, 10);

    comboViewer = new ComboViewer(composite, SWT.NONE);
    Combo combo = comboViewer.getCombo();
    combo.setBounds(141, 36, 180, 29);
    composite_1.setLayoutData(fd_composite_1);

    Label lblComponents = new Label(composite_1, SWT.NONE);
    FormData fd_lblComponents = new FormData();
    fd_lblComponents.right = new FormAttachment(0, 88);
    fd_lblComponents.top = new FormAttachment(0, 10);
    fd_lblComponents.left = new FormAttachment(0, 10);
    lblComponents.setLayoutData(fd_lblComponents);
    lblComponents.setText("Software");

    CLabel label = new CLabel(composite_1, SWT.NONE);
    FormData fd_label = new FormData();
    fd_label.top = new FormAttachment(0, 45);
    fd_label.left = new FormAttachment(0, 10);
    label.setLayoutData(fd_label);
    label.setText("Operating system");

    textOs = new Text(composite_1, SWT.BORDER);
    FormData fd_textOs = new FormData();
    fd_textOs.bottom = new FormAttachment(0, 72);
    fd_textOs.right = new FormAttachment(0, 321);
    fd_textOs.top = new FormAttachment(0, 45);
    fd_textOs.left = new FormAttachment(0, 141);
    textOs.setLayoutData(fd_textOs);
    textOs.setText("Debian 7.1 Linux");
    textOs.setEditable(false);

    CLabel lblComponents_1 = new CLabel(composite_1, SWT.NONE);
    FormData fd_lblComponents_1 = new FormData();
    fd_lblComponents_1.left = new FormAttachment(0, 10);
    fd_lblComponents_1.right = new FormAttachment(100, -106);
    fd_lblComponents_1.top = new FormAttachment(0, 91);
    lblComponents_1.setLayoutData(fd_lblComponents_1);
    lblComponents_1.setText("Deployed platform services");

    tableViewer = new TableViewer(composite_1, SWT.BORDER | SWT.FULL_SELECTION);
    tableViewer.addDoubleClickListener(
        new IDoubleClickListener() {
          public void doubleClick(DoubleClickEvent event) {
            if (!event.getSelection().isEmpty()) {
              IStructuredSelection selection = (IStructuredSelection) event.getSelection();
              PlatformService platformService = (PlatformService) selection.getFirstElement();
              Util.openEditor(
                  new PlatformServiceEditorInput(platformService), PlatformServiceEditor.ID);
            }
          }
        });
    table = tableViewer.getTable();
    FormData fd_table = new FormData();
    fd_table.bottom = new FormAttachment(100, -10);
    fd_table.top = new FormAttachment(lblComponents_1, 6);
    fd_table.left = new FormAttachment(0, 10);
    fd_table.right = new FormAttachment(100, -10);
    table.setLayoutData(fd_table);

    txtName = new Text(this, SWT.BORDER);
    txtName.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    FormData fd_txtName = new FormData();
    fd_txtName.top = new FormAttachment(lblTitle, 0, SWT.TOP);
    fd_txtName.bottom = new FormAttachment(composite, -6);
    fd_txtName.right = new FormAttachment(100, -11);
    fd_txtName.left = new FormAttachment(lblTitle, 6);
    txtName.setLayoutData(fd_txtName);

    // Should not be called -- the call is auto-generated
    if (computingInfrastructureService != null) m_bindingContext = initDataBindings();
  }
    public Composite createControls(Composite parent) {
      setPreferenceKey("mp3converttab");

      // set default for preferences.
      getPreferenceStore().setDefault(getPreferenceKey() + "." + "quickcopy", true);
      getPreferenceStore().setDefault(getPreferenceKey() + "." + "forceconvert", false);

      getPreferenceStore().setDefault(getPreferenceKey() + "." + "audioBitrate", "128");
      getPreferenceStore().setDefault(getPreferenceKey() + "." + "useAvisynth", false);

      Composite composite = new Composite(parent, SWT.NULL);
      composite.setLayout(new GridLayout(1, true));

      Group exportDir = new Group(composite, SWT.NULL);
      exportDir.setToolTipText(Messages.getString("mp3convert.exportDir.tooltip"));
      exportDir.setLayout(new GridLayout());
      exportDir.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      exportDir.setText(Messages.getString("mp3convert.exportDir"));

      createDirectoryInfo(exportDir);

      Group detailSetting = new Group(composite, SWT.NULL);
      detailSetting.setLayout(new FillLayout());
      detailSetting.setLayoutData(new GridData(GridData.FILL_BOTH));
      detailSetting.setText(Messages.getString("mp3convert.detail"));

      ExpandBar bar = new ExpandBar(detailSetting, SWT.V_SCROLL);

      Composite copybase = new Composite(bar, SWT.NULL);
      copybase.setLayout(new RowLayout());
      quickCopy = new Button(copybase, SWT.CHECK);
      quickCopy.setText(Messages.getString("mp3convert.quickcopy"));
      quickCopy.addSelectionListener(
          new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {}

            public void widgetSelected(SelectionEvent e) {
              updateStatus();
            }
          });
      // quickCopy.setSelection(true);//

      ExpandItem item0 = new ExpandItem(bar, SWT.NONE, 0);
      item0.setText(Messages.getString("mp3convert.aboutcopy"));
      item0.setHeight(copybase.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item0.setControl(copybase);

      Composite advancedSetting = new Composite(bar, SWT.NULL);
      advancedSetting.setLayout(new GridLayout(1, false));

      Composite changebase = new Composite(advancedSetting, SWT.NULL);
      changebase.setLayout(new GridLayout(1, false));
      forceConvert = new Button(changebase, SWT.CHECK);
      forceConvert.setText(Messages.getString("mp3convert.forceconvert"));
      mp3setting = new MP3AudioSettingComposite(changebase, SWT.NULL, false, getPreferenceKey());
      ExpandItem item1 = new ExpandItem(bar, SWT.NONE, 1);
      item1.setText(Messages.getString("mp3convert.convertsetting"));
      item1.setHeight(advancedSetting.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item1.setControl(advancedSetting);

      Composite bitrateBase = new Composite(bar, SWT.NULL);
      bitrateBase.setLayout(new RowLayout());
      Label label1 = new Label(bitrateBase, SWT.NULL);
      label1.setText(Messages.getString("mp3convert.defaultBitrate"));
      defaultBitrate = new CCombo(bitrateBase, SWT.NULL);
      int bitrates[] = {64, 80, 96, 112, 128, 160, 192, 224, 256, 320};
      for (int i = 0; i < bitrates.length; i++) {
        defaultBitrate.add("" + bitrates[i]);
      }
      defaultBitrate.select(4);
      Label label = new Label(bitrateBase, SWT.NULL);
      label.setText("kbps");

      ExpandItem item2 = new ExpandItem(bar, SWT.NONE, 2);
      item2.setText(Messages.getString("mp3convert.optionbitrate"));
      item2.setHeight(bitrateBase.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item2.setControl(bitrateBase);

      forceConvert.addSelectionListener(new SynchEnabled(mp3setting));

      Composite avisynthBase = new Composite(bar, SWT.NULL);
      avisynthBase.setLayout(new RowLayout());
      useAvisynth = new Button(avisynthBase, SWT.CHECK);
      useAvisynth.setText(Messages.getString("mp3convert.useAvisynth"));
      // quickCopy.setSelection(true);//

      ExpandItem item3 = new ExpandItem(bar, SWT.NONE, 3);
      item3.setText(Messages.getString("mp3convert.about_useAvisynth"));
      item3.setHeight(avisynthBase.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item3.setControl(avisynthBase);

      canConvertImage =
          AbstractUIPlugin.imageDescriptorFromPlugin(
                  "jp.sourceforge.akjrcp.akj_betas", "icons/dandd_mp3.png")
              .createImage();
      noFFMpegImage =
          AbstractUIPlugin.imageDescriptorFromPlugin(
                  "jp.sourceforge.akjrcp.akj_betas", "icons/dandd_noffmpeg.png")
              .createImage();
      // bitrate
      // framerate
      // channel

      dragHere = new CLabel(composite, SWT.BORDER | SWT.LEFT);
      dragHere.setBackground(ColorConstants.white);
      dragHere.setImage(canConvertImage);
      dragHere.setAlignment(SWT.CENTER);

      dragHere.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      // keep preference store
      SavePreferenceStore sps = new SavePreferenceStore();

      // restore from setting..
      restoreControl(forceConvert);
      restoreControl(quickCopy);
      restoreControl(defaultBitrate);
      restoreControl(useAvisynth);

      forceConvert.addSelectionListener(sps);
      quickCopy.addSelectionListener(sps);
      defaultBitrate.addSelectionListener(sps);
      useAvisynth.addSelectionListener(sps);

      mp3setting.setEnabled(forceConvert.getSelection());
      mp3setting.setPreferenceStore(getPreferenceStore());

      // update status
      setCanConvert(true);
      updateStatus();
      PlatformUI.getPreferenceStore().addPropertyChangeListener(new SettingMonitor());
      return composite;
    }
Пример #29
0
  @Override
  public void createPartControl(Composite parent) {

    logger.logInfo("Starting flight data view...", this.getClass());

    sensorData = new Group(parent, SWT.NONE);
    sensorData.setLayout(new GridLayout(1, false));
    GridData layoutData = new GridData();
    layoutData.horizontalSpan = 1;
    layoutData.grabExcessVerticalSpace = true;
    sensorData.setLayoutData(layoutData);
    sensorData.setText("Flight Data");

    GridData layoutGradient = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    layoutGradient.widthHint = 40;
    layoutGradient.heightHint = 15;
    layoutGradient.horizontalSpan = 1;

    GridData layoutSensor = new GridData();
    layoutSensor.minimumWidth = 20;
    layoutSensor.widthHint = 50;

    GridData layoutMotor = new GridData();
    layoutMotor.minimumWidth = 20;
    layoutMotor.widthHint = 30;

    GridData layoutLabelAttitude = new GridData();
    layoutLabelAttitude.minimumWidth = 20;
    layoutLabelAttitude.widthHint = 50;

    GridData layoutLabelS = new GridData();
    layoutLabelS.minimumWidth = 20;
    layoutLabelS.widthHint = 30;

    GridData layoutLabel = new GridData();
    layoutLabel.minimumWidth = 20;
    layoutLabel.widthHint = 50;

    Group angleData = new Group(sensorData, SWT.NONE);
    angleData.setLayout(new GridLayout(4, true));
    angleData.setText("Attitude Angles (°)");
    angleData.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label label = new Label(angleData, SWT.NONE);
    label.setText("Roll: ");
    label.setLayoutData(layoutLabelAttitude);
    rollText = new Text(angleData, SWT.NONE);
    rollText.setEnabled(false);
    rollText.setLayoutData(layoutSensor);
    rollText.setText("0.0");

    label = new Label(angleData, SWT.NONE);
    label.setText("Pitch: ");
    label.setLayoutData(layoutLabelAttitude);
    pitchText = new Text(angleData, SWT.NONE);
    pitchText.setEnabled(false);
    pitchText.setLayoutData(layoutSensor);
    pitchText.setText("0.0");

    label = new Label(angleData, SWT.NONE);
    label.setText("Heading: ");
    label.setLayoutData(layoutLabelAttitude);
    headingText = new Text(angleData, SWT.NONE);
    headingText.setEnabled(false);
    headingText.setLayoutData(layoutSensor);
    headingText.setText("0.0");

    Group dof1Data = new Group(sensorData, SWT.NONE);
    dof1Data.setLayout(new GridLayout(6, false));
    dof1Data.setText("Acceleration (g)");
    dof1Data.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    label = new Label(dof1Data, SWT.NONE);
    label.setText("x: ");
    label.setLayoutData(layoutLabelS);
    accXText = new Text(dof1Data, SWT.NONE);
    accXText.setEnabled(false);
    accXText.setLayoutData(layoutSensor);
    accXText.setText("0.0");

    label = new Label(dof1Data, SWT.NONE);
    label.setText("y: ");
    label.setLayoutData(layoutLabelS);
    accYText = new Text(dof1Data, SWT.NONE);
    accYText.setEnabled(false);
    accYText.setLayoutData(layoutSensor);
    accYText.setText("0.0");

    label = new Label(dof1Data, SWT.NONE);
    label.setText("z: ");
    label.setLayoutData(layoutLabelS);
    accZText = new Text(dof1Data, SWT.NONE);
    accZText.setEnabled(false);
    accZText.setLayoutData(layoutSensor);
    accZText.setText("0.0");

    Group dof2Data = new Group(sensorData, SWT.NONE);
    dof2Data.setLayout(new GridLayout(6, false));
    dof2Data.setText("Angular Velocity (°/s)");
    dof2Data.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    label = new Label(dof2Data, SWT.NONE);
    label.setText("x: ");
    label.setLayoutData(layoutLabelS);
    awXText = new Text(dof2Data, SWT.NONE);
    awXText.setEnabled(false);
    awXText.setLayoutData(layoutSensor);
    awXText.setText("0.0");

    label = new Label(dof2Data, SWT.NONE);
    label.setText("y: ");
    label.setLayoutData(layoutLabelS);
    awYText = new Text(dof2Data, SWT.NONE);
    awYText.setEnabled(false);
    awYText.setLayoutData(layoutSensor);
    awYText.setText("0.0");

    label = new Label(dof2Data, SWT.NONE);
    label.setText("z: ");
    label.setLayoutData(layoutLabelS);
    awZText = new Text(dof2Data, SWT.NONE);
    awZText.setEnabled(false);
    awZText.setLayoutData(layoutSensor);
    awZText.setText("0.0");

    Group dof3Data = new Group(sensorData, SWT.NONE);
    dof3Data.setLayout(new GridLayout(6, false));
    dof3Data.setText("Magnetic Field (uGauss)");
    dof3Data.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    label = new Label(dof3Data, SWT.NONE);
    label.setText("x: ");
    label.setLayoutData(layoutLabelS);
    magXText = new Text(dof3Data, SWT.NONE);
    magXText.setEnabled(false);
    magXText.setLayoutData(layoutSensor);
    magXText.setText("0.0");

    label = new Label(dof3Data, SWT.NONE);
    label.setText("y: ");
    label.setLayoutData(layoutLabelS);
    magYText = new Text(dof3Data, SWT.NONE);
    magYText.setEnabled(false);
    magYText.setLayoutData(layoutSensor);
    magYText.setText("0.0");

    label = new Label(dof3Data, SWT.NONE);
    label.setText("z: ");
    label.setLayoutData(layoutLabelS);
    magZText = new Text(dof3Data, SWT.NONE);
    magZText.setEnabled(false);
    magZText.setLayoutData(layoutSensor);
    magZText.setText("0.0");

    Group control = new Group(sensorData, SWT.NONE);
    control.setLayout(new GridLayout(6, false));
    layoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    layoutData.horizontalSpan = 6;
    control.setLayoutData(layoutData);
    control.setText("Motors Speed");

    label = new Label(control, SWT.NONE);
    label.setText("Front (R): ");
    label.setLayoutData(layoutLabel);

    gM0 = new CLabel(control, SWT.SHADOW_IN);
    gM0.setLayoutData(layoutGradient);
    gM0.setBackground(
        new Color[] {
          Display.getDefault().getSystemColor(SWT.COLOR_GREEN),
          Display.getDefault().getSystemColor(SWT.COLOR_YELLOW),
          Display.getDefault().getSystemColor(SWT.COLOR_RED)
        },
        new int[] {100, 100});
    m0Text = new Text(control, SWT.NONE);
    m0Text.setEnabled(false);
    m0Text.setLayoutData(layoutMotor);
    m0Text.setText("0.0");

    label = new Label(control, SWT.NONE);
    label.setText("Front (L): ");
    label.setLayoutData(layoutLabel);

    gM1 = new CLabel(control, SWT.SHADOW_IN);
    gM1.setLayoutData(layoutGradient);
    gM1.setBackground(
        new Color[] {
          Display.getDefault().getSystemColor(SWT.COLOR_GREEN),
          Display.getDefault().getSystemColor(SWT.COLOR_YELLOW),
          Display.getDefault().getSystemColor(SWT.COLOR_RED)
        },
        new int[] {100, 100});
    m1Text = new Text(control, SWT.NONE);
    m1Text.setEnabled(false);
    m1Text.setLayoutData(layoutMotor);
    m1Text.setText("0.0");

    label = new Label(control, SWT.NONE);
    label.setText("Back (R): ");
    label.setLayoutData(layoutLabel);

    gM2 = new CLabel(control, SWT.SHADOW_IN);
    gM2.setLayoutData(layoutGradient);
    gM2.setBackground(
        new Color[] {
          Display.getDefault().getSystemColor(SWT.COLOR_GREEN),
          Display.getDefault().getSystemColor(SWT.COLOR_YELLOW),
          Display.getDefault().getSystemColor(SWT.COLOR_RED)
        },
        new int[] {100, 100});
    m2Text = new Text(control, SWT.NONE);
    m2Text.setEnabled(false);
    m2Text.setLayoutData(layoutMotor);
    m2Text.setText("0.0");

    label = new Label(control, SWT.NONE);
    label.setText("Back (L): ");
    label.setLayoutData(layoutLabel);

    gM3 = new CLabel(control, SWT.SHADOW_IN);
    gM3.setLayoutData(layoutGradient);
    gM3.setBackground(
        new Color[] {
          Display.getDefault().getSystemColor(SWT.COLOR_GREEN),
          Display.getDefault().getSystemColor(SWT.COLOR_YELLOW),
          Display.getDefault().getSystemColor(SWT.COLOR_RED)
        },
        new int[] {100, 100});
    m3Text = new Text(control, SWT.NONE);
    m3Text.setEnabled(false);
    m3Text.setLayoutData(layoutMotor);
    m3Text.setText("0.0");
  }
  /** Create contents of the dialog. */
  private void createContents() {
    shell = new Shell(getParent(), getStyle());
    shell.setSize(624, 617);
    shell.setText(getText());
    GridLayout gl_shell = new GridLayout(1, false);
    gl_shell.horizontalSpacing = 0;
    gl_shell.marginHeight = 0;
    gl_shell.verticalSpacing = 0;
    gl_shell.marginWidth = 0;
    shell.setLayout(gl_shell);
    shell.setBackground(ColorRepository.getColor(ColorRepository.BG_CONTENTS));
    //		shell.setBackgroundMode(SWT.TRANSPARENT);

    CLabel lblTitle = new CLabel(shell, SWT.CENTER);
    lblTitle.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    GridData gd_lblTitle = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd_lblTitle.heightHint = 44;
    lblTitle.setLayoutData(gd_lblTitle);
    lblTitle.setFont(titleFont);
    lblTitle.setBackgroundImage(ImageRepository.getImage(ImageRepository.POPUP_TITLE_BG));
    lblTitle.setText("2차 계량 - 대상 차량 선택");

    Composite compContents = new Composite(shell, SWT.NONE);
    compContents.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    compContents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    GridLayout gl_compContents = new GridLayout(1, false);
    gl_compContents.marginTop = 10;
    gl_compContents.marginRight = 10;
    gl_compContents.marginLeft = 10;
    gl_compContents.marginBottom = 10;
    gl_compContents.verticalSpacing = 0;
    gl_compContents.marginWidth = 0;
    gl_compContents.marginHeight = 0;
    compContents.setLayout(gl_compContents);

    compCenter = new Composite(compContents, SWT.BORDER);
    compCenter.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
    compCenter.setLayout(new GridLayout(2, false));

    car = new CarComposite(compCenter, SWT.NONE);
    car.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusLost(FocusEvent e) {
            filter();
          }
        });
    car.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    car.setFont(defaultFont);
    car.setTitle("차량 번호: ");
    car.addFocusListener(new HelpAdapter("차량번호를 입력하거나 목록에서 선택 후 Enter."));

    Button btnSearch = new Button(compCenter, SWT.NONE);
    btnSearch.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            select();
          }
        });
    btnSearch.setFont(btnFont);
    btnSearch.setText(" 조 회 ");

    initGird(compContents);

    Composite btn = new Composite(shell, SWT.NONE);
    btn.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    btn.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    btn.setBackgroundMode(SWT.INHERIT_FORCE);
    if (user.hasAuth(DTSConstants.AUTH_DEL_FST)) {
      btn.setLayout(new GridLayout(4, false));
    } else {
      btn.setLayout(new GridLayout(3, false));
    }

    Button btnSave = new Button(btn, SWT.NONE);
    GridData gd_btnSave = new GridData(SWT.RIGHT, SWT.FILL, true, false);
    gd_btnSave.heightHint = 36;
    gd_btnSave.widthHint = 130;
    btnSave.setLayoutData(gd_btnSave);
    btnSave.setFont(btnFont);
    btnSave.setText("2차 계량");
    btnSave.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            onClickOK();
          }
        });

    Button btnPrint = new Button(btn, SWT.NONE);
    GridData gd_btnPrint = new GridData(SWT.RIGHT, SWT.FILL, true, false);
    gd_btnPrint.heightHint = 36;
    gd_btnPrint.widthHint = 130;
    btnPrint.setLayoutData(gd_btnPrint);
    btnPrint.setFont(btnFont);
    btnPrint.setText("전표 출력");
    btnPrint.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            Grid g = gridViewer.getGrid();
            if (g.getSelectionIndex() == -1) {
              MessageDialog.openInformation(
                  shell, "데이터 선택 필요", "선택된 데이터가 없습니다. \n\n목록에서 선택 후 작업하세요.");
              return;
            } else {
              if (listData != null && listData.length > g.getSelectionIndex()) {
                TsWgtInfDTO dto = listData[g.getSelectionIndex()];

                PrintUtil.print(dto, preferences.getInt(DTSPreConstants.GN_PRINT_COUNT));
              }
            }
          }
        });

    if (user.hasAuth(DTSConstants.AUTH_DEL_FST)) {
      Button btnDelete = new Button(btn, SWT.NONE);
      GridData gd_btnDelete = new GridData(SWT.CENTER, SWT.FILL, true, false);
      gd_btnDelete.heightHint = 36;
      gd_btnDelete.widthHint = 130;
      btnDelete.setLayoutData(gd_btnDelete);
      btnDelete.setFont(btnFont);
      btnDelete.setText("삭 제");
      btnDelete.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              onClickDelete();
            }
          });
    }
    Button btnCancel = new Button(btn, SWT.NONE);
    btnCancel.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            shell.close();
          }
        });
    GridData gd_btnCancel = new GridData(SWT.LEFT, SWT.FILL, true, false);
    gd_btnCancel.heightHint = 36;
    gd_btnCancel.widthHint = 130;
    btnCancel.setLayoutData(gd_btnCancel);
    btnCancel.setFont(btnFont);
    btnCancel.setText("취  소");

    lblHelp = new CLabel(shell, SWT.LEFT);
    lblHelp.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    GridData gd_lblHelp = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd_lblHelp.heightHint = 25;
    lblHelp.setLayoutData(gd_lblHelp);
    lblHelp.setText("도움말:");
    lblHelp.setFont(helpFont);
    lblHelp.setBackgroundImage(ImageRepository.getImage(ImageRepository.POPUP_HELP_BG));

    shell.addListener(
        SWT.Traverse,
        new Listener() {
          public void handleEvent(Event event) {
            if (event.detail == SWT.TRAVERSE_ESCAPE) {
              event.doit = false;
            }
          }
        });
  } // createContents