Source Code Cross Referenced for BpelNode.java in  » IDE-Netbeans » bpel » org » netbeans » modules » bpel » nodes » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » bpel » org.netbeans.modules.bpel.nodes 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * The contents of this file are subject to the terms of the Common Development
0003:         * and Distribution License (the License). You may not use this file except in
0004:         * compliance with the License.
0005:         * 
0006:         * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
0007:         * or http://www.netbeans.org/cddl.txt.
0008:         * 
0009:         * When distributing Covered Code, include this CDDL Header Notice in each file
0010:         * and include the License file at http://www.netbeans.org/cddl.txt.
0011:         * If applicable, add the following below the CDDL Header, with the fields
0012:         * enclosed by brackets [] replaced by your own identifying information:
0013:         * "Portions Copyrighted [year] [name of copyright owner]"
0014:         * 
0015:         * The Original Software is NetBeans. The Initial Developer of the Original
0016:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
0017:         * Microsystems, Inc. All Rights Reserved.
0018:         */
0019:        package org.netbeans.modules.bpel.nodes;
0020:
0021:        import org.netbeans.modules.bpel.editors.api.nodes.*;
0022:        import org.netbeans.modules.bpel.nodes.*;
0023:        import java.awt.Image;
0024:        import java.awt.datatransfer.Transferable;
0025:        import java.io.IOException;
0026:        import java.util.ArrayList;
0027:        import java.util.Comparator;
0028:        import java.util.HashMap;
0029:        import java.util.List;
0030:        import java.util.Map;
0031:        import javax.swing.Action;
0032:        import org.netbeans.modules.bpel.design.model.DelegatingChangeEventListener;
0033:        import org.netbeans.modules.bpel.model.api.CompositeActivity;
0034:        import org.netbeans.modules.bpel.model.api.Documentation;
0035:        import org.netbeans.modules.bpel.nodes.actions.AddElseAction;
0036:        import org.netbeans.modules.bpel.nodes.actions.AddFromPaletteAction;
0037:        import org.netbeans.modules.bpel.nodes.actions.AddPartnerLinkAction;
0038:        import org.netbeans.modules.bpel.nodes.actions.GoToTypeSourceAction;
0039:        import org.netbeans.modules.bpel.nodes.actions.MoveDownBpelEntityAction;
0040:        import org.netbeans.modules.bpel.nodes.actions.MoveUpBpelEntityAction;
0041:        import org.netbeans.modules.bpel.nodes.actions.WrapAction;
0042:        import org.netbeans.modules.soa.ui.nodes.InstanceRef;
0043:        import org.netbeans.modules.bpel.model.api.Activity;
0044:        import org.netbeans.modules.bpel.model.api.BaseScope;
0045:        import org.netbeans.modules.bpel.model.api.BpelEntity;
0046:        import org.netbeans.modules.bpel.model.api.BpelModel;
0047:        import org.netbeans.modules.bpel.model.api.ContentElement;
0048:        import org.netbeans.modules.bpel.model.api.Scope;
0049:        import org.netbeans.modules.bpel.model.api.Process;
0050:        import org.netbeans.modules.bpel.model.api.events.ArrayUpdateEvent;
0051:        import org.netbeans.modules.bpel.model.api.events.ChangeEvent;
0052:        import org.netbeans.modules.bpel.model.api.events.ChangeEventListenerAdapter;
0053:        import org.netbeans.modules.bpel.model.api.events.EntityInsertEvent;
0054:        import org.netbeans.modules.bpel.model.api.events.EntityRemoveEvent;
0055:        import org.netbeans.modules.bpel.model.api.events.EntityUpdateEvent;
0056:        import org.netbeans.modules.bpel.model.api.events.PropertyRemoveEvent;
0057:        import org.netbeans.modules.bpel.editors.api.nodes.NodeType;
0058:        import org.netbeans.modules.bpel.model.api.BpelContainer;
0059:        import org.netbeans.modules.bpel.model.api.CompensatableActivityHolder;
0060:        import org.netbeans.modules.bpel.model.api.events.ChangeEventListener;
0061:        import org.netbeans.modules.soa.ui.nodes.NodeTypeHolder;
0062:        import org.netbeans.modules.bpel.model.api.events.PropertyUpdateEvent;
0063:        import org.netbeans.modules.bpel.model.api.support.UniqueId;
0064:        import org.netbeans.modules.bpel.nodes.actions.AddPropertyToWsdlAction;
0065:        import org.netbeans.modules.bpel.nodes.actions.DeleteBpelExtensibiltyWsdlRefAction;
0066:        import org.netbeans.modules.bpel.nodes.actions.DeletePropertyAction;
0067:        import org.netbeans.modules.bpel.nodes.actions.FindMexPeerAction;
0068:        import org.netbeans.modules.bpel.nodes.actions.GoToDiagrammAction;
0069:        import org.netbeans.modules.bpel.nodes.actions.GoToMessageExchangeContainerSourceAction;
0070:        import org.netbeans.modules.bpel.nodes.actions.MoveDownCopyAction;
0071:        import org.netbeans.modules.bpel.nodes.actions.MoveUpCopyAction;
0072:        import org.netbeans.modules.bpel.nodes.actions.ShowBpelMapperAction;
0073:        import org.netbeans.modules.bpel.nodes.actions.ToggleBreakpointAction;
0074:        import org.netbeans.modules.bpel.nodes.navigator.BpelNavigatorLookupHint;
0075:        import org.netbeans.modules.bpel.nodes.navigator.BpelNavigatorDecorationProvider;
0076:        import org.netbeans.modules.bpel.nodes.validation.ChangeValidationListener;
0077:        import org.netbeans.modules.bpel.nodes.validation.ValidationProxyListener;
0078:        import org.netbeans.modules.bpel.properties.Constants;
0079:        import org.netbeans.modules.soa.ui.ExtendedLookup;
0080:        import org.netbeans.modules.soa.ui.nodes.NodesTreeParams;
0081:        import org.netbeans.modules.bpel.editors.api.nodes.actions.ActionType;
0082:        import org.netbeans.modules.bpel.nodes.actions.AddCatchAction;
0083:        import org.netbeans.modules.bpel.nodes.actions.AddCatchAllAction;
0084:        import org.netbeans.modules.bpel.nodes.actions.AddCompensationHandlerAction;
0085:        import org.netbeans.modules.bpel.nodes.actions.AddElseIfAction;
0086:        import org.netbeans.modules.bpel.nodes.actions.AddCorrelationSetAction;
0087:        import org.netbeans.modules.bpel.nodes.actions.DefineCorrelationAction;
0088:        import org.netbeans.modules.bpel.nodes.actions.AddMessageExchangeAction;
0089:        import org.netbeans.modules.bpel.nodes.actions.AddOnAlarmAction;
0090:        import org.netbeans.modules.bpel.nodes.actions.AddOnEventAction;
0091:        import org.netbeans.modules.bpel.nodes.actions.AddPropertyAction;
0092:        import org.netbeans.modules.bpel.nodes.actions.AddPropertyAliasToWsdlAction;
0093:        import org.netbeans.modules.bpel.nodes.actions.AddSchemaImportAction;
0094:        import org.netbeans.modules.bpel.nodes.actions.AddTerminationHandlerAction;
0095:        import org.netbeans.modules.bpel.nodes.actions.BpelNodeAction;
0096:        import org.netbeans.modules.bpel.nodes.actions.BpelNodeNewType;
0097:        import org.netbeans.modules.bpel.nodes.actions.GoToSourceAction;
0098:        import org.netbeans.modules.bpel.nodes.actions.InsertElseIfAfterAction;
0099:        import org.netbeans.modules.bpel.nodes.actions.InsertElseIfBeforeAction;
0100:        import org.netbeans.modules.bpel.nodes.actions.MoveElseIfLeftAction;
0101:        import org.netbeans.modules.bpel.nodes.actions.MoveElseIfRightAction;
0102:        import org.netbeans.modules.bpel.nodes.actions.AddVariableAction;
0103:        import org.netbeans.modules.bpel.nodes.actions.AddWsdlImportAction;
0104:        import org.netbeans.modules.bpel.nodes.actions.DeleteAction;
0105:        import org.netbeans.modules.bpel.nodes.actions.GoToCorrelationSetContainerSourceAction;
0106:        import org.netbeans.modules.bpel.nodes.actions.GoToVariableContainerSourceAction;
0107:        import org.netbeans.modules.bpel.nodes.actions.OpenInEditorAction;
0108:        import org.netbeans.modules.bpel.nodes.actions.OpenPartnerLinkInEditor;
0109:        import org.netbeans.modules.bpel.nodes.actions.ShowPropertyEditorAction;
0110:        import org.netbeans.modules.bpel.nodes.dnd.BpelEntityPasteType;
0111:        import org.netbeans.modules.bpel.nodes.dnd.BpelNodeTransferable;
0112:        import org.netbeans.modules.bpel.nodes.dnd.Util;
0113:        import org.netbeans.modules.bpel.properties.PropertyType;
0114:        import org.netbeans.modules.bpel.properties.props.PropertyUtils;
0115:        import org.netbeans.modules.refactoring.api.ui.RefactoringActionsFactory;
0116:        import org.netbeans.modules.soa.ui.SoaUiUtil;
0117:        import org.netbeans.modules.soa.ui.form.CustomNodeEditor;
0118:        import org.netbeans.modules.xml.xam.Component;
0119:        import org.netbeans.modules.xml.xam.Model;
0120:        import org.netbeans.modules.xml.xam.Named;
0121:        import org.netbeans.modules.xml.xam.dom.DocumentComponent;
0122:        import org.netbeans.modules.xml.xam.spi.Validator;
0123:        import org.netbeans.modules.xml.xam.ui.XAMUtils;
0124:        import org.netbeans.modules.xml.xam.ui.actions.GoToAction;
0125:        import org.openide.ErrorManager;
0126:        import org.openide.actions.NewAction;
0127:        import org.openide.actions.PropertiesAction;
0128:        import org.openide.actions.ReorderAction;
0129:        import org.openide.nodes.AbstractNode;
0130:        import org.openide.nodes.Children;
0131:        import org.openide.nodes.Node;
0132:        import org.openide.nodes.Node.Property;
0133:        import org.openide.nodes.Node.PropertySet;
0134:        import org.openide.nodes.Sheet;
0135:        import org.openide.util.HelpCtx;
0136:        import org.openide.util.Lookup;
0137:        import org.openide.util.Utilities;
0138:        import org.openide.util.actions.SystemAction;
0139:        import org.openide.util.datatransfer.NewType;
0140:        import org.openide.util.datatransfer.PasteType;
0141:
0142:        /**
0143:         * This class represents the base class for BPEL related nodes.
0144:         * <p>
0145:         * The PropertyNodeFactory class is implied that the derived nodes has
0146:         * at least one constructor with the specific parameters.
0147:         *
0148:         * @author nk160297
0149:         */
0150:        public abstract class BpelNode<T> extends AbstractNode implements 
0151:                InstanceRef<T>, NodeTypeHolder<NodeType> {
0152:
0153:            // constants used in childs
0154:            public static final String VARIABLE_EQ = " variable="; // NOI18N
0155:            public static final String MESSAGE_EXCHANGE_EQ = " messageExchange="; // NOI18N
0156:            public static final String PARTNER_LINK_EQ = " partnerLink="; // NOI18N
0157:            public static final String OPERATION_EQ = " operation="; // NOI18N
0158:            public static final String CREATE_INSTANCE_EQ = " createInstance="; // NOI18N
0159:            public static final String FROM_VARIABLE_EQ = " fromVariable="; // NOI18N
0160:            public static final String TO_VARIABLE_EQ = " toVariable="; // NOI18N
0161:            public static final String PART_EQ = " part="; // NOI18N
0162:            public static final String TYPE_EQ = " type="; // NOI18N
0163:            public static final String QUERY_EQ = " query="; // NOI18N
0164:            public static final String ELEMENT_EQ = " element="; // NOI18N
0165:            public static final String FOR_PROPERTY_EQ = " forProperty="; // NOI18N
0166:            public static final String EMPTY_STRING = "";
0167:            public static final String MESSAGE_TYPE_EQ = " messageType=";
0168:            public static final int MAX_CONTENT_NAME_LENGTH = 35;
0169:            public static final String DOTS_SIGN = "...";
0170:            public static final String DELIMITER = "/"; // NOI18N
0171:            public static final String EQUAL_SIGN = "="; // NOI18N
0172:            public static final String EXP_LABEL = "(exp)"; // NOI18N
0173:            public static final String QUERY_LABEL = "(query)"; // NOI18N
0174:            public static final String ENDPOINT_REFERENCE = "endpointReference"; // NOI18N
0175:            public static final String WHITE_SPACE = " "; // NOI18N
0176:
0177:            public static final Object UNKNOWN_OLD_VALUE = new Object();
0178:            //
0179:            private static final Map<ActionType, Action> ACTION_TYPE_MAP = new HashMap<ActionType, Action>();
0180:
0181:            private DecorationProvider decorationProvider;
0182:
0183:            static {
0184:                ACTION_TYPE_MAP.put(ActionType.REMOVE, SystemAction
0185:                        .get(DeleteAction.class));
0186:                ACTION_TYPE_MAP
0187:                        .put(ActionType.DELETE_BPEL_EXT_FROM_WSDL, SystemAction
0188:                                .get(DeleteBpelExtensibiltyWsdlRefAction.class));
0189:                ACTION_TYPE_MAP.put(ActionType.DELETE_PROPERTY_ACTION,
0190:                        SystemAction.get(DeletePropertyAction.class));
0191:                ACTION_TYPE_MAP.put(ActionType.SHOW_POPERTY_EDITOR,
0192:                        SystemAction.get(ShowPropertyEditorAction.class));
0193:                ACTION_TYPE_MAP.put(ActionType.ADD_CATCH, SystemAction
0194:                        .get(AddCatchAction.class));
0195:                ACTION_TYPE_MAP.put(ActionType.ADD_CATCH_ALL, SystemAction
0196:                        .get(AddCatchAllAction.class));
0197:                ACTION_TYPE_MAP.put(ActionType.ADD_COMPENSATION_HANDLER,
0198:                        SystemAction.get(AddCompensationHandlerAction.class));
0199:                ACTION_TYPE_MAP.put(ActionType.ADD_TERMINATION_HANDLER,
0200:                        SystemAction.get(AddTerminationHandlerAction.class));
0201:                ACTION_TYPE_MAP.put(ActionType.ADD_ON_EVENT, SystemAction
0202:                        .get(AddOnEventAction.class));
0203:                ACTION_TYPE_MAP.put(ActionType.ADD_ON_ALARM, SystemAction
0204:                        .get(AddOnAlarmAction.class));
0205:                ACTION_TYPE_MAP.put(ActionType.ADD_ELSE, SystemAction
0206:                        .get(AddElseAction.class));
0207:                ACTION_TYPE_MAP.put(ActionType.ADD_ELSE_IF, SystemAction
0208:                        .get(AddElseIfAction.class));
0209:                ACTION_TYPE_MAP.put(ActionType.INSERT_ELSE_IF_AFTER,
0210:                        SystemAction.get(InsertElseIfAfterAction.class));
0211:                ACTION_TYPE_MAP.put(ActionType.INSERT_ELSE_IF_BEFORE,
0212:                        SystemAction.get(InsertElseIfBeforeAction.class));
0213:                ACTION_TYPE_MAP.put(ActionType.MOVE_ELSE_IF_LEFT, SystemAction
0214:                        .get(MoveElseIfLeftAction.class));
0215:                ACTION_TYPE_MAP.put(ActionType.MOVE_ELSE_IF_RIGHT, SystemAction
0216:                        .get(MoveElseIfRightAction.class));
0217:                ACTION_TYPE_MAP.put(ActionType.ADD_VARIABLE, SystemAction
0218:                        .get(AddVariableAction.class));
0219:                ACTION_TYPE_MAP.put(ActionType.ADD_CORRELATION_SET,
0220:                        SystemAction.get(AddCorrelationSetAction.class));
0221:                ACTION_TYPE_MAP.put(ActionType.ADD_PROPERTY, SystemAction
0222:                        .get(AddPropertyAction.class));
0223:                ACTION_TYPE_MAP.put(ActionType.OPEN_IN_EDITOR, SystemAction
0224:                        .get(OpenInEditorAction.class));
0225:                ACTION_TYPE_MAP.put(ActionType.OPEN_PL_IN_EDITOR, SystemAction
0226:                        .get(OpenPartnerLinkInEditor.class));
0227:                ACTION_TYPE_MAP
0228:                        .put(
0229:                                ActionType.GO_TO,
0230:                                SystemAction
0231:                                        .get(org.netbeans.modules.bpel.nodes.actions.GoToAction.class));
0232:                ACTION_TYPE_MAP.put(ActionType.GO_TO_SOURCE, SystemAction
0233:                        .get(GoToSourceAction.class));
0234:                ACTION_TYPE_MAP.put(ActionType.GO_TO_WSDL_SOURCE, SystemAction
0235:                        .get(GoToAction.class));
0236:                ACTION_TYPE_MAP
0237:                        .put(
0238:                                ActionType.GO_TO_CORRSETCONTAINER_SOURCE,
0239:                                SystemAction
0240:                                        .get(GoToCorrelationSetContainerSourceAction.class));
0241:                ACTION_TYPE_MAP.put(ActionType.GO_TO_VARCONTAINER_SOURCE,
0242:                        SystemAction
0243:                                .get(GoToVariableContainerSourceAction.class));
0244:                ACTION_TYPE_MAP
0245:                        .put(
0246:                                ActionType.GO_TO_MSG_EX_CONTAINER_SOURCE,
0247:                                SystemAction
0248:                                        .get(GoToMessageExchangeContainerSourceAction.class));
0249:                ACTION_TYPE_MAP.put(ActionType.GO_TO_TYPE_SOURCE, SystemAction
0250:                        .get(GoToTypeSourceAction.class));
0251:                ACTION_TYPE_MAP.put(ActionType.ADD_MESSAGE_EXCHANGE,
0252:                        SystemAction.get(AddMessageExchangeAction.class));
0253:                ACTION_TYPE_MAP.put(ActionType.ADD_NEWTYPES, SystemAction
0254:                        .get(NewAction.class));
0255:                ACTION_TYPE_MAP.put(ActionType.MOVE_UP, SystemAction
0256:                        .get(MoveUpBpelEntityAction.class));
0257:                ACTION_TYPE_MAP.put(ActionType.MOVE_DOWN, SystemAction
0258:                        .get(MoveDownBpelEntityAction.class));
0259:                ACTION_TYPE_MAP.put(ActionType.MOVE_COPY_UP, SystemAction
0260:                        .get(MoveUpCopyAction.class));
0261:                ACTION_TYPE_MAP.put(ActionType.MOVE_COPY_DOWN, SystemAction
0262:                        .get(MoveDownCopyAction.class));
0263:                ACTION_TYPE_MAP.put(ActionType.PROPERTIES, SystemAction
0264:                        .get(PropertiesAction.class));
0265:                ACTION_TYPE_MAP.put(ActionType.TOGGLE_BREAKPOINT, SystemAction
0266:                        .get(ToggleBreakpointAction.class));
0267:                ACTION_TYPE_MAP.put(ActionType.CYCLE_MEX, SystemAction
0268:                        .get(FindMexPeerAction.class));
0269:                ACTION_TYPE_MAP.put(ActionType.ADD_PROPERTY_TO_WSDL,
0270:                        SystemAction.get(AddPropertyToWsdlAction.class));
0271:                ACTION_TYPE_MAP.put(ActionType.ADD_PROPERTY_ALIAS_TO_WSDL,
0272:                        SystemAction.get(AddPropertyAliasToWsdlAction.class));
0273:                ACTION_TYPE_MAP.put(ActionType.ADD_PARTNER_LINK, SystemAction
0274:                        .get(AddPartnerLinkAction.class));
0275:                ACTION_TYPE_MAP.put(ActionType.SHOW_BPEL_MAPPER, SystemAction
0276:                        .get(ShowBpelMapperAction.class));
0277:                ACTION_TYPE_MAP.put(ActionType.FIND_USAGES,
0278:                        RefactoringActionsFactory.whereUsedAction());
0279:                //                  SystemAction.get(FindUsagesAction.class));
0280:                ACTION_TYPE_MAP.put(ActionType.WRAP, SystemAction
0281:                        .get(WrapAction.class));
0282:                ACTION_TYPE_MAP.put(ActionType.ADD_FROM_PALETTE, SystemAction
0283:                        .get(AddFromPaletteAction.class));
0284:                ACTION_TYPE_MAP.put(ActionType.GO_TO_DIAGRAMM, SystemAction
0285:                        .get(GoToDiagrammAction.class));
0286:                ACTION_TYPE_MAP.put(ActionType.CHANGE_ORDER_ACTION,
0287:                        SystemAction.get(ReorderAction.class));
0288:                ACTION_TYPE_MAP.put(ActionType.ADD_WSDL_IMPORT, SystemAction
0289:                        .get(AddWsdlImportAction.class));
0290:                ACTION_TYPE_MAP.put(ActionType.ADD_SCHEMA_IMPORT, SystemAction
0291:                        .get(AddSchemaImportAction.class));
0292:                ACTION_TYPE_MAP.put(ActionType.DEFINE_CORRELATION, SystemAction
0293:                        .get(DefineCorrelationAction.class));
0294:            }
0295:
0296:            private Object reference;
0297:            private Synchronizer synchronizer = new Synchronizer();
0298:            private String cachedName;
0299:            private String cachedShortDescription;
0300:            private String cachedHtmlDisplayName;
0301:            private Object NAME_LOCK = new Object();
0302:            private ChangeValidationListener validationListener;
0303:            private boolean isErrorBadged;
0304:            private boolean isWarningBadged;
0305:
0306:            //    private boolean isDebuggerBadged;
0307:            //    private AnnotationType debuggerBadgeType;
0308:
0309:            public BpelNode(T ref, Lookup lookup) {
0310:                this (ref, Children.LEAF, lookup);
0311:            }
0312:
0313:            public BpelNode(T ref, Children children, Lookup lookup) {
0314:                super (children, new ExtendedLookup(lookup,
0315:                        BpelNavigatorLookupHint.getInstance()));
0316:                setReference(ref);
0317:
0318:                if (ref instanceof  BpelEntity) {
0319:                    BpelModel model = ((BpelEntity) ref).getBpelModel();
0320:
0321:                    assert model != null : "Can't create Node for orphaned Bpel Entity"; // NOI18N
0322:                    /// model.addEntityChangeListener(synchronizer);
0323:                    synchronizer.subscribe(model);
0324:                }
0325:                validationListener = new ValidationChangesListener();
0326:                attachValidationController(validationListener);
0327:
0328:                // TODO m
0329:                // set nodeDescription property which is shown in property sheet help region
0330:                setValue("nodeDescription", "");
0331:                //set default tooltip provider if it is no in lookup 
0332:                decorationProvider = (DecorationProvider) lookup
0333:                        .lookup(DecorationProvider.class);
0334:                if (decorationProvider == null) {
0335:                    setDecorationProvider();
0336:                }
0337:            }
0338:
0339:            public void setDecorationProvider(
0340:                    DecorationProvider decorationProvider) {
0341:                this .decorationProvider = decorationProvider;
0342:            }
0343:
0344:            /**
0345:             * Set default tooltip provider
0346:             */
0347:            protected void setDecorationProvider() {
0348:                this .decorationProvider = new BpelNavigatorDecorationProvider(
0349:                        getNodeType(), getReference());
0350:            }
0351:
0352:            public DecorationProvider getDecorationProvider() {
0353:                return decorationProvider;
0354:            }
0355:
0356:            protected boolean isValidationAnnotatedEntity(Component component) {
0357:                Object reference = BpelNode.this  instanceof  ContainerBpelNode ? ((ContainerBpelNode) BpelNode.this )
0358:                        .getContainerReference()
0359:                        : getReference();
0360:                if (reference == null) {
0361:                    return false;
0362:                }
0363:                return reference.equals(component);
0364:            }
0365:
0366:            protected Validator.ResultType getValidationStatus(
0367:                    ValidationProxyListener vpl) {
0368:                assert vpl != null;
0369:                Object ref = (this  instanceof  ContainerBpelNode) ? ((ContainerBpelNode) this )
0370:                        .getContainerReference()
0371:                        : getReference();
0372:                Validator.ResultType resultType = vpl
0373:                        .getValidationStatusForElement(ref);
0374:
0375:                return resultType;
0376:            }
0377:
0378:            /**
0379:             * true means that validation status from child elements should be accounted
0380:             */
0381:            protected boolean isComplexValidationStatus() {
0382:                return false;
0383:            }
0384:
0385:            // TODO r | m    
0386:            //    private Validator.ResultType getValidationStatus(
0387:            //            ValidationProxyListener vpl, List<BpelEntity> children) 
0388:            //    {
0389:            //        assert vpl != null;
0390:            //        if (children == null || children.size() == 0) {
0391:            //            return null;
0392:            //        }
0393:            //        Validator.ResultType resultType = null;
0394:            //        
0395:            //        List<Validator.ResultType> resultTypes = 
0396:            //                new ArrayList<Validator.ResultType>();
0397:            //        Validator.ResultType tmpResult = null;
0398:            //        for (BpelEntity entity : children) {
0399:            //            tmpResult = vpl
0400:            //                .getValidationStatusForElement(entity);
0401:            //            if (tmpResult != null) {
0402:            //                resultTypes.add(tmpResult);
0403:            //            }
0404:            //        }
0405:            //
0406:            //        resultType = ValidationProxyListener.getPriorytestType(resultTypes);
0407:            //        
0408:            //        if (resultType == null) {
0409:            //            for (BpelEntity entity : children) {
0410:            //                if (entity instanceof BpelContainer) {
0411:            //                    resultType = getValidationStatus(vpl, entity.getChildren());
0412:            //                }
0413:            //                if (resultType != null) {
0414:            //                    break;
0415:            //                }
0416:            //            }
0417:            //        }
0418:            //        
0419:            //        return resultType;
0420:            //    }
0421:            //        
0422:            /**
0423:             *  Attach listener to validation changes.
0424:             */
0425:            private void attachValidationController(
0426:                    ChangeValidationListener listener) {
0427:                //        final ValidationProxyListener validationProxyListener =
0428:                //                ValidationProxyListener.getInstance(getLookup());
0429:                //        if (validationProxyListener == null) {
0430:                //            return;
0431:                //        }
0432:
0433:                final ValidationProxyListener vpl = getValidationProxyListener();
0434:                if (vpl == null) {
0435:                    return;
0436:                }
0437:
0438:                vpl.addChangeValidationListener(listener);
0439:                Validator.ResultType resultType = getValidationStatus(vpl);
0440:
0441:                if (resultType == null) {
0442:                    isErrorBadged = false;
0443:                    isWarningBadged = false;
0444:                    return;
0445:                }
0446:                switch (resultType) {
0447:                case ERROR:
0448:                    isErrorBadged = true;
0449:                    isWarningBadged = false;
0450:                    break;
0451:                case WARNING:
0452:                    isErrorBadged = false;
0453:                    isWarningBadged = true;
0454:                    break;
0455:                default:
0456:                    isErrorBadged = false;
0457:                    isWarningBadged = false;
0458:                }
0459:
0460:                //        isDebuggerBadged = vpl.getAnnotationStatusForElement(((this instanceof ContainerBpelNode)?
0461:                //                    ((ContainerBpelNode) this).getContainerReference() :
0462:                //                    getReference()));
0463:
0464:            }
0465:
0466:            private AnnotationType getDebuggerAnnotationType() {
0467:                ValidationProxyListener vpl = getValidationProxyListener();
0468:                String[] types = null;
0469:                if (vpl != null) {
0470:                    types = vpl.getAnnotationTypes(getReference());
0471:                }
0472:
0473:                if (types == null || types.length < 1) {
0474:                    return null;
0475:                }
0476:
0477:                AnnotationType tmpDebuggerBadgeType = null;
0478:                boolean isCurrentPosition = false;
0479:                for (int i = 0; i < types.length; i++) {
0480:                    if (AnnotationType.CURRENT_POSITION.equals(AnnotationType
0481:                            .getAnnotationType(types[i]))) {
0482:                        isCurrentPosition = true;
0483:                    } else if (AnnotationType.BREAKPOINT.equals(AnnotationType
0484:                            .getAnnotationType(types[i]))) {
0485:                        tmpDebuggerBadgeType = AnnotationType.BREAKPOINT;
0486:                    } else if (tmpDebuggerBadgeType == null
0487:                            && AnnotationType.DISABLED_BREAKPOINT
0488:                                    .equals(AnnotationType
0489:                                            .getAnnotationType(types[i]))) {
0490:                        tmpDebuggerBadgeType = AnnotationType.DISABLED_BREAKPOINT;
0491:                    }
0492:                }
0493:
0494:                if (isCurrentPosition && tmpDebuggerBadgeType == null) {
0495:                    tmpDebuggerBadgeType = AnnotationType.CURRENT_POSITION;
0496:                } else if (isCurrentPosition && tmpDebuggerBadgeType != null) {
0497:                    switch (tmpDebuggerBadgeType) {
0498:                    case BREAKPOINT:
0499:                        tmpDebuggerBadgeType = AnnotationType.CURRENT_BREAKPOINT;
0500:                        break;
0501:                    case DISABLED_BREAKPOINT:
0502:                        tmpDebuggerBadgeType = AnnotationType.CURRENT_DISABLED_BREAKPOINT;
0503:                        break;
0504:                    }
0505:                }
0506:                return tmpDebuggerBadgeType;
0507:            }
0508:
0509:            /**
0510:             *  Dettach listener to validation changes.
0511:             */
0512:            private void detachValidationController(
0513:                    ChangeValidationListener listener) {
0514:                ValidationProxyListener vpl = getValidationProxyListener();
0515:                if (vpl != null) {
0516:                    vpl.removeChangeValidationListener(listener);
0517:                }
0518:            }
0519:
0520:            private ValidationProxyListener getValidationProxyListener() {
0521:                Lookup lookup = getLookup();
0522:                if (lookup == null) {
0523:                    return null;
0524:                }
0525:                return (ValidationProxyListener) lookup
0526:                        .lookup(ValidationProxyListener.class);
0527:            }
0528:
0529:            /**
0530:             * The reference to an object which the node represents.
0531:             */
0532:            public T getReference() {
0533:                T ref = null;
0534:                if (reference instanceof  BpelSafeReference) {
0535:                    ref = (T) ((BpelSafeReference) reference).getBpelObject();
0536:                } else {
0537:                    ref = (T) reference;
0538:                }
0539:
0540:                if (ref instanceof  BpelEntity) {
0541:                    warnIfBpelModelUnLocked((BpelEntity) ref);
0542:                }
0543:
0544:                return ref;
0545:            }
0546:
0547:            public Object getAlternativeReference() {
0548:                return null;
0549:            }
0550:
0551:            private void warnIfBpelModelUnLocked(BpelEntity entity) {
0552:                assert entity != null;
0553:                //        if (entity == null) {
0554:                //            return;
0555:                //        }
0556:
0557:                BpelModel model = entity.getBpelModel();
0558:                if (model == null) {
0559:                    return;
0560:                }
0561:
0562:                if (!model.isIntransaction()) {
0563:                    //            ErrorManager.getDefault()
0564:                    //                .notify(new IllegalStateException("The bpel model didn't lock"));
0565:                    //            System.out.println("The bpel model didn't lock");
0566:                }
0567:            }
0568:
0569:            /**
0570:             * Should be overriden for complex nodes
0571:             * @return true if event require update of the current node
0572:             */
0573:            protected boolean isEventRequreUpdate(ChangeEvent event) {
0574:                T curEntity = getReference();
0575:                return (event != null && curEntity != null && event.getParent() == curEntity)
0576:                        || isRequireSpecialUpdate(event, curEntity);
0577:            }
0578:
0579:            protected boolean isRequireSpecialUpdate(ChangeEvent event,
0580:                    Object currentEntity) {
0581:                BpelEntity sourceEntity = null;
0582:                if (event.getClass() == EntityRemoveEvent.class) {
0583:                    sourceEntity = ((EntityRemoveEvent) event).getOldValue();
0584:                } else if (event.getClass() == EntityUpdateEvent.class) {
0585:                    //            sourceEntity = ((EntityUpdateEvent)event).getOldValue();
0586:                    sourceEntity = ((EntityUpdateEvent) event).getNewValue();
0587:                } else if (event.getClass() == EntityInsertEvent.class) {
0588:                    sourceEntity = ((EntityInsertEvent) event).getValue();
0589:                }
0590:
0591:                if (sourceEntity == null
0592:                        || sourceEntity.getElementType() != Scope.class) {
0593:                    return false;
0594:                }
0595:
0596:                BpelEntity scopeParent = event.getParent();
0597:
0598:                if (!(scopeParent instanceof  BaseScope)) {
0599:                    scopeParent = org.netbeans.modules.bpel.nodes.navigator.Util
0600:                            .getUpClosestBaseScope(scopeParent);
0601:                }
0602:
0603:                if (scopeParent == null) {
0604:                    return false;
0605:                }
0606:
0607:                if (scopeParent.getElementType() == Process.class) {
0608:                    return getNodeType().equals(NodeType.VARIABLE_CONTAINER)
0609:                            || getNodeType().equals(
0610:                                    NodeType.CORRELATION_SET_CONTAINER);
0611:                }
0612:
0613:                if (scopeParent == currentEntity) {
0614:                    return true;
0615:                }
0616:
0617:                return false;
0618:            }
0619:
0620:            /**
0621:             * This method is called each time when an event is come.
0622:             * It is intended to be overridden only by the subclasses which
0623:             * require update name for unusual events.
0624:             */
0625:            private void updateComplexNames(ChangeEvent event) {
0626:                if (isRequireNameUpdate(event)) {
0627:                    updateName();
0628:                }
0629:            }
0630:
0631:            protected boolean isRequireNameUpdate(ChangeEvent event) {
0632:                if (event instanceof  PropertyUpdateEvent) {
0633:                    return true;
0634:                }
0635:                return false;
0636:            }
0637:
0638:            /**
0639:             * This method is called each time when an event is come.
0640:             * It is intended to be overridden only by the subclasses which
0641:             * require specific processing to update their complex properties.
0642:             * It generally intended to update the calculated properties.
0643:             *
0644:             * Don't update all properties here because most of them
0645:             * can be processed automatically with the help of other mechanism.
0646:             * See updateElementProperty and updateAttributeProperty methods.
0647:             */
0648:            protected void updateComplexProperties(ChangeEvent event) {
0649:                // DO NOTHING HERE
0650:            }
0651:
0652:            private Image getWarningBadge() {
0653:                return NodeBadges.WARNING.IMAGE;
0654:            }
0655:
0656:            private synchronized Image getErrorBadge() {
0657:                return NodeBadges.ERROR.IMAGE;
0658:            }
0659:
0660:            private synchronized Image getBreakpointBadge() {
0661:                return NodeBadges.BREAKPOINT.IMAGE;
0662:            }
0663:
0664:            private synchronized Image getCurrentBreakpointBadge() {
0665:                return NodeBadges.CURRENT_BREAKPOINT.IMAGE;
0666:            }
0667:
0668:            private synchronized Image getDisabledBreakpointBadge() {
0669:                return NodeBadges.DISABLED_BREAKPOINT.IMAGE;
0670:            }
0671:
0672:            private synchronized Image getCurrentDisabledBreakpointBadge() {
0673:                return NodeBadges.CURRENT_DISABLED_BREAKPOINT.IMAGE;
0674:            }
0675:
0676:            private synchronized Image getCurrentPositionBadge() {
0677:                return NodeBadges.CURRENT_POSITION.IMAGE;
0678:            }
0679:
0680:            private Image getDebuggerBadgedImage(Image nodeImage) {
0681:                return SoaUiUtil.getBadgedIcon(nodeImage, getBreakpointBadge(),
0682:                        9, 9);
0683:            }
0684:
0685:            private Image getAnnotationIcon(Image nodeImage, AnnotationType type) {
0686:                switch (type) {
0687:                case BREAKPOINT:
0688:                    return SoaUiUtil.getBadgedIcon(nodeImage,
0689:                            getBreakpointBadge(), 9, 9);
0690:                case CURRENT_BREAKPOINT:
0691:                    return SoaUiUtil.getBadgedIcon(nodeImage,
0692:                            getCurrentBreakpointBadge(), 9, 9);
0693:                case DISABLED_BREAKPOINT:
0694:                    return SoaUiUtil.getBadgedIcon(nodeImage,
0695:                            getDisabledBreakpointBadge(), 9, 9);
0696:                case CURRENT_DISABLED_BREAKPOINT:
0697:                    return SoaUiUtil.getBadgedIcon(nodeImage,
0698:                            getCurrentDisabledBreakpointBadge(), 9, 9);
0699:                case CURRENT_POSITION:
0700:                    return SoaUiUtil.getBadgedIcon(nodeImage,
0701:                            getCurrentPositionBadge(), 9, 9);
0702:                }
0703:
0704:                return nodeImage;
0705:            }
0706:
0707:            public Image getIcon(int type) {
0708:                Image vrgnImage = getNodeType().getImage();
0709:                AnnotationType annotationDebugType = getDebuggerAnnotationType();
0710:                //        System.out.println("getted Debug annotationType: "+annotationDebugType);
0711:                if (annotationDebugType != null) {
0712:                    vrgnImage = getAnnotationIcon(vrgnImage,
0713:                            annotationDebugType);
0714:                }
0715:
0716:                vrgnImage = vrgnImage == null ? getNodeType().getImage()
0717:                        : vrgnImage;
0718:
0719:                if (isErrorBadged) {
0720:                    return getErrorBadge() != null ? SoaUiUtil.getBadgedIcon(
0721:                            vrgnImage/*getNodeType().getImage()*/,
0722:                            getErrorBadge()) : vrgnImage;//getNodeType().getImage();
0723:                } else if (isWarningBadged) {
0724:                    return getWarningBadge() != null ? SoaUiUtil.getBadgedIcon(
0725:                            vrgnImage/*getNodeType().getImage()*/,
0726:                            getWarningBadge()) : vrgnImage;//getNodeType().getImage();
0727:                }
0728:
0729:                return vrgnImage;//getNodeType().getImage();
0730:            }
0731:
0732:            public Image getOpenedIcon(int type) {
0733:                return getIcon(type);
0734:            }
0735:
0736:            protected void setReference(T newRef) {
0737:                if (newRef instanceof  BpelEntity) {
0738:                    this .reference = new BpelSafeReference((BpelEntity) newRef);
0739:                } else {
0740:                    this .reference = newRef;
0741:                }
0742:            }
0743:
0744:            public abstract NodeType getNodeType();
0745:
0746:            protected String getNameImpl() {
0747:                Object ref = getReference();
0748:                String name = null;
0749:                if (ref != null) {
0750:                    if (ref instanceof  Named) {
0751:                        name = ((Named) ref).getName();
0752:                    }
0753:                }
0754:                return (name != null) ? name : "";
0755:            }
0756:
0757:            public String getName() {
0758:                /**
0759:                 * HACK to avoid deadlocks in navigator which uses separate thread to
0760:                 * deal with selection. Changing selection enters Children.MUTEX and
0761:                 * tries to get access to BPEL model lock via BpelEntity.getName();
0762:                 *
0763:                 * BTW, this caching may also improve the perfomance,
0764:                 * ... and cause a lot of bugs
0765:                 *
0766:                 * Name cache is cleared in updateName method, which is called when
0767:                 * ANY attribute of BPEL entity changes.
0768:                 **/
0769:
0770:                synchronized (NAME_LOCK) {
0771:                    if (cachedName == null) {
0772:                        cachedName = getNameImpl();
0773:                    }
0774:
0775:                    return cachedName;
0776:                }
0777:            }
0778:
0779:            public String getDisplayName() {
0780:                String instanceName = getName();
0781:                return ((instanceName == null || instanceName.length() == 0) ? ""
0782:                        : instanceName + " ")
0783:                        + "[" + getNodeType().getDisplayName() + "]"; // NOI18N
0784:            }
0785:
0786:            public String getHtmlDisplayName() {
0787:                synchronized (NAME_LOCK) {
0788:                    if (cachedHtmlDisplayName == null) {
0789:                        cachedHtmlDisplayName = getImplHtmlDisplayName();
0790:                    }
0791:                }
0792:
0793:                return cachedHtmlDisplayName;
0794:            }
0795:
0796:            protected String getImplHtmlDisplayName() {
0797:                String htmlDisplayName = getName();
0798:                htmlDisplayName = htmlDisplayName != null
0799:                        && htmlDisplayName.length() > 0 ? htmlDisplayName
0800:                        : getNodeType().getDisplayName();
0801:
0802:                return org.netbeans.modules.bpel.editors.api.utils.Util
0803:                        .getCorrectedHtmlRenderedString(htmlDisplayName);
0804:            }
0805:
0806:            protected String getImplShortDescription() {
0807:                //        String instanceName = getName();
0808:                //        return NbBundle.getMessage(BpelNode.class,
0809:                //                "LBL_SHORT_TOOLTIP_HTML_TEMPLATE", // NOI18N
0810:                //                getNodeType().getDisplayName(), 
0811:                //                instanceName); // NOI18N
0812:                //        return getDisplayName();
0813:
0814:                return decorationProvider == null ? EMPTY_STRING
0815:                        : decorationProvider.getTooltip(getNodeType(),
0816:                                getReference());
0817:            }
0818:
0819:            public String getShortDescription() {
0820:                synchronized (NAME_LOCK) {
0821:                    if (cachedShortDescription == null) {
0822:                        cachedShortDescription = getImplShortDescription();
0823:                    }
0824:                }
0825:                return cachedShortDescription;
0826:            }
0827:
0828:            public void updateName() {
0829:
0830:                //name will be reloaded from model during next getName call
0831:                synchronized (NAME_LOCK) {
0832:                    cachedName = null;
0833:                }
0834:
0835:                fireNameChange(null, getName());
0836:                synchronized (NAME_LOCK) {
0837:                    cachedShortDescription = null;
0838:                }
0839:
0840:                synchronized (NAME_LOCK) {
0841:                    cachedHtmlDisplayName = null;
0842:                }
0843:                fireShortDescriptionChange(null, getShortDescription());
0844:                fireDisplayNameChange(null, getDisplayName());
0845:            }
0846:
0847:            protected void updateProperty(PropertyType propertyType) {
0848:                updateProperty(propertyType.toString());
0849:            }
0850:
0851:            protected void updateProperty(String propertyName) {
0852:                Property prop = PropertyUtils.lookForPropertyByName(this ,
0853:                        propertyName);
0854:                Object newValue = null;
0855:                try {
0856:                    newValue = prop.getValue();
0857:                } catch (Exception ex) {
0858:                    // do nothing here
0859:                }
0860:                firePropertyChange(propertyName, UNKNOWN_OLD_VALUE, newValue);
0861:            }
0862:
0863:            public void updatePropertyChange(String propertyName,
0864:                    Object oldValue, Object newValue) {
0865:                firePropertyChange(propertyName, oldValue, newValue);
0866:                synchronized (NAME_LOCK) {
0867:                    cachedShortDescription = null;
0868:                }
0869:
0870:                synchronized (NAME_LOCK) {
0871:                    cachedHtmlDisplayName = null;
0872:                }
0873:                fireDisplayNameChange(null, getDisplayName());
0874:                fireShortDescriptionChange(null, getShortDescription());
0875:            }
0876:
0877:            public void updateShortDescription() {
0878:                synchronized (NAME_LOCK) {
0879:                    cachedShortDescription = null;
0880:                }
0881:
0882:                fireShortDescriptionChange(null, getShortDescription());
0883:            }
0884:
0885:            /**
0886:             * Iterates over all registered properties and update them.
0887:             */
0888:            public void updateAllProperties() {
0889:                PropertySet[] psArr = getSheet().toArray();
0890:                for (PropertySet ps : psArr) {
0891:                    Property[] propArr = ps.getProperties();
0892:                    for (Property prop : propArr) {
0893:                        String propName = prop.getName();
0894:                        try {
0895:                            Object newPropValue = prop.getValue();
0896:                            firePropertyChange(propName, UNKNOWN_OLD_VALUE,
0897:                                    newPropValue);
0898:                        } catch (Exception ex) {
0899:                            ErrorManager.getDefault().notify(ex);
0900:                        }
0901:                    }
0902:                }
0903:            }
0904:
0905:            public void updateAttributeProperty(String attributeName) {
0906:                Property prop = PropertyUtils
0907:                        .lookForPropertyByBoundedAttribute(this , attributeName);
0908:                if (prop != null) {
0909:                    String propName = prop.getName();
0910:                    try {
0911:                        Object newPropValue = prop.getValue();
0912:                        firePropertyChange(propName, UNKNOWN_OLD_VALUE,
0913:                                newPropValue);
0914:                    } catch (Exception ex) {
0915:                        ErrorManager.getDefault().notify(ex);
0916:                    }
0917:                }
0918:
0919:            }
0920:
0921:            public void updateElementProperty(Class elementClass) {
0922:                Property prop = PropertyUtils.lookForPropertyByBoundedElement(
0923:                        this , elementClass);
0924:                if (prop != null) {
0925:                    String propName = prop.getName();
0926:                    try {
0927:                        Object newPropValue = prop.getValue();
0928:                        firePropertyChange(propName, UNKNOWN_OLD_VALUE,
0929:                                newPropValue);
0930:                    } catch (Exception ex) {
0931:                        ErrorManager.getDefault().notify(ex);
0932:                    }
0933:                }
0934:            }
0935:
0936:            public boolean isModelReadOnly() {
0937:                Object ref = getReference();
0938:                if (ref == null)
0939:                    return true;
0940:                if (!(ref instanceof  DocumentComponent))
0941:                    return true;
0942:                Model model = ((DocumentComponent) ref).getModel();
0943:                if (model == null)
0944:                    return true;
0945:                return !XAMUtils.isWritable(model);
0946:            }
0947:
0948:            public boolean canDestroy() {
0949:                DeleteAction action = getActualDeleteAction()/*SystemAction.get(DeleteAction.class)*/;
0950:                return action != null && action.enable(new Node[] { this  });
0951:            }
0952:
0953:            public void destroy() throws IOException {
0954:
0955:                T ref = getReference();
0956:
0957:                //        DeleteAction action = (DeleteAction)SystemAction.get(DeleteAction.class);
0958:                DeleteAction action = getActualDeleteAction();
0959:                if (action != null) {
0960:                    action.performAction(new Node[] { this  });
0961:                }
0962:
0963:                if (ref instanceof  BpelEntity) {
0964:                    BpelModel model = ((BpelEntity) ref).getBpelModel();
0965:                    model.removeEntityChangeListener(synchronizer);
0966:                }
0967:
0968:                if (validationListener != null) {
0969:                    detachValidationController(validationListener);
0970:                }
0971:                super .destroy();
0972:            }
0973:
0974:            private DeleteAction getActualDeleteAction() {
0975:                Action[] actions = getActions(true);
0976:                for (Action elem : actions) {
0977:                    if (elem instanceof  DeleteAction) {
0978:                        return (DeleteAction) elem;
0979:                    }
0980:                }
0981:                return null;
0982:            }
0983:
0984:            private void unsubscribedFromAndDestroy(BpelModel bpelModel) {
0985:                bpelModel.removeEntityChangeListener(synchronizer);
0986:                //
0987:                if (validationListener != null) {
0988:                    detachValidationController(validationListener);
0989:                }
0990:                //
0991:                try {
0992:                    super .destroy();
0993:                } catch (IOException ex) {
0994:                    ErrorManager.getDefault().notify(ex);
0995:                }
0996:            }
0997:
0998:            protected boolean isChildrenAllowed() {
0999:                boolean isChildrenAllowed = true; // allowed by default
1000:                NodesTreeParams treeParams = (NodesTreeParams) getLookup()
1001:                        .lookup(NodesTreeParams.class);
1002:                if (treeParams != null) {
1003:                    Class<? extends Node>[] typeArr = treeParams
1004:                            .getLeaftNodeClasses();
1005:                    if (typeArr != null) {
1006:                        for (Class<? extends Node> leafNodeType : typeArr) {
1007:                            if (leafNodeType.equals(this .getClass())) {
1008:                                isChildrenAllowed = false;
1009:                                break;
1010:                            }
1011:                        }
1012:                    }
1013:                }
1014:                return isChildrenAllowed;
1015:            }
1016:
1017:            public boolean equals(Object obj) {
1018:                if (super .equals(obj)) {
1019:                    return true;
1020:                }
1021:
1022:                //
1023:                if (obj instanceof  BpelNode) {
1024:                    return this .getNodeType().equals(
1025:                            ((BpelNode) obj).getNodeType())
1026:                            && this .reference
1027:                                    .equals(((BpelNode) obj).reference);
1028:                }
1029:                //
1030:                return false;
1031:            }
1032:
1033:            public Action getPreferredAction() {
1034:                Action preferedAction = getDefaultPreferedAction();
1035:                return preferedAction != null ? preferedAction : super 
1036:                        .getPreferredAction();
1037:            }
1038:
1039:            /**
1040:             * If there is no PreffredeActionProvider in lookup then getPreffredAction
1041:             * invokes this method.
1042:             */
1043:            protected Action getDefaultPreferedAction() {
1044:                Action[] actions = getActions(true);
1045:                if (actions == null || actions.length < 1) {
1046:                    return null;
1047:                }
1048:
1049:                for (Action elem : actions) {
1050:                    if (elem instanceof  org.netbeans.modules.bpel.nodes.actions.GoToAction) {
1051:                        ShowBpelMapperAction goToMapper = SystemAction
1052:                                .get(ShowBpelMapperAction.class);
1053:                        if (goToMapper != null
1054:                                && goToMapper.enable(new Node[] { this  })) {
1055:                            return goToMapper;
1056:                        }
1057:                    }
1058:
1059:                    if (elem instanceof  ShowPropertyEditorAction) {
1060:                        return elem;
1061:                    }
1062:                }
1063:
1064:                return null;
1065:            }
1066:
1067:            private class Synchronizer extends ChangeEventListenerAdapter {
1068:                public Synchronizer() {
1069:                }
1070:
1071:                private ChangeEventListener listener;
1072:
1073:                private void subscribe(BpelModel model) {
1074:                    listener = new DelegatingChangeEventListener(this );
1075:                    model.addEntityChangeListener(listener);
1076:
1077:                }
1078:
1079:                private void reloadChildren() {
1080:
1081:                    Children children = getChildren();
1082:                    if (children instanceof  ReloadableChildren) {
1083:                        ((ReloadableChildren) children).reload();
1084:                    } else if (BpelNode.this  instanceof  ReloadableChildren) {
1085:                        ((ReloadableChildren) BpelNode.this ).reload();
1086:                    }
1087:                }
1088:
1089:                public void notifyEntityRemoved(EntityRemoveEvent event) {
1090:                    BpelEntity entity = event.getOutOfModelEntity();
1091:                    //
1092:                    T ref = getReference();
1093:                    if (ref == null) {
1094:                        //
1095:                        // the referenced element already removed
1096:                        //
1097:                        BpelModel bpelModel = entity.getBpelModel();
1098:                        unsubscribedFromAndDestroy(bpelModel);
1099:                    } else {
1100:                        if (BpelNode.this .isEventRequreUpdate(event)) {
1101:                            reloadChildren();
1102:                        }
1103:
1104:                        if (event.getOutOfModelEntity() instanceof  Documentation
1105:                                && ref.equals(event.getParent())) {
1106:                            updateShortDescription();
1107:                        }
1108:                    }
1109:                    //
1110:                    // Perform update processing of complex ptoperties
1111:                    updateComplexProperties(event);
1112:                    updateComplexNames(event);
1113:                }
1114:
1115:                public void notifyPropertyRemoved(PropertyRemoveEvent event) {
1116:                    BpelEntity entity = event.getParent();
1117:
1118:                    T ref = getReference();
1119:                    if (ref == null) {
1120:                        //
1121:                        // the referenced element already removed
1122:                        //
1123:                        BpelModel bpelModel = entity.getBpelModel();
1124:                        unsubscribedFromAndDestroy(bpelModel);
1125:                    } else {
1126:                        if (BpelNode.this .isEventRequreUpdate(event)) {
1127:                            reloadChildren();
1128:                        }
1129:                    }
1130:                    //
1131:                    // Perform update processing of complex ptoperties
1132:                    updateComplexProperties(event);
1133:                    updateComplexNames(event);
1134:                }
1135:
1136:                public void notifyPropertyUpdated(PropertyUpdateEvent event) {
1137:                    if (BpelNode.this .isEventRequreUpdate(event)) {
1138:                        String attributeName = event.getName();
1139:                        updateAttributeProperty(attributeName);
1140:                        updateName();
1141:                        //
1142:                        // Check if the property has the List type
1143:                        Object value = event.getNewValue();
1144:                        if (value == null) {
1145:                            value = event.getOldValue();
1146:                        }
1147:                        if (value != null && value instanceof  List) {
1148:                            reloadChildren();
1149:                        }
1150:                    }
1151:                    //
1152:                    // Check that the property is the content of an entity
1153:                    // which owned by the node's entity.
1154:                    if (ContentElement.CONTENT_PROPERTY.equals(event.getName())) {
1155:                        BpelEntity parentEntity = event.getParent();
1156:                        //
1157:                        T curEntity = getReference();
1158:                        if (curEntity != null && parentEntity != null
1159:                                && parentEntity.getParent() == curEntity) {
1160:                            updateElementProperty(parentEntity.getClass());
1161:                            if (parentEntity instanceof  Documentation) {
1162:                                updateShortDescription();
1163:                            }
1164:                        }
1165:                    }
1166:                    //
1167:                    // Perform update processing of complex ptoperties
1168:                    updateComplexProperties(event);
1169:                }
1170:
1171:                public void notifyArrayUpdated(ArrayUpdateEvent event) {
1172:                    if (BpelNode.this .isEventRequreUpdate(event)) {
1173:                        reloadChildren();
1174:                    }
1175:                    //
1176:                    // Perform update processing of complex ptoperties
1177:                    updateComplexProperties(event);
1178:                    updateComplexNames(event);
1179:                }
1180:
1181:                public void notifyEntityUpdated(EntityUpdateEvent event) {
1182:                    if (BpelNode.this .isEventRequreUpdate(event)) {
1183:                        BpelEntity entity = event.getNewValue();
1184:                        if (entity == null) {
1185:                            entity = event.getOldValue();
1186:                        }
1187:                        if (entity != null) {
1188:                            updateElementProperty(entity.getClass());
1189:                        }
1190:                        //
1191:                        reloadChildren();
1192:                    }
1193:
1194:                    //
1195:                    // Perform update processing of complex ptoperties
1196:                    updateComplexProperties(event);
1197:                    updateComplexNames(event);
1198:                }
1199:
1200:                public void notifyEntityInserted(EntityInsertEvent event) {
1201:                    if (BpelNode.this .isEventRequreUpdate(event)) {
1202:                        BpelEntity entity = event.getValue();
1203:                        if (entity != null) {
1204:                            updateElementProperty(entity.getClass());
1205:                        }
1206:
1207:                        if (entity instanceof  Documentation) {
1208:                            updateShortDescription();
1209:                        } else {
1210:                            //
1211:                            reloadChildren();
1212:                        }
1213:                    }
1214:                    //
1215:                    // Perform update processing of complex ptoperties
1216:                    updateComplexProperties(event);
1217:                    updateComplexNames(event);
1218:                }
1219:
1220:            }
1221:
1222:            private class ValidationChangesListener implements 
1223:                    ChangeValidationListener {
1224:                // TODO r
1225:                //        public void validationUpdated(Validator.ResultItem updatedItem) {
1226:                //            for(Component component: updatedItem.getComponents()) {
1227:                //                Object reference = BpelNode.this instanceof ContainerBpelNode
1228:                //                        ? ((ContainerBpelNode)BpelNode.this).getContainerReference()
1229:                //                        : getReference();
1230:                //                if (reference == null) {
1231:                //                    return;
1232:                //                }
1233:                //                if (reference.equals(component)) {
1234:                //                    switch (updatedItem.getType()) {
1235:                //                        case ERROR :
1236:                //                            isErrorBadged = true;
1237:                //                            isWarningBadged = false;
1238:                //                            fireIconChange();
1239:                //                            fireOpenedIconChange();
1240:                //                            break;
1241:                //                        case WARNING :
1242:                //                            isErrorBadged = false;
1243:                //                            isWarningBadged = true;
1244:                //                            fireIconChange();
1245:                //                            fireOpenedIconChange();
1246:                //                            break;
1247:                //                        default :
1248:                //                            isErrorBadged = false;
1249:                //                            isWarningBadged = false;
1250:                //                            fireIconChange();
1251:                //                            fireOpenedIconChange();
1252:                //                    }
1253:                //                }
1254:                //            }
1255:                //        }
1256:                //
1257:                //        public void validationRemoved(Validator.ResultItem updatedItem) {
1258:                //            for(Component component: updatedItem.getComponents()) {
1259:                //                Object reference = getReference();
1260:                //                if (reference == null) {
1261:                //                    return;
1262:                //                }
1263:                //                if (reference.equals(component)) {
1264:                //                    isErrorBadged = false;
1265:                //                    isWarningBadged = false;
1266:                //                    fireIconChange();
1267:                //                    fireOpenedIconChange();
1268:                //                }
1269:                //            }
1270:                //        }
1271:                public void validationUpdated(Component component,
1272:                        Validator.ResultType resultType) {
1273:                    if (isValidationAnnotatedEntity(component)) {
1274:
1275:                        if (isComplexValidationStatus()) {
1276:                            resultType = getValidationStatus(getValidationProxyListener());
1277:                        }
1278:                        updateValidationIcons(resultType);
1279:                    }
1280:                }
1281:
1282:                private void updateValidationIcons(
1283:                        Validator.ResultType resultType) {
1284:                    if (resultType == null) {
1285:                        isErrorBadged = false;
1286:                        isWarningBadged = false;
1287:                        fireIconChange();
1288:                        fireOpenedIconChange();
1289:                        return;
1290:                    }
1291:
1292:                    switch (resultType) {
1293:                    case ERROR:
1294:                        isErrorBadged = true;
1295:                        isWarningBadged = false;
1296:                        fireIconChange();
1297:                        fireOpenedIconChange();
1298:                        break;
1299:                    case WARNING:
1300:                        isErrorBadged = false;
1301:                        isWarningBadged = true;
1302:                        fireIconChange();
1303:                        fireOpenedIconChange();
1304:                        break;
1305:                    default:
1306:                        isErrorBadged = false;
1307:                        isWarningBadged = false;
1308:                        fireIconChange();
1309:                        fireOpenedIconChange();
1310:                    }
1311:                }
1312:
1313:                public void validationRemoved(Component component) {
1314:                    if (isValidationAnnotatedEntity(component)) {
1315:                        Validator.ResultType resultType = null;
1316:                        if (isComplexValidationStatus()) {
1317:                            resultType = getValidationStatus(getValidationProxyListener());
1318:                        }
1319:                        updateValidationIcons(resultType);
1320:                    }
1321:                }
1322:
1323:                public void annotationAdded(UniqueId entity, String type) {
1324:                    if (!isMyAnnotattionEvent(entity)) {
1325:                        return;
1326:                    }
1327:                    //            System.out.println("annotationAdded: type "+type);
1328:                    fireIconChange();
1329:                    fireOpenedIconChange();
1330:                }
1331:
1332:                public void annotationRemoved(UniqueId entity, String type) {
1333:                    if (!isMyAnnotattionEvent(entity)) {
1334:                        return;
1335:                    }
1336:                    //            System.out.println("annotationRemoved: type "+type);
1337:                    fireIconChange();
1338:                    fireOpenedIconChange();
1339:                }
1340:
1341:                private boolean isMyAnnotattionEvent(UniqueId entity) {
1342:                    Object ref = getReference();
1343:                    if (ref instanceof  BpelEntity
1344:                            && ((BpelEntity) ref).getUID().equals(entity)) {
1345:                        return true;
1346:                    }
1347:                    return false;
1348:                }
1349:            }
1350:
1351:            //    private class BpelSafeReference<T> {
1352:            //
1353:            //        private UniqueId myId;
1354:            //        private BpelModel model;
1355:            //
1356:            //        public BpelSafeReference(T bpelEntity) {
1357:            //
1358:            //            myId = ((BpelEntity)bpelEntity).getUID();
1359:            //            model = ((BpelEntity)bpelEntity).getBpelModel();
1360:            //        }
1361:            //
1362:            //        public UniqueId getId() {
1363:            //            return myId;
1364:            //        }
1365:            //
1366:            //        public T getBpelObject() {
1367:            //            BpelEntity bpelEntity = model.getEntity(myId);
1368:            //            return (T)bpelEntity;
1369:            //        }
1370:            //    }
1371:
1372:            /**
1373:             * Looks for the Properties Set by the Group enum.
1374:             * If the group isn't
1375:             */
1376:            protected Sheet.Set getPropertySet(Sheet sheet,
1377:                    Constants.PropertiesGroups group) {
1378:                Sheet.Set propSet = sheet.get(group.getDisplayName());
1379:                if (propSet == null) {
1380:                    propSet = new Sheet.Set();
1381:                    propSet.setName(group.getDisplayName());
1382:                    sheet.put(propSet);
1383:                }
1384:                //
1385:                return propSet;
1386:            }
1387:
1388:            //    protected Node.Property createProperty(PropertyType propType, ) {
1389:            //    }
1390:
1391:            public Action[] getActions(boolean b) {
1392:                Action[] actions = null;
1393:                Object ref = getReference();
1394:                if (ref instanceof  BpelEntity) {
1395:                    BpelModel model = ((BpelEntity) ref).getBpelModel();
1396:                    if (model != null
1397:                            && BpelModel.State.VALID.equals(model.getState())) {
1398:                        actions = createActionsArray();
1399:                    }
1400:                }
1401:
1402:                return actions == null ? super .getActions(b) : actions;
1403:            }
1404:
1405:            protected ActionType[] getActionsArray() {
1406:                List<ActionType> actionList = new ArrayList<ActionType>();
1407:                T ref = getReference();
1408:
1409:                if (ref instanceof  Activity) {
1410:                    if (ref instanceof  CompositeActivity) {
1411:                        actionList.add(ActionType.ADD_FROM_PALETTE);
1412:                    }
1413:                    if (!(ref instanceof  Process || ref instanceof  CompensatableActivityHolder)) {
1414:                        actionList.add(ActionType.WRAP);
1415:                    }
1416:                    actionList.add(ActionType.SEPARATOR);
1417:                }
1418:                if (ref instanceof  CompositeActivity) {
1419:                    actionList.add(ActionType.CHANGE_ORDER_ACTION);
1420:                    actionList.add(ActionType.SEPARATOR);
1421:                }
1422:
1423:                actionList.add(ActionType.GO_TO);
1424:                //        actionList.add(ActionType.GO_TO_SOURCE);
1425:                //        if (ref instanceof Activity) {
1426:                //            actionList.add(ActionType.GO_TO_DIAGRAMM);
1427:                //        }
1428:                if (ref instanceof  Activity) {
1429:                    actionList.add(ActionType.SEPARATOR);
1430:                    actionList.add(ActionType.MOVE_UP);
1431:                    actionList.add(ActionType.MOVE_DOWN);
1432:                    actionList.add(ActionType.SEPARATOR);
1433:                    actionList.add(ActionType.TOGGLE_BREAKPOINT);
1434:                }
1435:                actionList.add(ActionType.SEPARATOR);
1436:                actionList.add(ActionType.REMOVE);
1437:                PropertySet[] propertySets = getPropertySets();
1438:                if (propertySets != null && propertySets.length > 0) {
1439:                    actionList.add(ActionType.SEPARATOR);
1440:                    actionList.add(ActionType.PROPERTIES);
1441:                }
1442:                return actionList.toArray(new ActionType[actionList.size()]);
1443:            }
1444:
1445:            /**
1446:             * @return actions type which used to create new elements
1447:             * used in #getNewTypes
1448:             */
1449:            public ActionType[] getAddActionArray() {
1450:                return new ActionType[0];
1451:            }
1452:
1453:            protected Action[] createActionsArray() {
1454:                ActionType[] actions = getActionsArray();
1455:                if (actions == null) {
1456:                    return null;
1457:                }
1458:
1459:                Action[] actionsArray = new Action[actions.length];
1460:                for (int i = 0; i < actions.length; i++) {
1461:                    actionsArray[i] = createAction(actions[i]);
1462:                }
1463:                return actionsArray;
1464:            }
1465:
1466:            public Action createAction(ActionType actionType) {
1467:                Action action = null;
1468:                return ACTION_TYPE_MAP.get(actionType);
1469:            }
1470:
1471:            public boolean canCopy() {
1472:                return true;
1473:            }
1474:
1475:            public boolean canCut() {
1476:                return true;
1477:            }
1478:
1479:            public Transferable clipboardCopy() throws IOException {
1480:                try {
1481:                    return new BpelNodeTransferable(this );
1482:                } catch (ClassNotFoundException e) {
1483:                    Exception ioe = new IOException();
1484:                    throw (IOException) ErrorManager.getDefault().annotate(ioe,
1485:                            e);
1486:                }
1487:            }
1488:
1489:            public Transferable clipboardCut() throws IOException {
1490:                try {
1491:                    return new BpelNodeTransferable(this );
1492:                } catch (ClassNotFoundException e) {
1493:                    Exception ioe = new IOException();
1494:                    throw (IOException) ErrorManager.getDefault().annotate(ioe,
1495:                            e);
1496:                }
1497:            }
1498:
1499:            protected void createPasteTypes(Transferable t,
1500:                    List/*<PasteType>*/list) {
1501:                List<BpelEntityPasteType> supportedPTs = getBpelPasteTypes(t);
1502:                if (supportedPTs != null && supportedPTs.size() > 0) {
1503:                    list.addAll(supportedPTs);
1504:                }
1505:            }
1506:
1507:            public final List<BpelEntityPasteType> getBpelPasteTypes(
1508:                    Transferable t) {
1509:                List<BpelEntityPasteType> pasteTypes = new ArrayList<BpelEntityPasteType>();
1510:                BpelNode transfBpelNode = Util.getTransferableBpelNode(t);
1511:                if (transfBpelNode != null && transfBpelNode != this 
1512:                        && isDropNodeInstanceSupported(transfBpelNode)) {
1513:                    List<BpelEntityPasteType> supportedPTs = createSupportedPasteTypes(transfBpelNode);
1514:                    if (supportedPTs != null && supportedPTs.size() > 0) {
1515:                        pasteTypes.addAll(supportedPTs);
1516:                    }
1517:                }
1518:                //        System.out.println("isPasteSupported: "+(pasteTypes.size() > 0) ); // NOI18N
1519:                return pasteTypes;
1520:            }
1521:
1522:            // default implementation
1523:            // other nodes should override it
1524:            // all checking rules should be implemented inside isDropNodeInstanceSupported
1525:            /*
1526:             * @return list of the supported PasteTypes
1527:             */
1528:            public List<BpelEntityPasteType> createSupportedPasteTypes(
1529:                    BpelNode childNode) {
1530:                return null;
1531:            }
1532:
1533:            // default checking rule - can't be overriden
1534:            // and could be used as the first checking rule if neccessary
1535:            public final boolean isDropNodeSupported(BpelNode childNode) {
1536:                if (childNode == null) {
1537:                    return false;
1538:                }
1539:
1540:                if (childNode.getReference() instanceof  BpelEntity
1541:                        && getReference() instanceof  BpelEntity) {
1542:                    BpelEntity childRefObj = (BpelEntity) childNode
1543:                            .getReference();
1544:                    BpelEntity parentRefObj = (BpelEntity) getReference();
1545:                    if (parentRefObj.getUID().equals(childRefObj.getUID())
1546:                            || (childRefObj.getParent() != null && parentRefObj
1547:                                    .getUID().equals(
1548:                                            childRefObj.getParent().getUID()))) {
1549:                        return false;
1550:                    } else {
1551:                        // check is drop node is parent node for this
1552:                        BpelEntity this ParentRefObj = parentRefObj == null ? null
1553:                                : parentRefObj.getParent();
1554:                        while (this ParentRefObj != null) {
1555:                            if (this ParentRefObj.getUID().equals(
1556:                                    childRefObj.getUID())) {
1557:                                return false;
1558:                            }
1559:                            this ParentRefObj = this ParentRefObj.getParent();
1560:                        }
1561:
1562:                        return true;
1563:                    }
1564:                }
1565:
1566:                return false;
1567:            }
1568:
1569:            protected boolean isDropNodeInstanceSupported(BpelNode childNode) {
1570:                if (!isDropNodeSupported(childNode)) {
1571:                    return false;
1572:                }
1573:                // here should be additional checks
1574:                return false;
1575:            }
1576:
1577:            //    public Transferable drag() throws IOException {
1578:            //        returnclipboardCopy();
1579:            //    }
1580:            //    
1581:            /*
1582:             * @param transferable transferable object
1583:             * @param action the drag'n'drop action
1584:             * @param i0 index between children the drop occured at or -1 if not specified
1585:             *
1586:             */
1587:            public PasteType getDropType(Transferable transferable, int action,
1588:                    int i0) {
1589:                List<BpelEntityPasteType> pasteTypes = getBpelPasteTypes(transferable);
1590:                if (pasteTypes == null || pasteTypes.size() == 0) {
1591:                    return null;
1592:                }
1593:
1594:                for (BpelEntityPasteType elem : pasteTypes) {
1595:                    if (elem.isSupportedDnDOperations(action)
1596:                            && elem.isSupportedChildIndex(i0)) {
1597:                        elem.setDndAction(action);
1598:                        elem.setPlaceIndex(i0);
1599:                        return elem;
1600:                    }
1601:                }
1602:                return null;
1603:            }
1604:
1605:            /**
1606:             * @return the new types that can be created in this node
1607:             */
1608:            public NewType[] getNewTypes() {
1609:                List<BpelNodeAction> actions = getAddActions();
1610:                if (actions == null || actions.size() < 1) {
1611:                    return super .getNewTypes();
1612:                }
1613:                NewType[] newTypes = new NewType[actions.size()];
1614:                for (int i = 0; i < newTypes.length; i++) {
1615:                    newTypes[i] = new BpelNodeNewType(actions.get(i), this );
1616:                }
1617:                return newTypes;
1618:            }
1619:
1620:            public List<BpelNodeAction> getAddActions() {
1621:                ActionType[] actions = getAddActionArray();
1622:                if (actions == null || actions.length == 0) {
1623:                    return null;
1624:                }
1625:                List<BpelNodeAction> resultAddActions = new ArrayList<BpelNodeAction>();
1626:                for (ActionType elem : actions) {
1627:                    if (elem != null) {
1628:                        Action action = createAction(elem);
1629:                        if (action != null
1630:                                && action instanceof  BpelNodeAction
1631:                                && ((BpelNodeAction) action)
1632:                                        .enable(new Node[] { this  })) {
1633:                            resultAddActions.add((BpelNodeAction) action);
1634:                        }
1635:                    }
1636:                }
1637:
1638:                return resultAddActions;
1639:            }
1640:
1641:            public String getHelpId() {
1642:                return null;
1643:            }
1644:
1645:            public HelpCtx getHelpCtx() {
1646:                return getHelpId() == null ? null : new HelpCtx(getHelpId());
1647:            }
1648:
1649:            public java.awt.Component getCustomizer() {
1650:                return getCustomizer(CustomNodeEditor.EditingMode.EDIT_INSTANCE);
1651:            }
1652:
1653:            public java.awt.Component getCustomizer(
1654:                    CustomNodeEditor.EditingMode editingMode) {
1655:                return null;
1656:            }
1657:
1658:            public static class NameComparator implements  Comparator<Node> {
1659:                public int compare(Node o1, Node o2) {
1660:                    if (o1 == null || o2 == null) {
1661:                        if (o1 == null && o2 == null) {
1662:                            return 0;
1663:                        } else if (o1 == null) {
1664:                            return -1;
1665:                        } else {
1666:                            return 1;
1667:                        }
1668:                    } else {
1669:                        return o1.getName().compareTo(o2.getName());
1670:                    }
1671:                }
1672:            }
1673:
1674:            public static class DisplayNameComparator implements 
1675:                    Comparator<Node> {
1676:                public int compare(Node o1, Node o2) {
1677:                    if (o1 == null || o2 == null) {
1678:                        if (o1 == null && o2 == null) {
1679:                            return 0;
1680:                        } else if (o1 == null) {
1681:                            return -1;
1682:                        } else {
1683:                            return 1;
1684:                        }
1685:                    } else {
1686:                        return o1.getDisplayName().compareTo(
1687:                                o2.getDisplayName());
1688:                    }
1689:                }
1690:            }
1691:
1692:            public static class NodeTypeComparator extends
1693:                    BpelNode.DisplayNameComparator {
1694:
1695:                private Class[] classesSortOrder;
1696:
1697:                public NodeTypeComparator(final Class... classesSortOrder) {
1698:                    this .classesSortOrder = classesSortOrder;
1699:                }
1700:
1701:                public int compare(BpelNode o1, BpelNode o2) {
1702:                    if (o1 == null || o2 == null) {
1703:                        return super .compare(o1, o2);
1704:                    } else {
1705:                        Class c1 = o1.getClass();
1706:                        Class c2 = o2.getClass();
1707:                        if (c1.equals(c2)) {
1708:                            return super .compare(o1, o2);
1709:                        } else {
1710:                            return getSortOrderIndex(c1)
1711:                                    - getSortOrderIndex(c2);
1712:                        }
1713:                    }
1714:                }
1715:
1716:                private int getSortOrderIndex(Class classObj) {
1717:                    for (int index = 0; index < classesSortOrder.length; index++) {
1718:                        if (classesSortOrder[index] == classObj) {
1719:                            return index;
1720:                        }
1721:                    }
1722:                    //
1723:                    return classesSortOrder.length;
1724:                }
1725:            }
1726:
1727:            public static final class NodeBadges {
1728:                public static final class WARNING {
1729:                    private static final String WARNING_BADGE = "org/netbeans/modules/bpel/editors/resources/badge_warning.png"; //NOI18N
1730:                    public static final Image IMAGE = Utilities
1731:                            .loadImage(WARNING_BADGE);
1732:                }
1733:
1734:                public static final class ERROR {
1735:                    private static final String ERROR_BADGE = "org/netbeans/modules/bpel/editors/resources/badge_error.png"; //NOI18N
1736:                    public static final Image IMAGE = Utilities
1737:                            .loadImage(ERROR_BADGE);
1738:                }
1739:
1740:                public static final class BREAKPOINT {
1741:                    private static final String BREAKPOINT_BADGE = "org/netbeans/modules/bpel/editors/resources/badge_breakpoint.png"; //NOI18N
1742:                    public static final Image IMAGE = Utilities
1743:                            .loadImage(BREAKPOINT_BADGE);
1744:                }
1745:
1746:                public static final class CURRENT_POSITION {
1747:                    private static final String CURRENT_POSITION_BADGE = "org/netbeans/modules/bpel/editors/resources/badge_current_position.png"; //NOI18N
1748:                    public static final Image IMAGE = Utilities
1749:                            .loadImage(CURRENT_POSITION_BADGE);
1750:                }
1751:
1752:                public static final class CURRENT_DISABLED_BREAKPOINT {
1753:                    private static final String CURRENT_DISABLED_BREAKPOINT_BADGE = "org/netbeans/modules/bpel/editors/resources/badge_current_disabled_breakpoint.png"; //NOI18N
1754:                    public static final Image IMAGE = Utilities
1755:                            .loadImage(CURRENT_DISABLED_BREAKPOINT_BADGE);
1756:                }
1757:
1758:                public static final class DISABLED_BREAKPOINT {
1759:                    private static final String DISABLED_BREAKPOINT_BADGE = "org/netbeans/modules/bpel/editors/resources/badge_disabled_breakpoint.png"; //NOI18N
1760:                    public static final Image IMAGE = Utilities
1761:                            .loadImage(DISABLED_BREAKPOINT_BADGE);
1762:                }
1763:
1764:                public static final class CURRENT_BREAKPOINT {
1765:                    private static final String CURRENT_BREAKPOINT_BADGE = "org/netbeans/modules/bpel/editors/resources/badge_current_breakpoint.png"; //NOI18N
1766:                    public static final Image IMAGE = Utilities
1767:                            .loadImage(CURRENT_BREAKPOINT_BADGE);
1768:                }
1769:            }
1770:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.