Java 类org.eclipse.swt.custom.ViewForm 实例源码

项目:Eclipse-Postfix-Code-Completion    文件:RenameTypeWizardSimilarElementsPage.java   
public void createControl(Composite parent) {

        ViewForm viewForm= new ViewForm(parent, SWT.BORDER | SWT.FLAT);

        Composite inner= new Composite(viewForm, SWT.NULL);
        GridLayout layout= new GridLayout();
        inner.setLayout(layout);

        createTreeAndSourceViewer(inner);
        createButtonComposite(inner);
        viewForm.setContent(inner);

        setControl(viewForm);

        Dialog.applyDialogFont(viewForm);
        PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.RENAME_TYPE_WIZARD_PAGE);
    }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:RenameTypeWizardSimilarElementsPage.java   
public void createControl(Composite parent) {

        ViewForm viewForm= new ViewForm(parent, SWT.BORDER | SWT.FLAT);

        Composite inner= new Composite(viewForm, SWT.NULL);
        GridLayout layout= new GridLayout();
        inner.setLayout(layout);

        createTreeAndSourceViewer(inner);
        createButtonComposite(inner);
        viewForm.setContent(inner);

        setControl(viewForm);

        Dialog.applyDialogFont(viewForm);
        PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.RENAME_TYPE_WIZARD_PAGE);
    }
项目:xiliary    文件:LayoutReconciliation.java   
void run() {
  if( adapter.getParent() != null ) {
    if( adapter.getParent().getLayout() instanceof StackLayout ) {
      reconcileStackLayout();
    }
    if( adapter.getParent() instanceof ViewForm ) {
      reconcileViewFormLayout();
    }
    if( adapter.getParent().getClass().getName().equals( "org.eclipse.ui.part.PageBook" ) ) {
      reconcilePageBookLayout();
    }
    if( adapter.getParent() instanceof SashForm ) {
      reconcileSashLayout();
    }
    if( adapter.getParent() instanceof CTabFolder ) {
      reconcileCTabFolder();
    }
  }
}
项目:xiliary    文件:LayoutReconciliation.java   
private void reconcileViewFormLayout() {
  ViewForm viewForm = ( ViewForm )adapter.getParent();
  if( scrollable.isSameAs( viewForm.getContent() ) ) {
    viewForm.setContent( adapter );
    relayout( viewForm );
  }
  if( scrollable.isSameAs( viewForm.getTopCenter() ) ) {
    viewForm.setTopCenter( adapter );
    relayout( viewForm );
  }
  if( scrollable.isSameAs( viewForm.getTopLeft() ) ) {
    viewForm.setTopLeft( adapter );
    relayout( viewForm );
  }
  if( scrollable.isSameAs( viewForm.getTopRight() ) ) {
    viewForm.setTopRight( adapter );
    relayout( viewForm );
  }
}
项目:egradle    文件:SWTFactory.java   
/**
 * Creates a {@link ViewForm}
 * 
 * @param parent
 * @param style
 * @param cols
 * @param span
 * @param fill
 * @param marginwidth
 * @param marginheight
 * @return a new {@link ViewForm}
 */
public static ViewForm createViewform(Composite parent, int style, int cols, int span, int fill, int marginwidth,
        int marginheight) {
    ViewForm form = new ViewForm(parent, style);
    form.setFont(parent.getFont());
    GridLayout layout = new GridLayout(cols, false);
    layout.marginWidth = marginwidth;
    layout.marginHeight = marginheight;
    form.setLayout(layout);
    GridData gd = new GridData(fill);
    gd.horizontalSpan = span;
    form.setLayoutData(gd);
    return form;
}
项目:http4e    文件:ResponseView.java   
private ViewForm doToolbar( String title, final ItemModel model, final Composite parent){

      final ViewForm vForm = ViewUtils.buildViewForm(title, model, parent);
      final ToolBar bar = new ToolBar(vForm, SWT.FLAT);

      ToolItem i_raw = new ToolItem(bar, SWT.RADIO);
      i_raw.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.RAW));
      i_raw.setToolTipText("Raw View");

      ToolItem i_pretty = new ToolItem(bar, SWT.RADIO);
      i_pretty.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.PRETTY));
      i_pretty.setToolTipText("Pretty View");

      ToolItem i_json = new ToolItem(bar, SWT.RADIO);
      i_json.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.JSON));
      i_json.setToolTipText("JSON View");

      ToolItem i_hex = new ToolItem(bar, SWT.RADIO);
      i_hex.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.HEX));
      i_hex.setToolTipText("Hex View");

      ToolItem i_br = new ToolItem(bar, SWT.RADIO);
      i_br.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.BROWSER));
      i_br.setToolTipText("View in Browser");

      vForm.setTopCenter(bar);

      return vForm;
   }
