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: FileCompoundPropertySource.java 5803 2007-03-06 01:57:10Z lzheng $
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.BindingComponent;
035: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.ConsumerCCSL;
036: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.ProviderCCSL;
037:
038: public class BCCompoundPropertySource extends
039: ComponentFlowEditorElementPropertySource {
040:
041: public static final String C_WSDL_DOCUMENT_CCSL_CONSUMER = "c.ccsl.consumer";
042: public static final String C_DISPLAY_WSDL_DOCUMENT_CCSL_CONSUMER = "CCSL.Consumer";
043: private ConsumerCCSL consumerCCSL;
044: private IItemPropertySource consumerCCSLPropertySource;
045:
046: /**
047: * @param object
048: * @param itemPropertySource
049: */
050: public BCCompoundPropertySource(Object object,
051: AdapterFactory adapterFactory) {
052: super (object, adapterFactory);
053: Assert.isTrue(object instanceof BindingComponent);
054: this .consumerCCSL = ((BindingComponent) object)
055: .getConsumerCCSL();
056: this .consumerCCSLPropertySource = getIItemPropertySourceAdapter(consumerCCSL);
057:
058: }
059:
060: protected List getSubLevelPropertyDescriptorList() {
061: List result = super .getSubLevelPropertyDescriptorList();
062: updateSubSourcesMap();
063:
064: result.add(new PropertyDescriptor(
065: C_WSDL_DOCUMENT_CCSL_CONSUMER,
066: C_DISPLAY_WSDL_DOCUMENT_CCSL_CONSUMER));
067:
068: return result;
069: }
070:
071: protected void updateSubSourcesMap() {
072: super .updateSubSourcesMap();
073:
074: subSourcesMap.put(C_WSDL_DOCUMENT_CCSL_CONSUMER,
075: new ConsumerCCSLCompoundPropertySource(consumerCCSL,
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:
085: if (id.equals(C_WSDL_DOCUMENT_CCSL_CONSUMER)) {
086: Object obj = subSourcesMap
087: .get(C_WSDL_DOCUMENT_CCSL_CONSUMER);
088: // Assert.isTrue(obj instanceof ConsumerCCSLCompoundPropertySource);
089: return obj;
090: }
091:
092: return super .getPropertyValue(id);
093: }
094:
095: /* (non-Javadoc)
096: * @see com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.providers.ComponentFlowEditorBasicCompoundPropertySource#isPropertySet(java.lang.Object)
097: */
098: public boolean isPropertySet(Object id) {
099: if (id.equals(C_WSDL_DOCUMENT_CCSL_CONSUMER))
100: return true;
101:
102: return super.isPropertySet(id);
103: }
104:
105: }
|