@Override
  public void createPartControl(Composite parent) {

    FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    m_sform = toolkit.createScrolledForm(parent);
    m_sform.setText("FIAT News Search");
    m_sform.getBody().setLayout(new GridLayout());
    Composite editorComposite = m_sform.getBody();

    GridLayout layout = new GridLayout();
    layout.marginBottom = 10;
    layout.marginTop = 10;
    layout.marginLeft = 10;
    layout.marginRight = 10;
    layout.numColumns = 1;
    layout.makeColumnsEqualWidth = true;
    layout.verticalSpacing = 5;
    layout.horizontalSpacing = 5;
    editorComposite.setLayout(layout);
    editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    createContent(editorComposite, toolkit);
    m_sform.reflow(true);
    m_sform.setFocus();

    m_selectionProvider = new FiatNewsSearchViewSelectionProvider();
    getSite().setSelectionProvider(m_selectionProvider);
    m_SparqlQueryHelper = new SparqlQueryHelper();
  }
 public GridLayoutConfig margin(int top, int right, int bottom, int left) {
   layout.marginTop = top;
   layout.marginRight = right;
   layout.marginBottom = bottom;
   layout.marginLeft = left;
   return this;
 }
  public FilterAdvancedComposite(
      final FilterChangedListener filterChangedListener, final Composite parent, final int style) {
    // fields
    super(parent, style);

    // widgets
    this.tabFolder = new CTabFolder(this, SWT.TOP | SWT.BORDER | SWT.CLOSE);
    this.addOrConditionButton = creteAddOrConditionButton();
    addOrCondition();

    // layout
    final GridLayout layout = new GridLayout(1, true);
    layout.marginLeft = 6;
    layout.marginRight = 6;
    layout.marginTop = 6;
    layout.marginBottom = 6;
    layout.verticalSpacing = 12;
    this.setLayout(layout);

    final GridData tabFolderLayoutData = new GridData();
    tabFolderLayoutData.horizontalAlignment = GridData.FILL;
    tabFolderLayoutData.grabExcessHorizontalSpace = true;
    tabFolderLayoutData.verticalAlignment = GridData.FILL;
    tabFolderLayoutData.grabExcessVerticalSpace = true;
    this.tabFolder.setLayoutData(tabFolderLayoutData);
    this.tabFolder.setBackgroundMode(SWT.INHERIT_FORCE);

    final GridData addOrConditionButtonLayoutdata = new GridData();
    addOrConditionButtonLayoutdata.horizontalAlignment = GridData.END;
    this.addOrConditionButton.setLayoutData(addOrConditionButtonLayoutdata);
  }
  @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);
  }
Exemple #5
0
 protected void zeroMargins(GridLayout layout) {
   layout.marginLeft = 0;
   layout.marginTop = 0;
   layout.marginBottom = 0;
   layout.marginHeight = 0;
   layout.marginWidth = 0;
 }
  public PerspectiveSwitcherBuilder(final Composite parent, final String subSetId) {
    super(parent, subSetId);
    GridLayout glayout = new GridLayout();
    glayout.marginBottom = 0;
    glayout.marginHeight = 0;

    parent.setLayout(glayout);
    background = new Composite(parent, SWT.NONE);
    background.setData(RWT.CUSTOM_VARIANT, ICSSConstants.COMP_TRANS); // $NON-NLS-1$
    background.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true, 1, 1));
    RowLayout layout = new RowLayout();
    background.setLayout(layout);
    layout.spacing = 4;
    layout.marginBottom = 0;
    layout.marginRight = 10;
    layout.marginTop = 0;
    layout.wrap = false;
    layout.pack = false;
    perspectiveButtonMap = new HashMap<IPerspectiveDescriptor, Button>();
    buttonPerspectiveMap = new HashMap<Button, IPerspectiveDescriptor>();
    buttonList = new ArrayList<Button>();
    perspectiveList = new ArrayList<String>();
    // images
    bgActive = getImage(ILayoutSetConstants.PERSP_BG_ACTIVE);
  }
