Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

oracle.ide.editor
Class Editor

java.lang.Object
  extended by oracle.ide.view.View
      extended by oracle.ide.editor.Editor
All Implemented Interfaces:
ControllerProvider, Helpable, LayoutSelector, Observer
Direct Known Subclasses:
AbstractEditor, oracle.jdevimpl.compare.BaseCompareEditor, CodeEditor, UIEditor

public abstract class Editor
extends View
implements Observer, LayoutSelector

Editors such as code, gui, html editors should implements the Editor interface.


Field Summary
protected  EditorAddin _addin
           
protected  Context _context
           
static java.lang.String ATTRIBUTE_BACKGROUND_COLOR
          return the desired background Color.
static java.lang.String ATTRIBUTE_CUSTOM_HORIZONTAL_SCROLLBAR
          Return a custom component to control the editor scrolling as your own horizontal scrollbar.
static java.lang.String ATTRIBUTE_CUSTOM_VERTICAL_SCROLLBAR
          Return a custom component to control the editor scrolling as your own vertical scrollbar.
static java.lang.String ATTRIBUTE_DELAY_PALETTE_LOAD
           
static java.lang.String ATTRIBUTE_HORIZONTAL_BLOCK_INCREMENT
          return the block increment for the horizontal scrollbar in the form of an Integer
static java.lang.String ATTRIBUTE_HORIZONTAL_SCROLLBAR_POLICY
          The scrollbar policy to be applied to the horizontal scrollbar.
static java.lang.String ATTRIBUTE_HORIZONTAL_UNIT_INCREMENT
          return the unit increment for the horizontal scrollbar in the form of an Integer
static java.lang.String ATTRIBUTE_MENU_ID
          return the menu label to use for the dynamic menu as a String String.
static java.lang.String ATTRIBUTE_OLD_EDITOR
          return Boolean.TRUE if this editor was written before JDeveloper 9.0.5 (MDI windowing) and the old behavior is still needed.
static java.lang.String ATTRIBUTE_SCROLLABLE
          By default, editors are hosted in a JViewport except if the editor returns Boolean.FALSE for this property.
static java.lang.String ATTRIBUTE_VERTICAL_BLOCK_INCREMENT
          return the block increment for the vertical scrollbar in the form of an Integer
static java.lang.String ATTRIBUTE_VERTICAL_SCROLLBAR_POLICY
          The scrollbar policy to be applied to the vertical scrollbar.
static java.lang.String ATTRIBUTE_VERTICAL_UNIT_INCREMENT
          return the unit increment for the vertical scrollbar in the form of an Integer
protected static javax.swing.border.Border CUSTOM_BORDER
           
static java.lang.String PROPERTY_FIXED_BOTTOM_MARGIN
           
static java.lang.String PROPERTY_FIXED_LEFT_MARGIN
           
static java.lang.String PROPERTY_FIXED_RIGHT_MARGIN
           
static java.lang.String PROPERTY_FIXED_TOP_MARGIN
           
static java.lang.String PROPERTY_SCROLLABLE_LEFT_MARGIN
           
static java.lang.String PROPERTY_SCROLLABLE_TOP_MARGIN
           
 
Fields inherited from class oracle.ide.view.View
EMPTY_SELECTION, PROJECT_PROP, VISIBLE_PROP, WORKSPACE_PROP
 
Constructor Summary
Editor()
           
 
Method Summary
 void addPreferredLayoutListener(PreferredLayoutListener l)
          Add a PreferredLayoutListener.
 void addPropertyChangeListener(java.beans.PropertyChangeListener propertyChangeListener)
           
 void close()
           
 void editorHidden()
          This method is called when an editor is hidden.
 void editorShown()
          This method is called when an editor is made visible.
