Java 类org.eclipse.swt.events.FocusAdapter 实例源码

项目:convertigo-eclipse    文件:KTableCellEditor.java   
/**
 * Activates the editor at the given position.
 * 
 * @param row
 * @param col
 * @param rect
 */
public void open(KTable table, int col, int row, Rectangle rect) {
  m_Table = table;
  m_Model = table.getModel();
  m_Rect = rect;
  m_Row = row;
  m_Col = col;
  if (m_Control == null) {
    m_Control = createControl();
    m_Control.setToolTipText(toolTip);
    m_Control.addFocusListener(new FocusAdapter() {
      public void focusLost(FocusEvent arg0) {
        close(true);
      }
    });
  }
  setBounds(m_Rect);
  GC gc = new GC(m_Table);
  m_Table.drawCell(gc, m_Col, m_Row);
  gc.dispose();
}
项目:ermasterr    文件:ModelPropertiesDialog.java   
private void edit(final TableItem item, final TableEditor tableEditor) {
    final Text text = new Text(table, SWT.NONE);
    text.setText(item.getText(targetColumn));

    text.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(final FocusEvent e) {
            item.setText(targetColumn, text.getText());
            text.dispose();
        }

    });

    tableEditor.setEditor(text, item, targetColumn);
    text.setFocus();
    text.selectAll();
}
项目:ermaster-k    文件:ModelPropertiesDialog.java   
private void edit(final TableItem item, final TableEditor tableEditor) {
    final Text text = new Text(table, SWT.NONE);
    text.setText(item.getText(targetColumn));

    text.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            item.setText(targetColumn, text.getText());
            text.dispose();
        }

    });

    tableEditor.setEditor(text, item, targetColumn);
    text.setFocus();
    text.selectAll();
}
项目:depan    文件:RelationDisplayEditor.java   
/**
 * In a future world, this might provide access to a complete set
 * of {@code ResourceDocument} properties.
 */
@SuppressWarnings("unused")
private Composite setupProperties(Composite parent) {
  Composite result = Widgets.buildGridContainer(parent, 2);

  Label label = Widgets.buildCompactLabel(result, "&Name:");

  relSetName = new Text(result, SWT.BORDER | SWT.SINGLE);
  relSetName.setLayoutData(Widgets.buildHorzFillData());
  relSetName.addFocusListener(new FocusAdapter() {
    @Override
    public void focusLost(FocusEvent e) {
      if (propInfo.getName().equals(relSetName.getText())) {
        return;
      }
      setDirtyState(true);
      handleDocumentChange();
    }
  });
  return result;
}
项目:depan    文件:EdgeMatcherEditor.java   
/**
 * In a future world, this might provide access to a complete set
 * of {@code ResourceDocument} properties.
 */
@SuppressWarnings("unused")
private Composite setupProperties(Composite parent) {
  Composite result = Widgets.buildGridContainer(parent, 2);

  Label label = Widgets.buildCompactLabel(result, "&Name:");

  matcherName = new Text(result, SWT.BORDER | SWT.SINGLE);
  matcherName.setLayoutData(Widgets.buildHorzFillData());
  if (null != matcherInfo) {
    matcherName.setText(matcherInfo.getName());
  }
  matcherName.addFocusListener(new FocusAdapter() {
    @Override
    public void focusLost(FocusEvent e) {
      if (matcherInfo.getName().equals(matcherName.getText())) {
        return;
      }
      setDirtyState(true);
      handleDocumentChange();
    }
  });
  return result;
}
项目:depan    文件:RelationSetDescriptorEditor.java   
/**
 * In a future world, this might provide access to a complete set
 * of {@code ResourceDocument} properties.
 * @return 
 */
