Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.ITextViewer


  }
 
  @SuppressWarnings({ "rawtypes", "unchecked" })
  public static ITextViewer getTextViewer(IEditorPart editor) {
    Field svField;
    ITextViewer viewer = null;
   
    if (editor instanceof AbstractTextEditor) {
      try {
        svField = AbstractTextEditor.class.getDeclaredField("fSourceViewer");
        svField.setAccessible(true);
View Full Code Here


   
    Integer id = getEditorId(editor);
    if (!installedEditors.containsKey(id)) {
      // install key listener for Tab key
      try {
        ITextViewer textViewer = EclipseEmmetHelper.getTextViewer(editor);
        StyledText widget = textViewer.getTextWidget();
        widget.addVerifyKeyListener(getKeyListener(editor));
        installedEditors.put(id, editor);
      } catch (Exception e) {
        e.printStackTrace();
      }
View Full Code Here

     
      String[] tabGroups = tabStops.getSortedGroupKeys();
      TabStop firstTabStop = tabStops.getFirstTabStop();
     
      if (totalLinks > 1 || firstTabStop != null && firstTabStop.getStart() != firstTabStop.getEnd()) {
        ITextViewer viewer = EclipseEmmetHelper.getTextViewer(editor);
        LinkedModeModel model = new LinkedModeModel();
        int exitPos = -1;
       
        for (int i = 0; i < tabGroups.length; i++) {
          TabStopGroup tabGroup = tabStops.getTabStopGroup(tabGroups[i]);
View Full Code Here

      TargetPlatformGrammarAccess.TargetPlatformElements _targetPlatformAccess_1 = this.grammarAccess.getTargetPlatformAccess();
      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);
      if ((p instanceof ConfigurableCompletionProposal)) {
        int _replacementOffset = ((ConfigurableCompletionProposal)p).getReplacementOffset();
        int _length = proposalPrefix.length();
        int _plus_1 = (_replacementOffset + _length);
        ((ConfigurableCompletionProposal)p).setSelectionStart(_plus_1);
        int _length_1 = TargetPlatformProposalProvider.TARGET_PLATFORM__NAME_PLACEHOLDER.length();
        ((ConfigurableCompletionProposal)p).setSelectionLength(_length_1);
        ITextViewer _viewer_1 = context.getViewer();
        ((ConfigurableCompletionProposal)p).setSimpleLinkedMode(_viewer_1, '\t');
      }
      acceptor.accept(p);
    }
  }
View Full Code Here

      StringConcatenation _builder = new StringConcatenation();
      _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();
    _builder_2.append("\"");
    _builder_2.append(TargetPlatformProposalProvider.TARGET_PLATFORM__NAME_PLACEHOLDER, "");
    _builder_2.append("\"");
    StyledString _styledString = new StyledString(_builder_2.toString());
    StyledString _append = _styledString.append(" - name of the target", StyledString.QUALIFIER_STYLER);
    Image _image = this.getImage(TargetPlatformProposalProvider.TARGET_PLATFORM);
    final ICompletionProposal p = this.createCompletionProposal(textProposal, _append, _image, context);
    if ((p instanceof ConfigurableCompletionProposal)) {
      int _replacementOffset = ((ConfigurableCompletionProposal)p).getReplacementOffset();
      int _plus = (_replacementOffset + offset);
      ((ConfigurableCompletionProposal)p).setSelectionStart(_plus);
      int _length = TargetPlatformProposalProvider.TARGET_PLATFORM__NAME_PLACEHOLDER.length();
      ((ConfigurableCompletionProposal)p).setSelectionLength(_length);
      ITextViewer _viewer_2 = context.getViewer();
      ((ConfigurableCompletionProposal)p).setSimpleLinkedMode(_viewer_2, '\t');
    }
    acceptor.accept(p);
  }
View Full Code Here

    TargetPlatformGrammarAccess.LocationElements _locationAccess = this.grammarAccess.getLocationAccess();
    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);
    final ICompletionProposal p = this.createCompletionProposal(_plus_2, _append, _image, context);
    if ((p instanceof ConfigurableCompletionProposal)) {
      IContentProposalPriorities _priorityHelper = this.getPriorityHelper();
      int _defaultPriority = _priorityHelper.getDefaultPriority();
      int _plus_3 = (_defaultPriority + 540);
      ((ConfigurableCompletionProposal)p).setPriority(_plus_3);
      int _length = proposalText.length();
      int _length_1 = middleText.length();
      int _plus_4 = (_length + _length_1);
      ((ConfigurableCompletionProposal)p).setCursorPosition(_plus_4);
      int _replacementOffset = ((ConfigurableCompletionProposal)p).getReplacementOffset();
      int _length_2 = proposalPrefix.length();
      int _plus_5 = (_replacementOffset + _length_2);
      ((ConfigurableCompletionProposal)p).setSelectionStart(_plus_5);
      int _length_3 = TargetPlatformProposalProvider.LOCATION__URI_PLACEHOLDER.length();
      ((ConfigurableCompletionProposal)p).setSelectionLength(_length_3);
      ITextViewer _viewer_2 = context.getViewer();
      ((ConfigurableCompletionProposal)p).setSimpleLinkedMode(_viewer_2, '\t');
    }
    acceptor.accept(p);
  }
