本文整理汇总了Java中org.eclipse.swt.widgets.Text.setData方法的典型用法代码示例。如果您正苦于以下问题:Java Text.setData方法的具体用法?Java Text.setData怎么用?Java Text.setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Text
的用法示例。
在下文中一共展示了Text.setData方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: createStartElementSection
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
/**
* Create the element that allow to select a start element See the
* GraphWalker offline command for more information
*/
private void createStartElementSection(Composite parent) {
Label fGeneratorLabel = new Label(parent, SWT.NONE);
fGeneratorLabel.setText("Start Element");
gd = new GridData();
gd.horizontalSpan = 1;
gd.horizontalIndent = 25;
fGeneratorLabel.setLayoutData(gd);
fStartNodeText = new Text(parent, SWT.SINGLE | SWT.BORDER);
fStartNodeText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fStartNodeText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent evt) {
validatePage();
updateConfigState();
fStartNodeText.setFocus();
}
});
fStartNodeText.setData(GW4E_LAUNCH_CONFIGURATION_CONTROL_ID, GW4E_LAUNCH_CONFIGURATION_TEXT_ID_START_ELEMENT);
}
示例3: addTextBoxInTable
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
private Text addTextBoxInTable(TableViewer tableViewer, TableItem tableItem, String textBoxName,
String valueTextPane, String editorName, int columnIndex, Listener listener) {
final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
buttonPane.setLayout(new FillLayout());
final Text text = new Text(buttonPane, SWT.NONE);
text.addListener(SWT.Modify, listener);
text.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
tableItem.setData(textBoxName, text);
tableItem.setData(valueTextPane, buttonPane);
//text.addModifyListener(FilterHelper.INSTANCE.getTextModifyListener());
final TableEditor editor = new TableEditor(tableViewer.getTable());
editor.grabHorizontal = true;
editor.grabVertical = true;
editor.setEditor(buttonPane, tableItem, columnIndex);
editor.layout();
text.setData(editorName, editor);
return text;
}
示例4: GridTextInput
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
/**
* Constructor.
*
* @param parent The parent {@link Composite}.
* @param type The {@link Type}.
* @param name The {@link GridTextInput} name.
* @param labelText The {@link Label} text.
* @param labelStyle The {@link Label} style.
* @param labelLayoutData The {@link Label} {@link GridData layout data}.
* @param textText The {@link Text} text.
* @param textStyle The {@link Text} style.
* @param textLayoutData The {@link Text} {@link GridData layout data}.
*/
public GridTextInput(Composite parent, Type type, String name, String labelText, int labelStyle,
GridData labelLayoutData, String textText, int textStyle, GridData textLayoutData) {
_Type = type;
_DefaultTextValue = textText;
if (_DefaultTextValue != null && _Type.isInteger()) {
if (!isValidIntegerText(_DefaultTextValue)) {
throw new IllegalArgumentException("Invalid integer value: " + _DefaultTextValue);
}
}
_Name = name;
if (labelText != null) {
_Label = new Label(parent, labelStyle);
_Label.setText(labelText);
_Label.setLayoutData(labelLayoutData);
_Label.pack();
}
_Text = new Text(parent, textStyle);
if (textText != null) {
_Text.setText(textText);
}
_Text.setLayoutData(textLayoutData);
if (_Type.isInteger()) {
_Text.setTextLimit(10);
}
_Text.setData(this);
}
示例5: createrequirementSection
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
/**
* Create the Text that will hold the Requirement coming from the graphml file
* @param panel
* @param file
*/
protected void createrequirementSection(Composite panel, IFile file) {
Label label = createLabel(panel, MessageUtil.getString("Requirements")); //$NON-NLS-1$
Text t = new Text(panel, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
t.setData(GW4E_FILE_REQUIREMENT_TEXT_ID,GW4E_FILE_REQUIREMENT_TEXT_ID );
Set<String> requirements = null;
String reqMessage = "";
try {
requirements = GraphWalkerFacade.getRequirement(file);
String newline = System.getProperty("line.separator");
if (requirements == null || requirements.size() == 0) {
reqMessage = MessageUtil.getString("NoRequirements");
} else {
StringBuffer sb = new StringBuffer();
for (String req : requirements) {
sb.append(req).append(newline);
}
t.setText(sb.toString());
reqMessage = requirements.size() + " " + MessageUtil.getString("requirementsfound");
}
} catch (Exception e) {
ResourceManager.logException(e);
t.setText(e.getMessage());
}
t.setEditable(false);
GridDataFactory.fillDefaults().grab(true, true).hint(150, 150).applyTo(t);
createLabel(panel, MessageUtil.getString("requirementMessage")); //$NON-NLS-1$
label = createLabel(panel, reqMessage);
fillExcessHorizontalSpace(label);
}
示例6: createMethodSection
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
/**
* Create the Text that will hold the Methods coming from the graphml file
*
* @param panel
* @param file
*/
protected void createMethodSection(Composite panel, IFile file) {
Label label = createLabel(panel, MessageUtil.getString("Methods")); //$NON-NLS-1$
Text t = new Text(panel, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
t.setData(GraphModelPropertyPage.GW4E_FILE_METHODS_TEXT_ID, GW4E_FILE_METHODS_TEXT_ID);
Set<String> methods = null;
String reqMessage = "";
try {
methods = GraphWalkerFacade.getMethods(file);
String newline = System.getProperty("line.separator");
if (methods == null || methods.size() == 0) {
reqMessage = MessageUtil.getString("NoMethods");
} else {
StringBuffer sb = new StringBuffer();
for (String meth : methods) {
sb.append(meth).append(newline);
}
t.setText(sb.toString());
reqMessage = methods.size() + " " + MessageUtil.getString("methodsfound");
}
} catch (Exception e) {
ResourceManager.logException(e);
t.setText(e.getMessage());
}
t.setEditable(false);
GridDataFactory.fillDefaults().grab(true, true).hint(150, 150).applyTo(t);
createLabel(panel, MessageUtil.getString("methodMessage")); //$NON-NLS-1$
label = createLabel(panel, reqMessage);
fillExcessHorizontalSpace(label);
}
示例7: createNewMode
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
private void createNewMode() {
btnCreateNewRadioButton = new Button(this, SWT.RADIO);
btnCreateNewRadioButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
btnCreateNewRadioButton.setText(MessageUtil.getString("standalone_mode"));
btnCreateNewRadioButton.setSelection(false);
btnCreateNewRadioButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
switch (e.type) {
case SWT.Selection:
updateUI();
break;
}
}
});
btnCreateNewRadioButton.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_NEWCLASS_CHECKBOX);
Composite composite = new Composite(this, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
composite.setLayout(new GridLayout(12, false));
lblNewClassnameLabel = new Label(composite, SWT.NONE);
lblNewClassnameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
lblNewClassnameLabel.setText("Class name");
lblNewClassnameLabel.setEnabled(false);
newClassnameText = new Text(composite, SWT.BORDER);
newClassnameText.setEnabled(false);
newClassnameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
listener.handleEvent(null);
}
});
newClassnameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 8, 1));
newClassnameText.setEnabled(false);
newClassnameText.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_NEWCLASS_TEXT);
}
示例8: createNewClassWizard
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
/**
* Creates the new class wizard.
*
* @param fileNameTextBox
* the file name
* @param widgetConfig
*/
public void createNewClassWizard(Text fileNameTextBox, WidgetConfig widgetConfig) {
OpenNewClassWizardAction wizard = new OpenNewClassWizardAction();
wizard.setOpenEditorOnFinish(false);
final CustomizeNewClassWizardPage page = new CustomizeNewClassWizardPage();
page.setSuperClass("java.lang.Object", true);
page.setMethodStubSelection(false, false, true, true);
List<String> interfaceList = new ArrayList<String>();
OperationClassConfig operationClassConfig = (OperationClassConfig) widgetConfig;
Operations operations = XMLConfigUtil.INSTANCE.getComponent(getComponentName()).getOperations();
TypeInfo typeInfo=operations.getInterface();
if (operationClassConfig!=null && operationClassConfig.getComponentName().equalsIgnoreCase(typeInfo.getName()))
{
interfaceList.add(typeInfo.getClazz());
}
page.setSuperInterfaces(interfaceList, true);
wizard.setConfiguredWizardPage(page);
if(OSValidator.isMac()){
Display.getDefault().timerExec(0, new Runnable() {
@Override
public void run() {
page.getControl().forceFocus();
}
});
}
wizard.run();
if (page.isPageComplete()) {
if(!page.getPackageText().equalsIgnoreCase("")){
fileNameTextBox.setText(page.getPackageText()+"."
+ page.getTypeName());
}else{
fileNameTextBox.setText(page.getTypeName());
}
}
fileNameTextBox.setData("path", "/" + page.getPackageFragmentRootText() + "/"
+ page.getPackageText().replace(".", "/") + "/"
+ page.getTypeName() + ".java");
}
示例9: browseJavaSelectionDialog
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
/**
* Open selection dialog for Java files, File selection restricted to ".java" extension.
* @param filterExtension
* @param fileName
*/
public static void browseJavaSelectionDialog(String filterExtension, Text fileName) {
ResourceFileSelectionDialog dialog = new ResourceFileSelectionDialog(
"Project", "Select Java Class (.java)", new String[] { filterExtension });
if (dialog.open() == IDialogConstants.OK_ID) {
IResource resource = (IResource) dialog.getFirstResult();
String filePath = resource.getRawLocation().toOSString();
java.nio.file.Path path =Paths.get(filePath);
String classFile=path.getFileName().toString();
String name = "";
try(BufferedReader reader= new BufferedReader(new FileReader(filePath))){
String firstLine= reader.readLine();
if(firstLine.contains(Constants.PACKAGE)){
name= firstLine.replaceFirst(Constants.PACKAGE, "").replace(";", "");
if(!name.equalsIgnoreCase("")){
name=name+"."+classFile.substring(0, classFile.lastIndexOf('.'));
}
}else{
name=classFile.substring(0, classFile.lastIndexOf('.'));
}
} catch (IOException e) {
logger.error("Unable to read file " + filePath,e );
}
fileName.setText(name.trim());
filePath = resource.getRawLocation().toOSString();
fileName.setData("path", resource.getFullPath().toString());
}
}
示例10: validatePortField
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
/**
* Check if text box contains any alphabets
* @param textBox
* @param value
* @param message
*/
private void validatePortField(Text textBox, String value, String message) {
if (StringUtils.isBlank(value) || !value.matches(Constants.PORT_VALIDATION_REGEX)) {
textBox.setData(ERROR_KEY, message);
executionTrackPreference.setValid(false);
} else {
textBox.setData(ERROR_KEY, null);
executionTrackPreference.setValid(true);
}
checkState();
}
示例11: validationForTextField
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
/**
* Check if text box is blank
* @param textBox
* @param value
* @param message
*/
protected void validationForTextField(Text textBox, String message) {
if (StringUtils.isBlank(textBox.getText())) {
textBox.setData(ERROR_KEY, message);
executionTrackPreference.setValid(false);
} else {
textBox.setData(ERROR_KEY, null);
executionTrackPreference.setValid(true);
}
checkState();
}
示例12: createExtendMode
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
private void createExtendMode() {
btnExtendRadioButton = new Button(this, SWT.RADIO);
btnExtendRadioButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
btnExtendRadioButton.setText(MessageUtil.getString("extending_class"));
btnExtendRadioButton.setSelection(false);
btnExtendRadioButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
switch (e.type) {
case SWT.Selection:
updateUI();
break;
}
}
});
btnExtendRadioButton.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_EXTEND_CHECKBOX);
Composite composite = new Composite(this, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
composite.setLayout(new GridLayout(12, false));
lblExtendedLabel = new Label(composite, SWT.NONE);
lblExtendedLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
lblExtendedLabel.setText(MessageUtil.getString("class_extended"));
lblExtendedLabel.setEnabled(false);
comboExtendedClassnameViewer = new AncestorViewer(composite);
comboExtendedClassnameViewer.initialize(GW4E_CONVERSION_COMBO_ANCESTOR_EXTEND_TEST, false);
comboExtendedClassnameViewer.getCombo().setData(GW4E_CONVERSION_WIDGET_ID, GW4E_CONVERSION_COMBO_ANCESTOR_EXTEND_TEST);
Combo combo = comboExtendedClassnameViewer.getCombo();
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 8, 1));
combo.setEnabled(false);
lblExtendingLabel = new Label(composite, SWT.NONE);
lblExtendingLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
lblExtendingLabel.setText(MessageUtil.getString("classname"));
lblExtendingLabel.setEnabled(false);
extendingClassnameText = new Text(composite, SWT.BORDER);
extendingClassnameText.setEnabled(false);
extendingClassnameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
listener.handleEvent(null);
}
});
extendingClassnameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 8, 1));
extendingClassnameText.setEnabled(false);
extendingClassnameText.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_EXTEND_CLASS_TEXT);
}