Package org.eclipse.ui

Examples of org.eclipse.ui.IFileEditorInput


   * @since 2.0
   */
  protected void doValidateState(Object element, Object computationContext) throws CoreException {

    if (element instanceof IFileEditorInput) {
      IFileEditorInput input= (IFileEditorInput) element;
      FileInfo info= (FileInfo) getElementInfo(input);
      if (info != null) {
        IFile file= input.getFile();
        if (file.isReadOnly()) { // do not use cached state here
          IWorkspace workspace= file.getWorkspace();
          info.fStatus= workspace.validateEdit(new IFile[] { file }, computationContext);
        }
        if (isDerived(file)) {
View Full Code Here


   * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#doResetDocument(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
   * @since 3.0
   */
  protected void doResetDocument(Object element, IProgressMonitor monitor) throws CoreException {
    if (element instanceof IFileEditorInput) {
      IFileEditorInput input= (IFileEditorInput) element;
      try {
        refreshFile(input.getFile(), monitor);
        cacheEncodingState(element);
      } catch (CoreException x) {
        handleCoreException(x,TextEditorMessages.FileDocumentProvider_resetDocument);
      }
    }
View Full Code Here

   * @since 3.0
   */
  public boolean isSynchronized(Object element) {
    if (element instanceof IFileEditorInput) {
      if (getElementInfo(element) != null) {
        IFileEditorInput input= (IFileEditorInput) element;
        IResource resource= input.getFile();
        return resource.isSynchronized(IResource.DEPTH_ZERO);
      }
      return false;
    }
    return super.isSynchronized(element);
View Full Code Here

   * @return the persisted encoding
   * @since 2.1
   */
  protected String getPersistedEncoding(Object element) {
    if (element instanceof IFileEditorInput) {
      IFileEditorInput editorInput= (IFileEditorInput)element;
      IFile file= editorInput.getFile();
      if (file != null) {
        String encoding= null;
        try {
          encoding= file.getPersistentProperty(ENCODING_KEY);
        } catch (CoreException x) {
View Full Code Here

   * @throws org.eclipse.core.runtime.CoreException if persisting the encoding fails
   * @since 2.1
   */
  protected void persistEncoding(Object element, String encoding) throws CoreException {
    if (element instanceof IFileEditorInput) {
      IFileEditorInput editorInput= (IFileEditorInput)element;
      IFile file= editorInput.getFile();
      if (file != null) {
        file.setCharset(encoding, getProgressMonitor());
        StorageInfo info= (StorageInfo)getElementInfo(element);
        if (info != null) {
          if (encoding == null)
View Full Code Here

   * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#getResetRule(java.lang.Object)
   * @since 3.0
   */
  protected ISchedulingRule getResetRule(Object element) {
    if (element instanceof IFileEditorInput) {
      IFileEditorInput input= (IFileEditorInput) element;
      return fResourceRuleFactory.refreshRule(input.getFile());
    }
    return null;
  }
View Full Code Here

   * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#getSaveRule(java.lang.Object)
   * @since 3.0
   */
  protected ISchedulingRule getSaveRule(Object element) {
    if (element instanceof IFileEditorInput) {
      IFileEditorInput input= (IFileEditorInput) element;
      return computeSchedulingRule(input.getFile());
    }
    return null;
  }
View Full Code Here

   * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#getSynchronizeRule(java.lang.Object)
   * @since 3.0
   */
  protected ISchedulingRule getSynchronizeRule(Object element) {
    if (element instanceof IFileEditorInput) {
      IFileEditorInput input= (IFileEditorInput) element;
      return fResourceRuleFactory.refreshRule(input.getFile());
    }
    return null;
  }
View Full Code Here

   * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#getValidateStateRule(java.lang.Object)
   * @since 3.0
   */
  protected ISchedulingRule getValidateStateRule(Object element) {
    if (element instanceof IFileEditorInput) {
      IFileEditorInput input= (IFileEditorInput) element;
      return fResourceRuleFactory.validateEditRule(new IResource[] { input.getFile() });
    }
    return null;
  }
View Full Code Here

   * @throws CoreException if the encoding cannot be retrieved
   * @since 3.1
   */
  protected void cacheEncodingState(Object element) throws CoreException {
    if (element instanceof IFileEditorInput) {
      IFileEditorInput editorInput= (IFileEditorInput)element;
      IFile file= editorInput.getFile();
      if (file != null) {
        ElementInfo info= getElementInfo(element);
        if (info instanceof StorageInfo)
          ((StorageInfo)info).fEncoding= getPersistedEncoding(element);

View Full Code Here

TOP

Related Classes of org.eclipse.ui.IFileEditorInput

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.