Exemple #7
0
  /** @param tabFolder */
  private void createControl(CTabFolder tabFolder) {
    // Create Container
    ScrolledComposite scrolledContainer =
        new ScrolledComposite(tabFolder, SWT.BORDER | SWT.V_SCROLL);

    Composite container = new Composite(scrolledContainer, SWT.NONE);
    GridLayout glayout = new GridLayout();
    glayout.numColumns = 1;
    glayout.marginTop = 0;
    glayout.marginBottom = 0;
    glayout.marginRight = 4;
    glayout.verticalSpacing = 20;
    container.setLayout(glayout);

    // General
    createGeneralGroup(container);

    // SSL
    createSSLGroup(container);

    // HA
    createHAGroup(container);

    // LWT
    createLWTGroup(container);

    scrolledContainer.setContent(container);
    scrolledContainer.setExpandHorizontal(true);
    scrolledContainer.setExpandVertical(true);
    // scrolledContainer.setMinWidth( 1600 );
    scrolledContainer.setMinHeight(900);

    setControl(scrolledContainer);
  }
Exemple #8
0
  private void createControls() {
    GridLayout gLayout = new GridLayout();
    gLayout.marginHeight = 0;
    gLayout.marginWidth = 0;
    gLayout.verticalSpacing = 0;
    shell.setLayout(gLayout);
    Utils.setShellIcon(shell);

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

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

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

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

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

    shell.layout(true, true);
  }
  public void createDragSourceComposite(Composite parent, IReferenceNodeInfo referenceNodeInfo) {
    // Composite c = new Composite(parent, SWT.BORDER);
    Group c = new Group(parent, SWT.SHADOW_ETCHED_IN);
    GridLayout gl = new GridLayout(2, false);
    gl.marginTop = 1;
    gl.marginBottom = 5;
    gl.marginLeft = 1;
    gl.marginRight = 1;
    gl.marginHeight = 1;
    gl.marginWidth = 1;
    gl.verticalSpacing = 0;
    gl.horizontalSpacing = 0;

    c.setLayout(gl);

    c.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    Label il = new Label(c, SWT.LEFT | SWT.NO_FOCUS);
    il.setImage(resources.getPlatformImage(ISharedImages.IMG_OBJS_INFO_TSK));
    il.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    Label l = new Label(c, SWT.LEFT | SWT.NO_FOCUS);
    l.setText("Drag this area to a target in the tree to quick-link.");
    l.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    c.pack();

    DragSource[] sources =
        new DragSource[] {
          // new DragSource(il, DND.DROP_MOVE | DND.DROP_COPY),
          new DragSource(l, DND.DROP_MOVE | DND.DROP_COPY),
          new DragSource(c, DND.DROP_MOVE | DND.DROP_COPY),
        };

    final ObjRef fParentRef = referenceNodeInfo.getParentRef();
    final String fFeatureName = referenceNodeInfo.getFeatureName();

    for (DragSource source : sources) {
      Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
      source.setTransfer(types);
      source.addDragListener(
          new DragSourceListener() {
            @Override
            public void dragStart(DragSourceEvent event) {
              event.doit = true;
            }

            @Override
            public void dragSetData(DragSourceEvent event) {
              if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
                event.data = "$LINK$" + fFeatureName + "$" + xarch.getXPath(fParentRef);
              }
            }

            @Override
            public void dragFinished(DragSourceEvent event) {
              if (event.detail == DND.DROP_MOVE) {}
            }
          });
    }
  }
