Java 类org.eclipse.swt.custom.StyledTextContent 实例源码

项目:kawa-mirror    文件:SwtHelper.java   
/**
 * Creates a StyledText instance with a given content, and an SwtWindow
 * which will be installed as
 * VerifyKeylistener, FocusListener, KeyListener and Mouselistener
 */
public static StyledText newStyledText(final Composite parent, 
                                       final int style, 
                                       final StyledTextContent styledTextContent, 
                                       final SwtWindow swtWindow, 
                                       final int firstVisibleLine)
{
  if (Thread.currentThread() != getDisplay().getThread())
  {
    Resultable res = new Resultable() {public void run() {result = newStyledText(parent, style, styledTextContent, swtWindow, firstVisibleLine);}};
    getDisplay().syncExec(res);
    return (StyledText) res.result;
  }
  else {
    StyledText styledText = new StyledText(parent,  style);
    styledText.setContent(styledTextContent);
    styledText.setTopIndex(firstVisibleLine);
    styledText.addVerifyKeyListener(swtWindow);
    styledText.addFocusListener(swtWindow);
    styledText.addKeyListener(swtWindow);
    styledText.addMouseListener(swtWindow);
    return styledText;
  }
}
项目:kawa-mirror    文件:SwtWindowWidget.java   
public SwtWindowWidget(Composite parent, 
                       StyledTextContent styledTextContent, 
                       int firstVisibleLine)
{
 super(parent, 0);

 setBackground(new Color(getDisplay(), 0, 0, 0));
 GridLayout layout = new GridLayout();
 layout.numColumns = 1;
 layout.horizontalSpacing = layout.verticalSpacing = 2;
 layout.marginWidth = layout.marginHeight = 2;
 setLayout(layout);

 styledText = new StyledText(this,  SWT.H_SCROLL | SWT.V_SCROLL);
 styledText.setContent(styledTextContent);
 styledText.setTopIndex(firstVisibleLine);
 styledText.setLayoutData(new GridData(GridData.FILL_BOTH));

 modeline = new StyledText(this, SWT.SINGLE | SWT.READ_ONLY);
 modeline.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
项目:WAM    文件:GUI.java   
/**
 * Shows the texts in the GUI from the current cursor position. 
 */
public void showTexts(){
    for(int i = 0; i < 7; i++){
        StyledTextContent field = null;
        switch(i){
        case CODE: field = gui.getCodeText(); break;
        case HEAP: field = gui.getHeapText(); break;
        case TRAIL: field = gui.getTrailText(); break;
        case RUNTIMEVARS: field = gui.getRuntimeVariablesText(); break;
        case TRACE: field = gui.getTraceText(); break;
        case STACK: field = gui.getStackText(); break;
        case REGISTERS: field = gui.getRegistersText(); break;
        } 
        field.setText(data[i].get(cursor)); 
    }
}
项目:kawa-fork    文件:SwtHelper.java   
/**
 * Creates a StyledText instance with a given content, and an SwtWindow
 * which will be installed as
 * VerifyKeylistener, FocusListener, KeyListener and Mouselistener
 */
public static StyledText newStyledText(final Composite parent, 
                                       final int style, 
                                       final StyledTextContent styledTextContent, 
                                       final SwtWindow swtWindow, 
                                       final int firstVisibleLine)
{
  if (Thread.currentThread() != getDisplay().getThread())
  {
    Resultable res = new Resultable() {public void run() {result = newStyledText(parent, style, styledTextContent, swtWindow, firstVisibleLine);}};
    getDisplay().syncExec(res);
    return (StyledText) res.result;
  }
  else {
    StyledText styledText = new StyledText(parent,  style);
    styledText.setContent(styledTextContent);
    styledText.setTopIndex(firstVisibleLine);
    styledText.addVerifyKeyListener(swtWindow);
    styledText.addFocusListener(swtWindow);
    styledText.addKeyListener(swtWindow);
    styledText.addMouseListener(swtWindow);
    return styledText;
  }
}
项目:kawa-fork    文件:SwtWindowWidget.java   
public SwtWindowWidget(Composite parent, 
                       StyledTextContent styledTextContent, 
                       int firstVisibleLine)
{
 super(parent, 0);

 setBackground(new Color(getDisplay(), 0, 0, 0));
 GridLayout layout = new GridLayout();
 layout.numColumns = 1;
 layout.horizontalSpacing = layout.verticalSpacing = 2;
 layout.marginWidth = layout.marginHeight = 2;
 setLayout(layout);

 styledText = new StyledText(this,  SWT.H_SCROLL | SWT.V_SCROLL);
 styledText.setContent(styledTextContent);
 styledText.setTopIndex(firstVisibleLine);
 styledText.setLayoutData(new GridData(GridData.FILL_BOTH));

 modeline = new StyledText(this, SWT.SINGLE | SWT.READ_ONLY);
 modeline.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
项目:ai2-kawa    文件:SwtHelper.java   
/**
 * Creates a StyledText instance with a given content, and an SwtWindow
 * which will be installed as
 * VerifyKeylistener, FocusListener, KeyListener and Mouselistener
 */
public static StyledText newStyledText(final Composite parent, 
                                       final int style, 
                                       final StyledTextContent styledTextContent, 
                                       final SwtWindow swtWindow, 
                                       final int firstVisibleLine)
{
  if (Thread.currentThread() != getDisplay().getThread())
  {
    Resultable res = new Resultable() {public void run() {result = newStyledText(parent, style, styledTextContent, swtWindow, firstVisibleLine);}};
    getDisplay().syncExec(res);
    return (StyledText) res.result;
  }
  else {
    StyledText styledText = new StyledText(parent,  style);
    styledText.setContent(styledTextContent);
    styledText.setTopIndex(firstVisibleLine);
    styledText.addVerifyKeyListener(swtWindow);
    styledText.addFocusListener(swtWindow);
    styledText.addKeyListener(swtWindow);
    styledText.addMouseListener(swtWindow);
    return styledText;
  }
}
项目:ai2-kawa    文件:SwtWindowWidget.java   
public SwtWindowWidget(Composite parent, 
                       StyledTextContent styledTextContent, 
                       int firstVisibleLine)
{
 super(parent, 0);

 setBackground(new Color(getDisplay(), 0, 0, 0));
 GridLayout layout = new GridLayout();
 layout.numColumns = 1;
 layout.horizontalSpacing = layout.verticalSpacing = 2;
 layout.marginWidth = layout.marginHeight = 2;
 setLayout(layout);

 styledText = new StyledText(this,  SWT.H_SCROLL | SWT.V_SCROLL);
 styledText.setContent(styledTextContent);
 styledText.setTopIndex(firstVisibleLine);
 styledText.setLayoutData(new GridData(GridData.FILL_BOTH));

 modeline = new StyledText(this, SWT.SINGLE | SWT.READ_ONLY);
 modeline.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
项目:kawa    文件:SwtHelper.java   
/**
 * Creates a StyledText instance with a given content, and an SwtWindow
 * which will be installed as
 * VerifyKeylistener, FocusListener, KeyListener and Mouselistener
 */
public static StyledText newStyledText(final Composite parent, 
                                       final int style, 
                                       final StyledTextContent styledTextContent, 
                                       final SwtWindow swtWindow, 
                                       final int firstVisibleLine)
{
  if (Thread.currentThread() != getDisplay().getThread())
  {
    Resultable res = new Resultable() {public void run() {result = newStyledText(parent, style, styledTextContent, swtWindow, firstVisibleLine);}};
    getDisplay().syncExec(res);
    return (StyledText) res.result;
  }
  else {
    StyledText styledText = new StyledText(parent,  style);
    styledText.setContent(styledTextContent);
    styledText.setTopIndex(firstVisibleLine);
    styledText.addVerifyKeyListener(swtWindow);
    styledText.addFocusListener(swtWindow);
    styledText.addKeyListener(swtWindow);
    styledText.addMouseListener(swtWindow);
    return styledText;
  }
}
项目:kawa    文件:SwtWindowWidget.java   
public SwtWindowWidget(Composite parent, 
                       StyledTextContent styledTextContent, 
                       int firstVisibleLine)
{
 super(parent, 0);

 setBackground(new Color(getDisplay(), 0, 0, 0));
 GridLayout layout = new GridLayout();
 layout.numColumns = 1;
 layout.horizontalSpacing = layout.verticalSpacing = 2;
 layout.marginWidth = layout.marginHeight = 2;
 setLayout(layout);

 styledText = new StyledText(this,  SWT.H_SCROLL | SWT.V_SCROLL);
 styledText.setContent(styledTextContent);
 styledText.setTopIndex(firstVisibleLine);
 styledText.setLayoutData(new GridData(GridData.FILL_BOTH));

 modeline = new StyledText(this, SWT.SINGLE | SWT.READ_ONLY);
 modeline.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
项目:codelens-eclipse    文件:StyledTextPatcher.java   
private static Method getSetContentMethod(Object styledTextRenderer) throws NoSuchMethodException {
    // if (SET_CONTENT_METHOD == null) {
    Method SET_CONTENT_METHOD = styledTextRenderer.getClass().getDeclaredMethod("setContent",
            new Class[] { StyledTextContent.class });
    SET_CONTENT_METHOD.setAccessible(true);
    // }
    return SET_CONTENT_METHOD;
}
项目:kawa-mirror    文件:SwtHelper.java   
public static void setContent(final StyledText styledText, final StyledTextContent bufferContent)
{
  if (Thread.currentThread() != getDisplay().getThread())
  {
    Runnable run = new Resultable() {public void run() {setContent (styledText, bufferContent);}}; 
    getDisplay().syncExec(run);
  }
  else
  {
    styledText.setContent(bufferContent);
  }

}
项目:kawa-fork    文件:SwtHelper.java   
public static void setContent(final StyledText styledText, final StyledTextContent bufferContent)
{
  if (Thread.currentThread() != getDisplay().getThread())
  {
    Runnable run = new Resultable() {public void run() {setContent (styledText, bufferContent);}}; 
    getDisplay().syncExec(run);
  }
  else
  {
    styledText.setContent(bufferContent);
  }

}
项目:ai2-kawa    文件:SwtHelper.java   
public static void setContent(final StyledText styledText, final StyledTextContent bufferContent)
{
  if (Thread.currentThread() != getDisplay().getThread())
  {
    Runnable run = new Resultable() {public void run() {setContent (styledText, bufferContent);}}; 
    getDisplay().syncExec(run);
  }
  else
  {
    styledText.setContent(bufferContent);
  }

}
项目:kawa    文件:SwtHelper.java   
public static void setContent(final StyledText styledText, final StyledTextContent bufferContent)
{
  if (Thread.currentThread() != getDisplay().getThread())
  {
    Runnable run = new Resultable() {public void run() {setContent (styledText, bufferContent);}}; 
    getDisplay().syncExec(run);
  }
  else
  {
    styledText.setContent(bufferContent);
  }

}
项目:Pydev    文件:VerticalIndentGuidesPainter.java   
private boolean getStyledTextContentChangedAndStoreNew() {
    StyledTextContent currentContent = this.styledText.getContent();
    StyledTextContent oldContent = this.content;
    if (currentContent != oldContent) {
        //Important: the content may change during runtime, so, we have to stop listening the old one and
        //start listening the new one.
        if (oldContent != null) {
            oldContent.removeTextChangeListener(this);
        }
        this.content = currentContent;
        currentContent.addTextChangeListener(this);
        return true;
    }
    return false;
}
项目:kawa-mirror    文件:SwtBuffer.java   
public StyledTextContent getBufferContent()
{
  return bufferContent;
}
项目:Black    文件:textFile.java   
public void setTextContent(StyledTextContent textContent)
{
    this.textContent = textContent;
}
项目:Black    文件:textFile.java   
public StyledTextContent getTextContent()
{
    return textContent;
}
项目:WAM    文件:GUIWindow.java   
public StyledTextContent getCodeText() {
    return styledText_5.getContent();
}
项目:WAM    文件:GUIWindow.java   
public StyledTextContent getStackText() {
    return styledText_3.getContent();
}
项目:WAM    文件:GUIWindow.java   
public StyledTextContent getTraceText() {
    return styledText_6.getContent();
}
项目:WAM    文件:GUIWindow.java   
public StyledTextContent getTrailText() {
    return styledText_4.getContent();
}
项目:WAM    文件:GUIWindow.java   
public StyledTextContent getRuntimeVariablesText() {
    return styledText.getContent();
}
项目:WAM    文件:GUIWindow.java   
public StyledTextContent getRegistersText() {
    return styledText_1.getContent();
}
项目:WAM    文件:GUIWindow.java   
public StyledTextContent getHeapText() {
    return styledText_2.getContent();
}
项目:kawa-fork    文件:SwtBuffer.java   
public StyledTextContent getBufferContent()
{
  return bufferContent;
}
项目:ai2-kawa    文件:SwtBuffer.java   
public StyledTextContent getBufferContent()
{
  return bufferContent;
}
项目:kawa    文件:SwtBuffer.java   
public StyledTextContent getBufferContent()
{
  return bufferContent;
}
项目:IndentGuide    文件:IndentGuidePainter.java   
/**
 * Draw the given line range.
 * 
 * @param gc
 *            the GC
 * @param startLine
 *            first line number
 * @param endLine
 *            last line number (inclusive)
 * @param x
 *            the X-coordinate of the drawing range
 * @param w
 *            the width of the drawing range
 */
private void drawLineRange(GC gc, int startLine, int endLine, int x, int w) {
    int tabs = fTextWidget.getTabs();

    StyledTextContent content = fTextWidget.getContent();
    for (int line = startLine; line <= endLine; line++) {
        int widgetOffset = fTextWidget.getOffsetAtLine(line);
        if (!isFoldedLine(content.getLineAtOffset(widgetOffset))) {
            String text = fTextWidget.getLine(line);
            int extend = 0;
            if (skipCommentBlock && assumeCommentBlock(text, tabs)) {
                extend -= tabs;
            }
            if (drawBlankLine && text.trim().length() == 0) {
                int prevLine = line;
                while (--prevLine >= 0) {
                    text = fTextWidget.getLine(prevLine);
                    if (text.trim().length() > 0) {
                        int postLine = line;
                        int lineCount = fTextWidget.getLineCount();
                        while (++postLine < lineCount) {
                            String tmp = fTextWidget.getLine(postLine);
                            if (tmp.trim().length() > 0) {
                                if (countSpaces(text, tabs) < countSpaces(
                                        tmp, tabs)) {
                                    extend += tabs;
                                }
                                break;
                            }
                        }
                        break;
                    }
                }
            }
            int count = countSpaces(text, tabs) + extend;
            for (int i = drawLeftEnd ? 0 : tabs; i < count; i += tabs) {
                draw(gc, widgetOffset, i);
            }
        }
    }
}
项目:relations    文件:TextStyler.java   
private Point selectWord(final int inPosition) {
    final StyledTextContent lContent = widget.getContent();
    final int lLineIndex = lContent.getLineAtOffset(inPosition);
    return selectWord(inPosition, lContent.getOffsetAtLine(lLineIndex),
            lContent.getLine(lLineIndex).toCharArray());
}