📄 generaltab.java
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: GeneralTab.java * * Copyright (c) 2004 Sun Microsystems and Static Free Software * * Electric(tm) is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Electric(tm) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Electric(tm); see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, Mass 02111-1307, USA. */package com.sun.electric.tool.user.dialogs.options;import com.sun.electric.database.change.Undo;import com.sun.electric.database.text.TextUtils;import com.sun.electric.tool.io.FileType;import com.sun.electric.tool.user.User;import com.sun.electric.tool.user.dialogs.EDialog;import java.awt.Frame;import java.util.HashMap;import java.util.Map;import javax.swing.JPanel;/** * Class to handle the "General" tab of the Preferences dialog. */public class GeneralTab extends PreferencePanel{ private Map<Object,String> fileTypeMap = new HashMap<Object,String>(); /** Creates new form General Options */ public GeneralTab(Frame parent, boolean modal) { super(parent, modal); initComponents(); // make all text fields select-all when entered EDialog.makeTextFieldSelectAllOnTab(pathTextField); EDialog.makeTextFieldSelectAllOnTab(generalErrorLimit); EDialog.makeTextFieldSelectAllOnTab(maxUndoHistory); EDialog.makeTextFieldSelectAllOnTab(generalMaxMem); EDialog.makeTextFieldSelectAllOnTab(generalMaxSize); } /** return the panel to use for this preferences tab. */ public JPanel getPanel() { return general; } /** return the name of this preferences tab. */ public String getName() { return "General"; } /** * Method called at the start of the dialog. * Caches current values and displays them in the General tab. */ public void init() { // I/O section generalShowFileDialog.setSelected(User.isShowFileSelectionForNetlists()); for (Object obj : FileType.getFileTypeGroups()) { workingDirComboBox.addItem(obj); fileTypeMap.put(obj, null); } workingDirComboBoxActionPerformed(null); pathTextField.setText(User.getWorkingDirectory()); // Jobs section generalBeepAfterLongJobs.setSelected(User.isBeepAfterLongJobs()); generalVerboseMode.setSelected(User.isJobVerboseMode()); generalErrorLimit.setText(Integer.toString(User.getErrorLimit())); maxUndoHistory.setText(Integer.toString(User.getMaxUndoHistory())); // Memory section Runtime runtime = Runtime.getRuntime(); long maxMemLimit = runtime.maxMemory() / 1024 / 1024; generalMemoryUsage.setText("Current memory usage: " + Long.toString(maxMemLimit) + " megabytes"); generalMaxMem.setText(Long.toString(User.getMemorySize())); generalMaxSize.setText(Long.toString(User.getPermSpace())); // Database section generalSnapshotLogging.setSelected(User.isUseTwoJVMs()); generalLogClientServer.setSelected(User.isUseClientServer()); } /** * Method called when the "OK" panel is hit. * Updates any changed fields in the General tab. */ public void term() { // I/O section boolean currBoolean = generalShowFileDialog.isSelected(); if (currBoolean != User.isShowFileSelectionForNetlists()) User.setShowFileSelectionForNetlists(currBoolean); // Resetting dir path for (Map.Entry<Object,String> entry : fileTypeMap.entrySet()) { Object obj = entry.getKey(); FileType.setFileTypeGroupDir(obj, entry.getValue()); } // Jobs section currBoolean = generalBeepAfterLongJobs.isSelected(); if (currBoolean != User.isBeepAfterLongJobs()) User.setBeepAfterLongJobs(currBoolean); currBoolean = generalVerboseMode.isSelected(); if (currBoolean != User.isJobVerboseMode()) User.setJobVerboseMode(currBoolean); int currInt = TextUtils.atoi(generalErrorLimit.getText()); if (currInt != User.getErrorLimit()) User.setErrorLimit(currInt); currInt = TextUtils.atoi(maxUndoHistory.getText()); if (currInt != User.getMaxUndoHistory()) { User.setMaxUndoHistory(currInt); Undo.setHistoryListSize(currInt); } // Memory section currInt = TextUtils.atoi(generalMaxMem.getText()); if (currInt != User.getMemorySize()) User.setMemorySize(currInt); currInt = TextUtils.atoi(generalMaxSize.getText()); if (currInt != User.getPermSpace()) User.setPermSpace(currInt); // Database section currBoolean = generalSnapshotLogging.isSelected(); if (currBoolean != User.isUseTwoJVMs()) User.setUseTwoJVMs(currBoolean); currBoolean = generalLogClientServer.isSelected(); if (currBoolean != User.isUseClientServer()) User.setUseClientServer(currBoolean); } /** * Method called when the factory reset is requested. */ public void reset() { if (User.isFactoryShowFileSelectionForNetlists() != User.isShowFileSelectionForNetlists()) User.setShowFileSelectionForNetlists(User.isFactoryShowFileSelectionForNetlists()); for (Object obj : FileType.getFileTypeGroups()) if (!FileType.getFactoryGroupPath(obj).equals(FileType.getGroupPath(obj))) FileType.setFileTypeGroupDir(obj, FileType.getFactoryGroupPath(obj)); if (User.isFactoryBeepAfterLongJobs() != User.isBeepAfterLongJobs()) User.setBeepAfterLongJobs(User.isFactoryBeepAfterLongJobs()); if (User.isFactoryJobVerboseMode() != User.isJobVerboseMode()) User.setJobVerboseMode(User.isFactoryJobVerboseMode()); if (User.getFactoryErrorLimit() != User.getErrorLimit()) User.setErrorLimit(User.getFactoryErrorLimit()); if (User.getFactoryMaxUndoHistory() != User.getMaxUndoHistory()) User.setMaxUndoHistory(User.getFactoryMaxUndoHistory()); if (User.getFactoryMemorySize() != User.getMemorySize()) User.setMemorySize(User.getFactoryMemorySize()); if (User.getFactoryPermSpace() != User.getPermSpace()) User.setPermSpace(User.getFactoryPermSpace()); if (User.isFactoryUseTwoJVMs() != User.isUseTwoJVMs()) User.setUseTwoJVMs(User.isFactoryUseTwoJVMs()); if (User.isFactoryUseClientServer() != User.isUseClientServer()) User.setUseClientServer(User.isFactoryUseClientServer()); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; general = new javax.swing.JPanel(); memory = new javax.swing.JPanel(); jLabel60 = new javax.swing.JLabel(); generalMaxMem = new javax.swing.JTextField(); jLabel61 = new javax.swing.JLabel(); generalMemoryUsage = new javax.swing.JLabel(); jLabel62 = new javax.swing.JLabel(); jLabel63 = new javax.swing.JLabel(); generalMaxSize = new javax.swing.JTextField(); jLabel64 = new javax.swing.JLabel(); IO = new javax.swing.JPanel(); generalShowFileDialog = new javax.swing.JCheckBox(); groupPanel = new javax.swing.JPanel(); newPathLabel = new javax.swing.JLabel(); pathLabel = new javax.swing.JLabel(); pathTextField = new javax.swing.JTextField(); resetButton = new javax.swing.JButton(); workingDirComboBox = new javax.swing.JComboBox(); groupLabel = new javax.swing.JLabel(); currentPathLabel = new javax.swing.JLabel(); jobs = new javax.swing.JPanel(); generalBeepAfterLongJobs = new javax.swing.JCheckBox(); jLabel46 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); generalErrorLimit = new javax.swing.JTextField(); maxUndoHistory = new javax.swing.JTextField(); jLabel53 = new javax.swing.JLabel(); generalVerboseMode = new javax.swing.JCheckBox(); database = new javax.swing.JPanel(); generalLogClientServer = new javax.swing.JCheckBox(); generalSnapshotLogging = new javax.swing.JCheckBox(); getContentPane().setLayout(new java.awt.GridBagLayout()); setTitle("Edit Options"); setName(""); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); general.setLayout(new java.awt.GridBagLayout()); memory.setLayout(new java.awt.GridBagLayout()); memory.setBorder(javax.swing.BorderFactory.createTitledBorder("Memory")); jLabel60.setText("Maximum memory:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); memory.add(jLabel60, gridBagConstraints); generalMaxMem.setColumns(6); generalMaxMem.setText(" "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); memory.add(generalMaxMem, gridBagConstraints); jLabel61.setText("megabytes"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; memory.add(jLabel61, gridBagConstraints); generalMemoryUsage.setText("Current memory usage:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); memory.add(generalMemoryUsage, gridBagConstraints); jLabel62.setText("Changes to memory take effect when Electric is next run"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); memory.add(jLabel62, gridBagConstraints);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -