@Test
 public void testToStringObjectArray() {
   assertEquals("a, b or \"c d\"", ToStringUtils.toOrString(new Object[] {"a", "b", "c d"}));
   assertEquals("0, 0.1 or false", ToStringUtils.toOrString(new Object[] {0, 0.1f, false}));
   assertEquals("a", ToStringUtils.toOrString(new Object[] {"a"}));
   assertEquals("", ToStringUtils.toOrString(new Object[] {}));
 }
 @Test
 public void testFormatHumanReadable() {
   assertEquals("Shop Name", ToStringUtils.formatHumanReadable("shopName"));
   assertEquals("Current Row No", ToStringUtils.formatHumanReadable("currentRowNo"));
   assertEquals("Id", ToStringUtils.formatHumanReadable("id"));
   assertEquals("Active Z", ToStringUtils.formatHumanReadable("activeZ"));
   assertEquals("Active Z", ToStringUtils.formatHumanReadable("ActiveZ"));
   assertEquals("Active ZZ", ToStringUtils.formatHumanReadable("ActiveZZ"));
   assertEquals("Is DNA Available", ToStringUtils.formatHumanReadable("isDNAAvailable"));
   assertEquals("E Shop", ToStringUtils.formatHumanReadable("eShop"));
   assertEquals("E DNA", ToStringUtils.formatHumanReadable("eDNA"));
 }
  @Test
  public void testToStringListOfT() {
    final List<Object> l = new ArrayList<Object>();
    l.add("a");
    l.add("b");
    l.add("c d");
    assertEquals("a, b or \"c d\"", ToStringUtils.toOrString(l));

    l.clear();
    l.add(0);
    l.add(0.1f);
    l.add(false);
    assertEquals("0, 0.1 or false", ToStringUtils.toOrString(l));

    l.clear();
    assertEquals("", ToStringUtils.toOrString(l));
  }
  /**
   * Checks if any current {@link IScriptDependency} match the specified notification.
   *
   * <p>If one does match, all associated expressions are re-evaluated.
   *
   * @param msg the notification to check
   */
  protected void checkChangedDependencies(Notification msg) {
    final EList<IScriptDependency> dList = getDependencies().get(msg.getNotifier());

    /*
     * Should probably never happen!
     */
    if (dList == null) return;

    for (final IScriptDependency d : dList) {
      if (d.getFeature() != msg.getFeature()) {
        continue;
      }

      if (d.getIndex() != -1) {
        if (d.getIndex() != msg.getPosition()) {
          continue;
        }
      }

      if (d.getKey() != null) {
        // TODO
        LogUtils.debug(this, "key=" + d.getKey() + "\nmsg=" + ToStringUtils.toString(msg));
      }

      /*
       * We have a match...
       */
      for (final IScriptExpression e : d.getExpressions()) {
        IManagerRunnable.Factory.asyncExec(
            "evaluate",
            e,
            new Runnable() {
              @Override
              public void run() {
                e.evaluate();
              }
            });
      }
    }
  }
  @Override
  protected void createFieldEditors() {
    final INavigatorManager manager = INavigatorManager.Factory.getManager();
    FieldEditor editor;

    final IManager uim = IManager.Factory.getManager();
    for (final CEObjectHolder<EObject> pmt : manager.getPreferenceModelTypes()) {
      final IEditorInformation mt = manager.getEditorInformation(pmt.getObjectClass());

      final String[][] translation = new String[mt.getEditors().size()][];
      for (int i = 0; i < translation.length; i++) {
        final IEditorPartDescriptor d = mt.getEditors().get(i);
        translation[i] = new String[] {d.getName(), d.getId()};
      }

      // IBindingObjectInformation.Factory.getLabel(mt.g) - upps - no class yet, just a name
      /*
       * TODO: change this to use a proper binding
       *
       * IBindingObjectInformation
       */
      String n = mt.getModelType();
      if (n.lastIndexOf('.') != -1) {
        n = n.substring(n.lastIndexOf('.') + 1);
      }
      if (n.matches("^I[A-Z]")) {
        n = n.substring(1);
      }
      String name = ToStringUtils.formatHumanReadable(n);
      final IModelClassInfo info = uim.getModelClassInfo(mt.getModelType(), null, false);
      if (info != null) {
        final Object l = info.getArguments().get(Constants.ARG_LABEL);
        if (l != null && l instanceof String) {
          name = (String) l;
        }
      }
      editor = new ComboFieldEditor(mt.getModelType(), name, translation, getFieldEditorParent());

      addField(editor);
    }

    editor =
        new BooleanFieldEditor(
            NavigatorConstants.PREF_USE_GENERIC_EDITOR_PART_FALLBACK,
            "Fall back on generic editor part",
            getFieldEditorParent());
    addField(editor);

    editor =
        new BooleanFieldEditor(
            NavigatorConstants.PREF_OPEN_MUST_OPEN_NEW,
            "Open command should open new editors",
            getFieldEditorParent());
    addField(editor);

    editor =
        new BooleanFieldEditor(
            NavigatorConstants.PREF_SHOW_PIN_EDITOR_CONTRIBUTION,
            "Show 'pin editor' contribution in menus and toolbars",
            getFieldEditorParent());
    addField(editor);

    editor =
        new BooleanFieldEditor(
            NavigatorConstants.PREF_PIN_EDITOR_BY_DEFAULT,
            "Pin new editors by default",
            getFieldEditorParent());
    addField(editor);

    editor =
        new BooleanFieldEditor(
            NavigatorConstants.PREF_SHOW_CLONE_EDITOR_CONTRIBUTION,
            "Show 'clone editor' contribution in menus and toolbars",
            getFieldEditorParent());
    addField(editor);

    editor =
        new BooleanFieldEditor(
            NavigatorConstants.PREF_SHOW_CLONE_EDITOR_CONTRIBUTION,
            "Show other contribution in menus and toolbars",
            getFieldEditorParent());
    addField(editor);
  }