Java Code Examples for org.eclipse.swt.events.SelectionEvent

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 bpelunit, under directory /tycho/net.bpelunit.toolsupport/editors/wizards/fields/.

Source file: MessageEditor.java

  17 
vote

private boolean select(TreeItem newSelection){
  if (newSelection != null) {
    this.tree.setSelection(newSelection);
    Event event=new Event();
    event.item=newSelection;
    event.widget=this.tree;
    this.selectionListener.widgetSelected(new SelectionEvent(event));
    return true;
  }
  return false;
}
 

Example 2

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

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

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

Source file: LayerComboContributionItem.java

  15 
vote

public void widgetSelected(SelectionEvent e){
  try {
    Drawing activeDrawing=this.controller.getActiveDrawing();
    Combo combo=(Combo)e.widget;
    int selectionIndex=combo.getSelectionIndex();
    List<String> layers=activeDrawing.getLayerNames();
    Map<String,Layer> layerMap=activeDrawing.getLayerMap();
    String selectedLayerName=layers.get(selectionIndex);
    Layer layer=layerMap.get(selectedLayerName);
    if (!layer.isLocked()) {
      activeDrawing.setCurrentLayer(selectionIndex);
    }
 else {
      String currentLayerName=activeDrawing.getCurrentLayer().getName();
      int currentIndex=layers.indexOf(currentLayerName);
      combo.select(currentIndex);
      br.org.archimedes.Utils.getInputController().printInInterpreter(Messages.LayerComboContributionItem_LayerLocked);
    }
    forceFocusInterpreter();
  }
 catch (  NoActiveDrawingException e1) {
    deactivateCombo();
  }
catch (  IllegalActionException e1) {
    e1.printStackTrace();
  }
}
 

Example 4

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

Source file: AccountSelectionComposite.java

  15 
vote

protected void createAccountConfigurationLink(){
  Link link=new Link(this,SWT.NONE);
  link.setFont(this.getFont());
  link.setText("<A>" + "Configure AWS accounts..." + "</A>");
  link.addSelectionListener(new SelectionListener(){
    public void widgetSelected(    final SelectionEvent e){
      PreferencesUtil.createPreferenceDialogOn(Display.getDefault().getActiveShell(),AwsAccountPreferencePage.ID,new String[]{AwsAccountPreferencePage.ID},null).open();
      if (noAccounts != null && validAccountsConfigured()) {
        for (        Widget w : getChildren()) {
          w.dispose();
        }
        noAccounts=null;
        createChildWidgets();
        getShell().layout(true,true);
      }
      updateAccounts();
    }
    public void widgetDefaultSelected(    final SelectionEvent e){
      widgetSelected(e);
    }
  }
);
  link.setLayoutData(new GridData(SWT.END,SWT.CENTER,false,false));
  link.setEnabled(true);
}
 

Example 5

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

Source file: MainTab.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override public void widgetSelected(SelectionEvent ev){
  Object src=ev.getSource();
  if (src == btnProject) {
    IProject p=chooseProject();
    if (p == null) {
      return;
    }
    String name=p.getName();
    txtProject.setText(name);
    if (noLength((txtBuilder.getText()))) {
      IFile bldr=getDefault().getBuilder(p);
      if (bldr != null) {
        txtBuilder.setText(display(p,bldr));
      }
    }
    updateLaunchConfigurationDialog();
  }
 else   if (src == btnBuilder) {
    IFile f=chooseFile();
    if (f == null) {
      return;
    }
    txtBuilder.setText(display(f.getProject(),f));
    updateLaunchConfigurationDialog();
  }
}
 

Example 6

From project BHT-FPA, under directory /mailer-common/de.bht.fpa.mail.common/rcputils/de/ralfebert/rcputils/tables/sort/.

Source file: ColumnSortSelectionListener.java

  15 
vote

@Override public void widgetSelected(SelectionEvent e){
  TableColumn column=(TableColumn)e.getSource();
  Table table=column.getParent();
  boolean alreadyActiveSortColumn=column == table.getSortColumn();
  if (alreadyActiveSortColumn) {
    table.setSortDirection(table.getSortDirection() == SWT.DOWN ? SWT.UP : SWT.DOWN);
  }
 else {
    table.setSortColumn(column);
    table.setSortDirection(SWT.UP);
  }
  viewer.refresh();
}
 

