Search in sources :

Example 21 with IService

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

the class TypeVisitor method createConfiguration.

protected IConfiguration createConfiguration(IJavaProject project, Map<String, EntityInfo> entities) {
    IConfiguration result = null;
    IService service = getService(project);
    if (service != null) {
        result = service.newDefaultConfiguration();
        ProcessEntityInfo processor = new ProcessEntityInfo(service);
        processor.setEntities(entities);
        for (Entry<String, EntityInfo> entry : entities.entrySet()) {
            String fullyQualifiedName = entry.getValue().getFullyQualifiedName();
            ICompilationUnit icu = Utils.findCompilationUnit(project, fullyQualifiedName);
            if (icu != null) {
                CompilationUnit cu = Utils.getCompilationUnit(icu, true);
                processor.setEntityInfo(entry.getValue());
                cu.accept(processor);
            }
        }
        Collection<IPersistentClass> classesCollection = createHierarhyStructure(project, processor.getRootClasses());
        for (IPersistentClass persistentClass : classesCollection) {
            result.addClass(persistentClass);
        }
    }
    return result;
}
Also used : ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) CompilationUnit(org.eclipse.jdt.core.dom.CompilationUnit) ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) RefEntityInfo(org.hibernate.eclipse.jdt.ui.internal.jpa.common.RefEntityInfo) EntityInfo(org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) IService(org.jboss.tools.hibernate.runtime.spi.IService) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass)

Example 22 with IService

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

the class CFGXMLStructuredTextViewerConfiguration method getContentAssistProcessors.

protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
    IContentAssistProcessor[] processors = null;
    IService service = StructuredTextViewerConfigurationUtil.getService(sourceViewer);
    if ((IStructuredPartitions.DEFAULT_PARTITION.equals(partitionType)) || (IXMLPartitions.XML_DEFAULT.equals(partitionType))) {
        // TODO: return cached one ?
        processors = new IContentAssistProcessor[] { new CFGXMLContentAssistProcessor(service) };
    } else if (IStructuredPartitions.UNKNOWN_PARTITION.equals(partitionType)) {
        processors = new IContentAssistProcessor[] { new NoRegionContentAssistProcessor() };
    }
    return processors;
}
Also used : NoRegionContentAssistProcessor(org.eclipse.wst.xml.ui.internal.contentassist.NoRegionContentAssistProcessor) IContentAssistProcessor(org.eclipse.jface.text.contentassist.IContentAssistProcessor) IService(org.jboss.tools.hibernate.runtime.spi.IService)

Example 23 with IService

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

the class HBMXMLStructuredTextViewerConfiguration method getHyperlinkDetectors.

public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
    if (sourceViewer == null || hyperLinksEnabled()) {
        return null;
    }
    IHyperlinkDetector[] baseDetectors = super.getHyperlinkDetectors(sourceViewer);
    IService service = StructuredTextViewerConfigurationUtil.getService(sourceViewer);
    HBMXMLHyperlinkDetector hyperlinkDetector = new HBMXMLHyperlinkDetector(service);
    if (baseDetectors == null || baseDetectors.length == 0) {
        return new IHyperlinkDetector[] { hyperlinkDetector };
    } else {
        IHyperlinkDetector[] result = new IHyperlinkDetector[baseDetectors.length + 1];
        result[0] = hyperlinkDetector;
        for (int i = 0; i < baseDetectors.length; i++) {
            result[i + 1] = baseDetectors[i];
        }
        return result;
    }
}
Also used : IHyperlinkDetector(org.eclipse.jface.text.hyperlink.IHyperlinkDetector) IService(org.jboss.tools.hibernate.runtime.spi.IService)

Aggregations

IService (org.jboss.tools.hibernate.runtime.spi.IService)23 ConsoleConfiguration (org.hibernate.console.ConsoleConfiguration)8 IConfiguration (org.jboss.tools.hibernate.runtime.spi.IConfiguration)8 Properties (java.util.Properties)5 IFile (org.eclipse.core.resources.IFile)5 CoreException (org.eclipse.core.runtime.CoreException)5 IPath (org.eclipse.core.runtime.IPath)5 File (java.io.File)4 FileNotFoundException (java.io.FileNotFoundException)4 JavaModelException (org.eclipse.jdt.core.JavaModelException)4 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)4 Path (org.eclipse.core.runtime.Path)3 PartInitException (org.eclipse.ui.PartInitException)3 IArtifactCollector (org.jboss.tools.hibernate.runtime.spi.IArtifactCollector)3 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 IResource (org.eclipse.core.resources.IResource)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 IJavaProject (org.eclipse.jdt.core.IJavaProject)2 IPackageFragment (org.eclipse.jdt.core.IPackageFragment)2