protected  void firePropertyChangeEvent(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
           
 java.awt.Component getBottomComponent()
           
 Context getContext(java.util.EventObject event)
           
 ContextMenu getContextMenu()
           
 Controller getController()
          Get the Controller associated with this view.
 java.awt.Component getDefaultFocusComponent()
          This method is used to know what component should get the focus by default.
 Node[] getDependentNodes()
          Editors which access or manipulate more than one Node must return these Nodes using this method.
 java.lang.String getDisplayName()
          Returns a visible name that describes the class implementing this interface.
 EditorAddin getEditorAddin()
           
 java.lang.Object getEditorAttribute(java.lang.String attribute)
           
 java.awt.Component getFixedBottomMargin()
           
 java.awt.Component getFixedLeftMargin()
           
 java.awt.Component getFixedRightMargin()
           
 java.awt.Component getFixedTopMargin()
           
 java.awt.Component getMiniToolbar()
           
 java.lang.String getPreferredLayoutBaseName()
          Returns the base name is used as the file name part when building the preferred layout URL.
 java.net.URL getPreferredLayoutURL()
          Implementations should override this method and return their preferred layout.
 java.awt.Component getScrollableLeftMargin()
           
 java.awt.Component getScrollableTopMargin()
           
 java.lang.String getTabDescription()
          This method is called to get the tooltip to display in the tab hosting this editor.
 javax.swing.Icon getTabIcon()
          This method is called to get the icon to display in the tab hosting this editor.
 java.lang.String getTabLabel()
          This method is called to get the title to display in the tab hosting this editor.
 java.lang.String getTitleLabel()
          This method is called to get the title to display in the title bar of the EditorFrame hosting this editor.
 java.lang.String getType()
          Return a string that uniquely identifies this selector.
 void initializeActiveLayout()
          This method is called immediate after activating the selector's preferred layout.
 void initializeLayout(Layout layout)
          This method is called before to activate the selector's preferred layout.
 boolean isReady()
          This method is called before a preferred layout is activated.
 void loadSettings(StructuredPropertyAccess element)
          Reloads the editor settings.
protected  java.lang.String newId()
          Generates a unique view ID.
abstract  void open()
          Open this editor on the context set by a prior call to setContext.
 void prepareForSaving(boolean isClosing)
          Indicates that the editor is going to be checked for saving.
 void removePreferredLayoutListener(PreferredLayoutListener l)
          Remvoe a PreferredLayoutListener.
 void removePropertyChangeListener(java.beans.PropertyChangeListener propertyChangeListener)
           
 void saveSettings(StructuredPropertyAccess element)
          Saves the editor settings.
 void setContext(Context context)
          Sets the current editor context.
 void setEditorAddin(EditorAddin addin)
          Set the EditorAddin that actually created this editor (as opposed to some random EditorAddin that can create such an editor).
 void setEditorAttribute(java.lang.String attribute, java.lang.Object value)
           
 void setPreferredLayoutBaseName(java.lang.String name)
          Set the base name is used as the file name part when building the preferred layout URL.
 void setPreferredLayoutURL(java.net.URL layoutURL)
          This method is called from the activatePreferredLayout method to record a layout chosen by the user as their preferred layout.
 void setType(java.lang.String type)
          Set a string that uniquely identifies this selector.
 
Methods inherited from class oracle.ide.view.View
activate, addViewListener, addViewSelectionListener, addViewStateListener, deactivate, fireViewCollapsed, fireViewExpanded, fireViewSelectionChanged, getContext, getGUI, getHelpInfo, getId, getSelection, getSelectionFromUI, getTabName, getToolbar, getViewWithoutDecoration, isVisible, loadLayout, loadManifestToolbar, loadManifestToolbar, owner, removeViewListener, removeViewSelectionListener, removeViewStateListener, saveLayout, scheduleUpdateSelection, setId, setOwner, setToolbarVisible, show, toString, updateSelection, updateSelectionImpl, updateTitle, updateToolbarActions, updateVisibleActions, updateVisibleActions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.ide.model.Observer
update
 

Field Detail

ATTRIBUTE_SCROLLABLE

public static final java.lang.String ATTRIBUTE_SCROLLABLE
By default, editors are hosted in a JViewport except if the editor returns Boolean.FALSE for this property. This attribute is queried at the time the editor is hosted and cannot be changed by property changes.

See Also:
Constant Field Values

ATTRIBUTE_CUSTOM_HORIZONTAL_SCROLLBAR

public static final java.lang.String ATTRIBUTE_CUSTOM_HORIZONTAL_SCROLLBAR
Return a custom component to control the editor scrolling as your own horizontal scrollbar.

See Also:
Constant Field Values

ATTRIBUTE_CUSTOM_VERTICAL_SCROLLBAR

public static final java.lang.String ATTRIBUTE_CUSTOM_VERTICAL_SCROLLBAR
Return a custom component to control the editor scrolling as your own vertical scrollbar.

See Also:
Constant Field Values

ATTRIBUTE_HORIZONTAL_SCROLLBAR_POLICY

public static final java.lang.String ATTRIBUTE_HORIZONTAL_SCROLLBAR_POLICY
The scrollbar policy to be applied to the horizontal scrollbar. return ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER or ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS in the form of an Integer Note that ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED is not supported

See Also:
JScrollPane.setHorizontalScrollBarPolicy(int), Constant Field Values

ATTRIBUTE_VERTICAL_SCROLLBAR_POLICY

public static final java.lang.String ATTRIBUTE_VERTICAL_SCROLLBAR_POLICY
The scrollbar policy to be applied to the vertical scrollbar. return ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER or ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS in the form of an Integer. Note that ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED is not supported

See Also:
JScrollPane.setVerticalScrollBarPolicy(int), Constant Field Values

ATTRIBUTE_HORIZONTAL_UNIT_INCREMENT

public static final java.lang.String ATTRIBUTE_HORIZONTAL_UNIT_INCREMENT
return the unit increment for the horizontal scrollbar in the form of an Integer

See Also:
JScrollBar.setUnitIncrement(int), Constant Field Values

ATTRIBUTE_VERTICAL_UNIT_INCREMENT

public static final java.lang.String ATTRIBUTE_VERTICAL_UNIT_INCREMENT
return the unit increment for the vertical scrollbar in the form of an Integer

See Also:
JScrollBar.setUnitIncrement(int), Constant Field Values

ATTRIBUTE_HORIZONTAL_BLOCK_INCREMENT

public static final java.lang.String ATTRIBUTE_HORIZONTAL_BLOCK_INCREMENT
return the block increment for the horizontal scrollbar in the form of an Integer

See Also:
JScrollBar.setBlockIncrement(int), Constant Field Values

ATTRIBUTE_VERTICAL_BLOCK_INCREMENT

public static final java.lang.String ATTRIBUTE_VERTICAL_BLOCK_INCREMENT
return the block increment for the vertical scrollbar in the form of an Integer

See Also:
JScrollBar.setUnitIncrement(int), Constant Field Values

ATTRIBUTE_BACKGROUND_COLOR

public static final java.lang.String ATTRIBUTE_BACKGROUND_COLOR
return the desired background Color. If the editor is scrollable but the editor's UI is smaller than the window, this is what will be used to paint the rectangle below the editor.

See Also:
Constant Field Values

ATTRIBUTE_MENU_ID

public static final java.lang.String ATTRIBUTE_MENU_ID
return the menu label to use for the dynamic menu as a String String.

See Also:
DynamicMenuListener, Constant Field Values

ATTRIBUTE_OLD_EDITOR

public static final java.lang.String ATTRIBUTE_OLD_EDITOR
return Boolean.TRUE if this editor was written before JDeveloper 9.0.5 (MDI windowing) and the old behavior is still needed. Using this mode is strongly discouraged.

See Also:
Constant Field Values

ATTRIBUTE_DELAY_PALETTE_LOAD

public static final java.lang.String ATTRIBUTE_DELAY_PALETTE_LOAD
See Also:
Constant Field Values

PROPERTY_FIXED_BOTTOM_MARGIN

public static final java.lang.String PROPERTY_FIXED_BOTTOM_MARGIN
See Also:
Constant Field Values

PROPERTY_FIXED_LEFT_MARGIN

public static final java.lang.String PROPERTY_FIXED_LEFT_MARGIN
See Also:
Constant Field Values

PROPERTY_FIXED_RIGHT_MARGIN

public static final java.lang.String PROPERTY_FIXED_RIGHT_MARGIN
See Also:
Constant Field Values

PROPERTY_FIXED_TOP_MARGIN

public static final java.lang.String PROPERTY_FIXED_TOP_MARGIN
See Also:
Constant Field Values

PROPERTY_SCROLLABLE_LEFT_MARGIN

public static final java.lang.String PROPERTY_SCROLLABLE_LEFT_MARGIN
See Also:
Constant Field Values

PROPERTY_SCROLLABLE_TOP_MARGIN

public static final java.lang.String PROPERTY_SCROLLABLE_TOP_MARGIN
See Also:
Constant Field Values

CUSTOM_BORDER

protected static final javax.swing.border.Border CUSTOM_BORDER

_context

protected Context _context

_addin

protected EditorAddin _addin
Constructor Detail

Editor

public Editor()
Method Detail

open

public abstract void open()
Open this editor on the context set by a prior call to setContext. If the editor cannot be open (file not found for example), this method should throw an OpenAbortedException

Throws:
OpenAbortedException - if the editor could not be opened.
See Also:
setContext(oracle.ide.Context)

getDefaultFocusComponent

public java.awt.Component getDefaultFocusComponent()
This method is used to know what component should get the focus by default. The returned component should be a child of the component returned by getGUI() or getGUI() itself and should be requestFocusable. By contract, getGUI() will always be called before getDefaultFocusComponent().

Returns:
the component that should take the focus

getTitleLabel

public java.lang.String getTitleLabel()
This method is called to get the title to display in the title bar of the EditorFrame hosting this editor.


getTabLabel

public java.lang.String getTabLabel()
This method is called to get the title to display in the tab hosting this editor.


getTabIcon

public javax.swing.Icon getTabIcon()
This method is called to get the icon to display in the tab hosting this editor.


getTabDescription

public java.lang.String getTabDescription()
This method is called to get the tooltip to display in the tab hosting this editor.


setContext

public void setContext(Context context)
Sets the current editor context.


setEditorAddin

public void setEditorAddin(EditorAddin addin)
Set the EditorAddin that actually created this editor (as opposed to some random EditorAddin that can create such an editor). To be called by EditorManager only.

Parameters:
addin -

getEditorAddin

public EditorAddin getEditorAddin()
Returns:
the EditorAddin that created this editor

getDependentNodes

public Node[] getDependentNodes()
Editors which access or manipulate more than one Node must return these Nodes using this method. This allows the EditorManager to track Node usage, so that it can close Nodes when they are no longer open in any editor.


editorShown

public void editorShown()
This method is called when an editor is made visible. Then intent of this method is to let the editor know if it has to synchronize its content You should not do anything heavy in this method (like showing dockable windows) as the editorHidden()/editorShown could be called in sequence when the user creates a new tabgroup.


editorHidden

public void editorHidden()
This method is called when an editor is hidden.

See Also:
editorShown()

getController

public Controller getController()
Description copied from interface: ControllerProvider
Get the Controller associated with this view.

Specified by:
getController in interface ControllerProvider
Overrides:
getController in class View
Returns:
the Controller associated with this view.

getContext

public Context getContext(java.util.EventObject event)
Overrides:
getContext in class View
Parameters:
event - event associated with the context.
Returns:
the current view context for the given event.

getContextMenu

public ContextMenu getContextMenu()
Overrides:
getContextMenu in class View
Returns:
the ContextMenu, if any.

close

public void close()
Overrides:
close in class View

getBottomComponent

public java.awt.Component getBottomComponent()
Returns:
a component to be displayed underneath the editor to the right of the editor tabs. This can only be used when ATTRIBUTE_SCROLLABLE is Boolean.FALSE. The component replaces the horizontal scrollbar and will be stretched horizontally to fill the available space.

getEditorAttribute

public java.lang.Object getEditorAttribute(java.lang.String attribute)
Parameters:
attribute - takes values from ATTRIBUTE_ constants.
Returns:
the value for the specified attribute.

setEditorAttribute

public void setEditorAttribute(java.lang.String attribute,
                               java.lang.Object value)
Parameters:
attribute - takes values from ATTRIBUTE_ constants.
value - the value for the specified attribute.

getFixedLeftMargin

public java.awt.Component getFixedLeftMargin()
Returns:
the non-scrollable left margin if there is one or null.

getFixedRightMargin

public java.awt.Component getFixedRightMargin()
Returns:
the non-scrollable right margin if there is one or null.

getFixedTopMargin

public java.awt.Component getFixedTopMargin()
Returns:
the non-scrollable top margin if there is one or null.

getFixedBottomMargin

public java.awt.Component getFixedBottomMargin()
Returns:
the non-scrollable bottom margin if there is one or null.

getScrollableLeftMargin

public java.awt.Component getScrollableLeftMargin()
Returns:
the scrollable left margin if there is one or null.

getScrollableTopMargin

public java.awt.Component getScrollableTopMargin()
Returns:
the scrollable top margin if there is one or null.

getMiniToolbar

public java.awt.Component getMiniToolbar()
Returns:
the component (usually a toolbar) to be placed on the right of the horizontal toolbar.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener propertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener propertyChangeListener)