Example 7

From project big-data-plugin, under directory /src/org/pentaho/di/ui/job/entries/sqoop/xul/.

Source file: SwtLabelOrLink.java

  15 
vote

public SwtLabelOrLink(Element self,XulComponent parent,XulDomContainer container,String tagName){
  super(tagName);
  if (self.getAttributeValue("onclick") != null) {
    link=new Link((Composite)parent.getManagedObject(),SWT.NONE);
    link.addSelectionListener(new SelectionListener(){
      public void widgetSelected(      SelectionEvent selectionEvent){
        invoke(onclick);
      }
      public void widgetDefaultSelected(      SelectionEvent selectionEvent){
        invoke(onclick);
      }
    }
);
    setManagedObject(link);
  }
 else {
    String multi=(self != null) ? self.getAttributeValue("multiline") : null;
    if (multi != null && multi.equals("true")) {
      label=new Label((Composite)parent.getManagedObject(),SWT.WRAP);
      setManagedObject(label);
    }
 else {
      cLabel=new CLabel((Composite)parent.getManagedObject(),SWT.NONE);
      setManagedObject(cLabel);
    }
  }
}
 

Example 8

From project Bio-PEPA, under directory /uk.ac.ed.inf.biopepa.ui/src/uk/ac/ed/inf/biopepa/ui/wizards/timeseries/.

Source file: ImportDataPage.java

  15 
vote

public void widgetSelected(SelectionEvent event){
  FileDialog fd=new FileDialog(getShell(),SWT.OPEN);
  fd.setText("Open");
  fd.setFilterPath("C:/");
  fd.setFilterExtensions(this.extensions);
  String selected=fd.open();
  IPath selectedPath=Path.fromOSString(selected);
  String labelString=selectedPath.lastSegment();
  if (labelString.length() > 30) {
    labelString=labelString.substring(0,30) + "...";
  }
  selectedFile=selected;
  cfLabel.setText(labelString);
  cfButton.setText("Change");
  resultFileParser.parseFile(selectedFile);
}
 

Example 9

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

Source file: ModelsListEditor.java

  15 
vote

/** 
 * Creates a selection listener.
 */
public void createSelectionListener(){
  selectionListener=new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent event){
      Widget widget=event.widget;
      if (widget == addButton) {
        addPressed();
      }
 else       if (widget == removeButton) {
        removePressed();
      }
 else       if (widget == upButton) {
        upPressed();
      }
 else       if (widget == downButton) {
        downPressed();
      }
 else       if (widget == list) {
        selectionChanged();
      }
    }
  }
;
}
 

Example 10

From project bioclipse.seneca, under directory /plugins/net.bioclipse.seneca/src/net/bioclipse/seneca/editor/.

Source file: MetadataPage.java

  15 
vote

protected void createFormContent(IManagedForm managedForm){
  SenecaJobSpecification specification=((SenecaJobEditor)this.getEditor()).getSpecification();
  final ScrolledForm form=managedForm.getForm();
  FormToolkit toolkit=managedForm.getToolkit();
  form.setText("General Information");
  GridLayout layout=new GridLayout(3,false);
  form.getBody().setLayout(layout);
  toolkit.createLabel(form.getBody(),"Job Title:");
  jobTitle=toolkit.createText(form.getBody(),specification.getJobTitle(),SWT.BORDER);
  GridData gData=new GridData(GridData.FILL_HORIZONTAL);
  gData.horizontalSpan=2;
  jobTitle.setLayoutData(gData);
  jobTitle.addModifyListener(new EditorModifyListener(this));
  toolkit.createLabel(form.getBody(),"Molecular Formula:");
  mfData=toolkit.createText(form.getBody(),specification.getMolecularFormula(),SWT.BORDER);
  mfData.setLayoutData(gData);
  mfData.addModifyListener(new EditorModifyListener(this));
  toolkit.createLabel(form.getBody(),"Carbon hydrogen count:");
  for (int i=0; i < 4; i++) {
    toolkit.createLabel(form.getBody(),"CH" + i,SWT.BORDER);
    dataFile[i]=toolkit.createText(form.getBody(),Integer.toString(specification.getDeptData(i)),SWT.BORDER);
    gData=new GridData(SWT.LEFT);
    gData.horizontalSpan=1;
    dataFile[i].setLayoutData(gData);
    dataFile[i].addModifyListener(new EditorModifyListener(this));
    if (i < 4 - 1)     toolkit.createComposite(form.getBody());
  }
  toolkit.createLabel(form.getBody(),"Do aromaticity detection during run");
  detectAromaticity=toolkit.createButton(form.getBody(),"",SWT.CHECK);
  detectAromaticity.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
      setDirty(true);
    }
    public void widgetSelected(    SelectionEvent e){
      setDirty(true);
    }
  }
);
  detectAromaticity.setSelection(specification.getDetectAromaticity());
}
 

Example 11

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.specmol/src/net/bioclipse/specmol/editor/.

Source file: SpecMolTableComposite.java

  15 
vote

public void widgetSelected(SelectionEvent e){
  AssignmentController assContr=page.getAssignmentController();
  ArrayList<CMLPeak> list=new ArrayList<CMLPeak>();
  int[] selectedRows=table.getSelectionIndices();
  for (int i=0; i < selectedRows.length; i++) {
    list.add(page.getCurrentSpectrum().getPeakListElements().get(0).getPeakElements().get(selectedRows[i]));
  }
  assContr.setSelection(list,this);
}
 

Example 12

From project bndtools, under directory /bndtools.core/src/bndtools/editor/exports/.

Source file: ExportPackagesDetailsPage.java

  15 
vote

@Override public void createContents(Composite parent){
  super.createContents(parent);
  Composite mainComposite=getMainComposite();
  FormToolkit toolkit=getManagedForm().getToolkit();
  toolkit.createLabel(mainComposite,"");
  btnProvide=toolkit.createButton(mainComposite,"Provide",SWT.CHECK);
  btnProvide.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (!modifyLock.isUnderModification()) {
        boolean provide=btnProvide.getSelection();
        for (        ExportedPackage export : selectedClauses) {
          export.setProvided(provide);
        }
        PkgPatternsListPart<ExportedPackage> listPart=getListPart();
        if (listPart != null) {
          listPart.updateLabels(selectedClauses);
          listPart.validate();
        }
        markDirty();
      }
    }
  }
);
}
 

Example 13

From project BPMN2-Editor-for-Eclipse, under directory /org.eclipse.bpmn2.modeler.extras/src/org/eclipse/bpmn2/modeler/ui/property/.

Source file: JbpmPropertiesComposite.java

  15 
vote

public JbpmPropertiesComposite(Composite parent,int none){
  super(parent,none);
  customEditorButton=new Button(this,SWT.None);
  customEditorButton.setText("Open Custom Editor");
  buttonGridData=new GridData(SWT.LEFT,SWT.CENTER,false,false,3,1);
  customEditorButton.setLayoutData(buttonGridData);
  toolkit.adapt(customEditorButton,true,true);
  customEditorButton.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      MessageBox box=new MessageBox(getShell());
      box.setText("Custom Editor");
      updateDialogContents(box);
      box.open();
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
}
 

Example 14

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

Source file: CompositeEditMvnArtifacts.java

  15 
vote

/** 
 * <p> </p>
 */
protected void init(){
  final Shell shell=getShell();
  GridData layoutData=new GridData(GridData.FILL_BOTH);
  setLayoutData(layoutData);
  setLayout(new GridLayout(2,false));
  _contentList=new List(this,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL| SWT.MULTI);
  layoutData=new GridData(GridData.FILL_BOTH);
  layoutData.verticalIndent=0;
  _contentList.setLayoutData(layoutData);
  _contentList.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      refreshEnablement();
    }
  }
);
  Composite buttonBar=new Composite(this,SWT.NONE);
  buttonBar.setLayout(new GridLayout(1,false));
  GridData gd=new GridData();
  gd.verticalAlignment=GridData.BEGINNING;
  gd.horizontalAlignment=GridData.FILL;
  gd.verticalIndent=0;
  buttonBar.setLayoutData(gd);
  newTextButton(buttonBar,"Add Artifact...",new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      addArtifact(shell);
    }
  }
);
  _removeButton=newTextButton(buttonBar,"Remove Entry",new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      removeArtifact();
    }
  }
);
  redrawList();
  refreshEnablement();
}
 

