This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 216534
Collapse All | Expand All

(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/callhierarchy/CallHierarchyTasks.java (-2 / +2 lines)
Lines 336-342 Link Here
336
                Set<FileObject> relevantFiles = null;
336
                Set<FileObject> relevantFiles = null;
337
                if (!isCanceled()) {
337
                if (!isCanceled()) {
338
                    relevantFiles = JavaWhereUsedQueryPlugin.getRelevantFiles(
338
                    relevantFiles = JavaWhereUsedQueryPlugin.getRelevantFiles(
339
                            sourceToQuery, cpInfo, false, false, false, true, null, isCanceled);
339
                            sourceToQuery, cpInfo, false, false, false, false, true, null, isCanceled);
340
                    if (SourceUtils.isScanInProgress()) {
340
                    if (SourceUtils.isScanInProgress()) {
341
                        elmDesc.setIncomplete(true);
341
                        elmDesc.setIncomplete(true);
342
                    }
342
                    }
Lines 360-366 Link Here
360
                // XXX log it
360
                // XXX log it
361
                return;
361
                return;
362
            }
362
            }
363
            FindUsagesVisitor findVisitor = new FindUsagesVisitor(javac, isCanceled, false);
363
            FindUsagesVisitor findVisitor = new FindUsagesVisitor(javac, isCanceled, false, false);
364
            findVisitor.scan(javac.getCompilationUnit(), wanted);
364
            findVisitor.scan(javac.getCompilationUnit(), wanted);
365
            Collection<TreePath> usages = findVisitor.getUsages();
365
            Collection<TreePath> usages = findVisitor.getUsages();
366
            Map<Element, OccurrencesDesc> refs = new HashMap<Element, OccurrencesDesc>();
366
            Map<Element, OccurrencesDesc> refs = new HashMap<Element, OccurrencesDesc>();
(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/FindUsagesVisitor.java (-6 / +28 lines)
Lines 80-108 Link Here
80
    private List<WhereUsedElement> elements = new ArrayList<WhereUsedElement>();
80
    private List<WhereUsedElement> elements = new ArrayList<WhereUsedElement>();
81
    protected CompilationController workingCopy;
81
    protected CompilationController workingCopy;
82
    private boolean findInComments = false;
82
    private boolean findInComments = false;
83
    private final boolean isSearchOverloadedMethods;
83
    private final boolean fromTestRoot;
84
    private final boolean fromTestRoot;
84
    private final AtomicBoolean inImport;
85
    private final AtomicBoolean inImport;
85
    private Boolean usagesInComments;
86
    private Boolean usagesInComments;
86
    private final AtomicBoolean isCancelled;
87
    private final AtomicBoolean isCancelled;
88
    private List<ExecutableElement> methods;
87
89
88
    public FindUsagesVisitor(CompilationController workingCopy, AtomicBoolean isCancelled) {
90
    public FindUsagesVisitor(CompilationController workingCopy, AtomicBoolean isCancelled) {
89
        this(workingCopy, isCancelled, false);
91
        this(workingCopy, isCancelled, false, false);
90
    }
92
    }
91
    
93
    
92
    public FindUsagesVisitor(CompilationController workingCopy, AtomicBoolean isCancelled, boolean findInComments) {
94
    public FindUsagesVisitor(CompilationController workingCopy, AtomicBoolean isCancelled, boolean findInComments, boolean isSearchOverloadedMethods) {
93
        this(workingCopy, isCancelled, findInComments, RefactoringUtils.isFromTestRoot(workingCopy.getFileObject(), workingCopy.getClasspathInfo().getClassPath(PathKind.SOURCE)), new AtomicBoolean());
95
        this(workingCopy, isCancelled, findInComments, isSearchOverloadedMethods, RefactoringUtils.isFromTestRoot(workingCopy.getFileObject(), workingCopy.getClasspathInfo().getClassPath(PathKind.SOURCE)), new AtomicBoolean());
94
    }
96
    }
95
97
96
    public FindUsagesVisitor(CompilationController workingCopy, AtomicBoolean isCancelled, boolean findInComments, boolean fromTestRoot, AtomicBoolean inImport) {
98
    public FindUsagesVisitor(CompilationController workingCopy, AtomicBoolean isCancelled, boolean findInComments, boolean isSearchOverloadedMethods, boolean fromTestRoot, AtomicBoolean inImport) {
97
        try {
99
        try {
98
            setWorkingCopy(workingCopy);
100
            setWorkingCopy(workingCopy);
99
        } catch (ToPhaseException ex) {
101
        } catch (ToPhaseException ex) {
100
            Exceptions.printStackTrace(ex);
102
            Exceptions.printStackTrace(ex);
101
        }
103
        }
102
        this.findInComments = findInComments;
104
        this.findInComments = findInComments;
105
        this.isSearchOverloadedMethods = isSearchOverloadedMethods;
103
        this.fromTestRoot = fromTestRoot;
106
        this.fromTestRoot = fromTestRoot;
104
        this.inImport = inImport;
107
        this.inImport = inImport;
105
        this.isCancelled = isCancelled;
108
        this.isCancelled = isCancelled;
109
        this.methods = new LinkedList<ExecutableElement>();
106
    }
110
    }
107
111
108
    //<editor-fold defaultstate="collapsed" desc="Find in Comments">
112
    //<editor-fold defaultstate="collapsed" desc="Find in Comments">
Lines 134-139 Link Here
134
                }
138
                }
