Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » DLTK indexes' load is not being performed(DLTK indexes' load is not being performed due to H2Cache.load())
DLTK indexes' load is not being performed [message #1446192] Thu, 16 October 2014 13:28 Go to next message
Eriky Raggeoto Kashivagui is currently offline Eriky Raggeoto KashivaguiFriend
Messages: 7
Registered: October 2014
Junior Member
DLTK's org.eclipse.dltk.internal.core.index.sql.h2.H2Cache.load() method has a hardcoded reference to PHPNature. Due to that the already indexed files are not being loaded.

Do I have implemented something wrong ? Or, Is it an issue ?


public static void load() {
		loadedLock.acquire();
		try {
			if (!isLoaded) {
				try {
					DbFactory dbFactory = DbFactory.getInstance();
					Connection connection = dbFactory.createConnection();
					try {
						IElementDao elementDao = dbFactory.getElementDao();
						elementDao.search(connection, null, MatchRule.PREFIX,
								IModelElement.FIELD, 0, 0, null, null, null,
								null, "org.eclipse.php.core.PHPNature", 0,
								false, new IElementHandler() {
									public void handle(Element element) {
									}
								}, new NullProgressMonitor());

						elementDao.search(connection, null, MatchRule.PREFIX,
								IModelElement.TYPE, 0, 0, null, null, null,
								null, "org.eclipse.php.core.PHPNature", 0,
								false, new IElementHandler() {
									public void handle(Element element) {
									}
								}, new NullProgressMonitor());

						elementDao.search(connection, null, MatchRule.PREFIX,
								IModelElement.METHOD, 0, 0, null, null, null,
								null, "org.eclipse.php.core.PHPNature", 0,
								false, new IElementHandler() {
									public void handle(Element element) {
									}
								}, new NullProgressMonitor());

						elementDao.search(connection, null, MatchRule.PREFIX,
								IModelElement.IMPORT_DECLARATION, 0, 0, null,
								null, null, null,
								"org.eclipse.php.core.PHPNature", 0, false,
								new IElementHandler() {
									public void handle(Element element) {
									}
								}, new NullProgressMonitor());
					} finally {
						connection.close();
					}
				} catch (SQLException e) {
					if (H2Index.DEBUG) {
						e.printStackTrace();
					}
				} finally {
					isLoaded = true;
				}
			}
		} finally {
			loadedLock.release();
		}
	}

Re: DLTK indexes' load is not being performed [message #1476974 is a reply to message #1446192] Mon, 17 November 2014 14:06 Go to previous messageGo to next message
Kevin Hagel is currently offline Kevin HagelFriend
Messages: 26
Registered: December 2012
Junior Member
That's pretty bad, really bad. I've been running into this problem as well.
If you install PDT, with the source, you can see how they're using the various extensions in the sql indexer stuff. I guess PHP donated this cache and dltk took it without looking.

Also in Kepler when you do a project clean it invokes your configured indexer participant, but it doesn't do that in Luna. At least in Kepler you can get a 'current index' in the current workspace session by invoking clean ... but not in Luna.

Once you restart Luna, your indexing is gone. It appears you've found out why.

DLTk didn't issue a new release this year. Nobody's doing any work on it anymore.
Re: DLTK indexes' load is not being performed [message #1477868 is a reply to message #1476974] Tue, 18 November 2014 07:15 Go to previous messageGo to next message
Kevin Hagel is currently offline Kevin HagelFriend
Messages: 26
Registered: December 2012
Junior Member
I found a way around these problem in our language IDE, at least it works for us.

In the plugin.xml I disable all the other indexers
    <extension
        point="org.eclipse.dltk.core.projectIndexer">
        <projectIndexer
            class="com.basis.bdt.eclipse.core.indexer.BDTSqlProjectIndexerFactory"
            id="com.basis.bdt.eclipse.core.project.indexer">
        </projectIndexer>        
        <enable
            indexer="com.basis.bdt.eclipse.core.project.indexer"
            nature="com.basis.bdt.eclipse.core.nature">
        </enable>
        <disable
            indexer="org.eclipse.dltk.core.indexer.mixin"
            nature="com.basis.bdt.eclipse.core.nature">
        </disable>
        <disable
            indexer="org.eclipse.dltk.core.indexer.structure"
            nature="com.basis.bdt.eclipse.core.nature">
        </disable>
        <disable
            indexer="org.eclipse.dltk.core.indexer.index2"
            nature="com.basis.bdt.eclipse.core.nature">
        </disable>
   </extension>