@SuppressWarnings("unused")
private Composite setupProperties(Composite parent) {
  Composite result = Widgets.buildGridContainer(parent, 2);

  Label label = Widgets.buildCompactLabel(result, "&Name:");

  relSetName = new Text(result, SWT.BORDER | SWT.SINGLE);
  relSetName.setLayoutData(Widgets.buildHorzFillData());
  relSetName.addFocusListener(new FocusAdapter() {
    @Override
    public void focusLost(FocusEvent e) {
      if (relSetInfo.getName().equals(relSetName.getText())) {
        return;
      }
      setDirtyState(true);
      handleDocumentChange();
    }
  });
  return result;
}
项目:PDFReporter-Studio    文件:SelectableComposite.java   
private void createDescription(String text, Composite comp, StyleRange[] styles) {
    final StyledText descLabel = new StyledText(comp, SWT.MULTI | SWT.WRAP);
    descLabel.setRightMargin(10);
    descLabel.setEditable(false);
    descLabel.setText(text);
    descLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    descLabel.addMouseListener(compositeMouseAction);
    if (styles != null && styles.length > 0)
        descLabel.setStyleRanges(styles);
    descLabel.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            setScrolledFocus();
            descLabel.setSelection(0, 0);
        }

    });
}
项目:erflute    文件:ModelPropertiesDialog.java   
private void edit(final TableItem item, final TableEditor tableEditor) {
    final Text text = new Text(table, SWT.NONE);
    text.setText(item.getText(targetColumn));

    text.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            item.setText(targetColumn, text.getText());
            text.dispose();
        }
    });

    tableEditor.setEditor(text, item, targetColumn);
    text.setFocus();
    text.selectAll();
}
项目:mytourbook    文件:AutoComplete.java   
public AutoComplete(final ComboViewer comboViewer) {

        _comboViewer = comboViewer;

        final Combo combo = comboViewer.getCombo();

        combo.addKeyListener(new KeyAdapter() {
            @Override
            public void keyReleased(final KeyEvent e) {
                if (e.keyCode == SWT.DEL)
                    setSelection(null);
                autoCompleteKeyUp(e);
            }

        });

        combo.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(final FocusEvent arg0) {
                autoCompleteLeave();
            }
        });

    }
项目:mytourbook    文件:AutoComplete.java   
public AutoComplete(final ComboViewer comboViewer) {

        _comboViewer = comboViewer;

        final Combo combo = comboViewer.getCombo();

        combo.addKeyListener(new KeyAdapter() {
            @Override
            public void keyReleased(final KeyEvent e) {
                if (e.keyCode == SWT.DEL)
                    setSelection(null);
                autoCompleteKeyUp(e);
            }

        });

        combo.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(final FocusEvent arg0) {
                autoCompleteLeave();
            }
        });

    }
项目:translationstudio8    文件:EquivalentPage.java   
/**
 * 验证用户输入的加权系数的正确性
 * @param equiTxt
 */
private void validEquiTxt(final Text equiTxt){
    final String defaultStr = "0.50";
    equiTxt.setText(defaultStr);
    equiTxt.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            String textStr = equiTxt.getText().trim();
            if (textStr == null || textStr.trim().length() == 0) {
                equiTxt.setText(defaultStr);
            }else {
                String regular = "1\\.(0){0,2}|0\\.\\d{0,2}";
                if (!textStr.matches(regular)) {
                    MessageDialog.openInformation(getShell(), Messages.getString("preference.EquivalentPage.msgTitle"), 
                        Messages.getString("preference.EquivalentPage.msg5"));
                    equiTxt.setText(defaultStr);
                }
            }
        }
    });
}
项目:ermaster-nhit    文件:ModelPropertiesDialog.java   
private void edit(final TableItem item, final TableEditor tableEditor) {
    final Text text = new Text(table, SWT.NONE);
    text.setText(item.getText(targetColumn));

    text.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            item.setText(targetColumn, text.getText());
            text.dispose();
        }

    });

    tableEditor.setEditor(text, item, targetColumn);
    text.setFocus();
    text.selectAll();
}
项目:gef-gwt    文件:ContentProposalAdapter.java   
protected Control createDialogArea(Composite parent) {
    text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP
            | SWT.NO_FOCUS);

    // Use the compact margins employed by PopupDialog.
    GridData gd = new GridData(GridData.BEGINNING
            | GridData.FILL_BOTH);
    gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING;
    gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING;
    text.setLayoutData(gd);
    text.setText(contents);

    // since SWT.NO_FOCUS is only a hint...
    text.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent event) {
            ContentProposalPopup.this.close();
        }
    });
    return text;
}
项目:tmxeditor8    文件:EquivalentPage.java   
/**
 * 验证用户输入的加权系数的正确性
 * @param equiTxt
 */
private void validEquiTxt(final Text equiTxt){
    final String defaultStr = "0.50";
    equiTxt.setText(defaultStr);
    equiTxt.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            String textStr = equiTxt.getText().trim();
            if (textStr == null || textStr.trim().length() == 0) {
                equiTxt.setText(defaultStr);
            }else {
                String regular = "1\\.(0){0,2}|0\\.\\d{0,2}";
                if (!textStr.matches(regular)) {
                    MessageDialog.openInformation(getShell(), Messages.getString("preference.EquivalentPage.msgTitle"), 
                        Messages.getString("preference.EquivalentPage.msg5"));
                    equiTxt.setText(defaultStr);
                }
            }
        }
    });
}
项目:read-open-source-code    文件:TeraFastDialog.java   
/**
 * @param factory
 *            factory to use.
 */
