CloneSet434


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
63250.979class_body_declaration
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
163981
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
2631162
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
Clone Instance
1
Line Count
63
Source Line
981
Source File
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);
        }


Clone Instance
2
Line Count
63
Source Line
1162
Source File
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java

        /**
         * 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);
        }


Clone AbstractionParameter Count: 5Parameter Bindings

/**
         * 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 Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#515d41a0]]
NextSubWordAction 
12[[#515d41a0]]
PreviousSubWordAction 
21[[#515d4120]]
int code 
22[[#515d4120]]
final int code 
31[[#515d40c0]]
next 
32[[#515d40c0]]
previous 
41[[#515d4060]]
findNextPosition 
42[[#515d4060]]
findPreviousPosition 
51[[#ba671fc0]]
following 
52[[#ba671fc0]]
preceding