Exemple #10
0
  public static void main(String[] args) {
    Display display = Display.getDefault();
    final Shell shell = new Shell(display, SWT.TITLE | SWT.CLOSE);
    shell.setText(TITLE);

    final String C10T_PATH = System.getenv("C10T_PATH");

    final C10tGraphicalInterface gui = new C10tGraphicalInterface(display, shell);
    final DetachedProcess detachedProcess = new C10tDetachedProcess(gui);
    final CommandExecutioner executioner =
        new CommandExecutioner("c10t", detachedProcess, C10T_PATH);

    gui.addRenderButtonListener(new RenderSelection(shell, gui, executioner));

    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 3;
    gridLayout.marginBottom = 8;
    gridLayout.marginTop = 8;
    gridLayout.marginLeft = 8;
    gridLayout.marginRight = 8;

    shell.setLayout(gridLayout);
    shell.pack();
    shell.open();

    shell.setSize(500, shell.getSize().y);

    try {
      executioner.findCommand();
    } catch (CommandNotFoundException e) {
      MessageBox messageBox = new MessageBox(shell, SWT.ERROR);
      messageBox.setText("c10t - Command could not be found");
      messageBox.setMessage(
          "The program `"
              + executioner.getName()
              + "' could not be located anywhere in your PATH or in the current working directory\n\n"
              + "You must be fixed this by doing one of the following:\n\n"
              + " 1) Install the command `"
              + executioner.getName()
              + "' to somewhere in your PATH or the working directory of this program `"
              + System.getProperty("user.dir")
              + "'\n"
              + " 2) Specify where the command is with the environment variable `C10T_PATH'\n\n"
              + "Your PATH is: "
              + System.getenv("PATH"));
      messageBox.open();
    }

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }

    if (!display.isDisposed()) {
      display.dispose();
    }
  }
 private GridLayout makeGroupLayout(int spacing) {
   GridLayout layout = new GridLayout(3, false);
   layout.marginTop = spacing;
   layout.marginBottom = spacing;
   layout.marginLeft = spacing;
   layout.marginRight = spacing;
   layout.verticalSpacing = spacing;
   layout.horizontalSpacing = spacing;
   return layout;
 }
Exemple #12
0
 private void configureDialogLayout(Composite composite) {
   GridLayout layout = (GridLayout) composite.getLayout();
   layout.numColumns = 2;
   layout.marginLeft = 10;
   layout.marginRight = 10;
   layout.marginTop = 30;
   layout.marginBottom = 0;
   layout.horizontalSpacing = 20;
   layout.verticalSpacing = 10;
 }
