Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.jdeveloper.merge
Class BaseMergeEditor

java.lang.Object
  extended by oracle.ide.view.View
      extended by oracle.ide.editor.Editor
          extended by oracle.jdevimpl.compare.DrawerEditor
              extended by oracle.jdevimpl.compare.BaseCompareEditor
                  extended by oracle.jdeveloper.merge.BaseMergeEditor
All Implemented Interfaces:
java.util.EventListener, oracle.ide.ceditor.find.FindableEditor, ControllerProvider, Helpable, LayoutSelector, Observer, DynamicStatusProvider, StatusProvider, ComparePopupManager, ViewEditListener, BasicEditorPaneContainer, oracle.jdevimpl.compare.CompareViewOwner
Direct Known Subclasses:
AbstractMergeEditor, BaseTextMergeEditor

public abstract class BaseMergeEditor
extends oracle.jdevimpl.compare.BaseCompareEditor
implements ViewEditListener, DynamicStatusProvider, oracle.ide.ceditor.find.FindableEditor

Since:
11.1.2.0.0 (Sherman)

Field Summary
 
Fields inherited from class oracle.ide.editor.Editor
_addin, ATTRIBUTE_BACKGROUND_COLOR, ATTRIBUTE_CUSTOM_HORIZONTAL_SCROLLBAR, ATTRIBUTE_CUSTOM_VERTICAL_SCROLLBAR, ATTRIBUTE_DELAY_PALETTE_LOAD, ATTRIBUTE_HORIZONTAL_BLOCK_INCREMENT, ATTRIBUTE_HORIZONTAL_SCROLLBAR_POLICY, ATTRIBUTE_HORIZONTAL_UNIT_INCREMENT, ATTRIBUTE_MENU_ID, ATTRIBUTE_OLD_EDITOR, ATTRIBUTE_SCROLLABLE, ATTRIBUTE_VERTICAL_BLOCK_INCREMENT, ATTRIBUTE_VERTICAL_SCROLLBAR_POLICY, ATTRIBUTE_VERTICAL_UNIT_INCREMENT, CUSTOM_BORDER, PROPERTY_FIXED_BOTTOM_MARGIN, PROPERTY_FIXED_LEFT_MARGIN, PROPERTY_FIXED_RIGHT_MARGIN, PROPERTY_FIXED_TOP_MARGIN, PROPERTY_SCROLLABLE_LEFT_MARGIN, PROPERTY_SCROLLABLE_TOP_MARGIN
 
Fields inherited from class oracle.ide.view.View
EMPTY_SELECTION, PROJECT_PROP, VISIBLE_PROP, WORKSPACE_PROP
 
Constructor Summary
BaseMergeEditor()
           
 
Method Summary
protected  Context _getContext()
           
 void addChangeListener(javax.swing.event.ChangeListener l)
          
 void close()
          
protected  void compareViewStatusChanged()
           
protected  Command createEditCommand(ViewEdit viewEdit)
           
protected  CompareModel createMergeModel(Context context)
          Creates a merge compare model, based on the current editor context.
protected abstract  CompareModel createMergeModelImpl(Context context)
          Creates a merge compare model, based on the current editor context (implementor).
protected  java.io.Reader createReader()
          Creates a Reader on the node URL.
protected  void deinstallUndoableEditListener()
          De-installs view-specific undoable edit listeners.
 java.awt.Component getBottomComponent()
          
protected  boolean getClientSideMergeSetting()
           
 CompareView getCompareView()
          
protected  Controller getControllerImpl()
          
 javax.swing.JComponent[] getCustomCells()
          Get an array of custom cells to add to a StatusBar.
 java.lang.Object getEditorAttribute(java.lang.String attribute)
          
 BasicEditorPane getFocusedEditorPane()
          Fetches the focused (active) editor pane embedded in the editor.
protected  java.awt.Component getGUIImpl()
          
 HelpInfo getHelpInfo()
          
protected  java.net.URL getRealURL()
           
protected  java.net.URL getRealURL(Context context)
           
protected abstract
<T> T
getSaveResultForNode()
           
protected  java.net.URL getSaveURL(Context context)
           
protected  java.lang.String getSuffixAsType(java.net.URL url)
           
 Toolbar getToolbar()
          Get the toolbar associated with this view.
protected  void initializeMergeContextCS(Context context)
           
protected  void initializeMergeModel(CompareModel mergeModel)
           
protected  void initializeMergeView(CompareView mergeView)
          Intializes the merge compare view.
protected  void initializeToolbar(Toolbar toolbar)
          Initializes the toolbar instance with actions for the merge editor.
protected  void initializeToolbarImpl(Toolbar toolbar)
          Initializes the toolbar instance with specific actions for the merge editor.
