當前位置: 首頁>>代碼示例>>Java>>正文


Java StyledText.setEditable方法代碼示例

本文整理匯總了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;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:15,代碼來源:SuffixText.java

示例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()));
}
 
開發者ID:AppleCommander,項目名稱:AppleCommander,代碼行數:18,代碼來源:TextFilterAdapter.java

示例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;
}
 
開發者ID:sergueik,項目名稱:SWET,代碼行數:18,代碼來源:ScrolledTextEx.java

示例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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:22,代碼來源:ExecutionTrackingConsole.java

示例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;
}
 
開發者ID:openaudible,項目名稱:openaudible,代碼行數:23,代碼來源:GridComposite.java

示例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);

}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:16,代碼來源:UsageReportPreferencePage.java

示例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();
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:33,代碼來源:DebugDataViewer.java

示例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);
}
 
開發者ID:openaudible,項目名稱:openaudible,代碼行數:12,代碼來源:SummaryPanel.java

示例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;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:54,代碼來源:StyledTextDescriptor.java

示例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;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:77,代碼來源:IllegalBinaryStateDialog.java

示例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);
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:6,代碼來源:EvaluateDialog.java

示例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;
}
 
開發者ID:VisuFlow,項目名稱:visuflow-plugin,代碼行數:59,代碼來源:UnitBreakpointPropertiesDialog.java


注:本文中的org.eclipse.swt.custom.StyledText.setEditable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。