org.csstudio.ui.util
Class NoResourceEditorInput

java.lang.Object
  extended by org.csstudio.ui.util.NoResourceEditorInput

public class NoResourceEditorInput
extends java.lang.Object

Terrible Hack to avoid extra context menu entries

Eclipse Editors are often associated with a file, specifically IFile which is an IResource. Depending on what else is included in the overall product, the context menu of such editors will then receive certain menu entries that don't make sense to the end user:

When inspecting for example org.eclipse.debug.ui/plugin.xml of Eclipse 3.7.2, it turned out to contribute the "Run As" context menu for any editor input that adapts to IResource.

To avoid such context menu entries, we wrap the actual editor input into something that does not adapt to a plain IResource, but otherwise forwards to the original IEditorInput. When the editor wraps its input (received in init() and maybe set in saveAs() the nonapplicable context menu entries can be avoided - at least with Eclipse 3.7.2 for team, debug.ui and PyDev; it is a hack after all.

Author:
Kay Kasemir

Constructor Summary
NoResourceEditorInput(IEditorInput orig)
          Initialize
 
Method Summary
 boolean exists()
           
 java.lang.Object getAdapter(java.lang.Class adapter)
          Do NOT adapt to IResource
 ImageDescriptor getImageDescriptor()
           
 java.lang.String getName()
           
 IEditorInput getOriginEditorInput()
           
 IPersistableElement getPersistable()
           
 java.lang.String getToolTipText()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NoResourceEditorInput

public NoResourceEditorInput(IEditorInput orig)
Initialize

Parameters:
orig - Original editor input
Method Detail

getOriginEditorInput

public IEditorInput getOriginEditorInput()
Returns:
Original editor input, i.e. the one that's wrapped

getAdapter

public java.lang.Object getAdapter(java.lang.Class adapter)
Do NOT adapt to IResource


exists

public boolean exists()

getImageDescriptor

public ImageDescriptor getImageDescriptor()

getName

public java.lang.String getName()

getPersistable

public IPersistableElement getPersistable()

getToolTipText

public java.lang.String getToolTipText()