Example 15

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

Source file: ClojureMainTab.java

  15 
vote

private void createFileEditor(final Composite parent,String string){
  Group section=SWTFactory.createGroup(parent,"Evaluate Clojure source file(s)",2,1,GridData.FILL_BOTH);
  sourceFilesViewer=new TableViewer(section);
  sourceFilesViewer.setLabelProvider(new DecoratingLabelProvider(new WorkbenchLabelProvider(),CCWPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
  sourceFilesViewer.setContentProvider(new ArrayContentProvider());
  sourceFilesViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
  Composite buttonSection=SWTFactory.createComposite(section,parent.getFont(),1,1,GridData.FILL_BOTH);
  Button chooseButton=new Button(buttonSection,SWT.PUSH);
  chooseButton.setText("Choose...");
  chooseButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      String currentProjName=fProjText.getText().trim();
      final IProject proj=ResourcesPlugin.getWorkspace().getRoot().getProject(currentProjName);
      if (proj == null) {
        return;
      }
      CheckedTreeSelectionDialog dialog=new CheckedTreeSelectionDialog(parent.getShell(),new WorkbenchLabelProvider(),new BaseWorkbenchContentProvider());
      dialog.setInput(proj.getWorkspace().getRoot());
      dialog.addFilter(new ClojureElementViewerFilter(proj));
      if (sourceFilesViewer.getInput() != null) {
        dialog.setInitialSelections(((List<?>)sourceFilesViewer.getInput()).toArray());
      }
      dialog.setTitle("Evaluate Clojure source file(s)");
      dialog.open();
      List<IFile> selectedFiles=new ArrayList<IFile>();
      Object[] dialogResult=dialog.getResult();
      if (dialogResult != null) {
        for (        Object o : dialogResult) {
          if (o instanceof IFile) {
            selectedFiles.add((IFile)o);
          }
        }
      }
      sourceFilesViewer.setInput(selectedFiles);
      updateLaunchConfigurationDialog();
    }
  }
);
}
 

Example 16

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

Source file: AbstractAnnotationHover.java

  15 
vote

private Link createCompletionProposalLink(Composite parent,final ICompletionProposal proposal){
  Label proposalImage=new Label(parent,SWT.NONE);
  proposalImage.setLayoutData(new GridData(SWT.BEGINNING,SWT.CENTER,false,false));
  Image image=proposal.getImage();
  if (image != null) {
    proposalImage.setImage(image);
    proposalImage.addMouseListener(new MouseListener(){
      public void mouseDoubleClick(      MouseEvent e){
      }
      public void mouseDown(      MouseEvent e){
      }
      public void mouseUp(      MouseEvent e){
        if (e.button == 1) {
          apply(proposal,fInput.viewer,fInput.position.offset);
        }
      }
    }
);
  }
  Link proposalLink=new Link(parent,SWT.WRAP);
  proposalLink.setLayoutData(new GridData(SWT.BEGINNING,SWT.CENTER,false,false));
  proposalLink.setText("<a>" + proposal.getDisplayString() + "</a>");
  proposalLink.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      apply(proposal,fInput.viewer,fInput.position.offset);
    }
  }
);
  return proposalLink;
}
 

Example 17

From project cilia-workbench, under directory /cilia-workbench-monitoring/src/fr/liglab/adele/cilia/workbench/monitoring/changesview/.

Source file: ChangesTableViewer.java

  15 
vote

/** 
 * Gets the selection adapter.
 * @param column the column
 * @param columnHeader the column header
 * @return the selection adapter
 */
private static SelectionAdapter getSelectionAdapter(final TableColumn column,final ChangesTableColumnHeader columnHeader){
  SelectionAdapter selectionAdapter=new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      tableSorter.setColumn(columnHeader);
      viewer.refresh();
    }
  }
