|
Re: Fillter predicate [message #1062003 is a reply to message #1062001] |
Wed, 05 June 2013 11:21 |
|
Hi,
why do youn still not post the scopeprovider??????
IScope scope_ContentType_parentContentType(final ContentType ctx, EReference r) {
//alternatively do your aglo here and call Scopes.scopeFor
return new FilteringScope(delegateGetScope(ctx, r), new Predicate<IEObjectDescription>() {
public boolean apply(IEObjectDescription d) {
return !ctx.getName().equals(d.getName().toString());
};
});
}
(DID not try that)
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
[Updated on: Wed, 05 June 2013 11:22] Report message to a moderator
|
|
|
|
|
|
Re: Fillter predicate [message #1062131 is a reply to message #1062032] |
Thu, 06 June 2013 07:30 |
junior developer Messages: 354 Registered: January 2013 |
Senior Member |
|
|
Hi Christian,
I create a new Project without GMF.but my problem is scoping.hence I used qualifiedname
now ,another problem encountered. onlly ct1 comes in the ContentType's parent .ct2 is not come in the ContentType's parent.hence not comes elements are defined below in the contenttype's parent.such as I define a contenttype in the same customlist but not come in the contenttype's parent. How can I solved this scoping problem.There are top-down scop.if I defined contenttype in the ebove ,they comes in the below contenttype's parent.
Best regrads,
[Updated on: Thu, 06 June 2013 07:39] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Fillter predicate [message #1062172 is a reply to message #1062166] |
Thu, 06 June 2013 11:41 |
junior developer Messages: 354 Registered: January 2013 |
Senior Member |
|
|
Hi,
I want to call returned value from the ContentTypeUtil.getPossibleParentContentType(ctx);
Scope class:
public class ContentModelScopeProvider extends AbstractDeclarativeScopeProvider {
IScope scope_ContentType_parentContentType(final ContentType ctx, EReference r) {
final EObject parent = ctx;
//System.out.println("parennnnnnnnnnnnnnnnnttttttttttttttttt"+parent);
final ArrayList<ContentType> possiblecontenttype = ContentTypeUtil.getPossibleParentContentType(ctx);
//System.out.println("possible"+ possiblecontenttype);
return new FilteringScope(delegateGetScope(ctx, r), new Predicate<IEObjectDescription>() {
public boolean apply(IEObjectDescription d) {
System.out.println("........................."+d.getName().toString());
return possiblecontenttype; //I receive an error because not returns
};
});
}
}
I want to use my util class because there are a lots of constraints my system:( and I write code for this (my util class)
public static ArrayList<ContentType> getPossibleParentContentType(ContentType content){
//Oncelikle rootWeb bulunur Buradanda tüm ContentTypelar cekilecek.
Web web = ((Web)((CustomList)content.eContainer()).eContainer());
while(web.eContainer().eClass().getName().equals("Web")){
web = (Web) web.eContainer();
}
ArrayList<ContentType> allContentTypes = new ArrayList<>();
//Burada Dokumandakı tum ContentTypelar cekilir.
allContentTypes = returnAllContentTypeFromGivenWeb(web, allContentTypes);
//Burada kendi dışındaki contentTypeları getirip seçmesini isterim.
allContentTypes.remove(content);
return allContentTypes;
}
public static ArrayList<ContentType> returnAllContentTypeFromGivenWeb(Web rootWeb, ArrayList<ContentType> returnAllContentTypesFromWeb){
EList<CustomList> ownedLists = rootWeb.getOwnedList();
for (Iterator<CustomList> iterator = ownedLists.iterator(); iterator.hasNext();) {
CustomList customList = (CustomList) iterator.next();
EList<ContentType> ownedContentTypes = customList.getOwnedContentType();
for (Iterator<ContentType> iterator2 = ownedContentTypes.iterator(); iterator2
.hasNext();) {
ContentType contentType = (ContentType) iterator2.next();
returnAllContentTypesFromWeb.add(contentType);
}
}
EList<Web> ownedWebs = rootWeb.getOwnedWeb();
for (Iterator<Web> iterator = ownedWebs.iterator(); iterator.hasNext();) {
Web web = (Web) iterator.next();
returnAllContentTypeFromGivenWeb(web, returnAllContentTypesFromWeb);
}
return returnAllContentTypesFromWeb;
}
}
[Updated on: Thu, 06 June 2013 11:43] Report message to a moderator
|
|
|
Re: Fillter predicate [message #1062183 is a reply to message #1062172] |
Thu, 06 June 2013 12:18 |
|
Looks like you mixed up two things once more.
you have to choose possibility a or possibility b
public class ContentModelScopeProvider extends AbstractDeclarativeScopeProvider {
IScope scope_ContentType_parentContentType(final ContentType ctx, EReference r) {
final EObject parent = ctx;
//System.out.println("parennnnnnnnnnnnnnnnnttttttttttttttttt"+parent);
final ArrayList<ContentType> possiblecontenttype = ContentTypeUtil.getPossibleParentContentType(ctx);
return Scopes.scopeFor(possiblecontenttype );
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05677 seconds