135
            }
139
            }
136
        }
140
        }
141
        if(p.getKind() == ElementKind.METHOD || p.getKind() == ElementKind.CONSTRUCTOR) {
142
            ExecutableElement method = (ExecutableElement) p;
143
            methods.add(method);
144
            TypeElement enclosingTypeElement = workingCopy.getElementUtilities().enclosingTypeElement(method);
145
            if(isSearchOverloadedMethods) {
146
                for (Element overloaded : enclosingTypeElement.getEnclosedElements()) {
147
                    if(method != overloaded &&
148
                            method.getKind() == overloaded.getKind() &&
149
                            ((ExecutableElement)overloaded).getSimpleName().contentEquals(method.getSimpleName())) {
150
                        methods.add((ExecutableElement)overloaded);
151
                    }
152
                }
153
            }
154
        }
137
        return super.visitCompilationUnit(node, p);
155
        return super.visitCompilationUnit(node, p);
138
    }
156
    }
139
    //</editor-fold>
157
    //</editor-fold>
Lines 190-197 Link Here
190
            }
208
            }
191
        }
209
        }
192
        if (elementToFind != null && elementToFind.getKind() == ElementKind.METHOD && el.getKind() == ElementKind.METHOD) {
210
        if (elementToFind != null && elementToFind.getKind() == ElementKind.METHOD && el.getKind() == ElementKind.METHOD) {
193
            if (el.equals(elementToFind) || workingCopy.getElements().overrides((ExecutableElement) el, (ExecutableElement) elementToFind, (TypeElement) elementToFind.getEnclosingElement())) {
211
            for (ExecutableElement executableElement : methods) {
194
                addUsage(path);
212
                if (el.equals(executableElement) 
213
                        || workingCopy.getElements().overrides((ExecutableElement) el,
214
                        executableElement, (TypeElement) elementToFind.getEnclosingElement())) {
215
                    addUsage(path);
216
                }
195
            }
217
            }
196
        } else if (el.equals(elementToFind)) {
218
        } else if (el.equals(elementToFind)) {
197
            final ElementKind kind = elementToFind.getKind();
219
            final ElementKind kind = elementToFind.getKind();
(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/JavaWhereUsedQueryPlugin.java (-24 / +47 lines)
Lines 167-172 Link Here
167
                        isFindSubclasses(),
167
                        isFindSubclasses(),
168
                        isFindDirectSubclassesOnly(),
168
                        isFindDirectSubclassesOnly(),
169
                        isFindOverridingMethods(),
169
                        isFindOverridingMethods(),
170
                        isSearchOverloadedMethods(),
170
                        isFindUsages(),
171
                        isFindUsages(),
171
                        null, cancelRequested));
172
                        null, cancelRequested));
172
            }
173
            }