Exemple #13
0
  void createPopup(String[] items, int selectionIndex) {
    // create shell and list
    popup = new AlphaDialog(getShell(), SWT.NO_TRIM | SWT.ON_TOP | SWT.BORDER);
    popup.setBackgroundMode(SWT.INHERIT_DEFAULT);
    Color borderColor = ColorCache.getInstance().getColor(200, 200, 200);
    popup.setBackground(borderColor);

    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginBottom = 1;
    gridLayout.marginTop = 0;
    gridLayout.marginLeft = 0;
    gridLayout.marginRight = 0;

    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    gridLayout.marginWidth = 0;
    popup.getPopup().setLayout(gridLayout);

    int style = getStyle();
    int listStyle = SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER;
    if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT;
    if ((style & SWT.RIGHT_TO_LEFT) != 0) listStyle |= SWT.RIGHT_TO_LEFT;
    if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT;
    list = new List(popup.getPopup(), listStyle);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 2;
    list.setLayoutData(gridData);
    list.addMouseListener(
        new MouseAdapter() {
          public void mouseDown(MouseEvent e) {
            if (e.button == 3) {
              text.getMenu().setVisible(true);
            }
            if (list.isFocusControl()) return;
            text.forceFocus();
            list.setFocus();
          }
        });

    if (font != null) list.setFont(font);
    if (foreground != null) list.setForeground(foreground);
    if (background != null) list.setBackground(background);

    int[] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate};
    for (int i = 0; i < popupEvents.length; i++)
      popup.getPopup().addListener(popupEvents[i], listener);
    int[] listEvents = {
      SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose
    };
    for (int i = 0; i < listEvents.length; i++) list.addListener(listEvents[i], listener);

    if (items != null) list.setItems(items);
    if (selectionIndex != -1) list.setSelection(selectionIndex);
  }
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    GridLayout gridLayout = new GridLayout(1, false);
    gridLayout.marginLeft = 10;
    gridLayout.marginTop = 10;
    gridLayout.marginBottom = 10;
    gridLayout.marginRight = 10;
    shell.setLayout(gridLayout);

    final Table table = new Table(shell, SWT.BORDER | SWT.VIRTUAL | SWT.CHECK | SWT.FULL_SELECTION);
    table.setHeaderVisible(true);
    table.setLayoutData(new GridData(GridData.FILL_BOTH));
    table.addListener(
        SWT.SetData,
        new Listener() {

          public void handleEvent(Event event) {
            TableItem item = (TableItem) event.item;
            int index = table.indexOf(item);
            boolean checked = myModel[index];
            item.setChecked(checked);
            item.setText(0, "Row " + index + ": " + checked);
          }
        });

    TableColumn tableColumn = new TableColumn(table, SWT.LEFT);
    tableColumn.setWidth(100);
    tableColumn.setText("BlahBlah");

    table.setItemCount(myModel.length);
    table.clearAll();

    table.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            if (e.detail == SWT.CHECK) {
              TableItem item = (TableItem) e.item;
              int index = table.indexOf(item);
              boolean isChecked = item.getChecked();
              myModel[index] = isChecked;
              myModel[index / 2] = isChecked;
              table.clear(new int[] {index, index / 2});
            }
          }
        });

    shell.setSize(400, 300);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
    public OrCondition(
        final FilterAdvancedComposite filterAdvancedComposite, final CTabFolder tabFolder) {
      // fields
      this.filterAdvancedComposite = filterAdvancedComposite;
      this.tabItem = new CTabItem(tabFolder, SWT.NULL);
      this.tabItem.setText(Messages.a_condition);
      this.tabContent = new Composite(tabFolder, SWT.NONE);
      this.tabItem.setControl(this.tabContent);

      // widgets
      this.addAssertionComposite = new AddAssertionComposite(this, this.tabContent);
      this.assertionScrolledComposite =
          new ScrolledComposite(this.tabContent, SWT.V_SCROLL | SWT.NONE);
      this.assertionComposite = new Composite(this.assertionScrolledComposite, SWT.NONE);
      this.assertionScrolledComposite.setContent(this.assertionComposite);

      // layout
      final GridLayout layout = new GridLayout();
      layout.marginLeft = 6;
      layout.marginRight = 6;
      layout.marginTop = 6;
      layout.marginBottom = 6;
      layout.verticalSpacing = 12;
      this.tabContent.setLayout(layout);

      final GridData addAssertionCompositeLayoutData = new GridData();
      addAssertionCompositeLayoutData.grabExcessHorizontalSpace = true;
      addAssertionCompositeLayoutData.horizontalAlignment = GridData.FILL;
      this.addAssertionComposite.setLayoutData(addAssertionCompositeLayoutData);

      final GridData assertionCompositeLayoutData = new GridData();
      assertionCompositeLayoutData.grabExcessHorizontalSpace = true;
      assertionCompositeLayoutData.horizontalAlignment = GridData.FILL;
      assertionCompositeLayoutData.grabExcessVerticalSpace = true;
      assertionCompositeLayoutData.verticalAlignment = GridData.FILL;
      this.assertionScrolledComposite.setLayoutData(assertionCompositeLayoutData);
      this.assertionScrolledComposite.setExpandHorizontal(true);

      final RowLayout innerlayout = new RowLayout(SWT.VERTICAL);
      innerlayout.wrap = false;
      this.assertionComposite.setLayout(innerlayout);
      this.assertionComposite.addListener(
          SWT.Resize,
          new Listener() {
            public void handleEvent(final org.eclipse.swt.widgets.Event event) {
              final Point s =
                  OrCondition.this.assertionComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
              OrCondition.this.assertionComposite.setSize(s.x, s.y);
              refreshGUI();
            }
          });
    }
 private static GridLayout convertIntoSWTGridLayout(GridLayoutRule rule) {
   GridLayout gridLayout = new GridLayout();
   gridLayout.horizontalSpacing = rule.getHorizontalSpacing();
   gridLayout.makeColumnsEqualWidth = rule.isMakeColumnsEqualWidth();
   gridLayout.marginBottom = rule.getMarginBottom();
   gridLayout.marginHeight = rule.getMarginHeight();
   gridLayout.marginLeft = rule.getMarginLeft();
   gridLayout.marginRight = rule.getMarginRight();
   gridLayout.marginTop = rule.getMarginTop();
   gridLayout.marginWidth = rule.getMarginWidth();
   gridLayout.numColumns = rule.getNumColumns();
   gridLayout.verticalSpacing = rule.getVerticalSpacing();
   return gridLayout;
 }
  protected void createSecurityComposite(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginBottom = 10;
    composite.setLayout(layout);

    createSecureConnectionButton(composite);

    Label label = new Label(composite, SWT.NONE);
    label.setText("To enable secure connection you must provide keystore and truststore data.");

    createLink(composite, "<A>Security Preferences Page</A>");

    Router.getInstance().getConfigurationManager().addSecurityConfigurationChangeListener(this);
  }
  private Button createPerspectiveButton(final IPerspectiveDescriptor desc) {

    Button result = perspectiveButtonMap.get(desc);
    if (result == null && desc != null && desc.getLabel() != null) {
      Composite buttonBg = new Composite(background, SWT.NONE);
      GridLayout layout = new GridLayout();
      layout.marginBottom = 0;
      layout.marginTop = 0;
      layout.marginLeft = 0;
      layout.marginRight = 0;
      layout.marginWidth = 0;
      layout.marginHeight = 0;

      buttonBg.setLayout(layout);

      final Button perspButton = new Button(buttonBg, SWT.PUSH | SWT.FLAT);
      perspButton.setData(RWT.CUSTOM_VARIANT, ICSSConstants.PERSP_BOTTON);
      perspButton.setText(desc.getLabel());
      perspButton.setImage(desc.getImageDescriptor().createImage());
      perspButton.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, true));

      Label indicator = new Label(buttonBg, SWT.NONE);
      indicator.setImage(bgActive);
      indicator.setLayoutData(new GridData(SWT.CENTER, SWT.BOTTOM, false, false));

      RowData rd = new RowData();
      rd.height = 60;
      buttonBg.setLayoutData(rd);

      perspectiveButtonMap.put(desc, perspButton);
      buttonPerspectiveMap.put(perspButton, desc);
      buttonList.add(perspButton);

      perspButton.addSelectionListener(
          new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
              cleanButtons(perspButton);
              switchPerspective(desc.getId());
            }
          });

      result = perspButton;
    }

    return result;
  }
 /* (non-Javadoc)
  * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
  */
 @Override
 protected Control createDialogArea(Composite parent) {
   setTitle(
       NLS.bind(
           SnippetMessages.getString(
               "SelectImportsDialog.Manage_the_Java_Snippet_Editor_Imports_for___{0}__1"),
           new String[] {fEditor.getEditorInput().getName()})); // $NON-NLS-1$
   setMessage(
       NLS.bind(
           SnippetMessages.getString("SelectImportsDialog.add_remove_imports"),
           new String[] {fEditor.getEditorInput().getName()})); // $NON-NLS-1$
   Composite outer = SWTFactory.createComposite(parent, 2, 1, GridData.FILL_BOTH);
   GridLayout gl = (GridLayout) outer.getLayout();
   gl.marginLeft = 7;
   gl.marginTop = 0;
   gl.marginBottom = 0;
   SWTFactory.createLabel(
       outer, SnippetMessages.getString("SelectImportsDialog.imports_heading"), 2); // $NON-NLS-1$
   fImportsTable = new Table(outer, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
   GridData gd = new GridData(GridData.FILL_HORIZONTAL);
   gd.heightHint = 150;
   fImportsTable.setLayoutData(gd);
   fImportsViewer = new TableViewer(fImportsTable);
   fImportsViewer.setLabelProvider(new FilterLabelProvider());
   fImportsViewer.setComparator(new FilterViewerComparator());
   fImportContentProvider = new ImportsContentProvider(fImportsViewer);
   fImportsViewer.setContentProvider(fImportContentProvider);
   // input just needs to be non-null
   fImportsViewer.setInput(this);
   fImportsViewer.addSelectionChangedListener(
       new ISelectionChangedListener() {
         @Override
         public void selectionChanged(SelectionChangedEvent event) {
           ISelection selection = event.getSelection();
           if (selection.isEmpty()) {
             fRemoveImportsButton.setEnabled(false);
           } else {
             fRemoveImportsButton.setEnabled(true);
           }
         }
       });
   createImportButtons(outer);
   applyDialogFont(outer);
   return parent;
 }
Exemple #20
0
  /**
   * A new breadcrumb item which is shown inside the given viewer.
   *
   * @param viewer the items viewer
   * @param parent the container containing the item
   */
  public BreadcrumbItem(BreadcrumbViewer viewer, Composite parent) {
    super(parent, SWT.NONE);

    fParent = viewer;

    fContainer = new Composite(parent, SWT.NONE);
    fContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    GridLayout layout = new GridLayout(2, false);
    layout.marginBottom = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = 0;
    fContainer.setLayout(layout);

    fDetailsBlock = new BreadcrumbItemDetails(this, fContainer);

    fExpandBlock = new BreadcrumbItemDropDown(this, fContainer);
  }
  @Override
  public void createPartControlInternal(Composite parent) {
    GridLayout gl = new GridLayout(1, false);
    gl.marginWidth = 0;
    gl.marginHeight = 0;
    gl.horizontalSpacing = 0;
    gl.verticalSpacing = 0;
    parent.setLayout(gl);

    searchComposite = new Composite(parent, SWT.NONE);
    gl = new GridLayout(1, false);
    gl.marginWidth = 0;
    gl.marginHeight = 0;
    gl.horizontalSpacing = 0;
    gl.verticalSpacing = 0;
    gl.marginBottom = 5;
    gl.marginTop = 2;
    searchComposite.setLayout(gl);
    searchComposite.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    createTreeTextOptions(searchComposite);

    treeText = new BgcBaseText(searchComposite, SWT.SINGLE);
    treeText.addListener(
        SWT.DefaultSelection,
        new Listener() {
          @Override
          public void handleEvent(Event e) {
            internalSearch();
          }
        });
    treeText.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    treeText.setToolTipText(getTreeTextToolTip());
    searchComposite.setEnabled(false);

    adaptersTree = new AdapterTreeWidget(parent, false);
    getSite().setSelectionProvider(adaptersTree.getTreeViewer());

    createRootNode();
    adaptersTree.getTreeViewer().setInput(rootNode);
    adaptersTree.getTreeViewer().expandAll();
  }
  private void createContextsGroup(Composite parentComposite) {
    contextsSelectComp = new Composite(parentComposite, SWT.NULL);
    contextsSelectComp.setLayout(
        GridLayoutFactory.swtDefaults().spacing(10, 0).margins(0, 0).numColumns(2).create());
    GridDataFactory.swtDefaults()
        .align(SWT.RIGHT, SWT.DOWN)
        .grab(true, false)
        .applyTo(contextsSelectComp);
    GridLayout layout2 = (GridLayout) contextsSelectComp.getLayout();
    layout2.marginHeight = 0;
    layout2.marginTop = 0;
    layout2.marginBottom = 0;

    Label contextSeletLabel = new Label(contextsSelectComp, SWT.NULL);
    contextSeletLabel.setText(
        Messages.getString("ContextNebulaComposite.ContextGroupLabel")); // $NON-NLS-1$
    contextsCombo = new Combo(contextsSelectComp, SWT.READ_ONLY);
    contextsCombo.addSelectionListener(
        new SelectionListener() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            Object obj = e.getSource();
            String selectContext = ((Combo) obj).getText();
            IContext defaultContext = modelManager.getContextManager().getDefaultContext();
            if (selectContext.equals(defaultContext.getName())) {
            } else {
              IContext newSelContext = null;
              for (IContext enviroContext : modelManager.getContextManager().getListContext()) {
                if (selectContext.equals(enviroContext.getName())) {
                  newSelContext = enviroContext;
                }
              }
              modelManager.onContextChangeDefault(modelManager.getContextManager(), newSelContext);
              refresh();
            }
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent e) {}
        });
  }