protected void buildTableLine(final PluginWidgetFactory factory) {
    final Control topControl = this.wConnection;

    this.wlTable = factory.createRightLabel(BaseMessages.getString(PKG, "TeraFastDialog.TargetTable.Label"));
    this.props.setLook(this.wlTable);
    this.wlTable.setLayoutData(factory.createLabelLayoutData(topControl));

    this.wTable = factory.createSingleTextVarLeft();
    this.props.setLook(this.wTable);
    this.wTable.setLayoutData(factory.createControlLayoutData(topControl));

    this.wTable.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(final FocusEvent event) {
            setTableFieldCombo();
        }
    });
}
项目:kettle-4.4.0-stable    文件:TeraFastDialog.java   
/**
 * @param factory
 *            factory to use.
 */
protected void buildTableLine(final PluginWidgetFactory factory) {
    final Control topControl = this.wConnection;

    this.wlTable = factory.createRightLabel(BaseMessages.getString(PKG, "TeraFastDialog.TargetTable.Label"));
    this.props.setLook(this.wlTable);
    this.wlTable.setLayoutData(factory.createLabelLayoutData(topControl));

    this.wTable = factory.createSingleTextVarLeft();
    this.props.setLook(this.wTable);
    this.wTable.setLayoutData(factory.createControlLayoutData(topControl));

    this.wTable.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(final FocusEvent event) {
            setTableFieldCombo();
        }
    });
}
项目:kettle-trunk    文件:TeraFastDialog.java   
/**
 * @param factory
 *            factory to use.
 */
protected void buildTableLine(final PluginWidgetFactory factory) {
    final Control topControl = this.wConnection;

    this.wlTable = factory.createRightLabel(BaseMessages.getString(PKG, "TeraFastDialog.TargetTable.Label"));
    this.props.setLook(this.wlTable);
    this.wlTable.setLayoutData(factory.createLabelLayoutData(topControl));

    this.wTable = factory.createSingleTextVarLeft();
    this.props.setLook(this.wTable);
    this.wTable.setLayoutData(factory.createControlLayoutData(topControl));

    this.wTable.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(final FocusEvent event) {
            setTableFieldCombo();
        }
    });
}
项目:elexis-3-core    文件:ETFTextPlugin.java   
public Composite createContainer(Composite parent, ICallback h){
    handler = h;
    etf = new EnhancedTextField(parent);
    etf.text.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e){
            if (bSaveOnFocusLost) {
                if (handler != null) {
                    handler.save();
                }
            }
        }

    });
    ike = new ExternalLink();
    ike.connect(etf);
    etf.setText(StringTool.leer);
    return etf;
}
项目:pentaho-kettle    文件:TeraFastDialog.java   
/**
 * @param factory
 *          factory to use.
 */
protected void buildTableLine( final PluginWidgetFactory factory ) {
  final Control topControl = this.wConnection;

  this.wlTable = factory.createRightLabel( BaseMessages.getString( PKG, "TeraFastDialog.TargetTable.Label" ) );
  this.props.setLook( this.wlTable );
  this.wlTable.setLayoutData( factory.createLabelLayoutData( topControl ) );

  this.wTable = factory.createSingleTextVarLeft();
  this.props.setLook( this.wTable );
  this.wTable.setLayoutData( factory.createControlLayoutData( topControl ) );

  this.wTable.addFocusListener( new FocusAdapter() {
    @Override
    public void focusLost( final FocusEvent event ) {
      setTableFieldCombo();
    }
  } );
}
项目:SimQRI    文件:QueryPropertiesEditionPartImpl.java   
protected Composite createValueTextarea(Composite parent) {
    Label valueLabel = createDescription(parent, MetamodelViewsRepository.Query.Properties.value, MetamodelMessages.QueryPropertiesEditionPart_ValueLabel);
    GridData valueLabelData = new GridData(GridData.FILL_HORIZONTAL);
    valueLabelData.horizontalSpan = 3;
    valueLabel.setLayoutData(valueLabelData);
    value = SWTUtils.createScrollableText(parent, SWT.BORDER | SWT.WRAP | SWT.MULTI | SWT.V_SCROLL);
    GridData valueData = new GridData(GridData.FILL_HORIZONTAL);
    valueData.horizontalSpan = 2;
    valueData.heightHint = 80;
    valueData.widthHint = 200;
    value.setLayoutData(valueData);
    value.addFocusListener(new FocusAdapter() {

        /**
         * {@inheritDoc}
         * 
         * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
         * 
         */
        public void focusLost(FocusEvent e) {
            if (propertiesEditionComponent != null)
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(QueryPropertiesEditionPartImpl.this, MetamodelViewsRepository.Query.Properties.value, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, value.getText()));
        }

    });
    EditingUtils.setID(value, MetamodelViewsRepository.Query.Properties.value);
    EditingUtils.setEEFtype(value, "eef::Textarea"); //$NON-NLS-1$
    SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(MetamodelViewsRepository.Query.Properties.value, MetamodelViewsRepository.SWT_KIND), null); //$NON-NLS-1$
    // Start of user code for createValueTextArea

    // End of user code
    return parent;
}
项目:texlipse    文件:TexlipseProjectFilesWizardPage.java   
/**
 * Create the output file name field.
 * @param composite the parent container
 */