View Full Code Here

    TargetPlatformGrammarAccess.IncludeDeclarationElements _includeDeclarationAccess = this.grammarAccess.getIncludeDeclarationAccess();
    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);
    if ((p instanceof ConfigurableCompletionProposal)) {
      IContentProposalPriorities _priorityHelper = this.getPriorityHelper();
      int _defaultPriority = _priorityHelper.getDefaultPriority();
      int _plus_1 = (_defaultPriority + 530);
      ((ConfigurableCompletionProposal)p).setPriority(_plus_1);
      int _replacementOffset = ((ConfigurableCompletionProposal)p).getReplacementOffset();
      int _length = proposalPrefix.length();
      int _plus_2 = (_replacementOffset + _length);
      ((ConfigurableCompletionProposal)p).setSelectionStart(_plus_2);
      int _length_1 = TargetPlatformProposalProvider.INCLUDE_DECLARATION__URI_PLACEHOLDER.length();
      ((ConfigurableCompletionProposal)p).setSelectionLength(_length_1);
      ITextViewer _viewer_1 = context.getViewer();
      ((ConfigurableCompletionProposal)p).setSimpleLinkedMode(_viewer_1, '\t');
    }
    acceptor.accept(p);
  }
View Full Code Here

    }
  }
 
  public void completeIU_Version(final EObject model, final Assignment assignment, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) {
    try {
      ITextViewer _viewer = context.getViewer();
      IDocument _document = _viewer.getDocument();
      final String docText = _document.get();
      final int offset = context.getOffset();
      String _xifexpression = null;
      int _length = docText.length();
      boolean _greaterEqualsThan = (_length >= 1);
View Full Code Here

      throw Exceptions.sneakyThrow(_e);
    }
  }
 
  public void completeLocation_ID(final EObject model, final Assignment assignment, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) {
    ITextViewer _viewer = context.getViewer();
    IDocument _document = _viewer.getDocument();
    final String docText = _document.get();
    final int offset = context.getOffset();
    String _xifexpression = null;
    int _length = docText.length();
    boolean _greaterEqualsThan = (_length >= 1);
    if (_greaterEqualsThan) {
      _xifexpression = docText.substring((offset - 1), offset);
    } else {
      _xifexpression = "";
    }
    final String charBefore = _xifexpression;
    String _xifexpression_1 = null;
    int _length_1 = docText.length();
    boolean _greaterThan = (_length_1 > offset);
    if (_greaterThan) {
      _xifexpression_1 = docText.substring(offset, (offset + 1));
    } else {
      _xifexpression_1 = "";
    }
    final String charAfter = _xifexpression_1;
    String _xifexpression_2 = null;
    boolean _and = false;
    boolean _equals = charBefore.equals(" ");
    boolean _not = (!_equals);
    if (!_not) {
      _and = false;
    } else {
      boolean _equals_1 = charBefore.equals("\n");
      boolean _not_1 = (!_equals_1);
      _and = _not_1;
    }
    if (_and) {
      _xifexpression_2 = " ";
    } else {
      _xifexpression_2 = "";
    }
    final String prefix = _xifexpression_2;
    String _xifexpression_3 = null;
    boolean _equals_2 = charAfter.equals(" ");
    boolean _not_2 = (!_equals_2);
    if (_not_2) {
      _xifexpression_3 = " ";
    } else {
      _xifexpression_3 = "";
    }
    final String suffix = _xifexpression_3;
    final String proposal = ((prefix + TargetPlatformProposalProvider.LOCATION__ID_PLACEHOLDER) + suffix);
    StyledString _styledString = new StyledString(TargetPlatformProposalProvider.LOCATION__ID_PLACEHOLDER);
    StyledString _append = _styledString.append(" - ID of this location ", StyledString.QUALIFIER_STYLER);
    Image _image = this.getImage(TargetPlatformProposalProvider.LOCATION);
    final ICompletionProposal p = this.createCompletionProposal(proposal, _append, _image, context);
    if ((p instanceof ConfigurableCompletionProposal)) {
      int _replacementOffset = ((ConfigurableCompletionProposal)p).getReplacementOffset();
      int _length_2 = prefix.length();
      int _plus = (_replacementOffset + _length_2);
      ((ConfigurableCompletionProposal)p).setSelectionStart(_plus);
      int _length_3 = TargetPlatformProposalProvider.LOCATION__ID_PLACEHOLDER.length();
      ((ConfigurableCompletionProposal)p).setSelectionLength(_length_3);
      ITextViewer _viewer_1 = context.getViewer();
      ((ConfigurableCompletionProposal)p).setSimpleLinkedMode(_viewer_1, '\t');
    }
    acceptor.accept(p);
  }
