org.chromium.debug.ui/src/org/chromium/debug/ui/editors/JsDocumentProvider.java
changeset 355 8726e95bcbba
parent 2 e4420d2515f1
equal deleted inserted replaced
354:0bceeb415e7f 355:8726e95bcbba
     2 // Use of this source code is governed by a BSD-style license that can be
     2 // Use of this source code is governed by a BSD-style license that can be
     3 // found in the LICENSE file.
     3 // found in the LICENSE file.
     4 
     4 
     5 package org.chromium.debug.ui.editors;
     5 package org.chromium.debug.ui.editors;
     6 
     6 
       
     7 import org.eclipse.core.resources.IProject;
     7 import org.eclipse.core.runtime.CoreException;
     8 import org.eclipse.core.runtime.CoreException;
     8 import org.eclipse.jface.text.IDocument;
     9 import org.eclipse.jface.text.IDocument;
     9 import org.eclipse.jface.text.IDocumentPartitioner;
    10 import org.eclipse.jface.text.IDocumentPartitioner;
    10 import org.eclipse.jface.text.rules.FastPartitioner;
    11 import org.eclipse.jface.text.rules.FastPartitioner;
       
    12 import org.eclipse.ui.IFileEditorInput;
    11 import org.eclipse.ui.editors.text.FileDocumentProvider;
    13 import org.eclipse.ui.editors.text.FileDocumentProvider;
    12 
    14 
    13 /**
    15 /**
    14  * Provides JavaScript content and sets up the document partitioner.
    16  * Provides JavaScript content and sets up the document partitioner.
    15  */
    17  */
    25       doc.setDocumentPartitioner(partitioner);
    27       doc.setDocumentPartitioner(partitioner);
    26     }
    28     }
    27     return doc;
    29     return doc;
    28   }
    30   }
    29 
    31 
       
    32   /**
       
    33    * Alternative implementation of the method that does not require file to be a physical file.
       
    34    */
       
    35   @Override
       
    36   public boolean isDeleted(Object element) {
       
    37     if (element instanceof IFileEditorInput) {
       
    38       IFileEditorInput input= (IFileEditorInput) element;
       
    39 
       
    40       IProject project = input.getFile().getProject();
       
    41       if (project != null && !project.exists()) {
       
    42         return true;
       
    43       }
       
    44 
       
    45       return !input.getFile().exists();
       
    46     }
       
    47     return super.isDeleted(element);
       
    48   }
       
    49 
    30 }
    50 }