Skip to content

Commit

Permalink
Fix configuration of the Thymeleaf nature
Browse files Browse the repository at this point in the history
  • Loading branch information
ultraq committed Oct 21, 2023
1 parent 07a8e56 commit 0183e4d
Show file tree
Hide file tree
Showing 28 changed files with 91 additions and 115 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ configurations.create('contentassist')
//}

def groovyVersion = '4.0.15'
def springVersion = '5.2.0.RELEASE'
def springVersion = '6.0.13'

dependencies {
contentassist(
'javax.annotation:javax.annotation-api:1.3.2',
'javax.inject:javax.inject:1',
'jakarta.annotation:jakarta.annotation-api:2.1.1',
'jakarta.inject:jakarta.inject-api:2.0.0',
'nz.net.ultraq.jaxb:jaxb-utilities:3.0.0-SNAPSHOT',
'nz.net.ultraq.groovy:groovy-extensions:2.2.0',
'nz.net.ultraq.groovy:groovy-profiling-extensions:0.7.0',
Expand Down
31 changes: 10 additions & 21 deletions org.thymeleaf.extras.eclipse.contentassist/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Bundle-Version: 3.1.0.qualifier
Bundle-Activator: org.thymeleaf.extras.eclipse.ContentAssistPlugin
Require-Bundle: org.eclipse.core.resources;bundle-version="3.19.0",
org.eclipse.core.runtime;bundle-version="3.27.0",
org.eclipse.e4.ui.model.workbench;bundle-version="2.4.0",
org.eclipse.jdt.core;bundle-version="3.34.0",
org.eclipse.jdt.ui;bundle-version="3.29.0",
org.eclipse.jface.text;bundle-version="3.24.0",
Expand All @@ -17,18 +18,6 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="3.19.0",
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-Vendor: Thymeleaf Project
Export-Package: org.thymeleaf.extras.eclipse.autocomplete;uses:="org.eclipse.core.runtime,org.eclipse.wst.sse.ui.contentassist,org.thymeleaf.extras.eclipse.contentassist",
org.thymeleaf.extras.eclipse.autocomplete.generators;
uses:="org.eclipse.wst.xml.core.internal.provisional.document,
org.thymeleaf.extras.eclipse.contentassist,
org.eclipse.jface.text,
org.eclipse.wst.sse.core.internal.provisional.text",
org.thymeleaf.extras.eclipse.autocomplete.proposals;
uses:="org.eclipse.jface.text.contentassist,
org.eclipse.swt.graphics,
org.thymeleaf.extras.eclipse.dialect.xml,
org.eclipse.jface.text",
org.thymeleaf.extras.eclipse.hover;uses:="org.thymeleaf.extras.eclipse.contentassist,org.eclipse.jface.text"
Bundle-ClassPath: .,
lib/apiguardian-api-1.1.0.jar,
lib/attoparser-2.0.5.RELEASE.jar,
Expand All @@ -40,9 +29,9 @@ Bundle-ClassPath: .,
lib/groovy-xml-4.0.15.jar,
lib/jakarta.activation-1.2.2.jar,
lib/jakarta.activation-api-1.2.2.jar,
lib/jakarta.annotation-api-2.1.1.jar,
lib/jakarta.inject-api-2.0.0.jar,
lib/jakarta.xml.bind-api-2.3.3.jar,
lib/javax.annotation-api-1.3.2.jar,
lib/javax.inject-1.jar,
lib/jaxb-impl-2.3.5.jar,
lib/jaxb-utilities-3.0.0-SNAPSHOT.jar,
lib/junit-jupiter-5.7.2.jar,
Expand All @@ -55,10 +44,10 @@ Bundle-ClassPath: .,
lib/objenesis-3.2.jar,
lib/opentest4j-1.2.0.jar,
lib/slf4j-api-1.7.36.jar,
lib/spring-aop-5.2.0.RELEASE.jar,
lib/spring-beans-5.2.0.RELEASE.jar,
lib/spring-context-5.2.0.RELEASE.jar,
lib/spring-core-5.2.0.RELEASE.jar,
lib/spring-expression-5.2.0.RELEASE.jar,
lib/spring-jcl-5.2.0.RELEASE.jar,
lib/spring-test-5.2.0.RELEASE.jar
lib/spring-aop-6.0.13.jar,
lib/spring-beans-6.0.13.jar,
lib/spring-context-6.0.13.jar,
lib/spring-core-6.0.13.jar,
lib/spring-expression-6.0.13.jar,
lib/spring-jcl-6.0.13.jar,
lib/spring-test-6.0.13.jar
18 changes: 9 additions & 9 deletions org.thymeleaf.extras.eclipse.contentassist/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ bin.includes = .,\
lib/jakarta.activation-1.2.2.jar,\
lib/jakarta.activation-api-1.2.2.jar,\
lib/jakarta.xml.bind-api-2.3.3.jar,\
lib/javax.annotation-api-1.3.2.jar,\
lib/javax.inject-1.jar,\
lib/jaxb-impl-2.3.5.jar,\
lib/jaxb-utilities-3.0.0-SNAPSHOT.jar,\
lib/junit-jupiter-5.7.2.jar,\
Expand All @@ -31,10 +29,12 @@ bin.includes = .,\
lib/objenesis-3.2.jar,\
lib/opentest4j-1.2.0.jar,\
lib/slf4j-api-1.7.36.jar,\
lib/spring-aop-5.2.0.RELEASE.jar,\
lib/spring-beans-5.2.0.RELEASE.jar,\
lib/spring-context-5.2.0.RELEASE.jar,\
lib/spring-core-5.2.0.RELEASE.jar,\
lib/spring-expression-5.2.0.RELEASE.jar,\
lib/spring-jcl-5.2.0.RELEASE.jar,\
lib/spring-test-5.2.0.RELEASE.jar
lib/spring-aop-6.0.13.jar,\
lib/spring-beans-6.0.13.jar,\
lib/spring-context-6.0.13.jar,\
lib/spring-core-6.0.13.jar,\
lib/spring-expression-6.0.13.jar,\
lib/spring-jcl-6.0.13.jar,\
lib/spring-test-6.0.13.jar,\
lib/jakarta.inject-api-2.0.0.jar,\
lib/jakarta.annotation-api-2.1.1.jar
12 changes: 6 additions & 6 deletions org.thymeleaf.extras.eclipse.contentassist/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<plugin>
<extension
id="org.thymeleaf.extras.eclipse.core.ThymeleafBuilder"
id="org.thymeleaf.extras.eclipse.contentassist.ThymeleafBuilder"
name="Thymeleaf Validation Builder"
point="org.eclipse.core.resources.builders">
<builder>
Expand All @@ -25,7 +25,7 @@
</run>
</runtime>
<builder
id="org.thymeleaf.extras.eclipse.core.ThymeleafBuilder">
id="org.thymeleaf.extras.eclipse.contentassist.ThymeleafBuilder">
</builder>
</extension>
<extension
Expand Down Expand Up @@ -63,7 +63,7 @@
<not>
<test
property="org.eclipse.core.resources.projectNature"
value="org.thymeleaf.extras.eclipse.core.ThymeleafNature">
value="org.thymeleaf.extras.eclipse.contentassist.ThymeleafNature">
</test>
</not>
</adapt>
Expand All @@ -80,7 +80,7 @@
<adapt type="org.eclipse.core.resources.IProject">
<test
property="org.eclipse.core.resources.projectNature"
value="org.thymeleaf.extras.eclipse.core.ThymeleafNature">
value="org.thymeleaf.extras.eclipse.contentassist.ThymeleafNature">
</test>
</adapt>
</iterate>
Expand All @@ -104,7 +104,7 @@
<test
forcePluginActivation="true"
property="org.eclipse.core.resources.projectNature"
value="org.thymeleaf.extras.eclipse.core.ThymeleafNature">
value="org.thymeleaf.extras.eclipse.contentassist.ThymeleafNature">
</test>
</not>
</adapt>
Expand All @@ -128,7 +128,7 @@
</test>
<test
property="org.eclipse.core.resources.projectNature"
value="org.thymeleaf.extras.eclipse.core.ThymeleafNature">
value="org.thymeleaf.extras.eclipse.contentassist.ThymeleafNature">
</test>
</adapt>
</iterate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ package org.thymeleaf.extras.eclipse
import org.eclipse.core.resources.IWorkspace
import org.eclipse.core.resources.ResourcesPlugin
import org.eclipse.jface.resource.ImageRegistry
import org.eclipse.ui.PlatformUI
import org.eclipse.ui.IWorkbench
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
import org.thymeleaf.extras.eclipse.dialect.XmlDialectLoader
import org.thymeleaf.extras.eclipse.dialect.cache.DialectCache

/**
* Spring configuration for the core part of the plugin.
Expand All @@ -39,7 +42,7 @@ class ContentAssistConfig {

@Bean
IWorkbench workbench() {
return ContentAssistPlugin.default.workbench
return PlatformUI.workbench
}

@Bean
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import org.eclipse.ui.plugin.AbstractUIPlugin
import org.eclipse.wst.html.ui.internal.HTMLUIPlugin
import org.eclipse.wst.html.ui.internal.preferences.HTMLUIPreferenceNames
import org.osgi.framework.BundleContext
import org.springframework.context.ApplicationContext
import org.springframework.context.annotation.AnnotationConfigApplicationContext

/**
* Plugin activator class for the Thymeleaf content assist module.
Expand All @@ -39,6 +41,17 @@ class ContentAssistPlugin extends AbstractUIPlugin {

private static ContentAssistPlugin plugin

ApplicationContext applicationContext

/**
* Shortcut to the {@code getBean} method of the underlying application
* context.
*/
public <T> T getBean(Class<T> requiredType) {

return plugin.applicationContext.getBean(requiredType)
}

/**
* Returns the shared instance of this plugin.
*
Expand Down Expand Up @@ -86,14 +99,13 @@ class ContentAssistPlugin extends AbstractUIPlugin {
})
}

ContentAssistContainer.instance
applicationContext = new AnnotationConfigApplicationContext(ContentAssistConfig)
}

@Override
void stop(BundleContext context) {

plugin = null
super.stop(context)
ContentAssistContainer.instance.close()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.thymeleaf.extras.eclipse.autocomplete
import org.eclipse.core.runtime.IProgressMonitor
import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext
import org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer
import org.thymeleaf.extras.eclipse.ContentAssistContainer
import org.thymeleaf.extras.eclipse.ContentAssistPlugin
import org.thymeleaf.extras.eclipse.autocomplete.generators.ProposalGenerator
import org.thymeleaf.extras.eclipse.autocomplete.generators.AttributeProcessorProposalGenerator
import org.thymeleaf.extras.eclipse.autocomplete.generators.AttributeRestrictionProposalGenerator
Expand All @@ -46,10 +46,10 @@ class CompletionProposalComputer implements ICompletionProposalComputer {
CompletionProposalComputer() {

this(
ContentAssistContainer.instance.getBean(ElementProcessorProposalGenerator),
ContentAssistContainer.instance.getBean(AttributeProcessorProposalGenerator),
ContentAssistContainer.instance.getBean(AttributeRestrictionProposalGenerator),
ContentAssistContainer.instance.getBean(ExpressionObjectProposalGenerator)
ContentAssistPlugin.default.getBean(ElementProcessorProposalGenerator),
ContentAssistPlugin.default.getBean(AttributeProcessorProposalGenerator),
ContentAssistPlugin.default.getBean(AttributeRestrictionProposalGenerator),
ContentAssistPlugin.default.getBean(ExpressionObjectProposalGenerator)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import org.thymeleaf.extras.eclipse.wrappers.JavaProjectLocator
import org.w3c.dom.NamedNodeMap
import org.w3c.dom.Node

import javax.inject.Inject
import javax.inject.Named
import jakarta.inject.Inject
import jakarta.inject.Named

/**
* Proposal generator for Thymeleaf attribute processors.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import org.thymeleaf.extras.eclipse.autocomplete.proposals.AttributeRestrictionC
import org.thymeleaf.extras.eclipse.dialect.cache.DialectCache
import org.w3c.dom.Node

import javax.inject.Inject
import javax.inject.Named
import jakarta.inject.Inject
import jakarta.inject.Named

/**
* Proposal generator for Thymeleaf attribute restrictions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import org.thymeleaf.extras.eclipse.autocomplete.proposals.ElementProcessorCompl
import org.thymeleaf.extras.eclipse.dialect.cache.DialectCache
import org.w3c.dom.Node

import javax.inject.Inject
import javax.inject.Named
import jakarta.inject.Inject
import jakarta.inject.Named

/**
* Proposal generator for Thymeleaf element processors.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import org.thymeleaf.extras.eclipse.autocomplete.proposals.ExpressionObjectMetho
import org.thymeleaf.extras.eclipse.dialect.cache.DialectCache
import org.w3c.dom.Node

import javax.inject.Inject
import javax.inject.Named
import jakarta.inject.Inject
import jakarta.inject.Named

/**
* Proposal generator for Thymeleaf expression objects.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.eclipse.jdt.core.IJavaProject
import org.eclipse.jdt.core.JavaCore
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.thymeleaf.extras.eclipse.ContentAssistContainer
import org.thymeleaf.extras.eclipse.ContentAssistPlugin
import org.thymeleaf.extras.eclipse.dialect.cache.DialectCache
import static org.eclipse.core.resources.IResource.*

Expand All @@ -50,7 +50,7 @@ class ThymeleafBuilder extends IncrementalProjectBuilder {

private static final Logger logger = LoggerFactory.getLogger(ThymeleafBuilder)

private final DialectCache dialectCache = ContentAssistContainer.instance.getBean(DialectCache)
private final DialectCache dialectCache = ContentAssistPlugin.default.getBean(DialectCache)

/**
* Remove HTML validation messages that refer to unknown attributes, when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.eclipse.core.resources.IWorkspace
import org.eclipse.core.runtime.IPath

import groovy.transform.TupleConstructor
import javax.inject.Inject
import jakarta.inject.Inject

/**
* A dialect locator target at a single, already-known, dialect file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import nz.net.ultraq.jaxb.XmlReader
import org.thymeleaf.extras.eclipse.dialect.xml.Dialect
import org.thymeleaf.extras.eclipse.resources.ResourceLoader

import javax.inject.Named
import jakarta.inject.Named

/**
* Loads dialect help/documentation XML files from those returned by a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import org.thymeleaf.extras.eclipse.dialect.xml.ExpressionObjectMethod
import org.thymeleaf.extras.eclipse.dialect.xml.Processor
import static org.eclipse.core.resources.IResourceChangeEvent.*

import javax.annotation.PostConstruct
import javax.annotation.PreDestroy
import javax.inject.Inject
import javax.inject.Named
import jakarta.annotation.PostConstruct
import jakarta.annotation.PreDestroy
import jakarta.inject.Inject
import jakarta.inject.Named
import javax.xml.namespace.QName

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ import org.thymeleaf.extras.eclipse.dialect.SingleFileDialectLocator
import org.thymeleaf.extras.eclipse.dialect.XmlDialectLoader
import static org.eclipse.core.resources.IResourceChangeEvent.*

import jakarta.annotation.PreDestroy
import jakarta.inject.Inject
import jakarta.inject.Named
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import javax.annotation.PreDestroy
import javax.inject.Inject
import javax.inject.Named

/**
* A resource change listener, acting on changes made to any dialect files,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import org.eclipse.jdt.core.IJavaProject
import org.eclipse.jdt.ui.JavadocContentAccess
import org.thymeleaf.extras.eclipse.dialect.xml.*

import javax.inject.Named
import jakarta.inject.Named

/**
* Creates a content-assist ready dialect item from a dialect file definition.
*
Expand Down
Loading

0 comments on commit 0183e4d

Please sign in to comment.