/* (non-Javadoc)
   * @see de.jwic.base.Control#actionPerformed(java.lang.String, java.lang.String)
   */
  @Override
  public void actionPerformed(String actionId, String parameter) {
    if ("undoChanges".equalsIgnoreCase(actionId)) {

      tableModel.getUserConfigHandler().updateRelatedConfig(true);
      onCancel(); // to close the window

    } else if ("saveCurrent".equalsIgnoreCase(actionId)) {

      tableModel.getUserConfigHandler().updateRelatedConfig(false);
      onCancel(); // to close the window

    } else if ("saveNew".equalsIgnoreCase(actionId)) {

      final IUserViewConfiguration uvc =
          tableModel.getUserConfigHandler().createConfigWithCurrentSettings();
      UserViewConfigurationControl ctrl = createUserConfigControl(uvc, true);
      ctrl.actionEdit();

      ctrl.addListener(
          new IUserViewConfigurationControlListener() {
            @Override
            public void onConfigDeleted(Event event) {}

            @Override
            public void onConfigApplied(Event event) {}

            @Override
            public void onConfigUpdated(Event event) {
              // if it's a new config created from current settings, we need to apply it after it's
              // saved, to make it the main one
              tableModel.getUserConfigHandler().applyConfig(uvc);
            }
          });
    } else if ("loadProfile".equalsIgnoreCase(actionId)) {
      // to prevent opening the dialog multiple times
      if (loadProfileWindow != null) {
        return;
      }

      loadProfileWindow =
          new LoadProfileWindow(ExtendedApplication.getInstance(this).getSite(), tableModel);
      loadProfileWindow.addDialogWindowListener(
          new DialogWindowAdapter() {
            @Override
            public void onDialogAborted(DialogEvent event) {
              loadProfileWindow = null;
            }
          });
      loadProfileWindow.show();
    }
  }
 public void closeProfileWindow() {
   if (loadProfileWindow != null) {
     loadProfileWindow.close();
     loadProfileWindow = null;
   }
 }