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 171788
Collapse All | Expand All

(-)uml.project/src/org/netbeans/modules/uml/project/ui/nodes/UMLChildrenNodesCollection.java (-10 / +51 lines)
Lines 49-55 Link Here
49
49
50
import java.util.ArrayList;
50
import java.util.ArrayList;
51
import java.util.Collection;
51
import java.util.Collection;
52
import java.util.Hashtable;
52
import java.util.HashMap;
53
import java.util.Iterator;
53
import java.util.Iterator;
54
import java.util.Set;
54
import java.util.Set;
55
import java.util.TreeMap;
55
import java.util.TreeMap;
Lines 69-89 Link Here
69
{
69
{
70
    
70
    
71
    TreeMap<Key, ArrayList<Node>> map = new TreeMap<Key, ArrayList<Node>>();
71
    TreeMap<Key, ArrayList<Node>> map = new TreeMap<Key, ArrayList<Node>>();
72
    Hashtable<Node, Key> hash = new Hashtable<Node, Key>();
72
    HashMap<Node, Key> hash = new HashMap<Node, Key>();
73
73
74
    static int cnt = 0;
74
    static int cnt = 0;
75
    int ind = cnt++;
75
    int ind = cnt++;
76
76
77
    @Override
77
    public int size() 
78
    public int size() 
78
    {
79
    {
79
        return hash.size();        
80
        return hash.size();        
80
    }
81
    }
81
82
83
    @Override
82
    public boolean isEmpty() 
84
    public boolean isEmpty() 
83
    {
85
    {
84
        return hash.isEmpty();
86
        return hash.isEmpty();
85
    }
87
    }
86
88
89
    @Override
87
    public boolean contains(Object o) 
90
    public boolean contains(Object o) 
88
    {        
91
    {        
89
        Node n = null;
92
        Node n = null;
Lines 119-142 Link Here
119
        return false;
122
        return false;
120
    }
123
    }
121
124
125
    @Override
122
    public Iterator<Node> iterator() 
126
    public Iterator<Node> iterator() 
123
    {
127
    {
124
        ArrayList<Node> list = asList();
128
        ArrayList<Node> list = asList();
125
        return list.iterator(); 
129
        return list.iterator(); 
126
    }
130
    }
127
131
132
    @Override
128
    public <T> T[] toArray(T[] a) 
133
    public <T> T[] toArray(T[] a) 
129
    {
134
    {
130
        ArrayList<Node> list = asList();
135
        ArrayList<Node> list = asList();
131
        return list.toArray(a);
136
        return list.toArray(a);
132
    }
137
    }
133
138
139
    @Override
134
    public Object[] toArray() 
140
    public Object[] toArray() 
135
    {
141
    {
136
        ArrayList<Node> list = asList();
142
        ArrayList<Node> list = asList();
137
        return list.toArray();
143
        return list.toArray();
138
    }
144
    }
139
145
146
    @Override
140
    public boolean add(Node n)
147
    public boolean add(Node n)
141
    {   
148
    {   
142
        boolean added = false;
149
        boolean added = false;
Lines 162-167 Link Here
162
        list.add(n);
169
        list.add(n);
163
    }
170
    }
164
171
172
    @Override
165
    public boolean remove(Object o) 
173
    public boolean remove(Object o) 
166
    {
174
    {
167
        Node n = null;
175
        Node n = null;
Lines 198-204 Link Here
198
            if (list != null) 
206
            if (list != null) 
199
            {
207
            {
200
                removed = list.remove(n);
208
                removed = list.remove(n);
201
                if (list.size() == 0) 
209
                if (list.isEmpty()) 
202
                {
210
                {
203
                    map.remove(k);
211
                    map.remove(k);
204
                }
212
                }
Lines 207-212 Link Here
207
        return removed;
215
        return removed;
208
    }
216
    }
209
217
218
    @Override
210
    public boolean addAll(Collection<? extends Node> c) 
219
    public boolean addAll(Collection<? extends Node> c) 
211
    {
220
    {
212
        boolean changed = false;
221
        boolean changed = false;
Lines 217-222 Link Here
217
        return changed;
226
        return changed;
218
    }
227
    }
219
228
229
    @Override
220
    public boolean removeAll(Collection<?> c) 
230
    public boolean removeAll(Collection<?> c) 
221
    {
231
    {
222
        boolean changed = false;
232
        boolean changed = false;
Lines 227-232 Link Here
227
        return changed;       
237
        return changed;       
228
    }
238
    }
229
    
239
    
240
    @Override
230
    public boolean containsAll(Collection<?> c)
241
    public boolean containsAll(Collection<?> c)
231
    {
242
    {
232
        boolean contains = true;
243
        boolean contains = true;
Lines 237-242 Link Here
237
        return contains;        
248
        return contains;        
238
    }
249
    }
239
250
251
    @Override
240
    public boolean retainAll(Collection<?> c) 
252
    public boolean retainAll(Collection<?> c) 
241
    {
253
    {
242
        ArrayList<Node> list = asList();
254
        ArrayList<Node> list = asList();
Lines 251-256 Link Here
251
        return changed;        
263
        return changed;        
252
    }
264
    }
253
265
266
    @Override
254
    public void clear() 
267
    public void clear() 
255
    {
268
    {
256
        hash.clear();
269
        hash.clear();
Lines 258-269 Link Here
258
    }
271
    }
259
272
260
    @Override
273
    @Override
261
    public boolean equals(Object o) 
262
    {
263
        return (o == null ? false : hashCode() == o.hashCode());
264
    }
265
    
266
    @Override
267
    public int hashCode() 
274
    public int hashCode() 
268
    {
275
    {
269
        int h = (hash == null ? 0 : hash.hashCode());
276
        int h = (hash == null ? 0 : hash.hashCode());
Lines 271-280 Link Here
271
        return h ^ m;       
278
        return h ^ m;       
272
    }
279
    }
273
280
281
    @Override
282
    public boolean equals(Object obj) {
283
        if (obj == null) {
284
            return false;
285
        }
286
        if (getClass() != obj.getClass()) {
287
            return false;
288
        }
289
        final UMLChildrenNodesCollection other = (UMLChildrenNodesCollection) obj;
290
        if (this.map != other.map && (this.map == null || !this.map.equals(other.map))) {
291
            return false;
292
        }
293
        if (this.hash != other.hash && (this.hash == null || !this.hash.equals(other.hash))) {
294
            return false;
295
        }
296
        if (this.ind != other.ind) {
297
            return false;
298
        }
299
        return true;
300
    }
274
    
301
    
302
    
275
    void dumpMap() 
303
    void dumpMap() 
276
    {
304
    {
277
        ArrayList<Node> res = new ArrayList<Node>(hash.size());
278
        Set<Key> ks = map.keySet();
305
        Set<Key> ks = map.keySet();
279
        for(Key k : ks) 
306
        for(Key k : ks) 
280
        {
307
        {
Lines 334-339 Link Here
334
            this.name = name;
361
            this.name = name;
335
        }
362
        }
336
363
364
        @Override
337
        public int compareTo(Key other) 
365
        public int compareTo(Key other) 
338
        {
366
        {
339
            if (this.priority > other.priority) 
367
            if (this.priority > other.priority) 
Lines 373-380 Link Here
373
            return false;
401
            return false;
374
        }
402
        }
375
   
403
   
404
        @Override
405
        public int hashCode() {
406
            int hash = 7;
407
            hash = 23 * hash + (int) (this.priority ^ (this.priority >>> 32));
408
            hash = 23 * hash + (this.name != null ? this.name.hashCode() : 0);
409
            return hash;
376
    }
410
    }
377
411
412
    }
413
414
    @Override
378
    public void propertyChange (PropertyChangeEvent ev) 
415
    public void propertyChange (PropertyChangeEvent ev) 
379
    {
416
    {
380
        Object src = ev.getSource();
417
        Object src = ev.getSource();
Lines 395-406 Link Here
395
        }
432
        }
396
    }
433
    }
397
    
434
    
435
    @Override
398
    public void childrenAdded(NodeMemberEvent ev) {}
436
    public void childrenAdded(NodeMemberEvent ev) {}
399
437
438
    @Override
400
    public void childrenRemoved(NodeMemberEvent ev) {}
439
    public void childrenRemoved(NodeMemberEvent ev) {}
401
440
441
    @Override
402
    public void childrenReordered(NodeReorderEvent ev) {}
442
    public void childrenReordered(NodeReorderEvent ev) {}
403
443
444
    @Override
404
    public void nodeDestroyed(NodeEvent ev) {}
445
    public void nodeDestroyed(NodeEvent ev) {}
405
446
406
}
447
}
(-)uml.project/src/org/netbeans/modules/uml/project/ui/nodes/UMLDiagramChildFactory.java (+407 lines)
Line 0 Link Here
1
package org.netbeans.modules.uml.project.ui.nodes;
2
3
import java.util.ArrayList;
4
import java.util.Collection;
5
import java.util.Iterator;
6
import java.util.List;
7
import java.util.ListIterator;
8
import org.netbeans.modules.uml.core.metamodel.core.foundation.IElement;
9
import org.netbeans.modules.uml.core.metamodel.core.foundation.INamespace;
10
import org.netbeans.modules.uml.core.metamodel.diagrams.DiagramDetails;
11
import org.netbeans.modules.uml.core.metamodel.diagrams.IDiagram;
12
import org.netbeans.modules.uml.core.metamodel.diagrams.IProxyDiagram;
13
import org.netbeans.modules.uml.core.metamodel.structure.IProject;
14
import org.netbeans.modules.uml.core.support.umlutils.ETList;
15
import org.openide.nodes.ChildFactory;
16
import org.openide.nodes.Node;
17
18
/**
19
 *
20
 * @author Javier A. Ortiz Bultrón <javier.ortiz.78@gmail.com>
21
 */
22
public class UMLDiagramChildFactory extends ChildFactory<IProxyDiagram>{
23
24
    @Override
25
    protected boolean createKeys(List<IProxyDiagram> toPopulate) {
26
        ArrayList<IProxyDiagram> nodes=new ArrayList<IProxyDiagram>();
27
        nodes.add(new IProxyDiagram() {
28
29
            @Override
30
            public DiagramDetails getDiagramDetails() {
31
                return null;
32
            }
33
34
            @Override
35
            public String getName() {
36
                return "test";
37
            }
38
39
            @Override
40
            public void setName(String value) {
41
                throw new UnsupportedOperationException("Not supported yet.");
42
            }
43
44
            @Override
45
            public String getAlias() {
46
                 return "test";
47
            }
48
49
            @Override
50
            public void setAlias(String value) {
51
                throw new UnsupportedOperationException("Not supported yet.");
52
            }
53
54
            @Override
55
            public String getNameWithAlias() {
56
                 return "test";
57
            }
58
59
            @Override
60
            public void setNameWithAlias(String value) {
61
                throw new UnsupportedOperationException("Not supported yet.");
62
            }
63
64
            @Override
65
            public String getQualifiedName() {
66
                 return "test";
67
            }
68
69
            @Override
70
            public String getDocumentation() {
71
                 return "test";
72
            }
73
74
            @Override
75
            public void setDocumentation(String value) {
76
                throw new UnsupportedOperationException("Not supported yet.");
77
            }
78
79
            @Override
80
            public INamespace getNamespace() {
81
                throw new UnsupportedOperationException("Not supported yet.");
82
            }
83
84
            @Override
85
            public void setNamespace(INamespace value) {
86
                throw new UnsupportedOperationException("Not supported yet.");
87
            }
88
89
            @Override
90
            public String getNamespaceXMIID() {
91
                 return "test";
92
            }
93
94
            @Override
95
            public String getXMIID() {
96
                 return "test";
97
            }
98
99
            @Override
100
            public String getFilename() {
101
                 return "test";
102
            }
103
104
            @Override
105
            public void setFilename(String value) {
106
                throw new UnsupportedOperationException("Not supported yet.");
107
            }
108
109
            @Override
110
            public int getDiagramKind() {
111
                return 1;
112
            }
113
114
            @Override
115
            public String getDiagramKindName() {
116
                 return "test";
117
            }
118
119
            @Override
120
            public IProject getProject() {
121
                throw new UnsupportedOperationException("Not supported yet.");
122
            }
123
124
            @Override
125
            public IDiagram getDiagram() {
126
                throw new UnsupportedOperationException("Not supported yet.");
127
            }
128
129
            @Override
130
            public boolean isOpen() {
131
                return true;
132
            }
133
134
            @Override
135
            public boolean isValidDiagram() {
136
                return true;
137
            }
138
139
            @Override
140
            public boolean isSame(IProxyDiagram pProxy) {
141
                return false;
142
            }
143
144
            @Override
145
            public boolean getReadOnly() {
146
                return false;
147
            }
148
149
            @Override
150
            public void addAssociatedDiagram(String sDiagramXMIID) {
151
                throw new UnsupportedOperationException("Not supported yet.");
152
            }
153
154
            @Override
155
            public void addAssociatedDiagram(IProxyDiagram pDiagram) {
156
                throw new UnsupportedOperationException("Not supported yet.");
157
            }
158
159
            @Override
160
            public void addDualAssociatedDiagrams(IProxyDiagram pDiagram1, IProxyDiagram pDiagram2) {
161
                throw new UnsupportedOperationException("Not supported yet.");
162
            }
163
164
            @Override
165
            public void removeAssociatedDiagram(String sDiagramXMIID) {
166
                throw new UnsupportedOperationException("Not supported yet.");
167
            }
168
169
            @Override
170
            public void removeAssociatedDiagram(IProxyDiagram pDiagram) {
171
                throw new UnsupportedOperationException("Not supported yet.");
172
            }
173
174
            @Override
175
            public void removeDualAssociatedDiagrams(IProxyDiagram pDiagram1, IProxyDiagram pDiagram2) {
176
                throw new UnsupportedOperationException("Not supported yet.");
177
            }
178
179
            @Override
180
            public ETList<IProxyDiagram> getAssociatedDiagrams() {
181
                throw new UnsupportedOperationException("Not supported yet.");
182
            }
183
184
            @Override
185
            public boolean isAssociatedDiagram(String sDiagramXMIID) {
186
                return false;
187
            }
188
189
            @Override
190
            public boolean isAssociatedDiagram(IProxyDiagram pDiagram) {
191
                return false;
192
            }
193
194
            @Override
195
            public void addAssociatedElement(String sTopLevelElementXMIID, String sModelElementXMIID) {
196
                throw new UnsupportedOperationException("Not supported yet.");
197
            }
198
199
            @Override
200
            public void addAssociatedElement(IElement pElement) {
201
                throw new UnsupportedOperationException("Not supported yet.");
202
            }
203
204
            @Override
205
            public void removeAssociatedElement(String sTopLevelElementXMIID, String sModelElementXMIID) {
206
                throw new UnsupportedOperationException("Not supported yet.");
207
            }
208
209
            @Override
210
            public void removeAssociatedElement(IElement pElement) {
211
                throw new UnsupportedOperationException("Not supported yet.");
212
            }
213
214
            @Override
215
            public ETList<IElement> getAssociatedElements() {
216
                return new ETList<IElement>() {
217
218
                    @Override
219
                    public boolean find(IElement obj) {
220
                        throw new UnsupportedOperationException("Not supported yet.");
221
                    }
222
223
                    @Override
224
                    public int getCount() {
225
                        throw new UnsupportedOperationException("Not supported yet.");
226
                    }
227
228
                    @Override
229
                    public IElement item(int i) {
230
                        throw new UnsupportedOperationException("Not supported yet.");
231
                    }
232
233
                    @Override
234
                    public void addIfNotInList(IElement element) {
235
                        throw new UnsupportedOperationException("Not supported yet.");
236
                    }
237
238
                    @Override
239
                    public boolean isInList(IElement element) {
240
                        throw new UnsupportedOperationException("Not supported yet.");
241
                    }
242
243
                    @Override
244
                    public void removeItem(IElement element) {
245
                        throw new UnsupportedOperationException("Not supported yet.");
246
                    }
247
248
                    @Override
249
                    public void removeThese(ETList<IElement> elements) {
250
                        throw new UnsupportedOperationException("Not supported yet.");
251
                    }
252
253
                    @Override
254
                    public void addThese(ETList<IElement> elements) {
255
                        throw new UnsupportedOperationException("Not supported yet.");
256
                    }
257
258
                    @Override
259
                    public void removeDuplicates() {
260
                        throw new UnsupportedOperationException("Not supported yet.");
261
                    }
262
263
                    @Override
264
                    public void clear() {
265
                        throw new UnsupportedOperationException("Not supported yet.");
266
                    }
267
268
                    @Override
269
                    public int size() {
270
                        throw new UnsupportedOperationException("Not supported yet.");
271
                    }
272
273
                    @Override
274
                    public boolean isEmpty() {
275
                        throw new UnsupportedOperationException("Not supported yet.");
276
                    }
277
278
                    @Override
279
                    public boolean contains(Object o) {
280
                        throw new UnsupportedOperationException("Not supported yet.");
281
                    }
282
283
                    @Override
284
                    public Iterator<IElement> iterator() {
285
                        throw new UnsupportedOperationException("Not supported yet.");
286
                    }
287
288
                    @Override
289
                    public Object[] toArray() {
290
                        throw new UnsupportedOperationException("Not supported yet.");
291
                    }
292
293
                    @Override
294
                    public <T> T[] toArray(T[] a) {
295
                        throw new UnsupportedOperationException("Not supported yet.");
296
                    }
297
298
                    @Override
299
                    public boolean add(IElement e) {
300
                        throw new UnsupportedOperationException("Not supported yet.");
301
                    }
302
303
                    @Override
304
                    public boolean remove(Object o) {
305
                        throw new UnsupportedOperationException("Not supported yet.");
306
                    }
307
308
                    @Override
309
                    public boolean containsAll(Collection<?> c) {
310
                        throw new UnsupportedOperationException("Not supported yet.");
311
                    }
312
313
                    @Override
314
                    public boolean addAll(Collection<? extends IElement> c) {
315
                        throw new UnsupportedOperationException("Not supported yet.");
316
                    }
317
318
                    @Override
319
                    public boolean addAll(int index, Collection<? extends IElement> c) {
320
                        throw new UnsupportedOperationException("Not supported yet.");
321
                    }
322
323
                    @Override
324
                    public boolean removeAll(Collection<?> c) {
325
                        throw new UnsupportedOperationException("Not supported yet.");
326
                    }
327
328
                    @Override
329
                    public boolean retainAll(Collection<?> c) {
330
                        throw new UnsupportedOperationException("Not supported yet.");
331
                    }
332
333
                    @Override
334
                    public IElement get(int index) {
335
                        throw new UnsupportedOperationException("Not supported yet.");
336
                    }
337
338
                    @Override
339
                    public IElement set(int index, IElement element) {
340
                        throw new UnsupportedOperationException("Not supported yet.");
341
                    }
342
343
                    @Override
344
                    public void add(int index, IElement element) {
345
                        throw new UnsupportedOperationException("Not supported yet.");
346
                    }
347
348
                    @Override
349
                    public IElement remove(int index) {
350
                        throw new UnsupportedOperationException("Not supported yet.");
351
                    }
352
353
                    @Override
354
                    public int indexOf(Object o) {
355
                        throw new UnsupportedOperationException("Not supported yet.");
356
                    }
357
358
                    @Override
359
                    public int lastIndexOf(Object o) {
360
                        throw new UnsupportedOperationException("Not supported yet.");
361
                    }
362
363
                    @Override
364
                    public ListIterator<IElement> listIterator() {
365
                        throw new UnsupportedOperationException("Not supported yet.");
366
                    }
367
368
                    @Override
369
                    public ListIterator<IElement> listIterator(int index) {
370
                        throw new UnsupportedOperationException("Not supported yet.");
371
                    }
372
373
                    @Override
374
                    public List<IElement> subList(int fromIndex, int toIndex) {
375
                        throw new UnsupportedOperationException("Not supported yet.");
376
                    }
377
                };
378
            }
379
380
            @Override
381
            public boolean isAssociatedElement(String sModelElementXMIID) {
382
                return false;
383
            }
384
385
            @Override
386
            public boolean isAssociatedElement(IElement pElement) {
387
                return false;
388
            }
389
        });
390
        toPopulate.addAll(nodes);
391
        return true;
392
    } 
393
    
394
    @Override
395
    protected Node createNodeForKey(IProxyDiagram app) {
396
            return new UMLDiagramNode(app);
397
    }
398
399
    @Override
400
    protected Node[] createNodesForKey(IProxyDiagram key) {
401
        return new Node[]{createNodeForKey(key)};
402
    }
403
404
    public void refresh() {
405
        refresh(true);
406
    }
407
}
(-)uml.project/src/org/netbeans/modules/uml/project/ui/nodes/UMLDiagramNode.java (-3 / +24 lines)
Lines 119-135 Link Here
119
        getCookieSet().add(this);