saveSettings

public void saveSettings(StructuredPropertyAccess element)
Saves the editor settings.

Example:

   public void saveSettings(Element element)
   {
     String value = "value";
     element.setAttribute("key", value);

     Node ownerNode = element.getOwnerNode();
     for(int i=0;i<3;i++)
     {
       Element subElement = ownerNode.createElement("sub");
       String subValue = "sub-value-"+i;
       subElement.setAttribute("sub-key", subValue);
       element.appendChild(subElement);
     }
   }
 

loadSettings

public void loadSettings(StructuredPropertyAccess element)
Reloads the editor settings.

This method will be called when the the product is restarted but also when an editor is split. If the new editor is of the same type as the original, the settings will be taken from the original (saveSettings) and will be applied to the new editor (loadSettings). If your editor needs to make the difference, it can test for the element.getName() which will return "DUPLICATON". Example:

     String value = element.getAttribute("key");
     System.out.println("value = " + value);
     NodeList childNodes = element.getChildNodes();
     int length = childNodes.getLength();
     for(int i=0;i<length;i++)
     {
       Node childNode = childNodes.item(i);
       if ("sub".equals(childNode.getNodeName()))
       {
         Element subElement = (Element) childNode;
         String subValue = subElement.getAttribute("sub-key");
         System.out.println("subValue = " + subValue);
       }
     }
 


