Пример #1
0
  @Override
  public List<String> getHeaderColumns() {
    if (headerColumns == null) {
      headerColumns = new ArrayList<>();
      Row row = dataSheet.getRow(0);

      int colCount = row != null ? row.getLastCellNum() : 0;

      if (row == null || colCount == 0) {
        LogMgr.logError(
            "ExcelReader.getHeaderColumns()",
            "Cannot retrieve column names because no data is available in the first row of the sheet: "
                + dataSheet.getSheetName(),
            null);
        String msg = ResourceMgr.getFormattedString("ErrExportNoCols", dataSheet.getSheetName());
        messages.append(msg);
        messages.appendNewLine();
        return headerColumns;
      }

      for (int i = 0; i < colCount; i++) {
        Cell cell = row.getCell(i);
        Object value = getCellValue(cell);

        if (value != null) {
          headerColumns.add(value.toString());
        } else {
          headerColumns.add("Col" + Integer.toString(i));
        }
      }
    }
    return headerColumns;
  }
Пример #2
0
  @Override
  public void executeAction(ActionEvent e) {
    String text = client.getSelectedText();
    if (StringUtil.isBlank(text)) {
      Toolkit.getDefaultToolkit().beep();
      return;
    }

    AddMacroPanel panel = new AddMacroPanel(this.macroClientId);

    ValidatingDialog dialog =
        ValidatingDialog.createDialog(
            SwingUtilities.getWindowAncestor(client),
            panel,
            ResourceMgr.getString("TxtGetMacroNameWindowTitle"),
            null,
            0,
            true);

    dialog.addWindowListener(panel);
    dialog.setVisible(true);

    if (!dialog.isCancelled()) {
      MacroGroup group = panel.getSelectedGroup();
      String name = panel.getMacroName();
      if (StringUtil.isNonBlank(name) && group != null) {
        MacroManager.getInstance()
            .getMacros(macroClientId)
            .addMacro(group, new MacroDefinition(name, text));
      }
    }
  }
Пример #3
0
  public void retrieve() {
    initGui();

    if (this.dbConnection == null) return;
    if (this.reader == null) return;
    if (this.isRetrieving) return;

    if (!WbSwingUtilities.isConnectionIdle(this, this.dbConnection)) return;

    try {
      this.reset();
      this.dbConnection.setBusy(true);
      this.isRetrieving = true;
      this.infoLabel.setText(ResourceMgr.getString("MsgRetrieving"));
      WbSwingUtilities.showWaitCursorOnWindow(this);

      DataStore ds = reader.getTriggers(currentCatalog, currentSchema);
      final DataStoreTableModel model = new DataStoreTableModel(ds);

      WbSwingUtilities.invoke(
          () -> {
            infoLabel.showObjectListInfo(model);
            triggerList.setModel(model, true);
          });
      shouldRetrieve = false;
    } catch (OutOfMemoryError mem) {
      WbManager.getInstance().showOutOfMemoryError();
    } catch (Throwable e) {
      LogMgr.logError("ProcedureListPanel.retrieve() thread", "Could not retrieve trigger list", e);
    } finally {
      this.isRetrieving = false;
      this.dbConnection.setBusy(false);
      WbSwingUtilities.showDefaultCursorOnWindow(this);
    }
  }
 public EditorTabSelectMenu(
     String label,
     String tooltipKeyNewTab,
     String tooltipKeyTab,
     MainWindow parent,
     boolean includeClipboard) {
   super(label);
   parentWindow = parent;
   newTabTooltip = ResourceMgr.getDescription(tooltipKeyNewTab, true);
   regularTooltip = ResourceMgr.getDescription(tooltipKeyTab, true);
   withClipboard = includeClipboard;
   if (parentWindow != null) {
     parentWindow.addFilenameChangeListener(this);
     parentWindow.addTabChangeListener(this);
   }
 }
  private List<DbObject> retrieveObjects(Set<String> types) throws SQLException {
    if (this.monitor != null) {
      monitor.setMonitorType(RowActionMonitor.MONITOR_PLAIN);
      monitor.setCurrentObject(ResourceMgr.getString("MsgRetrievingTables"), -1, -1);
    }
    List<DbObject> result = CollectionUtil.sizedArrayList(50);

    String[] typeNames = new String[types.size()];
    int i = 0;
    for (String type : types) {
      if (type != null) {
        // the JDBC calls all use upper-case type names, even
        // if the DBMS stores them lower case
        typeNames[i] = type.toUpperCase();
        i++;
      }
    }

    for (String schema : schemas) {
      for (String name : names) {
        if (cancelSearch) return null;
        List<TableIdentifier> objects =
            connection.getMetadata().getObjectList(name, schema, typeNames);
        result.addAll(objects);
      }
    }
    return result;
  }
  public DataDisplayOptions() {
    super();
    initComponents();
    ComboBoxModel model =
        new DefaultComboBoxModel(
            new String[] {
              ResourceMgr.getString("TxtTabRight"), ResourceMgr.getString("TxtTabLeft")
            });
    alignmentDropDown.setModel(model);

    WbSwingUtilities.setMinimumSizeFromCols(defMaxRows);
    WbSwingUtilities.setMinimumSizeFromCols(nullString);
    WbSwingUtilities.setMinimumSizeFromCols(maxRowHeight);
    WbSwingUtilities.setMinimumSizeFromCols(multiLineThreshold);
    WbSwingUtilities.setMinimumSizeFromCols(minColSizeField);
    WbSwingUtilities.setMinimumSizeFromCols(maxColSizeField);
    WbSwingUtilities.makeEqualWidth(nullString, defMaxRows, alignmentDropDown);
  }
