CloneSet232


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
79250.993type_declarations
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
17946
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/FindExceptionOccurrencesAction.java
27945
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/FindImplementOccurrencesAction.java
Clone Instance
1
Line Count
79
Source Line
46
Source File
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/FindExceptionOccurrencesAction.java

/**
 * Action to find all originators of a exception (e.g. method invocations, 
 * class casts, ...) for a given exception.
 * <p> 
 * This class may be instantiated; it is not intended to be subclassed.
 * </p>
 * 
 * @since 3.1
 */
public class FindExceptionOccurrencesAction extends SelectionDispatchAction {

        private JavaEditor fEditor;

        /**
         * Note: This constructor is for internal use only. Clients should not call this constructor.
         * 
         * @param editor the Java editor
         */
        public FindExceptionOccurrencesAction(JavaEditor editor) {
                this(editor.getEditorSite());
                fEditor = editor;
                setEnabled(getEditorInput(editor) != null);
        }

        /**
         * Creates a new <code>FindExceptionOccurrencesAction</code>. The action 
         * requires that the selection provided by the site's selection provider is of type 
         * <code>IStructuredSelection</code>.
         * 
         * @param site the site providing context information for this action
         */
        public FindExceptionOccurrencesAction(IWorkbenchSite site) {
                super(site);
                setText(ActionMessages.FindExceptionOccurrences_text);
                setToolTipText(ActionMessages.FindExceptionOccurrences_toolTip);
                PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_EXCEPTION_OCCURRENCES);
        }

        //---- Text Selection ----------------------------------------------------------------------

        /**
         * {@inheritDoc}
         */
        public void selectionChanged(ITextSelection selection) {
        }

        /**
         * {@inheritDoc}
         * 
         * @since 3.2
         */
        public void selectionChanged(IStructuredSelection selection) {
                setEnabled(getMember(selection) != null);
        }

        /* (non-JavaDoc)
         * Method declared in SelectionDispatchAction.
         */
        public final void run(ITextSelection ts) {
                IJavaElement input = getEditorInput(fEditor);
                if ( !ActionUtil.isProcessable(getShell(), input))
                        return;
                FindOccurrencesEngine engine = FindOccurrencesEngine.create(input, new ExceptionOccurrencesFinder());
                try {
                        String result = engine.run(ts.getOffset(), ts.getLength());
                        if (result != null)
                                showMessage(getShell(), fEditor, result);
                } catch (JavaModelException e) {
                        JavaPlugin.log(e);
                  }
        }

        private static IJavaElement getEditorInput(JavaEditor editor) {
                IEditorInput input = editor.getEditorInput();
                if (input instanceof IClassFileEditorInput)
                        return ((IClassFileEditorInput) input).getClassFile();
                return  JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(input);
        }

        private static void showMessage(Shell shell, JavaEditor editor, String msg) {
                IEditorStatusLine statusLine = (IEditorStatusLine) editor.getAdapter(IEditorStatusLine.class );
                if (statusLine != null)
                        statusLine.setMessage(true, msg, null);
                shell.getDisplay().beep();
        }

        private IMember getMember(IStructuredSelection selection) {
                return null;
        }
}




Clone Instance
2
Line Count
79
Source Line
45
Source File
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/FindImplementOccurrencesAction.java

/**
 * Action to find all implement occurrences of an extended class or an implemented interface.
 * <p> 
 * This class may be instantiated; it is not intended to be subclassed.
 * </p>
 * 
 * @since 3.1
 */
public class FindImplementOccurrencesAction extends SelectionDispatchAction {

        private JavaEditor fEditor;

        /**
         * Note: This constructor is for internal use only. Clients should not call this constructor.
         * 
         * @param editor the Java editor
         */
        public FindImplementOccurrencesAction(JavaEditor editor) {
                this(editor.getEditorSite());
                fEditor = editor;
                setEnabled(getEditorInput(editor) != null);
        }

        /**
         * Creates a new <code>FindImplementOccurrencesAction</code>. The action 
         * requires that the selection provided by the site's selection provider is of type 
         * <code>IStructuredSelection</code>.
         * 
         * @param site the site providing context information for this action
         */
        public FindImplementOccurrencesAction(IWorkbenchSite site) {
                super(site);
                setText(ActionMessages.FindImplementOccurrencesAction_text);
                setToolTipText(ActionMessages.FindImplementOccurrencesAction_toolTip);
                PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_IMPLEMENT_OCCURRENCES);
        }

        //---- Text Selection ----------------------------------------------------------------------

        /**
         * {@inheritDoc}
         */
        public void selectionChanged(ITextSelection selection) {
        }

        /**
         * {@inheritDoc}
         * 
         * @since 3.2
         */
        public void selectionChanged(IStructuredSelection selection) {
                setEnabled(getMember(selection) != null);
        }

        /*
         * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#run(org.eclipse.jface.text.ITextSelection)
         */
        public final void run(ITextSelection ts) {
                IJavaElement input = getEditorInput(fEditor);
                if ( !ActionUtil.isProcessable(getShell(), input))
                        return;
                FindOccurrencesEngine engine = FindOccurrencesEngine.create(input, new ImplementOccurrencesFinder());
                try {
                        String result = engine.run(ts.getOffset(), ts.getLength());
                        if (result != null)
                                showMessage(getShell(), fEditor, result);
                } catch (JavaModelException e) {
                        JavaPlugin.log(e);
                  }
        }

        private static IJavaElement getEditorInput(JavaEditor editor) {
                IEditorInput input = editor.getEditorInput();
                if (input instanceof IClassFileEditorInput)
                        return ((IClassFileEditorInput) input).getClassFile();
                return  JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(input);
        }

        private static void showMessage(Shell shell, JavaEditor editor, String msg) {
                IEditorStatusLine statusLine = (IEditorStatusLine) editor.getAdapter(IEditorStatusLine.class );
                if (statusLine != null)
                        statusLine.setMessage(true, msg, null);
                shell.getDisplay().beep();
        }

        private IMember getMember(IStructuredSelection selection) {
                return null;
        }
}