;
  return selectionAdapter;
}
 

Example 18

From project CIShell, under directory /clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/.

Source file: AbstractDataManagerView.java

  15 
vote

public void widgetSelected(SelectionEvent e){
  Tree tree=(Tree)e.getSource();
  TreeItem[] selection=tree.getSelection();
  Set<Data> models=new HashSet<Data>();
  Data[] modelArray=new Data[selection.length];
  for (int i=0; i < selection.length; i++) {
    Data model=((DataGUIItem)selection[i].getData()).getModel();
    updateContextMenu(model);
    models.add(model);
    modelArray[i]=model;
  }
  AbstractDataManagerView.this.manager.setSelectedData(modelArray);
}
 

Example 19

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

Source file: AttributePropertiesEditionPartForm.java

  15 
vote

/** 
 */
protected Composite createLiteralsMultiValuedEditor(FormToolkit widgetFactory,Composite parent){
  literals=widgetFactory.createText(parent,"",SWT.READ_ONLY);
  GridData literalsData=new GridData(GridData.FILL_HORIZONTAL);
  literalsData.horizontalSpan=2;
  literals.setLayoutData(literalsData);
  EditingUtils.setID(literals,EntityrelationViewsRepository.Attribute.Properties.literals);
  EditingUtils.setEEFtype(literals,"eef::MultiValuedEditor::field");
  editLiterals=widgetFactory.createButton(parent,getDescription(EntityrelationViewsRepository.Attribute.Properties.literals,EntityrelationMessages.AttributePropertiesEditionPart_LiteralsLabel),SWT.NONE);
  GridData editLiteralsData=new GridData();
  editLiterals.setLayoutData(editLiteralsData);
  editLiterals.addSelectionListener(new SelectionAdapter(){
    /** 
 * {@inheritDoc}
 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
 */
    public void widgetSelected(    SelectionEvent e){
      EEFFeatureEditorDialog dialog=new EEFFeatureEditorDialog(literals.getShell(),"Attribute",new AdapterFactoryLabelProvider(adapterFactory),literalsList,TypesLibraryPackage.eINSTANCE.getTypeInstance_Literals().getEType(),null,false,true,null,null);
      if (dialog.open() == Window.OK) {
        literalsList=dialog.getResult();
        if (literalsList == null) {
          literalsList=new BasicEList();
        }
        literals.setText(literalsList.toString());
        propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(AttributePropertiesEditionPartForm.this,EntityrelationViewsRepository.Attribute.Properties.literals,PropertiesEditionEvent.COMMIT,PropertiesEditionEvent.SET,null,new BasicEList(literalsList)));
        setHasChanged(true);
      }
    }
  }
);
  EditingUtils.setID(editLiterals,EntityrelationViewsRepository.Attribute.Properties.literals);
  EditingUtils.setEEFtype(editLiterals,"eef::MultiValuedEditor::browsebutton");
  return parent;
}
 

Example 20

From project dawn-common, under directory /org.dawb.common.ui/src/org/dawb/common/ui/plot/roi/.

Source file: ROIEditTable.java

  15 
vote

@Override protected CellEditor getCellEditor(final Object element){
  FieldComponentCellEditor ed=null;
  try {
    ed=new FieldComponentCellEditor(((TableViewer)getViewer()).getTable(),FloatSpinnerWrapper.class.getName(),SWT.RIGHT);
  }
 catch (  ClassNotFoundException e) {
    logger.error("Cannot get FieldComponentCellEditor for " + SpinnerWrapper.class.getName(),e);
    return null;
  }
  final FloatSpinnerWrapper rb=(FloatSpinnerWrapper)ed.getFieldWidget();
  if (element instanceof LinearROI || element instanceof PointROI || element instanceof PolylineROI|| element instanceof RectangularROI) {
    if (column == 1) {
      if (!Double.isNaN(xLowerBound))       rb.setMinimum(xLowerBound);
      if (!Double.isNaN(xUpperBound))       rb.setMaximum(xUpperBound);
    }
 else {
      if (!Double.isNaN(yLowerBound))       rb.setMinimum(yLowerBound);
      if (!Double.isNaN(yUpperBound))       rb.setMaximum(yUpperBound);
    }
  }
 else {
    rb.setMaximum(Double.MAX_VALUE);
    rb.setMinimum(-Double.MAX_VALUE);
  }
  rb.setButtonVisible(false);
  rb.setActive(true);
  ((Spinner)rb.getControl()).addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      setValue(element,rb.getValue(),false);
    }
  }
);
  return ed;
}
 