protected  void installUndoableEditListener()
          Installs view-specific undoable edit listeners.
 boolean isCompleteState()
          Asks whether the editor is in 'complete state'.
 boolean isDynamic()
           
 boolean isExpandable(javax.swing.JComponent cell)
          Determine whether the given custom cell should expand to fill any extra space beyond its minimum requirements.
protected  boolean isMergeModelBasedOnFile()
           
protected  boolean isNodeDirty()
          Asks if the node is 'dirty' according to the merge editor.
protected  boolean isSaveEnabled()
           
protected  java.awt.Component layoutNorthComponent(Toolbar toolbar)
          Lays out and returns the north-orientation component in the merge editor UI.
 void moveToCompleteState()
          Move the editor into a 'complete state' from which no more merge activity can be performed.
 void open()
          Open this editor on the context set by a prior call to setContext.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          
protected  void reopen()
          Reopens the node for merging, from a restart (if complete) or revert.
protected  void resolveMergeStatus(java.net.URL realUrl)
           
 boolean restartMerge()
          Restarts the merge task, subject to user confirmation.
 boolean restartMergeImpl()
          Restarts the merge task, without user confirmation.
protected abstract  boolean restartMergeImpl(Context context)
          Restarts the merge task, without user confirmation (implementor).
 boolean saveMerge()
          Deprecated. only required for dynamic editor behaviors; merge editors should now be statically registered against a derivative type of BaseMergeNode.
 boolean saveMergeImpl()
          Deprecated. only required for dynamic editor behaviors; merge editors should now be statically registered against a derivative type of BaseMergeNode.
protected  boolean saveMergeImpl(Context context, CompareModel compareModel)
          Deprecated. only required for dynamic editor behaviors; merge editors should now be statically registered against a derivative type of BaseMergeNode.
 void setContext(Context context)
          Sets the current editor context.
protected  void setProgressCancelable(boolean cancelable)
           
protected  boolean supportsDrawers()
           
 void update(java.lang.Object observed, UpdateMessage change)
          Notification message.
protected  void updateMergeAttributes(TextBuffer mergeTextBuffer)
           
protected  void updateStatusLabel()
          Updates the status label of the merge editor, describing the number of conflicts and resolved differences.
protected abstract  boolean validateContent(CompareModel compareModel)
          Validate the content of the merged result.
 void viewEditHappened(ViewEditEvent vee)
          
 
Methods inherited from class oracle.jdevimpl.compare.BaseCompareEditor
addFixedCompareDrawer, augmentToolbarComponents, createLocalAction, createLocalAction, getGUI, getLocalAction, getLocalAction, hasCompareDrawers, hideAncillaryProgress, hidePopup, resolveGlobalAction, showAncillaryProgress, showPopup, showPopupImpl, stateDone, stateError, stateInProgress, updateFixedDrawerToolbars
 
Methods inherited from class oracle.jdevimpl.compare.DrawerEditor
addDrawer, getController, getDrawerViews, initializeGUI, persistDrawerStates, removeIfPresent, setSuppressPersistence, updateVisibleActions
 
Methods inherited from class oracle.ide.editor.Editor
addPreferredLayoutListener, addPropertyChangeListener, editorHidden, editorShown, firePropertyChangeEvent, getContext, getContextMenu, getDefaultFocusComponent, getDependentNodes, getDisplayName, getEditorAddin, getFixedBottomMargin, getFixedLeftMargin, getFixedRightMargin, getFixedTopMargin, getMiniToolbar, getPreferredLayoutBaseName, getPreferredLayoutURL, getScrollableLeftMargin, getScrollableTopMargin, getTabDescription, getTabIcon, getTabLabel, getTitleLabel, getType, initializeActiveLayout, initializeLayout, isReady, loadSettings, newId, prepareForSaving, removePreferredLayoutListener, removePropertyChangeListener, saveSettings, setEditorAddin, setEditorAttribute, setPreferredLayoutBaseName, setPreferredLayoutURL, setType
 
Methods inherited from class oracle.ide.view.View
activate, addViewListener, addViewSelectionListener, addViewStateListener, deactivate, fireViewCollapsed, fireViewExpanded, fireViewSelectionChanged, getContext, getId, getSelection, getSelectionFromUI, getTabName, getViewWithoutDecoration, isVisible, loadLayout, loadManifestToolbar, loadManifestToolbar, owner, removeViewListener, removeViewSelectionListener, removeViewStateListener, saveLayout, scheduleUpdateSelection, setId, setOwner, setToolbarVisible, show, toString, updateSelection, updateSelectionImpl, updateTitle, updateToolbarActions, updateVisibleActions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseMergeEditor

public BaseMergeEditor()
Method Detail

isDynamic

public boolean isDynamic()

setContext

public void setContext(Context context)
Description copied from class: Editor
Sets the current editor context.