View Full Code Here

    }
    acceptor.accept(p);
  }
 
  public void completeLocation_Uri(final EObject model, final Assignment assignment, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) {
    ITextViewer _viewer = context.getViewer();
    IDocument _document = _viewer.getDocument();
    final String docText = _document.get();
    final int offset = context.getOffset();
    String _xifexpression = null;
    int _length = docText.length();
    boolean _greaterEqualsThan = (_length >= 1);
    if (_greaterEqualsThan) {
      _xifexpression = docText.substring((offset - 1), offset);
    } else {
      _xifexpression = "";
    }
    final String charBefore = _xifexpression;
    String _xifexpression_1 = null;
    int _length_1 = docText.length();
    boolean _greaterThan = (_length_1 > offset);
    if (_greaterThan) {
      _xifexpression_1 = docText.substring(offset, (offset + 1));
    } else {
      _xifexpression_1 = "";
    }
    final String charAfter = _xifexpression_1;
    String _xifexpression_2 = null;
    boolean _and = false;
    boolean _equals = charBefore.equals(" ");
    boolean _not = (!_equals);
    if (!_not) {
      _and = false;
    } else {
      boolean _equals_1 = charBefore.equals("\n");
      boolean _not_1 = (!_equals_1);
      _and = _not_1;
    }
    if (_and) {
      _xifexpression_2 = " \"";
    } else {
      _xifexpression_2 = "\"";
    }
    final String prefix = _xifexpression_2;
    String _xifexpression_3 = null;
    boolean _equals_2 = charAfter.equals(" ");
    boolean _not_2 = (!_equals_2);
    if (_not_2) {
      _xifexpression_3 = "\" ";
    } else {
      _xifexpression_3 = "\"";
    }
    final String suffix = _xifexpression_3;
    final String proposal = ((prefix + TargetPlatformProposalProvider.LOCATION__URI_PLACEHOLDER) + suffix);
    StyledString _styledString = new StyledString(TargetPlatformProposalProvider.LOCATION__URI_PLACEHOLDER);
    StyledString _append = _styledString.append(" - URI of the location", StyledString.QUALIFIER_STYLER);
    Image _image = this.getImage(TargetPlatformProposalProvider.LOCATION);
    final ICompletionProposal p = this.createCompletionProposal(proposal, _append, _image, context);
    if ((p instanceof ConfigurableCompletionProposal)) {
      int _replacementOffset = ((ConfigurableCompletionProposal)p).getReplacementOffset();
      int _length_2 = prefix.length();
      int _plus = (_replacementOffset + _length_2);
      ((ConfigurableCompletionProposal)p).setSelectionStart(_plus);
      int _length_3 = TargetPlatformProposalProvider.LOCATION__URI_PLACEHOLDER.length();
      ((ConfigurableCompletionProposal)p).setSelectionLength(_length_3);
      ITextViewer _viewer_1 = context.getViewer();
      ((ConfigurableCompletionProposal)p).setSimpleLinkedMode(_viewer_1, '\t');
    }
    acceptor.accept(p);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.ITextViewer

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.