本文整理汇总了Java中org.eclipse.swt.custom.StyledText.setWordWrap方法的典型用法代码示例。如果您正苦于以下问题:Java StyledText.setWordWrap方法的具体用法?Java StyledText.setWordWrap怎么用?Java StyledText.setWordWrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.custom.StyledText
的用法示例。
在下文中一共展示了StyledText.setWordWrap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newTextArea
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
public StyledText newTextArea(Composite composite, boolean editable, int sty) {
int style = SWT.MULTI | SWT.V_SCROLL;
if (!editable)
style |= SWT.READ_ONLY;
else
style |= SWT.WRAP;
StyledText d = new StyledText(composite, style);
d.setText("To be entered\ntest\n\test\ntest");
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 80;
gd.widthHint = 460;
gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
d.setEditable(editable);
d.setLayoutData(gd);
d.setFont(FontShop.textFont());
if (keyListener != null)
d.addKeyListener(keyListener);
d.setWordWrap(editable);
WidgetShop.tweakTextWidget(d);
return d;
}
示例2: intializeEditor
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
private void intializeEditor(StyledText expressionEditor, JavaLineStyler javaLineStyler,Composite toolBarComposite) {
expressionEditor.setWordWrap(false);
expressionEditor.addLineStyleListener(javaLineStyler);
expressionEditor.setFont(new Font(null,"Arial", 10, SWT.NORMAL));
expressionEditor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 0, 0));
expressionEditor.getSize();
addDropSupport();
}
示例3: createCustomAreaWithLink
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
/**
* Creates a control with some message and with link to the Binaries preference page.
*
* @param parent
* the parent composite.
* @param dialog
* the container dialog that has to be closed.
* @param binary
* the binary with the illegal state.
*
* @return a control with error message and link that can be reused in dialogs.
*/
public static Control createCustomAreaWithLink(final Composite parent, final Dialog dialog, final Binary binary) {
final String binaryLabel = binary.getLabel();
final String prefix = "The requested operation cannot be performed due to invalid '" + binaryLabel
+ "' settings. Check your '" + binaryLabel
+ "' configuration and preferences under the corresponding ";
final String link = "preference page";
final String suffix = ".";
final String text = prefix + link + suffix;
final Composite control = new Composite(parent, NONE);
control.setLayout(GridLayoutFactory.fillDefaults().create());
final GridData gridData = GridDataFactory.fillDefaults().align(LEFT, TOP).grab(true, true).create();
control.setLayoutData(gridData);
final StyleRange style = new StyleRange();
style.underline = true;
style.underlineStyle = UNDERLINE_LINK;
final StyledText styledText = new StyledText(control, MULTI | READ_ONLY | WRAP);
styledText.setWordWrap(true);
styledText.setJustify(true);
styledText.setText(text);
final GridData textGridData = GridDataFactory.fillDefaults().align(FILL, FILL).grab(true, true).create();
textGridData.widthHint = TEXT_WIDTH_HINT;
textGridData.heightHint = TEXT_HEIGHT_HINT;
styledText.setLayoutData(textGridData);
styledText.setEditable(false);
styledText.setBackground(UIUtils.getSystemColor(COLOR_WIDGET_BACKGROUND));
final int[] ranges = { text.indexOf(link), link.length() };
final StyleRange[] styles = { style };
styledText.setStyleRanges(ranges, styles);
styledText.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(final MouseEvent event) {
try {
final int offset = styledText.getOffsetAtLocation(new Point(event.x, event.y));
final StyleRange actualStyle = styledText.getStyleRangeAtOffset(offset);
if (null != actualStyle && actualStyle.underline
&& UNDERLINE_LINK == actualStyle.underlineStyle) {
dialog.close();
final PreferenceDialog preferenceDialog = createPreferenceDialogOn(
UIUtils.getShell(),
BinariesPreferencePage.ID,
FILTER_IDS,
null);
if (null != preferenceDialog) {
preferenceDialog.open();
}
}
} catch (final IllegalArgumentException e) {
// We are not over the actual text.
}
}
});
return control;
}