|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel com.jidesoft.diff.AbstractDiffPane com.jidesoft.diff.AbstractMergePane com.jidesoft.diff.CodeEditorMergePane
public class CodeEditorMergePane
CodeEditorMergePane
is a merge pane based on CodeEditor
component in JIDE Code Editor
product. It can be used to compare three block of multiple line texts. The text will be displayed in a
CodeEditor
to have syntax coloring. It also uses the highlight features provided by
CodeEditor
to make it easy to see the differences and let user do the merging.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected com.jidesoft.diff.DiffMargin |
_fromDiffMargin
|
protected CodeEditor |
_fromEditor
|
protected com.jidesoft.diff.DiffMargin |
_otherDiffMargin
|
protected CodeEditor |
_otherEditor
|
protected CodeEditor |
_toEditor
|
protected int |
GAP_TITLE_PANE
|
Fields inherited from class com.jidesoft.diff.AbstractMergePane |
---|
_conflictedColor, COMMAND_ACCEPT |
Fields inherited from class com.jidesoft.diff.AbstractDiffPane |
---|
_actions, _changedColor, _deletedColor, _insertedColor, COMMAND_FIRST, COMMAND_LAST, COMMAND_NEXT, COMMAND_PREVIOUS |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
CodeEditorMergePane()
|
|
CodeEditorMergePane(String fromText,
String toText,
String otherText)
|
Method Summary | |
---|---|
protected List<Conflict> |
acceptConflict(List<Conflict> conflicts,
Difference c)
|
protected List<Conflict> |
acceptDocumentChange(List<Conflict> conflicts,
DocumentEvent e)
|
void |
acceptNonConflicts()
|
protected void |
adjustDividerOffset(DiffDivider divider,
int index)
Adjusts the DiffDivider's left and right offset. |
void |
clearMerge()
Clears the merge results. |
DiffDivider |
createDivider(int index)
Subclass implements it to create a DiffDivider that appears between the panes. |
protected CodeEditor |
createEditor()
|
protected CodeEditor |
createEditor(int index)
Creates the code editor. |
protected DiffDivider.RowConverter |
createFromRowConverter()
|
protected JComponent |
createFromTitle()
|
protected CharSequence |
createLineCharSequence(CodeEditor editor,
int lineIndex)
Creates the line char sequence for the code editor in the designated line. |
protected Merge<CharSequence> |
createMerge()
Creates the merge. |
protected DiffDivider.RowConverter |
createOtherRowConverter()
|
protected JComponent |
createOtherTitle()
|
JComponent |
createPane(Object item,
int index)
Subclass implements it to use a different component to display the objects to be compared. |
protected DiffDivider.RowConverter |
createToRowConverter()
|
protected JComponent |
createToTitle()
|
protected void |
customizeDivider(DiffDivider divider,
int index)
Customizes the newly created DiffDivider. |
protected void |
customizeEditor(CodeEditor editor,
int index)
|
void |
delete(int line,
int numberOfLines,
boolean runMergeAfterward)
|
protected void |
firstChange()
Goes to the first change. |
List<Conflict> |
getConflicts()
|
CodeEditor |
getFromEditor()
Gets the from code editor. |
CharSequence[] |
getFromItems()
Gets the from items to compare. |
String |
getFromText()
|
String |
getFromTitle()
|
protected List<Difference> |
getFromToDifferences(List<Conflict> conflicts)
|
CodeEditor |
getOtherEditor()
Gets the other code editor. |
CharSequence[] |
getOtherItems()
Gets the other items to compare. |
String |
getOtherText()
|
String |
getOtherTitle()
|
CodeEditor |
getToEditor()
Gets the to code editor. |
CharSequence[] |
getToItems()
Gets the to items to compare. |
protected List<Difference> |
getToOtherDifferences(List<Conflict> conflicts)
|
String |
getToText()
|
String |
getToTitle()
|
protected List<Conflict> |
ignoreConflict(List<Conflict> conflicts,
Difference c)
|
void |
insert(CodeEditor codeEditor,
int line,
int fromLine,
int fromNumberOfLines,
boolean runMergeAfterward)
|
protected void |
installListeners()
Installs the listeners. |
boolean |
isConflicted()
Checks if there is any conflicting changes during the merging process. |
boolean |
isIgnoreLeadingTrailingSpaces()
Gets the flag indicating if the leading and trailing spaces should be ignored when comparing two texts. |
boolean |
isReadOnly()
Checks if the diff pane is read only. |
protected void |
lastChange()
Goes to the last change. |
List<Conflict> |
merge()
|
protected List<Conflict> |
merge(String fromText,
String toText,
String otherText)
Deprecated. replaced by createMerge() . |
protected void |
nextChange()
Goes to the next change. |
protected void |
previousChange()
Goes to the previous change. |
void |
replace(CodeEditor codeEditor,
int line,
int numberOfLines,
int fromLine,
int fromNumberOfLines,
boolean runMergeAfterward)
|
void |
setChangedColor(Color changedColor)
|
void |
setConflictedColor(Color conflictedColor)
|
void |
setDeletedColor(Color deletedColor)
|
void |
setFromText(String fromText)
Sets the text for the from editor. |
void |
setFromTitle(String title)
|
void |
setIgnoreLeadingTrailingSpaces(boolean ignoreLeadingTrailingSpaces)
Sets the flag indicating if the leading and trailing spaces should be ignored when comparing two texts. |
void |
setInsertedColor(Color insertedColor)
|
void |
setOtherText(String otherText)
Sets the text for the other editor. |
void |
setOtherTitle(String title)
|
void |
setReadOnly(boolean readOnly)
Sets the read only flag. |
void |
setToText(String toText)
Sets the text for the to editor. |
void |
setToTitle(String title)
|
protected String[] |
splitString(String string,
String lineBreak)
Deprecated. replaced by createLineCharSequence(com.jidesoft.editor.CodeEditor, int) . |
protected void |
synchronizeViewport(DiffDivider diffDivider,
CodeEditor firstEditor,
CodeEditor secondEditor,
boolean changeFromFirst)
|
protected void |
updateActions(int index)
Updates the enable/disable states of the actions on the toolbar buttons. |
Methods inherited from class com.jidesoft.diff.AbstractMergePane |
---|
createActions, createLegendBar, customizeToolBar, getConflictedColor |
Methods inherited from class com.jidesoft.diff.AbstractDiffPane |
---|
createButton, createContentArea, createStatusBar, createToolBar, customizeAction, customizePane, customizePanes, flip, getChangedColor, getDeletedColor, getInsertedColor, getMessage, getResourceString, initLayout, setMessage, uninstallListeners |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final int GAP_TITLE_PANE
protected CodeEditor _fromEditor
protected CodeEditor _toEditor
protected CodeEditor _otherEditor
protected com.jidesoft.diff.DiffMargin _fromDiffMargin
protected com.jidesoft.diff.DiffMargin _otherDiffMargin
Constructor Detail |
---|
public CodeEditorMergePane()
public CodeEditorMergePane(String fromText, String toText, String otherText)
Method Detail |
---|
public JComponent createPane(Object item, int index)
AbstractDiffPane
createPane
in class AbstractDiffPane
item
- item to be compared. The component should be able to display the item.index
- the index of the pane. For example, for a type diff pane to compare two items before and after
modification, the index 0 will be the original item before modification, the index 1 will be the
item after modification.
public DiffDivider createDivider(int index)
AbstractDiffPane
createDivider
in class AbstractDiffPane
index
- the index of the DiffDivider
protected void customizeDivider(DiffDivider divider, int index)
AbstractDiffPane
customizeDivider
in class AbstractDiffPane
divider
- the diff dividerindex
- the index of the diff dividerpublic void setChangedColor(Color changedColor)
setChangedColor
in class AbstractDiffPane
public void setInsertedColor(Color insertedColor)
setInsertedColor
in class AbstractDiffPane
public void setDeletedColor(Color deletedColor)
setDeletedColor
in class AbstractDiffPane
public void setConflictedColor(Color conflictedColor)
setConflictedColor
in class AbstractMergePane
protected void adjustDividerOffset(DiffDivider divider, int index)
AbstractDiffPane
adjustDividerOffset
in class AbstractDiffPane
divider
- the DiffDivider.index
- the index of the DiffDivider.protected JComponent createFromTitle()
protected JComponent createToTitle()
protected JComponent createOtherTitle()
public String getFromTitle()
public void setFromTitle(String title)
public String getToTitle()
public void setToTitle(String title)
public String getOtherTitle()
public void setOtherTitle(String title)
protected CodeEditor createEditor(int index)
createEditor()
to create a CodeEditor instance.
index
- the code editor index
protected CodeEditor createEditor()
protected void customizeEditor(CodeEditor editor, int index)
public CodeEditor getFromEditor()
public CodeEditor getToEditor()
public CodeEditor getOtherEditor()
public CharSequence[] getFromItems()
public CharSequence[] getToItems()
public CharSequence[] getOtherItems()
protected CharSequence createLineCharSequence(CodeEditor editor, int lineIndex)
editor
- the code editorlineIndex
- the line number
public void setFromText(String fromText)
fromText
- the new text for the from editor.public String getFromText()
public void setToText(String toText)
toText
- the new text for the to editor.public String getToText()
public void setOtherText(String otherText)
otherText
- the new text for the other editor.public String getOtherText()
protected DiffDivider.RowConverter createFromRowConverter()
protected DiffDivider.RowConverter createToRowConverter()
protected DiffDivider.RowConverter createOtherRowConverter()
protected void synchronizeViewport(DiffDivider diffDivider, CodeEditor firstEditor, CodeEditor secondEditor, boolean changeFromFirst)
protected void updateActions(int index)
AbstractDiffPane
updateActions
in class AbstractDiffPane
index
- the pane index. This is the pane that triggers the update.protected void installListeners()
AbstractDiffPane
installListeners
in class AbstractDiffPane
@Deprecated protected String[] splitString(String string, String lineBreak)
createLineCharSequence(com.jidesoft.editor.CodeEditor, int)
.
string
- the stringlineBreak
- the line break@Deprecated protected List<Conflict> merge(String fromText, String toText, String otherText)
createMerge()
.
fromText
- the from texttoText
- the to textotherText
- the other text
protected Merge<CharSequence> createMerge()
public boolean isReadOnly()
public void setReadOnly(boolean readOnly)
readOnly
- the new read only flag.protected List<Difference> getFromToDifferences(List<Conflict> conflicts)
protected List<Difference> getToOtherDifferences(List<Conflict> conflicts)
public List<Conflict> getConflicts()
protected List<Conflict> acceptConflict(List<Conflict> conflicts, Difference c)
protected List<Conflict> ignoreConflict(List<Conflict> conflicts, Difference c)
protected List<Conflict> acceptDocumentChange(List<Conflict> conflicts, DocumentEvent e)
public List<Conflict> merge()
public void clearMerge()
public void delete(int line, int numberOfLines, boolean runMergeAfterward)
public void insert(CodeEditor codeEditor, int line, int fromLine, int fromNumberOfLines, boolean runMergeAfterward)
public void replace(CodeEditor codeEditor, int line, int numberOfLines, int fromLine, int fromNumberOfLines, boolean runMergeAfterward)
protected void firstChange()
AbstractDiffPane
firstChange
in class AbstractDiffPane
protected void previousChange()
AbstractDiffPane
previousChange
in class AbstractDiffPane
protected void nextChange()
AbstractDiffPane
nextChange
in class AbstractDiffPane
protected void lastChange()
AbstractDiffPane
lastChange
in class AbstractDiffPane
public void acceptNonConflicts()
acceptNonConflicts
in class AbstractMergePane
public boolean isConflicted()
acceptNonConflicts()
to accept all the changes.public boolean isIgnoreLeadingTrailingSpaces()
setIgnoreLeadingTrailingSpaces(boolean)
public void setIgnoreLeadingTrailingSpaces(boolean ignoreLeadingTrailingSpaces)
ignoreLeadingTrailingSpaces
- the flag
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |