Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » Change interpreter for project
Change interpreter for project [message #540424] Wed, 16 June 2010 02:45 Go to next message
Claudio Cancinos is currently offline Claudio Cancinos
Messages: 6
Registered: July 2009
Junior Member
Hi!

I'm using DLTK 1.0.2.v20100208-7C-77EAAoORwQXXqBeY-d and in my ide implementation I'd like to change the interpreter used for a specific project like in JDT using the project properties->java build path-> libraries tab.

I already have my own implementations of BuildPathsPropertyPage and BuildpathsBlock classes and I can see the project build path preference page similar to JDT in my ide.
The problem is when I go to Libraries tab. There I can see configured the default interpreter librarie configured for the project but there are 2 behaviours that differe from what I expected:

1) If I press the "Edit" button I get a dialog displaying a string representing the "buildpath container path", something like "org.eclipse.dltk.launching.INTERPRETER_CONTAINER"

What I'd like to have: a dialog similar to JDT with at least 1 combo containing the workspace configured interpreters from where I can choose one


2) If I press "Add Library..." I see a dialog with an empty table of libraries.

What I'd like to have: the table populated with the workspace configured interpreters.

Does DLTK have a proposed aproach for these features?



I copy the simple implementations of BuildPathsPropertyPage and BuildpathsBlock in case they might be useful:

public class TestBuildPathPropertyPage extends BuildPathsPropertyPage implements IWorkbenchPropertyPage {

	protected BuildpathsBlock createBuildPathBlock(IWorkbenchPreferenceContainer pageContainer) {
		return new TestBuildPathBlock(new BusyIndicatorRunnableContext(), this, getSettings().getInt(INDEX), false,
				pageContainer);
	}

	public TestBuildPathPropertyPage() {
	}

	public IDLTKLanguageToolkit getLanguageToolkit() {
		return TestLanguageToolkit.getDefault();
	}

}


public class TestBuildPathBlock extends BuildpathsBlock {

	public TestBuildPathBlock(IRunnableContext runnableContext, IStatusChangeListener context, int pageToShow,
			boolean useNewPage, IWorkbenchPreferenceContainer pageContainer) {
		super(runnableContext, context, pageToShow, useNewPage, pageContainer);
	}

	protected IPreferenceStore getPreferenceStore() {
		return TestCorePlugin.getDefault().getPreferenceStore();
	}

	protected boolean supportZips() {
		return false;
	}

}


Thanks in Advance!
Claudio

[Updated on: Thu, 17 June 2010 12:49]

Report message to a moderator

Re: Change interpreter for project [message #540448 is a reply to message #540424] Wed, 16 June 2010 04:17 Go to previous messageGo to next message
Alex Panchenko is currently offline Alex Panchenko
Messages: 342
Registered: July 2009
Senior Member
Hi Claudio,

I think you should do something like the following:

<extension point="org.eclipse.dltk.ui.buildpathContainerPage">
<buildpathContainerPage		 
class=" org.eclipse.dltk.ruby.internal.debug.ui.interpreters.RubyInterpreterContainerWizardPage "
id="org.eclipse.dltk.ruby.launching.INTERPRETER_CONTAINER"
name="Ruby Interpreter Libraries"
nature="org.eclipse.dltk.ruby.core.nature" />
</extension>



public class RubyInterpreterContainerWizardPage extends AbstractInterpreterContainerWizardPage {

	@Override
	public String getScriptNature() {
		return RubyNature.NATURE_ID;
	}

}


Regards,
Alex

[Updated on: Wed, 16 June 2010 22:32]

Report message to a moderator

Re: Change interpreter for project [message #540690 is a reply to message #540448] Wed, 16 June 2010 22:16 Go to previous messageGo to next message
Claudio Cancinos is currently offline Claudio Cancinos
Messages: 6
Registered: July 2009
Junior Member
Alex,

Thanks a lot for your answer, it really helped me Smile

Although in dltk version I'm using (the one from eclipse's update site), what I had to implement was something more like this:

public class TestInterpreterContainerWizardPage extends AbstractInterpreterContainerWizardPage {

	@Override
	protected AbstractInterpreterComboBlock getInterpreterBlock() {
		return new TestInterpreterComboBlock();
	}
}


public class TestInterpreterComboBlock extends AbstractInterpreterComboBlock {

	@Override
	protected String getCurrentLanguageNature() {
		return TestNature.ID;
	}

	@Override
	protected void showInterpreterPreferencePage() {
		// TODO not implemented yet...
	}
}


// I copy the code in case it could be useful for someone else

This makes me possible to have an element in the "Add LIbraries.." table allowing me add a new interpreter from the ones defined in the workspace but not yet to edit the currently defined in the project.


Best Regards
Claudio

[Updated on: Thu, 17 June 2010 12:48]

Report message to a moderator

Re: Change interpreter for project [message #540691 is a reply to message #540690] Wed, 16 June 2010 22:31 Go to previous message
Alex Panchenko is currently offline Alex Panchenko
Messages: 342
Registered: July 2009
Senior Member
Hi Claudio,

You are right, I provided example from DLTK 2.0. And it looks smaller Smile
DLTK 2.0 is part of Helios Simultaneous Release (Scheduled in a week), so I think now is a good time to upgrade.

Regards,
Alex
Previous Topic:How to display the libraries node in ScriptExplorer?
Next Topic:[BUILD] S-2.0RC4-201006161315
Goto Forum:
  


Current Time: Sun Aug 31 00:39:18 EDT 2014

Powered by FUDForum. Page generated in 0.01681 seconds