Java Code Examples for org.eclipse.swt.custom.StyledText#setAlwaysShowScrollBars()

The following examples show how to use org.eclipse.swt.custom.StyledText#setAlwaysShowScrollBars() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InputPageUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a signature preview viewer in a parent composite with a 1-column GridLayout.
 * 
 * @param parent the parent 
 * @return the preview viewer
 * @since 3.9
 */
public static JavaSourceViewer createSignaturePreview(Composite parent) {
	IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	JavaSourceViewer signaturePreview= new JavaSourceViewer(parent, null, null, false, SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP, store);
	signaturePreview.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null));
	StyledText textWidget= signaturePreview.getTextWidget();
	textWidget.setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
	textWidget.setAlwaysShowScrollBars(false);
	signaturePreview.adaptBackgroundColor(parent);
	signaturePreview.setDocument(new Document());
	signaturePreview.setEditable(false);

	GridData gdata= new GridData(GridData.FILL_BOTH);
	gdata.widthHint= new PixelConverter(textWidget).convertWidthInCharsToPixels(50);
	gdata.heightHint= textWidget.getLineHeight() * 2;
	textWidget.setLayoutData(gdata);
	
	return signaturePreview;
}
 
Example 2
Source File: DetailsView.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
public void insert(Composite parent, int numberOfRow) {
	for (int i = 0; i < params.length; i++) {
		String param = params[i];
		
		new Label(parent, SWT.NONE).setText("");
						
		StyledText lbl = new StyledText(parent, SWT.FULL_SELECTION | SWT.READ_ONLY | SWT.WRAP);
		lbl.setAlwaysShowScrollBars(false);
		lbl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
		if( param.matches("^[a-zA-Z0-9]+:\\/\\/.*$") ) {
			lbl.setFont(SWTResourceManager.getFont("Segoe UI", 7, SWT.UNDERLINE_LINK));
			lbl.setForeground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND));
			lbl.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_HAND));
			lbl.addMouseListener(new MouseAdapter() {

				@Override
				public void mouseDown(MouseEvent e) {
					eventManager.invoke(l -> l.onOpenInBrowserRequest(param));
				}
			});
		}else {
			lbl.setFont(SWTResourceManager.getFont("Segoe UI", 7, SWT.NORMAL));
		}
		lbl.setText(param);
		
		if (numberOfRow % 2 == 0) {
			lbl.setBackground(SWTResourceManager.getColor(206, 234, 255));
		}
	}
}
 
Example 3
Source File: StatechartDefinitionSection.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected EmbeddedEditor createSpecificationEditor() {
	ContextScopeHandler.defineContext(EMBEDDED_TEXT_EDITOR_SCOPE, TEXT_EDITOR_SCOPE);
	EmbeddedEditor embeddedEditor = createEmbeddedEditor();
	embeddedEditor.createPartialEditor();
	GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(embeddedEditor.getViewer().getControl());
	StyledText text = embeddedEditor.getViewer().getTextWidget();
	text.setAlwaysShowScrollBars(false);
	text.setSelection(0);
	text.setKeyBinding(SWT.MOD1 | SWT.KEY_MASK & 'a', ST.SELECT_ALL);
	initXtextSelectionProvider(text);
	initContextMenu(text);
	text.addModifyListener((event) -> editorPart.firePropertyChange(IEditorPart.PROP_DIRTY));
	text.setEnabled(editorPart.isEditable());
	return embeddedEditor;
}
 
Example 4
Source File: PersonalAnamnesisComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public PersonalAnamnesisComposite(Composite parent, int style){
	super(parent, style);
	setLayout(new GridLayout(1, false));
	textOberservation =
		new StyledText(this, SWT.NONE | SWT.WRAP | SWT.MULTI | SWT.V_SCROLL);
	textOberservation.setAlwaysShowScrollBars(true); //if false horizontal scrollbar blinks on typing
	GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd.widthHint = 100;
	gd.heightHint = 100;
	textOberservation.setLayoutData(gd);
	initDataBindings();
}
 
Example 5
Source File: AllergyIntoleranceComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public AllergyIntoleranceComposite(Composite parent, int style){
	super(parent, style);
	setLayout(new GridLayout(1, false));
	textOberservation =
		new StyledText(this, SWT.NONE | SWT.WRAP | SWT.MULTI | SWT.V_SCROLL);
	textOberservation.setAlwaysShowScrollBars(true); //if false horizontal scrollbar blinks on typing
	GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd.widthHint = 100;
	gd.heightHint = 100;
	textOberservation.setLayoutData(gd);
	initDataBindings();
}
 
Example 6
Source File: RiskComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public RiskComposite(Composite parent, int style){
	super(parent, style);
	setLayout(new GridLayout(1, false));
	textOberservation =
		new StyledText(this, SWT.NONE | SWT.WRAP | SWT.MULTI | SWT.V_SCROLL);
	textOberservation.setAlwaysShowScrollBars(true); //if false horizontal scrollbar blinks on typing
	GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd.widthHint = 100;
	gd.heightHint = 100;
	textOberservation.setLayoutData(gd);
	initDataBindings();
}
 
Example 7
Source File: FamilyAnamnesisComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public FamilyAnamnesisComposite(Composite parent, int style){
	super(parent, style);
	setLayout(new GridLayout(1, false));
	textOberservation =
		new StyledText(this, SWT.NONE | SWT.WRAP | SWT.MULTI | SWT.V_SCROLL);
	textOberservation.setAlwaysShowScrollBars(true); //if false horizontal scrollbar blinks on typing
	GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd.widthHint = 100;
	gd.heightHint = 100;
	textOberservation.setLayoutData(gd);
	initDataBindings();
}
 
Example 8
Source File: MapSection.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite root) {
	getShell().setText("Enter GeoJSON");
	Composite area = (Composite) super.createDialogArea(root);
	UI.gridLayout(area, 1);
	new Label(area, SWT.NONE).setText(
			"See e.g. http://geojson.io for examples");
	text = new StyledText(area, SWT.MULTI | SWT.BORDER
			| SWT.V_SCROLL | SWT.H_SCROLL);
	text.setAlwaysShowScrollBars(false);
	UI.gridData(text, true, true);
	text.setText(getJsonText());
	return area;
}