diff --git a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/core/indexsearch/IIndexQuery.java b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/core/indexsearch/IIndexQuery.java index 3fcd8857767..3ea26e025a3 100644 --- a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/core/indexsearch/IIndexQuery.java +++ b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/core/indexsearch/IIndexQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. + * Copyright (c) 2003, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -14,12 +14,13 @@ package org.eclipse.core.indexsearch; import java.io.IOException; -import java.util.*; import java.util.ArrayList; +import java.util.HashSet; -import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.resources.IFile; + /** * An IndeyQuery is used to perform a query against the indexing framework. */ diff --git a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/Jsp2JavaReconcileStep.java b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/Jsp2JavaReconcileStep.java index f3c8a624759..93e26ddc753 100644 --- a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/Jsp2JavaReconcileStep.java +++ b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/Jsp2JavaReconcileStep.java @@ -18,6 +18,8 @@ import java.io.Reader; import java.io.StringReader; +import org.eclipse.jsp.JspTranslator; + import org.eclipse.core.runtime.Assert; import org.eclipse.jface.text.BadLocationException; @@ -26,13 +28,11 @@ import org.eclipse.jface.text.Position; import org.eclipse.jface.text.reconciler.AbstractReconcileStep; import org.eclipse.jface.text.reconciler.DirtyRegion; -import org.eclipse.jface.text.reconciler.IReconcileStep; -import org.eclipse.jface.text.reconciler.IReconcileResult; import org.eclipse.jface.text.reconciler.IReconcilableModel; +import org.eclipse.jface.text.reconciler.IReconcileResult; +import org.eclipse.jface.text.reconciler.IReconcileStep; import org.eclipse.jface.text.source.translation.ITranslator; -import org.eclipse.jsp.JspTranslator; - /** * This reconcile step has a JSP source document as * input model and maintains a document that contains the Java @@ -66,9 +66,6 @@ protected void initialize() { fJspTranslator.setTagHandlerFactory(new Jsp2JavaTagHandlerFactory()); } - /* - * @see AbstractReconcileStep#reconcileModel(DirtyRegion, IRegion) - */ @Override protected IReconcileResult[] reconcileModel(DirtyRegion dirtyRegion, IRegion subRegion) { Assert.isTrue(getInputModel() instanceof DocumentAdapter, "wrong model"); //$NON-NLS-1$ @@ -88,17 +85,11 @@ protected IReconcileResult[] reconcileModel(DirtyRegion dirtyRegion, IRegion sub return null; } - /* - * @see AbstractReconcileStep#getModel() - */ @Override public IReconcilableModel getModel() { return fModel; } - /* - * @see AbstractReconcileStep#convertToInputModel(IReconcileResult[]) - */ @Override protected IReconcileResult[] convertToInputModel(IReconcileResult[] inputResults) { diff --git a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/Jsp2JavaTagHandler.java b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/Jsp2JavaTagHandler.java index 20934f2c193..99884a541c7 100644 --- a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/Jsp2JavaTagHandler.java +++ b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/Jsp2JavaTagHandler.java @@ -37,17 +37,11 @@ public class Jsp2JavaTagHandler implements ITagHandler { private boolean fInJavaSection; - /* - * @see org.eclipse.jface.text.source.ITagHandler#canHandleTag(java.lang.String) - */ @Override public boolean canHandleTag(String tag) { return true; } - /* - * @see org.eclipse.jface.text.source.ITagHandler#canHandleText(java.lang.String) - */ @Override public boolean canHandleText(String text) { return true; @@ -60,9 +54,6 @@ public void reset(String startTag) { fInJavaSection= "<%".equals(startTag); //$NON-NLS-1$ fInDeclaration= "<%!".equals(startTag); //$NON-NLS-1$ } - /* - * @see org.eclipse.jface.text.source.ITagHandler#addAttribute(java.lang.String, java.lang.String) - */ @Override public void addAttribute(String name, String value, int sourceLineNumber) { if (fInUseBean) { @@ -78,9 +69,6 @@ else if ("class".equals(name)) //$NON-NLS-1$ fSource= value; } - /* - * @see org.eclipse.jface.text.source.ITagHandler#backTranslateOffsetInLine(java.lang.String, int) - */ @Override public int backTranslateOffsetInLine(String originalLine, String translatedLine, int offsetInTranslatedLine) { int javaPartitionStart= 0; @@ -128,9 +116,6 @@ private int handleUseBeanTag(String jspLineStr, int relativeLineOffsetInJava) { return javaPartitionStart - relativeLineOffsetInJava; } - /* - * @see org.eclipse.jface.text.source.ITagHandler#processEndTag(ITranslatorResultCollector, int) - */ @Override public void processEndTag(ITranslatorResultCollector resultCollector, int sourceLineNumber) throws IOException { Assert.isTrue(resultCollector instanceof JspTranslatorResultCollector); diff --git a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/Jsp2JavaTagHandlerFactory.java b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/Jsp2JavaTagHandlerFactory.java index e6a871a8b0b..2b2c73cc02e 100644 --- a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/Jsp2JavaTagHandlerFactory.java +++ b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/Jsp2JavaTagHandlerFactory.java @@ -27,18 +27,12 @@ public class Jsp2JavaTagHandlerFactory implements ITagHandlerFactory { private final ITagHandler fTagHandler= new Jsp2JavaTagHandler(); - /* - * @see org.eclipse.jface.text.source.IHandlerFactory#getHandler(java.lang.String) - */ @Override public ITagHandler getHandler(String tag) { fTagHandler.reset(tag); return fTagHandler; } - /* - * @see org.eclipse.jface.text.source.IHandlerFactory#findHandler(java.lang.String) - */ @Override public ITagHandler findHandler(String text) { return fTagHandler; diff --git a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/JspEditor.java b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/JspEditor.java index 280eda7f0f3..201692fdd55 100644 --- a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/JspEditor.java +++ b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/JspEditor.java @@ -16,11 +16,11 @@ import org.eclipse.jface.text.source.IAnnotationAccess; +import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess; + import org.eclipse.ui.editors.text.FileDocumentProvider; import org.eclipse.ui.editors.text.TextEditor; -import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess; - /** * A simple JSP Editor. @@ -46,9 +46,6 @@ public JspEditor() { // setPreferenceStore(JspUIPlugin.getDefault().getPreferenceStore()); } - /* - * @see TextEditor#createAnnotationAccess() - */ @Override protected IAnnotationAccess createAnnotationAccess() { return new DefaultMarkerAnnotationAccess(); diff --git a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/JspReconcilingStrategy.java b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/JspReconcilingStrategy.java index fd767c734e5..9c6f9dc0e6b 100644 --- a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/JspReconcilingStrategy.java +++ b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/JspReconcilingStrategy.java @@ -17,18 +17,19 @@ import java.lang.reflect.InvocationTargetException; import java.util.Iterator; -import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.resources.IFile; + import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.reconciler.DirtyRegion; -import org.eclipse.jface.text.reconciler.IReconcileStep; import org.eclipse.jface.text.reconciler.IReconcileResult; +import org.eclipse.jface.text.reconciler.IReconcileStep; import org.eclipse.jface.text.reconciler.IReconcilingStrategy; import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension; import org.eclipse.jface.text.source.Annotation; @@ -38,6 +39,7 @@ import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.actions.WorkspaceModifyOperation; + import org.eclipse.ui.texteditor.ITextEditor; /** @@ -57,35 +59,23 @@ public JspReconcilingStrategy(ISourceViewer sourceViewer, ITextEditor textEditor fFirstStep= new Jsp2JavaReconcileStep(javaReconcileStep); } - /* - * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#setDocument(org.eclipse.jface.text.IDocument) - */ @Override public void setDocument(IDocument document) { fFirstStep.setInputModel(new DocumentAdapter(document)); } - /* - * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.reconciler.DirtyRegion, org.eclipse.jface.text.IRegion) - */ @Override public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) { removeTemporaryAnnotations(); process(fFirstStep.reconcile(dirtyRegion, subRegion)); } - /* - * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.IRegion) - */ @Override public void reconcile(IRegion partition) { removeTemporaryAnnotations(); process(fFirstStep.reconcile(partition)); } - /* - * @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) - */ @Override public void setProgressMonitor(IProgressMonitor monitor) { fFirstStep.setProgressMonitor(monitor); @@ -93,9 +83,6 @@ public void setProgressMonitor(IProgressMonitor monitor) { } - /* - * @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#initialReconcile() - */ @Override public void initialReconcile() { fFirstStep.reconcile(null); @@ -108,9 +95,6 @@ private void process(final IReconcileResult[] results) { return; IRunnableWithProgress runnable= new WorkspaceModifyOperation(null) { - /* - * @see org.eclipse.ui.actions.WorkspaceModifyOperation#execute(org.eclipse.core.runtime.IProgressMonitor) - */ @Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { for (IReconcileResult r : results) { @@ -156,9 +140,9 @@ private void removeTemporaryAnnotations() { private IFile getFile() { IEditorInput input= fTextEditor.getEditorInput(); - if (!(input instanceof IFileEditorInput)) + if (!(input instanceof IFileEditorInput fileInput)) return null; - return ((IFileEditorInput)input).getFile(); + return fileInput.getFile(); } } diff --git a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/JspSourceViewerConfiguration.java b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/JspSourceViewerConfiguration.java index 4a987577307..4dda49e2ef8 100644 --- a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/JspSourceViewerConfiguration.java +++ b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jdt/internal/ui/examples/jspeditor/JspSourceViewerConfiguration.java @@ -46,9 +46,6 @@ public JspSourceViewerConfiguration(ITextEditor textEditor) { fTextEditor= textEditor; } - /* - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer) - */ @Override public IReconciler getReconciler(ISourceViewer sourceViewer) { IReconcilingStrategy reconcilingStrategy= new JspReconcilingStrategy(sourceViewer, fTextEditor); @@ -57,17 +54,11 @@ public IReconciler getReconciler(ISourceViewer sourceViewer) { return reconciler; } - /* - * @see SourceViewerConfiguration#getAnnotationHover(ISourceViewer) - */ @Override public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) { return new DefaultAnnotationHover(); } - /* - * @see SourceViewerConfiguration#getTextHover(ISourceViewer, String) - */ @Override public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { return new DefaultTextHover(sourceViewer); diff --git a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jface/text/source/translation/TagHandlerFactory.java b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jface/text/source/translation/TagHandlerFactory.java index bd5d83d9f79..aee001a57dc 100644 --- a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jface/text/source/translation/TagHandlerFactory.java +++ b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jface/text/source/translation/TagHandlerFactory.java @@ -41,10 +41,6 @@ public ITagHandler registerHandler(String tag) { return (ITagHandler)fHandlers.remove(tag); } - - /* - * @see org.eclipse.jface.text.source.ITagHandlerFactory#getHandler(java.lang.String) - */ @Override public ITagHandler getHandler(String tag) { Assert.isNotNull(tag); @@ -52,9 +48,6 @@ public ITagHandler getHandler(String tag) { return (ITagHandler)fHandlers.get(tag); } - /* - * @see org.eclipse.jface.text.source.ITagHandlerFactory#findHandler(java.lang.String) - */ @Override public ITagHandler findHandler(String text) { Assert.isNotNull(text); diff --git a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/JspPluginImages.java b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/JspPluginImages.java index 589475e9555..182647fb482 100644 --- a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/JspPluginImages.java +++ b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/JspPluginImages.java @@ -46,11 +46,7 @@ public class JspPluginImages { static { String pathSuffix = "icons/full/"; //$NON-NLS-1$ - try { - ICON_BASE_URL= new URL(JspUIPlugin.getDefault().getBundle().getEntry("/"), pathSuffix); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // do nothing - } + ICON_BASE_URL= JspUIPlugin.getDefault().getBundle().getEntry("/"+ pathSuffix); //$NON-NLS-1$ } // Use IPath and toOSString to build the names to ensure they have the slashes correct diff --git a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/JspTypeQuery.java b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/JspTypeQuery.java index 8f3e9e3940e..86bd649da80 100644 --- a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/JspTypeQuery.java +++ b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/JspTypeQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. + * Copyright (c) 2003, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -14,18 +14,22 @@ package org.eclipse.jsp; import java.io.IOException; -import java.util.*; import java.util.ArrayList; +import java.util.HashSet; + +import org.eclipse.core.indexsearch.IIndex; +import org.eclipse.core.indexsearch.IIndexQuery; +import org.eclipse.core.indexsearch.ISearchResultCollector; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.indexsearch.*; -import org.eclipse.core.indexsearch.IIndexQuery; + import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaCore; diff --git a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/Util.java b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/Util.java index c5a4666e6a4..433b2be11d3 100644 --- a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/Util.java +++ b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/Util.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2020 IBM Corporation and others. + * Copyright (c) 2003, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -13,8 +13,12 @@ *******************************************************************************/ package org.eclipse.jsp; -import java.io.*; +import java.io.BufferedInputStream; import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; public class Util { @@ -29,17 +33,7 @@ static char[] getChars(String s) { static char[] getFileCharContent(File file, String encoding) throws IOException { System.out.println("****jdt.internal.compiler.util.Util.getFileCharContent: " + file + " " + encoding); //$NON-NLS-1$ //$NON-NLS-2$ try (InputStream stream= new BufferedInputStream(new FileInputStream(file))) { - try { - return Util.getInputStreamAsCharArray(stream, (int) file.length(), encoding); - } finally { - if (stream != null) { - try { - stream.close(); - } catch (IOException e) { - // ignore - } - } - } + return Util.getInputStreamAsCharArray(stream, (int) file.length(), encoding); } } diff --git a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/launching/TomcatTab.java b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/launching/TomcatTab.java index 5ff3ab0e33a..0b79317e0a3 100644 --- a/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/launching/TomcatTab.java +++ b/org.eclipse.jdt.ui.examples.javafamily/src/org/eclipse/jsp/launching/TomcatTab.java @@ -76,9 +76,6 @@ public TomcatTab() { super(); } - /** - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(Composite) - */ @Override public void createControl(Composite parent) { @@ -184,17 +181,11 @@ protected void handleTomcatBrowseButtonSelected() { } } - /** - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose() - */ @Override public void dispose() { // empty implementation } - /** - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(ILaunchConfiguration) - */ @Override public boolean isValid(ILaunchConfiguration config) { setErrorMessage(null); @@ -233,9 +224,6 @@ public boolean isValid(ILaunchConfiguration config) { return true; } - /** - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(ILaunchConfigurationWorkingCopy) - */ @Override public void setDefaults(ILaunchConfigurationWorkingCopy config) { config.setAttribute(TomcatLaunchDelegate.ATTR_CATALINA_HOME, "${catalina_home}"); //$NON-NLS-1$ @@ -243,9 +231,6 @@ public void setDefaults(ILaunchConfigurationWorkingCopy config) { config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "org.apache.catalina.startup.Bootstrap"); //$NON-NLS-1$ } - /** - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(ILaunchConfiguration) - */ @Override public void initializeFrom(ILaunchConfiguration configuration) { try { @@ -279,9 +264,6 @@ public void initializeFrom(ILaunchConfiguration configuration) { } } - /** - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(ILaunchConfigurationWorkingCopy) - */ @Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { configuration.setAttribute(TomcatLaunchDelegate.ATTR_CATALINA_HOME, getAttributeValueFrom(fTomcatDir)); @@ -303,17 +285,11 @@ protected String getAttributeValueFrom(Text text) { return null; } - /** - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() - */ @Override public String getName() { return LaunchingMessages.TomcatTab_7; } - /** - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() - */ @Override public Image getImage() { return JspPluginImages.getImage(JspPluginImages.IMG_OBJ_TOMCAT);