本文整理汇总了Java中org.eclipse.swt.widgets.Text类的典型用法代码示例。如果您正苦于以下问题:Java Text类的具体用法?Java Text怎么用?Java Text使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Text类属于org.eclipse.swt.widgets包,在下文中一共展示了Text类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTextBoxValue1Listener
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
/**
* Gets the text box value 1 listener.
*
* @param conditionsList
* the conditions list
* @param fieldsAndTypes
* the fields and types
* @param fieldNames
* the field names
* @param saveButton
* the save button
* @param displayButton
* the display button
* @return the text box value 1 listener
*/
public Listener getTextBoxValue1Listener(final List<Condition> conditionsList,
final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
Text text = (Text)event.widget;
int index = (int) text.getData(FilterConstants.ROW_INDEX);
Condition filterConditions = conditionsList.get(index);
filterConditions.setValue1(text.getText());
validateText(text, filterConditions.getFieldName(), fieldsAndTypes, filterConditions.getConditionalOperator());
toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
}
};
return listener;
}
示例2: createFilterControls
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
protected void createFilterControls(Composite con) {
Label filterLabel = new Label(con,SWT.NONE);
filterLabel.setText("Filter:");
GridDataFactory.swtDefaults().applyTo(filterLabel);
Text filterText = new Text(con, SWT.BORDER);
filterText.setMessage("(" + PreferenceFilter.MIN_FILTER_CHARS + " chars at least)");
filterText.addModifyListener(event -> {
filterChanged(filterText.getText());
});
GridDataFactory.fillDefaults().grab(true,false).applyTo(filterText);
Button clearBtn = new Button(con, SWT.PUSH);
clearBtn.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(PrefEditorPlugin.PLUGIN_ID,"icons/clear.gif").createImage());
GridDataFactory.swtDefaults().applyTo(clearBtn);
clearBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
filterText.setText("");
filterChanged("");
}
});
}
示例3: computeSize
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
@Override
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
int width = 0;
int height = 0;
Point textDimension = textDimensions();
Control[] children = composite.getChildren();
for (Control child : children) {
if (child instanceof Text) {
final String textContent = ((Text) child).getText();
textDimension = gc.textExtent(textContent);
width += textDimension.x;
height += textDimension.y;
}
if (child instanceof Label) {
Point computedSize = child.computeSize(0, 0);
width += computedSize.x;
}
}
return new Point(width, height + 4);
}
示例4: createProjectSection
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
/**
* Create the element that allow to select a project See the GraphWalker
* offline command for more information
*/
private void createProjectSection(Composite parent) {
fProjLabel = new Label(parent, SWT.NONE);
fProjLabel.setText(MessageUtil.getString("label_project"));
GridData gd = new GridData();
gd.horizontalIndent = 25;
fProjLabel.setLayoutData(gd);
fProjText = new Text(parent, SWT.SINGLE | SWT.BORDER);
fProjText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fProjText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent evt) {
validatePage();
updateConfigState();
}
});
fProjText.setData(GW4E_LAUNCH_CONFIGURATION_CONTROL_ID, GW4E_LAUNCH_CONFIGURATION_TEXT_ID_PROJECT);
}
示例5: SuperClassComponent
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
/**
* Creates a new super class component using the given model and container.
*
* @param model
* The model to bind this to
* @param container
* The parent WizardComponentContainer
*/
public SuperClassComponent(N4JSClassWizardModel model, WizardComponentContainer container) {
super(container);
this.model = model;
Label superClassLabel = new Label(container.getComposite(), SWT.NONE);
superClassLabel.setText("Super class:");
text = new Text(container.getComposite(), SWT.BORDER);
text.setLayoutData(fillTextDefaults());
browseButton = new Button(container.getComposite(), SWT.NONE);
browseButton.setToolTipText("Opens a dialog to choose the super class");
browseButton.setText("Browse...");
setupBindings();
setupDialog();
}
示例6: createVersionArea
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
private void createVersionArea(final Group parent, String versionLabel, Consumer<String> textHandler,
Consumer<Boolean> flagHandler) {
final Composite area = createVersionArea(parent, versionLabel);
final Composite textArea = createVersionInputArea(area);
final Text txtUpperVersion = getSimpleTextArea(textArea);
txtUpperVersion.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
Text textWidget = (Text) e.getSource();
textHandler.accept(textWidget.getText());
}
});
createVersionInclsivnessArea(area, flagHandler);
}
示例7: addVerifyListnerToOutputEditingSupport
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
public static void addVerifyListnerToOutputEditingSupport(JoinMappingEditingSupport outputEditingSupport) {
((Text)outputEditingSupport.getEditor().getControl()).addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
String text=e.text;
Matcher matcher=Pattern.compile(Constants.REGEX).matcher(text);
if(matcher.matches()){
e.doit=true;
}else{
e.doit=false;
}
}
});
}
示例8: addIdKeyComposite
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
/**
* @param container
* @return
*/
public Control addIdKeyComposite(Composite container, FTPAuthOperationDetails authOperationDetails) {
Composite keyFileComposite = new Composite(container, SWT.BORDER);
keyFileComposite.setLayout(new GridLayout(3, false));
keyFileComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
FTPWidgetUtility ftpWidgetUtility = new FTPWidgetUtility();
ftpWidgetUtility.createLabel(keyFileComposite, "User ID");
ftpWidgetUtility.createText(keyFileComposite, "", SWT.BORDER);
Button keyFileBrwsBtn1 = new Button(keyFileComposite, SWT.NONE);
keyFileBrwsBtn1.setVisible(false);
ftpWidgetUtility.createLabel(keyFileComposite, "Public/Private Key");
Text privateKeyTxt = (Text) ftpWidgetUtility.createText(keyFileComposite, "", SWT.BORDER);
Button keyFileBrwsBtn = new Button(keyFileComposite, SWT.NONE);
keyFileBrwsBtn.setText("...");
selectionListener(keyFileBrwsBtn, privateKeyTxt);
return keyFileComposite;
}
示例9: addBasicAuthKeyComposite
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
/**
* @param control
* @return
*/
public Control addBasicAuthKeyComposite(Composite control, FTPAuthOperationDetails authOperationDetails){
Composite basicAuthKeyComposite = new Composite(control, SWT.BORDER);
basicAuthKeyComposite.setLayout(new GridLayout(3, false));
basicAuthKeyComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
FTPWidgetUtility ftpWidgetUtility = new FTPWidgetUtility();
ftpWidgetUtility.createLabel(basicAuthKeyComposite, "User ID");
ftpWidgetUtility.createText(basicAuthKeyComposite, "", SWT.BORDER);
new Button(basicAuthKeyComposite, SWT.NONE).setVisible(false);
ftpWidgetUtility.createLabel(basicAuthKeyComposite, "Password");
ftpWidgetUtility.createText(basicAuthKeyComposite, "", SWT.PASSWORD|SWT.BORDER);
new Button(basicAuthKeyComposite, SWT.NONE).setVisible(false);
ftpWidgetUtility.createLabel(basicAuthKeyComposite, "Public/Private Key");
Text privateKeyTxt = (Text) ftpWidgetUtility.createText(basicAuthKeyComposite, "", SWT.BORDER);
Button keyFileBrwsBtn = new Button(basicAuthKeyComposite, SWT.NONE);
keyFileBrwsBtn.setText("...");
selectionListener(keyFileBrwsBtn, privateKeyTxt);
return basicAuthKeyComposite;
}
示例10: createSimpleIdTextBox
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
private void createSimpleIdTextBox(Composite composite_1) {
Composite composite = new Composite(composite_1, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
gd_composite.heightHint = 29;
composite.setLayoutData(gd_composite);
idTextBox = new Text(composite, SWT.BORDER);
idTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
idTextBox.setText(expressionDataStructure.getId());
idTextBox.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
expressionDataStructure.setId(idTextBox.getText());
dialog.refreshErrorLogs();
}
});
}
示例11: canFlipToNextPage
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
@Override
public boolean canFlipToNextPage() {
ZooKeeperServerNewWizardPage2 jmxPage = (ZooKeeperServerNewWizardPage2) getNextPage();
if (jmxPage != null) {
GridComposite jmxPageGridComposite = jmxPage.getGridComposite();
if (jmxPageGridComposite != null) {
String hostPortString = getHost() + ":" + String.valueOf(ZooKeeperServerDescriptor.DEFAULT_JMX_PORT);
String defaultJmxServiceUrlString = "service:jmx:rmi:///jndi/rmi://" + hostPortString + "/jmxrmi";
Text jmxUrlText = (Text) jmxPageGridComposite
.getControl(ZooKeeperServerNewWizardPage2.CONTROL_NAME_JMX_URL_TEXT);
if (jmxUrlText != null && !jmxUrlText.isDisposed()) {
jmxUrlText.setText(defaultJmxServiceUrlString);
}
}
}
return super.canFlipToNextPage();
}
示例12: getZnode
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
public Znode getZnode() throws Exception {
byte[] data = getZnodeData();
ZnodeModel parentZnodeModel = getParentZnodeModel();
Text pathText = (Text) getControl(CONTROL_NAME_PATH_TEXT);
String relativePath = pathText.getText();
Znode parentZnode = parentZnodeModel.getData();
String parentPath = parentZnode.getPath();
String absolutePath = Znode.getAbsolutePath(parentPath, relativePath);
Button sequentialCheckbox = (Button) getControl(CONTROL_NAME_CREATE_MODE_SEQUENTIAL_BUTTON);
boolean isSequential = sequentialCheckbox.getSelection();
Button ephemeralRadioButton = (Button) getControl(CONTROL_NAME_CREATE_MODE_EPHEMERAL_BUTTON);
boolean isEphemeral = ephemeralRadioButton.getSelection();
Znode znode = new Znode(absolutePath);
znode.setSequential(isSequential);
znode.setEphemeral(isEphemeral);
znode.setData(data);
return znode;
}
示例13: getZnodeData
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
@Override
public byte[] getZnodeData() throws Exception {
Text filePathText = (Text) getControl(CONTROL_NAME_DATA_FILE_TEXT);
String filePath = filePathText.getText();
File file = new File(filePath);
String fileName = file.getName();
if (!file.exists()) {
throw new IOException("File '" + fileName + "' does not exist.");
}
if (!file.isFile()) {
throw new IOException("Path '" + filePath + "' is not a valid file.");
}
long length = file.length();
if (length > Znode.MAX_DATA_SIZE) {
throw new Exception("File '" + fileName
+ "' size is greater than the maximum allowed Znode data size (" + Znode.MAX_DATA_SIZE
+ " bytes).");
}
FileEditor fileEditor = new FileEditor(file);
return fileEditor.read();
}
示例14: createSimpleIdTextBox
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
private void createSimpleIdTextBox(Composite composite_1) {
Composite composite = new Composite(composite_1, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
gd_composite.heightHint = 29;
composite.setLayoutData(gd_composite);
idTextBox = new Text(composite, SWT.BORDER);
idTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
idTextBox.setText(operationDataStructure.getId());
idTextBox.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
operationDataStructure.setId(idTextBox.getText());
dialog.refreshErrorLogs();
}
});
}
示例15: createAttributeText
import org.eclipse.swt.widgets.Text; //导入依赖的package包/类
private Text createAttributeText ( final String attribute )
{
final Text t = new Text ( this, SWT.BORDER );
final Fields field = Fields.byField ( attribute );
if ( field == null )
{
t.setEditable ( true );
t.setMessage ( Messages.custom_field );
}
else
{
t.setEditable ( false );
t.setText ( field.getName () );
}
t.addKeyListener ( new KeyAdapter () {
@Override
public void keyReleased ( final KeyEvent e )
{
AssertionComposite.this.orCondition.updateFilter ();
};
} );
final RowData rowData = new RowData ();
rowData.width = 132;
t.setLayoutData ( rowData );
return t;
}