Пример #7
0
 public FindAction(Searchable aClient) {
   super();
   this.client = aClient;
   this.initMenuDefinition(
       "MnuTxtFind",
       KeyStroke.getKeyStroke(KeyEvent.VK_F, PlatformShortcuts.getDefaultModifier()));
   this.setIcon("find");
   this.setMenuItemName(ResourceMgr.MNU_TXT_EDIT);
   this.setCreateToolbarSeparator(true);
   this.setDescriptiveName(ResourceMgr.getString("TxtEdPrefix") + " " + getMenuLabel());
 }
  public WindowTitleOptionsPanel() {
    super();
    initComponents();
    // It is important to add these in the correct order
    // which is defined by the numeric values from Settings.SHOW_NO_FILENAME
    // SHOW_FILENAME and SHOW_FULL_PATH
    this.windowTitleComboBox.addItem(ResourceMgr.getString("TxtShowNone"));
    this.windowTitleComboBox.addItem(ResourceMgr.getString("TxtShowName"));
    this.windowTitleComboBox.addItem(ResourceMgr.getString("TxtShowPath"));

    WbTraversalPolicy policy = new WbTraversalPolicy();
    policy.addComponent(productAtEnd);
    policy.addComponent(showProfileGroup);
    policy.addComponent(showWorkspace);
    policy.addComponent(windowTitleComboBox);
    policy.setDefaultComponent(productAtEnd);

    this.encloseChar.insertItemAt(ResourceMgr.getString("TxtNothingItem"), 0);
    this.setFocusTraversalPolicy(policy);
    this.setFocusCycleRoot(false);
    this.restoreSettings();
  }
 private List<DbObject> retrieveTriggers() throws SQLException {
   if (this.monitor != null) {
     monitor.setMonitorType(RowActionMonitor.MONITOR_PLAIN);
     monitor.setCurrentObject(ResourceMgr.getString("MsgRetrievingTriggers"), -1, -1);
   }
   TriggerReader trgReader = TriggerReaderFactory.createReader(connection);
   List<DbObject> result = CollectionUtil.sizedArrayList(50);
   for (String schema : schemas) {
     if (cancelSearch) return null;
     List<TriggerDefinition> triggers = trgReader.getTriggerList(null, schema, null);
     result.addAll(triggers);
   }
   return result;
 }
  private List<DbObject> retrieveProcedures() throws SQLException {
    if (this.monitor != null) {
      monitor.setMonitorType(RowActionMonitor.MONITOR_PLAIN);
      monitor.setCurrentObject(ResourceMgr.getString("MsgRetrievingProcedures"), -1, -1);
    }
    List<DbObject> result = CollectionUtil.sizedArrayList(50);
    ProcedureReader reader = connection.getMetadata().getProcedureReader();
    if (reader == null) return result;

    for (String schema : schemas) {
      for (String name : names) {
        if (cancelSearch) return null;
        List<ProcedureDefinition> procs = reader.getProcedureList(null, schema, name);
        result.addAll(procs);
      }
    }
    return result;
  }
Пример #11
0
  public void openEditWindow() {
    if (!table.isEditing()) return;

    int col = table.getEditingColumn();
    int row = table.getEditingRow();
    String data = null;
    TableCellEditor editor = table.getCellEditor();

    if (editor instanceof WbTextCellEditor) {
      WbTextCellEditor wbeditor = (WbTextCellEditor) editor;
      if (table.isEditing() && wbeditor.isModified()) {
        data = wbeditor.getText();
      } else {
        data = table.getValueAsString(row, col);
      }
    } else {
      data = (String) editor.getCellEditorValue();
    }

    Window owner = SwingUtilities.getWindowAncestor(table);
    Frame ownerFrame = null;
    if (owner instanceof Frame) {
      ownerFrame = (Frame) owner;
    }

    String title = ResourceMgr.getString("TxtEditWindowTitle");
    EditWindow w = new EditWindow(ownerFrame, title, data);
    try {
      w.setVisible(true);
      if (editor != null) {
        // we need to "cancel" the editor so that the data
        // in the editor component will not be written into the
        // table model!
        editor.cancelCellEditing();
      }
      if (!w.isCancelled()) {
        table.setValueAt(w.getText(), row, col);
      }
    } finally {
      w.dispose();
    }
  }
/** @author Thomas Kellerer */
public class InsertColumnMatcher {
  private List<InsertColumnInfo> columns;
  private boolean isInsert;
  private String noValue = "<" + ResourceMgr.getString("TxtNoValue") + ">";

  public InsertColumnMatcher(WbConnection conn, String sql) {
    analyzeStatement(conn, sql);
  }

  InsertColumnMatcher(String sql) {
    analyzeStatement(null, sql);
  }

  public boolean isInsertStatement() {
    return isInsert;
  }

