Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Unbenannt
Sunday, January 6th, 2008 at 10:57:43am MST 

  1. package org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document;
  2.  
  3. import org.eclipse.core.resources.IFile;
  4. import org.eclipse.core.runtime.IPath;
  5. import org.eclipse.emf.transaction.TransactionalEditingDomain;
  6. import org.eclipse.ui.IFileEditorInput;
  7. import org.eclipse.ui.IMemento;
  8. import org.eclipse.ui.IPathEditorInput;
  9. import org.eclipse.ui.IPersistableElement;
  10.  
  11. import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.MEditingDomainElement;
  12.  
  13.  
  14. /**
  15.  * FileEditorInput Proxy.
  16.  *
  17.  * @author mgoyal
  18.  *
  19.  *
  20.  */
  21. public class FileEditorInputProxy extends StorageEditorInputProxy
  22.         implements IFileEditorInput, IPathEditorInput, IPersistableElement, MEditingDomainElement {
  23.         /**
  24.          * @param proxied
  25.          * @param domain
  26.          */
  27.         public FileEditorInputProxy(IFileEditorInput proxied, TransactionalEditingDomain domain) {
  28.                 super(proxied, domain);
  29.                 assert proxied != null && domain != null;
  30.         }
  31.        
  32.         /* (non-Javadoc)
  33.          * @see org.eclipse.ui.IPersistableElement#getFactoryId()
  34.          */
  35.         public String getFactoryId() {
  36.                 IPersistableElement persistable = getPersistableElement();
  37.                 if(persistable != null)
  38.                         return persistable.getFactoryId();
  39.                 assert false;
  40.                 return null;
  41.         }
  42.  
  43.         /* (non-Javadoc)
  44.          * @see org.eclipse.ui.IFileEditorInput#getFile()
  45.          */
  46.         public IFile getFile() {
  47.                 IFileEditorInput fileInput = getFileInput();
  48.                 if(fileInput != null)
  49.                         return fileInput.getFile();
  50.                 assert false;
  51.                 return null;
  52.         }
  53.  
  54.         /* (non-Javadoc)
  55.          * @see org.eclipse.ui.IPathEditorInput#getPath()
  56.          */
  57.         public IPath getPath() {
  58.                 IPathEditorInput pathInput = getPathInput();
  59.                 if(pathInput != null)
  60.                         return pathInput.getPath();
  61.                 assert false;
  62.                 return null;
  63.         }
  64.  
  65.         /* (non-Javadoc)
  66.          * @see org.eclipse.ui.IPersistable#saveState(org.eclipse.ui.IMemento)
  67.          */
  68.         public void saveState(IMemento memento) {
  69.                 IPersistableElement persistable = getPersistableElement();
  70.                 if(persistable != null)
  71.                         persistable.saveState(memento);
  72.         }
  73.  
  74.         /* (non-Javadoc)
  75.          * @see java.lang.Object#toString()
  76.          */
  77.         public String toString() {
  78.                 return fProxied.toString();
  79.         }
  80.  
  81.         /* (non-Javadoc)
  82.          * @see org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.MEditingDomainElement#getEditingDomain()
  83.          */
  84.         public TransactionalEditingDomain getEditingDomain() {
  85.                 return editingDomain;
  86.         }
  87.        
  88.         /**
  89.          * @return FileEditorInput
  90.          */
  91.         private IFileEditorInput getFileInput() {
  92.                 return fProxied instanceof IFileEditorInput ? (IFileEditorInput)fProxied : null;
  93.         }
  94.  
  95.         /**
  96.          * @return PathEditorInput
  97.          */
  98.         private IPathEditorInput getPathInput() {
  99.                 return fProxied instanceof IPathEditorInput ? (IPathEditorInput)fProxied : null;
  100.         }
  101.        
  102.         /**
  103.          * @return Persistable Element
  104.          */
  105.         private IPersistableElement getPersistableElement() {
  106.                 return fProxied instanceof IPersistableElement ? (IPersistableElement)fProxied : null;
  107.         }
  108. }

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right
worth-right