Search in sources :

Example 6 with IHQLCodeAssist

use of org.jboss.tools.hibernate.runtime.spi.IHQLCodeAssist in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewHQLCodeAssist.

@Test
public void testNewHQLCodeAssist() {
    IConfiguration configuration = service.newDefaultConfiguration();
    configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
    IHQLCodeAssist hqlCodeAssist = service.newHQLCodeAssist(configuration);
    Assert.assertNotNull(hqlCodeAssist);
}
Also used : IHQLCodeAssist(org.jboss.tools.hibernate.runtime.spi.IHQLCodeAssist) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) Test(org.junit.Test)

Example 7 with IHQLCodeAssist

use of org.jboss.tools.hibernate.runtime.spi.IHQLCodeAssist in project jbosstools-hibernate by jbosstools.

the class ConsoleExtension method hqlCodeComplete.

public CompletionProposalsResult hqlCodeComplete(String query, int startPosition, int currentOffset) {
    HQLCompletionHandler handler = new HQLCompletionHandler(startPosition);
    if (!hibernateExtension.hasConfiguration()) {
        try {
            hibernateExtension.build();
            hibernateExtension.buildMappings();
        } catch (HibernateException e) {
        // FIXME
        // String mess =
        // NLS.bind(HibernateConsoleMessages.CompletionHelper_error_could_not_build_cc,
        // consoleConfiguration.getName());
        // HibernateConsolePlugin.getDefault().logErrorMessage(mess, e);
        }
    }
    IHQLCodeAssist hqlEval = hibernateExtension.getHibernateService().newHQLCodeAssist(hibernateExtension.getConfiguration());
    query = query.replace('\t', ' ');
    hqlEval.codeComplete(query, currentOffset, handler);
    return new CompletionProposalsResult(handler.getCompletionProposals(), handler.getLastErrorMessage());
}
Also used : HibernateException(org.jboss.tools.hibernate.runtime.spi.HibernateException) IHQLCodeAssist(org.jboss.tools.hibernate.runtime.spi.IHQLCodeAssist)

Example 8 with IHQLCodeAssist

use of org.jboss.tools.hibernate.runtime.spi.IHQLCodeAssist in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryTest method testCreateHQLCodeAssist.

@Test
public void testCreateHQLCodeAssist() {
    HQLCodeAssist hqlCodeAssist = new HQLCodeAssist(null);
    IHQLCodeAssist facade = facadeFactory.createHQLCodeAssist(hqlCodeAssist);
    Assert.assertSame(hqlCodeAssist, ((IFacade) facade).getTarget());
}
Also used : HQLCodeAssist(org.hibernate.tool.ide.completion.HQLCodeAssist) IHQLCodeAssist(org.jboss.tools.hibernate.runtime.spi.IHQLCodeAssist) IHQLCodeAssist(org.jboss.tools.hibernate.runtime.spi.IHQLCodeAssist) Test(org.junit.Test)

Example 9 with IHQLCodeAssist

use of org.jboss.tools.hibernate.runtime.spi.IHQLCodeAssist in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryTest method testCreateHQLCodeAssist.

@Test
public void testCreateHQLCodeAssist() {
    HQLCodeAssist hqlCodeAssist = new HQLCodeAssist(new Configuration());
    IHQLCodeAssist facade = facadeFactory.createHQLCodeAssist(hqlCodeAssist);
    Assert.assertSame(hqlCodeAssist, ((IFacade) facade).getTarget());
}
Also used : HQLCodeAssist(org.hibernate.tool.ide.completion.HQLCodeAssist) IHQLCodeAssist(org.jboss.tools.hibernate.runtime.spi.IHQLCodeAssist) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) Configuration(org.hibernate.cfg.Configuration) IHQLCodeAssist(org.jboss.tools.hibernate.runtime.spi.IHQLCodeAssist) Test(org.junit.Test)

Example 10 with IHQLCodeAssist

use of org.jboss.tools.hibernate.runtime.spi.IHQLCodeAssist in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewHQLCodeAssist.

@Test
public void testNewHQLCodeAssist() {
    IConfiguration configuration = service.newDefaultConfiguration();
    configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
    IHQLCodeAssist hqlCodeAssist = service.newHQLCodeAssist(configuration);
    Assert.assertNotNull(hqlCodeAssist);
}
Also used : IHQLCodeAssist(org.jboss.tools.hibernate.runtime.spi.IHQLCodeAssist) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) Test(org.junit.Test)

Aggregations

IHQLCodeAssist (org.jboss.tools.hibernate.runtime.spi.IHQLCodeAssist)13 Test (org.junit.Test)12 HQLCodeAssist (org.hibernate.tool.ide.completion.HQLCodeAssist)8 IConfiguration (org.jboss.tools.hibernate.runtime.spi.IConfiguration)7 Configuration (org.hibernate.cfg.Configuration)3 MetadataSources (org.hibernate.boot.MetadataSources)1 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)1 HibernateException (org.jboss.tools.hibernate.runtime.spi.HibernateException)1