Skip to content

Commit

Permalink
Merge branch 'master' into explicitencoding
Browse files Browse the repository at this point in the history
  • Loading branch information
carstenartur authored Jan 22, 2025
2 parents d1d623a + 013e35b commit 8ca0fc3
Show file tree
Hide file tree
Showing 64 changed files with 264 additions and 286 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,6 @@ private boolean isInSwitchExpression(YieldStatement node) {

private IDialogSettings fDialogSettings;


@SuppressWarnings("incomplete-switch")
public ASTView() {
fSuperListener= null;
fDialogSettings= ASTViewPlugin.getDefault().getDialogSettings();
Expand All @@ -503,27 +501,8 @@ public ASTView() {
fCurrentASTLevel= AST.getJLSLatest();
try {
int level= fDialogSettings.getInt(SETTINGS_JLS);
switch (level) {
case JLS2:
case JLS3:
case JLS4:
case JLS8:
case JLS9:
case JLS10:
case JLS11:
case JLS12:
case JLS13:
case JLS14:
case JLS15:
case JLS16:
case JLS17:
case JLS18:
case JLS19:
case JLS20:
case JLS21:
case JLS22:
case JLS23:
fCurrentASTLevel= level;
if(AST.isSupportedVersion(level)) {
fCurrentASTLevel = level;
}
} catch (NumberFormatException e) {
// ignore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2020 IBM Corporation and others.
* Copyright (c) 2005, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -25,7 +25,8 @@
import org.junit.Rule;
import org.junit.Test;

import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;

import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
Expand Down Expand Up @@ -228,14 +229,14 @@ public void testReadOnlyHistory() {
}

@Test
public void testLoadStore() throws Exception {
public void testLoadStoreIEclipsePreferences() throws Exception {
ContentAssistHistory history= new ContentAssistHistory();

history.remember(fgListT, fgArrayListT);
history.remember(fgCharSequenceT, fgStringT);


Preferences prefs= new Preferences();
IEclipsePreferences prefs= InstanceScope.INSTANCE.getNode("org.eclipse.jdt.text.testsa");
String key= "myKey";
ContentAssistHistory.store(history, prefs, key);
ContentAssistHistory loaded= ContentAssistHistory.load(prefs, key);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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$
Expand All @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -46,9 +46,6 @@ public JspEditor() {
// setPreferenceStore(JspUIPlugin.getDefault().getPreferenceStore());
}

/*
* @see TextEditor#createAnnotationAccess()
*/
@Override
protected IAnnotationAccess createAnnotationAccess() {
return new DefaultMarkerAnnotationAccess();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

/**
Expand All @@ -57,45 +59,30 @@ 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);
fProgressMonitor= monitor;

}

/*
* @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#initialReconcile()
*/
@Override
public void initialReconcile() {
fFirstStep.reconcile(null);
Expand All @@ -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) {
Expand Down Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,13 @@ 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);

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 8ca0fc3

Please sign in to comment.