Package org.eclipse.ui.texteditor

Examples of org.eclipse.ui.texteditor.ITextEditor.selectAndReveal()


            final IDocument document = ((textEditor).getDocumentProvider()).getDocument(textEditor.getEditorInput());
            final FindReplaceDocumentAdapter frda = new FindReplaceDocumentAdapter(document);
            final IRegion region = frda.find(0, '"' + wicketId + '"', true, true, false, false);
            if (region != null)
            {
              textEditor.selectAndReveal(region.getOffset() + 1, wicketId.length());
              wEditor.setActiveEditor(wEditor.getJavaEditor());
            }
          }
          else if ("html".equals(extension))
          {
View Full Code Here


            final IDocument document = ((textEditor).getDocumentProvider()).getDocument(textEditor.getEditorInput());
            final FindReplaceDocumentAdapter frda = new FindReplaceDocumentAdapter(document);
            final IRegion region = frda.find(0, "wicket:id=\"" + wicketId, true, true, true, false);
            if (region != null)
            {
              textEditor.selectAndReveal(region.getOffset() + 11, wicketId.length());
              wEditor.setActiveEditor(wEditor.getHtmlEditor());
            }
          }
          else if ("properties".equals(extension) && propertiesEditor != null)
          {
View Full Code Here

              regionBegin = frda.find(regionBegin.getOffset(), "=", true, true, false, false);
              if (regionBegin != null)
              {
                final IRegion lineRegion = document.getLineInformationOfOffset(regionBegin.getOffset());
                final int selectionLength = lineRegion.getOffset() + lineRegion.getLength() - regionBegin.getOffset();
                textEditor.selectAndReveal(regionBegin.getOffset() + 1, selectionLength);
                wEditor.setActiveEditor(propertiesEditor);
              }
            }
          }
        } catch (final BadLocationException e) {
View Full Code Here

  private void openInEditor(TestCaseFinder.TestCaseFinderResult result, IWorkbenchPage workbenchPage) {
    try {
      IEditorPart editor = getAndOpenEditor(result.getFile(), workbenchPage);
      if (editor instanceof ITextEditor) {
        ITextEditor textEditor = (ITextEditor) editor;
        textEditor.selectAndReveal(result.getMatchOffset(), result.getMatchLength());
      }

    } catch (PartInitException e) {
      logger.log(Level.SEVERE, "Could not open editor for: " + result.getFile(), e);
    }
View Full Code Here

    }

    // Optimization - could also use else branch
    if (editor instanceof ITextEditor) {
      ITextEditor textEditor= (ITextEditor)editor;
      textEditor.selectAndReveal(pos.offset, pos.length);
      return;
    }

    /*
     * Workaround: send out a text selection
View Full Code Here

          IEditorInput input = part.getEditorInput();
          provider.connect(input);
          IDocument document = provider.getDocument(input);
          try {
            IRegion line = document.getLineInformation(lineNumber);
            textEditor.selectAndReveal(line.getOffset(), line.getLength());
          } catch (BadLocationException e) {

          }
          provider.disconnect(input);
        }
View Full Code Here

            }
            if (textEditor == null && editor.getAdapter(ITextEditor.class) != null) {
                textEditor = (ITextEditor) editor.getAdapter(ITextEditor.class);
            }
            if (textEditor != null) {
                textEditor.selectAndReveal(offset, length);
            }
        }
    }

    @Override
View Full Code Here

                    String line = document.get(li.getOffset(), li.getLength()).trim();
                    if (line.startsWith("*") || line.startsWith("/*") || line.startsWith("//")) {
                      region = frda.find(region.getOffset() + 1, '"' + wicketId + '"', true, true, false, false);
                    } else {
                      DocumentHelper.markOccurrence(textEditor, DocumentHelper.getStringConstantName(line));
                      textEditor.selectAndReveal(region.getOffset() + 1, wicketId.length());
                      found = true;
                      break;
                    }
                  }
                } else {
View Full Code Here

                }
              } else if (HTML.equals(extension)) {
                String wid_const = DocumentHelper.getNamespacePrefix(document);
                final IRegion region = frda.find(0, wid_const + ":id=\"" + wicketId, true, true, true, false);
                if (region != null) {
                  textEditor.selectAndReveal(region.getOffset() + wid_const.length() + 5, wicketId.length());
                  break;
                }
              } else if (PROPERTIES.equals(extension)) {
                // for the wicket tags that use wicket:message
                if (wicketId.startsWith("value:")) {
View Full Code Here

                      activePage.closeEditor(editor, false);
                      continue;
                    }
                    final IRegion lineRegion = document.getLineInformationOfOffset(sr.getOffset());
                    final int selectionLength = lineRegion.getOffset() + lineRegion.getLength() - sr.getOffset();
                    textEditor.selectAndReveal(sr.getOffset() + 1, selectionLength - 1);
                    foundInPropertiesFile = true;
                    break;
                  } else { // xml, select till </
                    final IRegion selEnd = frda.find(regionBegin.getOffset(), "</", true, true, false, false);
                    textEditor.selectAndReveal(sr.getOffset() + 2, selEnd.getOffset() - sr.getOffset() - 2);
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.