Lines 197-202 Link Here
197
                            isFindSubclasses(),
198
                            isFindSubclasses(),
198
                            isFindDirectSubclassesOnly(),
199
                            isFindDirectSubclassesOnly(),
199
                            isFindOverridingMethods(),
200
                            isFindOverridingMethods(),
201
                            isSearchOverloadedMethods(),
200
                            isFindUsages(), packages, cancelRequested));
202
                            isFindUsages(), packages, cancelRequested));
201
                }
203
                }
202
            }
204
            }
Lines 208-213 Link Here
208
                    isFindSubclasses(),
210
                    isFindSubclasses(),
209
                    isFindDirectSubclassesOnly(),
211
                    isFindDirectSubclassesOnly(),
210
                    isFindOverridingMethods(),
212
                    isFindOverridingMethods(),
213
                    isSearchOverloadedMethods(),
211
                    isFindUsages(),
214
                    isFindUsages(),
212
                    null,
215
                    null,
213
                    cancelRequested);
216
                    cancelRequested);
Lines 218-225 Link Here
218
    public static Set<FileObject> getRelevantFiles(
221
    public static Set<FileObject> getRelevantFiles(
219
            final TreePathHandle tph, final ClasspathInfo cpInfo,
222
            final TreePathHandle tph, final ClasspathInfo cpInfo,
220
            final boolean isFindSubclasses, final boolean isFindDirectSubclassesOnly,
223
            final boolean isFindSubclasses, final boolean isFindDirectSubclassesOnly,
221
            final boolean isFindOverridingMethods, final boolean isFindUsages,
224
            final boolean isFindOverridingMethods, final boolean isSearchOverloadedMethods,
222
            final Set<NonRecursiveFolder> folders, final AtomicBoolean cancel) {
225
            final boolean isFindUsages, final Set<NonRecursiveFolder> folders,
226
            final AtomicBoolean cancel) {
223
        final ClassIndex idx = cpInfo.getClassIndex();
227
        final ClassIndex idx = cpInfo.getClassIndex();
224
        final Set<FileObject> set = new TreeSet<FileObject>(new FileComparator());
228
        final Set<FileObject> set = new TreeSet<FileObject>(new FileComparator());
225
        final Set<NonRecursiveFolder> packages = (folders == null)? Collections.<NonRecursiveFolder>emptySet() : folders;
229
        final Set<NonRecursiveFolder> packages = (folders == null)? Collections.<NonRecursiveFolder>emptySet() : folders;
Lines 289-320 Link Here
289
                        //get type references from index
293
                        //get type references from index
290
                        set.addAll(idx.getResources(ElementHandle.create((TypeElement) el), EnumSet.of(ClassIndex.SearchKind.TYPE_REFERENCES, ClassIndex.SearchKind.IMPLEMENTORS), searchScopeType));
294
                        set.addAll(idx.getResources(ElementHandle.create((TypeElement) el), EnumSet.of(ClassIndex.SearchKind.TYPE_REFERENCES, ClassIndex.SearchKind.IMPLEMENTORS), searchScopeType));
291
                    }
295
                    }
292
                } else if (el.getKind() == ElementKind.METHOD && isFindOverridingMethods) {
296
                } else if (el.getKind() == ElementKind.METHOD) {
293
                    //Find overriding methods
297
                    ExecutableElement method = (ExecutableElement) el;
294
                    TypeElement type = (TypeElement) el.getEnclosingElement();
298
                    List<ExecutableElement> methods = new LinkedList<ExecutableElement>();
295
                    set.addAll(getImplementorsRecursive(idx, cpInfo, type, cancel));
299
                    methods.add(method);
296
                }
300
                    TypeElement enclosingTypeElement = info.getElementUtilities().enclosingTypeElement(method);