private void createOutputDirControl(Composite composite) {

    // add label
    Label mainLabel = new Label(composite, SWT.LEFT);
    mainLabel.setText(TexlipsePlugin.getResourceString("projectWizardOutputDirLabel"));
    mainLabel.setToolTipText(TexlipsePlugin.getResourceString("projectWizardOutputDirTooltip"));
    mainLabel.setLayoutData(new GridData());

    // add text field
    outputDirNameField = new Text(composite, SWT.SINGLE | SWT.BORDER);
    outputDirNameField.setText(attributes.getOutputDir());
    outputDirNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardOutputDirTooltip"));
    outputDirNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    outputDirNameField.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent event) {
            if (outputDirItem != null) {
                dirTree.setSelection(new TreeItem[] { outputDirItem });
            }
        }});
    outputDirNameField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (!outputDirNameField.isDisposed()) {
                String t = outputDirNameField.getText();
                attributes.setOutputDir(t);
                validateDirName(outputDirNameField, t);
                if (t == null || t.length() == 0) {
                    recreateSubTree();
                } else if (outputDirItem == null) {
                    recreateSubTree();
                }
                if (outputDirItem != null) {
                    outputDirItem.setText(t);
                }
            }
        }});
}
项目:texlipse    文件:TexlipseProjectFilesWizardPage.java   
/**
 * Create the output file name field.
 * @param composite the parent container
 */
private void createOutputFileControl(Composite composite) {

    // add label
    Label mainLabel = new Label(composite, SWT.LEFT);
    mainLabel.setText(TexlipsePlugin.getResourceString("projectWizardOutputFileLabel"));
    mainLabel.setToolTipText(TexlipsePlugin.getResourceString("projectWizardOutputFileTooltip"));
    mainLabel.setLayoutData(new GridData());

    // add text field
    outputFileNameField = new Text(composite, SWT.SINGLE | SWT.BORDER);
    outputFileNameField.setText(attributes.getOutputFile());
    outputFileNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardOutputFileTooltip"));
    outputFileNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    outputFileNameField.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent event) {
            dirTree.setSelection(new TreeItem[] { outputFileItem });
        }});
    outputFileNameField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (!outputFileNameField.isDisposed()) {
                String t = outputFileNameField.getText();
                outputFileItem.setText(t);
                validateOutputFileName(t);
            }
        }});
}
项目:texlipse    文件:TexlipseProjectFilesWizardPage.java   
/**
 * Create the output file name field.
 * @param composite the parent container
 */
private void createMainDirControl(Composite composite) {

    // add label
    Label mainLabel = new Label(composite, SWT.LEFT);
    mainLabel.setText(TexlipsePlugin.getResourceString("projectWizardMainDirLabel"));
    mainLabel.setToolTipText(TexlipsePlugin.getResourceString("projectWizardMainDirTooltip"));
    mainLabel.setLayoutData(new GridData());

    // add text field
    sourceDirNameField = new Text(composite, SWT.SINGLE | SWT.BORDER);
    sourceDirNameField.setText(attributes.getSourceDir());
    sourceDirNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardMainDirTooltip"));
    sourceDirNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    sourceDirNameField.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent event) {
               if (sourceDirItem != null) {
                   dirTree.setSelection(new TreeItem[] { sourceDirItem });
               }
        }});
    sourceDirNameField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (!sourceDirNameField.isDisposed()) {
                String t = sourceDirNameField.getText();
                attributes.setSourceDir(t);
                validateDirName(sourceDirNameField, t);
                if (t == null || t.length() == 0) {
                    recreateSubTree();
                } else if (sourceDirItem == null) {
                    recreateSubTree();
                }
                if (sourceDirItem != null) {
                    sourceDirItem.setText(t);
                }
            }
        }});
}
项目:texlipse    文件:TexlipseProjectFilesWizardPage.java   
/**
 * Create main file settings box.
 * @param composite the parent container
 */
