Search in sources :

Example 11 with LineNumberRulerColumn

use of org.eclipse.jface.text.source.LineNumberRulerColumn in project hale by halestudio.

the class SourceViewerPage method createVerticalRuler.

/**
 * Create the vertical ruler for the source viewer.
 *
 * @return the vertical ruler
 */
protected IVerticalRuler createVerticalRuler() {
    final Display display = Display.getCurrent();
    CompositeRuler ruler = new CompositeRuler(3);
    LineNumberRulerColumn lineNumbers = new LineNumberRulerColumn();
    // SWT.COLOR_INFO_BACKGROUND));
    lineNumbers.setBackground(display.getSystemColor(SWT.COLOR_GRAY));
    // SWT.COLOR_INFO_FOREGROUND));
    lineNumbers.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
    lineNumbers.setFont(JFaceResources.getTextFont());
    ruler.addDecorator(0, lineNumbers);
    return ruler;
}
Also used : LineNumberRulerColumn(org.eclipse.jface.text.source.LineNumberRulerColumn) CompositeRuler(org.eclipse.jface.text.source.CompositeRuler) Display(org.eclipse.swt.widgets.Display)

Example 12 with LineNumberRulerColumn

use of org.eclipse.jface.text.source.LineNumberRulerColumn in project hale by halestudio.

the class GroovyEditor method createRuler.

/**
 * Create the vertical ruler for the source viewer.
 *
 * @return the vertical ruler
 */
private IVerticalRuler createRuler() {
    final Display display = Display.getCurrent();
    CompositeRuler ruler = new CompositeRuler(3);
    LineNumberRulerColumn lineNumbers = new LineNumberRulerColumn();
    // SWT.COLOR_INFO_BACKGROUND));
    lineNumbers.setBackground(display.getSystemColor(SWT.COLOR_GRAY));
    // SWT.COLOR_INFO_FOREGROUND));
    lineNumbers.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
    lineNumbers.setFont(JFaceResources.getTextFont());
    ruler.addDecorator(0, lineNumbers);
    return ruler;
}
Also used : LineNumberRulerColumn(org.eclipse.jface.text.source.LineNumberRulerColumn) CompositeRuler(org.eclipse.jface.text.source.CompositeRuler) Display(org.eclipse.swt.widgets.Display)

Example 13 with LineNumberRulerColumn

use of org.eclipse.jface.text.source.LineNumberRulerColumn in project hale by halestudio.

the class XMLStylePage3 method createControl.

/**
 * @see IDialogPage#createControl(Composite)
 */
@Override
public void createControl(Composite parent) {
    changed = false;
    final Display display = parent.getDisplay();
    FillLayout fillLayout = new FillLayout();
    fillLayout.type = SWT.VERTICAL;
    parent.setLayout(fillLayout);
    CompositeRuler ruler = new CompositeRuler(3);
    LineNumberRulerColumn lineNumbers = new LineNumberRulerColumn();
    // SWT.COLOR_INFO_BACKGROUND));
    lineNumbers.setBackground(display.getSystemColor(SWT.COLOR_GRAY));
    // SWT.COLOR_INFO_FOREGROUND));
    lineNumbers.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
    lineNumbers.setFont(JFaceResources.getTextFont());
    ruler.addDecorator(0, lineNumbers);
    viewer = new SourceViewer(parent, ruler, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    viewer.getTextWidget().setFont(JFaceResources.getTextFont());
    SourceViewerConfiguration conf = new SourceViewerConfiguration();
    viewer.configure(conf);
    SLDTransformer trans = new SLDTransformer();
    trans.setIndentation(2);
    String xml;
    try {
        xml = trans.transform(getParent().getStyle());
    } catch (TransformerException e) {
        // $NON-NLS-1$
        xml = "Error: " + e.getMessage();
    }
    IDocument doc = new Document();
    doc.set(xml);
    doc.addDocumentListener(new IDocumentListener() {

        @Override
        public void documentChanged(DocumentEvent event) {
            changed = true;
        }

        @Override
        public void documentAboutToBeChanged(DocumentEvent event) {
        // ignore
        }
    });
    viewer.setInput(doc);
    setControl(viewer.getControl());
}
Also used : LineNumberRulerColumn(org.eclipse.jface.text.source.LineNumberRulerColumn) SourceViewer(org.eclipse.jface.text.source.SourceViewer) IDocumentListener(org.eclipse.jface.text.IDocumentListener) CompositeRuler(org.eclipse.jface.text.source.CompositeRuler) FillLayout(org.eclipse.swt.layout.FillLayout) Document(org.eclipse.jface.text.Document) IDocument(org.eclipse.jface.text.IDocument) DocumentEvent(org.eclipse.jface.text.DocumentEvent) SourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration) SLDTransformer(org.geotools.xml.styling.SLDTransformer) TransformerException(javax.xml.transform.TransformerException) IDocument(org.eclipse.jface.text.IDocument) Display(org.eclipse.swt.widgets.Display)

Aggregations

LineNumberRulerColumn (org.eclipse.jface.text.source.LineNumberRulerColumn)13 CompositeRuler (org.eclipse.jface.text.source.CompositeRuler)11 Display (org.eclipse.swt.widgets.Display)6 RGB (org.eclipse.swt.graphics.RGB)5 SourceViewer (org.eclipse.jface.text.source.SourceViewer)3 FillLayout (org.eclipse.swt.layout.FillLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 SQLDocument (com.cubrid.common.ui.query.editor.SQLDocument)2 SQLPartitionScanner (com.cubrid.common.ui.query.editor.SQLPartitionScanner)2 SQLTextViewer (com.cubrid.common.ui.query.editor.SQLTextViewer)2 SQLViewerConfiguration (com.cubrid.common.ui.query.editor.SQLViewerConfiguration)2 Document (org.eclipse.jface.text.Document)2 IDocument (org.eclipse.jface.text.IDocument)2 IDocumentPartitioner (org.eclipse.jface.text.IDocumentPartitioner)2 TextViewerUndoManager (org.eclipse.jface.text.TextViewerUndoManager)2 FastPartitioner (org.eclipse.jface.text.rules.FastPartitioner)2 AnnotationRulerColumn (org.eclipse.jface.text.source.AnnotationRulerColumn)2 ISharedTextColors (org.eclipse.jface.text.source.ISharedTextColors)2 SourceViewerConfiguration (org.eclipse.jface.text.source.SourceViewerConfiguration)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2