Overrides:
setContext in class Editor

_getContext

protected final Context _getContext()

getCompareView

public CompareView getCompareView()

Specified by:
getCompareView in interface oracle.jdevimpl.compare.CompareViewOwner
Returns:

viewEditHappened

public void viewEditHappened(ViewEditEvent vee)

Specified by:
viewEditHappened in interface ViewEditListener
Parameters:
vee -

createEditCommand

protected Command createEditCommand(ViewEdit viewEdit)

compareViewStatusChanged

protected void compareViewStatusChanged()

updateStatusLabel

protected void updateStatusLabel()
Updates the status label of the merge editor, describing the number of conflicts and resolved differences. This would be invoked when an edit has occured which might affect the state of the merge compare model.


restartMerge

public boolean restartMerge()
                     throws java.io.IOException
Restarts the merge task, subject to user confirmation.

Returns:
true if the restart succeeded.
Throws:
java.io.IOException - if an I/O exception occurred restarting the merge task.

restartMergeImpl

public boolean restartMergeImpl()
                         throws java.io.IOException
Restarts the merge task, without user confirmation.

Returns:
true if the restart succeeded.
Throws:
java.io.IOException - if an I/O exception occurred restarting the merge task.

saveMerge

@Deprecated
public boolean saveMerge()
                  throws java.io.IOException
Deprecated. only required for dynamic editor behaviors; merge editors should now be statically registered against a derivative type of BaseMergeNode.

Saves the merge results, subject to user confirmation.

Returns:
true if the save succeeded.
Throws:
java.io.IOException - if an I/O exception occurred saving merge results.

getSaveURL

protected java.net.URL getSaveURL(Context context)

isMergeModelBasedOnFile

protected boolean isMergeModelBasedOnFile()

getRealURL

protected final java.net.URL getRealURL()

getRealURL

protected final java.net.URL getRealURL(Context context)

saveMergeImpl

@Deprecated
public boolean saveMergeImpl()
                      throws java.io.IOException
Deprecated. only required for dynamic editor behaviors; merge editors should now be statically registered against a derivative type of BaseMergeNode.

Saves the merge results, without user confirmation.

Returns:
true if the save succeeded.
Throws:
java.io.IOException - if an I/O exception occurred saving merge results.

moveToCompleteState

public void moveToCompleteState()
Move the editor into a 'complete state' from which no more merge activity can be performed. Currently this causes the editor to render blank with an explanatory label suggesting that the merge task is complete. In future this call will be redundant because we will be able to close out a dynamically registered flat editor tab w/o closing the tab group.


isCompleteState

public boolean isCompleteState()
Asks whether the editor is in 'complete state'.

Returns:
true if the editor is currently in the complete state.

getBottomComponent

public java.awt.Component getBottomComponent()

Overrides:
getBottomComponent in class Editor
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)

Overrides:
getEditorAttribute in class Editor
Parameters:
attribute - takes values from ATTRIBUTE_ constants.
Returns:
the value for the specified attribute.

open

public 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

Specified by:
open in class Editor
See Also:
Editor.setContext(oracle.ide.Context)

resolveMergeStatus

protected void resolveMergeStatus(java.net.URL realUrl)

setProgressCancelable

protected void setProgressCancelable(boolean cancelable)

getClientSideMergeSetting

protected boolean getClientSideMergeSetting()

initializeMergeContextCS

protected void initializeMergeContextCS(Context context)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

getSuffixAsType

protected java.lang.String getSuffixAsType(java.net.URL url)

close

public void close()

Overrides:
close in class Editor

getHelpInfo

public HelpInfo getHelpInfo()

Specified by:
getHelpInfo in interface Helpable
Overrides:
getHelpInfo in class View
Returns:

getGUIImpl

protected java.awt.Component getGUIImpl()

Overrides:
getGUIImpl in class oracle.jdevimpl.compare.DrawerEditor
Returns:

getControllerImpl

protected Controller getControllerImpl()

Specified by:
getControllerImpl in class oracle.jdevimpl.compare.DrawerEditor
Returns:

getToolbar

public Toolbar getToolbar()
Get the toolbar associated with this view.

Overrides:
getToolbar in class View
Returns:

supportsDrawers

protected boolean supportsDrawers()
Overrides:
supportsDrawers in class oracle.jdevimpl.compare.DrawerEditor

update

public void update(java.lang.Object observed,
                   UpdateMessage change)
Notification message. Subjects call this method when they notify their observers that the subjects state has changed.

Specified by:
update in interface Observer
Parameters:
observed - the subject whose state has changed.
change - what has changed.

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)

Specified by:
addChangeListener in interface DynamicStatusProvider
Parameters:
l -

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)

Specified by:
removeChangeListener in interface DynamicStatusProvider
Parameters:
l -

getCustomCells