项目:http4e    文件:ViewUtils.java   
static ViewForm buildViewForm( final String title, final ItemModel model, final Composite parent){
   final ViewForm vForm = new ViewForm(parent, SWT.NONE);

   // -- Label(vForm)
   final CLabel label = new CLabel(vForm, SWT.NONE);
   label.setText(CoreConstants.TITLE_SPACE + title + CoreConstants.TITLE_SPACE);
   label.setAlignment(SWT.LEFT);
   label.setBackground(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.TITLE_LINE));
   label.addMouseListener(new MouseAdapter() {
      public void mouseDoubleClick( MouseEvent e){
         int eventType = ModelEvent.UNKNOWN;
         if (CoreConstants.TITLE_HEADERS.equals(title)) {
            eventType = ModelEvent.HEADERS_RESIZED;

         } else if (CoreConstants.TITLE_PARAMETERS.equals(title)) {
            eventType = ModelEvent.PARAMS_RESIZED;

         } else if (CoreConstants.TITLE_BODY.equals(title)) {
            eventType = ModelEvent.BODY_RESIZED;

         } else if (CoreConstants.TITLE_REQUEST.equals(title)) {
            eventType = ModelEvent.REQUEST_RESIZED;

         } else if (CoreConstants.TITLE_RESPONSE.equals(title)) {
            eventType = ModelEvent.RESPONSE_RESIZED;
         }
         model.fireExecute(new ModelEvent(eventType, model));
      }
   });

   vForm.setTopLeft(label);

   return vForm;
}
项目:http4e    文件:Utils.java   
public static ToolItem getItem( int position, ViewForm vForm){
   ToolItem item = null;
   Control[] arr1 = vForm.getChildren();
   for (int i = 0; i < arr1.length; i++) {
      if (arr1[i] instanceof ToolBar) {
         ToolBar tBar = (ToolBar) arr1[i];
         ToolItem[] arr2 = tBar.getItems();
         return arr2[position];
      }
   }
   return item;
}
项目:tlaplus    文件:FilteredItemsSelectionDialog.java   
/**
 * Constructs a new instance of this class given its parent and a style
 * value describing its behavior and appearance.
 *
 * @param parent
 *            the parent component
 * @param style
 *            SWT style bits
 */
public DetailsContentViewer(Composite parent, int style) {
    viewForm = new ViewForm(parent, style);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    viewForm.setLayoutData(gd);
    label = new CLabel(viewForm, SWT.FLAT);
    label.setFont(parent.getFont());
    viewForm.setContent(label);
    hookControl(label);
}
项目:xiliary    文件:LayoutReconciliationHelper.java   
Rectangle setUpWithViewFormOnContent() {
  ViewForm viewForm = new ViewForm( shell, SWT.NONE );
  parent = viewForm;
  scrollable = createTree( viewForm, 1, 1 );
  adapter = new ScrollableAdapterFactory().create( scrollable, TreeAdapter.class ).get();
  adapter.setBounds( INITIAL_ADAPTER_BOUNDS );
  viewForm.setContent( scrollable );
  reconciliation = new LayoutReconciliation( adapter, new ScrollableControl<>( scrollable ) );
  shell.open();
  return INITIAL_ADAPTER_BOUNDS;
}
项目:xiliary    文件:LayoutReconciliationHelper.java   
Rectangle setUpWithViewFormOnTopCenter() {
  ViewForm viewForm = new ViewForm( shell, SWT.NONE );
  parent = viewForm;
  scrollable = createTree( viewForm, 1, 1 );
  adapter = new ScrollableAdapterFactory().create( scrollable, TreeAdapter.class ).get();
  adapter.setBounds( INITIAL_ADAPTER_BOUNDS );
  viewForm.setTopCenter( scrollable );
  reconciliation = new LayoutReconciliation( adapter, new ScrollableControl<>( scrollable ) );
  shell.open();
  return INITIAL_ADAPTER_BOUNDS;
}
项目:xiliary    文件:LayoutReconciliationHelper.java   
Rectangle setUpWithViewFormOnTopLeft() {
  ViewForm viewForm = new ViewForm( shell, SWT.NONE );
  parent = viewForm;
  scrollable = createTree( viewForm, 1, 1 );
  adapter = new ScrollableAdapterFactory().create( scrollable, TreeAdapter.class ).get();
  adapter.setBounds( INITIAL_ADAPTER_BOUNDS );
  viewForm.setTopLeft( scrollable );
  reconciliation = new LayoutReconciliation( adapter, new ScrollableControl<>( scrollable ) );
  shell.open();
  return INITIAL_ADAPTER_BOUNDS;
}
项目:xiliary    文件:LayoutReconciliationHelper.java   
Rectangle setUpWithViewFormOnTopRight() {
  ViewForm viewForm = new ViewForm( shell, SWT.NONE );
  parent = viewForm;
  scrollable = createTree( viewForm, 1, 1 );
  adapter = new ScrollableAdapterFactory().create( scrollable, TreeAdapter.class ).get();
  adapter.setBounds( INITIAL_ADAPTER_BOUNDS );
  viewForm.setTopRight( scrollable );
  reconciliation = new LayoutReconciliation( adapter, new ScrollableControl<>( scrollable ) );
  shell.open();
  return INITIAL_ADAPTER_BOUNDS;
}
项目:goclipse    文件:SWTFactory.java   
/**
 * Creates a {@link ViewForm}
 * @param parent
 * @param style
 * @param cols
 * @param span
 * @param fill
 * @param marginwidth
 * @param marginheight
 * @return a new {@link ViewForm}
 * @since 3.6
 */
