Package org.eclipse.swt.custom

Examples of org.eclipse.swt.custom.StyledText


     
      String errorMessage = e.getMessage();
     
      try{
 
        StyledText canvas = wText.getStyledText();
       
        // try to parse the error message
        Matcher m = pErrorMessage.matcher(errorMessage)
       
        if (m.find()){
          String errorSummary = "Error: "+m.group(1).trim();
          canvas.setData("lastErrorMessage",errorSummary);
          wlSyntaxCheck.setText(errorSummary);
          wlSyntaxCheck.setToolTipText(wlSyntaxCheck.getText());
        }
       
        // try to parse the error line
        m = pErrorLine.matcher(errorMessage)
 
        int errorLine = 0;
        int errorCol = 0;
        if (m.find()){
          errorLine = Integer.valueOf(m.group(1))-1;
          canvas.setData("lastErrorLine", errorLine);
          canvas.setLineBackground(errorLine, 1, errorLineColor);
        }
       
        // try to parse the actual error char
        m = pErrorChar.matcher(errorMessage);
       
        if (m.find()){
          errorCol = m.group(1).length();
          canvas.setSelection(canvas.getOffsetAtLine(errorLine)+errorCol);
        }
       
      }
      catch(Exception ex){
        //ex.printStackTrace();
View Full Code Here


      wlSyntaxCheck.setToolTipText(null);
    }
   
    Integer lastErrorLine = (Integer) wText.getStyledText().getData("lastErrorLine");
    if (lastErrorLine != null){
      StyledText canvas = wText.getStyledText();
      canvas.setLineBackground(lastErrorLine, 1, normalLineColor);
      canvas.setData("lastErrorLine", null);
      canvas.setData("lastErrorMessage", null);
     
    }   
   
  }
View Full Code Here

    }   
   
  }

  public void updateErrorToolTip(StyledTextComp wText, int x, int y) {
    StyledText canvas = wText.getStyledText();
    String errorText = (String)canvas.getData("lastErrorMessage");
   
    // if there's no errors, bail out
    if (errorText == null){
      canvas.setToolTipText(null);
      return;
    }

    // shield against SWT anomalies
    try{
      // if there are errors, see if the user hovers over the error line
      int line = canvas.getLineAtOffset(canvas.getOffsetAtLocation(new Point(1,y)));
 
      if (line == (Integer) canvas.getData("lastErrorLine")){
        canvas.setToolTipText(errorText);
        return;
      }
     
    }
    catch(IllegalArgumentException e){
     
    }
    // in case something went wrong or the line was not correct, no tooltip
    canvas.setToolTipText(null);
   
   
  }
View Full Code Here

      Keyword _targetKeyword_0_1 = _targetPlatformAccess_1.getTargetKeyword_0();
      String _value = _targetKeyword_0_1.getValue();
      final String proposalPrefix = (_value + " \"");
      final String proposalText = ((proposalPrefix + TargetPlatformProposalProvider.TARGET_PLATFORM__NAME_PLACEHOLDER) + "\"");
      ITextViewer _viewer = context.getViewer();
      StyledText _textWidget = _viewer.getTextWidget();
      String _lineDelimiter = _textWidget.getLineDelimiter();
      String _plus = (proposalText + _lineDelimiter);
      StyledString _styledString = new StyledString(proposalText);
      StyledString _append = _styledString.append(" - create a new target platform", StyledString.QUALIFIER_STYLER);
      Image _image = this.getImage(TargetPlatformProposalProvider.TARGET_PLATFORM);
      final ICompletionProposal p = this.createCompletionProposal(_plus, _append, _image, context);
View Full Code Here

      _builder.append(" ");
      _builder.append("\"");
      _builder.append(TargetPlatformProposalProvider.TARGET_PLATFORM__NAME_PLACEHOLDER, " ");
      _builder.append("\"");
      ITextViewer _viewer = context.getViewer();
      StyledText _textWidget = _viewer.getTextWidget();
      String _lineDelimiter = _textWidget.getLineDelimiter();
      _builder.append(_lineDelimiter, " ");
      textProposal = _builder.toString();
      offset = 2;
    } else {
      StringConcatenation _builder_1 = new StringConcatenation();
      _builder_1.append("\"");
      _builder_1.append(TargetPlatformProposalProvider.TARGET_PLATFORM__NAME_PLACEHOLDER, "");
      _builder_1.append("\"");
      ITextViewer _viewer_1 = context.getViewer();
      StyledText _textWidget_1 = _viewer_1.getTextWidget();
      String _lineDelimiter_1 = _textWidget_1.getLineDelimiter();
      _builder_1.append(_lineDelimiter_1, "");
      textProposal = _builder_1.toString();
      offset = 1;
    }
    StringConcatenation _builder_2 = new StringConcatenation();
