01: /*
02: * ChainBuilder ESB
03: * Visual Enterprise Integration
04: *
05: * Copyright (C) 2006 Bostech Corporation
06: *
07: * This program is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU General Public License as published by the
09: * Free Software Foundation; either version 2 of the License, or (at your option)
10: * any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15: * for more details.
16: *
17: * You should have received a copy of the GNU General Public License along with
18: * this program; if not, write to the Free Software Foundation, Inc.,
19: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: *
21: *
22: * $Id$
23: */
24: package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.providers;
25:
26: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.part.ComponentFlowEditorVisualIDRegistry;
27:
28: import org.eclipse.emf.common.notify.AdapterFactory;
29:
30: import org.eclipse.emf.ecore.EObject;
31:
32: import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
33:
34: import org.eclipse.gef.EditPart;
35:
36: import org.eclipse.gmf.runtime.notation.Edge;
37: import org.eclipse.gmf.runtime.notation.View;
38:
39: import org.eclipse.ui.views.properties.IPropertySource;
40: import org.eclipse.ui.views.properties.IPropertySourceProvider;
41:
42: /**
43: * @generated
44: */
45: public class ComponentFlowEditorPropertyProvider implements
46: IPropertySourceProvider {
47: /**
48: * @generated
49: */
50: private AdapterFactoryContentProvider adapterFactoryContentProvider;
51:
52: public ComponentFlowEditorPropertyProvider(
53: AdapterFactory domainAdapterFactory) {
54: adapterFactoryContentProvider = new ComponentFlowEditorAdapterFactoryContentProvider(
55: domainAdapterFactory);
56: }
57:
58: /**
59: * @generated
60: */
61: public IPropertySource getPropertySource(Object object) {
62: if (object instanceof IPropertySource) {
63: return (IPropertySource) object;
64: }
65: View view = getNotationElement(object);
66: if (view == null) {
67: return adapterFactoryContentProvider
68: .getPropertySource(object);
69: }
70: //XXX: compose with view properties
71: EObject domainElement = view.getElement();
72: return adapterFactoryContentProvider
73: .getPropertySource(domainElement);
74: }
75:
76: /**
77: * @generated
78: */
79: protected View getNotationElement(Object object) {
80: View view = null;
81: if (object instanceof View) {
82: view = (View) object;
83: } else if (object instanceof EditPart) {
84: EditPart editPart = (EditPart) object;
85: if (editPart.getModel() instanceof View) {
86: view = (View) editPart.getModel();
87: }
88: }
89: if (view != null
90: && "ComponentFlowEditor"
91: .equals(ComponentFlowEditorVisualIDRegistry
92: .getModelID(view))) {
93: return view;
94: }
95: return null;
96: }
97: }
|