/**
   * Constructor
   *
   * @param objectID Enters the identification of object.
   */
  public SwingInspector(Integer objectID) {
    super(MessagesGED.property_list, INSPECTORUUID);
    instance = this;

    setAssociatedXMLIDForHelp("quickged");

    buildMenuBar();
    addMenuBar(menuBar);

    ToolBar toolBar = ScilabToolBar.createToolBar();
    ((SwingScilabToolBar) toolBar.getAsSimpleToolBar())
        .add(ShowHide.createButton(MessagesGED.hide));
    toolBar.addSeparator();

    guiComponents();
    new SwapObject(objectID);

    setContentPane(desktop);
    WindowsConfigurationManager.restorationFinished(this);
    addToolBar(toolBar);
  }
  /**
   * Create a JTable with data Model.
   *
   * @param columnsName : Titles of JTable columns.
   */
  public SwingScilabVariableBrowser(String[] columnsName, int[] aligment) {
    super(UiDataMessages.VARIABLE_BROWSER, VARBROWSERUUID);

    setAssociatedXMLIDForHelp("browsevar");

    buildMenuBar();
    addMenuBar(menuBar);

    ToolBar toolBar = ScilabToolBar.createToolBar();
    toolBar.add(RefreshAction.createButton(UiDataMessages.REFRESH));
    toolBar.addSeparator();
    toolBar.add(ModifyAction.createButton(this, UiDataMessages.MODIFY));
    toolBar.add(DeleteAction.createButton(this, UiDataMessages.DELETE));
    toolBar.addSeparator();
    toolBar.add(HelpAction.createButton(UiDataMessages.HELP));
    filteringButton = ScilabVarFilteringButtonAction.createButton("Show/hide Scilab variable");
    //        toolBar.add(filteringButton);
    addToolBar(toolBar);

    dataModel = new SwingTableModel<Object>(columnsName);

    table =
        new JTable(dataModel) {
          // Implement table cell tool tips.
          public String getToolTipText(MouseEvent e) {
            String tip = null;
            TableModel model = ((JTable) e.getSource()).getModel();
            java.awt.Point p = e.getPoint();
            int rowIndex = rowAtPoint(p);

            if (rowIndex >= 0) {
              rowIndex = convertRowIndexToModel(rowIndex);
              int colIndex = columnAtPoint(p);
              if (colIndex == BrowseVar.TYPE_DESC_COLUMN_INDEX) {
                  /* Scilab type */
                try {
                  tip =
                      Messages.gettext("Scilab type:")
                          + " "
                          + model.getValueAt(rowIndex, BrowseVar.TYPE_COLUMN_INDEX).toString();
                } catch (IllegalArgumentException exception) {
                  /* If the type is not known/managed, don't crash */
                }
              } else {

                if (colIndex == BrowseVar.SIZE_COLUMN_INDEX) {
                  /* Use the getModel() method because the
                   * column 5 has been removed from display
                   * but still exist in the model */
                  tip =
                      Messages.gettext("Bytes:")
                          + " "
                          + model.getValueAt(rowIndex, BrowseVar.BYTES_COLUMN_INDEX).toString();
                }
              }
            }
            return tip;
          }
        };

    table.setFillsViewportHeight(true);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    table.setAutoCreateRowSorter(true);

    /* Size of the icon column */
    table.getColumnModel().getColumn(0).setPreferredWidth(30);

    /* Hide the columns. But keep it in memory for the tooltip */
    TableColumn column = table.getColumnModel().getColumn(BrowseVar.NB_COLS_INDEX);
    table.removeColumn(column);

    /* The order to removing does matter since it changes the positions */

    column = table.getColumnModel().getColumn(BrowseVar.NB_ROWS_INDEX);
    table.removeColumn(column);

    column = table.getColumnModel().getColumn(BrowseVar.TYPE_COLUMN_INDEX);
    table.removeColumn(column);

    column = table.getColumnModel().getColumn(BrowseVar.FROM_SCILAB_COLUMN_INDEX);
    table.removeColumn(column);

    column = table.getColumnModel().getColumn(BrowseVar.BYTES_COLUMN_INDEX);
    table.removeColumn(column);

    table.addMouseListener(new BrowseVarMouseListener());
    // Mouse selection mode
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setCellSelectionEnabled(true);

    table.setBackground(Color.WHITE);
    if (table.getGridColor().equals(Color.WHITE)) {
      table.setGridColor(new Color(128, 128, 128));
    }
    table.setShowHorizontalLines(true);
    table.setShowVerticalLines(true);

    for (int i = 0; i < aligment.length; i++) {
      align(table, columnsName[i], aligment[i]);
    }

    // Plug the shortcuts
    ExportToCsvAction.registerAction(this, table);

    JScrollPane scrollPane = new JScrollPane(table);
    setContentPane(scrollPane);
    WindowsConfigurationManager.restorationFinished(this);
  }