コード例 #1
0
 // referenceMappingHolder expects an MWReferenceObjectMapping
 public static ListChooser buildReferenceDescriptorChooser(
     ValueModel referenceMappingHolder, WorkbenchContextHolder contextHolder) {
   ListChooser listChooser =
       new DefaultListChooser(
           buildExtendedReferenceDescriptorComboBoxModel(referenceMappingHolder),
           contextHolder,
           buildDescriptorNodeSelector(contextHolder),
           buildReferenceChooserDialogBuilder(
               contextHolder
                   .getWorkbenchContext()
                   .getApplicationContext()
                   .getResourceRepository()));
   listChooser.setRenderer(
       buildDescriptorListRenderer(
           contextHolder.getWorkbenchContext().getApplicationContext().getResourceRepository()));
   return listChooser;
 }
コード例 #2
0
  /**
   * Creates a new button that when clicked will show the Class chooser dialog and update the given
   * selection holder with the selected value.
   *
   * @param context The context ...
   * @param key The key used to retrieve the localized text from the given context's <code>
   *     ResourceRepository</code>
   * @param classRepositoryHolder The holder of the {@link
   *     org.eclipse.persistence.tools.workbench.scplugin.model.meta.ClassRepository} used to
   *     retrieve the list of classes
   * @param selectionHolder The holder of the selected item if set, otherwise the value will remain
   *     <code>null</code>
   * @return The new <code>JButton</code>
   */
  public static JButton buildBrowseButton(
      WorkbenchContextHolder contextHolder,
      String key,
      ValueModel classRepositoryHolder,
      PropertyValueModel selectionHolder) {
    ResourceRepository repository =
        contextHolder.getWorkbenchContext().getApplicationContext().getResourceRepository();

    JButton browseButton = new JButton();
    browseButton.setText(repository.getString(key));
    browseButton.setMnemonic(repository.getMnemonic(key));
    browseButton.setDisplayedMnemonicIndex(repository.getMnemonicIndex(key));
    browseButton.setName(key);

    BrowseAction action = new BrowseAction(contextHolder, classRepositoryHolder, selectionHolder);
    browseButton.addActionListener(action);

    installBrowseButtonEnabler(classRepositoryHolder, browseButton);

    return browseButton;
  }
コード例 #3
0
 public void actionPerformed(ActionEvent e) {
   promptForType(
       contextHolder.getWorkbenchContext(),
       (ClassDescriptionRepository) classRepositoryHolder.getValue(),
       selectionHolder);
 }
コード例 #4
0
  private static JPanel buildContainerOptionsBrowser(
      final WorkbenchContextHolder holder,
      final PropertyValueModel subjectHolder,
      final JPanel subPanel,
      final String topicId) {

    GridBagConstraints constraints = new GridBagConstraints();

    HelpManager help = holder.getWorkbenchContext().getApplicationContext().getHelpManager();

    JPanel container = new JPanel(new GridBagLayout());
    String advancedContainerOptionsTitle =
        holder
            .getWorkbenchContext()
            .getApplicationContext()
            .getResourceRepository()
            .getString("COLLECTION_OPTIONS_ADVANCED_BUTTON");

    subPanel.setVisible(false);
    subPanel.setBorder(
        buildTitledBorder(
            holder.getWorkbenchContext().getApplicationContext().getResourceRepository(),
            "COLLECTION_OPTIONS_ADVANCED_BUTTON"));

    JButton button =
        buildButton(
            "COLLECTION_OPTIONS_ADVANCED_BUTTON",
            holder.getWorkbenchContext().getApplicationContext().getResourceRepository());
    String buttonText = button.getText();
    buttonText += " >>";
    button.setText(buttonText);

    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.LINE_START;
    constraints.insets = new Insets(0, 0, 0, 0);

    help.addTopicID(button, topicId + ".advancedContainerOptions");
    container.add(button, constraints);

    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.CENTER;
    constraints.insets = new Insets(0, 0, 0, 0);

    help.addTopicID(subPanel, topicId + ".advancedContainerOptions");
    container.add(subPanel, constraints);

    button.addActionListener(
        MappingComponentFactory.buildAdvancedCollectionOptionsButtonActionListener(
            button, subPanel, advancedContainerOptionsTitle));

    return container;
  }