Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » Sapphire.Jump(For Resource bundle)
Sapphire.Jump [message #728203] Thu, 22 September 2011 18:01 Go to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
I having a model element that will hold ResourceBundle. let me call call the List Property as "ResourceBundles" of type "IResourceBundle". the IResourceBundle has just one property called "ResourceBundle" which is defined as follows,
// *** ResourceBundle ***
	@Type( base = Path.class )
	@Services( value = { @Service( impl = ProjectRelativePathService.class ),
		@Service( impl = ResourceBundleValidationService.class ) } )
	@FileExtensions( expr = "properties" )
	@CustomXmlValueBinding( impl = ResourceBundleValueBinding.class )
	ValueProperty PROP_RESOURCE_BUNDLE = new ValueProperty( TYPE, "ResourceBundle" );

	Value<Path> getResourceBundle();

	void setResourceBundle( String value );

	void setResourceBundle( Path value );


I have the following definition in sdef for the property
<property-editor>
	<property>ResourceBundles</property>
	<hint>
		<name>show.label</name>
		<value>false</value>
	</hint>
	<child-property>
		<property>ResourceBundle</property>
		<action-handler>
			<action>Sapphire.Jump</action>
			<label>Open</label>
			<impl>ResourceBundleJumpActionHandler</impl>
		</action-handler>
	</child-property>
</property-editor>



When the property is rendered as List Property editor, am not able to invoke my ResourceBundleJumpActionHandler, i don't see the Hyperlink under it ..

Not sure why this not enabling the action ? I am giving my ResourceBundleJumpActionHandler because i will convert the resource bundle to actual file and call the IDE.openEditor(). For testing purpose i have made my computeEnablement() always return true.

Any thoughts on this is much appreciated.

~Kamesh
Re: Sapphire.Jump [message #728220 is a reply to message #728203] Thu, 22 September 2011 18:29 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 942
Registered: July 2009
Senior Member
You shouldn't need to define your own jump action handler here as there is a system-provided one for any property with RelativePathService (RelativePathJumpActionHandler).

When activating jump command, make sure that you aren't trying to do that while in table cell editing mode. When not in cell editing mode, hold down CTRL key, hover over the text in the table and you should see a hyperlink.

- Konstantin
Re: Sapphire.Jump [message #728222 is a reply to message #728220] Thu, 22 September 2011 18:34 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
But what if I want to give my own implementation, right now am opening a ResourceBundle which will look like com.test.Bundle actually that's file com/test/Bundle.properties, so i need to convert the file to workspace file before I open it. that's why I was implicitly providing Sapphire.Jump and giving my handler.

Will this not work ? I don't see any hyper link on my ListProperty even when am not in cell editing mode.
Re: Sapphire.Jump [message #728227 is a reply to message #728222] Thu, 22 September 2011 18:42 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 942
Registered: July 2009
Senior Member
Converting between a relative path (whatever the format) and the absolute path (in standard format) is the job of RelativePathService. I am not sure why this isn't working for you. I tried a similar case just now and it's working fine. Put a few breakpoints inside your jump action handler or disable yours and put breakpoints inside RelativePathJumpActionHandler.

- Konstantin
Re: Sapphire.Jump [message #728229 is a reply to message #728227] Thu, 22 September 2011 18:46 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 942
Registered: July 2009
Senior Member
May want to try your code on Windows to see if it works there. Painting jump hyperlinks is non-native behavior, there could be differences on Linux. It was tested on at least one version of Linux when originally implemented, but that was a while ago.

- Konstantin
Re: Sapphire.Jump [message #728230 is a reply to message #728227] Thu, 22 September 2011 18:49 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
no actually my file (properties) file is of java package format like com.test.Sapphire --> src/com/test/Sapphire.properties, but strangely when i added to my own sapphire-extension.xml of my plugin and copy and pasted the action with a special condition that its only for my ResourceBundle or its related model.

I will also try to debug it and see too.
Re: Sapphire.Jump [message #728235 is a reply to message #728230] Thu, 22 September 2011 19:01 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 942
Registered: July 2009
Senior Member
> actually my file (properties) file is of java package format like com.test.Sapphire

That doesn't matter for RelativePathService. You can implement different separators, handle path variables, etc. You just need to implement RelativePathService's convertToRelative and convertToAbsolute methods.

- Konstantin
Re: Sapphire.Jump [message #728246 is a reply to message #728235] Thu, 22 September 2011 19:19 Go to previous message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
ah!!! i see that right now i have not implemented it, let me try implementing it and remove my extension and see if that works for me. Thanks for the insight.
Previous Topic:Multiple Dev Env and Dev Target
Next Topic:Validation Service
Goto Forum:
  


Current Time: Sun Oct 26 01:21:04 GMT 2014

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

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