001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id$
023: */
024: package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.providers;
025:
026: import java.util.ArrayList;
027: import java.util.List;
028:
029: import org.eclipse.core.runtime.Assert;
030: import org.eclipse.emf.common.notify.AdapterFactory;
031: import org.eclipse.emf.edit.provider.IItemPropertySource;
032: import org.eclipse.ui.views.properties.PropertyDescriptor;
033:
034: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.ConsumerCCSL;
035: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Upoc;
036:
037: public class ConsumerCCSLCompoundPropertySource extends
038: ComponentFlowEditorBasicCompoundPropertySource {
039: //Category unique keys
040: public static final String C_WSDL_DOCUMENT_CONSUMER_CCSL_UPOC = "c.ccsl.consumer.upoc";
041:
042: //Category display keys
043: public static final String C_DISPLAY_WSDL_DOCUMENT_CONSUMER_CCSL_UPOC = "Upoc";
044:
045: Upoc upoc;
046: IItemPropertySource UpocItemProvider;
047:
048: /**
049: * @param object
050: * @param itemPropertySource
051: */
052: public ConsumerCCSLCompoundPropertySource(Object object,
053: AdapterFactory adapterFactory) {
054: super (object, adapterFactory);
055: //Assert.isTrue(object instanceof CCSL);
056: this .upoc = ((ConsumerCCSL) object).getUpoc();
057: this .UpocItemProvider = getIItemPropertySourceAdapter(upoc);
058: //add them and children
059: add(getIItemPropertySourceAdapter(object), object);
060: }
061:
062: protected List getSubLevelPropertyDescriptorList() {
063: List result = new ArrayList();
064: updateSubSourcesMap();
065: result.add(new PropertyDescriptor(
066: C_WSDL_DOCUMENT_CONSUMER_CCSL_UPOC,
067: C_DISPLAY_WSDL_DOCUMENT_CONSUMER_CCSL_UPOC));
068: return result;
069: }
070:
071: protected void updateSubSourcesMap() {
072: //subSourcesMap.put(C_WSDL_DOCUMENT_CONSUMER_CCSL_UPOC, new ComponentFlowEditorBasicPropertySource(upoc, UpocItemProvider));
073: subSourcesMap
074: .put(C_WSDL_DOCUMENT_CONSUMER_CCSL_UPOC,
075: new UpocConsumerUsePropertySource(upoc,
076: adapterFactory));
077:
078: }
079:
080: /* (non-Javadoc)
081: * @see com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.providers.ComponentFlowEditorBasicCompoundPropertySource#getPropertyValue(java.lang.Object)
082: */
083: public Object getPropertyValue(Object id) {
084: if (id.equals(C_WSDL_DOCUMENT_CONSUMER_CCSL_UPOC)) {
085: Object obj = subSourcesMap
086: .get(C_WSDL_DOCUMENT_CONSUMER_CCSL_UPOC);
087: Assert.isTrue(obj instanceof UpocConsumerUsePropertySource);
088: return obj;
089: }
090:
091: return super .getPropertyValue(id);
092: }
093:
094: /* (non-Javadoc)
095: * @see com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.providers.ComponentFlowEditorBasicCompoundPropertySource#isPropertySet(java.lang.Object)
096: */
097: public boolean isPropertySet(Object id) {
098: if (id.equals(C_WSDL_DOCUMENT_CONSUMER_CCSL_UPOC))
099: return true;
100:
101: return super .isPropertySet(id);
102: }
103:
104: /* (non-Javadoc)
105: * @see java.lang.Object#toString()
106: */
107: public String toString() {
108: return "";
109: }
110:
111: }
|