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

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 BHT-FPA, under directory /mailer-common/de.bht.fpa.mail.common/src/de/bht/fpa/mail/s000000/common/rcp/exception/.

Source file: ExceptionDetailsErrorDialog.java

  22 
vote

/** 
 * Show the details portion of the dialog if it is not already visible. This method will only work when it is invoked after the control of the dialog has been set. In other words, after the <code>createContents</code> method has been invoked and has returned the control for the content area of the dialog. Invoking the method before the content area has been set or after the dialog has been disposed will have no effect.
 * @since 3.1
 */
protected final void showDetailsArea(){
  if (!listCreated) {
    Control control=getContents();
    if (control != null && !control.isDisposed()) {
      toggleDetailsArea();
    }
  }
}
 

Example 2

From project Bio-PEPA, under directory /uk.ac.ed.inf.common.ui.plotview/src/uk/ac/ed/inf/common/ui/plotview/views/actions/.

Source file: SaveChartDialog.java

  22 
vote

protected Control createContents(Composite parent){
  Control contents=super.createContents(parent);
  setTitle("Export Options");
  setMessage("Select size and resolution");
  return contents;
}
 

Example 3

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.spectrum/src/net/bioclipse/spectrum/dialogs/.

Source file: AddMetadataDialog.java

  22 
vote

@Override protected Control createContents(Composite parent){
  Control contents=super.createContents(parent);
  setTitle("Add Metadata entries");
  setMessage("Add new Metadata entry to one of the existing categories, or create a new one");
  return contents;
}
 

Example 4

From project bndtools, under directory /bndtools.core/src/bndtools/launch/ui/.

Source file: GenericStackedLaunchTab.java

  22 
vote

public void createControl(Composite parent){
  Composite composite=new Composite(parent,SWT.NONE);
  setControl(composite);
  composite.setLayout(new GridLayout(1,false));
  for (  ILaunchTabPiece piece : getStack()) {
    Control control=piece.createControl(composite);
    control.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,false));
    piece.addPropertyChangeListener(updateListener);
  }
}
 

Example 5

From project bpelunit, under directory /tycho/net.bpelunit.toolsupport/editors/sections/.

Source file: StructuredSection.java

  22 
vote

protected void hookMenu(){
  MenuManager popupMenuManager=new MenuManager();
  IMenuListener listener=new IMenuListener(){
    public void menuAboutToShow(    IMenuManager mng){
      fillContextMenu(mng);
    }
  }
;
  popupMenuManager.addMenuListener(listener);
  popupMenuManager.setRemoveAllWhenShown(true);
  Control control=getViewer().getControl();
  Menu menu=popupMenuManager.createContextMenu(control);
  control.setMenu(menu);
}
 

Example 6

From project bundlemaker, under directory /main/org.bundlemaker.core.ui/src/org/bundlemaker/core/ui/handler/.

Source file: EditModuleDialog.java

  22 
vote

@Override public void setErrorMessage(String newErrorMessage){
  super.setErrorMessage(newErrorMessage);
  Control button=getButton(IDialogConstants.OK_ID);
  if (button != null) {
    button.setEnabled(newErrorMessage == null);
  }
}
 

Example 7

From project ccw, under directory /ccw.core/src/java/ccw/preferences/.

Source file: SyntaxColoringPreferencePage.java

  22 
vote

/** 
 * @param parent the parent composite
 * @return the control for the preference page
 */
public Control createContents(Composite parent){
  initializeDialogUnits(parent);
  ScrolledPageContent scrolled=new ScrolledPageContent(parent,SWT.H_SCROLL | SWT.V_SCROLL);
  scrolled.setExpandHorizontal(true);
  scrolled.setExpandVertical(true);
  Control control=createSyntaxPage(scrolled);
  scrolled.setContent(control);
  final Point size=control.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  scrolled.setMinSize(size.x,size.y);
  return scrolled;
}
 

Example 8

From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/code/editor/.

Source file: RulerEnableDisableBreakpointAction.java

  22 
vote

public RulerEnableDisableBreakpointAction(ITextEditor editor,IVerticalRulerInfo info){
  super(editor,info);
  setText("&Disable Breakpoint");
  update();
  Control control=info.getControl();
  if (control != null && !control.isDisposed())   control.addMouseListener(this);
}
 

Example 9

From project cilia-workbench, under directory /cilia-workbench-common/src/fr/liglab/adele/cilia/workbench/common/ui/editors/.

Source file: KeyValueEditor.java

  22 
vote

@Override public void controlResized(ControlEvent e){
  Control control=table.getControl();
  int width=control.getBounds().width / 2 - 2;
  col1.getColumn().setWidth(width);
  col2.getColumn().setWidth(width);
}
 

Example 10

From project CIShell, under directory /clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/builder/components/.

Source file: LabelingComponent.java

  22 
vote

public Control createGUI(Composite parent,int style){
  if (drawsLabel && !childComponent.drawsLabel()) {
    String labelText=attribute.getName();
    if (labelText == null) {
      labelText="";
    }
    label=new Label(parent,SWT.NONE);
    label.setText(labelText);
  }
  Control control=childComponent.createGUI(parent,style);
  setDefaultValue();
  createAndAddDescriptionButton(control,parent);
  return control;
}
 

Example 11

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

Source file: NewAwsJavaProjectWizardPageOne.java

  21 
vote

