Extension SDK 10.1.3.36.73

oracle.jdeveloper.merge
Class AbstractMergeEditor

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

public abstract class AbstractMergeEditor
extends Editor
implements DynamicStatusProvider, oracle.ide.ceditor.find.FindableEditor, PopupManager, oracle.jdevimpl.compare.CompareViewOwner

Abstract class for a dynamically registered merge editor.

Since:
10.1.3.0.3

Field Summary
 
Fields inherited from class oracle.ide.editor.Editor
_context, ATTRIBUTE_BACKGROUND_COLOR, ATTRIBUTE_CUSTOM_HORIZONTAL_SCROLLBAR, ATTRIBUTE_CUSTOM_VERTICAL_SCROLLBAR, 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
 
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  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 any view-specific undoable edit listeners.
 java.awt.Component getBottomComponent()
          
 CompareView getCompareView()
          
 Controller getController()
          
 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.
 java.lang.Object getEditorAttribute(java.lang.String attribute)
          
 BasicEditorPane getFocusedEditorPane()
          
 java.awt.Component getGUI()
          Get the root graphical user interface component.
 HelpInfo getHelpInfo()
          
 Toolbar getToolbar()
          Get the toolbar associated with this view.
 void hidePopup(BasicEditorPane editorPane)
          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.
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 any 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 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. If the editor cannot be open (file not found for example), this method should throw an OpenAbortedException
 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 showPopup(BasicEditorPane editorPane, 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.
 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.
protected  void updateStatusLabel()
          Updates the status label of the merge editor, describing the number of conflicts and resolved differences.
 
Methods inherited from class oracle.ide.editor.Editor
addPreferredLayoutListener, addPropertyChangeListener, editorHidden, editorShown, firePropertyChangeEvent, getContext, getContextMenu, getDefaultFocusComponent, getDependentNodes, getDisplayName, getFixedBottomMargin, getFixedLeftMargin, getFixedRightMargin, getFixedTopMargin, getMiniToolbar, getPreferredLayoutBaseName, getPreferredLayoutURL, getScrollableLeftMargin, getScrollableTopMargin, getTabDescription, getTabIcon, getTabLabel, getTitleLabel, getType, initializeActiveLayout, initializeLayout, isReady, loadSettings, newId, removePreferredLayoutListener, removePropertyChangeListener, saveSettings, setContext, setPreferredLayoutBaseName, setPreferredLayoutURL, setType
 
Methods inherited from class oracle.ide.view.View
activate, addViewListener, addViewSelectionListener, deactivate, fireViewClosed, fireViewSelectionChanged, getContext, getId, getSelection, getSelectionFromUI, isVisible, loadManifestToolbar, loadManifestToolbar, owner, removeViewListener, removeViewSelectionListener, scheduleUpdateSelection, setId, setOwner, setToolbarVisible, show, updateSelection, updateSelectionImpl, updateTitle, updateToolbarActions, updateVisibleActions, updateVisibleActions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMergeEditor

public AbstractMergeEditor()
Method Detail

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.

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.

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)

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()
Get the root graphical user interface component.

Specified by:
getGUI in class View
Returns:

getController

public Controller getController()

Specified by:
getController in interface ControllerProvider
Overrides:
getController in class Editor
Returns:

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(BasicEditorPane editorPane,
                      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 PopupManager
Parameters:
editorPane - the editorPane that the user request occurred in
mouseEvent - the mouse event describing the location of the popup request.

hidePopup

public void hidePopup(BasicEditorPane editorPane)
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 PopupManager
Parameters:
editorPane - the editorPane for which the popup should be hidden

installUndoableEditListener

protected void installUndoableEditListener()
Installs any view-specific undoable edit listeners.


deinstallUndoableEditListener

protected void deinstallUndoableEditListener()
De-installs any view-specific undoable edit listeners.


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.

Extension SDK 10.1.3.36.73

 

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