Exemple #23
0
  private void create(Shell parent, boolean readOnly) {
    shell.setText("Segmentation");
    if (parent != null) UIUtil.inheritIcon(shell, parent);
    GridLayout layTmp = new GridLayout();
    layTmp.marginBottom = 0;
    layTmp.verticalSpacing = 0;
    shell.setLayout(layTmp);

    createComposite(shell);

    // --- Dialog-level buttons

    SelectionAdapter OKCancelActions =
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            result = false;
            if (e.widget.getData().equals("h")) {
              if (help != null) help.showWiki("Segmentation Step");
              return;
            }
            if (e.widget.getData().equals("o")) saveData();
            shell.close();
          };
        };
    pnlActions = new OKCancelPanel(shell, SWT.NONE, OKCancelActions, true);
    pnlActions.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    pnlActions.btOK.setEnabled(!readOnly);
    if (!readOnly) {
      shell.setDefaultButton(pnlActions.btOK);
    }

    shell.pack();
    shell.setMinimumSize(shell.getSize());
    Point startSize = shell.getMinimumSize();
    if (startSize.x < 600) startSize.x = 600;
    shell.setSize(startSize);
    setData();
    Dialogs.centerWindow(shell, parent);
  }
Exemple #24
0
  private void createFilesArea(Composite parent, FormToolkit toolkit, int span) {
    Section files = createSection(parent, toolkit, span);
    Composite filesArea = createSectionClient(files, toolkit);
    GridLayout filesAreaLayout = (GridLayout) filesArea.getLayout();
    filesAreaLayout.marginLeft = 0;
    filesAreaLayout.marginRight = 0;
    filesAreaLayout.marginTop = 0;
    filesAreaLayout.marginBottom = 0;

    CommitFileDiffViewer viewer =
        new CommitFileDiffViewer(
            filesArea,
            getSite(),
            SWT.MULTI
                | SWT.H_SCROLL
                | SWT.V_SCROLL
                | SWT.FULL_SELECTION
                | toolkit.getBorderStyle());
    // commit file diff viewer uses a nested composite with a stack layout
    // and so margins need to be applied to have form toolkit style borders
    toolkit.paintBordersFor(viewer.getTable().getParent());
    viewer.getTable().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
    StackLayout viewerLayout = (StackLayout) viewer.getControl().getParent().getLayout();
    viewerLayout.marginHeight = 2;
    viewerLayout.marginWidth = 2;
    GridDataFactory.fillDefaults()
        .grab(true, true)
        .hint(SWT.DEFAULT, 80)
        .applyTo(viewer.getTable().getParent());
    viewer.setContentProvider(ArrayContentProvider.getInstance());
    viewer.setTreeWalk(getCommit().getRepository(), null);

    FileDiff[] diffs = getCommit().getDiffs();
    viewer.setInput(diffs);
    files.setText(
        MessageFormat.format(UIText.CommitEditorPage_SectionFiles, Integer.valueOf(diffs.length)));

    updateSectionClient(files, filesArea, toolkit);
  }
 @Override
 protected Control createDialogArea(Composite parent) {
   setTitle(Messages.appDlgTxt);
   setMessage(Messages.appDlgMsg);
   // display help contents
   PlatformUI.getWorkbench()
       .getHelpSystem()
       .setHelp(parent, "com.persistent.winazure.eclipseplugin." + "windows_azure_addapp_dialog");
   Activator.getDefault().setSaved(false);
   Composite container = new Composite(parent, SWT.NONE);
   GridLayout gridLayout = new GridLayout();
   GridData gridData = new GridData();
   gridLayout.numColumns = 3;
   gridLayout.marginBottom = 10;
   gridData.verticalIndent = 10;
   gridData.horizontalAlignment = SWT.FILL;
   gridData.grabExcessHorizontalSpace = true;
   container.setLayout(gridLayout);
   container.setLayoutData(gridData);
   createAppFileCmpnt(container);
   createAppProjCmpnt(container);
   return super.createDialogArea(parent);
 }
