Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Faceted Project Framework » modifying facet constraints programmatically
modifying facet constraints programmatically [message #491276] Tue, 13 October 2009 22:21 Go to next message
Hania A. is currently offline Hania A.Friend
Messages: 6
Registered: July 2009
Junior Member
Hi!

I had a question regarding WTP facets that I was hoping someone might be able to help me with.

I work on a project that adds a custom facet to a dynamic web project, along with a certain number of required prerequisites. Some time after the project is created, I need to be able to remove some of those required facets programmatically as part of project maintenance. I am running into a problem, however, because understandably "One or more constraints have not been satisfied." So my question is: is there any way to programmatically modify the project's constraints so that I can remove required facets (or add conflicting ones)?

I really appreciate any help or direction you can offer in this regard.

thank you,
Hania A.
Re: modifying facet constraints programmatically [message #491468 is a reply to message #491276] Wed, 14 October 2009 17:39 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
The API is not going to knowingly allow you to get into an invalid state, so you can't remove a facet that another facet depends on and leave it at that.

But, the API does support the case where you are replacing one facet with another. Say you have facet A that requires B or C. Currently A and B are installed. You can't just remove B, but you can remove B and add C as long as you do it all in one operation. If this sounds like something that would help you out, take a look at the IFacetedProjectWorkingCopy interface. The working copy allows you to compose all of the your changes in memory and then do a single "commit" operation.

Hope this helps.

- Konstantin
Re: modifying facet constraints programmatically [message #491469 is a reply to message #491468] Wed, 14 October 2009 17:52 Go to previous messageGo to next message
Hania A. is currently offline Hania A.Friend
Messages: 6
Registered: July 2009
Junior Member
Thanks Konstantin. I've been using IFacetedProjectWorkingCopy that but it didn't solve my problem.

What I would like to do is to completely change what the requirements of my facet are programmatically so that the new state is not considered invalid.

Eg. originally my facet A required B and C, I would now like to modify it so that A only requires B. Or instead A requires B and D and conflicts with E, etc.
I would like to do this without changing plugin.xml.

Do you know if there is a way to do this?

thank you,
Hania
Re: modifying facet constraints programmatically [message #491472 is a reply to message #491469] Wed, 14 October 2009 17:58 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
I am afraid that there is no way to alter facet constraints without changing facet declaration. I am curious though about your scenario where you are finding this to be necessary. Could you go into more detail? I haven't heard anyone request localized constraints before.

- Konstantin
Re: modifying facet constraints programmatically [message #491480 is a reply to message #491472] Wed, 14 October 2009 18:19 Go to previous message
Hania A. is currently offline Hania A.Friend
Messages: 6
Registered: July 2009
Junior Member
Actually I'm trying to get around a side effect that a facet I require causes when modifying the version but not when installing it. So rather than changing the version I was trying to uninstall/reinstall. Since I have to do it all in one operation, however, it's smart enough to recognize this sequence as a version change action and causes the unwanted side-effect anyhow.

I realize this is not exactly a scenario that would be ideal for dynamically modifying constraints, but I had hoped the facility existed for some other more legitimate reason Smile

thank you for your help anyhow Konstantin, much appreciated!

Hania
Re: modifying facet constraints programmatically [message #572197 is a reply to message #491276] Wed, 14 October 2009 17:39 Go to previous message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
The API is not going to knowingly allow you to get into an invalid state, so you can't remove a facet that another facet depends on and leave it at that.

But, the API does support the case where you are replacing one facet with another. Say you have facet A that requires B or C. Currently A and B are installed. You can't just remove B, but you can remove B and add C as long as you do it all in one operation. If this sounds like something that would help you out, take a look at the IFacetedProjectWorkingCopy interface. The working copy allows you to compose all of the your changes in memory and then do a single "commit" operation.

Hope this helps.

- Konstantin
Re: modifying facet constraints programmatically [message #572214 is a reply to message #572197] Wed, 14 October 2009 17:52 Go to previous message
Hania A. is currently offline Hania A.Friend
Messages: 6
Registered: July 2009
Junior Member
Thanks Konstantin. I've been using IFacetedProjectWorkingCopy that but it didn't solve my problem.

What I would like to do is to completely change what the requirements of my facet are programmatically so that the new state is not considered invalid.

Eg. originally my facet A required B and C, I would now like to modify it so that A only requires B. Or instead A requires B and D and conflicts with E, etc.
I would like to do this without changing plugin.xml.

Do you know if there is a way to do this?

thank you,
Hania
Re: modifying facet constraints programmatically [message #572243 is a reply to message #572214] Wed, 14 October 2009 17:58 Go to previous message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
I am afraid that there is no way to alter facet constraints without changing facet declaration. I am curious though about your scenario where you are finding this to be necessary. Could you go into more detail? I haven't heard anyone request localized constraints before.

- Konstantin
Re: modifying facet constraints programmatically [message #572277 is a reply to message #491472] Wed, 14 October 2009 18:19 Go to previous message
Hania A. is currently offline Hania A.Friend
Messages: 6
Registered: July 2009
Junior Member
Actually I'm trying to get around a side effect that a facet I require causes when modifying the version but not when installing it. So rather than changing the version I was trying to uninstall/reinstall. Since I have to do it all in one operation, however, it's smart enough to recognize this sequence as a version change action and causes the unwanted side-effect anyhow.

I realize this is not exactly a scenario that would be ideal for dynamically modifying constraints, but I had hoped the facility existed for some other more legitimate reason :)

thank you for your help anyhow Konstantin, much appreciated!

Hania
Previous Topic:modifying facet constraints programmatically
Next Topic:Default facets and Dynamic Preset
Goto Forum:
  


Current Time: Mon Dec 30 16:17:23 GMT 2024

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

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

Back to the top