Skip to content

Commit b53ea1d

Browse files
committed
Fix several warnings due to name clashes
Resolves warnings of kind "hiding field" by either * removing the variable if it is unnecessary or a duplicate, or * renaming the hiding or the hidden variable, or * making the method static in case a parameter is hiding a field.
1 parent f746493 commit b53ea1d

File tree

50 files changed

+293
-297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+293
-297
lines changed

bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/codemining/annotation/AnnotationCodeMiningProvider.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,22 @@ public void modelChanged(AnnotationModelEvent event) {
155155
private @Nullable IAnnotationAccessExtension annotationAccess= null;
156156

157157
@Override
158-
public CompletableFuture<List<? extends ICodeMining>> provideCodeMinings(ITextViewer viewer, IProgressMonitor monitor) {
159-
if (!(viewer instanceof ISourceViewerExtension5)) {
158+
public CompletableFuture<List<? extends ICodeMining>> provideCodeMinings(ITextViewer textViewer, IProgressMonitor monitor) {
159+
if (!(textViewer instanceof ISourceViewerExtension5)) {
160160
throw new IllegalArgumentException("Cannot attach to TextViewer without code mining support"); //$NON-NLS-1$
161161
}
162162

163163
if (!new AnnotationCodeMiningPreferences().isEnabled()) {
164164
return CompletableFuture.completedFuture(Collections.emptyList());
165165
}
166166

167-
this.viewer= viewer;
167+
this.viewer= textViewer;
168168

169-
final IAnnotationAccess annotationAccess= getAdapter(IAnnotationAccess.class);
170-
if (!(annotationAccess instanceof IAnnotationAccessExtension)) {
169+
if (getAdapter(IAnnotationAccess.class) instanceof IAnnotationAccessExtension annotationAccessExtension) {
170+
this.annotationAccess= annotationAccessExtension;
171+
} else {
171172
throw new IllegalStateException("annotationAccess must implement IAnnotationAccessExtension"); //$NON-NLS-1$
172173
}
173-
this.annotationAccess= (IAnnotationAccessExtension) annotationAccess;
174174

175175
return provideCodeMiningsInternal(monitor);
176176
}

bundles/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ExtensionBasedTextViewerConfiguration.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewe
9494
private ITextEditor editor;
9595
private Set<IContentType> resolvedContentTypes;
9696
private Set<IContentType> fallbackContentTypes = Set.of();
97-
private IDocument document;
97+
private IDocument watchedDocument;
9898

9999
private GenericEditorContentAssistant contentAssistant;
100100

@@ -187,8 +187,8 @@ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
187187
Set<IContentType> types = getContentTypes(sourceViewer.getDocument());
188188
contentAssistant = new GenericEditorContentAssistant(contentAssistProcessorTracker,
189189
registry.getContentAssistProcessors(sourceViewer, editor, types), types, fPreferenceStore);
190-
if (this.document != null) {
191-
associateTokenContentTypes(this.document);
190+
if (this.watchedDocument != null) {
191+
associateTokenContentTypes(this.watchedDocument);
192192
}
193193
watchDocument(sourceViewer.getDocument());
194194
return contentAssistant;
@@ -205,16 +205,16 @@ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceVie
205205
return super.getPresentationReconciler(sourceViewer);
206206
}
207207

208-
void watchDocument(IDocument documentParam) {
209-
if (document == documentParam) {
208+
void watchDocument(IDocument document) {
209+
if (this.watchedDocument == document) {
210210
return;
211211
}
212-
if (document != null) {
213-
document.removeDocumentPartitioningListener(this);
212+
if (this.watchedDocument != null) {
213+
this.watchedDocument.removeDocumentPartitioningListener(this);
214214
}
215215
if (document != null) {
216-
document = documentParam;
217-
associateTokenContentTypes(documentParam);
216+
this.watchedDocument = document;
217+
associateTokenContentTypes(document);
218218
document.addDocumentPartitioningListener(this);
219219
}
220220
}

bundles/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/markers/MarkerInformationControl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ public boolean hasContents() {
6565
}
6666

6767
@Override
68-
protected void createContent(Composite parent) {
69-
parent.setLayout(new RowLayout(SWT.VERTICAL));
70-
parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
71-
parent.setBackgroundMode(SWT.INHERIT_DEFAULT);
72-
this.parent = parent;
68+
protected void createContent(Composite parentComposite) {
69+
parentComposite.setLayout(new RowLayout(SWT.VERTICAL));
70+
parentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
71+
parentComposite.setBackgroundMode(SWT.INHERIT_DEFAULT);
72+
this.parent = parentComposite;
7373
}
7474

7575
private static Image getImage(IMarker marker) {

bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,8 +886,8 @@ private void copyFileStores(IContainer destination,
886886
if (fork) {
887887
WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
888888
@Override
889-
public void execute(IProgressMonitor monitor) {
890-
copyFileStores(stores, destinationPath, monitor);
889+
public void execute(IProgressMonitor operationMonitor) {
890+
copyFileStores(stores, destinationPath, operationMonitor);
891891
}
892892
};
893893
try {

bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/RenameResourceAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,8 @@ private void saveChangesAndDispose(IResource resource) {
549549
displayError(status.getMessage());
550550
} else if (!LTKLauncher.renameResource(newName, new StructuredSelection(inlinedResource))) {
551551
// LTK Launcher couldn't rename the resource
552-
IPath newPath = inlinedResource.getFullPath().removeLastSegments(1).append(newName);
553-
runWithNewPath(newPath, inlinedResource);
552+
IPath path = inlinedResource.getFullPath().removeLastSegments(1).append(newName);
553+
runWithNewPath(path, inlinedResource);
554554
}
555555
}
556556
inlinedResource = null;

bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/WorkspaceAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void displayError(String message) {
138138
* instance can be executed multiple times concurrently. This method must
139139
* not access or modify any mutable state on action class.
140140
*
141-
* @param monitor
141+
* @param mon
142142
* a progress monitor
143143
* @return The result of the execution
144144
*/

bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/ContainerGenerator.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
public class ContainerGenerator {
5757
private IPath containerFullPath;
5858

59-
private IContainer container;
59+
private IContainer generatedContainer;
6060

6161
/**
6262
* Creates a generator for the container resource (folder or project) at the
@@ -148,41 +148,41 @@ public IContainer generateContainer(IProgressMonitor monitor) throws CoreExcepti
148148
IDEWorkbenchPlugin.getPluginWorkspace().run(monitor1 -> {
149149
SubMonitor subMonitor = SubMonitor.convert(monitor1,
150150
IDEWorkbenchMessages.ContainerGenerator_progressMessage, containerFullPath.segmentCount());
151-
if (container != null) {
151+
if (generatedContainer != null) {
152152
return;
153153
}
154154

155155
// Does the container exist already?
156156
IWorkspaceRoot root = getWorkspaceRoot();
157-
container = (IContainer) root.findMember(containerFullPath);
158-
if (container != null) {
157+
generatedContainer = (IContainer) root.findMember(containerFullPath);
158+
if (generatedContainer != null) {
159159
return;
160160
}
161161

162162
// Create the container for the given path
163-
container = root;
163+
generatedContainer = root;
164164
for (int i = 0; i < containerFullPath.segmentCount(); i++) {
165165
String currentSegment = containerFullPath.segment(i);
166-
IResource resource = container.findMember(currentSegment);
166+
IResource resource = generatedContainer.findMember(currentSegment);
167167
if (resource != null) {
168168
if (resource.getType() == IResource.FILE) {
169169
String msg = NLS.bind(IDEWorkbenchMessages.ContainerGenerator_pathOccupied,
170170
resource.getFullPath().makeRelative());
171171
throw new CoreException(
172172
new Status(IStatus.ERROR, IDEWorkbenchPlugin.IDE_WORKBENCH, 1, msg, null));
173173
}
174-
container = (IContainer) resource;
174+
generatedContainer = (IContainer) resource;
175175
subMonitor.worked(1);
176176
} else if (i == 0) {
177177
IProject projectHandle = createProjectHandle(root, currentSegment);
178-
container = createProject(projectHandle, subMonitor.split(1));
178+
generatedContainer = createProject(projectHandle, subMonitor.split(1));
179179
} else {
180-
IFolder folderHandle = createFolderHandle(container, currentSegment);
181-
container = createFolder(folderHandle, subMonitor.split(1));
180+
IFolder folderHandle = createFolderHandle(generatedContainer, currentSegment);
181+
generatedContainer = createFolder(folderHandle, subMonitor.split(1));
182182
}
183183
}
184184
}, null, IResource.NONE, monitor);
185-
return container;
185+
return generatedContainer;
186186
}
187187

188188
/**

bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/FilteredResourcesSelectionDialog.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,26 +1036,26 @@ private ResourceFilter(IContainer container, IContainer searchContainer, boolean
10361036
if (filenamePattern.isEmpty()) // relative patterns don't need a file name
10371037
filenamePattern = "**"; //$NON-NLS-1$
10381038

1039-
String containerPattern = stringPattern.substring(isMatchPrefix(stringPattern) ? 1 : 0, sep);
1039+
String newContainerPattern = stringPattern.substring(isMatchPrefix(stringPattern) ? 1 : 0, sep);
10401040

10411041
if (searchContainer != null) {
10421042
relativeContainerPattern = new SearchPattern(
10431043
SearchPattern.RULE_EXACT_MATCH | SearchPattern.RULE_PATTERN_MATCH);
10441044
relativeContainerPattern
1045-
.setPattern(searchContainer.getFullPath().append(containerPattern).toString());
1045+
.setPattern(searchContainer.getFullPath().append(newContainerPattern).toString());
10461046
}
10471047

1048-
if (!containerPattern.startsWith(Character.toString('*'))) {
1048+
if (!newContainerPattern.startsWith(Character.toString('*'))) {
10491049
// bug 552418 - make the search always "root less", so that users don't need to
10501050
// type the initial "*/"
1051-
if (!containerPattern.startsWith(Character.toString(IPath.SEPARATOR))) {
1052-
containerPattern = IPath.SEPARATOR + containerPattern;
1051+
if (!newContainerPattern.startsWith(Character.toString(IPath.SEPARATOR))) {
1052+
newContainerPattern = IPath.SEPARATOR + newContainerPattern;
10531053
}
1054-
containerPattern = '*' + containerPattern;
1054+
newContainerPattern = '*' + newContainerPattern;
10551055
}
10561056
this.containerPattern = new SearchPattern(SearchPattern.RULE_EXACT_MATCH
10571057
| SearchPattern.RULE_PREFIX_MATCH | SearchPattern.RULE_PATTERN_MATCH);
1058-
this.containerPattern.setPattern(containerPattern);
1058+
this.containerPattern.setPattern(newContainerPattern);
10591059
}
10601060
if (isMatchPrefix(stringPattern)) {
10611061
filenamePattern = '>' + filenamePattern;

bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/ResourceListSelectionDialog.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -411,30 +411,29 @@ public void create() {
411411
*/
412412
@Override
413413
protected Control createDialogArea(Composite parent) {
414-
415-
Composite dialogArea = (Composite) super.createDialogArea(parent);
416-
Label l = new Label(dialogArea, SWT.NONE);
414+
Composite dialogAreaComposite = (Composite) super.createDialogArea(parent);
415+
Label l = new Label(dialogAreaComposite, SWT.NONE);
417416
l.setText(IDEWorkbenchMessages.ResourceSelectionDialog_label);
418417
GridData data = new GridData(GridData.FILL_HORIZONTAL);
419418
l.setLayoutData(data);
420419

421-
pattern = new Text(dialogArea, SWT.SINGLE | SWT.BORDER);
420+
pattern = new Text(dialogAreaComposite, SWT.SINGLE | SWT.BORDER);
422421
pattern.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
423-
l = new Label(dialogArea, SWT.NONE);
422+
l = new Label(dialogAreaComposite, SWT.NONE);
424423
l.setText(IDEWorkbenchMessages.ResourceSelectionDialog_matching);
425424
data = new GridData(GridData.FILL_HORIZONTAL);
426425
l.setLayoutData(data);
427-
resourceNames = new Table(dialogArea, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
426+
resourceNames = new Table(dialogAreaComposite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
428427
data = new GridData(GridData.FILL_BOTH);
429428
data.heightHint = 12 * resourceNames.getItemHeight();
430429
resourceNames.setLayoutData(data);
431430

432-
l = new Label(dialogArea, SWT.NONE);
431+
l = new Label(dialogAreaComposite, SWT.NONE);
433432
l.setText(IDEWorkbenchMessages.ResourceSelectionDialog_folders);
434433
data = new GridData(GridData.FILL_HORIZONTAL);
435434
l.setLayoutData(data);
436435

437-
folderNames = new Table(dialogArea, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
436+
folderNames = new Table(dialogAreaComposite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
438437
data = new GridData(GridData.FILL_BOTH);
439438
data.widthHint = 300;
440439
data.heightHint = 4 * folderNames.getItemHeight();
@@ -477,7 +476,7 @@ public void widgetDefaultSelected(SelectionEvent e) {
477476
});
478477

479478
if (getAllowUserToToggleDerived()) {
480-
showDerivedButton = new Button(dialogArea, SWT.CHECK);
479+
showDerivedButton = new Button(dialogAreaComposite, SWT.CHECK);
481480
showDerivedButton.setText(IDEWorkbenchMessages.ResourceSelectionDialog_showDerived);
482481
showDerivedButton.addSelectionListener(new SelectionAdapter() {
483482
@Override
@@ -489,8 +488,8 @@ public void widgetSelected(SelectionEvent e) {
489488
showDerivedButton.setSelection(getShowDerived());
490489
}
491490

492-
applyDialogFont(dialogArea);
493-
return dialogArea;
491+
applyDialogFont(dialogAreaComposite);
492+
return dialogAreaComposite;
494493
}
495494

496495
/**

bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/SaveAsDialog.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ private boolean validatePage() {
297297
}
298298
}
299299

300-
IStatus result = workspace.validateName(resourceName, IResource.FILE);
301-
if (!result.isOK()) {
302-
setErrorMessage(result.getMessage());
300+
IStatus resultStatus = workspace.validateName(resourceName, IResource.FILE);
301+
if (!resultStatus.isOK()) {
302+
setErrorMessage(resultStatus.getMessage());
303303
return false;
304304
}
305305

0 commit comments

Comments
 (0)