public void createControl(final Composite parent){
  initializeDialogUnits(parent);
  final Composite composite=new Composite(parent,SWT.NULL);
  composite.setFont(parent.getFont());
  composite.setLayout(initGridLayout(new GridLayout(1,false),true));
  composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
  Control nameControl=createNameControl(composite);
  nameControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  Control layoutControl=createProjectLayoutControl(composite);
  layoutControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  Control workingSetControl=createWorkingSetControl(composite);
  workingSetControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  final ExpandableComposite dropDown=new ExpandableComposite(composite,ExpandableComposite.TWISTIE);
  dropDown.setText("Advanced Settings");
  final Composite advancedSettingsGroup=new Composite(dropDown,SWT.NONE);
  advancedSettingsGroup.setLayout(initGridLayout(new GridLayout(1,false),true));
  advancedSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  Control locationControl=createLocationControl(advancedSettingsGroup);
  locationControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  sdkSamplesComposite.listenForSdkChange(sdkVersionInfoComposite);
  Control jreControl=createJRESelectionControl(advancedSettingsGroup);
  jreControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  dropDown.setClient(advancedSettingsGroup);
  GridData g=new GridData(SWT.FILL,SWT.FILL,true,true);
  g.minimumHeight=100;
  dropDown.setLayoutData(g);
  dropDown.addExpansionListener(new IExpansionListener(){
    public void expansionStateChanged(    ExpansionEvent e){
      composite.getShell().pack(true);
    }
    public void expansionStateChanging(    ExpansionEvent e){
    }
  }
);
  setControl(composite);
}
 

Example 12

From project bioclipse.opentox, under directory /plugins/net.bioclipse.opentox.ds/src/net/bioclipse/opentox/ds/prefs/.

Source file: ModelsListEditor.java

  21 
vote

protected void doFillIntoGrid(Composite parent,int numColumns){
  Control control=getLabelControl(parent);
  GridData gd=new GridData();
  gd.horizontalSpan=numColumns;
  control.setLayoutData(gd);
  list=getListControl(parent);
  gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.verticalAlignment=GridData.FILL;
  gd.horizontalSpan=numColumns - 1;
  gd.grabExcessHorizontalSpace=true;
  list.setLayoutData(gd);
  buttonBox=getButtonBoxControl(parent);
  gd=new GridData();
  gd.verticalAlignment=GridData.BEGINNING;
  buttonBox.setLayoutData(gd);
}
 

Example 13

From project Database-Designer, under directory /plugins/org.obeonetwork.dsl.entityrelation.edit/src-gen/org/obeonetwork/dsl/entityrelation/parts/forms/.

Source file: AttributePropertiesEditionPartForm.java

  21 
vote

public void updateTypeFields(boolean lengthVisible,boolean precisionVisible,boolean literalsVisible){
  Composite composite=getMainComposite();
  Composite lengthAndPrecisionComposite=(Composite)composite.getChildren()[LENGHT_AND_PRECISION_COMPOSITE_INDEX];
  HorizontalBox lengthAndPrecisionHBox=(HorizontalBox)lengthAndPrecisionComposite.getChildren()[0];
  Control lengthText=lengthAndPrecisionHBox.getChildren()[LENGHT_TEXT_INDEX];
  Control lengthLabel=lengthAndPrecisionHBox.getChildren()[LENGHT_LABEL_INDEX];
  Control lengthHelp=lengthAndPrecisionHBox.getChildren()[LENGHT_HELP_INDEX];
  setVisibilityOnWidget(lengthText,lengthVisible);
  setVisibilityOnWidget(lengthLabel,lengthVisible);
  setVisibilityOnWidget(lengthHelp,lengthVisible);
  Control precisionText=lengthAndPrecisionHBox.getChildren()[PRECISION_TEXT_INDEX];
  Control precisionLabel=lengthAndPrecisionHBox.getChildren()[PRECISION_LABEL_INDEX];
  Control precisionHelp=lengthAndPrecisionHBox.getChildren()[PRECISION_HELP_INDEX];
  setVisibilityOnWidget(precisionText,precisionVisible);
  setVisibilityOnWidget(precisionLabel,precisionVisible);
  setVisibilityOnWidget(precisionHelp,precisionVisible);
  setVisibilityOnWidget(lengthAndPrecisionComposite,lengthVisible || precisionVisible);
  Control literalsText=composite.getChildren()[LITERALS_TEXT_INDEX];
  Control literalsButton=composite.getChildren()[LITERALS_BUTTON_INDEX];
  setVisibilityOnWidget(literalsText,literalsVisible);
  setVisibilityOnWidget(literalsButton,literalsVisible);
  lengthAndPrecisionHBox.layout();
  lengthAndPrecisionComposite.layout();
  composite.layout();
}
 

Example 14

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

  19 
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 15

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

Source file: LayerComboContributionItem.java

  19 
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 16

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

Source file: BELEditorPropertyPage.java

  19 
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 17

From project CBCJVM, under directory /eclipse/src/cbclipse/properties/.

Source file: CBCPropertyPage.java

  19 
vote

/** 
 * @see PreferencePage#createContents(Composite)
 */
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 18

From project dawn-common, under directory /org.dawb.common.ui/src/org/dawb/common/ui/components/cell/.

Source file: ScaleCellEditor.java

  19 
vote

@Override protected Control createControl(Composite parent){
  scale=new Scale(parent,getStyle());
  scale.setFont(parent.getFont());
  this.focusListener=new FocusAdapter(){
    @Override public void focusLost(    FocusEvent e){
      ScaleCellEditor.this.focusLost();
    }
  }
;
  if ((getStyle() & SWT.NO_FOCUS) == 0) {
    scale.addFocusListener(focusListener);
  }
  this.keyListener=new KeyListener(){
    @Override public void keyPressed(    KeyEvent e){
    }
    @Override public void keyReleased(    KeyEvent e){
      if (e.character == '\n') {
        ScaleCellEditor.this.focusLost();
      }
      if (e.character == '\r') {
        ScaleCellEditor.this.focusLost();
      }
    }
  }
;
  scale.addKeyListener(keyListener);
  return scale;
}