  private void analyzeStatement(WbConnection conn, String sql) {
    try {
      Set<String> verbs = CollectionUtil.caseInsensitiveSet("INSERT", "MERGE");

      SQLLexer lexer = SQLLexerFactory.createLexer(conn, sql);
      SQLToken token = lexer.getNextToken(false, false);

      if (token == null || !verbs.contains(token.getContents())) {
        isInsert = false;
        columns = Collections.emptyList();
        return;
      }

      boolean afterValues = false;

      if (token.getContents().equals("MERGE")) {
        // "fast forward" to the actual INSERT part
        // so that the following code does not need to handle any "noise" before the actual insert
        while (token != null) {
          if (token.getContents().equals("INSERT")) break;
          token = lexer.getNextToken(false, false);
        }
      }

      List<ElementInfo> columnEntries = null;
      List<List<ElementInfo>> rowValues = new ArrayList<>(1);

      int bracketCount = 0;
      boolean isSubSelect = false;

      while (token != null) {
        String text = token.getContents();
        if (token.getContents().equals(")")) {
          bracketCount--;
        } else if (token.getContents().equals("(") && !afterValues) {
          bracketCount++;
          if (bracketCount == 1) {
            columnEntries = getListValues(lexer, token.getCharEnd(), sql);
            // getListValues() terminated at the closing bracket
            // so the bracket count must be decreased here again.
            bracketCount--;
          }
        } else if (token.getContents().equals("(") && afterValues) {
          bracketCount++;
          if (bracketCount == 1) {
            rowValues.add(getListValues(lexer, token.getCharEnd(), sql));
            bracketCount--;
          }
        } else if (token.getContents().equals("VALUES")) {
          afterValues = true;
        } else if (text.equals("SELECT") || text.equals("WITH")) {
          String subSelect = sql.substring(token.getCharBegin());
          List<ElementInfo> entries = SqlUtil.getColumnEntries(subSelect, true, conn);
          for (ElementInfo element : entries) {
            element.setOffset(token.getCharBegin());
          }
          rowValues.add(entries);
          isSubSelect = true;
          break; // no need to go any further, it's an INSERT ... SELECT statement
        }
        token = lexer.getNextToken(false, false);
      }

      int maxValues = -1;
      for (List<ElementInfo> values : rowValues) {
        if (values.size() > maxValues) {
          maxValues = values.size();
        }
      }

      int maxElements = columnEntries.size() > maxValues ? columnEntries.size() : maxValues;
      columns = new ArrayList<>(maxElements);
      for (int i = 0; i < maxElements; i++) {
        InsertColumnInfo info = new InsertColumnInfo();
        if (i < columnEntries.size()) {
          info.columnStart = columnEntries.get(i).getStartPosition();
          info.columnEnd = columnEntries.get(i).getEndPosition();
          info.columnName = columnEntries.get(i).getElementValue();
        } else {
          info.columnStart = -1;
          info.columnEnd = -1;
          info.columnName = null;
        }
        for (List<ElementInfo> entries : rowValues) {
          if (i < entries.size()) {
            info.addValue(
                entries.get(i).getElementValue(),
                entries.get(i).getStartPosition(),
                entries.get(i).getEndPosition());
          } else {
            info.addValue(null, -1, -1);
          }
        }
        columns.add(info);
      }
      if (isSubSelect) {
        adjustValueStarts();
      }
    } catch (Exception e) {
      if (columns == null) {
        columns = Collections.emptyList();
      }
      LogMgr.logError(
          "InsertColumnMatcher.analyzeStatemet()", "Could not analyze statement: " + sql, e);
    }
  }

  /**
   * The start position of sub-select columns does not consider whitespace before the column name.
   * It is always the start of the actual column name. This is not correct for tooltip hinting (as
   * the "start of the column is right behind the previous comma), so we need to adjust those
   * values.
   */
  private void adjustValueStarts() {
    for (int i = 0; i < columns.size() - 1; i++) {
      InsertColumnInfo current = columns.get(i);
      InsertColumnInfo next = columns.get(i + 1);
      for (int v = 0; v < next.values.size(); v++) {
        if (next.values.get(v).valueStart > 0 && next.values.get(v).valueEnd > 0) {
          next.values.get(v).valueStart = current.values.get(v).valueEnd - 1;
        }
      }
    }
  }

  private List<ElementInfo> getListValues(SQLLexer lexer, int lastStart, String sql) {
    List<ElementInfo> result = new ArrayList<>();

    int bracketCount = 1;
    int lastComma = lastStart;
    SQLToken token = lexer.getNextToken(false, false);
    while (token != null) {
      String c = token.getText();
      if (c.equals("(")) {
        bracketCount++;
      } else if (c.equals(")")) {
        bracketCount--;
        if (bracketCount == 0) {
          ElementInfo info =
              new ElementInfo(
                  sql.substring(lastComma, token.getCharBegin()).trim(),
                  lastComma,
                  token.getCharBegin());
          result.add(info);
          break;
        }
      } else if (c.equals(",") && bracketCount == 1) {
        ElementInfo info =
            new ElementInfo(
                sql.substring(lastComma, token.getCharBegin()).trim(),
                lastComma,
                token.getCharBegin());
        result.add(info);
        lastComma = token.getCharEnd();
      }
      token = lexer.getNextToken(false, false);
    }
    return result;
  }

  public boolean inValueList(int position) {
    for (InsertColumnInfo info : columns) {
      for (ColumnValueInfo valInfo : info.values) {
        if (valInfo.valueStart <= position && valInfo.valueEnd >= position) {
          return true;
        }
      }
    }
    return false;
  }

  public boolean inColumnList(int position) {
    for (InsertColumnInfo info : columns) {
      if (info.columnStart <= position && info.columnEnd >= position) {
        return true;
      }
    }
    return false;
  }

  public List<String> getColumns() {
    if (columns == null) return Collections.emptyList();

    List<String> result = new ArrayList<>(columns.size());
    for (InsertColumnInfo column : columns) {
      result.add(column.columnName);
    }
    return result;
  }

  /**
   * Return the value for the given column name.
   *
   * @param columnName the column to search for
   * @return the value or null if the column was not found
   */
  public String getValueForColumn(String columnName) {
    if (StringUtil.isBlank(columnName)) return null;

    for (InsertColumnInfo info : columns) {
      if (StringUtil.equalStringIgnoreCase(columnName, info.columnName)) {
        return info.getValue();
      }
    }
    return null;
  }

  /**
   * Return the name of the column at the given position.
   *
   * <p>If the cursor is not in the VALUES list, null will be returned.
   *
   * @param position the cursor position.
   * @return the column name or null
   */
  public String getInsertColumnName(int position) {
    for (InsertColumnInfo info : columns) {
      for (ColumnValueInfo valInfo : info.values) {
        if (valInfo.valueStart <= position && valInfo.valueEnd >= position) {
          return info.columnName;
        }
      }
    }
    return null;
  }

  /**
   * Return the tooltip text for the given cursor position. If the cursor is in the column list, the
   * tooltip will contain the column's value. If the cursor is in the values list, it returns the
   * column's name
   *
   * @param position
   * @return the value or column name. null if position is invalid
   */
  public String getTooltipForPosition(int position) {
    for (InsertColumnInfo info : columns) {
      if (info.columnStart <= position && info.columnEnd >= position) {
        return info.getValue();
      }
      for (ColumnValueInfo valInfo : info.values) {
        if (valInfo.valueStart <= position && valInfo.valueEnd >= position) {
          return info.columnName;
        }
      }
    }
    return null;
  }