private void createMainFileControl(Composite composite) {

    // add label
    Label mainLabel = new Label(composite, SWT.LEFT);
    mainLabel.setText(TexlipsePlugin.getResourceString("projectWizardMainFileLabel"));
    mainLabel.setToolTipText(TexlipsePlugin.getResourceString("projectWizardMainFileTooltip"));
    mainLabel.setLayoutData(new GridData());

    // add text field
    sourceFileNameField = new Text(composite, SWT.SINGLE | SWT.BORDER);
    sourceFileNameField.setText(attributes.getSourceFile());
    sourceFileNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardMainFileTooltip"));
    sourceFileNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    sourceFileNameField.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent event) {
            dirTree.setSelection(new TreeItem[] { sourceFileItem });
        }});
    sourceFileNameField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (!sourceFileNameField.isDisposed()) {
                String t = sourceFileNameField.getText();
                sourceFileItem.setText(t);
                tempFileItem.setText(t.substring(0, t.lastIndexOf('.')+1) + "aux");
                validateMainFileName(t);
            }
        }});
}
项目:texlipse    文件:TexlipseProjectFilesWizardPage.java   
/**
 * Create the output file name field.
 * @param composite the parent container
 */
private void createTempDirControl(Composite composite) {

    // add label
    Label mainLabel = new Label(composite, SWT.LEFT);
    mainLabel.setText(TexlipsePlugin.getResourceString("projectWizardTempDirLabel"));
    mainLabel.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTempDirTooltip"));
    mainLabel.setLayoutData(new GridData());

    // add text field
    tempDirNameField = new Text(composite, SWT.SINGLE | SWT.BORDER);
    tempDirNameField.setText(attributes.getTempDir());
    tempDirNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTempDirTooltip"));
    tempDirNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    tempDirNameField.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent event) {
               if (tempDirItem != null) {
                dirTree.setSelection(new TreeItem[] { tempDirItem });
               }
        }});
    tempDirNameField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (!tempDirNameField.isDisposed()) {
                String t = tempDirNameField.getText();
                attributes.setTempDir(t);
                validateDirName(tempDirNameField, t);
                if (t == null || t.length() == 0) {
                    recreateSubTree();
                } else if (tempDirItem == null) {
                    recreateSubTree();
                }
                if (tempDirItem != null) {
                    tempDirItem.setText(t);
                }
            }
        }});
}
项目:TranskribusSwtGui    文件:MyContentProposalAdapter.java   
@Override
protected Control createDialogArea(Composite parent) {
    text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP
            | SWT.NO_FOCUS);

    // Use the compact margins employed by PopupDialog.
    GridData gd = new GridData(GridData.BEGINNING
            | GridData.FILL_BOTH);
    gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING;
    gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING;
    text.setLayoutData(gd);
    text.setText(contents);

    // since SWT.NO_FOCUS is only a hint...
    text.addFocusListener(new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent event) {
            ContentProposalPopup.this.close();
        }
    });
    return text;
}
项目:scouter    文件:AlertScriptingView.java   
private void addApiDescTableFocusListener() {
    table.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            toolTip.hide();
        }
    });
}
项目:JFaceUtils    文件:EditableComboFieldEditor.java   
@Override
protected Combo getComboBoxControl(final Composite parent) {
    Combo combo = getComboBoxControl();
    if (combo == null) {
        combo = new Combo(parent, SWT.NONE);
        setComboBoxControl(combo);
        combo.setFont(parent.getFont());
        final String[][] entryNamesAndValues = getEntryNamesAndValues();
        for (int i = 0; i < entryNamesAndValues.length; i++) {
            combo.add(entryNamesAndValues[i][0], i);
        }
        combo.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent se) {
                updateValue();
            }
        });
        combo.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(final FocusEvent fe) {
                updateValue();
            }
        });
        if (textLimit > 0) {
            combo.setTextLimit(textLimit);
        }
    }
    return combo;
}
项目:JFaceUtils    文件:WrapStringFieldEditor.java   
@Override
public Text getTextControl(final Composite parent) {
    if (textField == null) {
        textField = new Text(parent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.WRAP);
        textField.setFont(parent.getFont());
        textField.addKeyListener(new KeyAdapter() {
            @Override
            public void keyReleased(final KeyEvent ke) {
                valueChanged();
            }
        });
        textField.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(final FocusEvent fe) {
                valueChanged();
            }
        });
        textField.addDisposeListener(new DisposeListener() {
            @Override
            public void widgetDisposed(final DisposeEvent de) {
                textField = null;
            }
        });
    }
    else {
        checkParent(textField, parent);
    }
    return textField;
}
项目:jo-widgets    文件:TextFieldImpl.java   
public TextFieldImpl(final Object parentUiReference, final ITextFieldSetupSpi setup, final SwtImageRegistry imageRegistry) {
    super(new Text((Composite) parentUiReference, getStyle(setup)), imageRegistry);

    if (SwtOptions.hasInputVerification()) {
        final IInputVerifier maskVerifier = TextMaskVerifierFactory.create(this, setup.getMask());

        final IInputVerifier inputVerifier = InputVerifierHelper.getInputVerifier(maskVerifier, setup);
        if (inputVerifier != null) {
            inputVerificationListener = createVerifyListener(inputVerifier);
            getUiReference().addVerifyListener(inputVerificationListener);
        }
    }

    if (setup.getMaxLength() != null) {
        getUiReference().setTextLimit(setup.getMaxLength().intValue());
    }

    if (SwtOptions.hasInputVerification() && setup.getMask() != null && TextMaskMode.FULL_MASK == setup.getMask().getMode()) {
        setText(setup.getMask().getPlaceholder());
        getUiReference().addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(final FocusEvent e) {
                if (getUiReference().getSelectionCount() == 0) {
                    getUiReference().setSelection(0, 0);
                }
            }
        });
    }

    registerTextControl(getUiReference(), setup.getInputChangeEventPolicy());
}
项目:ArchiGITPlugin    文件:RemoteRepositoryDialog.java   
private void createRepositoryToClone(Composite container) {
  Label lbtRepoToClone = new Label(container, SWT.NONE);
  lbtRepoToClone.setText("Remote Repository Location");

  GridData dataRepoToClone = new GridData();
  dataRepoToClone.grabExcessHorizontalSpace = true;
  dataRepoToClone.horizontalAlignment = GridData.FILL;

  txtRepositoryToClone = new Text(container, SWT.BORDER);
  txtRepositoryToClone.setLayoutData(dataRepoToClone);
  if(this.repositoryToClone!=null)
    txtRepositoryToClone.setText(repositoryToClone);

  txtRepositoryToClone.addFocusListener(new FocusAdapter() {

@Override
public void focusLost(FocusEvent e) {
    if (!txtRepositoryToClone.getText().toLowerCase().startsWith("http")) {
        txtRepoUser.setEnabled(false);
        txtRepoPassword.setEnabled(false);
    }
    else {
        txtRepoUser.setEnabled(true);
        txtRepoPassword.setEnabled(true);
    }

    super.focusLost(e);
}

  });
}
项目:data-mapper    文件:MappingViewer.java   
private Text createText(final Composite parent) {
    final Text text = new Text(parent, SWT.BORDER);
    text.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    text.setEditable(false);
    text.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(final FocusEvent event) {
            text.selectAll();
        }

    });
    return text;
}
项目:elexis-3-core    文件:ActiveControl.java   
protected void setControl(Control control){
    ctl = control;
    ctl.setLayoutData(SWTHelper.getFillGridData(2, true, 1, false));
    ctl.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e){
            if (isValid()) {

            }
        }
    });
}
项目:elexis-3-core    文件:MoneyInput.java   
private void prepare(){
    text.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(final FocusEvent e){
            try {
                String t = text.getText();
                if (t.length() == 0) {
                    text.setText(new ch.rgw.tools.Money().getAmountAsString());
                } else {
                    ch.rgw.tools.Money.checkInput(t);
                }
                for (SelectionListener lis : listeners) {
                    Event ev = new Event();
                    ev.widget = e.widget;
                    ev.display = e.display;
                    lis.widgetSelected(new SelectionEvent(ev));
                }
            } catch (ParseException px) {
                SWTHelper.alert(Messages.MoneyInput_InvalidAmountCaption, //$NON-NLS-1$
                    Messages.MoneyInput_InvalidAmountContents); //$NON-NLS-1$
            }
        }
    });
    /*
     * text.addVerifyListener(new VerifyListener(){ public void verifyText(VerifyEvent e) {
     * if(e.character==SWT.DEL || e.character==SWT.BS){ e.doit=true; }else{ String
     * t=text.getText()+e.character; if(t.length()<2 || t.matches("[0-9]+[\\.,]?[0-9]{0,2}")){
     * e.doit=true; }else{ e.doit=false; } } }});
     */

}
项目:elexis-3-base    文件:MiGelDetailDisplay.java   
public Composite createDisplay(Composite parent, IViewSite site){
    parent.setLayout(new GridLayout());
    form = tk.createScrolledForm(parent);
    form.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));

    Composite ret = form.getBody();
    ret.setLayout(new GridLayout());

    ifName = new LabeledInputField(ret, "Name");
    ifName.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
    tName = (Text) ifName.getControl();
    tName.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e){
            if (act != null) {
                act.setInternalName(tName.getText());
            }
            super.focusLost(e);
        }

    });
    ifPreis = new LabeledInputField(ret, Messages.MiGelDetailDisplay_Price);
    ifAmount = new LabeledInputField(ret, Messages.MiGelDetailDisplay_Amount);
    ifEinheit = new LabeledInputField(ret, Messages.MiGelDetailDisplay_Unit);
    tLong = SWTHelper.createText(tk, ret, 4, SWT.READ_ONLY);

    return ret;
}
项目:elexis-3-base    文件:TimeInput.java   
public TimeInput(Composite parent, String lbl){
    super(parent, SWT.NONE);
    listeners = new ArrayList<TimeInputListener>();
    setLayout(new GridLayout());
    label = new Label(this, SWT.NONE);
    label.setText(lbl);
    text = new Text(this, SWT.BORDER | SWT.SINGLE);
    text.addVerifyListener(new VerifyListener() {
        public void verifyText(VerifyEvent e){
            if (!isAcceptable(text.getText())) {
                e.doit = false;
            }

        }
    });
    text.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(final FocusEvent arg0){
            for (TimeInputListener s : listeners) {
                s.changed();
            }
        }

    });
    text.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
}
项目:team-explorer-everywhere    文件:QueryEditorCellModifier.java   
@Override
public Object getValue(final Object element, final String property) {
    final QEQueryRow row = (QEQueryRow) element;

    if (QueryEditorControl.LOGICAL_OPERATOR_COLUMN.equals(property)) {
        return getValueForComboBoxCellEditor(row.getLogicalOperator(), property);
    } else if (QueryEditorControl.FIELD_NAME_COLUMN.equals(property)) {
        return getValueForComboBoxCellEditor(row.getFieldName(), property);
    } else if (QueryEditorControl.OPERATOR_COLUMN.equals(property)) {
        setComboBoxCellEditorItems(property, getItemsForOperatorCombo(row.getFieldName()));
        setVisibleItemCount(QueryEditorControl.OPERATOR_COLUMN);
        return getValueForComboBoxCellEditor(row.getOperator(), property);
    } else if (QueryEditorControl.VALUE_COLUMN.equals(property)) {
        final FieldDefinition fieldDefinition = client.getFieldDefinitions().get(row.getFieldName());
        final String op = WIQLOperators.getInvariantOperator(row.getOperator());
        String fieldKey = fieldDefinition.getName();

        // Allowed values are cached by fieldName unless this is an
        // "IN GROUP" clause in which
        // case the allowed values are stored under a special case key.
        if (WIQLOperators.isGroupOperator(op)) {
            if (fieldDefinition.getReferenceName().equalsIgnoreCase(CoreFieldReferenceNames.WORK_ITEM_TYPE)) {
                fieldKey = GROUPVALUES_WITCATEGORIES;
            } else {
                fieldKey = GROUPVALUES_USERGROUPS;
            }
        } else if (WIQLOperators.isFieldNameOperator(op)) {
            final FieldType type = fieldDefinition.getFieldType();
            if (type == FieldType.DATETIME) {
                fieldKey = FIELDVALUES_FOR_DATE;
            } else if (type == FieldType.DOUBLE) {
                fieldKey = FIELDVALUES_FOR_DOUBLE;
            } else if (type == FieldType.INTEGER) {
                fieldKey = FIELDVALUES_FOR_INTEGER;
            } else if (type == FieldType.STRING) {
                fieldKey = FIELDVALUES_FOR_STRING;
            } else if (type == FieldType.BOOLEAN) {
                fieldKey = FIELDVALUES_FOR_BOOLEAN;
            } else if (type == FieldType.GUID) {
                fieldKey = FIELDVALUES_FOR_GUID;
            }
        }

        setComboBoxCellEditorItems(property, getItemsForValueCombo(fieldKey));
        setVisibleItemCount(QueryEditorControl.VALUE_COLUMN);

        final Integer comboBoxValue = getValueForComboBoxCellEditor(row.getValue(), property);

        final String value = row.getValue();
        if (comboBoxValue.intValue() == -1 && value != null && value.trim().length() > 0) {
            final ComboBoxCellEditor comboBoxCellEditor =
                (ComboBoxCellEditor) getCellEditorForProperty(QueryEditorControl.VALUE_COLUMN);
            ((CCombo) comboBoxCellEditor.getControl()).addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(final FocusEvent e) {
                    final CCombo combo = (CCombo) e.widget;
                    combo.setText(value);
                    combo.setSelection(new Point(0, value.length()));
                    combo.removeFocusListener(this);
                }
            });
        }

        return comboBoxValue;
    }

    return null;
}
项目:NEXCORE-UML-Modeler    文件:ContainerGroup.java   
/**
 * Creates this object's visual components.
 * 
 * @param parent
 *            org.eclipse.swt.widgets.Composite
 * @param heightHint
 *            height hint for the container selection widget group
 */