View Full Code Here

    Keyword _locationKeyword_0 = _locationAccess.getLocationKeyword_0();
    String _value = _locationKeyword_0.getValue();
    final String proposalPrefix = (_value + " \"");
    final String proposalText = ((proposalPrefix + TargetPlatformProposalProvider.LOCATION__URI_PLACEHOLDER) + "\"");
    ITextViewer _viewer = context.getViewer();
    StyledText _textWidget = _viewer.getTextWidget();
    String _lineDelimiter = _textWidget.getLineDelimiter();
    String _plus = (" {" + _lineDelimiter);
    final String middleText = (_plus + "\t");
    ITextViewer _viewer_1 = context.getViewer();
    StyledText _textWidget_1 = _viewer_1.getTextWidget();
    String _lineDelimiter_1 = _textWidget_1.getLineDelimiter();
    String _plus_1 = ((proposalText + middleText) + _lineDelimiter_1);
    String _plus_2 = (_plus_1 + "}");
    StyledString _styledString = new StyledString(proposalText);
    StyledString _append = _styledString.append(" - add a new location to this target platform", StyledString.QUALIFIER_STYLER);
    Image _image = this.getImage(TargetPlatformProposalProvider.LOCATION);
View Full Code Here

    Keyword _includeKeyword_0 = _includeDeclarationAccess.getIncludeKeyword_0();
    String _value = _includeKeyword_0.getValue();
    final String proposalPrefix = (_value + " \"");
    final String proposalText = ((proposalPrefix + TargetPlatformProposalProvider.INCLUDE_DECLARATION__URI_PLACEHOLDER) + "\"");
    ITextViewer _viewer = context.getViewer();
    StyledText _textWidget = _viewer.getTextWidget();
    String _lineDelimiter = _textWidget.getLineDelimiter();
    String _plus = (proposalText + _lineDelimiter);
    StyledString _styledString = new StyledString(proposalText);
    StyledString _append = _styledString.append(" - include another target platform to this file", StyledString.QUALIFIER_STYLER);
    Image _image = this.getImage(TargetPlatformProposalProvider.INCLUDE_DECLARATION);
    final ICompletionProposal p = this.createCompletionProposal(_plus, _append, _image, context);
View Full Code Here

   
    fPreviewViewer = new PHPStructuredTextViewer(composite, null, null, false, SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP);
    fPreviewViewer.setDocument(new Document());
    //fPreviewViewer.adaptBackgroundColor(composite);
   
    StyledText textWidget = fPreviewViewer.getTextWidget();
   
    textWidget.setAlwaysShowScrollBars(false);
   
    GridData gdata= new GridData(GridData.FILL_BOTH);
    gdata.widthHint= new PixelConverter(textWidget).convertWidthInCharsToPixels(50);
    gdata.heightHint= textWidget.getLineHeight() * 2;
    gdata.horizontalSpan=2;
    textWidget.setLayoutData(gdata);
   
    textWidget.setBackground(composite.getBackground());   
  }
 
View Full Code Here

    multilineCheckBox.setLayoutData(data);

    //RegExp
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 4;
    regExpText = new StyledText(panel, SWT.BORDER);
    regExpText.setLayoutData(data);
    regExpText.addFocusListener(new focusListener());

    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 4;
    Label matchTextLabel = new Label(panel, SWT.NONE);
    matchTextLabel.setText("Match text:");
    matchTextLabel.setLayoutData(data);

    //Match text
    data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
    data.horizontalSpan = 4;
    matchText = new StyledText(panel, SWT.BORDER | SWT.H_SCROLL
        | SWT.V_SCROLL);
    matchText.setLayoutData(data);
    matchText.addFocusListener(new focusListener());

    //set the actions for the global action handler
View Full Code Here

            final ISourceViewer sourceViewer = editor.getViewer();
            if (sourceViewer == null) {
                return;
            }

            final StyledText text = sourceViewer.getTextWidget();
            if (text == null || text.isDisposed()) {
                return;
            }

            sourceViewer.addTextInputListener(this);
View Full Code Here

TOP

Related Classes of org.eclipse.swt.custom.StyledText

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.