prepareForSaving

public void prepareForSaving(boolean isClosing)
Indicates that the editor is going to be checked for saving. Logic in this method will be executed before that check happens. By default this method does not do anything.

Parameters:
isClosing - indicates if this editor will be closed or not.

firePropertyChangeEvent

protected final void firePropertyChangeEvent(java.lang.String propertyName,
                                             java.lang.Object oldValue,
                                             java.lang.Object newValue)

getPreferredLayoutURL

public java.net.URL getPreferredLayoutURL()
Description copied from interface: LayoutSelector
Implementations should override this method and return their preferred layout. This method is called from the activatePreferredLayout method to determine if this selector has a preferred layout. Default implementation returns null indicating that the selector does not have a preferred layout.

Specified by:
getPreferredLayoutURL in interface LayoutSelector

setPreferredLayoutURL

public void setPreferredLayoutURL(java.net.URL layoutURL)
Description copied from interface: LayoutSelector
This method is called from the activatePreferredLayout method to record a layout chosen by the user as their preferred layout.

Specified by:
setPreferredLayoutURL in interface LayoutSelector

initializeLayout

public void initializeLayout(Layout layout)
Description copied from interface: LayoutSelector
This method is called before to activate the selector's preferred layout. This is the opportunity for the layout selector to set values that will distinct its layout from others.

