Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » Re: How add restriction to delete a component
Re: How add restriction to delete a component [message #902629] Thu, 16 August 2012 17:41
Konstantin Scheglov is currently offline Konstantin Scheglov
Messages: 555
Registered: July 2009
Senior Member
IIRC "isComponentType" is available only for flow/simple containers.
And if there is any error in "canDelete" script, we consider this as "false".


In other scripts you have only ReflectionUtils class.
But actually all this can be done using ReflectionUtils, see org.eclipse.wb.internal.core.model.generic.ContainerObjectValidators.DEF_functions

[code][ private static final String DEF_functions = StringUtils.join(new String[]{
"def isModelType(model, c) {",
" if (c is String) {",
" return ReflectionUtils.isSuccessorOf((Class) model.description.componentClass, c);",
" } else {",
" return c.isAssignableFrom(model.description.componentClass);",
" }",
"};",
"def isSuccessorOf(o, c) {",
" if (c is String) {",
" return ReflectionUtils.isSuccessorOf(o, c);",
" } else {",
" return o != null && c.isAssignableFrom(o.getClass());",
" }",
"};",
"def isComponentType(c) {",
" return isModelType(component, c);",
"};",
"def isReferenceType(c) {",
" return isModelType(reference, c);",
"};",
"def isContainerType(c) {",
" return isModelType(container, c);",
"};",
"def isContainerThis() {",
" return isSuccessorOf(container.creationSupport, "
+ "'org.eclipse.wb.internal.core.model.creation.ThisCreationSupport');",
"};",}, "\n");
/code]
--
Konstantin Scheglov,
Google, Inc.


Konstantin Scheglov,
Google, Inc.
Previous Topic:Re: How add restriction to delete a component
Next Topic:Re: How add restriction to delete a component
Goto Forum:
  


Current Time: Sun Oct 26 01:24:10 GMT 2014

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

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