297
                if (el.getKind() == ElementKind.METHOD && isFindUsages) {
301
                    if(isSearchOverloadedMethods) {
298
                    //get method references for method and for all it's overriders
302
                        for (Element overloaded : enclosingTypeElement.getEnclosedElements()) {
299
                    Set<ElementHandle<TypeElement>> s = RefactoringUtils.getImplementorsAsHandles(idx, cpInfo, (TypeElement) el.getEnclosingElement(), cancel);
303
                            if(method != overloaded &&
300
                    for (ElementHandle<TypeElement> eh : s) {
304
                                    method.getKind() == overloaded.getKind() &&
301
                        if (cancel != null && cancel.get()) {
305
                                    ((ExecutableElement)overloaded).getSimpleName().contentEquals(method.getSimpleName())) {
302
                            set.clear();
306
                                methods.add((ExecutableElement)overloaded);
303
                            return;
307
                            }
304
                        }
308
                        }
305
                        TypeElement te = eh.resolve(info);
309
                    }
306
                        if (te == null) {
310
                    if (isFindOverridingMethods) {
307
                            continue;
311
                        //Find overriding methods
308
                        }
312
                        set.addAll(getImplementorsRecursive(idx, cpInfo, enclosingTypeElement, cancel));
309
                        for (Element e : te.getEnclosedElements()) {
313
                    }
310
                            if (e.getKind() == ElementKind.METHOD || e.getKind() == ElementKind.CONSTRUCTOR) {
314
                    if (isFindUsages) {
311
                                if (info.getElements().overrides((ExecutableElement) e, (ExecutableElement) el, te)) {
315
                        //get method references for method and for all it's overriders
312
                                    set.addAll(idx.getResources(ElementHandle.create(te), EnumSet.of(ClassIndex.SearchKind.METHOD_REFERENCES), searchScopeType));
316
                        Set<ElementHandle<TypeElement>> s = RefactoringUtils.getImplementorsAsHandles(idx, cpInfo, (TypeElement) method.getEnclosingElement(), cancel);
317
                        for (ElementHandle<TypeElement> eh : s) {
318
                            if (cancel != null && cancel.get()) {
319
                                set.clear();
320
                                return;
321
                            }
322
                            TypeElement te = eh.resolve(info);
323
                            if (te == null) {
324
                                continue;
325
                            }
326
                            for (Element e : te.getEnclosedElements()) {
327
                                if (e.getKind() == ElementKind.METHOD || e.getKind() == ElementKind.CONSTRUCTOR) {
328
                                    for (ExecutableElement executableElement : methods) {
329
                                        if (info.getElements().overrides((ExecutableElement) e, executableElement, te)) {
330
                                            set.addAll(idx.getResources(ElementHandle.create(te), EnumSet.of(ClassIndex.SearchKind.METHOD_REFERENCES), searchScopeType));
331
                                        }
332
                                    }
313
                                }
333
                                }
314
                            }
334
                            }
315
                        }
335
                        }
336
                        set.addAll(idx.getResources(ElementHandle.create((TypeElement) el.getEnclosingElement()), EnumSet.of(ClassIndex.SearchKind.METHOD_REFERENCES), searchScopeType)); //?????
316
                    }
337
                    }
317
                    set.addAll(idx.getResources(ElementHandle.create((TypeElement) el.getEnclosingElement()), EnumSet.of(ClassIndex.SearchKind.METHOD_REFERENCES), searchScopeType)); //?????
318
                } else if (el.getKind() == ElementKind.CONSTRUCTOR) {
338
                } else if (el.getKind() == ElementKind.CONSTRUCTOR) {
319
                    set.addAll(idx.getResources(ElementHandle.create((TypeElement) el.getEnclosingElement()), EnumSet.of(ClassIndex.SearchKind.TYPE_REFERENCES, ClassIndex.SearchKind.IMPLEMENTORS), searchScopeType));
339
                    set.addAll(idx.getResources(ElementHandle.create((TypeElement) el.getEnclosingElement()), EnumSet.of(ClassIndex.SearchKind.TYPE_REFERENCES, ClassIndex.SearchKind.IMPLEMENTORS), searchScopeType));
320
                }
340
                }
Lines 434-439 Link Here
434
    private boolean isFindOverridingMethods() {
454
    private boolean isFindOverridingMethods() {
435
        return refactoring.getBooleanValue(WhereUsedQueryConstants.FIND_OVERRIDING_METHODS);
455
        return refactoring.getBooleanValue(WhereUsedQueryConstants.FIND_OVERRIDING_METHODS);
436
    }
456
    }
457
    private boolean isSearchOverloadedMethods() {
458
        return refactoring.getBooleanValue(WhereUsedQueryConstants.SEARCH_OVERLOADED);
459
    }
437
    private boolean isSearchFromBaseClass() {
460
    private boolean isSearchFromBaseClass() {
438
        return refactoring.getBooleanValue(WhereUsedQueryConstants.SEARCH_FROM_BASECLASS);
461
        return refactoring.getBooleanValue(WhereUsedQueryConstants.SEARCH_FROM_BASECLASS);
439
    }
462
    }
Lines 505-511 Link Here
505
            final boolean fromTestRoot = RefactoringUtils.isFromTestRoot(compiler.getFileObject(), compiler.getClasspathInfo().getClassPath(ClasspathInfo.PathKind.SOURCE));
528
            final boolean fromTestRoot = RefactoringUtils.isFromTestRoot(compiler.getFileObject(), compiler.getClasspathInfo().getClassPath(ClasspathInfo.PathKind.SOURCE));
506
            AtomicBoolean inImport = new AtomicBoolean();
529
            AtomicBoolean inImport = new AtomicBoolean();
507
            if (isFindUsages()) {
530
            if (isFindUsages()) {
508
                FindUsagesVisitor findVisitor = new FindUsagesVisitor(compiler, cancelled, refactoring.getBooleanValue(WhereUsedQuery.SEARCH_IN_COMMENTS), fromTestRoot, inImport);
531
                FindUsagesVisitor findVisitor = new FindUsagesVisitor(compiler, cancelled, refactoring.getBooleanValue(WhereUsedQuery.SEARCH_IN_COMMENTS), isSearchOverloadedMethods(), fromTestRoot, inImport);
509
                findVisitor.scan(compiler.getCompilationUnit(), element);
532
                findVisitor.scan(compiler.getCompilationUnit(), element);
510
                Collection<WhereUsedElement> foundElements = findVisitor.getElements();
533
                Collection<WhereUsedElement> foundElements = findVisitor.getElements();
511
                for (WhereUsedElement el : foundElements) {
534
                for (WhereUsedElement el : foundElements) {
(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/Bundle.properties (+1 lines)
Lines 488-493 Link Here
488
ReplaceConstructorWithBuilder.jLabel1.text=&Builder Class Name:
488
ReplaceConstructorWithBuilder.jLabel1.text=&Builder Class Name:
489
ReplaceConstructorWithBuilderName=Replace Constructor With Builder
489
ReplaceConstructorWithBuilderName=Replace Constructor With Builder
490
ReplaceConstructorWithBuilderDescription=Replace Constructor {0} with Builder {1}
490
ReplaceConstructorWithBuilderDescription=Replace Constructor {0} with Builder {1}
491
WhereUsedPanelMethod.searchOverloaded.text=Include overloaded methods
491
LBL_BuilderParameter=Parameter
492
LBL_BuilderParameter=Parameter
492
LBL_BuilderSetterName=Setter Name
493
LBL_BuilderSetterName=Setter Name
493
LBL_BuilderDefaultValue=Default Value
494
LBL_BuilderDefaultValue=Default Value
(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanel.java (+8 lines)
Lines 278-283 Link Here
278
        }
278
        }
279
        return false;
279
        return false;
280
    }
280
    }
281
    
282
    public boolean isMethodSearchOverloaded() {
283
        if(panel instanceof WhereUsedPanelMethod) {
284
            WhereUsedPanelMethod methodPanel = (WhereUsedPanelMethod) panel;
285
            return methodPanel.isSearchOverloaded();
286
        }
287
        return false;
288
    }
281
289
282
    public boolean isClassSubTypes() {
290
    public boolean isClassSubTypes() {
283
        if(panel instanceof WhereUsedPanelClass) {
291
        if(panel instanceof WhereUsedPanelClass) {
(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanelMethod.form (-3 / +19 lines)
Lines 30-43 Link Here
30
              <Group type="103" groupAlignment="0" attributes="0">
30
              <Group type="103" groupAlignment="0" attributes="0">
31
                  <Component id="label" alignment="0" max="32767" attributes="0"/>
31
                  <Component id="label" alignment="0" max="32767" attributes="0"/>
32
                  <Component id="jComboBox1" max="32767" attributes="0"/>
32
                  <Component id="jComboBox1" max="32767" attributes="0"/>
33
                  <Group type="102" alignment="0" attributes="0">
33
                  <Group type="102" attributes="0">
34
                      <Group type="103" groupAlignment="0" attributes="0">
34
                      <Group type="103" groupAlignment="0" attributes="0">
35
                          <Component id="searchOverloaded" min="-2" max="-2" attributes="0"/>
35
                          <Component id="btn_usages_overriders" min="-2" max="-2" attributes="0"/>
36
                          <Component id="btn_usages_overriders" min="-2" max="-2" attributes="0"/>
36
                          <Component id="btn_usages" min="-2" max="-2" attributes="0"/>
37
                          <Component id="btn_usages" min="-2" max="-2" attributes="0"/>
37
                          <Component id="searchInComments" min="-2" max="-2" attributes="0"/>
38
                          <Component id="searchInComments" min="-2" max="-2" attributes="0"/>
38
                          <Component id="btn_overriders" alignment="0" min="-2" max="-2" attributes="0"/>
39
                          <Component id="btn_overriders" alignment="0" min="-2" max="-2" attributes="0"/>
39
                      </Group>
40
                      </Group>
40
                      <EmptySpace min="0" pref="33" max="32767" attributes="0"/>
41
                      <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
41
                  </Group>
42
                  </Group>
42
              </Group>
43
              </Group>
43
              <EmptySpace max="-2" attributes="0"/>
44
              <EmptySpace max="-2" attributes="0"/>
Lines 65-71 Link Here
65
              <Component id="btn_overriders" min="-2" max="-2" attributes="0"/>
66
              <Component id="btn_overriders" min="-2" max="-2" attributes="0"/>
66
              <EmptySpace max="-2" attributes="0"/>
67
              <EmptySpace max="-2" attributes="0"/>
67
              <Component id="btn_usages_overriders" min="-2" max="-2" attributes="0"/>
68
              <Component id="btn_usages_overriders" min="-2" max="-2" attributes="0"/>
68
              <EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
69
              <EmptySpace max="-2" attributes="0"/>
70
              <Component id="searchOverloaded" min="-2" max="-2" attributes="0"/>
71
              <EmptySpace max="-2" attributes="0"/>
69
          </Group>
72
          </Group>
70
      </Group>
73
      </Group>
71
    </DimensionLayout>
74
    </DimensionLayout>
Lines 150-154 Link Here
150
        </Property>
153
        </Property>
151
      </Properties>
154
      </Properties>
152
    </Component>
155
    </Component>
156
    <Component class="javax.swing.JCheckBox" name="searchOverloaded">
157
      <Properties>
158
        <Property name="selected" type="boolean" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
159
          <Connection code="((Boolean) RefactoringModule.getOption(&quot;searchOverloaded.whereUsed&quot;, Boolean.FALSE)).booleanValue()" type="code"/>
160
        </Property>
161
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
162
          <ResourceString bundle="org/netbeans/modules/refactoring/java/ui/Bundle.properties" key="WhereUsedPanelMethod.searchOverloaded.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
163
        </Property>
164
      </Properties>
165
      <Events>
166
        <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="searchOverloadedItemStateChanged"/>
167
      </Events>
168
    </Component>
153
  </SubComponents>
169
  </SubComponents>
154
</Form>
170
</Form>
(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedPanelMethod.java (-2 / +27 lines)
Lines 101-106 Link Here
101
        btn_usages = new javax.swing.JRadioButton();
101
        btn_usages = new javax.swing.JRadioButton();
102
        btn_overriders = new javax.swing.JRadioButton();
102
        btn_overriders = new javax.swing.JRadioButton();
103
        btn_usages_overriders = new javax.swing.JRadioButton();
103
        btn_usages_overriders = new javax.swing.JRadioButton();
104
        searchOverloaded = new javax.swing.JCheckBox();
104
105
105
        label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/refactoring/java/resources/warning_16.png"))); // NOI18N
106
        label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/refactoring/java/resources/warning_16.png"))); // NOI18N
106
        label.setText("<<Element>>"); // NOI18N
107
        label.setText("<<Element>>"); // NOI18N
Lines 129-134 Link Here
129
        buttonGroup1.add(btn_usages_overriders);
130
        buttonGroup1.add(btn_usages_overriders);
130
        org.openide.awt.Mnemonics.setLocalizedText(btn_usages_overriders, org.openide.util.NbBundle.getMessage(WhereUsedPanelMethod.class, "LBL_FindUsagesOverridingMethods")); // NOI18N
131
        org.openide.awt.Mnemonics.setLocalizedText(btn_usages_overriders, org.openide.util.NbBundle.getMessage(WhereUsedPanelMethod.class, "LBL_FindUsagesOverridingMethods")); // NOI18N
131
132
133
        searchOverloaded.setSelected(((Boolean) RefactoringModule.getOption("searchOverloaded.whereUsed", Boolean.FALSE)).booleanValue());
134
        org.openide.awt.Mnemonics.setLocalizedText(searchOverloaded, org.openide.util.NbBundle.getMessage(WhereUsedPanelMethod.class, "WhereUsedPanelMethod.searchOverloaded.text")); // NOI18N
135
        searchOverloaded.addItemListener(new java.awt.event.ItemListener() {
136
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
137
                searchOverloadedItemStateChanged(evt);
138
            }
139
        });
140
132
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
141
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
133
        this.setLayout(layout);
142
        this.setLayout(layout);
134
        layout.setHorizontalGroup(
143
        layout.setHorizontalGroup(
Lines 144-154 Link Here
144
                    .addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
153
                    .addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
145
                    .addGroup(layout.createSequentialGroup()
154
                    .addGroup(layout.createSequentialGroup()
146
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
155
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
156
                            .addComponent(searchOverloaded)
147
                            .addComponent(btn_usages_overriders)
157
                            .addComponent(btn_usages_overriders)
148
                            .addComponent(btn_usages)
158
                            .addComponent(btn_usages)
149
                            .addComponent(searchInComments)
159
                            .addComponent(searchInComments)
150
                            .addComponent(btn_overriders))
160
                            .addComponent(btn_overriders))
151
                        .addGap(0, 33, Short.MAX_VALUE)))
161
                        .addGap(0, 0, Short.MAX_VALUE)))
152
                .addContainerGap())
162
                .addContainerGap())
153
        );
163
        );
154
        layout.setVerticalGroup(
164
        layout.setVerticalGroup(
Lines 170-176 Link Here
170
                .addComponent(btn_overriders)
180
                .addComponent(btn_overriders)
171
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
181
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
172
                .addComponent(btn_usages_overriders)
182
                .addComponent(btn_usages_overriders)
173
                .addGap(8, 8, 8))
183
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
184
                .addComponent(searchOverloaded)
185
                .addContainerGap())
174
        );