  private class InsertColumnInfo {
    int columnStart;
    int columnEnd;
    String columnName;
    List<ColumnValueInfo> values = new ArrayList<>(1);

    void addValue(String value, int valueStart, int valueEnd) {
      values.add(new ColumnValueInfo(value, valueStart, valueEnd));
    }

    String getValue() {
      if (values.isEmpty()) {
        return null;
      }
      if (values.size() == 1) {
        return values.get(0).value;
      }
      StringBuilder result = new StringBuilder(values.size() * 5);
      result.append('[');
      for (int i = 0; i < values.size(); i++) {
        if (i > 0) result.append(", ");
        String value = values.get(i).value;
        if (StringUtil.isBlank(value)) {
          result.append(noValue);
        } else {
          result.append(values.get(i).value);
        }
      }
      result.append(']');
      return result.toString();
    }
  }

  private class ColumnValueInfo {
    int valueStart;
    int valueEnd;
    String value;

    ColumnValueInfo(String value, int valueStart, int valueEnd) {
      this.valueStart = valueStart;
      this.valueEnd = valueEnd;
      this.value = value;
    }

    @Override
    public String toString() {
      return value;
    }
  }
}
  protected final synchronized void updateMenu() {
    if (parentWindow == null) return;

    List<String> panels = this.parentWindow.getPanelLabels();
    if (CollectionUtil.isEmpty(panels)) return;

    int count = this.getItemCount();
    // Make sure none of the items has an ActionListener attached
    for (int i = 0; i < count; i++) {
      JMenuItem item = this.getItem(i);
      if (item != null && target != null) {
        item.removeActionListener(target);
      }
    }

    this.removeAll();

    int current = this.parentWindow.getCurrentPanelIndex();

    JMenuItem show = new WbMenuItem(ResourceMgr.getString("LblShowDataInNewTab"));
    show.setActionCommand(PANEL_CMD_PREFIX + "-1");
    show.setToolTipText(newTabTooltip);
    show.addActionListener(target == null ? this : target);
    this.add(show);

    if (withClipboard) {
      JMenuItem clipboard = new WbMenuItem(ResourceMgr.getString("MnuTxtStmtClip"));
      clipboard.setToolTipText(ResourceMgr.getDescription("MnuTxtStmtClip", true));
      clipboard.setActionCommand(CMD_CLIPBOARD);
      clipboard.addActionListener(target);
      this.add(clipboard);
    }

    Font boldFont = show.getFont();
    if (boldFont != null) boldFont = boldFont.deriveFont(Font.BOLD);

    addSeparator();

    for (int i = 0; i < panels.size(); i++) {
      if (panels.get(i) == null) continue;

      String menuText = panels.get(i);
      if (i < 9) {
        menuText += " &" + NumberStringCache.getNumberString(i + 1);
      } else {
        menuText += NumberStringCache.getNumberString(i + 1);
      }
      JMenuItem item = new WbMenuItem(menuText);

      item.setActionCommand(
          EditorTabSelectMenu.PANEL_CMD_PREFIX + NumberStringCache.getNumberString(i));
      if (i == current && boldFont != null) {
        item.setFont(boldFont);
      }

      // The tooltip is the same for all items
      item.setToolTipText(regularTooltip);
      item.addActionListener(target == null ? this : target);
      this.add(item);
    }

    List<TableIdentifier> tables = DbObjectList.Util.getSelectedTableObjects(objectList);
    setEnabled(tables.size() > 0);
  }