protected void createContents(Composite parent, String resourceLabelString, int heightHint) {

    Font font = parent.getFont();
    // server name group
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    composite.setFont(font);

    // container group
    if (heightHint == SWT.DEFAULT) {
        containerGroup = new ContainerSelectionGroup(composite, this, true, null, showClosedProjects, dialogType);
    } else {
        containerGroup = new ContainerSelectionGroup(composite,
            this,
            true,
            null,
            showClosedProjects,
            heightHint,
            SIZING_TEXT_FIELD_WIDTH,
            dialogType);
    }

    // resource name group
    Composite nameGroup = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    nameGroup.setLayout(layout);
    nameGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
    nameGroup.setFont(font);

    Label label = new Label(nameGroup, SWT.NONE);
    label.setText(resourceLabelString);
    label.setFont(font);

    // resource name entry field
    resourceNameField = new Text(nameGroup, SWT.BORDER);
    resourceNameField.addListener(SWT.Modify, this);
    resourceNameField.addFocusListener(new FocusAdapter() {
        public void focusLost(FocusEvent e) {
            handleResourceNameFocusLostEvent();
        }
    });
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    resourceNameField.setLayoutData(data);
    resourceNameField.setFont(font);
    validateControls();
}
项目:ArchiGITPlugin    文件:RemoteRepositoryDialog.java   
private void createRepoIdCombo(Composite container) {
  Label lbtSaveToBranch = new Label(container, SWT.NONE);
  lbtSaveToBranch.setText("Existing Repository Id (If Known)");

  GridData dataBranch = new GridData();
  dataBranch.grabExcessHorizontalSpace = true;
  dataBranch.horizontalAlignment = GridData.FILL;

  this.cmbRepoList = new Combo(container, SWT.BORDER);

  Set s = this.repoPropertyMap.keySet();
  Iterator i = s.iterator();
  String[] itemList = new String[s.size()];
  int ctr = 0;
  while(i.hasNext()) {
    String value = (String) i.next();
    itemList[ctr] = value;
    ctr++;
  }

  cmbRepoList.setItems(itemList);
  cmbRepoList.setLayoutData(dataBranch);

  cmbRepoList.addFocusListener(new FocusAdapter() {

@Override
public void focusLost(FocusEvent e) {


    if(repoPropertyMap.containsKey(cmbRepoList.getText())) {
        Properties repoProperties = (Properties) repoPropertyMap.get(cmbRepoList.getText());
        txtRepositoryToClone.setText(repoProperties.getProperty(IVersionModelPropertyConstants.REMOTE_REPO_LOCATION_PROPERTY_NAME));
        txtRepoUser.setText(repoProperties.getProperty(IVersionModelPropertyConstants.REMOTE_REPO_USER_PROPERTY_NAME));
    }   

    super.focusLost(e);
}

  });


}
项目:geokettle-2.0    文件:StyledTextComp.java   
public void addFocusListener(FocusAdapter focusAdapter){
    styledText.addFocusListener(focusAdapter);
}