Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342088 - Support project relative paths
Summary: Support project relative paths
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Konstantin Komissarchik CLA
QA Contact:
URL:
Whiteboard: plan
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-06 18:48 EDT by Brian Fitzpatrick CLA
Modified: 2021-11-19 09:21 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Fitzpatrick CLA 2011-04-06 18:48:39 EDT
One of the things that we do quite a bit is browse the project for a file, so that any file references when we deploy are all relative. And I found your example that mentions the @EclipseWorkspacePath annotation in the Browsing section of the Sapphire Help, which is great if you're dealing with Workspace-relative paths, but not specific enough for Project-relative paths.

That led me to poke around with creating a custom class extending BasePathsProviderImpl... but then I stumbled upon ProjectRootBasePathsProvider. 

Is there a reason this is internal? I know I could simply make a copy of the class and stash it in my own project, but that kind of defeats the purpose.
Comment 1 Konstantin Komissarchik CLA 2011-04-07 02:15:51 EDT
I will take care of this together with Bug 342099 as all of the code with dependencies on workspace APIs will need to move.
Comment 2 Konstantin Komissarchik CLA 2011-04-13 14:21:13 EDT
Rather than exposing ProjectRootBasePathsProvider class, I have paralleled the way relative workspace paths are supported with @ProjectRelativePath annotation (org.eclipse.sapphire.workspace plugin). 

Use this annotation like this:

@Type( base = IPath.class )
@ProjectRelativePath
@MustExist
    
ValueProperty PROP_PROJECT_RELATIVE_PATH = new ValueProperty( TYPE, "ProjectRelativePath" );
    
Value<IPath> getProjectRelativePath();
void setProjectRelativePath( String value );
void setProjectRelativePath( IPath value );

For this to work, the model must be based on a resource located in a project, such as when a Sapphire editor is opened on a file in a project.

Using @ProjectRelativePath annotation together with @MustExist, @ValidFileSystemResourceType and @ValidFileExtension, gives you validation, browse dialog and jump action (ctrl+click on path to open file). 

Added an example to gallery sample.
Added content to the what's new document in the developer guide.
Added TestWorkspace0001 unit test to cover validation.

Once you had a chance to move to the newest build and play around with this feature, please make a note of that here so that we can consider this verified and close the bug.
Comment 3 Konstantin Komissarchik CLA 2011-06-06 11:58:52 EDT
Brian,

Could you verify this enhancement? Thanks!
Comment 4 Brian Fitzpatrick CLA 2011-06-09 08:47:32 EDT
I can look at verifying this when I get back from vacation the middle of next week...
Comment 5 Konstantin Komissarchik CLA 2011-06-17 14:28:41 EDT
Brian,

Will you be able to verify this before our ship date on 6/22?
Comment 6 Brian Fitzpatrick CLA 2011-06-17 15:32:16 EDT
Yes, I can look at this on Monday and get back to you... (Scribbling it in my list of things to do now...)
Comment 7 Brian Fitzpatrick CLA 2011-06-20 15:19:43 EDT
(In reply to comment #6)
> Yes, I can look at this on Monday and get back to you... (Scribbling it in my
> list of things to do now...)

Ok... I've added some additional annotations, but am unsure quite how to test this bugger. I'm not seeing any sort of browse dialog show up. My annotations look like this... Have I messed something up?


    // *** smooks:config ***
    
    @XmlBinding( path = "smooks:config" )
    @Label( standard = "&Smooks Config" )
    @Type( base = IPath.class )
    @ProjectRelativePath
    @Required
    @ValidFileSystemResourceType( FileSystemResourceType.FILE )
    @ValidFileExtensions( "xml" )
    @MustExist
        
    ValueProperty PROP_TRANSFORM_SMOOKS_CONFIG = new ValueProperty( TYPE, "TransformSmooksConfig" );
        
    Value<IPath> getTransformSmooksConfig();
    void setTransformSmooksConfig( String value );
    void setTransformSmooksConfig( IPath value );
Comment 8 Brian Fitzpatrick CLA 2011-06-20 15:25:39 EDT
I'm seeing this in the console:

ERROR : Could not find serializer for org.eclipse.core.runtime.IPath. Type is used in org.jboss.tools.esb.switchyard.ITransformSmooks.TransformSmooksConfig.
Comment 9 Konstantin Komissarchik CLA 2011-06-20 15:31:48 EDT
In 0.3, the use of org.eclipse.core.runtime.IPath in the framework has been replaced with built-in org.eclipse.sapphire.modeling.Path class to break the dependency on Eclipse in core bundles.
Comment 10 Brian Fitzpatrick CLA 2011-06-20 15:36:06 EDT
(In reply to comment #9)
> In 0.3, the use of org.eclipse.core.runtime.IPath in the framework has been
> replaced with built-in org.eclipse.sapphire.modeling.Path class to break the
> dependency on Eclipse in core bundles.

And there is much rejoicing!! 

Consider this one licked. Thanks for the assistance Konstantin!
Comment 11 Konstantin Komissarchik CLA 2011-06-20 15:37:00 EDT
Closing as resolved. Thanks for the verification, Brian.