186
        );
175
    }// </editor-fold>//GEN-END:initComponents
187
    }// </editor-fold>//GEN-END:initComponents
176
188
Lines 180-185 Link Here
180
        Boolean b = evt.getStateChange() == ItemEvent.SELECTED ? Boolean.TRUE : Boolean.FALSE;
192
        Boolean b = evt.getStateChange() == ItemEvent.SELECTED ? Boolean.TRUE : Boolean.FALSE;
181
        RefactoringModule.setOption("searchInComments.whereUsed", b); // NOI18N
193
        RefactoringModule.setOption("searchInComments.whereUsed", b); // NOI18N
182
    }//GEN-LAST:event_searchInCommentsItemStateChanged
194
    }//GEN-LAST:event_searchInCommentsItemStateChanged
195
196
    private void searchOverloadedItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_searchOverloadedItemStateChanged
197
        // used for change default value for searchOverloaded check-box.
198
        // The value is persisted and then used as default in next IDE run.
199
        Boolean b = evt.getStateChange() == ItemEvent.SELECTED ? Boolean.TRUE : Boolean.FALSE;
200
        RefactoringModule.setOption("searchOverloaded.whereUsed", b); // NOI18N
201
    }//GEN-LAST:event_searchOverloadedItemStateChanged
202
183
    // Variables declaration - do not modify//GEN-BEGIN:variables
