Examples of ITextSelection


Examples of org.eclipse.jface.text.ITextSelection

    return null;
  }

  public IRegion getSubject(ITextViewer textViewer, int offset) {
    if (textViewer.getSelectionProvider().getSelection() instanceof ITextSelection) {
      ITextSelection selection = (ITextSelection)textViewer.getSelectionProvider().getSelection();
      return new Region(selection.getOffset(),0);
    }
    return new Region(offset, 0);
  }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

    _findreplace = new FindReplaceDocumentAdapter(doc);
    IEditorPart editorPart = Plugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (editorPart != null && editorPart instanceof ITextEditor) {
      _editor = (ITextEditor) editorPart;
    }
    ITextSelection selection = ((ITextSelection) _editor.getEditorSite().getSelectionProvider().getSelection());
    _currentSelection = new Region(selection.getOffset(), selection.getLength());
   
   
   
  }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

 


  public void replace(String key) throws BadLocationException {
    ITextSelection selection = ((ITextSelection) _editor.getEditorSite().getSelectionProvider().getSelection());
    String tmlLabelTag = getRefactorString(key);
    _doc.replace(selection.getOffset(), selection.getLength(), tmlLabelTag);
    _editor.selectAndReveal(_currentSelection.getOffset(), tmlLabelTag.length())
   
  }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

   
  }


  public String getRefactorString(String key) throws BadLocationException {
    ITextSelection textSelection = ((ITextSelection) _editor.getEditorSite().getSelectionProvider().getSelection());
    ITypedRegion region = _doc.getPartition(textSelection.getOffset());

    String tmlLabelTag = "";

    if (region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) {
      // generats tmltag
      tmlLabelTag = "<tml:label";
      if (!_labelFileName.equals("general")) {
        tmlLabelTag += " file=\"" + _labelFileName + "\"";
      }
      tmlLabelTag += " key=\"" + key + "\"/>";
    }

    if (region.getType().equals(TMLPartitionScanner.TML_TAG_START)) {

      try {
        TMLRegion tmlRegion = TMLRegion.parse(region, _doc, textSelection.getOffset());

        if (tmlRegion.isCursorInAttributeValue()) {
          tmlLabelTag = "{label(\'" + key + "\')}";
        }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

    IEditorPart editorPart = Plugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (editorPart != null && editorPart instanceof ITextEditor) {
      ITextEditor editor = (ITextEditor) editorPart;
      ISelection selection = editor.getEditorSite().getSelectionProvider().getSelection();
      if (selection != null && selection instanceof ITextSelection) {
        ITextSelection textSelection = (ITextSelection) selection;
        IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
        if (doc != null) {
          if(textSelection.getLength()>0){
            new LabelingDialog(editor.getEditorSite().getShell(), textSelection, doc).open();
          }
        }
      }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

    IEditorPart editorPart = Plugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();   
    if (editorPart != null && editorPart instanceof ITextEditor) {
      ITextEditor editor = (ITextEditor) editorPart;
      ISelection selection = editor.getEditorSite().getSelectionProvider().getSelection();
      if (selection != null && selection instanceof ITextSelection) {
        ITextSelection textSelection = (ITextSelection)selection;
        IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
        if (doc != null) {
          try {
            _snippet.apply(doc, textSelection, editor);
          } catch (BadLocationException e) {
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

    IEditorPart editorPart = Plugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();   
    if (editorPart != null && editorPart instanceof AbstractWGATextEditor) {
      AbstractWGATextEditor editor = (AbstractWGATextEditor) editorPart;     
      ISelection selection = editor.getEditorSite().getSelectionProvider().getSelection();
      if (selection != null && selection instanceof ITextSelection) {
        ITextSelection textSelection = (ITextSelection)selection;
        IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
        if (doc != null) {
          try {
            ITypedRegion region = doc.getPartition(textSelection.getOffset());           
           
            // comment handling for TMLScriptEditor
            if (editorPart instanceof TMLScriptEditor) {
              if (region.getType().equals(TMLScriptPartitionScanner.MCOMMENT)) {
                removeTMLScriptComment(doc, region);
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

                if (editor.isDecompiled() != showBytecode) {

                    editor.doSetInput(true, !showBytecode);

                    if (selection instanceof ITextSelection) {
                        ITextSelection textSelection = (ITextSelection) selection;
                        textSelection = editor.convertSelection(
                            textSelection, showBytecode);
                        editor.getSelectionProvider().setSelection(
                            textSelection);
                    }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

                }

                editor.doSetInput(true, false);

                if (selection instanceof ITextSelection) {
                    ITextSelection textSelection = editor.convertLine(sourceLine);
                    if(textSelection != null) {
                        editor.getSelectionProvider().setSelection(textSelection);
                    }
                }
            }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

        if (editorReferences == null || editorReferences.length == 0) {
            deActivateView();
        } else if (checkNewSelection) {
            IEditorPart activeEditor = EclipseUtils.getActiveEditor();
            if (activeEditor instanceof ITextEditor) {
                ITextSelection selection = EclipseUtils
                    .getSelection(((ITextEditor) activeEditor)
                        .getSelectionProvider());
                handleSelectionChanged(activeEditor, selection);
            } else {
                deActivateView();
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.