Source Code Cross Referenced for BiFeatureNode.java in  » IDE-Netbeans » beans » org » netbeans » modules » beans » beaninfo » 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 » beans » org.netbeans.modules.beans.beaninfo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.beans.beaninfo;
043:
044:        import java.io.IOException;
045:        import java.beans.PropertyEditor;
046:        import java.beans.PropertyEditorSupport;
047:        import java.lang.reflect.InvocationTargetException;
048:
049:        import javax.swing.Action;
050:        import javax.swing.GrayFilter;
051:        import org.openide.util.actions.SystemAction;
052:        import org.openide.nodes.Node;
053:        import org.openide.nodes.Children;
054:        import org.openide.nodes.AbstractNode;
055:        import org.openide.nodes.PropertySupport;
056:        import org.openide.nodes.Sheet;
057:
058:        /** The basic node for representing features included in BanInfo. It recognizes
059:         * the type of the BiFeature and creates properties according to it.
060:         * @author Petr Hrebejk
061:         */
062:        final class BiFeatureNode extends AbstractNode implements  Node.Cookie {
063:            /** generated Serialized Version UID */
064:            static final long serialVersionUID = -8680621542479107034L;
065:
066:            // static variables ...........................................................................
067:
068:            /** Property display name constant */
069:            public static final String PROP_DISPLAY_NAME = "displayName"; // NOI18N
070:            /** Property expert constant */
071:            public static final String PROP_EXPERT = "expert"; // NOI18N
072:            /** Property hidden constant
073:             */
074:            public static final String PROP_HIDDEN = "hidden"; // NOI18N
075:            /** Property name constant */
076:            public static final String PROP_NAME = "name"; // NOI18N
077:            /** Property preffered constant */
078:            public static final String PROP_PREFERRED = "preferred"; // NOI18N
079:            /** Property short description constant */
080:            public static final String PROP_SHORT_DESCRIPTION = "shortDescription"; // NOI18N
081:            /** Property include constant */
082:            public static final String PROP_INCLUDED = "included"; // NOI18N
083:            /** Property include constant */
084:            public static final String PROP_CUSTOMIZER = "customizer"; // NOI18N
085:
086:            /** Property bound constant */
087:            public static final String PROP_BOUND = "bound"; // NOI18N
088:            /** Property constrained constant */
089:            public static final String PROP_CONSTRAINED = "constrained"; // NOI18N
090:            /** Property mode constant */
091:            public static final String PROP_MODE = "mode"; // NOI18N
092:            /** Property editor class constant */
093:            public static final String PROP_EDITOR_CLASS = "propertyEditorClass"; // NOI18N
094:            /** Property non-indexed getter constant */
095:            public static final String PROP_NI_GETTER = "niGetter"; // NOI18N
096:            /** Property non-indexed setter constant */
097:            public static final String PROP_NI_SETTER = "niSetter"; // NOI18N
098:
099:            /** Property unicast constant */
100:            public static final String PROP_UNICAST = "unicast"; // NOI18N
101:            /** Property in default event set constant */
102:            public static final String PROP_IN_DEFAULT_EVENTSET = "inDefaultEventSet"; // NOI18N
103:
104:            // variables ..........................................................................
105:
106:            //private static SystemAction [] staticActions;
107:
108:            // feature mode asociated to this node
109:            protected BiFeature biFeature = null;
110:
111:            //analyser
112:            protected BiAnalyser biAnalyser = null;
113:
114:            static javax.swing.GrayFilter grayFilter = null;
115:
116:            static {
117:                grayFilter = new GrayFilter(true, 5);
118:            }
119:
120:            // constructors .......................................................................
121:
122:            /**
123:             * Creates empty BreakpointContext.
124:             */
125:            public BiFeatureNode(final BiFeature biFeature,
126:                    BiAnalyser biAnalyser) {
127:                super (Children.LEAF);
128:                this .biFeature = biFeature;
129:                this .biAnalyser = biAnalyser;
130:                setDisplayName(getName());
131:                setShortDescription(biFeature.getToolTip());
132:                setIconBaseWithExtension(biFeature.getIconBase(false) + ".gif");
133:                init();
134:            }
135:
136:            @Override
137:            public java.awt.Image getIcon(int type) {
138:                if (biFeature instanceof  BiFeature.Descriptor
139:                        && biAnalyser.isNullDescriptor()) {
140:                    //setIconBase( biFeature.getIconBase(true));
141:                    return GrayFilter.createDisabledImage(super .getIcon(type));
142:                }
143:                if ((biFeature instanceof  BiFeature.Property || biFeature instanceof  BiFeature.IdxProperty)
144:                        && biAnalyser.isNullProperties()) {
145:                    //setIconBase( biFeature.getIconBase(true));
146:                    return GrayFilter.createDisabledImage(super .getIcon(type));
147:                }
148:                if (biFeature instanceof  BiFeature.EventSet
149:                        && biAnalyser.isNullEventSets()) {
150:                    //setIconBase( biFeature.getIconBase(true));
151:                    return GrayFilter.createDisabledImage(super .getIcon(type));
152:                }
153:                if (biFeature instanceof  BiFeature.Method
154:                        && biAnalyser.isNullMethods()) {
155:                    //setIconBase( biFeature.getIconBase(true));
156:                    return GrayFilter.createDisabledImage(super .getIcon(type));
157:                }
158:                //setIconBase( biFeature.getIconBase(false));
159:                return super .getIcon(type);
160:            }
161:
162:            private void init() {
163:                createProperties();
164:                getCookieSet().add(this );
165:                /*
166:                breakpoint.addPropertyChangeListener (new PropertyChangeListener () {
167:                  public void propertyChange (PropertyChangeEvent e) {
168:                    String s = e.getPropertyName ();
169:                    parameterChanged (e);
170:                  }
171:                });
172:                 */
173:            }
174:
175:            @Override
176:            public <T extends Node.Cookie> T getCookie(Class<T> type) {
177:                if (type == BiFeatureNode.class)
178:                    return type.cast(this );
179:
180:                return getCookieSet().getCookie(type);
181:            }
182:
183:            /** Creates properties for this node */
184:            private void createProperties() {
185:
186:                // default sheet with "properties" property set // NOI18N
187:                Sheet sheet = Sheet.createDefault();
188:                Sheet.Set ps = sheet.get(Sheet.PROPERTIES);
189:
190:                ps.put(new PropertySupport.ReadOnly<String>(PROP_NAME,
191:                        String.class, GenerateBeanInfoAction
192:                                .getString("PROP_Bi_" + PROP_NAME),
193:                        GenerateBeanInfoAction
194:                                .getString("HINT_Bi_" + PROP_NAME)) {
195:                    public String getValue() {
196:                        return (!(biFeature instanceof  BiFeature.Descriptor)) ? biFeature
197:                                .getName()
198:                                : ((BiFeature.Descriptor) biFeature)
199:                                        .getBeanName();
200:                    }
201:
202:                    @Override
203:                    public void setValue(String val)
204:                            throws IllegalAccessException {
205:                        throw new IllegalAccessException(GenerateBeanInfoAction
206:                                .getString("MSG_Cannot_Write"));
207:                    }
208:                });
209:
210:                ps.put(BiNode.createProperty(biFeature, Boolean.TYPE,
211:                        PROP_EXPERT, GenerateBeanInfoAction
212:                                .getString("PROP_Bi_" + PROP_EXPERT),
213:                        GenerateBeanInfoAction.getString("HINT_Bi_"
214:                                + PROP_EXPERT), "isExpert", "setExpert")); // NOI18N
215:                ps.put(BiNode.createProperty(biFeature, Boolean.TYPE,
216:                        PROP_HIDDEN, GenerateBeanInfoAction
217:                                .getString("PROP_Bi_" + PROP_HIDDEN),
218:                        GenerateBeanInfoAction.getString("HINT_Bi_"
219:                                + PROP_HIDDEN), "isHidden", "setHidden")); // NOI18N
220:                ps.put(BiNode.createProperty(biFeature, Boolean.TYPE,
221:                        PROP_PREFERRED, GenerateBeanInfoAction
222:                                .getString("PROP_Bi_" + PROP_PREFERRED),
223:                        GenerateBeanInfoAction.getString("HINT_Bi_"
224:                                + PROP_PREFERRED), "isPreferred",
225:                        "setPreferred")); // NOI18N
226:
227:                ps.put(new CodePropertySupportRW<String>(PROP_DISPLAY_NAME,
228:                        String.class, GenerateBeanInfoAction
229:                                .getString("PROP_Bi_" + PROP_DISPLAY_NAME),
230:                        GenerateBeanInfoAction.getString("HINT_Bi_"
231:                                + PROP_DISPLAY_NAME)) {
232:                    public String getValue() {
233:                        return biFeature.getDisplayName() != null ? biFeature
234:                                .getDisplayName() : "null"; // NOI18N
235:                    }
236:
237:                    public void setValue(String val)
238:                            throws IllegalAccessException,
239:                            IllegalArgumentException, InvocationTargetException {
240:                        try {
241:                            if ("null".equals(val)) // NOI18N
242:                                val = null;
243:                            biFeature.setDisplayName(val);
244:                        } catch (ClassCastException e) {
245:                            throw new IllegalArgumentException();
246:                        }
247:                    }
248:                });
249:
250:                ps.put(new CodePropertySupportRW<String>(
251:                        //PropertySupport.ReadWrite (
252:                        PROP_SHORT_DESCRIPTION, String.class,
253:                        GenerateBeanInfoAction.getString("PROP_Bi_"
254:                                + PROP_SHORT_DESCRIPTION),
255:                        GenerateBeanInfoAction.getString("HINT_Bi_"
256:                                + PROP_SHORT_DESCRIPTION)) {
257:                    public String getValue() {
258:                        String toRet = biFeature.getShortDescription() != null ? biFeature
259:                                .getShortDescription()
260:                                : "null"; // NOI18N
261:                        return toRet;
262:                    }
263:
264:                    public void setValue(String val)
265:                            throws IllegalAccessException,
266:                            IllegalArgumentException, InvocationTargetException {
267:                        try {
268:                            if ("null".equals(val)) // NOI18N
269:                                val = null;
270:                            biFeature.setShortDescription(val);
271:                        } catch (ClassCastException e) {
272:                            throw new IllegalArgumentException();
273:                        }
274:                    }
275:                });
276:                // Add special properties according to type of feature
277:                if (!(biFeature instanceof  BiFeature.Descriptor))
278:                    addIncludedProperty(ps);
279:                else
280:                    addCustomizerProperty(sheet);
281:
282:                if (biFeature instanceof  BiFeature.Property
283:                        || biFeature instanceof  BiFeature.IdxProperty)
284:                    addExpertProperty(sheet);
285:                else if (biFeature instanceof  BiFeature.EventSet)
286:                    addExpertEventSet(sheet);
287:
288:                // and set new sheet
289:                setSheet(sheet);
290:            }
291:
292:            protected void addIncludedProperty(Sheet.Set ps) {
293:                ps.put(new PropertySupport.ReadWrite<Boolean>(PROP_INCLUDED,
294:                        Boolean.TYPE, GenerateBeanInfoAction
295:                                .getString("PROP_Bi_" + PROP_INCLUDED),
296:                        GenerateBeanInfoAction.getString("HINT_Bi_"
297:                                + PROP_INCLUDED)) {
298:                    public Boolean getValue() {
299:                        return biFeature.isIncluded();
300:                    }
301:
302:                    public void setValue(Boolean val)
303:                            throws IllegalAccessException,
304:                            IllegalArgumentException, InvocationTargetException {
305:                        try {
306:                            biFeature.setIncluded(val);
307:                            setIconBaseWithExtension(biFeature
308:                                    .getIconBase(false)
309:                                    + ".gif");
310:                        } catch (ClassCastException e) {
311:                            throw new IllegalArgumentException();
312:                        }
313:                    }
314:                });
315:            }
316:
317:            protected void addCustomizerProperty(Sheet sheet) {
318:                Sheet.Set ps = Sheet.createExpertSet();
319:
320:                ps.put(new CodePropertySupportRW<String>(
321:                        //PropertySupport.ReadWrite (
322:                        //ps.put(new PropertySupport.ReadWrite (
323:                        PROP_DISPLAY_NAME, String.class, GenerateBeanInfoAction
324:                                .getString("PROP_Bi_" + PROP_CUSTOMIZER),
325:                        GenerateBeanInfoAction.getString("HINT_Bi_"
326:                                + PROP_CUSTOMIZER)) {
327:                    public String getValue() {
328:                        String toRet = ((BiFeature.Descriptor) biFeature)
329:                                .getCustomizer() != null ? ((BiFeature.Descriptor) biFeature)
330:                                .getCustomizer()
331:                                : "null"; // NOI18N
332:                        return toRet;
333:                    }
334:
335:                    public void setValue(String val)
336:                            throws IllegalAccessException,
337:                            IllegalArgumentException, InvocationTargetException {
338:                        try {
339:                            if ("null".equals(val)) // NOI18N
340:                                val = null;
341:                            ((BiFeature.Descriptor) biFeature)
342:                                    .setCustomizer(val);
343:                        } catch (ClassCastException e) {
344:                            throw new IllegalArgumentException();
345:                        }
346:                    }
347:                });
348:                sheet.put(ps);
349:            }
350:
351:            protected void addExpertProperty(Sheet sheet) {
352:                Sheet.Set ps = Sheet.createExpertSet();
353:
354:                ps.put(BiNode.createProperty((BiFeature.Property) biFeature,
355:                        Boolean.TYPE, PROP_BOUND, GenerateBeanInfoAction
356:                                .getString("PROP_Bi_" + PROP_BOUND),
357:                        GenerateBeanInfoAction.getString("HINT_Bi_"
358:                                + PROP_BOUND), "isBound", "setBound")); // NOI18N
359:                ps.put(BiNode.createProperty((BiFeature.Property) biFeature,
360:                        Boolean.TYPE, PROP_CONSTRAINED, GenerateBeanInfoAction
361:                                .getString("PROP_Bi_" + PROP_CONSTRAINED),
362:                        GenerateBeanInfoAction.getString("HINT_Bi_"
363:                                + PROP_CONSTRAINED), "isConstrained",
364:                        "setConstrained")); // NOI18N
365:                ps.put(new PropertySupport<Integer>(
366:                        PROP_MODE,
367:                        Integer.TYPE, //int.class !!!!????,
368:                        GenerateBeanInfoAction
369:                                .getString("PROP_Bi_" + PROP_MODE),
370:                        GenerateBeanInfoAction
371:                                .getString("HINT_Bi_" + PROP_MODE), true,
372:                        ((BiFeature.Property) biFeature).modeChangeable()) {
373:                    public Integer getValue() {
374:                        return ((BiFeature.Property) biFeature).getMode();
375:                    }
376:
377:                    public void setValue(Integer val)
378:                            throws IllegalAccessException,
379:                            IllegalArgumentException, InvocationTargetException {
380:                        try {
381:                            ((BiFeature.Property) biFeature).setMode(val);
382:                            setIconBaseWithExtension(biFeature
383:                                    .getIconBase(false)
384:                                    + ".gif");
385:                        } catch (ClassCastException e) {
386:                            throw new IllegalArgumentException();
387:                        }
388:                    }
389:
390:                    @Override
391:                    public PropertyEditor getPropertyEditor() {
392:                        return new org.netbeans.modules.beans.ModePropertyEditor();
393:                    }
394:                });
395:                ps.put(BiNode.createProperty((BiFeature.Property) biFeature,
396:                        String.class, PROP_EDITOR_CLASS, GenerateBeanInfoAction
397:                                .getString("PROP_Bi_" + PROP_EDITOR_CLASS),
398:                        GenerateBeanInfoAction.getString("HINT_Bi_"
399:                                + PROP_EDITOR_CLASS), "getPropertyEditorClass",
400:                        "setPropertyEditorClass"));
401:
402:                if (biFeature instanceof  BiFeature.IdxProperty) {
403:                    ps.put(new PropertySupport<Boolean>(PROP_NI_GETTER,
404:                            Boolean.TYPE, GenerateBeanInfoAction
405:                                    .getString("PROP_Bi_" + PROP_NI_GETTER),
406:                            GenerateBeanInfoAction.getString("HINT_Bi_"
407:                                    + PROP_NI_GETTER), true,
408:                            ((BiFeature.IdxProperty) biFeature).hasNiGetter()) {
409:                        public Boolean getValue() {
410:                            return ((BiFeature.IdxProperty) biFeature)
411:                                    .isNiGetter();
412:                        }
413:
414:                        public void setValue(Boolean val)
415:                                throws IllegalAccessException,
416:                                IllegalArgumentException,
417:                                InvocationTargetException {
418:                            if (!((BiFeature.IdxProperty) biFeature)
419:                                    .hasNiGetter())
420:                                throw new IllegalAccessException();
421:                            try {
422:                                ((BiFeature.IdxProperty) biFeature)
423:                                        .setNiGetter(val);
424:                            } catch (ClassCastException e) {
425:                                throw new IllegalArgumentException();
426:                            }
427:                        }
428:                    });
429:                    ps.put(new PropertySupport<Boolean>(PROP_NI_SETTER,
430:                            Boolean.TYPE, GenerateBeanInfoAction
431:                                    .getString("PROP_Bi_" + PROP_NI_SETTER),
432:                            GenerateBeanInfoAction.getString("HINT_Bi_"
433:                                    + PROP_NI_SETTER), true,
434:                            ((BiFeature.IdxProperty) biFeature).hasNiSetter()) {
435:                        public Boolean getValue() {
436:                            return ((BiFeature.IdxProperty) biFeature)
437:                                    .isNiSetter();
438:                        }
439:
440:                        public void setValue(Boolean val)
441:                                throws IllegalAccessException,
442:                                IllegalArgumentException,
443:                                InvocationTargetException {
444:                            if (!((BiFeature.IdxProperty) biFeature)
445:                                    .hasNiSetter())
446:                                throw new IllegalAccessException();
447:                            try {
448:                                ((BiFeature.IdxProperty) biFeature)
449:                                        .setNiSetter(val);
450:                            } catch (ClassCastException e) {
451:                                throw new IllegalArgumentException();
452:                            }
453:                        }
454:                    });
455:                }
456:
457:                sheet.put(ps);
458:            }
459:
460:            void addExpertEventSet(Sheet sheet) {
461:                Sheet.Set ps = Sheet.createExpertSet();
462:
463:                ps.put(BiNode.createProperty((BiFeature.EventSet) biFeature,
464:                        Boolean.TYPE, PROP_UNICAST, GenerateBeanInfoAction
465:                                .getString("PROP_Bi_" + PROP_UNICAST),
466:                        GenerateBeanInfoAction.getString("HINT_Bi_"
467:                                + PROP_UNICAST), "isUnicast", null)); // NOI18N
468:
469:                ps.put(BiNode.createProperty((BiFeature.EventSet) biFeature,
470:                        Boolean.TYPE, PROP_IN_DEFAULT_EVENTSET,
471:                        GenerateBeanInfoAction.getString("PROP_Bi_"
472:                                + PROP_IN_DEFAULT_EVENTSET),
473:                        GenerateBeanInfoAction.getString("HINT_Bi_"
474:                                + PROP_IN_DEFAULT_EVENTSET),
475:                        "isInDefaultEventSet", "setInDefaultEventSet")); // NOI18N
476:
477:                sheet.put(ps);
478:
479:            }
480:
481:            // implementation of Node ..........................................................
482:
483:            /** Getter for set of actions that should be present in the
484:             * popup menu of this node. This set is used in construction of
485:             * menu returned from getContextMenu and specially when a menu for
486:             * more nodes is constructed.
487:             *
488:             * @return array of system actions that should be in popup menu
489:             */
490:            @Override
491:            public Action[] getActions(boolean context) {
492:                Action[] staticActions = null;
493:                //if (staticActions == null) {
494:                if (!(biFeature instanceof  BiFeature.Descriptor)) {
495:                    staticActions = new Action[] {
496:                            SystemAction.get(BiToggleAction.class), null
497:                    /*
498:                    SystemAction.get (DeleteAction.class),
499:                    null,
500:                    SystemAction.get (ToolsAction.class),
501:                    SystemAction.get (PropertiesAction.class),
502:                     */
503:                    };
504:                } else {
505:                    staticActions = new Action[0];
506:                }
507:                //}
508:                return staticActions;
509:            }
510:
511:            /**
512:             * the feature cannot be removed it can only be disabled from BeanInfo
513:             *
514:             * @return <CODE>true</CODE>
515:             */
516:            @Override
517:            public boolean canDestroy() {
518:                return false;
519:            }
520:
521:            /**
522:             * Deletes breakpoint and removes the node too.
523:             * Ovverrides destroy() from abstract node.
524:             */
525:            @Override
526:            public void destroy() throws IOException {
527:                // remove node
528:                // super.destroy ();
529:            }
530:
531:            /** It has default action - it is the toggle of value for include to bean info
532:             * @return <CODE>true</CODE>
533:             */
534:            public boolean hasDefaultAction() {
535:                return true;
536:            }
537:
538:            /** Toggles the selection of bi feature */
539:            public void toggleSelection() {
540:                biFeature.setIncluded(!biFeature.isIncluded());
541:                firePropertyChange(PROP_INCLUDED, !biFeature.isIncluded(),
542:                        biFeature.isIncluded());
543:                setIconBaseWithExtension(biFeature.getIconBase(false) + ".gif");
544:            }
545:
546:            /** Includes/excludes the pattern from bean info */
547:            public void include(boolean value) {
548:                if ((value && biFeature.isIncluded())
549:                        || (!value && !biFeature.isIncluded()))
550:                    return;
551:
552:                biFeature.setIncluded(value);
553:                firePropertyChange(PROP_INCLUDED, !biFeature.isIncluded(),
554:                        biFeature.isIncluded());
555:                setIconBaseWithExtension(biFeature.getIconBase(false) + ".gif");
556:            }
557:
558:            /** Executes default action.
559:             */
560:            public void invokeDefaultAction() {
561:                //System.out.println ( "Default action"); // NOI18N
562:                toggleSelection();
563:            }
564:
565:            // private methods .....................................................................
566:
567:            /**
568:             * Returns the associated BiFature
569:             */
570:            BiFeature getBiFeature() {
571:                return biFeature;
572:            }
573:
574:            BiAnalyser getBiAnalyser() {
575:                return biAnalyser;
576:            }
577:
578:            /**
579:             * Sets display name and fires property change.
580:             */
581:            /*
582:            void parameterChanged (PropertyChangeEvent e) {
583:              setDisplayName (getName ());
584:              firePropertyChange (e.getPropertyName (), e.getOldValue (), e.getNewValue ());
585:            }
586:             */
587:
588:            /**
589:             * Returns human presentable name of this breakpoint containing
590:             * informations about lineNumber, className e.t.c.
591:             *
592:             * @return human presentable name of this breakpoint.
593:             */
594:            @Override
595:            public String getName() {
596:                return (!(biFeature instanceof  BiFeature.Descriptor)) ? biFeature
597:                        .getName()
598:                        : ((BiFeature.Descriptor) biFeature).getBeanName();
599:                //return biFeature.getName();
600:            }
601:
602:            public void iconChanged() {
603:                if (biFeature instanceof  BiFeature.Descriptor
604:                        && biAnalyser.isNullDescriptor()) {
605:                    setIconBaseWithExtension(biFeature.getIconBase(true)
606:                            + ".gif");
607:                } else if ((biFeature instanceof  BiFeature.Property || biFeature instanceof  BiFeature.IdxProperty)
608:                        && biAnalyser.isNullProperties()) {
609:                    setIconBaseWithExtension(biFeature.getIconBase(true)
610:                            + ".gif");
611:                } else if (biFeature instanceof  BiFeature.EventSet
612:                        && biAnalyser.isNullEventSets()) {
613:                    setIconBaseWithExtension(biFeature.getIconBase(true)
614:                            + ".gif");
615:                } else if (biFeature instanceof  BiFeature.Method
616:                        && biAnalyser.isNullMethods()) {
617:                    setIconBaseWithExtension(biFeature.getIconBase(true)
618:                            + ".gif");
619:                } else
620:                    setIconBaseWithExtension(biFeature.getIconBase(false)
621:                            + ".gif");
622:
623:                fireIconChange();
624:            }
625:
626:            abstract class CodePropertySupportRW<T> extends
627:                    PropertySupport.ReadWrite<T> {
628:                CodePropertySupportRW(String name, Class<T> type,
629:                        String displayName, String shortDescription) {
630:                    super (name, type, displayName, shortDescription);
631:                }
632:
633:                @Override
634:                public PropertyEditor getPropertyEditor() {
635:                    return new PropertyEditorSupport() {
636:                        @Override
637:                        public java.awt.Component getCustomEditor() {
638:                            return new CustomCodeEditor(
639:                                    CodePropertySupportRW.this );
640:                        }
641:
642:                        @Override
643:                        public boolean supportsCustomEditor() {
644:                            return true;
645:                        }
646:                    };
647:                }
648:            }
649:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.