001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id$
006: */package net.refractions.udig.printing.model.impl;
007:
008: import java.awt.Graphics2D;
009:
010: import net.refractions.udig.printing.model.Box;
011: import net.refractions.udig.printing.model.BoxPrinter;
012: import net.refractions.udig.printing.model.Connection;
013: import net.refractions.udig.printing.model.DecoratorBox;
014: import net.refractions.udig.printing.model.Element;
015: import net.refractions.udig.printing.model.ModelFactory;
016: import net.refractions.udig.printing.model.ModelPackage;
017: import net.refractions.udig.printing.model.Page;
018: import net.refractions.udig.project.internal.ProjectPackage;
019: import net.refractions.udig.project.internal.impl.ProjectPackageImpl;
020: import net.refractions.udig.project.internal.render.impl.RenderPackageImpl;
021:
022: import org.eclipse.core.runtime.IProgressMonitor;
023: import org.eclipse.draw2d.geometry.Dimension;
024: import org.eclipse.draw2d.geometry.Point;
025: import org.eclipse.emf.ecore.EAttribute;
026: import org.eclipse.emf.ecore.EClass;
027: import org.eclipse.emf.ecore.EDataType;
028: import org.eclipse.emf.ecore.EPackage;
029: import org.eclipse.emf.ecore.EReference;
030: import org.eclipse.emf.ecore.impl.EPackageImpl;
031:
032: /**
033: * <!-- begin-user-doc -->
034: * An implementation of the model <b>Package</b>.
035: * <!-- end-user-doc -->
036: * @generated
037: */
038: public class ModelPackageImpl extends EPackageImpl implements
039: ModelPackage {
040: /**
041: * <!-- begin-user-doc -->
042: * <!-- end-user-doc -->
043: * @generated
044: */
045: private EClass boxEClass = null;
046:
047: /**
048: * <!-- begin-user-doc -->
049: * <!-- end-user-doc -->
050: * @generated
051: */
052: private EClass connectionEClass = null;
053:
054: /**
055: * <!-- begin-user-doc -->
056: * <!-- end-user-doc -->
057: * @generated
058: */
059: private EClass decoratorBoxEClass = null;
060:
061: /**
062: * <!-- begin-user-doc -->
063: * <!-- end-user-doc -->
064: * @generated
065: */
066: private EClass elementEClass = null;
067:
068: /**
069: * <!-- begin-user-doc -->
070: * <!-- end-user-doc -->
071: * @generated
072: */
073: private EClass pageEClass = null;
074:
075: /**
076: * <!-- begin-user-doc -->
077: * <!-- end-user-doc -->
078: * @generated
079: */
080: private EDataType graphics2DEDataType = null;
081:
082: /**
083: * <!-- begin-user-doc -->
084: * <!-- end-user-doc -->
085: * @generated
086: */
087: private EDataType dimensionEDataType = null;
088:
089: /**
090: * <!-- begin-user-doc -->
091: * <!-- end-user-doc -->
092: * @generated
093: */
094: private EDataType pointEDataType = null;
095:
096: /**
097: * <!-- begin-user-doc -->
098: * <!-- end-user-doc -->
099: * @generated
100: */
101: private EDataType iProgressMonitorEDataType = null;
102:
103: /**
104: * <!-- begin-user-doc -->
105: * <!-- end-user-doc -->
106: * @generated
107: */
108: private EDataType boxPrinterEDataType = null;
109:
110: /**
111: * Creates an instance of the model <b>Package</b>, registered with
112: * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
113: * package URI value.
114: * <p>Note: the correct way to create the package is via the static
115: * factory method {@link #init init()}, which also performs
116: * initialization of the package, or returns the registered package,
117: * if one already exists.
118: * <!-- begin-user-doc -->
119: * <!-- end-user-doc -->
120: * @see org.eclipse.emf.ecore.EPackage.Registry
121: * @see net.refractions.udig.printing.model.ModelPackage#eNS_URI
122: * @see #init()
123: * @generated
124: */
125: private ModelPackageImpl() {
126: super (eNS_URI, ModelFactory.eINSTANCE);
127: }
128:
129: /**
130: * <!-- begin-user-doc -->
131: * <!-- end-user-doc -->
132: * @generated
133: */
134: private static boolean isInited = false;
135:
136: /**
137: * Creates, registers, and initializes the <b>Package</b> for this
138: * model, and for any others upon which it depends. Simple
139: * dependencies are satisfied by calling this method on all
140: * dependent packages before doing anything else. This method drives
141: * initialization for interdependent packages directly, in parallel
142: * with this package, itself.
143: * <p>Of this package and its interdependencies, all packages which
144: * have not yet been registered by their URI values are first created
145: * and registered. The packages are then initialized in two steps:
146: * meta-model objects for all of the packages are created before any
147: * are initialized, since one package's meta-model objects may refer to
148: * those of another.
149: * <p>Invocation of this method will not affect any packages that have
150: * already been initialized.
151: * <!-- begin-user-doc -->
152: * <!-- end-user-doc -->
153: * @see #eNS_URI
154: * @see #createPackageContents()
155: * @see #initializePackageContents()
156: * @generated
157: */
158: public static ModelPackage init() {
159: if (isInited)
160: return (ModelPackage) EPackage.Registry.INSTANCE
161: .getEPackage(ModelPackage.eNS_URI);
162:
163: // Obtain or create and register package
164: ModelPackageImpl theModelPackage = (ModelPackageImpl) (EPackage.Registry.INSTANCE
165: .getEPackage(eNS_URI) instanceof ModelPackageImpl ? EPackage.Registry.INSTANCE
166: .getEPackage(eNS_URI)
167: : new ModelPackageImpl());
168:
169: isInited = true;
170:
171: // Initialize simple dependencies
172: ProjectPackageImpl.init();
173: RenderPackageImpl.init();
174: ProjectPackageImpl.init();
175: RenderPackageImpl.init();
176:
177: // Create package meta-data objects
178: theModelPackage.createPackageContents();
179:
180: // Initialize created meta-data
181: theModelPackage.initializePackageContents();
182:
183: // Mark meta-data to indicate it can't be changed
184: theModelPackage.freeze();
185:
186: return theModelPackage;
187: }
188:
189: /**
190: * <!-- begin-user-doc -->
191: * <!-- end-user-doc -->
192: * @generated
193: */
194: public EClass getBox() {
195: return boxEClass;
196: }
197:
198: /**
199: * <!-- begin-user-doc -->
200: * <!-- end-user-doc -->
201: * @generated
202: */
203: public EReference getBox_SourceConnections() {
204: return (EReference) boxEClass.getEStructuralFeatures().get(0);
205: }
206:
207: /**
208: * <!-- begin-user-doc -->
209: * <!-- end-user-doc -->
210: * @generated
211: */
212: public EReference getBox_TargetConnections() {
213: return (EReference) boxEClass.getEStructuralFeatures().get(1);
214: }
215:
216: /**
217: * <!-- begin-user-doc -->
218: * <!-- end-user-doc -->
219: * @generated
220: */
221: public EAttribute getBox_BoxPrinter() {
222: return (EAttribute) boxEClass.getEStructuralFeatures().get(2);
223: }
224:
225: /**
226: * <!-- begin-user-doc -->
227: * <!-- end-user-doc -->
228: * @generated
229: */
230: public EAttribute getBox_ID() {
231: return (EAttribute) boxEClass.getEStructuralFeatures().get(3);
232: }
233:
234: /**
235: * <!-- begin-user-doc -->
236: * <!-- end-user-doc -->
237: * @generated
238: */
239: public EClass getConnection() {
240: return connectionEClass;
241: }
242:
243: /**
244: * <!-- begin-user-doc -->
245: * <!-- end-user-doc -->
246: * @generated
247: */
248: public EAttribute getConnection_Connected() {
249: return (EAttribute) connectionEClass.getEStructuralFeatures()
250: .get(0);
251: }
252:
253: /**
254: * <!-- begin-user-doc -->
255: * <!-- end-user-doc -->
256: * @generated
257: */
258: public EReference getConnection_Source() {
259: return (EReference) connectionEClass.getEStructuralFeatures()
260: .get(1);
261: }
262:
263: /**
264: * <!-- begin-user-doc -->
265: * <!-- end-user-doc -->
266: * @generated
267: */
268: public EReference getConnection_Target() {
269: return (EReference) connectionEClass.getEStructuralFeatures()
270: .get(2);
271: }
272:
273: /**
274: * <!-- begin-user-doc -->
275: * <!-- end-user-doc -->
276: * @generated
277: */
278: public EClass getDecoratorBox() {
279: return decoratorBoxEClass;
280: }
281:
282: /**
283: * <!-- begin-user-doc -->
284: * <!-- end-user-doc -->
285: * @generated
286: */
287: public EReference getDecoratorBox_Map() {
288: return (EReference) decoratorBoxEClass.getEStructuralFeatures()
289: .get(0);
290: }
291:
292: /**
293: * <!-- begin-user-doc -->
294: * <!-- end-user-doc -->
295: * @generated
296: */
297: public EReference getDecoratorBox_Layer() {
298: return (EReference) decoratorBoxEClass.getEStructuralFeatures()
299: .get(1);
300: }
301:
302: /**
303: * <!-- begin-user-doc -->
304: * <!-- end-user-doc -->
305: * @generated
306: */
307: public EClass getElement() {
308: return elementEClass;
309: }
310:
311: /**
312: * <!-- begin-user-doc -->
313: * <!-- end-user-doc -->
314: * @generated
315: */
316: public EAttribute getElement_Location() {
317: return (EAttribute) elementEClass.getEStructuralFeatures().get(
318: 0);
319: }
320:
321: /**
322: * <!-- begin-user-doc -->
323: * <!-- end-user-doc -->
324: * @generated
325: */
326: public EAttribute getElement_Size() {
327: return (EAttribute) elementEClass.getEStructuralFeatures().get(
328: 1);
329: }
330:
331: /**
332: * <!-- begin-user-doc -->
333: * <!-- end-user-doc -->
334: * @generated
335: */
336: public EClass getPage() {
337: return pageEClass;
338: }
339:
340: /**
341: * <!-- begin-user-doc -->
342: * <!-- end-user-doc -->
343: * @generated
344: */
345: public EReference getPage_Boxes() {
346: return (EReference) pageEClass.getEStructuralFeatures().get(0);
347: }
348:
349: /**
350: * <!-- begin-user-doc -->
351: * <!-- end-user-doc -->
352: * @generated
353: */
354: public EDataType getGraphics2D() {
355: return graphics2DEDataType;
356: }
357:
358: /**
359: * <!-- begin-user-doc -->
360: * <!-- end-user-doc -->
361: * @generated
362: */
363: public EDataType getDimension() {
364: return dimensionEDataType;
365: }
366:
367: /**
368: * <!-- begin-user-doc -->
369: * <!-- end-user-doc -->
370: * @generated
371: */
372: public EDataType getPoint() {
373: return pointEDataType;
374: }
375:
376: /**
377: * <!-- begin-user-doc -->
378: * <!-- end-user-doc -->
379: * @generated
380: */
381: public EDataType getIProgressMonitor() {
382: return iProgressMonitorEDataType;
383: }
384:
385: /**
386: * <!-- begin-user-doc -->
387: * <!-- end-user-doc -->
388: * @generated
389: */
390: public EDataType getBoxPrinter() {
391: return boxPrinterEDataType;
392: }
393:
394: /**
395: * <!-- begin-user-doc -->
396: * <!-- end-user-doc -->
397: * @generated
398: */
399: public ModelFactory getModelFactory() {
400: return (ModelFactory) getEFactoryInstance();
401: }
402:
403: /**
404: * <!-- begin-user-doc -->
405: * <!-- end-user-doc -->
406: * @generated
407: */
408: private boolean isCreated = false;
409:
410: /**
411: * Creates the meta-model objects for the package. This method is
412: * guarded to have no affect on any invocation but its first.
413: * <!-- begin-user-doc -->
414: * <!-- end-user-doc -->
415: * @generated
416: */
417: public void createPackageContents() {
418: if (isCreated)
419: return;
420: isCreated = true;
421:
422: // Create classes and their features
423: boxEClass = createEClass(BOX);
424: createEReference(boxEClass, BOX__SOURCE_CONNECTIONS);
425: createEReference(boxEClass, BOX__TARGET_CONNECTIONS);
426: createEAttribute(boxEClass, BOX__BOX_PRINTER);
427: createEAttribute(boxEClass, BOX__ID);
428:
429: connectionEClass = createEClass(CONNECTION);
430: createEAttribute(connectionEClass, CONNECTION__CONNECTED);
431: createEReference(connectionEClass, CONNECTION__SOURCE);
432: createEReference(connectionEClass, CONNECTION__TARGET);
433:
434: decoratorBoxEClass = createEClass(DECORATOR_BOX);
435: createEReference(decoratorBoxEClass, DECORATOR_BOX__MAP);
436: createEReference(decoratorBoxEClass, DECORATOR_BOX__LAYER);
437:
438: elementEClass = createEClass(ELEMENT);
439: createEAttribute(elementEClass, ELEMENT__LOCATION);
440: createEAttribute(elementEClass, ELEMENT__SIZE);
441:
442: pageEClass = createEClass(PAGE);
443: createEReference(pageEClass, PAGE__BOXES);
444:
445: // Create data types
446: graphics2DEDataType = createEDataType(GRAPHICS2_D);
447: dimensionEDataType = createEDataType(DIMENSION);
448: pointEDataType = createEDataType(POINT);
449: iProgressMonitorEDataType = createEDataType(IPROGRESS_MONITOR);
450: boxPrinterEDataType = createEDataType(BOX_PRINTER);
451: }
452:
453: /**
454: * <!-- begin-user-doc -->
455: * <!-- end-user-doc -->
456: * @generated
457: */
458: private boolean isInitialized = false;
459:
460: /**
461: * Complete the initialization of the package and its meta-model. This
462: * method is guarded to have no affect on any invocation but its first.
463: * <!-- begin-user-doc -->
464: * <!-- end-user-doc -->
465: * @generated
466: */
467: public void initializePackageContents() {
468: if (isInitialized)
469: return;
470: isInitialized = true;
471:
472: // Initialize package
473: setName(eNAME);
474: setNsPrefix(eNS_PREFIX);
475: setNsURI(eNS_URI);
476:
477: // Obtain other dependent packages
478: ProjectPackageImpl theProjectPackage = (ProjectPackageImpl) EPackage.Registry.INSTANCE
479: .getEPackage(ProjectPackage.eNS_URI);
480:
481: // Add supertypes to classes
482: boxEClass.getESuperTypes().add(this .getElement());
483: connectionEClass.getESuperTypes().add(this .getElement());
484: decoratorBoxEClass.getESuperTypes().add(this .getBox());
485: pageEClass.getESuperTypes().add(this .getElement());
486: pageEClass.getESuperTypes().add(
487: theProjectPackage.getProjectElement());
488:
489: // Initialize classes and features; add operations and parameters
490: initEClass(
491: boxEClass,
492: Box.class,
493: "Box", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
494: initEReference(
495: getBox_SourceConnections(),
496: this .getConnection(),
497: null,
498: "sourceConnections", null, 0, -1, Box.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
499: initEReference(
500: getBox_TargetConnections(),
501: this .getConnection(),
502: null,
503: "targetConnections", null, 0, -1, Box.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
504: initEAttribute(
505: getBox_BoxPrinter(),
506: this .getBoxPrinter(),
507: "boxPrinter", null, 0, 1, Box.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
508: initEAttribute(
509: getBox_ID(),
510: ecorePackage.getEString(),
511: "iD", null, 0, 1, Box.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
512:
513: initEClass(
514: connectionEClass,
515: Connection.class,
516: "Connection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
517: initEAttribute(
518: getConnection_Connected(),
519: ecorePackage.getEBoolean(),
520: "connected", null, 0, 1, Connection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
521: initEReference(
522: getConnection_Source(),
523: this .getBox(),
524: null,
525: "source", null, 0, 1, Connection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
526: initEReference(
527: getConnection_Target(),
528: this .getBox(),
529: null,
530: "target", null, 0, 1, Connection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
531:
532: initEClass(
533: decoratorBoxEClass,
534: DecoratorBox.class,
535: "DecoratorBox", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
536: initEReference(
537: getDecoratorBox_Map(),
538: theProjectPackage.getMap(),
539: null,
540: "map", null, 0, 1, DecoratorBox.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
541: initEReference(
542: getDecoratorBox_Layer(),
543: theProjectPackage.getLayer(),
544: null,
545: "layer", null, 0, 1, DecoratorBox.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
546:
547: initEClass(
548: elementEClass,
549: Element.class,
550: "Element", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
551: initEAttribute(
552: getElement_Location(),
553: this .getPoint(),
554: "location", null, 0, 1, Element.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
555: initEAttribute(
556: getElement_Size(),
557: this .getDimension(),
558: "size", null, 0, 1, Element.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
559:
560: initEClass(
561: pageEClass,
562: Page.class,
563: "Page", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
564: initEReference(
565: getPage_Boxes(),
566: this .getBox(),
567: null,
568: "boxes", null, 0, -1, Page.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
569:
570: // Initialize data types
571: initEDataType(
572: graphics2DEDataType,
573: Graphics2D.class,
574: "Graphics2D", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
575: initEDataType(
576: dimensionEDataType,
577: Dimension.class,
578: "Dimension", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
579: initEDataType(pointEDataType, Point.class,
580: "Point", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
581: initEDataType(
582: iProgressMonitorEDataType,
583: IProgressMonitor.class,
584: "IProgressMonitor", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
585: initEDataType(
586: boxPrinterEDataType,
587: BoxPrinter.class,
588: "BoxPrinter", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
589:
590: // Create resource
591: createResource(eNS_URI);
592: }
593:
594: } //ModelPackageImpl
|