203
    // Variables declaration - do not modify//GEN-BEGIN:variables
184
    private javax.swing.JRadioButton btn_overriders;
204
    private javax.swing.JRadioButton btn_overriders;
185
    private javax.swing.JRadioButton btn_usages;
205
    private javax.swing.JRadioButton btn_usages;
Lines 190-195 Link Here
190
    private javax.swing.JLabel label;
210
    private javax.swing.JLabel label;
191
    private javax.swing.JLabel lbl_usagesof;
211
    private javax.swing.JLabel lbl_usagesof;
192
    private javax.swing.JCheckBox searchInComments;
212
    private javax.swing.JCheckBox searchInComments;
213
    private javax.swing.JCheckBox searchOverloaded;
193
    // End of variables declaration//GEN-END:variables
214
    // End of variables declaration//GEN-END:variables
194
215
195
    @Override
216
    @Override
Lines 242-247 Link Here
242
    public boolean isSearchInComments() {
263
    public boolean isSearchInComments() {
243
        return searchInComments.isSelected();
264
        return searchInComments.isSelected();
244
    }
265
    }
266
    
267
    public boolean isSearchOverloaded() {
268
        return searchOverloaded.isSelected();
269
    }
245
270
246
    @SuppressWarnings("serial")
271
    @SuppressWarnings("serial")
