org.eclipse.swt.custom.LineStyleListener Java Examples

The following examples show how to use org.eclipse.swt.custom.LineStyleListener. 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: StyledTextComp.java    From hop with Apache License 2.0 4 votes vote down vote up
public void addLineStyleListener( LineStyleListener lineStyler ) {
  styledText.addLineStyleListener( lineStyler );
}
 
Example #2
Source File: BibtexMergeDialog.java    From slr-toolkit with Eclipse Public License 1.0 4 votes vote down vote up
private void buildPreview(Composite container) {
	GridData gridData = new GridData();
	gridData.horizontalAlignment = SWT.RIGHT;
	gridData.verticalAlignment = SWT.TOP;
	gridData.grabExcessVerticalSpace = true;
	gridData.horizontalSpan = 1;
	gridData.verticalSpan = 5;

	Composite composite = new Composite(container, SWT.NONE);
	composite.setLayout(new GridLayout(1, false));
	composite.setLayoutData(gridData);

	// create overview
	Table table = new Table(composite, SWT.BORDER);
	table.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, true, 1, 1));

	TableColumn intersection = new TableColumn(table, SWT.CENTER);
	TableColumn mergeConflicts = new TableColumn(table, SWT.CENTER);
	TableColumn unionWithoutConflicts = new TableColumn(table, SWT.CENTER);
	intersection.setText("Intersection");
	mergeConflicts.setText("Merge conflicts");
	unionWithoutConflicts.setText("Union without conflicts");
	intersection.setWidth(80);
	mergeConflicts.setWidth(100);
	unionWithoutConflicts.setWidth(140);
	table.setHeaderVisible(true);

	previewStats = new TableItem(table, SWT.NONE);

	Label label = new Label(composite, SWT.NONE);
	label.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, true, 1, 1));
	label.setText("Preview: ");

	preview = new StyledText(composite, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	preview.setLayoutData(new GridData(GridData.FILL_BOTH));
	preview.setEditable(false);
	preview.setEnabled(false);
	preview.setBlockSelection(true);

	// highlight current conflict
	initializeConflictIterator();
	preview.addLineStyleListener(new LineStyleListener() {
		public void lineGetStyle(LineStyleEvent event) {
			if (currentConflictedField == null
					|| currentConflictedResource.getConflictForField(currentConflictedField) == null)
				return;

			String currentConflict = currentConflictedResource.getConflictForField(currentConflictedField);
			StyleRange styleRange = new StyleRange();
			styleRange.start = preview.getText().indexOf(currentConflict);
			styleRange.length = currentConflict.length();
			styleRange.background = getParentShell().getDisplay().getSystemColor(SWT.COLOR_YELLOW);
			event.styles = new StyleRange[] { styleRange };
		}
	});

	GridData textGrid = new GridData(500, 500);
	textGrid.horizontalSpan = 2;
	preview.setLayoutData(textGrid);

	updatePreview();
}
 
Example #3
Source File: StyledTextComp.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void addLineStyleListener( LineStyleListener lineStyler ) {
  styledText.addLineStyleListener( lineStyler );
}