I created my own BDTSqlProjectIndexer (created through a factory extension so I could have guice inject it) and enabled it.

BDTSqlProjectIIndexer extends ProjectIndexer2
in the method wantRefreshOnStart() you return true. So dltk calls your
startIndexing() method on waking up.

Here I grab the IScriptProjects open in the workspace, submit them to be removed, and then submit them to be indexed
    @Override
    public void startIndexing()
    {
        super.startIndexing();
        try
        {
            final IScriptProject[] projects =
                ScriptModelHelper
                    .getOpenedScriptProjects(DLTKCore
                        .create(ResourcesPlugin.getWorkspace().getRoot()),
                                             BasisNature.NATURE_ID);
            for (IScriptProject scriptProject : projects)
                super.removeProject(scriptProject.getPath());
            for (IScriptProject scriptProject : projects)
                super.indexProject(scriptProject);
        }
        catch (ModelException e)
        {
            logService.logError(BBCore.PLUGIN_ID, getClass(), "Error Indexing", e);
        }
    }


This means they're all indexed every time on workspace wakeup. This is a crude brute force method, I'm sure I can do some checking for this or that to see if the index for a project already exists ... if that project has dirty changes from the last time it was indexed etc.

I see the other language IDEs you can download and get source for : Ruby, Tcl, Python, JavaScript, and to some extent php's PDT - they're all quite comfortable using dltk classes in internal packages ... having run into problems in eclipse before doing this we hope to avoid that.
An advantage using ProjectIndexer2 here is that it is in a public package, using its own internal packages to do its job.
Re: DLTK indexes' load is not being performed [message #1477872 is a reply to message #1477868] Tue, 18 November 2014 07:18 Go to previous messageGo to next message
Kevin Hagel is currently offline Kevin HagelFriend
Messages: 26
Registered: December 2012
Junior Member
a followup: You have to configure and implement your IndexerPartitipant
    <extension
          point="org.eclipse.dltk.core.indexerParticipant">
       <indexerParticipant
             class="com.basis.bdt.eclipse.core.indexer.BBjIndexerParticipant"
             nature="com.basis.bdt.eclipse.core.nature"
             targetId="org.eclipse.dltk.core.index.sql.indexer">
       </indexerParticipant>
    </extension>


and have it return your own IIndexingParser and IElementResolver
Re: DLTK indexes' load is not being performed [message #1560096 is a reply to message #1477872] Mon, 12 January 2015 11:43 Go to previous messageGo to next message
Eriky Raggeoto Kashivagui is currently offline Eriky Raggeoto KashivaguiFriend
Messages: 7
Registered: October 2014
Junior Member
Hello Kevin, I've opened an issue some time ago bugs.eclipse.org/bugs/show_bug.cgi?id=447571.

So, they recently solved it removing the H2Cache and indexing Database columns. Now the searches are made directly into the H2 Database.
Thank you for your help.
Re: DLTK indexes' load is not being performed [message #1669993 is a reply to message #1560096] Fri, 13 March 2015 03:30 Go to previous message
Eriky Raggeoto Kashivagui is currently offline Eriky Raggeoto KashivaguiFriend
Messages: 7
Registered: October 2014
Junior Member
Issue resolved in the last DLTK release 5.1.1.

Thanks for the committers.
Previous Topic:is it over?
Next Topic:[Tcl] [JACL] Want to use jacl as the DLTK Interpreter
Goto Forum:
  


Current Time: Mon Jun 18 08:00:58 GMT 2018

Powered by FUDForum. Page generated in 0.02393 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top