protected final void addLabelledComponentRow(final String[] labels, final Component[] contents) {
    Ensure.ensureArgumentTrue(
        "Same number of labels required", labels.length == contents.length); // $NON-NLS-1$
    getPageContent()
        .addDialogComponent(
            new IDialogComponent() {
              public void fillInto(JPanel panel, int columnCount) {
                for (int index = 0; index < contents.length; index++) {
                  panel.add(new JLabel(labels[index]));
                  panel.add(contents[index], GridDialogLayoutData.FILL_HORIZONTAL);
                }
              }

              public int getColumnCount() {
                return contents.length * 2;
              }
            });
  }
Esempio n. 2
0
 private void readMerged(Element mergedElement, ICharm[] existingCharms) {
   List<Element> charmReferences = ElementUtilities.elements(mergedElement, TAG_CHARM_REFERENCE);
   Set<ICharm> charms = new HashSet<ICharm>(charmReferences.size());
   for (Element charmReference : charmReferences) {
     final String charmId = charmReference.attributeValue(ATTRIB_ID);
     ICharm charm =
         ArrayUtilities.getFirst(
             existingCharms,
             new IPredicate<ICharm>() {
               @Override
               public boolean evaluate(ICharm candidate) {
                 return candidate.getId().equals(charmId);
               }
             });
     Ensure.ensureNotNull("Charm not found " + charmId, charm); // $NON-NLS-1$
     charms.add(charm);
   }
   for (ICharm charm : charms) {
     ((Charm) charm).addMerged(charms);
   }
 }
Esempio n. 3
0
 public MultiFileReadAccess(File itemFolder, String mainFileName, String extension) {
   Ensure.ensureTrue("Must be a directory.", itemFolder.isDirectory()); // $NON-NLS-1$
   this.itemFolder = itemFolder;
   this.mainFileName = mainFileName;
   this.extension = extension;
 }
Esempio n. 4
0
 public void addParent(ISimpleNode node) {
   Ensure.ensureNull(this.parent[0]);
   this.parent[0] = node;
 }