Пример #14
0
  private void _initGui() {
    if (initialized) return;

    Reloadable sourceReload =
        () -> {
          if (dbConnection == null) return;
          if (dbConnection.isBusy()) return;
          retrieveCurrentTrigger();
        };

    this.source = new DbObjectSourcePanel(parentWindow, sourceReload);
    if (DbExplorerSettings.allowSourceEditing()) {
      source.allowEditing(true);
    }

    JPanel listPanel = new JPanel();
    this.triggerList = new WbTable(true, false, false);

    this.triggerList.setRendererSetup(RendererSetup.getBaseSetup());
    this.triggerList.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    this.triggerList.setCellSelectionEnabled(false);
    this.triggerList.setColumnSelectionAllowed(false);
    this.triggerList.setRowSelectionAllowed(true);
    this.triggerList.getSelectionModel().addListSelectionListener(this);
    this.triggerList
        .getSelectionModel()
        .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    this.triggerList.addTableModelListener(this);
    triggerList.setReadOnly(true);

    findPanel = new QuickFilterPanel(this.triggerList, false, "triggerlist");
    findPanel.setFilterOnType(DbExplorerSettings.getFilterDuringTyping());
    findPanel.setAlwaysUseContainsFilter(DbExplorerSettings.getUsePartialMatch());

    ReloadAction a = new ReloadAction(this);
    a.setUseLabelIconSize(true);
    this.findPanel.addToToolbar(a, true, false);
    a.getToolbarButton().setToolTipText(ResourceMgr.getString("TxtRefreshTriggerList"));
    listPanel.setLayout(new BorderLayout());
    listPanel.add((JPanel) findPanel, BorderLayout.NORTH);

    this.splitPane = new WbSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    this.splitPane.setOneTouchExpandable(true);
    this.splitPane.setDividerSize(6);
    WbScrollPane scroll = new WbScrollPane(this.triggerList);

    listPanel.add(scroll, BorderLayout.CENTER);

    infoLabel = new SummaryLabel("");
    listPanel.add(infoLabel, BorderLayout.SOUTH);

    this.splitPane.setLeftComponent(listPanel);
    this.splitPane.setRightComponent(source);
    this.splitPane.setDividerBorder(WbSwingUtilities.EMPTY_BORDER);
    this.setLayout(new BorderLayout());
    this.add(splitPane, BorderLayout.CENTER);

    WbTraversalPolicy pol = new WbTraversalPolicy();
    pol.setDefaultComponent((JPanel) findPanel);
    pol.addComponent((JPanel) findPanel);
    pol.addComponent(this.triggerList);
    this.setFocusTraversalPolicy(pol);
    this.reset();

    WbSelectionModel list = WbSelectionModel.Factory.createFacade(triggerList.getSelectionModel());
    this.dropAction = new DropDbObjectAction(this, list, this);
    triggerList.addPopupAction(dropAction, true);
    this.compileAction = new CompileDbObjectAction(this, list);
    triggerList.addPopupAction(compileAction, false);

    if (dbConnection != null) {
      setConnection(dbConnection);
    }
    this.splitPane.setDividerLocation(0.5d);

    initialized = true;

    restoreSettings();
    if (workspaceProperties != null) {
      readSettings(workspaceProperties, workspaceProperties.getFilterPrefix());
      workspaceProperties = null;
    }
    Settings.getInstance()
        .addPropertyChangeListener(this, DbExplorerSettings.PROP_ALLOW_SOURCE_EDITING);
  }
  public String getWindowTitle(
      ConnectionProfile profile, String workspaceFile, String editorFile, String appName) {
    final StringBuilder title = new StringBuilder(50);

    String enclose = GuiSettings.getTitleGroupBracket();
    String sep = GuiSettings.getTitleGroupSeparator();

    if (appName != null && productNamePosition == NAME_AT_START) {
      title.append(appName);
      title.append(' ');
    }

    if (profile != null) {
      boolean showUser = includeUser || profile.getPromptForUsername();

      if (showURL) {
        String url = makeCleanUrl(profile.getUrl());
        if (showUser) {
          title.append(profile.getLoginUser());
          if (url.charAt(0) != '@') {
            title.append('@');
          }
        }
        title.append(url);
      } else {
        if (profile.getPromptForUsername()) {
          // always display the username if prompted
          title.append(profile.getLoginUser());
          title.append("- ");
        }
        if (showProfileGroup) {
          char open = getOpeningBracket(enclose);
          char close = getClosingBracket(enclose);

          if (open != 0 && close != 0) {
            title.append(open);
          }
          title.append(profile.getGroup());
          if (open != 0 && close != 0) {
            title.append(close);
          }
          if (sep != null) title.append(sep);
        }
        title.append(profile.getName());
      }
    } else if (showNotConnected) {
      if (title.length() > 0) title.append("- ");
      title.append(ResourceMgr.getString("TxtNotConnected"));
    }

    if (workspaceFile != null && showWorkspace) {
      File f = new File(workspaceFile);
      String baseName = f.getName();
      title.append(" - ");
      title.append(baseName);
      title.append(" ");
    }

    int showFilename = GuiSettings.getShowFilenameInWindowTitle();
    if (editorFile != null && showFilename != GuiSettings.SHOW_NO_FILENAME) {
      title.append(" - ");
      if (showFilename == GuiSettings.SHOW_FULL_PATH) {
        title.append(editorFile);
      } else {
        File f = new File(editorFile);
        title.append(f.getName());
      }
    }

    if (appName != null && productNamePosition == NAME_AT_END) {
      if (title.length() > 0) title.append(" - ");
      title.append(appName);
    }

    return title.toString();
  }
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    jLabel1 = new javax.swing.JLabel();
    localeDropDown = new javax.swing.JComboBox();
    generalPanel = new javax.swing.JPanel();
    selectSummary = new javax.swing.JCheckBox();
    retrieveComments = new javax.swing.JCheckBox();
    jLabel5 = new javax.swing.JLabel();
    defMaxRows = new javax.swing.JTextField();
    showRowNumbers = new javax.swing.JCheckBox();
    showMaxRowsWarn = new javax.swing.JCheckBox();
    showMaxRowsTooltip = new javax.swing.JCheckBox();
    showGeneratingSQL = new javax.swing.JCheckBox();
    alignLabel = new javax.swing.JLabel();
    alignmentDropDown = new javax.swing.JComboBox();
    boldHeader = new javax.swing.JCheckBox();
    nullStringLabel = new javax.swing.JLabel();
    nullString = new javax.swing.JTextField();
    appendResults = new javax.swing.JCheckBox();
    useTableName = new javax.swing.JCheckBox();
    colWidthPanel = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    autoColWidth = new javax.swing.JCheckBox();
    includeHeaderWidth = new javax.swing.JCheckBox();
    jPanel4 = new javax.swing.JPanel();
    minColSizeLabel = new javax.swing.JLabel();
    minColSizeField = new NumberField();
    jLabel4 = new javax.swing.JLabel();
    maxColSizeLabel = new javax.swing.JLabel();
    maxColSizeField = new NumberField();
    jLabel6 = new javax.swing.JLabel();
    rowHeightPanel = new javax.swing.JPanel();
    autoRowHeight = new javax.swing.JCheckBox();
    ignoreEmptyRows = new javax.swing.JCheckBox();
    maxRowHeightLabel = new javax.swing.JLabel();
    maxRowHeight = new NumberField();
    rowHeightResize = new javax.swing.JCheckBox();
    multiLinePanel = new javax.swing.JPanel();
    wrapMultineRender = new javax.swing.JCheckBox();
    wrapMultlineEdit = new javax.swing.JCheckBox();
    multilineThresholLabel = new javax.swing.JLabel();
    multiLineThreshold = new NumberField();

    setLayout(new java.awt.GridBagLayout());

    jLabel1.setText(ResourceMgr.getString("LblSortLocale")); // NOI18N
    jLabel1.setToolTipText(ResourceMgr.getString("d_LblSortLocale")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 12, 0, 0);
    add(jLabel1, gridBagConstraints);

    localeDropDown.setModel(
        new javax.swing.DefaultComboBoxModel(
            new String[] {"Item 1", "Item 2", "Item 3", "Item 4"}));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(10, 7, 0, 10);
    add(localeDropDown, gridBagConstraints);

    generalPanel.setLayout(new java.awt.GridBagLayout());

    selectSummary.setText(ResourceMgr.getString("LblSelectionSummary")); // NOI18N
    selectSummary.setToolTipText(ResourceMgr.getString("d_LblSelectionSummary")); // NOI18N
    selectSummary.setBorder(null);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(1, 0, 0, 0);
    generalPanel.add(selectSummary, gridBagConstraints);

    retrieveComments.setText(ResourceMgr.getString("LblRetrieveColComments")); // NOI18N
    retrieveComments.setToolTipText(ResourceMgr.getString("d_LblRetrieveColComments")); // NOI18N
    retrieveComments.setBorder(null);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0);
    generalPanel.add(retrieveComments, gridBagConstraints);

    jLabel5.setLabelFor(defMaxRows);
    jLabel5.setText(ResourceMgr.getString("LblDefMaxRows")); // NOI18N
    jLabel5.setToolTipText(ResourceMgr.getString("d_LblDefMaxRows")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 16, 0, 7);
    generalPanel.add(jLabel5, gridBagConstraints);

    defMaxRows.setColumns(8);
    defMaxRows.setToolTipText(ResourceMgr.getString("d_LblDefMaxRows")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 10);
    generalPanel.add(defMaxRows, gridBagConstraints);

    showRowNumbers.setText(ResourceMgr.getString("LblShowRowNumbers")); // NOI18N
    showRowNumbers.setToolTipText(ResourceMgr.getString("d_LblShowRowNumbers")); // NOI18N
    showRowNumbers.setBorder(null);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0);
    generalPanel.add(showRowNumbers, gridBagConstraints);

    showMaxRowsWarn.setText(ResourceMgr.getString("LblShowMaxRowsWarning")); // NOI18N
    showMaxRowsWarn.setToolTipText(ResourceMgr.getString("d_LblShowMaxRowsWarning")); // NOI18N
    showMaxRowsWarn.setBorder(null);
    showMaxRowsWarn.addActionListener(this);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(6, 16, 0, 0);
    generalPanel.add(showMaxRowsWarn, gridBagConstraints);

    showMaxRowsTooltip.setText(ResourceMgr.getString("LblShowMaxRowsTooltip")); // NOI18N
    showMaxRowsTooltip.setToolTipText(ResourceMgr.getString("d_LblShowMaxRowsTooltip")); // NOI18N
    showMaxRowsTooltip.setBorder(null);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 16, 0, 0);
    generalPanel.add(showMaxRowsTooltip, gridBagConstraints);

    showGeneratingSQL.setText(ResourceMgr.getString("LblShowGenSQL")); // NOI18N
    showGeneratingSQL.setToolTipText(ResourceMgr.getString("d_LblShowGenSQL")); // NOI18N
    showGeneratingSQL.setBorder(null);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
    generalPanel.add(showGeneratingSQL, gridBagConstraints);

    alignLabel.setText(ResourceMgr.getString("LblAlignNum")); // NOI18N
    alignLabel.setToolTipText(ResourceMgr.getString("d_LblAlignNum")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(2, 16, 0, 0);
    generalPanel.add(alignLabel, gridBagConstraints);

    alignmentDropDown.setModel(
        new javax.swing.DefaultComboBoxModel(new String[] {"Left", "Right"}));
    alignmentDropDown.setSelectedItem("Right");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 10);
    generalPanel.add(alignmentDropDown, gridBagConstraints);

    boldHeader.setText(ResourceMgr.getString("LblBoldHeader")); // NOI18N
    boldHeader.setToolTipText(ResourceMgr.getString("d_LblBoldHeader")); // NOI18N
    boldHeader.setBorder(null);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
    generalPanel.add(boldHeader, gridBagConstraints);

    nullStringLabel.setText(ResourceMgr.getString("LblNullString")); // NOI18N
    nullStringLabel.setToolTipText(ResourceMgr.getString("d_LblNullDisp")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(2, 16, 0, 0);
    generalPanel.add(nullStringLabel, gridBagConstraints);

    nullString.setColumns(8);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 10);
    generalPanel.add(nullString, gridBagConstraints);

    appendResults.setText(ResourceMgr.getString("LblAppendDefault")); // NOI18N
    appendResults.setToolTipText(ResourceMgr.getString("d_LblAppendDefault")); // NOI18N
    appendResults.setBorder(null);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 0, 0, 0);
    generalPanel.add(appendResults, gridBagConstraints);

    useTableName.setText(ResourceMgr.getString("LblUseTblName")); // NOI18N
    useTableName.setToolTipText(ResourceMgr.getString("d_LblUseTblName")); // NOI18N
    useTableName.setBorder(null);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 16, 0, 7);
    generalPanel.add(useTableName, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(4, 12, 2, 0);
    add(generalPanel, gridBagConstraints);

    colWidthPanel.setBorder(
        javax.swing.BorderFactory.createTitledBorder(
            ResourceMgr.getString("TxtColWidthSettings"))); // NOI18N
    colWidthPanel.setLayout(new java.awt.GridBagLayout());

    jPanel3.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

    autoColWidth.setText(ResourceMgr.getString("LblAutoColWidth")); // NOI18N
    autoColWidth.setToolTipText(ResourceMgr.getString("d_LblAutoColWidth")); // NOI18N
    autoColWidth.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    autoColWidth.setMargin(new java.awt.Insets(0, 0, 0, 0));
    jPanel3.add(autoColWidth);

    includeHeaderWidth.setText(ResourceMgr.getString("LblIncludeHeaderColWidth")); // NOI18N
    includeHeaderWidth.setToolTipText(
        ResourceMgr.getString("d_LblIncludeHeaderColWidth")); // NOI18N
    includeHeaderWidth.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 10, 0, 0));
    includeHeaderWidth.setMargin(new java.awt.Insets(0, 0, 0, 0));
    jPanel3.add(includeHeaderWidth);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 0.5;
    gridBagConstraints.insets = new java.awt.Insets(5, 1, 0, 0);
    colWidthPanel.add(jPanel3, gridBagConstraints);

    jPanel4.setLayout(new java.awt.GridBagLayout());

    minColSizeLabel.setText(ResourceMgr.getString("LblMinColsize")); // NOI18N
    minColSizeLabel.setToolTipText(ResourceMgr.getString("d_LblMinColsize")); // NOI18N
    minColSizeLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 5, 0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 0, 0, 6);
    jPanel4.add(minColSizeLabel, gridBagConstraints);

    minColSizeField.setColumns(6);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    jPanel4.add(minColSizeField, gridBagConstraints);

    jLabel4.setText("px");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 0);
    jPanel4.add(jLabel4, gridBagConstraints);

    maxColSizeLabel.setText(ResourceMgr.getString("LblMaxColsize")); // NOI18N
    maxColSizeLabel.setToolTipText(ResourceMgr.getString("d_LblMaxColsize")); // NOI18N
    maxColSizeLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 10, 0, 5));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2);
    jPanel4.add(maxColSizeLabel, gridBagConstraints);

    maxColSizeField.setColumns(6);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    jPanel4.add(maxColSizeField, gridBagConstraints);

    jLabel6.setText("px");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 5;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 0);
    jPanel4.add(jLabel6, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 0.5;
    gridBagConstraints.insets = new java.awt.Insets(6, 6, 2, 0);
    colWidthPanel.add(jPanel4, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 8, 0, 7);
    add(colWidthPanel, gridBagConstraints);

    rowHeightPanel.setBorder(
        javax.swing.BorderFactory.createTitledBorder(
            ResourceMgr.getString("TxtRowHeightSettings"))); // NOI18N
    rowHeightPanel.setLayout(new java.awt.GridBagLayout());

    autoRowHeight.setText(ResourceMgr.getString("LblRowHeightAuto")); // NOI18N
    autoRowHeight.setToolTipText(ResourceMgr.getString("LblRowHeightAuto")); // NOI18N
    autoRowHeight.setBorder(null);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
    rowHeightPanel.add(autoRowHeight, gridBagConstraints);

    ignoreEmptyRows.setText(ResourceMgr.getString("LblIgnoreRowHeightEmptyLine")); // NOI18N
    ignoreEmptyRows.setToolTipText(
        ResourceMgr.getString("d_LblIgnoreRowHeightEmptyLine")); // NOI18N
    ignoreEmptyRows.setBorder(null);
    ignoreEmptyRows.setMargin(new java.awt.Insets(0, 10, 0, 0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 2, 0);
    rowHeightPanel.add(ignoreEmptyRows, gridBagConstraints);

    maxRowHeightLabel.setText(ResourceMgr.getString("LblRowHeightMax")); // NOI18N
    maxRowHeightLabel.setToolTipText(ResourceMgr.getString("d_LblRowHeightMax")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 11, 0, 0);
    rowHeightPanel.add(maxRowHeightLabel, gridBagConstraints);

    maxRowHeight.setColumns(8);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(1, 5, 0, 0);
    rowHeightPanel.add(maxRowHeight, gridBagConstraints);

    rowHeightResize.setText(ResourceMgr.getString("LblRowResize")); // NOI18N
    rowHeightResize.setToolTipText(ResourceMgr.getString("d_LblRowResize")); // NOI18N
    rowHeightResize.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    rowHeightResize.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    rowHeightResize.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 11, 2, 0);
    rowHeightPanel.add(rowHeightResize, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 8, 0, 7);
    add(rowHeightPanel, gridBagConstraints);

    multiLinePanel.setBorder(
        javax.swing.BorderFactory.createTitledBorder(
            ResourceMgr.getString("LblMultiLineCols"))); // NOI18N
    multiLinePanel.setLayout(new java.awt.GridBagLayout());

    wrapMultineRender.setText(ResourceMgr.getString("LblMultiWrapRender")); // NOI18N
    wrapMultineRender.setBorder(null);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
    multiLinePanel.add(wrapMultineRender, gridBagConstraints);

    wrapMultlineEdit.setText(ResourceMgr.getString("LblMultiWrapEdit")); // NOI18N
    wrapMultlineEdit.setBorder(null);
    wrapMultlineEdit.setMargin(new java.awt.Insets(0, 10, 0, 0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 2, 0);
    multiLinePanel.add(wrapMultlineEdit, gridBagConstraints);

    multilineThresholLabel.setText(ResourceMgr.getString("LblMultiLineLimit")); // NOI18N
    multilineThresholLabel.setToolTipText(ResourceMgr.getString("d_LblMultiLineLimit")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 11, 0, 0);
    multiLinePanel.add(multilineThresholLabel, gridBagConstraints);

    multiLineThreshold.setColumns(8);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(1, 5, 0, 0);
    multiLinePanel.add(multiLineThreshold, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 8, 0, 7);
    add(multiLinePanel, gridBagConstraints);
  }
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    productAtEnd = new javax.swing.JCheckBox();
    showProfileGroup = new javax.swing.JCheckBox();
    showWorkspace = new javax.swing.JCheckBox();
    windowTitleLabel = new javax.swing.JLabel();
    windowTitleComboBox = new javax.swing.JComboBox();
    encloseCharLabel = new javax.swing.JLabel();
    encloseChar = new javax.swing.JComboBox();
    jPanel1 = new javax.swing.JPanel();
    titleGroupSepLabel = new javax.swing.JLabel();
    titleGroupSep = new javax.swing.JTextField();
    showUrl = new javax.swing.JCheckBox();
    includeUser = new javax.swing.JCheckBox();

    setLayout(new java.awt.GridBagLayout());

    productAtEnd.setText(ResourceMgr.getString("LblShowProductAtEnd")); // NOI18N
    productAtEnd.setToolTipText(ResourceMgr.getString("d_LblShowProductAtEnd")); // NOI18N
    productAtEnd.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 12, 2, 11);
    add(productAtEnd, gridBagConstraints);

    showProfileGroup.setText(ResourceMgr.getString("LblShowProfileGroup")); // NOI18N
    showProfileGroup.setToolTipText(ResourceMgr.getString("d_LblShowProfileGroup")); // NOI18N
    showProfileGroup.setBorder(null);
    showProfileGroup.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    showProfileGroup.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    showProfileGroup.setIconTextGap(5);
    showProfileGroup.addChangeListener(
        new javax.swing.event.ChangeListener() {
          public void stateChanged(javax.swing.event.ChangeEvent evt) {
            showProfileGroupStateChanged(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.gridwidth = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(8, 12, 0, 11);
    add(showProfileGroup, gridBagConstraints);

    showWorkspace.setText(ResourceMgr.getString("LblShowWorkspace")); // NOI18N
    showWorkspace.setToolTipText(ResourceMgr.getString("d_LblShowWorkspace")); // NOI18N
    showWorkspace.setBorder(null);
    showWorkspace.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    showWorkspace.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    showWorkspace.setIconTextGap(5);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.gridwidth = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 12, 0, 1);
    add(showWorkspace, gridBagConstraints);

    windowTitleLabel.setLabelFor(windowTitleComboBox);
    windowTitleLabel.setText(ResourceMgr.getString("LblShowEditorInfo")); // NOI18N
    windowTitleLabel.setToolTipText(ResourceMgr.getString("d_LblShowEditorInfo")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(16, 12, 0, 0);
    add(windowTitleLabel, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.gridwidth = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(15, 4, 0, 11);
    add(windowTitleComboBox, gridBagConstraints);

    encloseCharLabel.setText(ResourceMgr.getString("LblEncloseGroupChar")); // NOI18N
    encloseCharLabel.setToolTipText(ResourceMgr.getString("d_LblEncloseGroupChar")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 12, 2, 0);
    add(encloseCharLabel, gridBagConstraints);

    encloseChar.setModel(
        new javax.swing.DefaultComboBoxModel(new String[] {"( )", "{ }", "[ ]", "< >"}));
    encloseChar.setToolTipText(ResourceMgr.getDescription("LblEncloseGroupChar"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 4, 0, 11);
    add(encloseChar, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    add(jPanel1, gridBagConstraints);

    titleGroupSepLabel.setText(ResourceMgr.getString("LblGroupSeparator")); // NOI18N
    titleGroupSepLabel.setToolTipText(ResourceMgr.getString("d_LblGroupSeparator")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 2, 2, 0);
    add(titleGroupSepLabel, gridBagConstraints);

    titleGroupSep.setColumns(5);
    titleGroupSep.setToolTipText(ResourceMgr.getDescription("LblGroupSeparator"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 5, 2, 11);
    add(titleGroupSep, gridBagConstraints);

    showUrl.setText(ResourceMgr.getString("LblUrlInTitle")); // NOI18N
    showUrl.setToolTipText(ResourceMgr.getString("d_LblUrlInTitle")); // NOI18N
    showUrl.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    showUrl.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            showUrlActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 12, 2, 11);
    add(showUrl, gridBagConstraints);

    includeUser.setText(ResourceMgr.getString("LblUrlWithUser")); // NOI18N
    includeUser.setToolTipText(ResourceMgr.getString("d_LblUrlWithUser")); // NOI18N
    includeUser.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 30, 2, 11);
    add(includeUser, gridBagConstraints);
  } // </editor-fold>//GEN-END:initComponents
 private ObjectCacheStorage(String resourceKey) {
   this.label = ResourceMgr.getString(resourceKey);
 }
Пример #19
0
  @Override
  public StatementRunnerResult execute(String aSql) throws SQLException {
    StatementRunnerResult result = new StatementRunnerResult();
    String parm = SqlUtil.stripVerb(aSql);

    cmdLine.parse(parm);

    WbFile inputFile = evaluateFileArgument(cmdLine.getValue(ARG_INPUT));
    WbFile outputFile = evaluateFileArgument(cmdLine.getValue(ARG_OUTPUT));
    WbFile xsltFile = evaluateFileArgument(cmdLine.getValue(ARG_STYLESHEET));

    if (!cmdLine.hasArguments()) {
      result.addErrorMessageByKey("ErrXsltWrongParameter");
      return result;
    }

    if (inputFile == null) {
      result.addErrorMessageByKey("ErrXsltMissingInputFile");
      return result;
    }

    if (!inputFile.exists()) {
      result.addErrorMessageByKey("ErrFileNotFound", cmdLine.getValue(ARG_INPUT));
      return result;
    }

    if (outputFile == null) {
      result.addErrorMessageByKey("ErrXsltMissingOutputFile");
      return result;
    }

    if (xsltFile == null) {
      result.addErrorMessageByKey("ErrXsltMissingStylesheet");
      return result;
    }

    if (!xsltFile.exists()) {
      result.addErrorMessageByKey("ErrFileNotFound", cmdLine.getValue(ARG_STYLESHEET));
      return result;
    }

    Map<String, String> params = getParameters(cmdLine);

    XsltTransformer transformer = new XsltTransformer();

    try {
      transformer.setSaveSystemOutMessages(true);
      transformer.setXsltBaseDir(getXsltBaseDir());

      transformer.transform(inputFile, outputFile, xsltFile, params);

      String msg = transformer.getAllOutputs();
      if (msg.length() != 0) {
        result.addMessage(msg);
        result.addMessage(""); // create newline
      }

      WbFile xsltUsed = new WbFile(transformer.getXsltUsed());
      WbFile userXslt = new WbFile(xsltFile);
      if (xsltUsed != null && !userXslt.equals(xsltUsed)) {
        // If the xslt file has been "automatically" found, inform the user about this
        result.addMessage(ResourceMgr.getFormattedString("MsgXsltUsed", xsltUsed.getFullPath()));
      }
      result.addMessage(ResourceMgr.getFormattedString("MsgXsltSuccessful", outputFile));
      result.setSuccess();
    } catch (Exception e) {
      LogMgr.logError(
          "WbXslt.execute()",
          "Error when transforming '" + inputFile + "' to '" + outputFile + "' using " + xsltFile,
          e);
      String msg = transformer.getAllOutputs(e);
      LogMgr.logError("WbXslt.execute()", msg, null);
      result.addErrorMessage(msg);
    }
    return result;
  }