private void informUserModal(CompletionProposalComputerDescriptor descriptor, IStatus status) {
    String title = DartTextMessages.CompletionProposalComputerRegistry_error_dialog_title;
    CompletionProposalCategory category = descriptor.getCategory();
    IContributor culprit = descriptor.getContributor();
    Set affectedPlugins = getAffectedContributors(category, culprit);

    final String avoidHint;
    final String culpritName = culprit == null ? null : culprit.getName();
    if (affectedPlugins.isEmpty()) {
      avoidHint =
          Messages.format(
              DartTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHint,
              new Object[] {culpritName, category.getDisplayName()});
    } else {
      avoidHint =
          Messages.format(
              DartTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHintWithWarning,
              new Object[] {culpritName, category.getDisplayName(), toString(affectedPlugins)});
    }

    String message = status.getMessage();
    // inlined from MessageDialog.openError
    MessageDialog dialog =
        new MessageDialog(
            DartToolsPlugin.getActiveWorkbenchShell(),
            title,
            null /* default image */,
            message,
            MessageDialog.ERROR,
            new String[] {IDialogConstants.OK_LABEL},
            0) {
          @Override
          protected Control createCustomArea(Composite parent) {
            Link link = new Link(parent, SWT.NONE);
            link.setText(avoidHint);
            link.addSelectionListener(
                new SelectionAdapter() {
                  @Override
                  public void widgetSelected(SelectionEvent e) {
                    PreferencesUtil.createPreferenceDialogOn(
                            getShell(),
                            "com.google.dart.tools.ui.internal.preferences.CodeAssistPreferenceAdvanced",
                            null,
                            null)
                        .open(); //$NON-NLS-1$
                  }
                });
            GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
            gridData.widthHint = this.getMinimumMessageWidth();
            link.setLayoutData(gridData);
            return link;
          }
        };
    dialog.open();
  }
  /** key is the plugin id, value is the plugin library path */
  public static synchronized SortedMap<String, String> getContributedDetectors() {
    if (contributedDetectors != null) {
      return contributedDetectors;
    }
    TreeMap<String, String> set = new TreeMap<String, String>();

    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint point = registry.getExtensionPoint(EXTENSION_POINT_ID);
    if (point == null) {
      return set;
    }
    IExtension[] extensions = point.getExtensions();
    for (IExtension extension : extensions) {
      IConfigurationElement[] elements = extension.getConfigurationElements();
      for (IConfigurationElement configElt : elements) {
        String libPathAsString;
        String pluginId;
        IContributor contributor = null;
        try {
          contributor = configElt.getContributor();
          if (contributor == null) {
            throw new IllegalArgumentException("Null contributor");
          }
          pluginId = configElt.getAttribute(PLUGIN_ID);
          if (pluginId == null) {
            throw new IllegalArgumentException("Missing '" + PLUGIN_ID + "'");
          }
          libPathAsString = configElt.getAttribute(LIBRARY_PATH);
          if (libPathAsString == null) {
            throw new IllegalArgumentException("Missing '" + LIBRARY_PATH + "'");
          }
          libPathAsString = resolveRelativePath(contributor, libPathAsString);
          if (libPathAsString == null) {
            throw new IllegalArgumentException("Failed to resolve library path for: " + pluginId);
          }
          if (set.containsKey(pluginId)) {
            throw new IllegalArgumentException("Duplicated '" + pluginId + "' contribution.");
          }
          set.put(pluginId, libPathAsString);
        } catch (Throwable e) {
          String cName = contributor != null ? contributor.getName() : "unknown contributor";
          String message =
              "Failed to read contribution for '"
                  + EXTENSION_POINT_ID
                  + "' extension point from "
                  + cName;
          FindbugsPlugin.getDefault().logException(e, message);
          continue;
        }
      }
    }
    contributedDetectors = set;
    return contributedDetectors;
  }
 /**
  * Returns the names of contributors affected by disabling a category.
  *
  * @param category the category that would be disabled
  * @param culprit the culprit plug-in, which is not included in the returned list
  * @return the names of the contributors other than <code>culprit</code> that contribute to <code>
  *     category</code> (element type: {@link String})
  */
 private Set getAffectedContributors(CompletionProposalCategory category, IContributor culprit) {
   Set affectedPlugins = new HashSet();
   for (Iterator it = getProposalComputerDescriptors().iterator(); it.hasNext(); ) {
     CompletionProposalComputerDescriptor desc = (CompletionProposalComputerDescriptor) it.next();
     CompletionProposalCategory cat = desc.getCategory();
     if (cat.equals(category)) {
       IContributor contributor = desc.getContributor();
       if (contributor != null && !culprit.equals(contributor)) {
         affectedPlugins.add(contributor.getName());
       }
     }
   }
   return affectedPlugins;
 }
