Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to use wst.facets or provide an adapter to an existing facet #99

Closed
gamerson opened this issue Jul 4, 2014 · 5 comments
Closed
Milestone

Comments

@gamerson
Copy link
Contributor

gamerson commented Jul 4, 2014

Liferay IDE projects are just webtools projects with liferay.* facet. I would like the ability to either adapt a ternNature to the liferay facet or add support in tern for tern.java facet that would serve the same purpose as ternNature.

@gamerson
Copy link
Contributor Author

gamerson commented Jul 4, 2014

Either solution works for me and I will be willing to write the code for either but I wanted to see what others here thought: @pascalleclercq @vrubezhny

@gamerson
Copy link
Contributor Author

gamerson commented Jul 4, 2014

By far the simpler change is to just add a "class" element to the ternNatureAdapter and if an adopter provides a class (as opposed to just another nature id) then the tern adapter manager could call a method adapt on that class and see if tern should "recognize" that project, then adopters are free to implement the "this is a tern project" however they need, and in my case it would be the existence of liferay.portlet facet.

@angelozerr
Copy link
Owner

Indeed, today tern nature adapter works only with project nature :

You can write that :

<extension point="tern.eclipse.ide.core.ternNatureAdapters">
    <ternAdaptToNature
        id = "org.eclipse.angularjs.core.angularnature"
        name = "AngularAppNature">
        <defaultModules>
            <module name="angular" withDependencies="true"/>
        </defaultModules>
    </ternAdaptToNature>
</extension>    

It means that project which has the nature "org.eclipse.angularjs.core.angularnature" is a tern project.

If I understand your need, you wish to use facet and not the project nature. To do that we could provide :

  • a new interface tern.eclipse.ide.core.ITernNatureCapability like this :

    package tern.eclipse.ide.core;
    
    import org.eclipse.core.resources.IProject;
    
    public interface ITernNatureCapability {
    
        boolean hasTernNature(IProject project);
    }
    
  • create your own implementation MyTernNatureCapability of this interface and use it with class attribute :

    <extension point="tern.eclipse.ide.core.ternNatureAdapters">
        <ternAdaptToNature
            id = "org.eclipse.angularjs.core.angularnature"
            name = "AngularAppNature"
                class="MyTernNatureCapability " >
            <defaultModules>
                <module name="angular" withDependencies="true"/>
            </defaultModules>
        </ternAdaptToNature>
    </extension> 
    

If class is not defined, it uses project nature like today.

@gamerson @vrubezhny what do you think about that?

Perhaps you will find a better name than ITernNatureCapability .

@gamerson
Copy link
Contributor Author

gamerson commented Jul 4, 2014

That sounds good. On the flight from china to US (I didn't see your mail) I
wrote some code to do just that Once I get my laptop on wifi I'll send
you the code that works for our projects.

On Friday, July 4, 2014, Angelo notifications@github.com wrote:

Indeed, today tern nature adapter works only with project nature :

You can write that :

It means that project which has the nature
"org.eclipse.angularjs.core.angularnature" is a tern project.

If I understand your need, you wish to use facet and not the project
nature. To do that we could provide :

a new interface tern.eclipse.ide.core.ITernNatureCapability like this
:

package tern.eclipse.ide.core;

import org.eclipse.core.resources.IProject;

public interface ITernNatureCapability {

boolean hasTernNature(IProject project);

}
-

create your own implementation MyTernNatureCapability of this
interface and use it with class attribute :

id = "org.eclipse.angularjs.core.angularnature"
name = "AngularAppNature"
class="MyTernNatureCapability " >

If class is not defined, it uses project nature like today.

@gamerson https://github.com/gamerson @vrubezhny
https://github.com/vrubezhny what do you think about that?

Perhaps you will find a better name than ITernNatureCapability .


Reply to this email directly or view it on GitHub
#99 (comment).

Greg Amerson
Liferay Developer Tools
Liferay, Inc. www.liferay.com

@angelozerr
Copy link
Owner

I close this issue since a PR was done for that at #100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants