Source Code Cross Referenced for MapItemProvider.java in  » GIS » udig-1.1 » net » refractions » udig » project » internal » provider » 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 » GIS » udig 1.1 » net.refractions.udig.project.internal.provider 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * <copyright>
003:         * </copyright>
004:         *
005:         * $Id: MapItemProvider.java 24145 2007-02-01 18:03:34Z jeichar $
006:         */package net.refractions.udig.project.internal.provider;
007:
008:        import java.io.File;
009:        import java.util.Collection;
010:        import java.util.Iterator;
011:        import java.util.List;
012:
013:        import net.refractions.udig.project.edit.internal.Messages;
014:        import net.refractions.udig.project.internal.Layer;
015:        import net.refractions.udig.project.internal.LayerDecorator;
016:        import net.refractions.udig.project.internal.Map;
017:        import net.refractions.udig.project.internal.ProjectFactory;
018:        import net.refractions.udig.project.internal.ProjectPackage;
019:        import net.refractions.udig.project.internal.impl.SynchronizedEList;
020:        import net.refractions.udig.project.internal.render.ViewportModel;
021:        import net.refractions.udig.project.internal.render.provider.ViewportModelItemProvider;
022:
023:        import org.eclipse.core.runtime.FileLocator;
024:        import org.eclipse.core.runtime.IPath;
025:        import org.eclipse.core.runtime.IProgressMonitor;
026:        import org.eclipse.core.runtime.IStatus;
027:        import org.eclipse.core.runtime.Path;
028:        import org.eclipse.emf.common.notify.Adapter;
029:        import org.eclipse.emf.common.notify.AdapterFactory;
030:        import org.eclipse.emf.common.notify.Notification;
031:        import org.eclipse.emf.common.util.ResourceLocator;
032:        import org.eclipse.emf.ecore.EStructuralFeature;
033:        import org.eclipse.emf.ecore.InternalEObject;
034:        import org.eclipse.emf.ecore.impl.ENotificationImpl;
035:        import org.eclipse.emf.ecore.resource.Resource;
036:        import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
037:        import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
038:        import org.eclipse.emf.edit.provider.IItemLabelProvider;
039:        import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
040:        import org.eclipse.emf.edit.provider.IItemPropertySource;
041:        import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
042:        import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
043:        import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
044:        import org.eclipse.emf.edit.provider.ViewerNotification;
045:        import org.eclipse.jface.resource.ImageDescriptor;
046:        import org.eclipse.swt.graphics.Image;
047:        import org.osgi.framework.Bundle;
048:
049:        /**
050:         * This is the item provider adapter for a {@link net.refractions.udig.project.internal.Map} object.
051:         * <!-- begin-user-doc --> <!-- end-user-doc -->
052:         * 
053:         * @generated NOT
054:         */
055:        public class MapItemProvider extends AbstractLazyLoadingItemProvider
056:                implements  IEditingDomainItemProvider,
057:                IStructuredItemContentProvider, ITreeItemContentProvider,
058:                IItemLabelProvider, IItemPropertySource {
059:
060:            /**
061:             * Placeholder that will be placed in viewers while layers are being loaded.
062:             * 
063:             * @author Jesse
064:             * @since 1.1.0
065:             */
066:            public static class LayerLoadingPlaceHolder extends LayerDecorator
067:                    implements  LoadingPlaceHolder {
068:
069:                public LayerLoadingPlaceHolder(Layer layer) {
070:                    super (layer);
071:                }
072:
073:                public Image getImage() {
074:                    return getGlyph().createImage();
075:                }
076:
077:                public String getText() {
078:                    return getName();
079:                }
080:
081:                public int getZorder() {
082:                    return Integer.MAX_VALUE;
083:                }
084:            }
085:
086:            /**
087:             * Allows the property descriptor of the viewport model to appear as part of the map (User does
088:             * not need to know that there is a viewport model)
089:             * 
090:             * @author jones
091:             * @since 0.6.0
092:             */
093:            private static class ViewportModelDescriptor implements 
094:                    IItemPropertyDescriptor {
095:
096:                private ItemPropertyDescriptor element;
097:
098:                /**
099:                 * Construct <code>ViewportModelDescriptor</code>.
100:                 * 
101:                 * @param element
102:                 */
103:                public ViewportModelDescriptor(ItemPropertyDescriptor element) {
104:                    this .element = element;
105:                }
106:
107:                ViewportModel getModel(Object obj) {
108:                    return ((Map) obj).getViewportModelInternal();
109:                }
110:
111:                /**
112:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#getPropertyValue(java.lang.Object)
113:                 */
114:                public Object getPropertyValue(Object object) {
115:                    return element.getPropertyValue(getModel(object));
116:                }
117:
118:                /**
119:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#isPropertySet(java.lang.Object)
120:                 */
121:                public boolean isPropertySet(Object object) {
122:                    return element.isPropertySet(getModel(object));
123:                }
124:
125:                /**
126:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#canSetProperty(java.lang.Object)
127:                 */
128:                public boolean canSetProperty(Object object) {
129:                    return element.canSetProperty(getModel(object));
130:                }
131:
132:                /**
133:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#resetPropertyValue(java.lang.Object)
134:                 */
135:                public void resetPropertyValue(Object object) {
136:                    element.resetPropertyValue(getModel(object));
137:                }
138:
139:                /**
140:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#setPropertyValue(java.lang.Object,
141:                 *      java.lang.Object)
142:                 */
143:                public void setPropertyValue(Object object, Object value) {
144:                    element.setPropertyValue(getModel(object), value);
145:                }
146:
147:                /**
148:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#getCategory(java.lang.Object)
149:                 */
150:                public String getCategory(Object object) {
151:                    return element.getCategory(getModel(object));
152:                }
153:
154:                /**
155:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#getDescription(java.lang.Object)
156:                 */
157:                public String getDescription(Object object) {
158:                    return element.getDescription(getModel(object));
159:                }
160:
161:                /**
162:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#getDisplayName(java.lang.Object)
163:                 */
164:                public String getDisplayName(Object object) {
165:                    return element.getDisplayName(getModel(object));
166:                }
167:
168:                /**
169:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#getFilterFlags(java.lang.Object)
170:                 */
171:                public String[] getFilterFlags(Object object) {
172:                    return element.getFilterFlags(getModel(object));
173:                }
174:
175:                /**
176:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#getHelpContextIds(java.lang.Object)
177:                 */
178:                public Object getHelpContextIds(Object object) {
179:                    return element.getHelpContextIds(getModel(object));
180:                }
181:
182:                /**
183:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#getId(java.lang.Object)
184:                 */
185:                public String getId(Object object) {
186:                    return element.getId(getModel(object));
187:                }
188:
189:                /**
190:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#getLabelProvider(java.lang.Object)
191:                 */
192:                public IItemLabelProvider getLabelProvider(Object object) {
193:                    return element.getLabelProvider(getModel(object));
194:                }
195:
196:                /**
197:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#isCompatibleWith(java.lang.Object,
198:                 *      java.lang.Object, org.eclipse.emf.edit.provider.IItemPropertyDescriptor)
199:                 */
200:                public boolean isCompatibleWith(Object object,
201:                        Object anotherObject,
202:                        IItemPropertyDescriptor anotherPropertyDescriptor) {
203:                    return element.isCompatibleWith(getModel(object),
204:                            anotherObject, anotherPropertyDescriptor);
205:                }
206:
207:                /**
208:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#getFeature(java.lang.Object)
209:                 */
210:                public Object getFeature(Object object) {
211:                    return element.getFeature(getModel(object));
212:                }
213:
214:                /**
215:                 * @see org.eclipse.emf.edit.provider.IItemPropertyDescriptor#getChoiceOfValues(java.lang.Object)
216:                 */
217:                public Collection getChoiceOfValues(Object object) {
218:                    return element.getChoiceOfValues(getModel(object));
219:                }
220:
221:                public boolean isMany(Object arg0) {
222:                    return element.isMany(arg0);
223:                }
224:
225:                public boolean isMultiLine(Object arg0) {
226:                    return element.isMultiLine(arg0);
227:                }
228:
229:                public boolean isSortChoices(Object arg0) {
230:                    return element.isSortChoices(arg0);
231:                }
232:            }
233:
234:            /**
235:             * <!-- begin-user-doc --> <!-- end-user-doc -->
236:             * 
237:             * @generated
238:             */
239:            public static final String copyright = "uDig - User Friendly Desktop Internet GIS client http://udig.refractions.net (C) 2004, Refractions Research Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; version 2.1 of the License. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details."; //$NON-NLS-1$
240:            ViewportModelItemProvider modelProvider;
241:
242:            /**
243:             * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!--
244:             * end-user-doc -->
245:             * 
246:             * @generated NOT
247:             */
248:            public MapItemProvider(AdapterFactory adapterFactory) {
249:                super (adapterFactory);
250:                modelProvider = new ViewportModelItemProvider(adapterFactory);
251:            }
252:
253:            /**
254:             * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!--
255:             * end-user-doc -->
256:             * 
257:             * @generated NOT
258:             */
259:            public List getPropertyDescriptors(Object object) {
260:                if (itemPropertyDescriptors == null) {
261:                    super .getPropertyDescriptors(object);
262:                    addAbstractPropertyDescriptor(object);
263:                    addNamePropertyDescriptor(object);
264:                    addViewportModelDescriptors((Map) object);
265:                }
266:                return itemPropertyDescriptors;
267:            }
268:
269:            @SuppressWarnings("unchecked")
270:            private void addViewportModelDescriptors(Map map) {
271:                for (Iterator iter = modelProvider.getPropertyDescriptors(
272:                        map.getViewportModel()).iterator(); iter.hasNext();) {
273:                    ItemPropertyDescriptor element = (ItemPropertyDescriptor) iter
274:                            .next();
275:                    itemPropertyDescriptors.add(new ViewportModelDescriptor(
276:                            element));
277:                }
278:            }
279:
280:            /**
281:             * This adds a property descriptor for the Abstract feature. <!-- begin-user-doc --> <!--
282:             * end-user-doc -->
283:             * 
284:             * @generated
285:             */
286:            @SuppressWarnings("unchecked")
287:            protected void addAbstractPropertyDescriptor(Object object) {
288:                itemPropertyDescriptors
289:                        .add(createItemPropertyDescriptor(
290:                                ((ComposeableAdapterFactory) adapterFactory)
291:                                        .getRootAdapterFactory(),
292:                                getResourceLocator(),
293:                                getString("_UI_Map_abstract_feature"), //$NON-NLS-1$
294:                                getString(
295:                                        "_UI_PropertyDescriptor_description", "_UI_Map_abstract_feature", "_UI_Map_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
296:                                ProjectPackage.eINSTANCE.getMap_Abstract(),
297:                                true,
298:                                ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
299:                                null, null));
300:            }
301:
302:            /**
303:             * This adds a property descriptor for the Name feature. <!-- begin-user-doc --> <!--
304:             * end-user-doc -->
305:             * 
306:             * @generated
307:             */
308:            @SuppressWarnings("unchecked")
309:            protected void addNamePropertyDescriptor(Object object) {
310:                itemPropertyDescriptors
311:                        .add(createItemPropertyDescriptor(
312:                                ((ComposeableAdapterFactory) adapterFactory)
313:                                        .getRootAdapterFactory(),
314:                                getResourceLocator(),
315:                                getString("_UI_ProjectElement_name_feature"), //$NON-NLS-1$
316:                                getString(
317:                                        "_UI_PropertyDescriptor_description", "_UI_ProjectElement_name_feature", "_UI_ProjectElement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
318:                                ProjectPackage.eINSTANCE
319:                                        .getProjectElement_Name(), true,
320:                                ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
321:                                null, null));
322:            }
323:
324:            /**
325:             * This adds a property descriptor for the Nav Command Stack feature. <!-- begin-user-doc -->
326:             * <!-- end-user-doc -->
327:             * 
328:             * @generated
329:             */
330:            @SuppressWarnings("unchecked")
331:            protected void addNavCommandStackPropertyDescriptor(Object object) {
332:                itemPropertyDescriptors
333:                        .add(createItemPropertyDescriptor(
334:                                ((ComposeableAdapterFactory) adapterFactory)
335:                                        .getRootAdapterFactory(),
336:                                getResourceLocator(),
337:                                getString("_UI_Map_navCommandStack_feature"), //$NON-NLS-1$
338:                                getString(
339:                                        "_UI_PropertyDescriptor_description", "_UI_Map_navCommandStack_feature", "_UI_Map_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
340:                                ProjectPackage.eINSTANCE
341:                                        .getMap_NavCommandStack(), false,
342:                                ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
343:                                null, null));
344:            }
345:
346:            /**
347:             * This adds a property descriptor for the Command Stack feature. <!-- begin-user-doc --> <!--
348:             * end-user-doc -->
349:             * 
350:             * @generated
351:             */
352:            @SuppressWarnings("unchecked")
353:            protected void addCommandStackPropertyDescriptor(Object object) {
354:                itemPropertyDescriptors
355:                        .add(createItemPropertyDescriptor(
356:                                ((ComposeableAdapterFactory) adapterFactory)
357:                                        .getRootAdapterFactory(),
358:                                getResourceLocator(),
359:                                getString("_UI_Map_commandStack_feature"), //$NON-NLS-1$
360:                                getString(
361:                                        "_UI_PropertyDescriptor_description", "_UI_Map_commandStack_feature", "_UI_Map_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
362:                                ProjectPackage.eINSTANCE.getMap_CommandStack(),
363:                                false,
364:                                ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
365:                                null, null));
366:            }
367:
368:            /**
369:             * This adds a property descriptor for the Color Palette feature. <!-- begin-user-doc --> <!--
370:             * end-user-doc -->
371:             * 
372:             * @generated
373:             */
374:            @SuppressWarnings("unchecked")
375:            protected void addColorPalettePropertyDescriptor(Object object) {
376:                itemPropertyDescriptors
377:                        .add(createItemPropertyDescriptor(
378:                                ((ComposeableAdapterFactory) adapterFactory)
379:                                        .getRootAdapterFactory(),
380:                                getResourceLocator(),
381:                                getString("_UI_Map_colorPalette_feature"), //$NON-NLS-1$
382:                                getString(
383:                                        "_UI_PropertyDescriptor_description", "_UI_Map_colorPalette_feature", "_UI_Map_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
384:                                ProjectPackage.eINSTANCE.getMap_ColorPalette(),
385:                                true,
386:                                ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
387:                                null, null));
388:            }
389:
390:            /**
391:             * This adds a property descriptor for the Render Manager Internal feature. <!-- begin-user-doc
392:             * --> <!-- end-user-doc -->
393:             * 
394:             * @generated
395:             */
396:            protected void addRenderManagerInternalPropertyDescriptor(
397:                    Object object) {
398:                itemPropertyDescriptors
399:                        .add(createItemPropertyDescriptor(
400:                                ((ComposeableAdapterFactory) adapterFactory)
401:                                        .getRootAdapterFactory(),
402:                                getResourceLocator(),
403:                                getString("_UI_Map_renderManagerInternal_feature"), //$NON-NLS-1$
404:                                getString(
405:                                        "_UI_PropertyDescriptor_description", "_UI_Map_renderManagerInternal_feature", "_UI_Map_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
406:                                ProjectPackage.eINSTANCE
407:                                        .getMap_RenderManagerInternal(), true,
408:                                null, null, null));
409:            }
410:
411:            /**
412:             * This adds a property descriptor for the Colour Scheme feature. <!-- begin-user-doc --> <!--
413:             * end-user-doc -->
414:             * 
415:             * @generated
416:             */
417:            protected void addColourSchemePropertyDescriptor(Object object) {
418:                itemPropertyDescriptors
419:                        .add(createItemPropertyDescriptor(
420:                                ((ComposeableAdapterFactory) adapterFactory)
421:                                        .getRootAdapterFactory(),
422:                                getResourceLocator(),
423:                                getString("_UI_Map_colourScheme_feature"), //$NON-NLS-1$
424:                                getString(
425:                                        "_UI_PropertyDescriptor_description", "_UI_Map_colourScheme_feature", "_UI_Map_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
426:                                ProjectPackage.eINSTANCE.getMap_ColourScheme(),
427:                                true,
428:                                ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
429:                                null, null));
430:            }
431:
432:            /**
433:             * This adds a property descriptor for the Black Board Internal feature. <!-- begin-user-doc -->
434:             * <!-- end-user-doc -->
435:             * 
436:             * @generated NOT
437:             */
438:            protected void addBlackBoardInternalPropertyDescriptor(Object object) {
439:                itemPropertyDescriptors.add(createItemPropertyDescriptor(
440:                        ((ComposeableAdapterFactory) adapterFactory)
441:                                .getRootAdapterFactory(), getResourceLocator(),
442:                        "blackboard", "blackboard ", ProjectPackage.eINSTANCE
443:                                .getMap_BlackBoardInternal(), true, null, null,
444:                        null));
445:            }
446:
447:            /**
448:             * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate
449:             * feature for an {@link org.eclipse.emf.edit.command.AddCommand},
450:             * {@link org.eclipse.emf.edit.command.RemoveCommand} or
451:             * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. <!--
452:             * begin-user-doc --> Changed so only layers and viewport model appears. <!-- end-user-doc -->
453:             * 
454:             * @generated NOT
455:             */
456:            public Collection getChildrenFeatures(Object object) {
457:                if (childrenFeatures == null) {
458:                    super .getChildrenFeatures(object);
459:                    childrenFeatures.add(ProjectPackage.eINSTANCE
460:                            .getMap_ContextModel());
461:                }
462:                return childrenFeatures;
463:            }
464:
465:            /**
466:             * <!-- begin-user-doc --> <!-- end-user-doc -->
467:             * 
468:             * @generated
469:             */
470:            protected EStructuralFeature getChildFeature(Object object,
471:                    Object child) {
472:                // Check the type of the specified child object and return the proper feature to use for
473:                // adding (see {@link AddCommand}) it as a child.
474:
475:                return super .getChildFeature(object, child);
476:            }
477:
478:            /**
479:             * This returns Map.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
480:             * 
481:             * @generated
482:             */
483:            public Object getImage(Object object) {
484:                return getResourceLocator().getImage("full/obj16/Map"); //$NON-NLS-1$
485:            }
486:
487:            public static final LayerLoadingPlaceHolder LOADING_LAYER;
488:            static {
489:                LOADING_LAYER = new LayerLoadingPlaceHolder(
490:                        ProjectFactory.eINSTANCE.createLayer());
491:                LOADING_LAYER.setName(Messages.ProjectItemProvider_loading);
492:                Bundle bundle = ProjectEditPlugin.getPlugin().getBundle();
493:
494:                IPath path = new Path("icons/full/obj16/Layer.gif"); //$NON-NLS-1$
495:                ImageDescriptor image = ImageDescriptor
496:                        .createFromURL(FileLocator.find(bundle, path, null));
497:                LOADING_LAYER.setGlyph(image);
498:                LOADING_LAYER.setVisible(true);
499:            }
500:
501:            @SuppressWarnings("unchecked")
502:            protected net.refractions.udig.project.internal.provider.LoadingPlaceHolder getLoadingItem() {
503:                return LOADING_LAYER;
504:            };
505:
506:            protected ChildFetcher createChildFetcher() {
507:                return new ChildFetcher(this ) {
508:                    protected void notifyChanged() {
509:                        MapItemProvider.this 
510:                                .notifyChanged(new ENotificationImpl(
511:                                        (InternalEObject) parent,
512:                                        Notification.SET,
513:                                        ProjectPackage.MAP__CONTEXT_MODEL,
514:                                        LOADING_LAYER, null));
515:                    }
516:
517:                    @SuppressWarnings("unchecked")
518:                    @Override
519:                    protected IStatus run(IProgressMonitor monitor) {
520:                        if (parent instanceof  Map) {
521:                            Map map = (Map) parent;
522:                            boolean found = false;
523:                            SynchronizedEList adapters = (SynchronizedEList) map
524:                                    .getContextModel().eAdapters();
525:                            adapters.lock();
526:                            try {
527:                                for (Iterator<Adapter> iter = adapters
528:                                        .iterator(); iter.hasNext();) {
529:                                    Adapter next = iter.next();
530:                                    if (next instanceof  ContextModelItemProvider
531:                                            && ((ContextModelItemProvider) next)
532:                                                    .getAdapterFactory() == getAdapterFactory())
533:                                        found = true;
534:                                }
535:                            } finally {
536:                                adapters.unlock();
537:                            }
538:                            if (!found) {
539:                                ContextModelItemProvider provider = new ContextModelItemProvider(
540:                                        getAdapterFactory());
541:                                adapters.add(provider);
542:                            }
543:                        }
544:
545:                        IStatus result = super .run(monitor);
546:                        return result;
547:                    }
548:                };
549:            }
550:
551:            @Override
552:            protected Collection<? extends Object> getConcreteChildren(
553:                    Object object) {
554:                if (object instanceof  Map)
555:                    return ((Map) object).getMapLayers();
556:                throw new IllegalArgumentException(
557:                        "Object must be a Map.  Was: " + object); //$NON-NLS-1$
558:            }
559:
560:            @Override
561:            public Object getChild(Object object, int childIndex) {
562:                Map map = (Map) object;
563:                if (childIndex >= map.getMapLayers().size())
564:                    return null;
565:                return map.getMapLayers().get(childIndex);
566:            }
567:
568:            @Override
569:            public boolean hasChildren(Object object) {
570:                return true;
571:            }
572:
573:            /**
574:             * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc
575:             * -->
576:             * 
577:             * @generated NOT
578:             */
579:            public String getText(Object object) {
580:                Map map = ((Map) object);
581:                String label = map.getName();
582:                if (label == null) {
583:                    Resource resource = map.eResource();
584:                    if (resource != null) {
585:                        String toString = resource.toString();
586:                        int lastSlash = toString
587:                                .lastIndexOf(File.pathSeparator);
588:                        if (lastSlash == -1)
589:                            lastSlash = 0;
590:                        label = toString.substring(lastSlash);
591:                    }
592:                }
593:                return label == null || label.length() == 0 ? "Unable to load map"
594:                        : label;
595:            }
596:
597:            /**
598:             * This handles model notifications by calling {@link #updateChildren} to update any cached
599:             * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
600:             * <!-- begin-user-doc --> <!-- end-user-doc -->
601:             * 
602:             * @generated NOT
603:             */
604:            public void notifyChanged(Notification notification) {
605:                if (notification.getNewValue() == notification.getOldValue()
606:                        || (notification.getNewValue() != null && notification
607:                                .getNewValue().equals(
608:                                        notification.getOldValue()))
609:                        || (notification.getOldValue() != null && notification
610:                                .getOldValue().equals(
611:                                        notification.getNewValue())))
612:                    return;
613:
614:                super .notifyChanged(notification);
615:
616:                switch (notification.getFeatureID(Map.class)) {
617:                case ProjectPackage.MAP__NAME:
618:                case ProjectPackage.MAP__ABSTRACT:
619:                    //        case ProjectPackage.MAP__NAV_COMMAND_STACK:
620:                    //        case ProjectPackage.MAP__COMMAND_STACK:
621:                case ProjectPackage.MAP__COLOR_PALETTE:
622:                case ProjectPackage.MAP__COLOUR_SCHEME:
623:                    fireNotifyChanged(new ViewerNotification(notification,
624:                            notification.getNotifier(), false, true));
625:                    return;
626:                case ProjectPackage.MAP__CONTEXT_MODEL:
627:                case ProjectPackage.MAP__LAYER_FACTORY:
628:                case ProjectPackage.MAP__VIEWPORT_MODEL_INTERNAL:
629:                case ProjectPackage.MAP__EDIT_MANAGER_INTERNAL:
630:                    fireNotifyChanged(new ViewerNotification(notification,
631:                            notification.getNotifier(), true, false));
632:                    return;
633:                }
634:                super .notifyChanged(notification);
635:            }
636:
637:            /**
638:             * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
639:             * end-user-doc -->
640:             * 
641:             * @generated
642:             */
643:            public ResourceLocator getResourceLocator() {
644:                return ProjectEditPlugin.INSTANCE;
645:            }
646:
647:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.