Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.IDocument.replace()


          }
          // replaced
        }
        else if (delta instanceof ChangeDelta) {
          while (count1 != orgRange.getTo()) {
            doc.replace(index, text1[count1].length() + 1, "");
            count1++;
          }
          while (count2 != revRange.getTo()) {
            doc.replace(index, 0, text2[count2] + "\n");
            index = index + text2[count2].length() + 1;
View Full Code Here


          while (count1 != orgRange.getTo()) {
            doc.replace(index, text1[count1].length() + 1, "");
            count1++;
          }
          while (count2 != revRange.getTo()) {
            doc.replace(index, 0, text2[count2] + "\n");
            index = index + text2[count2].length() + 1;
            count2++;
          }
        }
        count1 = orgRange.getTo();
View Full Code Here

    @Override
    public void run() {
      ITextSelection sel = (ITextSelection) getSelectionProvider().getSelection();
      IDocument doc = getDocumentProvider().getDocument(getEditorInput());
      try {
        doc.replace(sel.getOffset(), sel.getLength(), HTMLUtil.escapeHTML(sel.getText()));
      }
      catch (BadLocationException e) {
        HTMLPlugin.logException(e);
      }
    }
View Full Code Here

      String text = sel.getText().trim();
      try {
        if (text.startsWith("<!--") && text.indexOf("-->") > 3) {
          text = sel.getText().replaceFirst("<!--", "");
          text = text.replaceFirst("-->", "");
          doc.replace(sel.getOffset(), sel.getLength(), text);
        }
        else {
          doc.replace(sel.getOffset(), sel.getLength(), "<!--" + sel.getText() + "-->");
        }
      }
View Full Code Here

          text = sel.getText().replaceFirst("<!--", "");
          text = text.replaceFirst("-->", "");
          doc.replace(sel.getOffset(), sel.getLength(), text);
        }
        else {
          doc.replace(sel.getOffset(), sel.getLength(), "<!--" + sel.getText() + "-->");
        }
      }
      catch (BadLocationException e) {
        HTMLPlugin.logException(e);
      }
View Full Code Here

      IDocument doc = getDocumentProvider().getDocument(getEditorInput());
      String text = sel.getText().trim();
      try {
        if(text.startsWith("<%--") && text.endsWith("--%>")){
          text = sel.getText().replaceAll("<%--|--%>", "");
          doc.replace(sel.getOffset(),sel.getLength(),text);
        } else {
          doc.replace(sel.getOffset(),sel.getLength(),"<%--" + sel.getText() + "--%>");
        }
      } catch (BadLocationException e) {
        HTMLPlugin.logException(e);
View Full Code Here

      try {
        if(text.startsWith("<%--") && text.endsWith("--%>")){
          text = sel.getText().replaceAll("<%--|--%>", "");
          doc.replace(sel.getOffset(),sel.getLength(),text);
        } else {
          doc.replace(sel.getOffset(),sel.getLength(),"<%--" + sel.getText() + "--%>");
        }
      } catch (BadLocationException e) {
        HTMLPlugin.logException(e);
      }
    }
View Full Code Here

    @Override
    public void run() {
      ITextSelection sel = (ITextSelection)getSelectionProvider().getSelection();
      IDocument doc = getDocumentProvider().getDocument(getEditorInput());
      try {
        doc.replace(sel.getOffset(),sel.getLength(),HTMLUtil.escapeXML(sel.getText()));
      } catch (BadLocationException e) {
        HTMLPlugin.logException(e);
      }
    }
  }
View Full Code Here

    RGB color = dialog.open();
    if(color!=null){
      IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
      ITextSelection sel = (ITextSelection)editor.getSelectionProvider().getSelection();
      try {
        doc.replace(sel.getOffset(), 0, HTMLUtil.toHex(color));
      } catch(Exception ex){
        HTMLPlugin.logException(ex);
      }
    }
  }
View Full Code Here

                  return;
                } else if (c2 == LexicalConstants.LF) {
                  break;
                }
              }
              document.replace(offset, 0, String.valueOf(endChar));
            }
          } else {
            document.replace(offset, 0, String.valueOf(endChar));
          }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.