From fc34af4102dc6eb6c0c00a86f527b26c837a4cff Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Mon, 7 Nov 2022 14:21:01 +0100 Subject: [PATCH] remove dependencies on yedit and do not include that bundle anymore --- .../category.xml | 1 - .../category.xml | 1 - .../category.xml | 1 - .../category.xml | 1 - eclipse-distribution/pom.xml | 5 - .../META-INF/MANIFEST.MF | 1 - .../META-INF/MANIFEST.MF | 1 - .../support/yaml/AbstractYamlEditor.java | 40 --- ...AbstractYamlSourceViewerConfiguration.java | 244 ------------------ eclipse-language-servers/pom.xml | 5 - 10 files changed, 300 deletions(-) delete mode 100644 eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlEditor.java delete mode 100644 eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlSourceViewerConfiguration.java diff --git a/eclipse-distribution/org.springframework.boot.ide.product.e423/category.xml b/eclipse-distribution/org.springframework.boot.ide.product.e423/category.xml index d991c89e4..1e22f37ba 100644 --- a/eclipse-distribution/org.springframework.boot.ide.product.e423/category.xml +++ b/eclipse-distribution/org.springframework.boot.ide.product.e423/category.xml @@ -138,7 +138,6 @@ - diff --git a/eclipse-distribution/org.springframework.boot.ide.product.e424/category.xml b/eclipse-distribution/org.springframework.boot.ide.product.e424/category.xml index 9345bc045..b1071bf5a 100644 --- a/eclipse-distribution/org.springframework.boot.ide.product.e424/category.xml +++ b/eclipse-distribution/org.springframework.boot.ide.product.e424/category.xml @@ -138,7 +138,6 @@ - diff --git a/eclipse-distribution/org.springframework.boot.ide.product.e425/category.xml b/eclipse-distribution/org.springframework.boot.ide.product.e425/category.xml index 9345bc045..b1071bf5a 100644 --- a/eclipse-distribution/org.springframework.boot.ide.product.e425/category.xml +++ b/eclipse-distribution/org.springframework.boot.ide.product.e425/category.xml @@ -138,7 +138,6 @@ - diff --git a/eclipse-distribution/org.springframework.boot.ide.product.e426/category.xml b/eclipse-distribution/org.springframework.boot.ide.product.e426/category.xml index 9345bc045..b1071bf5a 100644 --- a/eclipse-distribution/org.springframework.boot.ide.product.e426/category.xml +++ b/eclipse-distribution/org.springframework.boot.ide.product.e426/category.xml @@ -138,7 +138,6 @@ - diff --git a/eclipse-distribution/pom.xml b/eclipse-distribution/pom.xml index 4ef92a011..edc199811 100644 --- a/eclipse-distribution/pom.xml +++ b/eclipse-distribution/pom.xml @@ -767,11 +767,6 @@ p2 ${sts4-language-servers-p2-repo} - - yedit - p2 - https://dist.springsource.com/release/TOOLS/third-party/yedit - p2-thirdparty-bundles p2 diff --git a/eclipse-extensions/org.springframework.ide.eclipse.boot.dash/META-INF/MANIFEST.MF b/eclipse-extensions/org.springframework.ide.eclipse.boot.dash/META-INF/MANIFEST.MF index b2b43fbaa..4f6863fdb 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.boot.dash/META-INF/MANIFEST.MF +++ b/eclipse-extensions/org.springframework.ide.eclipse.boot.dash/META-INF/MANIFEST.MF @@ -28,7 +28,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ui.views.properties.tabbed, org.eclipse.ui.editors, org.eclipse.jface.text, - org.dadacoalition.yedit, org.eclipse.ui.workbench, org.yaml.snakeyaml, org.eclipse.compare, diff --git a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/META-INF/MANIFEST.MF b/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/META-INF/MANIFEST.MF index 2f90178cd..b42ed5fb9 100644 --- a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/META-INF/MANIFEST.MF +++ b/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/META-INF/MANIFEST.MF @@ -15,7 +15,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ui.ide, org.eclipse.jdt.ui, org.eclipse.jdt.core, - org.dadacoalition.yedit, org.eclipse.ui.editors, org.springsource.ide.eclipse.commons.livexp;bundle-version="3.8.4", org.springsource.ide.eclipse.commons.frameworks.core, diff --git a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlEditor.java b/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlEditor.java deleted file mode 100644 index 402707d24..000000000 --- a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlEditor.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2016 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.eclipse.editor.support.yaml; - -import org.dadacoalition.yedit.editor.YEdit; -import org.eclipse.core.resources.IFile; -import org.eclipse.ui.IEditorInput; - -import com.google.common.collect.ImmutableSet; - -public abstract class AbstractYamlEditor extends YEdit { - - private static final ImmutableSet YAML_EXTENSIONS = ImmutableSet.of("yml", "yaml"); - - protected ImmutableSet getSupportedFileExtensions() { - return YAML_EXTENSIONS; - } - - @Override - protected boolean canHandleMove(IEditorInput originalElement, IEditorInput movedElement) { - //See https://issuetracker.springsource.com/browse/STS-4299 - IFile file = (IFile)movedElement.getAdapter(IFile.class); - if (file!=null) { - String extension = file.getFileExtension(); - if (extension!=null) { - extension = extension.toLowerCase(); - return getSupportedFileExtensions().contains(extension); - } - } - return false; - } -} diff --git a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlSourceViewerConfiguration.java b/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlSourceViewerConfiguration.java deleted file mode 100644 index fe8c6a944..000000000 --- a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlSourceViewerConfiguration.java +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2017 Pivotal, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.eclipse.editor.support.yaml; - -import java.lang.reflect.Constructor; -import java.util.HashSet; -import java.util.Set; - -import javax.inject.Provider; - -import org.dadacoalition.yedit.editor.YEditSourceViewerConfiguration; -import org.dadacoalition.yedit.template.YEditCompletionProcessor; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextHover; -import org.eclipse.jface.text.ITextViewerExtension2; -import org.eclipse.jface.text.contentassist.ContentAssistant; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.text.contentassist.IContentAssistant; -import org.eclipse.jface.text.reconciler.IReconciler; -import org.eclipse.jface.text.reconciler.IReconcilingStrategy; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jface.text.source.DefaultAnnotationHover; -import org.eclipse.jface.text.source.IAnnotationHover; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Shell; -import org.springframework.ide.eclipse.editor.support.EditorSupportActivator; -import org.springframework.ide.eclipse.editor.support.ForceableReconciler; -import org.springframework.ide.eclipse.editor.support.completions.CompletionFactory; -import org.springframework.ide.eclipse.editor.support.completions.ICompletionEngine; -import org.springframework.ide.eclipse.editor.support.completions.ProposalProcessor; -import org.springframework.ide.eclipse.editor.support.hover.HoverInfoProvider; -import org.springframework.ide.eclipse.editor.support.hover.HoverInfoTextHover; -import org.springframework.ide.eclipse.editor.support.reconcile.DefaultQuickfixContext; -import org.springframework.ide.eclipse.editor.support.reconcile.QuickfixContext; -import org.springframework.ide.eclipse.editor.support.reconcile.ReconcileProblemAnnotationHover; -import org.springframework.ide.eclipse.editor.support.util.DefaultUserInteractions; -import org.springframework.ide.eclipse.editor.support.yaml.ast.YamlASTProvider; -import org.springframework.ide.eclipse.editor.support.yaml.hover.YamlHoverInfoProvider; -import org.springframework.ide.eclipse.editor.support.yaml.structure.YamlStructureProvider; -import org.yaml.snakeyaml.Yaml; -import org.yaml.snakeyaml.constructor.SafeConstructor; - -/** - * @author Kris De Volder - */ -public abstract class AbstractYamlSourceViewerConfiguration extends YEditSourceViewerConfiguration { - - private static final Set ANNOTIONS_SHOWN_IN_TEXT = new HashSet<>(); - static { - ANNOTIONS_SHOWN_IN_TEXT.add("org.eclipse.jdt.ui.warning"); - ANNOTIONS_SHOWN_IN_TEXT.add("org.eclipse.jdt.ui.error"); - } - private static final Set ANNOTIONS_SHOWN_IN_OVERVIEW_BAR = ANNOTIONS_SHOWN_IN_TEXT; - - //TODO: the ANNOTIONS_SHOWN_IN_TEXT and ANNOTIONS_SHOWN_IN_OVERVIEW_BAR should be replaced with - // properly using preferences. An example of how to set this up can be found in the code - // of the Java properties file editor. Roughly these things need to happen: - // 1) use methods like 'isShownIntext' and 'isShownInOverviewRuler' which are defined in - // our super class. - // 2) initialize the super class with a preference store (simialr to how java properties file does it) - // 3) To be able to do 2) it is necessary to add a constructor to YEditSourceViewerConfiguration which - // accepts preference store and passes it to its super class. So this requires a patch to - // YEdit source code. - - - - private Provider shellProvider; - private final String DIALOG_SETTINGS_KEY = this.getClass().getName(); - private final YamlASTProvider astProvider = new YamlASTProvider(new Yaml(new SafeConstructor())); - private YamlCompletionEngine completionEngine; - protected ForceableReconciler fReconciler; - - public AbstractYamlSourceViewerConfiguration(Provider shellProvider) { - this.shellProvider = shellProvider; - } - - protected final IDialogSettings getDialogSettings() { - IDialogSettings dialogSettings = getPluginDialogSettings(); - IDialogSettings existing = dialogSettings.getSection(DIALOG_SETTINGS_KEY); - if (existing!=null) { - return existing; - } - IDialogSettings created = dialogSettings.addNewSection(DIALOG_SETTINGS_KEY); - Point defaultPopupSize = getDefaultPopupSize(); - if (defaultPopupSize!=null) { - int suggestW = defaultPopupSize.x; - int suggestH = defaultPopupSize.y; - created.put(ContentAssistant.STORE_SIZE_X, suggestW); - created.put(ContentAssistant.STORE_SIZE_Y, suggestH); - } - return created; - } - - protected Point getDefaultPopupSize() { - return null; - } - - protected abstract IDialogSettings getPluginDialogSettings(); - - @Override - public final IContentAssistant getContentAssistant(ISourceViewer viewer) { - IContentAssistant _a = super_getContentAssistant(viewer); - - if (_a instanceof ContentAssistant) { - ContentAssistant a = (ContentAssistant)_a; - //IContentAssistProcessor processor = assistant.getContentAssistProcessor(IDocument.DEFAULT_CONTENT_TYPE); - //if (processor!=null) { - //TODO: don't overwrite existing processor but wrap it so - // we combine our proposals with existing propopals - //} - - a.setInformationControlCreator(getInformationControlCreator(viewer)); - a.enableColoredLabels(true); - a.enablePrefixCompletion(false); - a.enableAutoInsert(true); - a.enableAutoActivation(true); - a.setRestoreCompletionProposalSize(getDialogSettings()); - ProposalProcessor processor = new ProposalProcessor(getCompletionEngine(viewer)); - a.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); - a.setSorter(CompletionFactory.SORTER); - } - return _a; - } - - private IContentAssistant super_getContentAssistant(ISourceViewer sourceViewer) { - //Copied from superclass's getContentAssistant... then modifed to make ContentAssistant - // asynchronous. - ContentAssistant ca; - try { - //Use reflection to call the constructor because it only exists in Eclipse 4.7. - Constructor constructor = ContentAssistant.class.getConstructor(boolean.class); - ca = constructor.newInstance(true); - } catch (Exception e) { - ca = new ContentAssistant(); - } - - IContentAssistProcessor cap = new YEditCompletionProcessor(); - ca.setContentAssistProcessor(cap, IDocument.DEFAULT_CONTENT_TYPE); - ca.setInformationControlCreator(getInformationControlCreator(sourceViewer)); - - ca.enableAutoInsert(true); - - return ca; - } - - @Override - public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) { - if (contentType.equals(IDocument.DEFAULT_CONTENT_TYPE) && ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK==stateMask) { - ITextHover delegate = getTextAnnotationHover(sourceViewer); - try { - HoverInfoProvider hoverProvider = getHoverProvider(sourceViewer); - if (hoverProvider!=null) { - return new HoverInfoTextHover(sourceViewer, getHoverProvider(sourceViewer), delegate); - } - } catch (Exception e) { - EditorSupportActivator.log(e); - } - return delegate; - } else { - return super.getTextHover(sourceViewer, contentType, stateMask); - } - } - - public ICompletionEngine getCompletionEngine(ISourceViewer viewer) { - if (completionEngine==null) { - completionEngine = new YamlCompletionEngine(getStructureProvider(), getAssistContextProvider(viewer)); - } - return completionEngine; - } - - protected HoverInfoProvider getHoverProvider(ISourceViewer viewer) { - return new YamlHoverInfoProvider(getAstProvider(), getStructureProvider(), getAssistContextProvider(viewer)); - } - - protected final YamlASTProvider getAstProvider() { - return astProvider; - } - - @Override - public final IReconciler getReconciler(ISourceViewer sourceViewer) { - if (fReconciler==null) { - fReconciler = createReconciler(sourceViewer); - } - return fReconciler; - } - - @Override - public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) { - return new DefaultAnnotationHover() { - @Override - protected boolean isIncluded(Annotation annotation) { - return ANNOTIONS_SHOWN_IN_OVERVIEW_BAR.contains(annotation.getType()); - } - }; - } - - protected ITextHover getTextAnnotationHover(ISourceViewer sourceViewer) { - return new ReconcileProblemAnnotationHover(sourceViewer, getQuickfixContext(sourceViewer)); - } - - protected Shell getShell() { - return shellProvider.get(); - } - - protected final QuickfixContext getQuickfixContext(ISourceViewer sourceViewer) { - return new DefaultQuickfixContext( - getPluginId(), - getPreferencesStore(), - sourceViewer, - new DefaultUserInteractions(getShell()) - ); - } - - protected abstract String getPluginId(); - protected abstract IPreferenceStore getPreferencesStore(); - protected abstract YamlStructureProvider getStructureProvider(); - protected abstract YamlAssistContextProvider getAssistContextProvider(ISourceViewer viewer); - - protected IReconcilingStrategy createReconcilerStrategy(ISourceViewer sourceViewer) { - return null; - } - - protected ForceableReconciler createReconciler(ISourceViewer sourceViewer) { - //TODO: aplication.properties|yaml editors are overriding this. That should not be necessary. - IReconcilingStrategy strategy = createReconcilerStrategy(sourceViewer); - if (strategy!=null) { - ForceableReconciler reconciler = new ForceableReconciler(strategy); - reconciler.setDelay(500); - return reconciler; - } - return null; - } -} diff --git a/eclipse-language-servers/pom.xml b/eclipse-language-servers/pom.xml index 90c84a630..262e7d903 100644 --- a/eclipse-language-servers/pom.xml +++ b/eclipse-language-servers/pom.xml @@ -349,11 +349,6 @@ p2 https://dist.springsource.com/release/TOOLS/third-party/misc-p2-repo/${misc.p2.repo.version} - - yedit - p2 - https://dist.springsource.com/release/TOOLS/third-party/yedit -