public abstract class AbstractStructureController extends java.lang.Object implements ICompareMergeController, ICommandManagerChangeListener
Modifier and Type | Field and Description |
---|---|
protected boolean |
_needNotifyCallback
Specifies whether we need notify call back when closing the merge
session.
|
protected AbstractStructureMergeViewer |
_viewer
StructureMergeViewer, the GUI editor for compare/merge
|
static java.lang.String |
COMPARE_EDITOR_VIEW_ID |
static java.lang.String |
NAVIGATION_PROVIDER_PROPERTY
Unique identifier used to retrieve navigator provider from this
controller's getProperty method
|
static java.lang.String |
SELECTION_PROVIDER_PROPERTY
Unique identifier used to retrieve selection provider from this
controller's getProperty method
|
Constructor and Description |
---|
AbstractStructureController(AbstractStructureMergeViewer viewer)
Constructs a new AbstractStructureController
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
Adds a listener for property changes to this notifier.
|
boolean |
canAutoAdvance()
Determines if the Auto-Advance action can be enabled.
|
boolean |
canSaveMergedContributor()
Checks if it is possible to save the merged result to the default
location
|
boolean |
canSaveMergedContributorAs(ContributorType contributor)
Checks if it is possible to save the merged result on top of Left ot
Right contributors
|
protected boolean |
canSaveToLeftOrRight() |
void |
close()
Called when the parent Merge Viewer is disposed.
|
void |
closeCompareMergeSession()
Close C/M session, if any.
|
void |
commandManagerChanged(CommandManagerChangeEvent event)
Handles an event indicating that a command manager has changed.
|
protected abstract void |
doSaveDeltas(java.lang.String toPath)
Saves the rendered representation of deltas to a specified file path.
|
protected abstract void |
doSaveDeltas2(java.lang.String toPath)
Saves the rendered representation of deltas to a specified file path.
|
abstract ICommand |
getAcceptAllCommand(java.lang.String label,
ContributorType source)
Returns the command accepting all Differences associated with the
specified contributor and applying them to the Merged model.
|
abstract ICommand |
getAcceptAllNonconflictingCommand(java.lang.String label)
Returns the command for accepting all Non-Conflicting Diffs from both
contributors.
|
abstract ICommand |
getAcceptCommand(java.lang.String label,
ContributorType source,
IContentViewerInput input)
Returns the command for accepting the specified contributor's difference
and applying it to the Merged model
If the Difference is a part of conflict, the Conflict will also be resolved, and the other conflicting Diff will be rejected. |
ActionManager |
getActionManager()
Returns the action manager for this session
|
protected static <T> T |
getAdapter(java.lang.Object v,
java.lang.Class<T> clazz) |
com.ibm.xtools.comparemerge.ui.internal.tasks.ICMTaskFactory |
getCMTaskFactory()
Returns factory for managing operations related to Compare/Merge tasks.
|
IMergeViewerPane |
getContentPane()
Retrieves reference to the Content Pane of the parent Merge Viewer
|
IContentViewerInput |
getContentViewerInput()
Returns current selection in the SP
|
abstract ICommand |
getIgnoreAllCommand(java.lang.String label)
Returns the command for ignoring ALL conflicts in the current
MergeSession.
|
abstract ICommand |
getIgnoreCommand(java.lang.String label,
IContentViewerInput input)
Returns the command for Ignoring the Conflict.
|
IMergeViewerPane |
getMergedPane()
Retrieves reference to the Merged Pane of the parent Merge Viewer
|
AbstractMergeManager |
getMergeManager()
Returns MergeManager controlled by this Controller
|
AbstractMergeViewer |
getMergeViewer()
Returns the StructureViewer controlled by this Controller
|
INavigationProvider |
getNavigationProvider()
Returns the navigation provider for diff/conflict navigation
|
java.lang.Object |
getProperty(java.lang.String key)
Returns the property with the given name, or
null if no
such property exists. |
abstract ICommand |
getRejectAllCommand(java.lang.String label,
ContributorType contributor)
Returns the command for rejecting ALL Differences from specified
contributor.
|
abstract ICommand |
getRejectCommand(java.lang.String label,
ContributorType source,
IContentViewerInput input)
Returns the command for rejecting the specified contributor's Difference.
|
abstract ICommand |
getResolveAllCommand(java.lang.String label,
ContributorType contributor)
Returns the command for resolving ALL Conflicts using the specified
contributor.
|
abstract ICommand |
getResolveCommand(java.lang.String label,
ContributorType contributor,
IContentViewerInput input)
Returns the command for resolving the Conflict by accepting the
conflciting Difference from a specified Contributor
|
org.eclipse.jface.viewers.ISelectionProvider |
getSelectionProvider()
Returns the selection provider for diff/conflict
|
MergeSessionInfo |
getSessionInfo()
Returns the information about current Compare/Merge session, such as the
Ancestor, Left, Right, Merged descriptors, CompareConfiguration, other
flags.
|
IMergeViewerPane |
getStructurePane()
Retrieves reference to the Structure Pane of the parent Merge Viewer
|
static org.eclipse.compare.internal.CompareEditor |
getViewInstance()
Returns the instance of SnippetEditorView in the workbench or null if the view
couldn't be found or restored.
|
boolean |
isAutoAdvance()
Determines whether the structure pane's selection must auto advance to
the next unresolved Conflict/Diff once the previos one was resolved.
|
boolean |
isCompareMergeSessionOpen()
Determines if the C/M session was open and it is in good "healthy" state
(not faile because of incorrect data in the input etc).
|
boolean |
isContributorVisible(ContributorType contributor)
Returns whether the specified contributor should be shown.
|
boolean |
isDirty()
Checks is the model was modified since the beginning or the last save
operation
|
boolean |
isMergeCompleted()
Returns whether all conflicts have been resolved.
|
boolean |
isMergeMode()
Returns whether the session is a merge session or not.
|
boolean |
isThreeWayMode()
Returns whether the session is a three way comparison or not.
|
static void |
openCMTasksView(boolean checkPreference) |
void |
openCompareMergeSession(org.eclipse.compare.structuremergeviewer.ICompareInput input)
Starts a new C/M session.
|
void |
removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
Removes the given content change listener from this notifier.
|
void |
resumeUpdates()
Resumes updates for the panes.
|
void |
revertMergeSession()
Will revert an existing Merge session.
|
void |
saveDeltas()
Saves the deltas to a file selected by dialog
|
void |
saveMergedContributor()
Saves the modified contents of the Merged contributor
|
void |
saveMergedContributorAs(ContributorType contributor)
Will save the merged result on top of Left ot Right contributors
|
void |
saveMergedContributorCopy()
Saves the modified contents of the Merged contributor to a file selected
by dialog
|
protected void |
saveMergedContributorCopy(boolean saveToFolder,
java.lang.String message) |
void |
setAutoAdvance(boolean advance)
Sets whether the structure pane's selection must auto advance to the next
unresolved Conflict/Diff once the previous one was resolved.
|
protected void |
setDirty(boolean state)
Sets a new state on the Dirty flag.
|
void |
setProperty(java.lang.String key,
java.lang.Object newValue)
Sets the property with the given name.
|
void |
suspendUpdates()
Suspends updates for the panes to avoid frequent refreshes while merging
data.
|
boolean |
wasSaved() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChangeChangeConflictAcceptCommand, getProxyCommand
public static final java.lang.String SELECTION_PROVIDER_PROPERTY
public static final java.lang.String NAVIGATION_PROVIDER_PROPERTY
public static final java.lang.String COMPARE_EDITOR_VIEW_ID
protected AbstractStructureMergeViewer _viewer
protected boolean _needNotifyCallback
public AbstractStructureController(AbstractStructureMergeViewer viewer)
viewer
- the parent Merge Viewer hosting other panes to be controlled
by this Controllerpublic void close()
ICompareMergeController
close
in interface ICompareMergeController
ICompareMergeController.close()
public void openCompareMergeSession(org.eclipse.compare.structuremergeviewer.ICompareInput input) throws java.lang.Exception
ICompareMergeController
openCompareMergeSession
in interface ICompareMergeController
input
- the new compare input for new sessionjava.lang.Exception
ICompareMergeController.openCompareMergeSession(org.eclipse.compare.structuremergeviewer.ICompareInput)
public static void openCMTasksView(boolean checkPreference)
public void closeCompareMergeSession()
ICompareMergeController
closeCompareMergeSession
in interface ICompareMergeController
ICompareMergeController.closeCompareMergeSession()
public static org.eclipse.compare.internal.CompareEditor getViewInstance()
public boolean isCompareMergeSessionOpen()
ICompareMergeController
isCompareMergeSessionOpen
in interface ICompareMergeController
ICompareMergeController.isCompareMergeSessionOpen()
public void revertMergeSession() throws java.lang.Exception
ICompareMergeController
revertMergeSession
in interface ICompareMergeController
java.lang.Exception
ICompareMergeController.revertMergeSession()
public AbstractMergeViewer getMergeViewer()
getMergeViewer
in interface ICompareMergeController
ICompareMergeController.getMergeViewer()
public IMergeViewerPane getStructurePane()
public IMergeViewerPane getContentPane()
public IMergeViewerPane getMergedPane()
public boolean isDirty()
isDirty
in interface ICompareMergeController
protected void setDirty(boolean state)
state
- of the dirty flagpublic boolean isAutoAdvance()
ICompareMergeController
isAutoAdvance
in interface ICompareMergeController
ICompareMergeController.isAutoAdvance()
public boolean canAutoAdvance()
ICompareMergeController
canAutoAdvance
in interface ICompareMergeController
ICompareMergeController.canAutoAdvance()
public void setAutoAdvance(boolean advance)
ICompareMergeController
setAutoAdvance
in interface ICompareMergeController
advance
- to specify whether the structure pane's selection must auto
advance to the next unresolved Conflict/Diff once the previos
one was resolved. Normally is set by the AutoAdvanceAction.ICompareMergeController.setAutoAdvance(boolean)
public AbstractMergeManager getMergeManager()
getMergeManager
in interface ICompareMergeController
ICompareMergeController.getMergeManager()
public ActionManager getActionManager()
ICompareMergeController
getActionManager
in interface ICompareMergeController
null
if noneICompareMergeController.getActionManager()
public IContentViewerInput getContentViewerInput()
getContentViewerInput
in interface ICompareMergeController
null
if noneICompareMergeController.getContentViewerInput()
public INavigationProvider getNavigationProvider()
ICompareMergeController
getNavigationProvider
in interface ICompareMergeController
null
if noneICompareMergeController.getNavigationProvider()
public org.eclipse.jface.viewers.ISelectionProvider getSelectionProvider()
ICompareMergeController
getSelectionProvider
in interface ICompareMergeController
null
if noneICompareMergeController.getSelectionProvider()
public MergeSessionInfo getSessionInfo()
ICompareMergeController
getSessionInfo
in interface ICompareMergeController
ICompareMergeController.getSessionInfo()
public boolean isMergeCompleted()
ICompareMergeController
isMergeCompleted
in interface ICompareMergeController
true
if all conflicts are resolvedICompareMergeController.isMergeCompleted()
public boolean canSaveMergedContributor()
ICompareMergeController
canSaveMergedContributor
in interface ICompareMergeController
ICompareMergeController.canSaveMergedContributor()
public void saveMergedContributor() throws org.eclipse.core.runtime.CoreException
ICompareMergeController
saveMergedContributor
in interface ICompareMergeController
org.eclipse.core.runtime.CoreException
- in case of the file I/O errorICompareMergeController.saveMergedContributor()
public void saveMergedContributorCopy()
ICompareMergeController
saveMergedContributorCopy
in interface ICompareMergeController
ICompareMergeController.saveMergedContributorCopy()
protected void saveMergedContributorCopy(boolean saveToFolder, java.lang.String message)
public boolean canSaveMergedContributorAs(ContributorType contributor)
ICompareMergeController
canSaveMergedContributorAs
in interface ICompareMergeController
contributor
- to checkICompareMergeController.canSaveMergedContributorAs(com.ibm.xtools.comparemerge.core.utils.ContributorType)
public void saveMergedContributorAs(ContributorType contributor) throws org.eclipse.core.runtime.CoreException
ICompareMergeController
saveMergedContributorAs
in interface ICompareMergeController
contributor
- to save on top oforg.eclipse.core.runtime.CoreException
- in case of errorICompareMergeController.saveMergedContributorAs(com.ibm.xtools.comparemerge.core.utils.ContributorType)
public void saveDeltas()
ICompareMergeController
saveDeltas
in interface ICompareMergeController
ICompareMergeController.saveDeltas()
public com.ibm.xtools.comparemerge.ui.internal.tasks.ICMTaskFactory getCMTaskFactory()
ICompareMergeController
getCMTaskFactory
in interface ICompareMergeController
ICMTaskFactory
ICompareMergeController.getCMTaskFactory()
protected abstract void doSaveDeltas(java.lang.String toPath) throws java.io.IOException
toPath
- the file path to save tojava.io.IOException
- if i/o error occuredprotected abstract void doSaveDeltas2(java.lang.String toPath) throws java.io.IOException
toPath
- the file path to save tojava.io.IOException
- if i/o error occuredpublic boolean isMergeMode()
ICompareMergeController
isMergeMode
in interface ICompareMergeController
ICompareMergeController.isMergeMode()
public boolean isThreeWayMode()
ICompareMergeController
isThreeWayMode
in interface ICompareMergeController
ICompareMergeController.isThreeWayMode()
public boolean isContributorVisible(ContributorType contributor)
ICompareMergeController
isContributorVisible
in interface ICompareMergeController
contributor
- the contributor type (for e.g.
ContributorType.ANCESTOR
)true
if the specified contributor should be shown,
false otherwiseICompareMergeController.isContributorVisible(com.ibm.xtools.comparemerge.core.utils.ContributorType)
public void setProperty(java.lang.String key, java.lang.Object newValue)
PropertyChangeEvent
is sent to registered listeners.setProperty
in interface ICompareMergeController
key
- the name of the property to setnewValue
- the new value of the propertypublic java.lang.Object getProperty(java.lang.String key)
null
if no
such property exists.getProperty
in interface ICompareMergeController
key
- the name of the property to retrievenull
if not
foundpublic void addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
ICompareMergeController
addPropertyChangeListener
in interface ICompareMergeController
addPropertyChangeListener
in interface org.eclipse.compare.IPropertyChangeNotifier
IPropertyChangeNotifier.addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
public void removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
ICompareMergeController
removePropertyChangeListener
in interface ICompareMergeController
removePropertyChangeListener
in interface org.eclipse.compare.IPropertyChangeNotifier
IPropertyChangeNotifier.removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
public void commandManagerChanged(CommandManagerChangeEvent event)
ICommandManagerChangeListener
commandManagerChanged
in interface ICommandManagerChangeListener
event
- The command manager change event to be handled.ICommandManagerChangeListener.commandManagerChanged(com.ibm.xtools.comparemerge.core.command.CommandManagerChangeEvent)
public abstract ICommand getAcceptCommand(java.lang.String label, ContributorType source, IContentViewerInput input)
ICompareMergeController
getAcceptCommand
in interface ICompareMergeController
label
- for the new ICommand.source
- the source contributor (for e.g.
ContributorType.LEFT
) to accept the Difference
frominput
- the compare merge input object that holds the Difference to be
acceptednull
if noneICompareMergeController.getAcceptCommand(java.lang.String,
com.ibm.xtools.comparemerge.core.utils.ContributorType,
com.ibm.xtools.comparemerge.ui.controller.IContentViewerInput)
public abstract ICommand getAcceptAllCommand(java.lang.String label, ContributorType source)
ICompareMergeController
getAcceptAllCommand
in interface ICompareMergeController
label
- for the new ICommand.source
- the source contributor (for e.g.
ContributorType.LEFT
) to accept all Diffs
from.null
if noneICompareMergeController.getAcceptAllCommand(java.lang.String,
com.ibm.xtools.comparemerge.core.utils.ContributorType)
public abstract ICommand getAcceptAllNonconflictingCommand(java.lang.String label)
ICompareMergeController
getAcceptAllNonconflictingCommand
in interface ICompareMergeController
null
if noneICompareMergeController.getAcceptAllNonconflictingCommand(java.lang.String)
public abstract ICommand getRejectCommand(java.lang.String label, ContributorType source, IContentViewerInput input)
ICompareMergeController
getRejectCommand
in interface ICompareMergeController
label
- for the new ICommand.source
- the contributor (for e.g. ContributorType.LEFT
)
to rejects the Difference frominput
- the compare merge input object that holds the Difference to be
rejectednull
if noneICompareMergeController.getRejectCommand(java.lang.String,
com.ibm.xtools.comparemerge.core.utils.ContributorType,
com.ibm.xtools.comparemerge.ui.controller.IContentViewerInput)
public abstract ICommand getRejectAllCommand(java.lang.String label, ContributorType contributor)
ICompareMergeController
getRejectAllCommand
in interface ICompareMergeController
label
- for the new ICommand.contributor
- to reject all Differences fromnull
if noneICompareMergeController.getRejectAllCommand(java.lang.String,
com.ibm.xtools.comparemerge.core.utils.ContributorType)
public abstract ICommand getResolveCommand(java.lang.String label, ContributorType contributor, IContentViewerInput input)
ICompareMergeController
getResolveCommand
in interface ICompareMergeController
label
- for the new ICommand.contributor
- to reject all Differences frominput
- the compare merge input object that holds the Conflict to be
resolvednull
if noneICompareMergeController.getResolveCommand(java.lang.String,
com.ibm.xtools.comparemerge.core.utils.ContributorType,
com.ibm.xtools.comparemerge.ui.controller.IContentViewerInput)
public abstract ICommand getResolveAllCommand(java.lang.String label, ContributorType contributor)
ICompareMergeController
getResolveAllCommand
in interface ICompareMergeController
label
- for the new ICommand.contributor
- to resolve all Conflicts withnull
if noneICompareMergeController.getResolveAllCommand(java.lang.String,
com.ibm.xtools.comparemerge.core.utils.ContributorType)
public abstract ICommand getIgnoreCommand(java.lang.String label, IContentViewerInput input)
ICompareMergeController
getIgnoreCommand
in interface ICompareMergeController
label
- for the new ICommand.input
- the compare merge input object that holds the Conflict to be
ignorednull
if noneICompareMergeController.getIgnoreCommand(java.lang.String,
com.ibm.xtools.comparemerge.ui.controller.IContentViewerInput)
public abstract ICommand getIgnoreAllCommand(java.lang.String label)
ICompareMergeController
getIgnoreAllCommand
in interface ICompareMergeController
label
- for the new ICommand.null
if noneICompareMergeController.getIgnoreAllCommand(java.lang.String)
public void resumeUpdates()
ICompareMergeController
resumeUpdates
in interface ICompareMergeController
ICompareMergeController.resumeUpdates()
public void suspendUpdates()
ICompareMergeController
suspendUpdates
in interface ICompareMergeController
ICompareMergeController.suspendUpdates()
public boolean wasSaved()
wasSaved
in interface ICompareMergeController
protected boolean canSaveToLeftOrRight()
protected static <T> T getAdapter(java.lang.Object v, java.lang.Class<T> clazz)