Package org.eclipse.ui

Examples of org.eclipse.ui.IEditorReference


  public String getToolTipText() {
    return styledText.getToolTipText();
  }

  public boolean isActive() {
    IEditorReference activeEditor = UIThreadRunnable.syncExec(new Result<IEditorReference>() {
      public IEditorReference run() {
        try {
          IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
          return (IEditorReference) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getReference(
              activeEditor);
View Full Code Here


   *
   * @return the active editor, if any
   * @throws WidgetNotFoundException if there is no active view
   */
  public SWTBotEditor activeEditor() {
    IEditorReference editor = workbenchContentsFinder.findActiveEditor();
    if (editor == null)
      throw new WidgetNotFoundException("There is no active editor"); //$NON-NLS-1$
    return new SWTBotEditor(editor, this);
  }
View Full Code Here

    ArrayList suggestions= createSuggestionsFromOpenDocument(viewer, offset, prefix);
    IDocument currentDocument= viewer.getDocument();

    IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IEditorReference editorReferences[]= window.getActivePage().getEditorReferences();

    for (int i= 0; i < editorReferences.length; i++) {
      IEditorPart editor= editorReferences[i].getEditor(false); // don't create!
      if (editor instanceof ITextEditor) {
        ITextEditor textEditor= (ITextEditor) editor;
View Full Code Here

  private String[] getSuggestions(String prefix) throws BadLocationException {

    ArrayList suggestions= createSuggestionsFromOpenDocument(prefix);

    IWorkbenchWindow window= getTextEditor().getSite().getWorkbenchWindow();
    IEditorReference editorsArray[]= window.getActivePage().getEditorReferences();

    for (int i= 0; i < editorsArray.length; i++) {
      IEditorPart realEditor= editorsArray[i].getEditor(false);
      if (realEditor instanceof ITextEditor &&
          !realEditor.equals(getTextEditor())) { // realEditor != null
View Full Code Here

                IEditorReference[] editorReferences = activePage.
                        getEditorReferences();

                for (int j = 0; !alreadyOpen && j < editorReferences.length;
                     j++) {
                    IEditorReference editorReference = editorReferences[j];
                    // Check to see if the last segment of the file name matches
                    // the editor's name (which should be the name and extension
                    // for example, 'chart.mcht'). If it does then check to
                    // see if the full path matches that of the file path. We
                    // do this to reduce calls to x.getEditor(true) which restores
                    // the editor. Looking at how other eclipse editors work,
                    // see AbstractDocumentProvider#saveDocument(..), an internal
                    // map is maintained using within a document provider (which
                    // we don't have). Adopting a similar approach is better
                    // but not feasible within the current time frame.
                    // @todo later evaluate/resolve this comment's issue.
                    if (filename.equals(editorReference.getName())) {
                        IFileEditorInput fileEditorInput = ((IFileEditorInput)
                                editorReference.getEditor(true).getEditorInput());
                        // If the full path matches, then this editor is exists
                        // and is open, so we cannot save over it.
                        if (fileEditorInput.getFile().getFullPath().
                                equals(filePath)) {
                            alreadyOpen = true;
View Full Code Here

                    null,
                    UMLClassDiagramJavaEditor.ID,
                    IWorkbenchPage.MATCH_ID
                );
              if(references!=null) {
                IEditorReference reference = null;
                IEditorPart editor = null;
                for(int j=0 ; j<references.length ; j++) {
                  reference = references[j];
                  if(reference!=null) {
                    editor =
                      reference.getEditor(false);
                    if(
                        editor
                        instanceof
                        UMLClassDiagramJavaEditor
                    ) {
View Full Code Here

     */
    public IEditorReference getVisibleEditor() {
        EditorStack activeWorkbook = editorArea.getActiveWorkbook();
        EditorPane pane = (EditorPane)activeWorkbook.getSelection();
        if (pane != null) {
            IEditorReference result = pane.getEditorReference();
            IEditorPart editorPart = (IEditorPart) result.getPart(false);
            if ((editorPart != null) && (editorPart instanceof MultiEditor)) {
                editorPart = ((MultiEditor) editorPart).getActiveEditor();
                EditorSite site = (EditorSite) editorPart.getSite();
                result = (IEditorReference) site.getPartReference();
            }
View Full Code Here

     * @param ref editor to add
     * @param workbookId workbook that will contain the editor (or null if the editor
     * should be added to the default workbook)
     */
    public void addEditor(EditorReference ref, String workbookId) {
        IEditorReference refs[] = editorArea.getPage().getEditorReferences();
        for (int i = 0; i < refs.length; i++) {
            if (ref == refs[i]) {
        return;
      }
        }
View Full Code Here

     * @param part the editor to make visible
     * @param setFocus whether to give the editor focus
     * @return true if the visible editor was changed, false if not.
     */
    public boolean setVisibleEditor(IEditorReference ref, boolean setFocus) {
        IEditorReference visibleEditor = getVisibleEditor();
        if (ref != visibleEditor) {
            IEditorPart part = (IEditorPart) ref.getPart(true);
            EditorPane pane = null;
            if (part != null) {
        pane = (EditorPane) ((PartSite) part.getEditorSite()).getPane();
View Full Code Here

        IWorkbenchPage page = getActivePage();
        if (page == null) {
            setEnabled(false);
            return;
        }
        IEditorReference editors[] = page.getEditorReferences();
        for (int i = 0; i < editors.length; i++) {
            if (!editors[i].isDirty()) {
                setEnabled(true);
                return;
            }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IEditorReference

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.