Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
63 | 2 | 5 | 0.979 | class_body_declaration |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 63 | 981 | plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java |
2 | 63 | 1162 | plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java |
| ||||
/** * Text navigation action to navigate to the next sub-word. * * @since 3.0 */ protected abstract class NextSubWordAction extends TextNavigationAction { protected JavaWordIterator fIterator = new JavaWordIterator(); /** * Creates a new next sub-word action. * * @param code Action code for the default operation. Must be an action code from @see org.eclipse.swt.custom.ST. */ protected NextSubWordAction(int code) { super(getSourceViewer().getTextWidget(), code); } /* * @see org.eclipse.jface.action.IAction#run() */ public void run() { // Check whether we are in a java code partition and the preference is enabled final IPreferenceStore store = getPreferenceStore(); if ( !store.getBoolean(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION)) { super.run(); return; } final ISourceViewer viewer = getSourceViewer(); final IDocument document = viewer.getDocument(); fIterator.setText((CharacterIterator) new DocumentCharacterIterator(document)); int position = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset()); if (position == -1) return; int next = findNextPosition(position); if (next != BreakIterator.DONE) { setCaretPosition(next); getTextWidget().showSelection(); fireSelectionChanged(); } } /** * Finds the next position after the given position. * * @param position the current position * @return the next position */ protected int findNextPosition(int position) { ISourceViewer viewer = getSourceViewer(); int widget = -1; while (position != BreakIterator.DONE && widget == -1) { // TODO: optimize position = fIterator.following(position); if (position != BreakIterator.DONE) widget = modelOffset2WidgetOffset(viewer, position); } return position; } /** * Sets the caret position to the sub-word boundary given with <code>position</code>. * * @param position Position where the action should move the caret */ protected abstract void setCaretPosition(int position); } |
| ||||
/** * Text navigation action to navigate to the previous sub-word. * * @since 3.0 */ protected abstract class PreviousSubWordAction extends TextNavigationAction { protected JavaWordIterator fIterator = new JavaWordIterator(); /** * Creates a new previous sub-word action. * * @param code Action code for the default operation. Must be an action code from @see org.eclipse.swt.custom.ST. */ protected PreviousSubWordAction( final int code) { super(getSourceViewer().getTextWidget(), code); } /* * @see org.eclipse.jface.action.IAction#run() */ public void run() { // Check whether we are in a java code partition and the preference is enabled final IPreferenceStore store = getPreferenceStore(); if ( !store.getBoolean(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION)) { super.run(); return; } final ISourceViewer viewer = getSourceViewer(); final IDocument document = viewer.getDocument(); fIterator.setText((CharacterIterator) new DocumentCharacterIterator(document)); int position = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset()); if (position == -1) return; int previous = findPreviousPosition(position); if (previous != BreakIterator.DONE) { setCaretPosition(previous); getTextWidget().showSelection(); fireSelectionChanged(); } } /** * Finds the previous position before the given position. * * @param position the current position * @return the previous position */ protected int findPreviousPosition(int position) { ISourceViewer viewer = getSourceViewer(); int widget = -1; while (position != BreakIterator.DONE && widget == -1) { // TODO: optimize position = fIterator.preceding(position); if (position != BreakIterator.DONE) widget = modelOffset2WidgetOffset(viewer, position); } return position; } /** * Sets the caret position to the sub-word boundary given with <code>position</code>. * * @param position Position where the action should move the caret */ protected abstract void setCaretPosition(int position); } |
| |||
/** * Text navigation action to navigate to the next sub-word. * * @since 3.0 */ /** * Text navigation action to navigate to the previous sub-word. * * @since 3.0 */ protected abstract class [[#variable515d41a0]]extends TextNavigationAction { protected JavaWordIterator fIterator = new JavaWordIterator(); /** * Creates a new next sub-word action. * * @param code Action code for the default operation. Must be an action code from @see org.eclipse.swt.custom.ST. */ /** * Creates a new previous sub-word action. * * @param code Action code for the default operation. Must be an action code from @see org.eclipse.swt.custom.ST. */ protected [[#variable515d41a0]]( [[#variable515d4120]]) { super(getSourceViewer().getTextWidget(), code); } /* * @see org.eclipse.jface.action.IAction#run() */ public void run() { // Check whether we are in a java code partition and the preference is enabled final IPreferenceStore store = getPreferenceStore(); if ( !store.getBoolean(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION)) { super.run(); return; } final ISourceViewer viewer = getSourceViewer(); final IDocument document = viewer.getDocument(); fIterator.setText((CharacterIterator) new DocumentCharacterIterator(document)); int position = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset()); if (position == -1) return; int [[#variable515d40c0]]= [[#variable515d4060]](position); if ( [[#variable515d40c0]]!= BreakIterator.DONE) { setCaretPosition( [[#variable515d40c0]]); getTextWidget().showSelection(); fireSelectionChanged(); } } /** * Finds the next position after the given position. * * @param position the current position * @return the next position */ /** * Finds the previous position before the given position. * * @param position the current position * @return the previous position */ protected int [[#variable515d4060]](int position) { ISourceViewer viewer = getSourceViewer(); int widget = -1; while (position != BreakIterator.DONE && widget == -1) { // TODO: optimize position = fIterator. [[#variableba671fc0]](position); if (position != BreakIterator.DONE) widget = modelOffset2WidgetOffset(viewer, position); } return position; } /** * Sets the caret position to the sub-word boundary given with <code>position</code>. * * @param position Position where the action should move the caret */ protected abstract void setCaretPosition(int position); } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#515d41a0]] | NextSubWordAction |
1 | 2 | [[#515d41a0]] | PreviousSubWordAction |
2 | 1 | [[#515d4120]] | int code |
2 | 2 | [[#515d4120]] | final int code |
3 | 1 | [[#515d40c0]] | next |
3 | 2 | [[#515d40c0]] | previous |
4 | 1 | [[#515d4060]] | findNextPosition |
4 | 2 | [[#515d4060]] | findPreviousPosition |
5 | 1 | [[#ba671fc0]] | following |
5 | 2 | [[#ba671fc0]] | preceding |