Java Code Examples for org.eclipse.swt.widgets.Composite

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project Archimedes, under directory /br.org.archimedes.core/src/br/org/archimedes/gui/swt/preferences/.

Source file: PreferencesEditor.java

  32 
vote

/** 
 * Creates the buttons
 */
private void createButtons(){
  Composite buttonsComposite=new Composite(shell,SWT.NONE);
  buttonsComposite.setLayout(new FillLayout());
  okButton=new Button(buttonsComposite,SWT.PUSH);
  okButton.setText(Messages.OK);
  okButton.addSelectionListener(getOKSelectionAdapter());
  okButton.setVisible(true);
}
 

Example 2

From project Archimedes, under directory /br.org.archimedes.core/src/br/org/archimedes/gui/swt/.

Source file: WorkspacePropertiesDialog.java

  32 
vote

/** 
 * Creates the composite for the dialog buttons.
 * @return The created composite to be layed out.
 */
private Composite createButtonsComposite(){
  Composite buttonsComposite=new Composite(shell,SWT.NONE);
  GridLayout buttonsCompositeLayout=new GridLayout(2,true);
  buttonsComposite.setLayout(buttonsCompositeLayout);
  GridData buttonsLayoutData;
  okButton=createOkButton(buttonsComposite);
  buttonsLayoutData=new GridData(SWT.FILL,SWT.TOP,false,false);
  okButton.setLayoutData(buttonsLayoutData);
  Button cancelButton=createCancelButton(buttonsComposite);
  buttonsLayoutData=new GridData(SWT.FILL,SWT.TOP,false,false);
  cancelButton.setLayoutData(buttonsLayoutData);
  return buttonsComposite;
}
 

Example 3

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/ui/overview/.

Source file: GradientBoxComposite.java

  32 
vote

/** 
 * Creates a horizontal composite for this gradient box with the specified background image tiled repeatedly in the horizontal direction.
 * @param imageKey The key of the image to use for the background.
 * @return The new composite.
 */
private Composite createHorizontalComposite(String imageKey){
  Composite composite=toolkit.createComposite(this);
  TableWrapData layoutData=new TableWrapData(TableWrapData.FILL);
  if (imageKey != null) {
    composite.setBackgroundImage(imageRegistry.get(imageKey));
    composite.setBackgroundMode(SWT.INHERIT_DEFAULT);
    layoutData.heightHint=imageRegistry.get(imageKey).getImageData().height;
    layoutData.maxWidth=imageRegistry.get(imageKey).getImageData().width;
  }
  composite.setLayoutData(layoutData);
  return composite;
}
 

Example 4

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/ui/overview/.

Source file: GradientBoxComposite.java

  32 
vote

/** 
 * Creates a vertical composite for this gradient box with the specified background image tiled repeatedly in the vertical direction.
 * @param imageKey The key of the image to use for the background.
 * @return The new composite.
 */
private Composite createVerticalComposite(String imageKey){
  Composite composite=toolkit.createComposite(this);
  composite.setBackgroundImage(imageRegistry.get(imageKey));
  composite.setBackgroundMode(SWT.INHERIT_DEFAULT);
  TableWrapData layoutData=new TableWrapData(TableWrapData.FILL,TableWrapData.FILL);
  layoutData.maxWidth=imageRegistry.get(imageKey).getImageData().width;
  layoutData.grabVertical=true;
  composite.setLayoutData(layoutData);
  return composite;
}
 

Example 5

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/ui/preferences/.

Source file: AwsToolkitPreferencePage.java

  32 
vote

/** 
 * Creates a thin, empty composite to help space components vertically.
 * @param parent The composite this spacer is being added to.
 */
protected void createSpacer(Composite parent){
  Composite spacer=new Composite(parent,SWT.NONE);
  GridData data=new GridData(GridData.FILL_HORIZONTAL);
  data.heightHint=5;
  data.horizontalSpan=LAYOUT_COLUMN_WIDTH;
  spacer.setLayoutData(data);
}
 

Example 6

From project bel-editor, under directory /org.openbel.editor.ui/src/org/openbel/editor/ui/properties/.

Source file: BELEditorPropertyPage.java

  32 
vote

private void addFirstSection(Composite parent){
  Composite composite=createDefaultComposite(parent);
  Label pathLabel=new Label(composite,SWT.NONE);
  pathLabel.setText(PATH_TITLE);
  Text pathValueText=new Text(composite,SWT.WRAP | SWT.READ_ONLY);
  pathValueText.setText(((IResource)getElement()).getFullPath().toString());
}
 

Example 7

From project bel-editor, under directory /org.openbel.editor.ui/src/org/openbel/editor/ui/properties/.

Source file: BELEditorPropertyPage.java

  32 
vote

/** 
 * @see PreferencePage#createContents(Composite)
 */
@Override protected Control createContents(Composite parent){
  Composite composite=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  composite.setLayout(layout);
  GridData data=new GridData(GridData.FILL);
  data.grabExcessHorizontalSpace=true;
  composite.setLayoutData(data);
  addFirstSection(composite);
  addSeparator(composite);
  addSecondSection(composite);
  return composite;
}
 

Example 8

From project bel-editor, under directory /org.openbel.editor.ui/src/org/openbel/editor/ui/properties/.

Source file: BELEditorPropertyPage.java

  32 
vote

private Composite createDefaultComposite(Composite parent){
  Composite composite=new Composite(parent,SWT.NULL);
  GridLayout layout=new GridLayout();
  layout.numColumns=2;
  composite.setLayout(layout);
  GridData data=new GridData();
  data.verticalAlignment=GridData.FILL;
  data.horizontalAlignment=GridData.FILL;
  composite.setLayoutData(data);
  return composite;
}
 

Example 9

From project BHT-FPA, under directory /mailer-common/de.bht.fpa.mail.common/src/de/bht/fpa/mail/s000000/common/rcp/exception/.

Source file: ExceptionDetailsErrorDialog.java

  32 
vote

@Override protected void createDialogAndButtonArea(Composite parent){
  super.createDialogAndButtonArea(parent);
  if (this.dialogArea instanceof Composite) {
    Composite dialogComposite=(Composite)dialogArea;
    if (dialogComposite.getChildren().length == 0) {
      new Label(dialogComposite,SWT.NULL);
    }
  }
}
 

Example 10

From project adt-cdt, under directory /com.android.ide.eclipse.adt.cdt/src/com/android/ide/eclipse/adt/cdt/internal/preferences/.

Source file: NDKPreferencePage.java

  31 
vote

/** 
 * Create contents of the preference page.
 * @param parent
 */
@Override public Control createContents(Composite parent){
  Composite container=new Composite(parent,SWT.NULL);
  container.setLayout(new GridLayout(1,false));
  Group grpNdkLocation=new Group(container,SWT.NONE);
  grpNdkLocation.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false,1,1));
  grpNdkLocation.setText("NDK Location");
  grpNdkLocation.setLayout(new GridLayout(2,false));
  text=new Text(grpNdkLocation,SWT.BORDER);
  text.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false,1,1));
  String ndkLoc=NDKManager.getNDKLocation();
  if (ndkLoc != null)   text.setText(ndkLoc);
  Button button=new Button(grpNdkLocation,SWT.NONE);
  button.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      String dir=new DirectoryDialog(NDKPreferencePage.this.getShell()).open();
      if (dir != null)       text.setText(dir);
    }
  }
);
  button.setText("Browse...");
  return container;
}
 

Example 11

From project Archimedes, under directory /br.org.archimedes.core/src/br/org/archimedes/gui/rca/.

Source file: LayerComboContributionItem.java

  31 
vote

@Override protected Control createControl(Composite parent){
  final Controller controller=br.org.archimedes.Utils.getController();
  Composite top=new Composite(parent,SWT.NONE);
  GridLayoutFactory.fillDefaults().applyTo(top);
  layersCombo=new Combo(top,SWT.READ_ONLY);
  layersCombo.addSelectionListener(new ComboSelectionListener(controller));
  layersCombo.addFocusListener(new ComboFocusListener());
  layersCombo.addKeyListener(new ComboKeyListener());
  try {
    Drawing activeDrawing=controller.getActiveDrawing();
    setObservedDrawing(activeDrawing);
  }
 catch (  NoActiveDrawingException e) {
    deactivateCombo();
  }
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.BEGINNING).grab(true,false).applyTo(layersCombo);
  IWorkbenchWindow window=getWorkbenchWindow();
  window.addPageListener(new IPageListener(){
    public void pageActivated(    IWorkbenchPage page){
    }
    public void pageClosed(    IWorkbenchPage page){
      page.removePartListener(LayerComboContributionItem.this);
    }
    public void pageOpened(    IWorkbenchPage page){
      page.addPartListener(LayerComboContributionItem.this);
    }
  }
);
  return top;
}
 

Example 12