Exemple #26
0
  @Override
  public void initGraphicComponents() {
    mainComposite = new Composite(parentComposite, SWT.NONE);
    if (parentComposite.getBackground() != null
        && !parentComposite.getBackground().equals(mainComposite.getBackground())) {
      mainComposite.setBackground(parentComposite.getBackground());
    }
    GridLayout layout = new GridLayout();
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.horizontalSpacing = 0;
    layout.marginTop = 0;
    layout.marginBottom = 0;
    layout.verticalSpacing = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    mainComposite.setLayout(layout);

    GridData gridData = new GridData(GridData.FILL_BOTH);

    mainComposite.setLayoutData(gridData);

    initTable();

    getExtendedTableViewer()
        .getTableViewerCreator()
        .getTableViewer()
        .setComparer(createElementComparer());
    getExtendedTableViewer()
        .getTableViewerCreator()
        .getTable()
        .setLayoutData(new GridData(GridData.FILL_BOTH));

    initToolBar();

    addListeners();
  }
  public ActionRetractFactWidget(
      FormToolkit toolkit,
      Composite parent,
      RuleModeller modeller,
      ActionRetractFact fact,
      int index) {

    super(parent, toolkit, modeller, index);

    this.fact = fact;

    GridLayout l = new GridLayout();
    l.numColumns = 4;
    l.marginBottom = 0;
    l.marginHeight = 0;
    l.marginLeft = 0;
    l.marginRight = 0;
    l.marginTop = 0;
    l.marginWidth = 0;
    l.verticalSpacing = 0;
    parent.setLayout(l);

    create();
  }
  /**
   * Initializes the boxes of the board
   *
   * @param board the model object containing the board information
   */
  protected void initializeBoard(Board board) {
    gBoxes = new ArrayList<GraphicalBox>();
    GridLayout gridLayout = new GridLayout(board.getColumns(), true);
    gridLayout.marginTop = 5;
    gridLayout.marginRight = 5;
    gridLayout.marginLeft = 5;
    gridLayout.marginBottom = 5;
    setLayout(gridLayout);

    List<Box> boxes = board.getBoxes();
    for (Box box : boxes) {
      GraphicalBox gb =
          new GraphicalBox(this, SWT.BORDER | SWT.CENTER, getImage(box), gBoxes.size() + 1);
      GridData gData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
      gData.verticalIndent = 5;
      gData.horizontalIndent = 5;
      gb.setLayoutData(gData);
      gBoxes.add(gb);
      gb.addListener(
          SWT.MouseDown,
          new Listener() {

            @Override
            public void handleEvent(Event event) {
              moves++;
              int boxNumber = ((GraphicalBox) event.widget).getNumber();
              if (moves % 2 == 1) {
                controller.makeFirstMove(boxNumber);
              } else {
                controller.makeSecondMove(boxNumber);
              }
            }
          });
    }
    layout();
  }
  private void createThreadStatesGroup(Composite composite) {
    Group gs = new Group(composite, SWT.NONE);
    gs.setText(Messages.TmfTimeLegend_TRACE_STATES);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gs.setLayoutData(gd);

    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 20;
    layout.marginBottom = 10;
    gs.setLayout(layout);

    // Go through all the defined colors and only add the ones you need.
    // This will not handle several colors assigned to a color, we have
    // 16 mil colors, and should not pick two to mean the same thing.
    for (int i = 0; i < TraceColorScheme.getStateColors().length; i++) {
      // Get the color enum related to the index
      StateColor stateColor = TraceColorScheme.getStateColors()[i];
      // Get the given name, provided by the interface to the application
      String stateName = ifUtil.getStateName(stateColor);
      if (stateName != "Not mapped") { // $NON-NLS-1$
        Bar bar = new Bar(gs, i);
        gd = new GridData();
        gd.widthHint = 40;
        gd.heightHint = 20;
        gd.verticalIndent = 8;
        bar.setLayoutData(gd);
        Label name = new Label(gs, SWT.NONE);
        name.setText(stateName);
        gd = new GridData();
        gd.horizontalIndent = 10;
        gd.verticalIndent = 8;
        name.setLayoutData(gd);
      }
    }
  }
 private void addCheckFields() {
   Composite checkGroup = new Composite(this, SWT.NONE);
   GridLayout checkGridLayout = new GridLayout(1, false);
   checkGroup.setLayout(checkGridLayout);
   GridData checkGridData = new GridData(GridData.FILL_HORIZONTAL);
   checkGridData.minimumHeight = 5;
   checkGroup.setLayoutData(checkGridData);
   Composite checkButtonComposite =
       Form.startNewGridLayout(checkGroup, 1, false, SWT.CENTER, SWT.BOTTOM);
   GridLayout checkButtonLayout = (GridLayout) checkButtonComposite.getLayout();
   checkButtonLayout.marginHeight = 0;
   checkButtonLayout.marginTop = 0;
   checkButtonLayout.marginBottom = 0;
   checkButtonLayout.marginLeft = 0;
   checkButtonLayout.marginRight = 0;
   checkButtonLayout.marginWidth = 0;
   checkConnectionBtn =
       new UtilsButton(
           checkButtonComposite,
           Messages.getString("OozieForm.check"),
           WIDTH_BUTTON_PIXEL,
           HEIGHT_BUTTON_PIXEL); //$NON-NLS-1$
   checkConnectionBtn.setEnabled(false);
 }