本文整理汇总了Java中org.eclipse.swt.custom.StyledText.setEditable方法的典型用法代码示例。如果您正苦于以下问题:Java StyledText.setEditable方法的具体用法?Java StyledText.setEditable怎么用?Java StyledText.setEditable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.custom.StyledText
的用法示例。
在下文中一共展示了StyledText.setEditable方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSuffixText
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
/**
* Creates, configures and returns the suffix text control.
*/
private StyledText createSuffixText() {
StyledText styledText = new StyledText(this, SWT.TRANSPARENT);
styledText.setText("");
styledText.setForeground(INACTIVE_COLOR);
styledText.setBackground(getDisplay().getSystemColor(SWT.COLOR_TRANSPARENT));
styledText.setEditable(false);
styledText.setEnabled(false);
styledText.setLeftMargin(0);
return styledText;
}
示例2: createTextWidget
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
protected void createTextWidget(String textContents) {
StyledText styledText = new StyledText(getComposite(), SWT.NONE);
styledText.setText(textContents);
styledText.setFont(getCourierFont());
styledText.setEditable(false);
//styledText.setWordWrap(true); // seems to throw size out-of-whack
Point size = styledText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
getComposite().setContent(styledText);
getComposite().setExpandHorizontal(true);
getComposite().setExpandVertical(true);
getComposite().setMinWidth(size.x);
getComposite().setMinHeight(size.y);
getComposite().getContent().addListener(SWT.KeyUp, getToolbarCommandHandler());
getToolItem().setSelection(true);
setContentTypeAdapter(new StyledTextAdapter(styledText, getFileEntry().getFilename()));
}
示例3: createStyledText
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
private StyledText createStyledText() {
styledText = new StyledText(shell,
SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); // SWT.WRAP
GridData gridData = new GridData();
styledText.setFont(
new Font(shell.getDisplay(), "Source Code Pro Light", 10, SWT.NORMAL));
gridData.horizontalAlignment = GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.verticalAlignment = GridData.FILL;
gridData.grabExcessVerticalSpace = true;
styledText.setLayoutData(gridData);
styledText.addLineStyleListener(lineStyler);
styledText.setEditable(false);
styledText
.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));
return styledText;
}
示例4: createContents
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
/**
* Create contents of the application window.
*
* @param parent the parent
* @return the control
*/
@Override
protected Control createContents(Composite parent) {
getShell().setText("Execution tracking console - " + consoleName);
getShell().setBounds(50, 250, 450, 500);
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout(1, false));
{
styledText = new StyledText(container, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
styledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
styledText.setEditable(false);
}
statusLineManager.setMessage("Waiting for tracking status from server. Please wait!");
return container;
}
示例5: 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;
}
示例6: createReportingData
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
private void createReportingData(Composite parent) {
Group group = new Group(parent, SWT.NONE);
group.setText(Messages.UsageReportPreferencePage_ReportedValues);
GridDataFactory.fillDefaults().grab(true, true).hint(SWT.FILL, SWT.FILL).applyTo(group);
FillLayout fillLayout = new FillLayout();
fillLayout.marginHeight = 4;
fillLayout.marginWidth = 8;
group.setLayout(fillLayout);
StyledText text = new StyledText(group, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
text.setEditable(false);
EclipseEnvironment eclipseEnvironment = Activator.getDefault()
.getEclipseEnvironment();
createText(eclipseEnvironment, text);
}
示例7: createFormatedViewTabItem
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
/**
*
* Create formatted view tab in data viewer tab folder
*
*/
public void createFormatedViewTabItem() {
if (isViewTabExist(Views.FORMATTED_VIEW_NAME)) {
CTabItem item = getViewTabItem(Views.FORMATTED_VIEW_NAME);
tabFolder.setSelection(item);
dataViewLoader.reloadloadViews();
return;
}
CTabItem tbtmFormattedView = new CTabItem(tabFolder, SWT.CLOSE);
tbtmFormattedView.setData(Views.VIEW_NAME_KEY, Views.FORMATTED_VIEW_NAME);
tbtmFormattedView.setText(Views.FORMATTED_VIEW_DISPLAYE_NAME);
{
Composite composite = new Composite(tabFolder, SWT.NONE);
tbtmFormattedView.setControl(composite);
composite.setLayout(new GridLayout(1, false));
{
formattedViewTextarea = new StyledText(composite, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL
| SWT.V_SCROLL);
formattedViewTextarea.setFont(SWTResourceManager.getFont("Courier New", 9, SWT.NORMAL));
formattedViewTextarea.setEditable(false);
formattedViewTextarea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
}
}
tabFolder.setSelection(tbtmFormattedView);
dataViewLoader.setFormattedViewTextarea(formattedViewTextarea);
dataViewLoader.reloadloadViews();
}
示例8: SummaryPanel
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
SummaryPanel(Composite parent) {
summary = new StyledText(parent, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL);
summary.setCaret(null);
summary.setEditable(false);
GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL | GridData.GRAB_HORIZONTAL);
gd.horizontalSpan = 2;
// gd.heightHint = 100;
summary.setLayoutData(gd);
BookNotifier.getInstance().addListener(this);
}
示例9: toStyledText
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
/**
* Creates and returns with a new {@link StyledText styled text} instance hooked up to the given parent composite.
*
* @param parent
* the parent of the styled text control.
* @param style
* style bits for the new text control.
* @return a new styled text control initialized from the descriptor.
*/
default StyledText toStyledText(final Composite parent, final int style) {
final StyledText text = new StyledText(parent, READ_ONLY | style);
text.setText(getText());
text.setStyleRanges(getRanges());
text.setFont(getFont());
text.setEditable(false);
text.setEnabled(false);
final AtomicReference<Color> colorRef = new AtomicReference<>();
final IPreferenceStore prefStore = EditorsUI.getPreferenceStore();
if (null == prefStore
|| prefStore.getBoolean(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
colorRef.set(getDefault().getSystemColor(COLOR_LIST_BACKGROUND));
} else {
RGB rgb = null;
if (prefStore.contains(PREFERENCE_COLOR_BACKGROUND)) {
if (prefStore.isDefault(PREFERENCE_COLOR_BACKGROUND)) {
rgb = getDefaultColor(prefStore, PREFERENCE_COLOR_BACKGROUND);
} else {
rgb = getColor(prefStore, PREFERENCE_COLOR_BACKGROUND);
}
if (rgb != null) {
colorRef.set(new Color(text.getDisplay(), rgb));
}
}
}
if (null != colorRef.get()) {
text.setBackground(colorRef.get());
text.addDisposeListener(e -> {
if (!colorRef.get().isDisposed()) {
colorRef.get().dispose();
}
});
}
text.pack();
return text;
}
示例10: 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;
}
示例11: createOutputConsole
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
private void createOutputConsole(Composite errorComposite) {
outputConsole = new StyledText(errorComposite, SWT.BORDER|SWT.V_SCROLL|SWT.WRAP);
outputConsole.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
outputConsole.setEditable(false);
}
示例12: createDialogArea
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.getShell().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
lineHighlight.dispose();
}
});
Composite verticalGroup = new Composite(container, SWT.NONE);
verticalGroup.setLayout(new GridLayout());
compositeType = new Composite(verticalGroup, SWT.NONE);
compositeType.setLayout(new RowLayout(SWT.HORIZONTAL));
bSuspendOnType = new Button(compositeType, SWT.CHECK);
bSuspendOnType.setText("Suspend on type");
bSuspendOnType.addSelectionListener(this);
cmbTypes = new Combo(compositeType, SWT.READ_ONLY);
cmbTypes.addSelectionListener(this);
cmbTypes.setEnabled(false);
compositeUnit = new Composite(verticalGroup, SWT.NONE);
compositeUnit.setLayout(new RowLayout(SWT.HORIZONTAL));
bSuspendOnUnit = new Button(compositeUnit, SWT.CHECK);
bSuspendOnUnit.setText("Suspend on unit");
bSuspendOnUnit.setSelection(true);
bSuspendOnUnit.addSelectionListener(this);
cmbClass = new Combo(compositeUnit, SWT.READ_ONLY);
cmbClass.addSelectionListener(this);
cmbMethod = new Combo(compositeUnit, SWT.READ_ONLY);
cmbMethod.addSelectionListener(this);
Label spacer = new Label(verticalGroup, SWT.NONE);
spacer.setText("");
Label label = new Label(verticalGroup, SWT.NONE);
label.setText("Selected the unit to suspend on by clicking on a line below:");
Composite textContainer = new Composite(verticalGroup, SWT.NONE);
textContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1,1));
textContainer.setLayout(new GridLayout());
unitSelectionArea = new StyledText(textContainer, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
unitSelectionArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1,1));
unitSelectionArea.setLayoutData(new GridData(750, 400));
unitSelectionArea.setEditable(false);
unitSelectionArea.addCaretListener(this);
unitSelectionArea.addSelectionListener(this);
fillCombos();
cmbClass.select(0);
cmbMethod.select(0);
cmbTypes.select(0);
return container;
}