Example #4
0
  /**
   * Parses a configuration definition element.
   *
   * @param element A configuration definition element.
   * @throws CoreException
   * @throws Exception If anything wrong occurs.
   */
  private Configuration parseConfiguration(IConfigurationElement element) throws CoreException {
    String name = element.getAttribute("name");

    String extension = element.getAttribute("extension");
    String type = element.getAttribute("type");
    FileFormat format = new FileFormat(extension, type);

    IConfigurationElement[] children = element.getChildren("import");
    children = children[0].getChildren();
    parseTransformations(format.getImportTransformations(), children);

    children = element.getChildren("export");
    if (children.length > 0) {
      children = children[0].getChildren();
      parseTransformations(format.getExportTransformations(), children);
    }

    Map<String, ObjectType> graphTypes = parseTypes(element.getChildren("graphType"));
    Map<String, ObjectType> vertexTypes = parseTypes(element.getChildren("vertexType"));
    Map<String, ObjectType> edgeTypes = parseTypes(element.getChildren("edgeType"));

    IValidator validator = (IValidator) element.createExecutableExtension("validator");

    String refinement = element.getAttribute("refinement");
    IRefinementPolicy refinementPolicy = null;
    if (refinement != null) {
      refinementPolicy = (IRefinementPolicy) element.createExecutableExtension("refinement");
    }

    IContributor contributor = element.getContributor();
    Configuration configuration =
        new Configuration(
            name,
            contributor.getName(),
            format,
            graphTypes,
            vertexTypes,
            edgeTypes,
            validator,
            refinementPolicy);
    return configuration;
  }
  /**
   * @param contributor non null
   * @param libPathAsString non null
   * @return resolved absolute path for the detector package
   */
  @CheckForNull
  private static String resolveRelativePath(IContributor contributor, String libPathAsString) {
    String bundleName = contributor.getName();
    Bundle bundle = Platform.getBundle(bundleName);
    if (bundle == null) {
      return null;
    }
    File bundleFile;
    try {
      bundleFile = FileLocator.getBundleFile(bundle);
    } catch (IOException e) {
      FindbugsPlugin.getDefault()
          .logException(e, "Failed to resolve detector library for " + bundle.getSymbolicName());
      return null;
    }
    boolean runningInDebugger = Boolean.getBoolean("eclipse.pde.launch");
    if (!DEFAULT_USE_PLUGIN_JAR.equals(libPathAsString)) {
      return new Path(bundleFile.getAbsolutePath()).append(libPathAsString).toOSString();
    }
    if (!bundleFile.isDirectory()) {
      return bundleFile.getAbsolutePath();
    }
    if (runningInDebugger) {
      // in case we are inside debugger & see bundle as directory
      return createTemporaryJar(bundleName, bundleFile);
    }

    // it's a directory, and we are in the production environment.
    IllegalArgumentException e =
        new IllegalArgumentException(
            "Failed to resolve detector library for " + bundle.getSymbolicName());
    String message =
        "Failed to resolve detector library. '"
            + bundleFile
            + "' is a directory and can't be used as FindBugs detector package."
            + " Please specify '"
            + LIBRARY_PATH
            + "' argument as a relative path to the detectors jar file.";
    FindbugsPlugin.getDefault().logException(e, message);
    return null;
  }
    @Override
    public void run(IProgressMonitor progress) throws InvocationTargetException {
      SubMonitor monitor = SubMonitor.convert(progress, 3);
      monitor.setTaskName("Loading Templates...");
      try {
        final Set<Template> templates = new LinkedHashSet<>();
        final List<String> errors = new LinkedList<>();

        // Load from workspace, if one exists
        Workspace ws = Central.getWorkspaceIfPresent();
        if (ws != null) {
          List<Repository> repos = ws.getPlugins(Repository.class);
          RepoPluginsBundleLocator locator = new RepoPluginsBundleLocator(ws.getRepositories());
          templates.addAll(
              new ReposTemplateLoader(repos, locator)
                  .findTemplates(
                      templateType, errors, monitor.newChild(1, SubMonitor.SUPPRESS_NONE)));
        }

        // Load from the preferences-configured template repository
        BndPreferences bndPrefs = new BndPreferences();
        if (bndPrefs.getEnableTemplateRepo()) {
          try {
            FixedIndexedRepo repo = loadRepo(bndPrefs.getTemplateRepoUriList());
            RepoPluginsBundleLocator locator =
                new RepoPluginsBundleLocator(Collections.<RepositoryPlugin>singletonList(repo));
            ReposTemplateLoader loader =
                new ReposTemplateLoader(Collections.<Repository>singletonList(repo), locator);
            templates.addAll(
                loader.findTemplates(
                    templateType, errors, monitor.newChild(1, SubMonitor.SUPPRESS_NONE)));
          } catch (Exception e) {
            throw new InvocationTargetException(e);
          }
        }

        // Log errors
        for (String error : errors) {
          Plugin.getDefault()
              .getLog()
              .log(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, error, null));
        }

        // Add the build-in empty template if provided
        if (emptyTemplate != null) templates.add(emptyTemplate);

        // Load from extension registry
        if (templateExtPoint != null) {
          IConfigurationElement[] elements =
              Platform.getExtensionRegistry()
                  .getConfigurationElementsFor(Plugin.PLUGIN_ID, templateExtPoint);
          if (elements == null) elements = new IConfigurationElement[0];
          monitor.setWorkRemaining(elements.length);

          for (IConfigurationElement element : elements) {
            String elementName = element.getName();
            IContributor contributor = element.getContributor();
            try {
              Template extTemplate = (Template) element.createExecutableExtension("class");
              templates.add(extTemplate);
            } catch (CoreException e) {
              Plugin.getDefault()
                  .getLog()
                  .log(
                      new Status(
                          IStatus.ERROR,
                          Plugin.PLUGIN_ID,
                          0,
                          String.format(
                              "Error loading template '%s' from bundle %s",
                              elementName, contributor.getName()),
                          e));
            } finally {
              monitor.worked(1);
            }
          }
        }

        // Display results
        Control control = viewer.getControl();
        if (control != null && !control.isDisposed()) {
          control
              .getDisplay()
              .asyncExec(
                  new Runnable() {
                    @Override
                    public void run() {
                      setTemplates(templates);
                      IconLoaderJob iconLoaderJob =
                          new IconLoaderJob(templates, viewer, loadedImages, 5);
                      iconLoaderJob.setSystem(true);
                      iconLoaderJob.schedule(0);
                    }
                  });
        }

      } finally {
        monitor.done();
        // Restore the original message to the page
        if (!shell.isDisposed())
          shell
              .getDisplay()
              .asyncExec(
                  new Runnable() {
                    @Override
                    public void run() {
                      setMessage(originalMessage);
                    }
                  });
      }
    }
 public static String generate(final MyxGenBrick b) {
   MyxGenBrick _xtrycatchfinallyexpression = null;
   try {
     String _parentBrickId = b.getParentBrickId();
     MyxGenBrick _activeMyxGenBrick =
         MyxGenWorkspaceExtensions.getActiveMyxGenBrick(_parentBrickId);
     _xtrycatchfinallyexpression = _activeMyxGenBrick;
   } catch (final Throwable _t) {
     if (_t instanceof Exception) {
       final Exception e = (Exception) _t;
       _xtrycatchfinallyexpression = null;
     } else {
       throw Exceptions.sneakyThrow(_t);
     }
   }
   final MyxGenBrick pb = _xtrycatchfinallyexpression;
   try {
     StringConcatenation _builder = new StringConcatenation();
     _builder.append("package ");
     String _stubClassName = b.getStubClassName();
     String _packageName = MyxCompUtils.toPackageName(_stubClassName);
     _builder.append(_packageName, "");
     _builder.append(";");
     _builder.newLineIfNotEmpty();
     _builder.newLine();
     {
       boolean _equals = Objects.equal(pb, null);
       if (_equals) {
         _builder.append("import org.archstudio.myx.fw.MyxRegistry;");
         _builder.newLine();
       }
     }
     {
       Collection<MyxGenInterface> _interfaces = b.getInterfaces();
       int _size = _interfaces.size();
       boolean _greaterThan = (_size > 0);
       if (_greaterThan) {
         _builder.append("import org.archstudio.myx.fw.MyxUtils;");
         _builder.newLine();
       }
     }
     _builder.append("import org.archstudio.myx.fw.IMyxName;");
     _builder.newLine();
     _builder.newLine();
     _builder.append("/*");
     _builder.newLine();
     _builder.append(" ");
     _builder.append("* DO NOT EDIT THIS CLASS, it is automatically generated.");
     _builder.newLine();
     _builder.append(" ");
     _builder.append("* ANY MODIFICATIONS WILL BE OVERWRITTEN.");
     _builder.newLine();
     _builder.append(" ");
     _builder.append("*");
     _builder.newLine();
     _builder.append(" ");
     _builder.append("* To modify, update the \"");
     String _name = b.getName();
     _builder.append(_name, " ");
     _builder.append("\" MyxGen ");
     _builder.newLineIfNotEmpty();
     _builder.append(" ");
     _builder.append("* extension in the ");
     IContributor _contributor = b.getContributor();
     String _name_1 = _contributor.getName();
     _builder.append(_name_1, " ");
     _builder.append(" plugin.");
     _builder.newLineIfNotEmpty();
     _builder.append(" ");
     _builder.append("*/");
     _builder.newLine();
     _builder.newLine();
     _builder.append("/**");
     _builder.newLine();
     _builder.append(" ");
     _builder.append("* Abstract Myx brick: ");
     String _name_2 = b.getName();
     _builder.append(_name_2, " ");
     _builder.newLineIfNotEmpty();
     _builder.append(" ");
     _builder.append("* ");
     {
       String _description = b.getDescription();
       boolean _notEquals = (!Objects.equal(_description, null));
       if (_notEquals) {
         _builder.append("<p>");
         String _description_1 = b.getDescription();
         _builder.append(_description_1, " ");
       }
     }
     _builder.newLineIfNotEmpty();
     _builder.append(" ");
     _builder.append("* @generated");
     _builder.newLine();
     _builder.append(" ");
     _builder.append("*/");
     _builder.newLine();
     _builder.append("public abstract class ");
     String _stubClassName_1 = b.getStubClassName();
     String _className = MyxCompUtils.toClassName(_stubClassName_1);
     _builder.append(_className, "");
     _builder.newLineIfNotEmpty();
     {
       boolean _equals_1 = Objects.equal(pb, null);
       if (_equals_1) {
         _builder.append("extends org.archstudio.myx.fw.AbstractMyxSimpleBrick");
         _builder.newLine();
       } else {
         _builder.append("extends ");
         String _className_1 = pb.getClassName();
         _builder.append(_className_1, "");
         _builder.newLineIfNotEmpty();
       }
     }
     _builder.append("implements org.archstudio.myx.fw.IMyxDynamicBrick");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_1 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EServiceObjectDelegate _serviceObjectDelegate = i.getServiceObjectDelegate();
               boolean _equals =
                   Objects.equal(_serviceObjectDelegate, EServiceObjectDelegate.brick);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_1, _function);
       boolean _hasElements = false;
       for (final MyxGenInterface i : _filter) {
         if (!_hasElements) {
           _hasElements = true;
           _builder.append(", ", "");
         } else {
           _builder.appendImmediate(", ", "");
         }
         String _className_2 = i.getClassName();
         _builder.append(_className_2, "");
       }
     }
     _builder.newLineIfNotEmpty();
     _builder.append("{");
     _builder.newLine();
     _builder.append("\t");
     _builder.newLine();
     {
       boolean _notEquals_1 = (!Objects.equal(pb, null));
       if (_notEquals_1) {
         _builder.append("\t");
         IContributor _contributor_1 = pb.getContributor();
         String _name_3 = _contributor_1.getName();
         String _className_3 = pb.getClassName();
         String _constructorsFor = MyxCompUtils.constructorsFor(b, _name_3, _className_3);
         _builder.append(_constructorsFor, "	");
         _builder.newLineIfNotEmpty();
       } else {
         _builder.append("\t");
         _builder.append("/**");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* The registry of objects for this brick.");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* @generated");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("*/");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(
             "protected final MyxRegistry myxRegistry = MyxRegistry.getSharedInstance();");
         _builder.newLine();
         _builder.append("\t");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("/**");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* Register this brick instance with the registry.");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* @generated");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("*/");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("@Override");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("public void begin(){");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("\t");
         _builder.append("super.begin();");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("\t");
         _builder.append("myxRegistry.register(this);");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("}");
         _builder.newLine();
         _builder.append("\t");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("/**");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* Unregister this brick instance with the registry.");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* @generated");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("*/");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("@Override");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("public void end(){");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("\t");
         _builder.append("myxRegistry.unregister(this);");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("\t");
         _builder.append("super.end();");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("}");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_2 = b.getInterfaces();
       for (final MyxGenInterface i_1 : _interfaces_2) {
         _builder.append("\t");
         _builder.append("/**");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* Myx name for the <code>");
         String _name_4 = i_1.getName();
         _builder.append(_name_4, "	 ");
         _builder.append("</code> interface.");
         _builder.newLineIfNotEmpty();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* ");
         {
           String _description_2 = i_1.getDescription();
           boolean _notEquals_2 = (!Objects.equal(_description_2, null));
           if (_notEquals_2) {
             _builder.append("<p>");
             String _description_3 = i_1.getDescription();
             _builder.append(_description_3, "	 ");
           }
         }
         _builder.newLineIfNotEmpty();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* @generated");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("*/");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("public static final IMyxName ");
         EMyxInterfaceDirection _direction = i_1.getDirection();
         String _name_5 = _direction.name();
         String _lowerCase = _name_5.toLowerCase();
         String _name_6 = i_1.getName();
         String _firstUpper = StringExtensions.toFirstUpper(_name_6);
         String _plus = (_lowerCase + _firstUpper);
         String _constantName = MyxCompUtils.toConstantName(_plus);
         _builder.append(_constantName, "	");
         _builder.append(" = MyxUtils.createName(\"");
         String _id = i_1.getId();
         _builder.append(_id, "	");
         _builder.append("\");");
         _builder.newLineIfNotEmpty();
         _builder.append("\t");
         _builder.newLine();
         {
           EServiceObjectDelegate _serviceObjectDelegate = i_1.getServiceObjectDelegate();
           boolean _isNeedsVariable = _serviceObjectDelegate.isNeedsVariable();
           if (_isNeedsVariable) {
             _builder.append("\t");
             _builder.append("/**");
             _builder.newLine();
             _builder.append("\t");
             _builder.append(" ");
             _builder.append("* Service object");
             {
               boolean _isSingle = i_1.isSingle();
               boolean _not = (!_isSingle);
               if (_not) {
                 _builder.append("s");
               }
             }
             _builder.append(" for the ");
             String _name_7 = i_1.getName();
             _builder.append(_name_7, "	 ");
             _builder.append(" interface.");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append(" ");
             _builder.append("* @see #");
             EMyxInterfaceDirection _direction_1 = i_1.getDirection();
             String _name_8 = _direction_1.name();
             String _lowerCase_1 = _name_8.toLowerCase();
             String _name_9 = i_1.getName();
             String _firstUpper_1 = StringExtensions.toFirstUpper(_name_9);
             String _plus_1 = (_lowerCase_1 + _firstUpper_1);
             String _constantName_1 = MyxCompUtils.toConstantName(_plus_1);
             _builder.append(_constantName_1, "	 ");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append(" ");
             _builder.append("* @generated");
             _builder.newLine();
             _builder.append("\t");
             _builder.append(" ");
             _builder.append("*/");
             _builder.newLine();
             {
               boolean _isSingle_1 = i_1.isSingle();
               if (_isSingle_1) {
                 _builder.append("\t");
                 _builder.append("protected ");
                 String _className_4 = i_1.getClassName();
                 _builder.append(_className_4, "	");
                 _builder.append(" ");
                 String _name_10 = i_1.getName();
                 _builder.append(_name_10, "	");
                 _builder.append(" = null;");
                 _builder.newLineIfNotEmpty();
               } else {
                 _builder.append("\t");
                 _builder.append("protected final java.util.Collection<");
                 String _className_5 = i_1.getClassName();
                 _builder.append(_className_5, "	");
                 _builder.append("> ");
                 String _name_11 = i_1.getName();
                 _builder.append(_name_11, "	");
                 _builder.append(" = new java.util.concurrent.CopyOnWriteArrayList<");
                 String _className_6 = i_1.getClassName();
                 _builder.append(_className_6, "	");
                 _builder.append(">();");
                 _builder.newLineIfNotEmpty();
               }
             }
           }
         }
         _builder.append("\t");
         _builder.newLine();
         {
           EServiceObjectDelegate _serviceObjectDelegate_1 = i_1.getServiceObjectDelegate();
           boolean _isNeedsProxy = _serviceObjectDelegate_1.isNeedsProxy();
           if (_isNeedsProxy) {
             _builder.append("\t");
             _builder.append("/**");
             _builder.newLine();
             _builder.append("\t");
             _builder.append(" ");
             _builder.append("* Service object proxy for the ");
             String _name_12 = i_1.getName();
             _builder.append(_name_12, "	 ");
             _builder.append(" interface.");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append(" ");
             _builder.append("* Calls to this proxy object are automatically delegated to ");
             {
               EServiceObjectDelegate _serviceObjectDelegate_2 = i_1.getServiceObjectDelegate();
               boolean _equals_2 =
                   Objects.equal(_serviceObjectDelegate_2, EServiceObjectDelegate.myxRegistry);
               if (_equals_2) {
                 _builder.append("all service objects in the MyxRegistry of type ");
                 String _className_7 = i_1.getClassName();
                 _builder.append(_className_7, "	 ");
                 _builder.append(".");
               } else {
                 _builder.append("all connections on the interface");
               }
             }
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("* @see #");
             EMyxInterfaceDirection _direction_2 = i_1.getDirection();
             String _name_13 = _direction_2.name();
             String _lowerCase_2 = _name_13.toLowerCase();
             String _name_14 = i_1.getName();
             String _firstUpper_2 = StringExtensions.toFirstUpper(_name_14);
             String _plus_2 = (_lowerCase_2 + _firstUpper_2);
             String _constantName_2 = MyxCompUtils.toConstantName(_plus_2);
             _builder.append(_constantName_2, "	");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("* @generated");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("*/");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("protected final ");
             String _className_8 = i_1.getClassName();
             _builder.append(_className_8, "	");
             _builder.append(" ");
             String _name_15 = i_1.getName();
             _builder.append(_name_15, "	");
             _builder.append("Proxy =");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t");
             _builder.append("(");
             String _className_9 = i_1.getClassName();
             _builder.append(_className_9, "		");
             _builder.append(") java.lang.reflect.Proxy.newProxyInstance(");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             String _className_10 = i_1.getClassName();
             _builder.append(_className_10, "			");
             _builder.append(".class.getClassLoader(), ");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             _builder.append("new Class[] { ");
             String _className_11 = i_1.getClassName();
             _builder.append(_className_11, "			");
             _builder.append(".class },");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             _builder.append("new java.lang.reflect.InvocationHandler() {");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t");
             _builder.append("@Override");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t");
             _builder.append(
                 "public Object invoke(Object proxy, java.lang.reflect.Method method, Object[] args) throws Throwable {");
             _builder.newLine();
             {
               EServiceObjectDelegate _serviceObjectDelegate_3 = i_1.getServiceObjectDelegate();
               boolean _equals_3 =
                   Objects.equal(_serviceObjectDelegate_3, EServiceObjectDelegate.myxRegistry);
               if (_equals_3) {
                 _builder.append("\t");
                 _builder.append("\t\t\t\t");
                 _builder.append("for (");
                 String _className_12 = i_1.getClassName();
                 _builder.append(_className_12, "					");
                 _builder.append(" o : myxRegistry.getObjects(");
                 String _stubClassName_2 = b.getStubClassName();
                 String _className_13 = MyxCompUtils.toClassName(_stubClassName_2);
                 _builder.append(_className_13, "					");
                 _builder.append(".this, ");
                 String _className_14 = i_1.getClassName();
                 _builder.append(_className_14, "					");
                 _builder.append(".class)) {");
                 _builder.newLineIfNotEmpty();
               } else {
                 boolean _isSingle_2 = i_1.isSingle();
                 boolean _not_1 = (!_isSingle_2);
                 if (_not_1) {
                   _builder.append("\t");
                   _builder.append("\t\t\t\t");
                   _builder.append("for (");
                   String _className_15 = i_1.getClassName();
                   _builder.append(_className_15, "					");
                   _builder.append(" o : ");
                   String _name_16 = i_1.getName();
                   _builder.append(_name_16, "					");
                   _builder.append(") {");
                   _builder.newLineIfNotEmpty();
                 } else {
                   _builder.append("\t");
                   _builder.append("\t\t\t\t");
                   String _className_16 = i_1.getClassName();
                   _builder.append(_className_16, "					");
                   _builder.append(" o = ");
                   String _name_17 = i_1.getName();
                   _builder.append(_name_17, "					");
                   _builder.append(";");
                   _builder.newLineIfNotEmpty();
                   _builder.append("\t");
                   _builder.append("\t\t\t\t");
                   _builder.append("if (o == null) {");
                   _builder.newLine();
                   _builder.append("\t");
                   _builder.append("\t\t\t\t");
                   _builder.append("\t");
                   _builder.append("throw new NullPointerException(\"");
                   String _name_18 = i_1.getName();
                   _builder.append(_name_18, "						");
                   _builder.append("\");");
                   _builder.newLineIfNotEmpty();
                   _builder.append("\t");
                   _builder.append("\t\t\t\t");
                   _builder.append("}");
                   _builder.newLine();
                   _builder.append("\t");
                   _builder.append("\t\t\t\t");
                   _builder.append("else {");
                   _builder.newLine();
                 }
               }
             }
             _builder.append("\t");
             _builder.append("\t\t\t\t");
             _builder.append("try {");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t\t\t");
             _builder.append("method.invoke(o, args);");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t\t");
             _builder.append("}");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t\t");
             _builder.append("catch (Exception e) {");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t\t\t");
             _builder.append("e.printStackTrace();");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t\t");
             _builder.append("}");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t\t");
             _builder.append("}");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t");
             _builder.append("return null;");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t");
             _builder.append("}");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t");
             _builder.append("});");
             _builder.newLine();
           }
         }
         _builder.newLine();
         {
           boolean _isGenerateGetter = i_1.isGenerateGetter();
           if (_isGenerateGetter) {
             _builder.append("\t");
             _builder.append("/**");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("* Returns the service object(s) for the ");
             String _name_19 = i_1.getName();
             _builder.append(_name_19, "	");
             _builder.append(" interface.");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("* @see #");
             EMyxInterfaceDirection _direction_3 = i_1.getDirection();
             String _name_20 = _direction_3.name();
             String _lowerCase_3 = _name_20.toLowerCase();
             String _name_21 = i_1.getName();
             String _firstUpper_3 = StringExtensions.toFirstUpper(_name_21);
             String _plus_3 = (_lowerCase_3 + _firstUpper_3);
             String _constantName_3 = MyxCompUtils.toConstantName(_plus_3);
             _builder.append(_constantName_3, "	");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("* @generated");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("*/");
             _builder.newLine();
             {
               EServiceObjectDelegate _serviceObjectDelegate_4 = i_1.getServiceObjectDelegate();
               boolean _isNeedsProxy_1 = _serviceObjectDelegate_4.isNeedsProxy();
               if (_isNeedsProxy_1) {
                 _builder.append("\t");
                 _builder.append("public ");
                 String _className_17 = i_1.getClassName();
                 _builder.append(_className_17, "	");
                 _builder.append(" get");
                 String _name_22 = i_1.getName();
                 String _firstUpper_4 = StringExtensions.toFirstUpper(_name_22);
                 _builder.append(_firstUpper_4, "	");
                 _builder.append("() {");
                 _builder.newLineIfNotEmpty();
               } else {
                 _builder.append("\t");
                 _builder.append("public ");
                 {
                   boolean _isSingle_3 = i_1.isSingle();
                   if (_isSingle_3) {
                     String _className_18 = i_1.getClassName();
                     _builder.append(_className_18, "	");
                   } else {
                     _builder.append("java.util.Collection<");
                     String _className_19 = i_1.getClassName();
                     _builder.append(_className_19, "	");
                     _builder.append(">");
                   }
                 }
                 _builder.append(" get");
                 String _name_23 = i_1.getName();
                 String _firstUpper_5 = StringExtensions.toFirstUpper(_name_23);
                 _builder.append(_firstUpper_5, "	");
                 _builder.append("() {");
                 _builder.newLineIfNotEmpty();
               }
             }
             {
               EServiceObjectDelegate _serviceObjectDelegate_5 = i_1.getServiceObjectDelegate();
               boolean _equals_4 =
                   Objects.equal(_serviceObjectDelegate_5, EServiceObjectDelegate.brick);
               if (_equals_4) {
                 _builder.append("\t");
                 _builder.append("\t");
                 _builder.append("return this;");
                 _builder.newLine();
               } else {
                 {
                   boolean _and = false;
                   EServiceObjectDelegate _serviceObjectDelegate_6 =
                       i_1.getServiceObjectDelegate();
                   boolean _isNeedsProxy_2 = _serviceObjectDelegate_6.isNeedsProxy();
                   boolean _not_2 = (!_isNeedsProxy_2);
                   if (!_not_2) {
                     _and = false;
                   } else {
                     boolean _isSingle_4 = i_1.isSingle();
                     _and = (_not_2 && _isSingle_4);
                   }
                   if (_and) {
                     _builder.append("\t");
                     _builder.append("\t");
                     _builder.append("if (");
                     String _name_24 = i_1.getName();
                     _builder.append(_name_24, "		");
                     _builder.append(" == null) {");
                     _builder.newLineIfNotEmpty();
                     _builder.append("\t");
                     _builder.append("\t");
                     _builder.append("\t");
                     _builder.append(
                         "throw new NullPointerException(\"Uninitialized service object: ");
                     String _name_25 = i_1.getName();
                     _builder.append(_name_25, "			");
                     _builder.append("\");");
                     _builder.newLineIfNotEmpty();
                     _builder.append("\t");
                     _builder.append("\t");
                     _builder.append("}");
                     _builder.newLine();
                   }
                 }
                 _builder.append("\t");
                 _builder.append("\t");
                 _builder.append("return ");
                 String _name_26 = i_1.getName();
                 _builder.append(_name_26, "		");
                 {
                   EServiceObjectDelegate _serviceObjectDelegate_7 =
                       i_1.getServiceObjectDelegate();
                   boolean _isNeedsProxy_3 = _serviceObjectDelegate_7.isNeedsProxy();
                   if (_isNeedsProxy_3) {
                     _builder.append("Proxy");
                   }
                 }
                 _builder.append(";");
                 _builder.newLineIfNotEmpty();
               }
             }
             _builder.append("\t");
             _builder.append("}");
             _builder.newLine();
           }
         }
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("/**");
     _builder.newLine();
     _builder.append("\t ");
     _builder.append("* Returns service object(s) for IN interfaces.");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_3 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function_1 =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EMyxInterfaceDirection _direction = i.getDirection();
               boolean _equals = Objects.equal(_direction, EMyxInterfaceDirection.IN);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter_1 =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_3, _function_1);
       for (final MyxGenInterface i_2 : _filter_1) {
         _builder.append("\t");
         _builder.append("* @see #");
         EMyxInterfaceDirection _direction_4 = i_2.getDirection();
         String _name_27 = _direction_4.name();
         String _lowerCase_4 = _name_27.toLowerCase();
         String _name_28 = i_2.getName();
         String _firstUpper_6 = StringExtensions.toFirstUpper(_name_28);
         String _plus_4 = (_lowerCase_4 + _firstUpper_6);
         String _constantName_4 = MyxCompUtils.toConstantName(_plus_4);
         _builder.append(_constantName_4, "	");
         _builder.newLineIfNotEmpty();
       }
     }
     _builder.append("\t");
     _builder.append("* @generated");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("*/");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("@Override");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("public Object getServiceObject(IMyxName interfaceName) {");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_4 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function_2 =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EMyxInterfaceDirection _direction = i.getDirection();
               boolean _equals = Objects.equal(_direction, EMyxInterfaceDirection.IN);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter_2 =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_4, _function_2);
       for (final MyxGenInterface i_3 : _filter_2) {
         _builder.append("\t");
         _builder.append("if(interfaceName.equals(");
         EMyxInterfaceDirection _direction_5 = i_3.getDirection();
         String _name_29 = _direction_5.name();
         String _lowerCase_5 = _name_29.toLowerCase();
         String _name_30 = i_3.getName();
         String _firstUpper_7 = StringExtensions.toFirstUpper(_name_30);
         String _plus_5 = (_lowerCase_5 + _firstUpper_7);
         String _constantName_5 = MyxCompUtils.toConstantName(_plus_5);
         _builder.append(_constantName_5, "	");
         _builder.append(")) {");
         _builder.newLineIfNotEmpty();
         {
           EServiceObjectDelegate _serviceObjectDelegate_8 = i_3.getServiceObjectDelegate();
           boolean _equals_5 =
               Objects.equal(_serviceObjectDelegate_8, EServiceObjectDelegate.brick);
           if (_equals_5) {
             _builder.append("\t");
             _builder.append("\t");
             _builder.append("return this;");
             _builder.newLine();
           } else {
             {
               boolean _and_1 = false;
               EServiceObjectDelegate _serviceObjectDelegate_9 = i_3.getServiceObjectDelegate();
               boolean _isNeedsProxy_4 = _serviceObjectDelegate_9.isNeedsProxy();
               boolean _not_3 = (!_isNeedsProxy_4);
               if (!_not_3) {
                 _and_1 = false;
               } else {
                 boolean _isSingle_5 = i_3.isSingle();
                 _and_1 = (_not_3 && _isSingle_5);
               }
               if (_and_1) {
                 _builder.append("\t");
                 _builder.append("\t");
                 _builder.append("if (");
                 String _name_31 = i_3.getName();
                 _builder.append(_name_31, "		");
                 _builder.append(" == null) {");
                 _builder.newLineIfNotEmpty();
                 _builder.append("\t");
                 _builder.append("\t");
                 _builder.append("\t");
                 _builder.append(
                     "throw new NullPointerException(\"Uninitialized service object: ");
                 String _name_32 = i_3.getName();
                 _builder.append(_name_32, "			");
                 _builder.append("\");");
                 _builder.newLineIfNotEmpty();
                 _builder.append("\t");
                 _builder.append("\t");
                 _builder.append("}");
                 _builder.newLine();
               }
             }
             _builder.append("\t");
             _builder.append("\t");
             _builder.append("return ");
             String _name_33 = i_3.getName();
             _builder.append(_name_33, "		");
             {
               EServiceObjectDelegate _serviceObjectDelegate_10 = i_3.getServiceObjectDelegate();
               boolean _isNeedsProxy_5 = _serviceObjectDelegate_10.isNeedsProxy();
               if (_isNeedsProxy_5) {
                 _builder.append("Proxy");
               }
             }
             _builder.append(";");
             _builder.newLineIfNotEmpty();
           }
         }
         _builder.append("\t");
         _builder.append("}");
         _builder.newLine();
       }
     }
     {
       String _parentBrickId_1 = b.getParentBrickId();
       boolean _equals_6 = Objects.equal(_parentBrickId_1, null);
       if (_equals_6) {
         _builder.append("\t");
         _builder.append(
             "throw new IllegalArgumentException(\"Unhandled interface: \"+interfaceName.getName());");
         _builder.newLine();
       } else {
         _builder.append("\t");
         _builder.append("return super.getServiceObject(interfaceName);");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("\t");
     _builder.append("/**");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("* Update service objects based on connected OUT interfaces.");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_5 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function_3 =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EMyxInterfaceDirection _direction = i.getDirection();
               boolean _equals = Objects.equal(_direction, EMyxInterfaceDirection.OUT);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter_3 =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_5, _function_3);
       for (final MyxGenInterface i_4 : _filter_3) {
         _builder.append("\t");
         _builder.append("* @see #");
         EMyxInterfaceDirection _direction_6 = i_4.getDirection();
         String _name_34 = _direction_6.name();
         String _lowerCase_6 = _name_34.toLowerCase();
         String _name_35 = i_4.getName();
         String _firstUpper_8 = StringExtensions.toFirstUpper(_name_35);
         String _plus_6 = (_lowerCase_6 + _firstUpper_8);
         String _constantName_6 = MyxCompUtils.toConstantName(_plus_6);
         _builder.append(_constantName_6, "	");
         _builder.newLineIfNotEmpty();
       }
     }
     _builder.append("\t");
     _builder.append("* @generated");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("*/");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("@Override");
     _builder.newLine();
     _builder.append("\t");
     _builder.append(
         "public void interfaceConnected(IMyxName interfaceName, Object serviceObject) {");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("if (serviceObject == null)");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("throw new NullPointerException(interfaceName.getName());");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_6 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function_4 =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EMyxInterfaceDirection _direction = i.getDirection();
               boolean _equals = Objects.equal(_direction, EMyxInterfaceDirection.OUT);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter_4 =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_6, _function_4);
       for (final MyxGenInterface i_5 : _filter_4) {
         _builder.newLine();
         _builder.append("\t");
         _builder.append("if(interfaceName.equals(");
         EMyxInterfaceDirection _direction_7 = i_5.getDirection();
         String _name_36 = _direction_7.name();
         String _lowerCase_7 = _name_36.toLowerCase();
         String _name_37 = i_5.getName();
         String _firstUpper_9 = StringExtensions.toFirstUpper(_name_37);
         String _plus_7 = (_lowerCase_7 + _firstUpper_9);
         String _constantName_7 = MyxCompUtils.toConstantName(_plus_7);
         _builder.append(_constantName_7, "	");
         _builder.append(")) {");
         _builder.newLineIfNotEmpty();
         {
           boolean _isSingle_6 = i_5.isSingle();
           if (_isSingle_6) {
             _builder.append("\t");
             _builder.append("\t\t");
             _builder.append("if (");
             String _name_38 = i_5.getName();
             _builder.append(_name_38, "			");
             _builder.append(" != null)");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             _builder.append("\t");
             _builder.append(
                 "throw new IllegalStateException(\"Only a single connection is supported on interface: ");
             String _name_39 = i_5.getName();
             _builder.append(_name_39, "				");
             _builder.append("\");");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             String _name_40 = i_5.getName();
             _builder.append(_name_40, "			");
             _builder.append(" = (");
             String _className_20 = i_5.getClassName();
             _builder.append(_className_20, "			");
             _builder.append(") serviceObject;");
             _builder.newLineIfNotEmpty();
           } else {
             _builder.append("\t");
             _builder.append("\t\t");
             String _name_41 = i_5.getName();
             _builder.append(_name_41, "			");
             _builder.append(".add((");
             String _className_21 = i_5.getClassName();
             _builder.append(_className_21, "			");
             _builder.append(") serviceObject);");
             _builder.newLineIfNotEmpty();
           }
         }
         _builder.append("\t");
         _builder.append("\t\t");
         _builder.append("return;");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("}");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.newLine();
     {
       String _parentBrickId_2 = b.getParentBrickId();
       boolean _equals_7 = Objects.equal(_parentBrickId_2, null);
       if (_equals_7) {
         _builder.append("\t");
         _builder.append(
             "throw new IllegalArgumentException(\"Unhandled interface: \"+interfaceName.getName());");
         _builder.newLine();
       } else {
         _builder.append("\t");
         _builder.append("super.interfaceConnected(interfaceName, serviceObject);");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("\t");
     _builder.append("/**");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("* Update service objects based on disconnecting OUT interfaces.");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_7 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function_5 =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EMyxInterfaceDirection _direction = i.getDirection();
               boolean _equals = Objects.equal(_direction, EMyxInterfaceDirection.OUT);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter_5 =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_7, _function_5);
       for (final MyxGenInterface i_6 : _filter_5) {
         _builder.append("\t");
         _builder.append("* @see #");
         EMyxInterfaceDirection _direction_8 = i_6.getDirection();
         String _name_42 = _direction_8.name();
         String _lowerCase_8 = _name_42.toLowerCase();
         String _name_43 = i_6.getName();
         String _firstUpper_10 = StringExtensions.toFirstUpper(_name_43);
         String _plus_8 = (_lowerCase_8 + _firstUpper_10);
         String _constantName_8 = MyxCompUtils.toConstantName(_plus_8);
         _builder.append(_constantName_8, "	");
         _builder.newLineIfNotEmpty();
       }
     }
     _builder.append("\t");
     _builder.append("* @generated");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("*/");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("@Override");
     _builder.newLine();
     _builder.append("\t");
     _builder.append(
         "public void interfaceDisconnecting(IMyxName interfaceName, Object serviceObject) {");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("if (serviceObject == null)");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("throw new NullPointerException(interfaceName.getName());");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_8 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function_6 =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EMyxInterfaceDirection _direction = i.getDirection();
               boolean _equals = Objects.equal(_direction, EMyxInterfaceDirection.OUT);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter_6 =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_8, _function_6);
       for (final MyxGenInterface i_7 : _filter_6) {
         _builder.newLine();
         _builder.append("\t");
         _builder.append("if(interfaceName.equals(");
         EMyxInterfaceDirection _direction_9 = i_7.getDirection();
         String _name_44 = _direction_9.name();
         String _lowerCase_9 = _name_44.toLowerCase();
         String _name_45 = i_7.getName();
         String _firstUpper_11 = StringExtensions.toFirstUpper(_name_45);
         String _plus_9 = (_lowerCase_9 + _firstUpper_11);
         String _constantName_9 = MyxCompUtils.toConstantName(_plus_9);
         _builder.append(_constantName_9, "	");
         _builder.append(")) {");
         _builder.newLineIfNotEmpty();
         {
           boolean _isSingle_7 = i_7.isSingle();
           if (_isSingle_7) {
             _builder.append("\t");
             _builder.append("\t\t");
             _builder.append("if (");
             String _name_46 = i_7.getName();
             _builder.append(_name_46, "			");
             _builder.append(" == null)");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             _builder.append("\t");
             _builder.append(
                 "throw new IllegalStateException(\"A connection was never made on interface: ");
             String _name_47 = i_7.getName();
             _builder.append(_name_47, "				");
             _builder.append("\");");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             String _name_48 = i_7.getName();
             _builder.append(_name_48, "			");
             _builder.append(" = null;");
             _builder.newLineIfNotEmpty();
           } else {
             _builder.append("\t");
             _builder.append("\t\t");
             String _name_49 = i_7.getName();
             _builder.append(_name_49, "			");
             _builder.append(".remove(serviceObject);");
             _builder.newLineIfNotEmpty();
           }
         }
         _builder.append("\t");
         _builder.append("\t\t");
         _builder.append("return;");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("}");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.newLine();
     {
       String _parentBrickId_3 = b.getParentBrickId();
       boolean _equals_8 = Objects.equal(_parentBrickId_3, null);
       if (_equals_8) {
         _builder.append("\t");
         _builder.append(
             "throw new IllegalArgumentException(\"Unhandled interface: \"+interfaceName.getName());");
         _builder.newLine();
       } else {
         _builder.append("\t");
         _builder.append("super.interfaceDisconnecting(interfaceName, serviceObject);");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("\t");
     _builder.append("/**");
     _builder.newLine();
     _builder.append("\t ");
     _builder.append("* Performs no operation upon the completion of an interface disconnecting.");
     _builder.newLine();
     _builder.append("\t ");
     _builder.append("* @generated");
     _builder.newLine();
     _builder.append("\t ");
     _builder.append("*/");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("@Override");
     _builder.newLine();
     _builder.append("\t");
     _builder.append(
         "public void interfaceDisconnected(IMyxName interfaceName, Object serviceObject) {");
     _builder.newLine();
     {
       String _parentBrickId_4 = b.getParentBrickId();
       boolean _notEquals_3 = (!Objects.equal(_parentBrickId_4, null));
       if (_notEquals_3) {
         _builder.append("\t");
         _builder.append("super.interfaceDisconnected(interfaceName, serviceObject);");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     return _builder.toString();
   } catch (Throwable _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }