Examples of ITextEditor


Examples of org.eclipse.ui.texteditor.ITextEditor

    //~ Methods

    protected void doRun()
    {
        ITextEditor editor = getEditor();

        String selection = ((TextSelection) editor.getSelectionProvider().getSelection()).getText();
        Shell shell = PerlEditorPlugin.getWorkbenchWindow().getShell();

        if (selection.length() == 0)
        {
            InputDialog inputDialog =
View Full Code Here

Examples of org.eclipse.ui.texteditor.ITextEditor

    }
    return null;
  }

  public static IFile getActiveFile() {
    ITextEditor editor = getActiveEditor();
    try {
      IFile curfile = ((IFileEditorInput) editor.getEditorInput()).getFile();
      return curfile;
    } catch (Exception e) {
      return null;
    }
  }
View Full Code Here

Examples of org.eclipse.ui.texteditor.ITextEditor

  /**
   * @return
   */
  private static ITextEditor getActiveEditor() {
    ITextEditor editor = (ITextEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    return editor;
  }
View Full Code Here

Examples of org.eclipse.ui.texteditor.ITextEditor

  public RunRescripterHandler() { }

  public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow window = getWindow(event);
    try {
      ITextEditor editor = getEditor();
      IEditorInput editorInput = editor.getEditorInput();
            IDocument document = editor.getDocumentProvider().getDocument(editorInput);
           
            IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput;
            IFile file = fileEditorInput.getFile();
           
            createRunScript(window).withContents(document.get(), file, editor.getTitle());
     
      return null;
    } catch (Throwable t) {
      t.printStackTrace();
      new Alerter(window).error("Error running script: "+t.getMessage());
View Full Code Here

Examples of org.eclipse.ui.texteditor.ITextEditor

  @Test public void
  runs_script_from_current_editor() throws ExecutionException {
    final RunScript runScript = context.mock(RunScript.class);
    final IFile file = context.mock(IFile.class);
    final IWorkbenchWindow window = context.mock(IWorkbenchWindow.class);
    final ITextEditor editor = context.mock(ITextEditor.class);
    final IFileEditorInput editorInput = context.mock(IFileEditorInput.class);
    final IDocumentProvider documentProvider = context.mock(IDocumentProvider.class);
    final IDocument document = context.mock(IDocument.class);
   
    ExecutionEvent event = new ExecutionEvent();
View Full Code Here

Examples of org.eclipse.ui.texteditor.ITextEditor

  @Override
  public void apply(ITextViewer viewer, char trigger, int stateMask,
      int offset) {

    IDocument document = viewer.getDocument();
    ITextEditor textEditor = ((PHPStructuredTextViewer) viewer)
        .getTextEditor();

    if (textEditor instanceof PHPStructuredEditor) {
      IModelElement editorElement = ((PHPStructuredEditor) textEditor)
          .getModelElement();
View Full Code Here

Examples of org.eclipse.ui.texteditor.ITextEditor

  private String computeReplacementString() {

    ITextViewer viewer = getTextViewer();
    IDocument document = viewer.getDocument();
    ITextEditor textEditor = ((PHPStructuredTextViewer) viewer)
        .getTextEditor();

    try {

      if (textEditor instanceof PHPStructuredEditor) {
View Full Code Here

Examples of org.eclipse.ui.texteditor.ITextEditor

        }

    }

    public void higlightCodePart(final DuplicatedCodeInstanceElement codePart) {
        final ITextEditor textEditor = (ITextEditor) WranglerUtils.openFile(codePart
                .getContainingFile());
        WranglerUtils.highlightOffsetSelection(codePart.getStartOffset(),
                codePart.getEndOffset(), textEditor);
    }
View Full Code Here

Examples of org.eclipse.ui.texteditor.ITextEditor

    public void run() {
        super.run();
        if (module == null) {
            return;
        }
        final ITextEditor textEditor = getTextEditor();
        {
            final IDocument document = textEditor.getDocumentProvider().getDocument(
                    textEditor.getEditorInput());
            final String text = document.get();
            final String scannerName = module.getScannerName();

            final InternalScanner internalScanner = (InternalScanner) ErlangEngine
                    .getInstance().getSimpleScannerService();
View Full Code Here

Examples of org.eclipse.ui.texteditor.ITextEditor

    }

    @Override
    public Object execute(final ExecutionEvent event) throws ExecutionException {

        final ITextEditor textEditor = (ITextEditor) HandlerUtil.getActiveEditor(event);
        if (!validateEditorInputState(textEditor)) {
            return null;
        }
        final ISelection sel = textEditor.getSelectionProvider().getSelection();
        if (sel == null || sel.isEmpty() || !(sel instanceof ITextSelection)) {
            return null;
        }
        ErlideEventTracer.getInstance().traceOperationStart(this);
        try {
            final IRunnableWithProgress myRunnableWithProgress = new IRunnableWithProgress() {
                @Override
                public void run(final IProgressMonitor monitor0) {
                    final IProgressMonitor monitor = monitor0 != null ? monitor0
                            : new NullProgressMonitor();
                    try {
                        monitor.beginTask("Processing "
                                + textEditor.getEditorInput().getName(),
                                IProgressMonitor.UNKNOWN);
                        doAction(sel, textEditor);
                    } finally {
                        monitor.done();
                    }
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.