public javax.swing.JComponent[] getCustomCells()
Get an array of custom cells to add to a StatusBar. The cells will be added to the StatusBar in the same order as they appear in the resulting array.

Specified by:
getCustomCells in interface StatusProvider
Returns:
an ordered array of custom status cells or null
See Also:
StatusBar

isExpandable

public boolean isExpandable(javax.swing.JComponent cell)
Determine whether the given custom cell should expand to fill any extra space beyond its minimum requirements.

Specified by:
isExpandable in interface StatusProvider
Parameters:
cell -
Returns:
true if customCell should expand to fill extra space.
See Also:
StatusProvider.getCustomCells()

getFocusedEditorPane

public BasicEditorPane getFocusedEditorPane()
Fetches the focused (active) editor pane embedded in the editor. If there is more than one editor pane, the one with focus should be returned. If the focus is not currently on an editor pane, then null should be returned.

Specified by:
getFocusedEditorPane in interface BasicEditorPaneContainer
Returns:
the instance of the embedded BasicEditorPane that currently has focus

installUndoableEditListener

protected void installUndoableEditListener()
Installs view-specific undoable edit listeners. By default, adds a ViewEditListener to the view.


deinstallUndoableEditListener

protected void deinstallUndoableEditListener()
De-installs view-specific undoable edit listeners. By default, removes a ViewEditListener from the view.


layoutNorthComponent

protected java.awt.Component layoutNorthComponent(Toolbar toolbar)
Lays out and returns the north-orientation component in the merge editor UI. By default, returns the toolbar instance.

Parameters:
toolbar - the toolbar.
Returns:
the component to have north orientation.

initializeToolbar

protected void initializeToolbar(Toolbar toolbar)
Initializes the toolbar instance with actions for the merge editor. By default, adds actions for SaveMergeCommand and RestartMergeCommand before calling initializeToolbarImpl(Toolbar).

Parameters:
toolbar - the toolbar.

initializeToolbarImpl

protected void initializeToolbarImpl(Toolbar toolbar)
Initializes the toolbar instance with specific actions for the merge editor. By default, does nothing. Actions will have already been added for SaveMergeCommand and RestartMergeCommand.

Parameters:
toolbar - the toolbar.

initializeMergeModel

protected void initializeMergeModel(CompareModel mergeModel)

initializeMergeView

protected void initializeMergeView(CompareView mergeView)
Intializes the merge compare view. By default, does nothing.

Parameters:
mergeView - the merge compare view.

createMergeModel

protected CompareModel createMergeModel(Context context)
Creates a merge compare model, based on the current editor context.

Parameters:
context - the current context.
Returns:
the create merge model, a CompareModel.

getSaveResultForNode

protected abstract <T> T getSaveResultForNode()

createMergeModelImpl

protected abstract CompareModel createMergeModelImpl(Context context)
Creates a merge compare model, based on the current editor context (implementor).

Parameters:
context - the current context.
Returns:
the create merge model, a CompareModel.

restartMergeImpl

protected abstract boolean restartMergeImpl(Context context)
                                     throws java.io.IOException
Restarts the merge task, without user confirmation (implementor).

Parameters:
context - the current context.
Returns:
true if the restart succeeded.
Throws:
java.io.IOException - if an I/O exception occurred restarting the merge task.

reopen

protected void reopen()
Reopens the node for merging, from a restart (if complete) or revert. By default, calls close() followed by open().


saveMergeImpl

@Deprecated
protected boolean saveMergeImpl(Context context,
                                           CompareModel compareModel)
                         throws java.io.IOException
Deprecated. only required for dynamic editor behaviors; merge editors should now be statically registered against a derivative type of BaseMergeNode.

Saves the merge results, without user confirmation (implementor).

Parameters:
context - the current context.
compareModel - the merge compare model of the view.
Returns:
true if the save succeeded.
Throws:
java.io.IOException - if an I/O exception occurred saving merge results.

isNodeDirty

protected boolean isNodeDirty()
Asks if the node is 'dirty' according to the merge editor. In this instance, 'dirty' means that the node's file timestamp has changed since the merge compare view was created.

Returns:
true if the file timestmap has changed.

createReader

protected java.io.Reader createReader()
                               throws java.io.IOException
Creates a Reader on the node URL.

Returns:
the created reader.
Throws:
java.io.IOException - if an I/O exception occurred accessing the file.

isSaveEnabled

protected boolean isSaveEnabled()

validateContent

protected abstract boolean validateContent(CompareModel compareModel)
                                    throws java.io.IOException
Validate the content of the merged result.

Parameters:
compareModel -
Returns:
true content valid or user wants to continue and save. false content not valid.
Throws:
java.io.IOException

updateMergeAttributes

protected void updateMergeAttributes(TextBuffer mergeTextBuffer)

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

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