Clone AbstractionParameter Count: 5Parameter Bindings

/**
 * Action to find all implement occurrences of an extended class or an implemented interface.
 * <p> 
 * This class may be instantiated; it is not intended to be subclassed.
 * </p>
 * 
 * @since 3.1
 */
/**
 * Action to find all originators of a exception (e.g. method invocations, 
 * class casts, ...) for a given exception.
 * <p> 
 * This class may be instantiated; it is not intended to be subclassed.
 * </p>
 * 
 * @since 3.1
 */
public class [[#variableba6359c0]]extends SelectionDispatchAction {
  private JavaEditor fEditor;

  /**
           * Note: This constructor is for internal use only. Clients should not call this constructor.
           * 
           * @param editor the Java editor
           */
  public [[#variableba6359c0]](JavaEditor editor) {
    this(editor.getEditorSite());
    fEditor = editor;
    setEnabled(getEditorInput(editor) != null);
  }

  /**
           * Creates a new <code>FindImplementOccurrencesAction</code>. The action 
           * requires that the selection provided by the site's selection provider is of type 
           * <code>IStructuredSelection</code>.
           * 
           * @param site the site providing context information for this action
           */
  /**
           * Creates a new <code>FindExceptionOccurrencesAction</code>. The action 
           * requires that the selection provided by the site's selection provider is of type 
           * <code>IStructuredSelection</code>.
           * 
           * @param site the site providing context information for this action
           */
  public [[#variableba6359c0]](IWorkbenchSite site) {
    super(site);
    setText(ActionMessages. [[#variableba6358c0]]);
    setToolTipText(ActionMessages. [[#variableba635860]]);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds. [[#variable5fac0d60]]);
  }

  //---- Text Selection ----------------------------------------------------------------------
  /**
           * {@inheritDoc}
           */
  public void selectionChanged(ITextSelection selection) {
  }

  /**
           * {@inheritDoc}
           * 
           * @since 3.2
           */
  public void selectionChanged(IStructuredSelection selection) {
    setEnabled(getMember(selection) != null);
  }

  /*
           * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#run(org.eclipse.jface.text.ITextSelection)
           */
  /* (non-JavaDoc)
           * Method declared in SelectionDispatchAction.
           */
  public final void run(ITextSelection ts) {
    IJavaElement input = getEditorInput(fEditor);
    if ( !ActionUtil.isProcessable(getShell(), input))
      return;
    FindOccurrencesEngine engine = FindOccurrencesEngine.create(input, new [[#variableba6358a0]]());
    try {
      String result = engine.run(ts.getOffset(), ts.getLength());
      if (result != null)
        showMessage(getShell(), fEditor, result);
    }
    catch (JavaModelException e) {
      JavaPlugin.log(e);
    }
  }

  private static IJavaElement getEditorInput(JavaEditor editor) {
    IEditorInput input = editor.getEditorInput();
    if (input instanceof IClassFileEditorInput)
      return ((IClassFileEditorInput) input).getClassFile();
    return JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(input);
  }

  private static void showMessage(Shell shell, JavaEditor editor, String msg) {
    IEditorStatusLine statusLine = (IEditorStatusLine) editor.getAdapter(IEditorStatusLine.class );
    if (statusLine != null)
      statusLine.setMessage(true, msg, null);
    shell.getDisplay().beep();
  }

  private IMember getMember(IStructuredSelection selection) {
    return null;
  }
}


 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#ba6359c0]]
FindImplementOccurrencesAction 
12[[#ba6359c0]]
FindExceptionOccurrencesAction 
21[[#ba6358c0]]
FindImplementOccurrencesAction_text 
22[[#ba6358c0]]
FindExceptionOccurrences_text 
31[[#ba635860]]
FindImplementOccurrencesAction_toolTip 
32[[#ba635860]]
FindExceptionOccurrences_toolTip 
41[[#5fac0d60]]
FIND_IMPLEMENT_OCCURRENCES 
42[[#5fac0d60]]
FIND_EXCEPTION_OCCURRENCES 
51[[#ba6358a0]]
ImplementOccurrencesFinder 
52[[#ba6358a0]]
ExceptionOccurrencesFinder