Package org.eclipse.ui.editors.text

Examples of org.eclipse.ui.editors.text.TextEditor


        return fEditor;
    }

    protected Collection<IProject> getProjects() {

        final TextEditor editor = getEditor();
        if (editor != null) {
            final IEditorInput editorInput = editor.getEditorInput();
            if (editorInput instanceof IFileEditorInput) {
                final IFileEditorInput input = (IFileEditorInput) editorInput;
                final IFile file = input.getFile();
                final IProject project = file.getProject();
                return Lists.newArrayList(project);
View Full Code Here


    }

    protected void addPages() {
        try {
            editor = new RuleFlowModelEditor();
            xmlEditor = new TextEditor() {
                public boolean isEditable() {
                    return false;
                }
               
                public void close(boolean save) {
View Full Code Here

    public void testSwitchToTemplate() {
        Preferences.setJavaPackageFragmentRoot("src/main/javaxx");
        Preferences.setTemplateFileExtension(LoomConstants.HTML_FILE_EXTENSION);
        EditorFileOpener.getInstance().switchToTemplateOrJavaFile(javaFile);
        IDE.setDefaultEditor(templateFile, "org.eclipse.ui.DefaultTextEditor");
        TextEditor currentEditor = (TextEditor) getActiveEditor();
        IFileEditorInput input = (IFileEditorInput) currentEditor.getEditorInput();
        Assert.assertEquals("Wizard.html", input.getFile().getName());
    }
View Full Code Here

    public void testSwitchToLocalTemplate() {
        Preferences.setCreateTemplateInJavaFolder(true);
        Preferences.setTemplateFileExtension(LoomConstants.TML_FILE_EXTENSION);
        EditorFileOpener.getInstance().switchToTemplateOrJavaFile(javaFile);
        IDE.setDefaultEditor(localTemplateFile, "org.eclipse.ui.DefaultTextEditor");
        TextEditor currentEditor = (TextEditor) getActiveEditor();
        IFileEditorInput input = (IFileEditorInput) currentEditor.getEditorInput();
        Assert.assertEquals("Wizard.tml", input.getFile().getName());
    }
View Full Code Here

                IWorkbenchPage page = window.getActivePage();
                if (page != null)
                {
                    FileEditorInput input = new FileEditorInput(
                        (IFile) getMarker().getResource());
                    TextEditor editor = (TextEditor) page.findEditor(input);
                    doc = editor.getDocumentProvider().getDocument(input);
                }
            }
        }
        if (doc == null)
        {
View Full Code Here

  }

  private void createTextPage()
  {
    try {
      editor = new TextEditor();
      int index = addPage(editor, getEditorInput());
      setPageText(index, editor.getTitle());
    } catch (PartInitException e) {
      ErrorDialog.openError(
        getSite().getShell(),
View Full Code Here

    }
  }

  static void gotoError(IEditorPart editorPart, int line, int column) {
    if (editorPart != null) {
      TextEditor textEditor = (TextEditor) editorPart.getAdapter(TextEditor.class);
      if (textEditor != null) {
        try {
          IDocumentProvider dp = textEditor.getDocumentProvider();
          IDocument document = (dp != null) ? dp.getDocument(textEditor.getEditorInput()) : null;
          textEditor.selectAndReveal(document.getLineOffset(line - 1) + column - 1, 0);
        }
        catch (BadLocationException x) {
          // marker refers to invalid text position -> do nothing
        }
      }
View Full Code Here

        if (!MaudesimpleGUIPlugin.getDefault().getMaude().isRunning()) {
          MessageDialog.openError(null, Messages.getString("MaudeGUI.E_TITLE"),Messages.getString("MaudeGUI.E_NORUNNING")); //$NON-NLS-1$ //$NON-NLS-2$
        } else {

          TextEditor editor;
         
          editor = (TextEditor) activeEditorPart;
         
          String editorText =
            editor.getDocumentProvider().getDocument(editor.getEditorInput()).get();
         
          MaudesimpleGUIPlugin.getDefault().getMaude().sendToMaude(editorText);
         
//          envio el texto a maude modules. Alfredo Mu�oz Andrades
          MaudeModules.getInstance().addModules(editorText);
           
        }
      }
    };
    actSendMaude.setText(Messages.getString("MaudeGUI.MM_SENDTOMAUDE")); //$NON-NLS-1$
    actSendMaude.setToolTipText(Messages.getString("MaudeGUI.MT_SENDTOMAUDE")); //$NON-NLS-1$
    actSendMaude.setAccelerator(SWT.F9);
    actSendMaude.setImageDescriptor(ImageDescriptor.createFromURL(
        MaudesimpleGUIPlugin.getDefault().find(new Path(Messages.getString("MaudeGUI.MI_SENDTOMAUDE"))))); //$NON-NLS-1$
    actSendMaude.setDisabledImageDescriptor(ImageDescriptor.createFromURL(
        MaudesimpleGUIPlugin.getDefault().find(new Path(Messages.getString("MaudeGUI.MC_SENDTOMAUDE"))))); //$NON-NLS-1$
   
    // Send selection to Maude
    actSendSelMaude = new Action() {
      public void run() {
       
        if (!MaudesimpleGUIPlugin.getDefault().getMaude().isRunning()) {
          MessageDialog.openError(Workbench.getInstance().getDisplay().getActiveShell(), Messages.getString("MaudeGUI.E_TITLE"),Messages.getString("MaudeGUI.E_NORUNNING")); //$NON-NLS-1$ //$NON-NLS-2$
        } else {
 
          TextEditor editor;
         
          editor = (TextEditor) activeEditorPart;
         
          ISelection sel = editor.getSelectionProvider().getSelection();
          Object selection = null;
          if(sel instanceof TextSelection) {
            selection = ((TextSelection)sel).getText();
          }
          if(selection!= null && selection.toString().length() > 0)
View Full Code Here

        if (!MaudesimpleGUIPlugin.getDefault().getMaude().isRunning()) {
          MessageDialog.openError(null, Messages.getString("MaudeGUI.E_TITLE"),Messages.getString("MaudeGUI.E_NORUNNING")); //$NON-NLS-1$ //$NON-NLS-2$
        } else {

          TextEditor editor;
         
          editor = (TextEditor) activeEditorPart;
         
          String editorText =
            editor.getDocumentProvider().getDocument(editor.getEditorInput()).get();
         
          MaudesimpleGUIPlugin.getDefault().getMaude().sendToMaude(editorText);
           
        }
      }
    };
    actSendMaude.setText(Messages.getString("MaudeGUI.MM_SENDTOMAUDE")); //$NON-NLS-1$
    actSendMaude.setToolTipText(Messages.getString("MaudeGUI.MT_SENDTOMAUDE")); //$NON-NLS-1$
    actSendMaude.setAccelerator(SWT.F9);
    actSendMaude.setImageDescriptor(ImageDescriptor.createFromURL(
        MaudesimpleGUIPlugin.getDefault().find(new Path(Messages.getString("MaudeGUI.MI_SENDTOMAUDE"))))); //$NON-NLS-1$
    actSendMaude.setDisabledImageDescriptor(ImageDescriptor.createFromURL(
        MaudesimpleGUIPlugin.getDefault().find(new Path(Messages.getString("MaudeGUI.MC_SENDTOMAUDE"))))); //$NON-NLS-1$
   
    // Send selection to Maude
    actSendSelMaude = new Action() {
      public void run() {
       
        if (!MaudesimpleGUIPlugin.getDefault().getMaude().isRunning()) {
          MessageDialog.openError(null, Messages.getString("MaudeGUI.E_TITLE"),Messages.getString("MaudeGUI.E_NORUNNING")); //$NON-NLS-1$ //$NON-NLS-2$
        } else {
 
          TextEditor editor;
         
          editor = (TextEditor) activeEditorPart;
         
          ISelection sel = editor.getSelectionProvider().getSelection();
          Object selection = null;
          if(sel instanceof TextSelection) {
            selection = ((TextSelection)sel).getText();
          }
          if(selection!= null && selection.toString().length() > 0)
View Full Code Here

   * Creates page of the multi-page editor as <code>TextEditor</code>
   * for representing csv content as normal text.
   */
  private void createTextPage() {
    try {
      csvTextEditor = new TextEditor();
      int index = addPage(csvTextEditor, getEditorInput());
      setPageText(index, "Source view");
    } catch (PartInitException e) {
      ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null,e.getStatus());
    }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.editors.text.TextEditor

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.