Logo Search packages:      
Sourcecode: ooeclipseintegration version File versions  Download package

static IUnoComposite org::openoffice::ide::eclipse::core::model::CompositeFactory::createInterface ( String  name,
boolean  isPublished,
String[]  parentIntfNames 
) [inline, static]

Creates a Uno composite corresponding to an interface with its mandatory parent interfaces.

This method returns two kind of texts depending on the number of parent interfaces name in the array. The first writing is used when there is only one parent interface:

[published ]interface name [: parent::name ]{
 [...]
 };

The other way is used when there are more than one parent interfaces:


[published ]interface name { [[optional] ]interface parent::name; // for each parent [...] };

Parameters:
name is the name of the interface (eg: foo)
isPublished true if the interface is published
parentIntfNames array of all the mandatory parent interfaces
See also:
createInterfaceInheritance(String, boolean) for the interfaces inheritances. This method should be called for each new interface to add or for optional interfaces. It is used in this method thought.
Returns:
a uno composite representing an interface declaration

Definition at line 354 of file CompositeFactory.java.

References org::openoffice::ide::eclipse::core::model::IUnoComposite::addChild(), org::openoffice::ide::eclipse::core::model::IUnoComposite::configure(), createInterfaceInheritance(), org::openoffice::ide::eclipse::core::model::IUnoComposite::setIndented(), and org::openoffice::ide::eclipse::core::model::IUnoComposite::setType().

                                                                 {
            
            IUnoComposite intf = null;
            
            if (name != null && !name.equals("")) { //$NON-NLS-1$
                  intf = new UnoComposite();
                  intf.setType(IUnoComposite.COMPOSITE_TYPE_TEXT);
                  intf.setIndented(true);
                  
                  Hashtable properties = new Hashtable();
                  properties.put("name", name); //$NON-NLS-1$
                  if (parentIntfNames.length == 1) {
                        properties.put("interface", ": " + parentIntfNames[0] + " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                  } else {
                        properties.put("interface", ""); //$NON-NLS-1$ //$NON-NLS-2$
                  }
                  if (isPublished) {
                        properties.put("published", "published "); //$NON-NLS-1$ //$NON-NLS-2$
                  } else {
                        properties.put("published", ""); //$NON-NLS-1$ //$NON-NLS-2$
                  }
                  String template = "\n\n${published}interface ${name} ${interface}{\n" + //$NON-NLS-1$
                        "${children}\n};\n\n"; //$NON-NLS-1$
                  intf.configure(properties, template);
                  
                  // Adds the interfaces if more than 1
                  if (parentIntfNames.length > 1){
                        
                        for (int i=0; i<parentIntfNames.length; i++) {
                              IUnoComposite parent = createInterfaceInheritance(
                                          parentIntfNames[i], false);
                              if (parent != null) {
                                    intf.addChild(parent);
                              }
                        }
                  }
            }
            return intf;
      }


Generated by  Doxygen 1.6.0   Back to index