Example 21

From project dawn-isenciaui, under directory /com.isencia.passerelle.workbench.model.editor.ui/src/main/java/com/isencia/passerelle/workbench/model/editor/ui/cell/.

Source file: CComboCellEditor.java

  15 
vote

@Override protected Control createControl(Composite parent){
  comboBox=new CCombo(parent,getStyle());
  comboBox.setFont(parent.getFont());
  populateComboBoxItems();
  comboBox.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent e){
      keyReleaseOccured(e);
    }
  }
);
  comboBox.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetDefaultSelected(    SelectionEvent event){
    }
    @Override public void widgetSelected(    SelectionEvent event){
      selection=comboBox.getSelectionIndex();
    }
  }
);
  comboBox.addTraverseListener(new TraverseListener(){
    @Override public void keyTraversed(    TraverseEvent e){
      if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
        e.doit=false;
      }
    }
  }
);
  comboBox.addFocusListener(new FocusAdapter(){
    @Override public void focusLost(    FocusEvent e){
      CComboCellEditor.this.focusLost();
    }
  }
);
  return comboBox;
}
 

Example 22

From project dawn-third, under directory /org.dawb.org.csstudio.swt.xygraph/src/org/csstudio/swt/xygraph/toolbar/.

Source file: XYGraphConfigDialog.java

  15 
vote

@Override protected void createButtonsForButtonBar(Composite parent){
  ((GridLayout)parent.getLayout()).numColumns++;
  Button button=new Button(parent,SWT.PUSH);
  button.setText("Apply");
  GridData data=new GridData(GridData.HORIZONTAL_ALIGN_FILL);
  int widthHint=convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
  Point minSize=button.computeSize(SWT.DEFAULT,SWT.DEFAULT,true);
  data.widthHint=Math.max(widthHint,minSize.x);
  button.setLayoutData(data);
  button.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      applyChanges();
    }
  }
);
  super.createButtonsForButtonBar(parent);
  Shell shell=parent.getShell();
  if (shell != null) {
    shell.setDefaultButton(button);
  }
}
 

Example 23

From project dawn-ui, under directory /org.dawb.workbench.plotting/src/org/dawb/workbench/plotting/printing/.

Source file: PlotPrintPreviewDialog.java

  15 
vote

@Override public void widgetSelected(SelectionEvent e){
  settings.setKeepAspectRatio(buttonAspectRatio.getSelection());
  setAspectRatioPreference(buttonAspectRatio.getSelection());
  if (buttonAspectRatio.getSelection()) {
    image=xyGraph.getImage(getImageSizeRect(xyGraph));
  }
 else {
    image=xyGraph.getImage(getPrinterSizeRect(printer));
  }
  canvas.redraw();
}
 

Example 24

From project dawn-workflow, under directory /org.dawb.passerelle.actors/src/org/dawb/passerelle/editors/.

Source file: UserModifyDialog.java

  15 
vote

protected Control createDialogArea(Composite container){
  final Composite top=new Composite(container,SWT.NONE);
  top.setLayout(new GridLayout(1,false));
  top.setLayoutData(new GridData(SWT.LEFT,SWT.CENTER,true,false));
  this.label=new Link(top,SWT.LEFT);
  label.setLayoutData(new GridData(SWT.LEFT,SWT.CENTER,true,false));
  label.setText("Please check and/or set values, then <a>continue</a> or <a>stop</a> the workflow.");
  label.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (e.text.contains("stop")) {
        userModComp.stop.run();
      }
 else {
        userModComp.confirm.run();
      }
      close();
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  this.userModComp=new UserModifyComposite(container,this,SWT.NONE);
  return userModComp.getViewer().getControl();
}