From project BHT-FPA, under directory /mailer-common/de.bht.fpa.mail.common/src/de/bht/fpa/mail/s000000/common/filter/.

Source file: FilterDialog.java

  31 
vote

private void addUnionIntersection(){
  Composite unionIntersectionComponent=new Composite(container,SWT.NONE);
  unionIntersectionComponent.setLayout(new GridLayout(NR_OF_COLUMNS,false));
  Label lblBeiErfllen=new Label(unionIntersectionComponent,SWT.NONE);
  lblBeiErfllen.setText("If");
  groupFilterComboViewer=new ComboViewer(unionIntersectionComponent,SWT.READ_ONLY);
  groupFilterComboViewer.setContentProvider(ArrayContentProvider.getInstance());
  groupFilterComboViewer.setLabelProvider(new LabelProvider(){
    @Override public String getText(    Object element){
      return ((FilterGroupType)element).value();
    }
  }
);
  groupFilterComboViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      filterGroupType=SelectionHelper.handleStructuredSelectionEvent(event,FilterGroupType.class);
    }
  }
);
  groupFilterComboViewer.setInput(FilterGroupType.values());
  groupFilterComboViewer.setSelection(new StructuredSelection(FilterGroupType.UNION));
  Label lblDerFolgendenBedingungen=new Label(unionIntersectionComponent,SWT.NONE);
  lblDerFolgendenBedingungen.setText("of the following conditions are met:");
}
 

Example 13

From project BHT-FPA, under directory /mailer-common/de.bht.fpa.mail.common/src/de/bht/fpa/mail/s000000/common/rcp/exception/.

Source file: ExceptionDetailsErrorDialog.java

  31 
vote

/** 
 * This implementation of the <code>Dialog</code> framework method creates and lays out a composite and calls <code>createMessageArea</code> and <code>createCustomArea</code> to populate it. Subclasses should override <code>createCustomArea</code> to add contents below the message.
 */
@Override protected Control createDialogArea(Composite parent){
  createMessageArea(parent);
  Composite composite=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  layout.marginHeight=convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
  layout.marginWidth=convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
  layout.verticalSpacing=convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
  layout.horizontalSpacing=convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
  layout.numColumns=2;
  composite.setLayout(layout);
  GridData childData=new GridData(GridData.FILL_BOTH);
  childData.horizontalSpan=2;
  composite.setLayoutData(childData);
  composite.setFont(parent.getFont());
  return composite;
}
 

Example 14

From project acceleo-modules, under directory /psm-gen-scala/plugins/com.github.sbegaudeau.acceleo.modules.psm.gen.scala.editor/src-gen/com/github/sbegaudeau/acceleo/modules/psm/gen/scala/model/scala/presentation/.

Source file: ScalaEditor.java

  29 
vote

