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

E13403-08

oracle.jdeveloper.merge
Class AbstractMergeEditor

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

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

Abstract class for a dynamically registered merge editor.

Since:
10.1.3.0.3

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
AbstractMergeEditor()
           
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          
 void close()
          
protected  Command createEditCommand(ViewEdit viewEdit)
           
protected  IdeAction createLocalAction(int cmdId)
          Creates a local (view-specific) action for the given command ID.
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()
          
 Controller getController()
          Get the Controller associated with this view.
 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()
          
 java.awt.Component getGUI()
          
 HelpInfo getHelpInfo()
          
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.
 void hidePopup()
          Informs the editor client that the popup menu (if showing) should now be hidden.
protected  void initializeMergeContextCS(Context context)
           
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 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  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.
 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()
          Saves the merge results, subject to user confirmation.
 boolean saveMergeImpl()
          Saves the merge results, without user confirmation.
protected abstract  boolean saveMergeImpl(Context context, CompareModel compareModel)
          Saves the merge results, without user confirmation (implementor).
 void setContext(Context context)
          Sets the current editor context.
protected  void setProgressCancelable(boolean cancelable)
           
 void showPopup(java.awt.event.MouseEvent mouseEvent)
          Informs the editor client that the user requested a popup menu in the given editor pane, at the location specified in the mouseEvent.
 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
augmentToolbarComponents
 
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, updateVisibleActions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractMergeEditor

public AbstractMergeEditor()
Method Detail

setContext

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

Overrides:
setContext in class Editor

getCompareView

public CompareView getCompareView()

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

createLocalAction

protected IdeAction createLocalAction(int cmdId)
Creates a local (view-specific) action for the given command ID.

Parameters:
cmdId - the command ID.
Returns:
the local action instance.

viewEditHappened

public void viewEditHappened(ViewEditEvent vee)

Specified by:
viewEditHappened in interface ViewEditListener
Parameters:
vee -

createEditCommand

protected Command createEditCommand(ViewEdit viewEdit)

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

public boolean saveMerge()
                  throws java.io.IOException
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()

saveMergeImpl

public boolean saveMergeImpl()
                      throws java.io.IOException
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)

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:

getGUI

public java.awt.Component getGUI()

Specified by:
getGUI in class View
Returns:
the root graphical user interface component.

getController

public Controller getController()
Get the Controller associated with this view.

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

getToolbar

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

Overrides:
getToolbar in class View
Returns:

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()

Specified by:
getFocusedEditorPane in interface oracle.ide.ceditor.find.FindableEditor
Returns:

showPopup

public void showPopup(java.awt.event.MouseEvent mouseEvent)
Informs the editor client that the user requested a popup menu in the given editor pane, at the location specified in the mouseEvent. The client is responsible for building/populating the popup menus (if necessary), and making it visible.

Specified by:
showPopup in interface ComparePopupManager
Parameters:
mouseEvent - the mouse event describing the location of the popup request.

hidePopup

public void hidePopup()
Informs the editor client that the popup menu (if showing) should now be hidden. This may be in response to some user input or event.

Specified by:
hidePopup in interface ComparePopupManager

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.

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.

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

protected abstract boolean saveMergeImpl(Context context,
                                         CompareModel compareModel)
                                  throws java.io.IOException
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.

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 Reference
11g Release 1 (11.1.1.7.0)

E13403-08

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