Skip to content

Commit 1971370

Browse files
committed
Minor warning cleanups, increment bundle versions
1 parent 3112794 commit 1971370

10 files changed

Lines changed: 60 additions & 52 deletions

File tree

core/bundles/org.eclipse.wst.sse.core/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
33
Automatic-Module-Name: org.eclipse.wst.sse.core
44
Bundle-Name: %pluginName
55
Bundle-SymbolicName: org.eclipse.wst.sse.core; singleton:=true
6-
Bundle-Version: 1.2.1400.qualifier
6+
Bundle-Version: 1.2.1500.qualifier
77
Bundle-Activator: org.eclipse.wst.sse.core.internal.SSECorePlugin
88
Bundle-Vendor: %providerName
99
Bundle-Localization: plugin

core/bundles/org.eclipse.wst.sse.core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<groupId>org.eclipse.webtools.sourceediting</groupId>
2323
<artifactId>org.eclipse.wst.sse.core</artifactId>
24-
<version>1.2.1400-SNAPSHOT</version>
24+
<version>1.2.1500-SNAPSHOT</version>
2525
<packaging>eclipse-plugin</packaging>
2626

2727
<build>

core/bundles/org.eclipse.wst.sse.core/src-contentproperties/org/eclipse/wst/sse/internal/contentproperties/SimpleNodeOperator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2001, 2012 IBM Corporation and others.
2+
* Copyright (c) 2001, 2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -248,7 +248,7 @@ private Node getElementWithAttribute(Node first, String attName, String attValue
248248
if (m == null)
249249
continue;
250250
if (m.getNamedItem(attName) != null) {
251-
if (attValue.equals(((Attr) m.getNamedItem(attName)).getNodeValue()))
251+
if (attValue.equals(m.getNamedItem(attName).getNodeValue()))
252252
return navpoint;
253253
}
254254
NodeList childNodes = navpoint.getChildNodes();

core/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/FileBufferModelManager.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2001, 2024 IBM Corporation and others.
2+
* Copyright (c) 2001, 2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -288,7 +288,7 @@ public IContainer getRootLocation() {
288288
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(root));
289289
for (int i = 0; i < files.length; i++) {
290290
if ((files[i].getType() & IResource.FOLDER) == IResource.FOLDER) {
291-
if (fPath.isPrefixOf(((IFolder) files[i]).getFullPath())) {
291+
if (fPath.isPrefixOf(files[i].getFullPath())) {
292292
return (IFolder) files[i];
293293
}
294294
}
@@ -354,7 +354,7 @@ public void bufferDisposed(IFileBuffer buffer) {
354354
if (Logger.DEBUG_TEXTBUFFERLIFECYCLE) {
355355
Logger.log(Logger.INFO, "Discarded buffer: " + locationString(textBuffer) + " " + buffer + " " + ((ITextFileBuffer) buffer).getDocument()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
356356
}
357-
DocumentInfo info = (DocumentInfo) fDocumentMap.get(textBuffer.getDocument());
357+
DocumentInfo info = fDocumentMap.get(textBuffer.getDocument());
358358
if (info != null) {
359359
info.bufferReferenceCount--;
360360
checkReferenceCounts(info, textBuffer.getDocument());
@@ -370,7 +370,7 @@ public void dirtyStateChanged(IFileBuffer buffer, boolean isDirty) {
370370
}
371371
if (!(textBuffer.getDocument() instanceof IStructuredDocument))
372372
return;
373-
DocumentInfo info = (DocumentInfo) fDocumentMap.get(textBuffer.getDocument());
373+
DocumentInfo info = fDocumentMap.get(textBuffer.getDocument());
374374
if (info != null && info.model != null) {
375375
String msg = "Updating model dirty state for" + locationString(textBuffer); //$NON-NLS-1$
376376
if (Logger.DEBUG_FILEBUFFERMODELMANAGEMENT || Logger.DEBUG_TEXTBUFFERLIFECYCLE) {
@@ -430,9 +430,9 @@ static synchronized final void shutdown() {
430430
FileBuffers.getTextFileBufferManager().removeFileBufferListener(instance.fFileBufferListener);
431431

432432
if (Logger.DEBUG_FILEBUFFERMODELMANAGEMENT || Logger.DEBUG_FILEBUFFERMODELLEAKS) {
433-
IDocument[] danglingDocuments = (IDocument[]) instance.fDocumentMap.keySet().toArray(new IDocument[0]);
433+
IDocument[] danglingDocuments = instance.fDocumentMap.keySet().toArray(new IDocument[0]);
434434
for (int i = 0; i < danglingDocuments.length; i++) {
435-
DocumentInfo info = (DocumentInfo) instance.fDocumentMap.get(danglingDocuments[i]);
435+
DocumentInfo info = instance.fDocumentMap.get(danglingDocuments[i]);
436436
if (info.modelReferenceCount > 0)
437437
System.err.println("LEAKED MODEL: " + locationString(info.buffer) + " " + (info.model != null ? info.model.getId() : null)); //$NON-NLS-1$ //$NON-NLS-2$
438438
if (info.bufferReferenceCount > 0)
@@ -446,13 +446,13 @@ static synchronized final void startup() {
446446
}
447447

448448
// a map of IStructuredDocuments to DocumentInfo objects
449-
Map fDocumentMap = null;
449+
Map<IDocument, DocumentInfo> fDocumentMap = null;
450450

451451
FileBufferMapper fFileBufferListener = new FileBufferMapper();
452452

453453
FileBufferModelManager() {
454454
super();
455-
fDocumentMap = new Hashtable(4);
455+
fDocumentMap = new Hashtable<>(4);
456456
}
457457

458458
public String calculateId(IFile file) {
@@ -507,7 +507,7 @@ public boolean connect(IDocument document) {
507507
Logger.logException(iae);
508508
return false;
509509
}
510-
DocumentInfo info = (DocumentInfo) fDocumentMap.get(document);
510+
DocumentInfo info = fDocumentMap.get(document);
511511
if (info == null)
512512
return false;
513513
ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
@@ -649,7 +649,7 @@ public boolean disconnect(IDocument document) {
649649
Logger.logException(iae);
650650
return false;
651651
}
652-
DocumentInfo info = (DocumentInfo) fDocumentMap.get(document);
652+
DocumentInfo info = fDocumentMap.get(document);
653653
if( info == null)
654654
return false;
655655
ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
@@ -676,14 +676,14 @@ public ITextFileBuffer getBuffer(IDocument document) {
676676
return null;
677677
}
678678

679-
DocumentInfo info = (DocumentInfo) fDocumentMap.get(document);
679+
DocumentInfo info = fDocumentMap.get(document);
680680
if (info != null)
681681
return info.buffer;
682682
return null;
683683
}
684684

685685
String getContentTypeID(IDocument document) {
686-
DocumentInfo info = (DocumentInfo) fDocumentMap.get(document);
686+
DocumentInfo info = fDocumentMap.get(document);
687687
if (info != null)
688688
return info.contentTypeID;
689689
return null;
@@ -706,7 +706,7 @@ IStructuredModel getModel(File file) {
706706
bufferManager.connect(location, LocationKind.LOCATION, getProgressMonitor());
707707
ITextFileBuffer buffer = bufferManager.getTextFileBuffer(location, LocationKind.LOCATION);
708708
if (buffer != null) {
709-
DocumentInfo info = (DocumentInfo) fDocumentMap.get(buffer.getDocument());
709+
DocumentInfo info = fDocumentMap.get(buffer.getDocument());
710710
if (info != null) {
711711
/*
712712
* Note: "info" being null means someone requested a
@@ -781,7 +781,7 @@ public IStructuredModel getModel(IFile file) {
781781
bufferManager.connect(location, LocationKind.IFILE, getProgressMonitor());
782782
ITextFileBuffer buffer = bufferManager.getTextFileBuffer(location, LocationKind.IFILE);
783783
if (buffer != null) {
784-
DocumentInfo info = (DocumentInfo) fDocumentMap.get(buffer.getDocument());
784+
DocumentInfo info = fDocumentMap.get(buffer.getDocument());
785785
if (info != null) {
786786
/*
787787
* Note: "info" being null means someone requested a
@@ -843,7 +843,7 @@ public IStructuredModel getModel(IStructuredDocument document) {
843843
return null;
844844
}
845845

846-
DocumentInfo info = (DocumentInfo) fDocumentMap.get(document);
846+
DocumentInfo info = fDocumentMap.get(document);
847847
if (info != null && info.model == null) {
848848
if (Logger.DEBUG_FILEBUFFERMODELMANAGEMENT) {
849849
Logger.log(Logger.INFO, "FileBufferModelManager creating model for " + locationString(info.buffer) + " " + info.buffer.getDocument()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -906,7 +906,7 @@ public boolean isExistingBuffer(IDocument document) {
906906
return false;
907907
}
908908

909-
DocumentInfo info = (DocumentInfo) fDocumentMap.get(document);
909+
DocumentInfo info = fDocumentMap.get(document);
910910
return info != null;
911911
}
912912

@@ -916,7 +916,7 @@ public void releaseModel(IDocument document) {
916916
Logger.logException(iae);
917917
return;
918918
}
919-
DocumentInfo info = (DocumentInfo) fDocumentMap.get(document);
919+
DocumentInfo info = fDocumentMap.get(document);
920920
if (info != null) {
921921
if (Logger.DEBUG_FILEBUFFERMODELMANAGEMENT) {
922922
Logger.log(Logger.INFO, "FileBufferModelManager noticed full release of model for " + locationString(info.buffer) + " " + info.buffer.getDocument()); //$NON-NLS-1$ //$NON-NLS-2$
@@ -954,7 +954,7 @@ public void revert(IDocument document) {
954954
Logger.logException(iae);
955955
return;
956956
}
957-
DocumentInfo info = (DocumentInfo) fDocumentMap.get(document);
957+
DocumentInfo info = fDocumentMap.get(document);
958958
if (info == null) {
959959
Logger.log(Logger.ERROR, "FileBufferModelManager was asked to revert a document that was not being managed"); //$NON-NLS-1$
960960
}

core/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/ltk/modelhandler/IModelHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2001, 2009 IBM Corporation and others.
2+
* Copyright (c) 2001, 2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -41,7 +41,7 @@ public interface IModelHandler extends IDocumentTypeHandler {
4141
String getAssociatedContentTypeId();
4242

4343
/**
44-
* The Loader is reponsible for decoding the Resource,
44+
* The Loader is responsible for decoding the Resource,
4545
*/
4646
IModelLoader getModelLoader();
4747

core/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/AbstractNotifier.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2001, 2010 IBM Corporation and others.
2+
* Copyright (c) 2001, 2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -110,11 +110,11 @@ public synchronized INodeAdapter getAdapterFor(Object type) {
110110
* Returns a shallow clone of list, since clients should not manipulate
111111
* our list directly. Instead, they should use add/removeAdapter.
112112
*/
113-
public synchronized Collection getAdapters() {
113+
public synchronized Collection<INodeAdapter> getAdapters() {
114114
if (fAdapters != null) {
115115
if (adapterCount == 0) {
116116
fAdapters = null;
117-
return Collections.EMPTY_LIST;
117+
return Collections.emptyList();
118118
}
119119
else {
120120
// we need to make a new array, to be sure
@@ -132,7 +132,7 @@ public synchronized Collection getAdapters() {
132132
}
133133
}
134134
else
135-
return Collections.EMPTY_LIST;
135+
return Collections.emptyList();
136136
}
137137

138138
private long getAdapterTimeCriteria() {
@@ -185,7 +185,7 @@ public void notify(int eventType, Object changedFeature, Object oldValue, Object
185185
}
186186
}
187187

188-
for (int i = 0; i < localAdapterCount; i++) {
188+
for (int i = 0; localAdapters != null && i < localAdapterCount; i++) {
189189
INodeAdapter a = localAdapters[i];
190190

191191
if (Logger.DEBUG_ADAPTERNOTIFICATIONTIME) {

core/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/text/JobSafeStructuredDocument.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2001, 2009 IBM Corporation and others.
2+
* Copyright (c) 2001, 2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -47,7 +47,7 @@ public void handleException(Throwable exception) {
4747
}
4848
}
4949

50-
private Stack fExecutionDelegates = new Stack();
50+
private Stack<IExecutionDelegate> fExecutionDelegates = new Stack<>();
5151
private ILock fLockable = Job.getJobManager().newLock();
5252

5353
public JobSafeStructuredDocument() {
@@ -69,7 +69,7 @@ protected final void acquireLock() {
6969

7070
private IExecutionDelegate getExecutionDelegate() {
7171
if (!fExecutionDelegates.isEmpty())
72-
return (IExecutionDelegate) fExecutionDelegates.peek();
72+
return fExecutionDelegates.peek();
7373
return null;
7474
}
7575

@@ -90,7 +90,7 @@ public ILock getLockObject() {
9090
protected final void releaseLock() {
9191
getLockObject().release();
9292
}
93-
93+
9494
/*
9595
* @see org.eclipse.jface.text.IDocument.replace(int, int, String)
9696
*/

core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/EditorExecutionContext.java

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2001, 2018 IBM Corporation and others.
2+
* Copyright (c) 2001, 2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -22,6 +22,7 @@
2222
import org.eclipse.core.runtime.SafeRunner;
2323
import org.eclipse.jface.operation.IRunnableWithProgress;
2424
import org.eclipse.swt.widgets.Display;
25+
import org.eclipse.ui.IEditorPart;
2526
import org.eclipse.ui.IWorkbench;
2627
import org.eclipse.ui.IWorkbenchPartSite;
2728
import org.eclipse.ui.IWorkbenchWindow;
@@ -37,12 +38,14 @@ class EditorExecutionContext implements IExecutionDelegate {
3738
* garbage creation. Will make use of the progress service if possible.
3839
*/
3940
private static class ReusableUIRunner implements Runnable, IRunnableWithProgress {
40-
private StructuredTextEditor editor;
41+
private StructuredTextEditor textEditor;
42+
private IEditorPart editorPart = null;
4143
private ISafeRunnable fRunnable = null;
4244

43-
ReusableUIRunner(StructuredTextEditor part) {
45+
ReusableUIRunner(IEditorPart editorPart, StructuredTextEditor textEditor) {
4446
super();
45-
editor = part;
47+
this.textEditor = textEditor;
48+
this.editorPart = editorPart;
4649
}
4750

4851
/*
@@ -51,7 +54,7 @@ private static class ReusableUIRunner implements Runnable, IRunnableWithProgress
5154
* @see java.lang.Runnable#run()
5255
*/
5356
public void run() {
54-
IWorkbenchPartSite site = editor.getEditorPart().getSite();
57+
IWorkbenchPartSite site = editorPart.getSite();
5558
final IWorkbenchWindow workbenchWindow = (site == null) ? null : site.getWorkbenchWindow();
5659
final IWorkbenchSiteProgressService jobService = (site == null) ? null : site.getAdapter(IWorkbenchSiteProgressService.class);
5760
/*
@@ -66,7 +69,7 @@ public void run() {
6669
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=165180
6770
*/
6871
try {
69-
jobService.runInUI(workbenchWindow, this, editor.getEditorPart().getEditorInput().getAdapter(IResource.class));
72+
jobService.runInUI(workbenchWindow, this, editorPart.getEditorInput().getAdapter(IResource.class));
7073
}
7174
catch (InvocationTargetException e) {
7275
Logger.logException(e);
@@ -88,7 +91,9 @@ public void run() {
8891
IWorkbench workbench = SSEUIPlugin.getInstance().getWorkbench();
8992
final Display display = workbench.getDisplay();
9093
if (display != null && !display.isDisposed()) {
91-
editor.beginBackgroundOperation();
94+
if (textEditor != null) {
95+
textEditor.beginBackgroundOperation();
96+
}
9297
try {
9398
/*
9499
* Here's where the document update/modification
@@ -102,7 +107,9 @@ public void run() {
102107
* particular update is done. Its up to the editor to
103108
* decide exactly when to leave its "background mode"
104109
*/
105-
editor.endBackgroundOperation();
110+
if (textEditor != null) {
111+
textEditor.endBackgroundOperation();
112+
}
106113
}
107114
}
108115
fRunnable = null;
@@ -126,13 +133,15 @@ void setRunnable(ISafeRunnable r) {
126133
}
127134
}
128135

129-
StructuredTextEditor fEditor;
136+
StructuredTextEditor fTextEditor;
137+
IEditorPart fEditorPart = null;
130138
private ReusableUIRunner fReusableRunner;
131139

132-
public EditorExecutionContext(StructuredTextEditor editor) {
140+
public EditorExecutionContext(IEditorPart editorPart, StructuredTextEditor editor) {
133141
super();
134-
fEditor = editor;
135-
fReusableRunner = new ReusableUIRunner(fEditor);
142+
fEditorPart = editorPart;
143+
fTextEditor = editor;
144+
fReusableRunner = new ReusableUIRunner(fEditorPart, fTextEditor);
136145
}
137146

138147
/*

0 commit comments

Comments
 (0)