247
    private static class ComboBoxRenderer extends JLabel implements ListCellRenderer, UIResource {
272
    private static class ComboBoxRenderer extends JLabel implements ListCellRenderer, UIResource {
(-)a/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/WhereUsedQueryUI.java (+11 lines)
Lines 149-154 Link Here
149
        } else if (kind.isClass() || kind.isInterface()) {
149
        } else if (kind.isClass() || kind.isInterface()) {
150
            setForClass();
150
            setForClass();
151
            return query.checkParameters();
151
            return query.checkParameters();
152
        } else if(kind == ElementKind.CONSTRUCTOR) {
153
            setForConstructor();
154
            return query.checkParameters();
152
        } else {
155
        } else {
153
            return null;
156
            return null;
154
        }
157
        }
Lines 160-165 Link Here
160
        query.putValue(WhereUsedQueryConstants.SEARCH_FROM_BASECLASS, panel.isMethodFromBaseClass());
163
        query.putValue(WhereUsedQueryConstants.SEARCH_FROM_BASECLASS, panel.isMethodFromBaseClass());
161
        query.putValue(WhereUsedQueryConstants.FIND_OVERRIDING_METHODS, panel.isMethodOverriders());
164
        query.putValue(WhereUsedQueryConstants.FIND_OVERRIDING_METHODS, panel.isMethodOverriders());
162
        query.putValue(WhereUsedQuery.FIND_REFERENCES, panel.isMethodFindUsages());
165
        query.putValue(WhereUsedQuery.FIND_REFERENCES, panel.isMethodFindUsages());
166
        query.putValue(WhereUsedQueryConstants.SEARCH_OVERLOADED, panel.isMethodSearchOverloaded());
167
    }
168
    
169
    private void setForConstructor() {
170
        query.putValue(WhereUsedQueryConstants.SEARCH_OVERLOADED, panel.isMethodSearchOverloaded());
163
    }
171
    }
164
172
165
    private void setForClass() {
173
    private void setForClass() {
Lines 176-181 Link Here
176
        } else if (kind.isClass() || kind.isInterface()) {
184
        } else if (kind.isClass() || kind.isInterface()) {
177
            setForClass();
185
            setForClass();
178
            return query.fastCheckParameters();
186
            return query.fastCheckParameters();
187
        } else if(kind == ElementKind.CONSTRUCTOR) {
188
            setForConstructor();
189
            return query.fastCheckParameters();
179
        } else {
190
        } else {
180
            return null;
191
            return null;
181
        }
192
        }

Return to bug 216534