/** 
 * This accesses a cached version of the content outliner. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage(){
  if (contentOutlinePage == null) {
class MyContentOutlinePage extends ContentOutlinePage {
      @Override public void createControl(      Composite parent){
        super.createControl(parent);
        contentOutlineViewer=getTreeViewer();
        contentOutlineViewer.addSelectionChangedListener(this);
        contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
        contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider.ColorProvider(adapterFactory,contentOutlineViewer));
        contentOutlineViewer.setInput(editingDomain.getResourceSet());
        createContextMenuFor(contentOutlineViewer);
        if (!editingDomain.getResourceSet().getResources().isEmpty()) {
          contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)),true);
        }
      }
      @Override public void makeContributions(      IMenuManager menuManager,      IToolBarManager toolBarManager,      IStatusLineManager statusLineManager){
        super.makeContributions(menuManager,toolBarManager,statusLineManager);
        contentOutlineStatusLineManager=statusLineManager;
      }
      @Override public void setActionBars(      IActionBars actionBars){
        super.setActionBars(actionBars);
        getActionBarContributor().shareGlobalActions(this,actionBars);
      }
    }
    contentOutlinePage=new MyContentOutlinePage();
    contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener(){
      public void selectionChanged(      SelectionChangedEvent event){
        handleContentOutlineSelection(event.getSelection());
      }
    }
);
  }
  return contentOutlinePage;
}
 

Example 15

From project acceleo-webapp-generator, under directory /plugins/org.eclipse.acceleo.tutorial.webapp.editor/src-gen/org/eclipse/acceleo/tutorial/webapp/presentation/.

Source file: WebappEditor.java

  29 
vote

/** 
 * This accesses a cached version of the content outliner. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage(){
  if (contentOutlinePage == null) {
class MyContentOutlinePage extends ContentOutlinePage {
      @Override public void createControl(      Composite parent){
        super.createControl(parent);
        contentOutlineViewer=getTreeViewer();
        contentOutlineViewer.addSelectionChangedListener(this);
        contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
        contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
        contentOutlineViewer.setInput(editingDomain.getResourceSet());
        createContextMenuFor(contentOutlineViewer);
        if (!editingDomain.getResourceSet().getResources().isEmpty()) {
          contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)),true);
        }
      }
      @Override public void makeContributions(      IMenuManager menuManager,      IToolBarManager toolBarManager,      IStatusLineManager statusLineManager){
        super.makeContributions(menuManager,toolBarManager,statusLineManager);
        contentOutlineStatusLineManager=statusLineManager;
      }
      @Override public void setActionBars(      IActionBars actionBars){
        super.setActionBars(actionBars);
        getActionBarContributor().shareGlobalActions(this,actionBars);
      }
    }
    contentOutlinePage=new MyContentOutlinePage();
    contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener(){
      public void selectionChanged(      SelectionChangedEvent event){
        handleContentOutlineSelection(event.getSelection());
      }
    }
);
  }
  return contentOutlinePage;
}
 

Example 16

From project acceleo-webapp-generator, under directory /plugins/org.obeonetwork.pim.gen.backbone.model.editor/src-gen/org/obeonetwork/pim/gen/backbone/model/backbone/presentation/.

Source file: BackboneEditor.java

  29 
vote

/** 
 * This accesses a cached version of the content outliner. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage(){
  if (contentOutlinePage == null) {
class MyContentOutlinePage extends ContentOutlinePage {
      @Override public void createControl(      Composite parent){
        super.createControl(parent);
        contentOutlineViewer=getTreeViewer();
        contentOutlineViewer.addSelectionChangedListener(this);
        contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
        contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
        contentOutlineViewer.setInput(editingDomain.getResourceSet());
        createContextMenuFor(contentOutlineViewer);
        if (!editingDomain.getResourceSet().getResources().isEmpty()) {
          contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)),true);
        }
      }
      @Override public void makeContributions(      IMenuManager menuManager,      IToolBarManager toolBarManager,      IStatusLineManager statusLineManager){
        super.makeContributions(menuManager,toolBarManager,statusLineManager);
        contentOutlineStatusLineManager=statusLineManager;
      }
      @Override public void setActionBars(      IActionBars actionBars){
        super.setActionBars(actionBars);
        getActionBarContributor().shareGlobalActions(this,actionBars);
      }
    }
    contentOutlinePage=new MyContentOutlinePage();
    contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener(){
      public void selectionChanged(      SelectionChangedEvent event){
        handleContentOutlineSelection(event.getSelection());
      }
    }
);
  }
  return contentOutlinePage;
}
 

Example 17

From project acceleo-webapp-generator, under directory /plugins/org.obeonetwork.pim.gen.bootstrap.model.editor/src-gen/org/obeonetwork/pim/gen/bootstrap/model/bootstrap/presentation/.

Source file: BootstrapEditor.java

  29 
vote

/** 
 * This accesses a cached version of the content outliner. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage(){
  if (contentOutlinePage == null) {
class MyContentOutlinePage extends ContentOutlinePage {
      @Override public void createControl(      Composite parent){
        super.createControl(parent);
        contentOutlineViewer=getTreeViewer();
        contentOutlineViewer.addSelectionChangedListener(this);
        contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
        contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
        contentOutlineViewer.setInput(editingDomain.getResourceSet());
        createContextMenuFor(contentOutlineViewer);
        if (!editingDomain.getResourceSet().getResources().isEmpty()) {
          contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)),true);
        }
      }
      @Override public void makeContributions(      IMenuManager menuManager,      IToolBarManager toolBarManager,      IStatusLineManager statusLineManager){
        super.makeContributions(menuManager,toolBarManager,statusLineManager);
        contentOutlineStatusLineManager=statusLineManager;
      }
      @Override public void setActionBars(      IActionBars actionBars){
        super.setActionBars(actionBars);
        getActionBarContributor().shareGlobalActions(this,actionBars);
      }
    }
    contentOutlinePage=new MyContentOutlinePage();
    contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener(){
      public void selectionChanged(      SelectionChangedEvent event){
        handleContentOutlineSelection(event.getSelection());
      }
    }
);
  }
  return contentOutlinePage;
}