public static ViewForm createViewform(Composite parent, int style, int cols, int span, int fill, int marginwidth, int marginheight) {
    ViewForm form = new ViewForm(parent, style);
    form.setFont(parent.getFont());
    GridLayout layout = new GridLayout(cols, false);
       layout.marginWidth = marginwidth;
    layout.marginHeight = marginheight;
       form.setLayout(layout);
    GridData gd = new GridData(fill);
    gd.horizontalSpan = span;
    form.setLayoutData(gd);
    return form;
}
项目:Eclipse-Postfix-Code-Completion    文件:ReferencesInBinaryStatusContextViewer.java   
/**
 * {@inheritDoc}
 */
public void createControl(Composite parent) {
    fForm= new ViewForm(parent, SWT.BORDER | SWT.FLAT);
    fForm.marginWidth= 0;
    fForm.marginHeight= 0;

    fLabel= new CLabel(fForm, SWT.NONE);
    fLabel.setText(RefactoringMessages.ReferencesInBinaryStatusContextViewer_title);
    fForm.setTopLeft(fLabel);

    Composite composite= new Composite(fForm, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    GridLayout layout= new GridLayout(1, false);
    layout.marginWidth= 0;
    layout.marginHeight= 0;
    composite.setLayout(layout);


    fTreeViewer= new TreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    final AppearanceAwareLabelProvider labelProvider= new AppearanceAwareLabelProvider();
    fTreeViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(labelProvider));
    fTreeViewer.setComparator(new ViewerComparator() {
        private Collator fCollator= Collator.getInstance();
        @Override
        public int compare(Viewer viewer, Object e1, Object e2) {
            String l1= labelProvider.getText(e1);
            String l2= labelProvider.getText(e2);
            return fCollator.compare(l1, l2);
        }
    });
    fTreeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    fButton= new Button(composite, SWT.PUSH);
    fButton.setText(RefactoringMessages.ReferencesInBinaryStatusContextViewer_show_as_search_button);
    GridData layoutData= new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
    layoutData.widthHint= SWTUtil.getButtonWidthHint(fButton);
    fButton.setLayoutData(layoutData);
    fButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            fillInSearchView();
        }
    });
    fButton.setEnabled(false);

    fForm.setContent(composite);

    Dialog.applyDialogFont(parent);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ReferencesInBinaryStatusContextViewer.java   
/**
 * {@inheritDoc}
 */
public void createControl(Composite parent) {
    fForm= new ViewForm(parent, SWT.BORDER | SWT.FLAT);
    fForm.marginWidth= 0;
    fForm.marginHeight= 0;

    fLabel= new CLabel(fForm, SWT.NONE);
    fLabel.setText(RefactoringMessages.ReferencesInBinaryStatusContextViewer_title);
    fForm.setTopLeft(fLabel);

    Composite composite= new Composite(fForm, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    GridLayout layout= new GridLayout(1, false);
    layout.marginWidth= 0;
    layout.marginHeight= 0;
    composite.setLayout(layout);


    fTreeViewer= new TreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    final AppearanceAwareLabelProvider labelProvider= new AppearanceAwareLabelProvider();
    fTreeViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(labelProvider));
    fTreeViewer.setComparator(new ViewerComparator() {
        private Collator fCollator= Collator.getInstance();
        @Override
        public int compare(Viewer viewer, Object e1, Object e2) {
            String l1= labelProvider.getText(e1);
            String l2= labelProvider.getText(e2);
            return fCollator.compare(l1, l2);
        }
    });
    fTreeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    fButton= new Button(composite, SWT.PUSH);
    fButton.setText(RefactoringMessages.ReferencesInBinaryStatusContextViewer_show_as_search_button);
    GridData layoutData= new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
    layoutData.widthHint= SWTUtil.getButtonWidthHint(fButton);
    fButton.setLayoutData(layoutData);
    fButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            fillInSearchView();
        }
    });
    fButton.setEnabled(false);

    fForm.setContent(composite);

    Dialog.applyDialogFont(parent);
}