This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 23350
Collapse All | Expand All

(-)utilities/src/org/netbeans/modules/group/GroupShadow.java (-32 / +14 lines)
Lines 96-134 Link Here
96
    /** Generated serial version UID. */
96
    /** Generated serial version UID. */
97
    static final long serialVersionUID =-5086491126656157958L;
97
    static final long serialVersionUID =-5086491126656157958L;
98
98
99
    private static TemplateWizard.Iterator groupTemplateIterator = null;
100
    private static synchronized TemplateWizard.Iterator getGroupTemplateIterator() {
101
        if (groupTemplateIterator == null) {
102
            groupTemplateIterator = new GroupTemplateIterator();
103
        }
104
        return groupTemplateIterator;
105
    }
106
99
    
107
    
100
    /** Constructs group shadow data object. */
108
    /** Constructs group shadow data object. */
101
    public GroupShadow(final FileObject fo, DataLoader dl)
109
    public GroupShadow(final FileObject fo, DataLoader dl)
102
    throws DataObjectExistsException, IllegalArgumentException, IOException {
110
    throws DataObjectExistsException, IllegalArgumentException, IOException {
103
        super(fo, dl);
111
        super(fo, dl);
104
105
        if (isTemplate() && TemplateWizard.getIterator(this) == null
106
                && !fo.isReadOnly())
107
            try {
108
                TemplateWizard.setIterator(this, new GroupTemplateIterator());
109
            } catch (IOException ioe) {
110
                if(Boolean.getBoolean("netbeans.debug.exceptions")) { // NOI18N
111
                    System.err.println("[WARNING] Cannot attach template iterator to "+fo.getName()+" group."); // NOI18N
112
                    ioe.printStackTrace();
113
                }
114
            }
115
116
        // track changes when dataobject becomes template; listener is
117
        // attached all the time (filesystem attributes could be deleted...)
118
        addPropertyChangeListener(new PropertyChangeListener() {
119
            public void propertyChange(PropertyChangeEvent evt) {
120
                if (DataObject.PROP_TEMPLATE.equals(evt.getPropertyName())
121
                      && new Boolean(true).equals(evt.getNewValue())) {
122
                    try {
123
                        if (TemplateWizard.getIterator(GroupShadow.this) == null)
124
                            TemplateWizard.setIterator(GroupShadow.this,
125
                                                  new GroupTemplateIterator());
126
                    }
127
                    catch (IOException ex) { // do nothing...
128
                    }
129
                }
130
            }
131
        });
132
    }
112
    }
133
113
134
    
114
    
Lines 226-236 Link Here
226
206
227
    /** Adds a {@link CompilerCookie compilation cookie}. */
207
    /** Adds a {@link CompilerCookie compilation cookie}. */
228
    public Node.Cookie getCookie (Class cookie) {
208
    public Node.Cookie getCookie (Class cookie) {
229
        if (CompilerCookie.class.isAssignableFrom (cookie)) {
209
        if (cookie.isAssignableFrom(GroupShadowCompiler.class)) {
230
            GroupShadowCompiler c = new GroupShadowCompiler (this, cookie);
210
            return new GroupShadowCompiler (this, cookie);
231
            return c;
211
        } else if (cookie == TemplateWizard.Iterator.class) {
212
            return getGroupTemplateIterator();
213
        } else {
214
            return super.getCookie (cookie);
232
        }
215
        }
233
        return super.getCookie (cookie);
234
    }
216
    }
235
217
236
    /** Reads whole file to the List.
218
    /** Reads whole file to the List.

Return to bug 23350