119
        getCookieSet().add(this);
120
    }
120
    }
121
    
121
    
122
    @Override
122
    public String getShortDescription()
123
    public String getShortDescription()
123
    {
124
    {
124
        StringBuffer fullNameSpace = new StringBuffer();
125
        StringBuilder fullNameSpace = new StringBuilder();
125
        IProject project = getDiagram().getProject();
126
        IProject project = getDiagram().getProject();
126
        String qname = getDiagram().getQualifiedName();
127
        String qname = getDiagram().getQualifiedName();
127
        fullNameSpace.append(project + "::" + qname); // NOI18N
128
        fullNameSpace.append(project).append("::").append(qname); // NOI18N
128
        
129
        
129
        return fullNameSpace.toString();
130
        return fullNameSpace.toString();
130
    }
131
    }
131
    
132
    
132
    
133
    
134
    @Override
133
    public void registerListeners()
135
    public void registerListeners()
134
    {
136
    {
135
        if (isListenersRegistered())
137
        if (isListenersRegistered())
Lines 147-152 Link Here
147
    
149
    
148
    
150
    
149
    // enables the node to be renamed
151
    // enables the node to be renamed
152
    @Override
150
    public boolean canRename()
153
    public boolean canRename()
151
    {
154
    {
152
        return !isOldDiagramFormat();
155
        return !isOldDiagramFormat();
Lines 175-180 Link Here
175
   /* (non-Javadoc)
178
   /* (non-Javadoc)
176
    * @see org.netbeans.modules.uml.ui.support.projecttreesupport.ITreeDiagram#getDiagram()
179
    * @see org.netbeans.modules.uml.ui.support.projecttreesupport.ITreeDiagram#getDiagram()
177
    */
180
    */
181
    @Override
178
    public IProxyDiagram getDiagram()
182
    public IProxyDiagram getDiagram()
179
    {
183
    {
180
        return mDiagram;
184
        return mDiagram;
Lines 197-202 Link Here
197
     *
201
     *
198
     * @param name The diagram type name.
202
     * @param name The diagram type name.
199
     */
203
     */
204
    @Override
200
    public void setDiagramType(String name)
205
    public void setDiagramType(String name)
201
    {
206
    {
202
        mDiagramType = name;
207
        mDiagramType = name;
Lines 219-224 Link Here
219
     *
224
     *
220
     * @return The diagram type name.
225
     * @return The diagram type name.
221
     */
226
     */
227
    @Override
222
    public String getDiagramType()
228
    public String getDiagramType()
223
    {
229
    {
224
        return mDiagramType;
230
        return mDiagramType;
Lines 387-392 Link Here
387
    }
393
    }
388
    
394
    
389
    @Override
395
    @Override
396
    public int hashCode() {
397
        int hash = 7;
398
        hash = 67 * hash + (this.mDiagram != null ? this.mDiagram.hashCode() : 0);
399
        hash = 67 * hash + (this.mDiagramType != null ? this.mDiagramType.hashCode() : 0);
400
        hash = 67 * hash + (this.mPrintCookie != null ? this.mPrintCookie.hashCode() : 0);
401
        hash = 67 * hash + (this.dispatchHelper != null ? this.dispatchHelper.hashCode() : 0);
402
        return hash;
403
    }
404
    
405
    @Override
390
    public String getType()
406
    public String getType()
391
    {
407
    {
392
        return mDiagramType;
408
        return mDiagramType;
Lines 394-399 Link Here
394
    
410
    
395
    
411
    
396
    
412
    
413
    @Override
397
    public void setName(String newName)
414
    public void setName(String newName)
398
    {
415
    {
399
        if (!Util.isDiagramNameValid(newName))
416
        if (!Util.isDiagramNameValid(newName))
Lines 581-586 Link Here
581
//    }
598
//    }
582
    
599
    
583
    
600
    
601
    @Override
584
    public String getElementType()
602
    public String getElementType()
585
    {
603
    {
586
        String retVal = ""; // NOI18N
604
        String retVal = ""; // NOI18N
Lines 607-612 Link Here
607
        return retVal;
625
        return retVal;
608
    }
626
    }
609
    
627
    
628
    @Override
610
    public IElement getModelElement()
629
    public IElement getModelElement()
611
    {
630
    {
612
        IElement retVal = null;
631
        IElement retVal = null;
Lines 626-633 Link Here
626
    }
645
    }
627
    
646
    
628
    /**
647
    /**
629
     * Builds the proerty set structure.
648
     * Builds the property set structure.
630
     */
649
     */
650
    @Override
631
    protected Node.PropertySet[] buildProperties()
651
    protected Node.PropertySet[] buildProperties()
632
    {
652
    {
633
        Node.PropertySet[] retVal = null;
653
        Node.PropertySet[] retVal = null;
Lines 879-884 Link Here
879
    public class DiagramPrintCookie implements PrintCookie
899
    public class DiagramPrintCookie implements PrintCookie
880
    {
900
    {
881
        
901
        
902
        @Override
882
        public void print()
903
        public void print()
883
        {
904
        {
884
            IProjectTreeItem item = getData();
905
            IProjectTreeItem item = getData();
(-)uml.project/src/org/netbeans/modules/uml/project/ui/nodes/UMLDiagramsRootNode.java (-5 / +30 lines)
Lines 71-76 Link Here
71
import org.netbeans.modules.uml.resources.images.ImageUtil;
71
import org.netbeans.modules.uml.resources.images.ImageUtil;
72
import org.netbeans.modules.uml.ui.support.diagramsupport.IDrawingAreaEventsSink;
72
import org.netbeans.modules.uml.ui.support.diagramsupport.IDrawingAreaEventsSink;
73
import org.openide.loaders.DataObject;
73
import org.openide.loaders.DataObject;
74
import org.openide.nodes.Children;
74
import org.openide.util.datatransfer.NewType;
75
import org.openide.util.datatransfer.NewType;
75
import org.openide.util.datatransfer.PasteType;
76
import org.openide.util.datatransfer.PasteType;
76
77
Lines 113-120 Link Here
113
        PropertyEvaluator eval)
114
        PropertyEvaluator eval)
114
        
115
        
115
    {
116
    {
116
        super(new DiagramsChildren( eval, helper), Lookups.singleton(project));
117
        super(Children.create(new UMLDiagramChildFactory(), true), Lookups.singleton(project));
117
        ((DiagramsChildren)this.getChildren()).setNode(this);
118
//        ((DiagramsChildren)this.getChildren()).setNode(this);
118
        
119
        
119
        this.setIconBaseWithExtension(ICON);
120
        this.setIconBaseWithExtension(ICON);
120
        setElement(helper.getProject());
121
        setElement(helper.getProject());
Lines 136-151 Link Here
136
     *
137
     *
137
     * @param element The Model element that represents the project.
138
     * @param element The Model element that represents the project.
138
     */
139
     */
140
    @Override
139
    protected void addElementCookie(IElement element)
141
    protected void addElementCookie(IElement element)
140
    {
142
    {
141
    }
143
    }
142
  
144
  
143
    
145
    
146
    @Override
144
    public String getDisplayName()
147
    public String getDisplayName()
145
    {
148
    {
146
        return this.displayName;
149
        return this.displayName;
147
    }
150
    }
148
    
151
    
152
    @Override
149
    public String getName()
153
    public String getName()
150
    {
154
    {
151
        return this.getDisplayName();
155
        return this.getDisplayName();
Lines 158-168 Link Here
158
	 *
162
	 *
159
	 * @return An array of new type operations that are allowed.
163
	 * @return An array of new type operations that are allowed.
160
	 */
164
	 */
165
    @Override
161
    public NewType[] getNewTypes()
166
    public NewType[] getNewTypes()
162
    {
167
    {
163
		String elType = getElementType();
164
		NewType[] retVal = null;
165
166
		return new NewType[]
168
		return new NewType[]
167
		{
169
		{
168
			new NewDiagramType(getModelElement()),
170
			new NewDiagramType(getModelElement()),
Lines 170-175 Link Here
170
		};
172
		};
171
    }
173
    }
172
174
175
    @Override
173
    public Action[] getActions( boolean context )
176
    public Action[] getActions( boolean context )
174
    {
177
    {
175
       return super.getNewMenuAction();
178
       return super.getNewMenuAction();
Lines 187-221 Link Here
187
     * @return The IProject instance.
190
     * @return The IProject instance.
188
     * @see IProject
191
     * @see IProject
189
     */
192
     */
193
    @Override
190
    public IElement getModelElement()
194
    public IElement getModelElement()
191
    {
195
    {
192
        return helper.getProject();
196
        return helper.getProject();
193
    }
197
    }
194
    
198
    
199
    @Override
195
    public boolean canCopy()
200
    public boolean canCopy()
196
    {
201
    {
197
        return false;
202
        return false;
198
    }
203
    }
199
    
204
    
205
    @Override
200
    public boolean canCut()
206
    public boolean canCut()
201
    {
207
    {
202
        return false;
208
        return false;
203
    }
209
    }
204
    
210
    
211
    @Override
205
    public boolean canDestroy()
212
    public boolean canDestroy()
206
    {
213
    {
207
        return false;
214
        return false;
208
    }
215
    }
209
    
216
    
217
    @Override
210
    public boolean canRename()
218
    public boolean canRename()
211
    {
219
    {
212
        return false;
220
        return false;
213
    }
221
    }
214
    
222
    
223
    @Override
224
    public int hashCode() {
225
        int hash = 3;
226
        hash = 53 * hash + (this.displayName != null ? this.displayName.hashCode() : 0);
227
        return hash;
228
    }
229
    
215
    /**
230
    /**
216
     * Check if the specified node is the same UMLDiagramsRootNode
231
     * Check if the specified node is the same UMLDiagramsRootNode
217
     * instance.
232
     * instance.
218
     */
233
     */
234
    @Override
219
    public boolean equals(Object obj)
235
    public boolean equals(Object obj)
220
    {
236
    {
221
        boolean retVal = false;
237
        boolean retVal = false;
Lines 243-248 Link Here
243
            this.helper = helper;
259
            this.helper = helper;
244
        }
260
        }
245
        
261
        
262
        @Override
246
        public Node findChild(String name)
263
        public Node findChild(String name)
247
        {
264
        {
248
            Node[] list = getNodes();
265
            Node[] list = getNodes();
Lines 280-285 Link Here
280
         * Notify listeners that a node is being expanded.  Listeners are able to add
297
         * Notify listeners that a node is being expanded.  Listeners are able to add
281
         * nodes to the ProjectTreeItem.
298
         * nodes to the ProjectTreeItem.
282
         */
299
         */
300
        @Override
283
        protected void sendNodeExpandEvent()
301
        protected void sendNodeExpandEvent()
284
        {
302
        {
285
            NetBeansUMLProjectTreeModel model = UMLModelRootNode.getProjectTreeModel();
303
            NetBeansUMLProjectTreeModel model = UMLModelRootNode.getProjectTreeModel();
Lines 312-317 Link Here
312
            this.extensions = Arrays.asList(extensions);
330
            this.extensions = Arrays.asList(extensions);
313
        }
331
        }
314
        
332
        
333
        @Override
315
        public boolean accept(File f)
334
        public boolean accept(File f)
316
        {
335
        {
317
            return true; // mcf hack
336
            return true; // mcf hack
Lines 327-332 Link Here
327
             */
346
             */
328
        }
347
        }
329
        
348
        
349
        @Override
330
        public String getDescription()
350
        public String getDescription()
331
        {
351
        {
332
            return this.description;
352
            return this.description;
Lines 355-360 Link Here
355
        IProxyDiagram pParentDiagram, IResultCell cell)
375
        IProxyDiagram pParentDiagram, IResultCell cell)
356
    {}
376
    {}
357
377
378
    @Override
358
    public void onDrawingAreaPrePropertyChange(
379
    public void onDrawingAreaPrePropertyChange(
359
        IProxyDiagram pProxyDiagram, int nPropertyKindChanged, IResultCell cell)
380
        IProxyDiagram pProxyDiagram, int nPropertyKindChanged, IResultCell cell)
360
    {}
381
    {}
Lines 376-381 Link Here
376
        IProxyDiagram pParentDiagram, IResultCell cell)
397
        IProxyDiagram pParentDiagram, IResultCell cell)
377
    {}
398
    {}
378
399
400
    @Override
379
    public void onDrawingAreaPostPropertyChange(
401
    public void onDrawingAreaPostPropertyChange(
380
        IProxyDiagram pProxyDiagram, int nPropertyKindChanged, IResultCell cell)
402
        IProxyDiagram pProxyDiagram, int nPropertyKindChanged, IResultCell cell)
381
    {}
403
    {}
Lines 386-391 Link Here
386
//        IResultCell cell)
408
//        IResultCell cell)
387
//    {}
409
//    {}
388
//
410
//
411
    @Override
389
    public void onDrawingAreaPostCreated(DataObject obj, IResultCell cell)
412
    public void onDrawingAreaPostCreated(DataObject obj, IResultCell cell)
390
    {}
413
    {}
391
414
Lines 403-408 Link Here
403
426
404
    
427
    
405
    // cvc - CR 6302705
428
    // cvc - CR 6302705
429
    @Override
406
    public void onDrawingAreaFileRemoved(String sFilename, IResultCell cell)
430
    public void onDrawingAreaFileRemoved(String sFilename, IResultCell cell)
407
    {
431
    {
408
        Enumeration<ITreeItem> nodeKids = getNodeChildren();
432
        Enumeration<ITreeItem> nodeKids = getNodeChildren();
Lines 430-435 Link Here
430
    {}
454
    {}
431
    
455
    
432
    
456
    
457
    @Override
433
    public PasteType getDropType(Transferable t, int action, int index)
458
    public PasteType getDropType(Transferable t, int action, int index)
434
    {
459
    {
435
        return null;
460
        return null;
(-)uml.project/src/org/netbeans/modules/uml/project/ui/nodes/UMLModelElementNode.java (+1 lines)
Lines 78-83 Link Here
78
import org.netbeans.modules.uml.ui.support.projecttreesupport.ITreeItem;
78
import org.netbeans.modules.uml.ui.support.projecttreesupport.ITreeItem;
79
import org.openide.DialogDisplayer;
79
import org.openide.DialogDisplayer;
80
import org.openide.NotifyDescriptor;
80
import org.openide.NotifyDescriptor;
81
import org.openide.nodes.ChildFactory;
81
import org.openide.util.NbBundle;
82
import org.openide.util.NbBundle;
82
import org.openide.util.datatransfer.NewType;
83
import org.openide.util.datatransfer.NewType;
83
84
(-)uml.project/src/org/netbeans/modules/uml/project/ui/nodes/UMLModelRootNode.java (-22 / +22 lines)
Lines 74-80 Link Here
74
import org.netbeans.modules.uml.project.ui.nodes.actions.NewElementType;
74
import org.netbeans.modules.uml.project.ui.nodes.actions.NewElementType;
75
import org.netbeans.modules.uml.project.UMLProjectModule;
75
import org.netbeans.modules.uml.project.UMLProjectModule;
76
import org.netbeans.modules.uml.ui.controls.projecttree.IProjectTreeControl;
76
import org.netbeans.modules.uml.ui.controls.projecttree.IProjectTreeControl;
77
import org.netbeans.modules.uml.ui.support.projecttreesupport.ProjectTreeComparable;
78
import org.netbeans.modules.uml.core.metamodel.core.foundation.IElement;
77
import org.netbeans.modules.uml.core.metamodel.core.foundation.IElement;
79
import org.netbeans.modules.uml.core.metamodel.core.foundation.INamespace;
78
import org.netbeans.modules.uml.core.metamodel.core.foundation.INamespace;
80
import org.netbeans.modules.uml.core.support.umlsupport.IResultCell;
79
import org.netbeans.modules.uml.core.support.umlsupport.IResultCell;
Lines 85-90 Link Here
85
import org.netbeans.modules.uml.project.ui.nodes.actions.FilterAction;
84
import org.netbeans.modules.uml.project.ui.nodes.actions.FilterAction;
86
import javax.swing.tree.DefaultTreeModel;
85
import javax.swing.tree.DefaultTreeModel;
87
import org.netbeans.modules.uml.resources.images.ImageUtil;
86
import org.netbeans.modules.uml.resources.images.ImageUtil;
87
import org.netbeans.modules.uml.ui.products.ad.projecttreedefaultengine.ADProjectTreeEngine;
88
import org.openide.actions.PropertiesAction;
88
import org.openide.actions.PropertiesAction;
89
import org.openide.actions.SaveAction;
89
import org.openide.actions.SaveAction;
90
import org.openide.cookies.SaveCookie;
90
import org.openide.cookies.SaveCookie;
Lines 112-139 Link Here
112
        private static ADProjectTreeEngine mEngine = new ADProjectTreeEngine();
112
        private static ADProjectTreeEngine mEngine = new ADProjectTreeEngine();
113
        private static NetBeansUMLProjectTreeModel mModel = new NetBeansUMLProjectTreeModel();
113
        private static NetBeansUMLProjectTreeModel mModel = new NetBeansUMLProjectTreeModel();
114
         */
114
         */
115
    //	private static ADProjectTreeEngine mEngine = null;
115
    	private static ADProjectTreeEngine mEngine = null;
116
    //	private static NetBeansUMLProjectTreeModel mModel = null;
116
    	private static NetBeansUMLProjectTreeModel mModel = null;
117
    //
118
    //	static
119
    //	{
120
    //		// TODO - remove HACK sleeps.
121
    //		// These were suggested by Alexi Mokeev re:
122
    //		// "Project saving and freeze issue"
123
    //		mEngine = new ADProjectTreeEngine();
124
    //		try
125
    //		{Thread.sleep(3000);}
126
    //		catch(Exception e)
127
    //		{}
128
    //		mModel = new NetBeansUMLProjectTreeModel();
129
    //		try
130
    //		{Thread.sleep(3000);}
131
    //		catch(Exception e)
132
    //		{}
133
    //
134
    //		mEngine.initialize(mModel);
135
    //	}
136
    
117
    
118
    	static
119
    	{
120
    		// TODO - remove HACK sleeps.
121
    		// These were suggested by Alexi Mokeev re:
122
    		// "Project saving and freeze issue"
123
    		mEngine = new ADProjectTreeEngine();
124
    		try
125
    		{Thread.sleep(3000);}
126
    		catch(Exception e)
127
    		{}
128
    		mModel = new NetBeansUMLProjectTreeModel();
129
    		try
130
    		{Thread.sleep(3000);}
131
    		catch(Exception e)
132
    		{}
133
    
134
    		mEngine.initialize(mModel);
135
    	}
136
    
137
    public UMLModelRootNode(UMLProject project, UMLProjectHelper helper,
137
    public UMLModelRootNode(UMLProject project, UMLProjectHelper helper,
138
            PropertyEvaluator eval)
138
            PropertyEvaluator eval)
139
    {
139
    {

Return to bug 171788