Specified by:
initializeLayout in interface LayoutSelector

initializeActiveLayout

public void initializeActiveLayout()
Description copied from interface: LayoutSelector
This method is called immediate after activating the selector's preferred layout.

Specified by:
initializeActiveLayout in interface LayoutSelector

isReady

public boolean isReady()
Description copied from interface: LayoutSelector
This method is called before a preferred layout is activated. This method should return true only when the selector is visible and fully activated.

Specified by:
isReady in interface LayoutSelector

getDisplayName

public java.lang.String getDisplayName()
Description copied from interface: LayoutSelector
Returns a visible name that describes the class implementing this interface.

Specified by:
getDisplayName in interface LayoutSelector

getType

public java.lang.String getType()
Description copied from interface: LayoutSelector
Return a string that uniquely identifies this selector. Selectors of the same type use the same preferred layout.

Specified by:
getType in interface LayoutSelector

setType

public void setType(java.lang.String type)
Description copied from interface: LayoutSelector
Set a string that uniquely identifies this selector. Selectors of the same type use the same preferred layout.

Specified by:
setType in interface LayoutSelector

getPreferredLayoutBaseName

public java.lang.String getPreferredLayoutBaseName()
Description copied from interface: LayoutSelector
Returns the base name is used as the file name part when building the preferred layout URL.

Specified by:
getPreferredLayoutBaseName in interface LayoutSelector

setPreferredLayoutBaseName

public void setPreferredLayoutBaseName(java.lang.String name)
Description copied from interface: LayoutSelector
Set the base name is used as the file name part when building the preferred layout URL.

Specified by:
setPreferredLayoutBaseName in interface LayoutSelector

addPreferredLayoutListener

public void addPreferredLayoutListener(PreferredLayoutListener l)
Description copied from interface: LayoutSelector
Add a PreferredLayoutListener.

Specified by:
addPreferredLayoutListener in interface LayoutSelector

removePreferredLayoutListener

public void removePreferredLayoutListener(PreferredLayoutListener l)
Description copied from interface: LayoutSelector
Remvoe a PreferredLayoutListener.

Specified by:
removePreferredLayoutListener in interface LayoutSelector

newId

protected java.lang.String newId()
Description copied from class: View
Generates a unique view ID. The default view ID is UnknownView{N}, where {N} is a unique integer value. Subclasses should override this method to return a more meaningful view ID.

Overrides:
newId in class View

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

Copyright © 1997, 2011, Oracle. All rights reserved.