⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 projectsettingsframe.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        boolean checkAndRepair = false;        // gather preference changes on the client        if (currentOptionPanel != null)        {            currentOptionPanel.term();            currentOptionPanel = null;        }        for (Setting setting: Setting.getSettings())        {            Object v = currentContext.get(setting);            if (originalContext.get(setting).equals(v)) continue;            changeBatch.add(setting, v);            if (setting instanceof Technology.TechSetting)                checkAndRepair = true;        }        if (changeBatch.changesForSettings.isEmpty())        {            closeDialog(null);            return;        }        new OKUpdate(this, changeBatch, true, checkAndRepair);	}    private void helpActionPerformed()	{		ManualViewer.showProjectSettingHelp(currentTabName);		closeDialog(null);	}//	private void exportActionPerformed()//	{//		Job.getUserInterface().exportPrefs();//	}//	private void importActionPerformed()//	{//		Job.getUserInterface().importPrefs();//        TopLevel top = (TopLevel)TopLevel.getCurrentJFrame();//        top.getTheMenuBar().restoreSavedBindings(false); // trying to cache again////		// recache all layers and their graphics//		for(Iterator<Technology> it = Technology.getTechnologies(); it.hasNext(); )//		{//			Technology tech = it.next();//			for(Iterator<Layer> lIt = tech.getLayers(); lIt.hasNext(); )//			{//				Layer layer = lIt.next();//				layer.getGraphics().recachePrefs();//			}//		}////		// close dialog now because all values are cached badly//		closeDialog(null);////		// redraw everything//		EditWindow.repaintAllContents();//        for(Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); )//        {//        	WindowFrame wf = it.next();//        	wf.loadComponentMenuForTechnology();//        }//	}	private void loadOptionPanel()	{        ProjSettingsPanel ti = createOptionPanel(isModal());        if (ti == null) return;        if (currentOptionPanel != null)            currentOptionPanel.term();        currentOptionPanel = ti;        ti.init();        splitPane.setRightComponent(ti.getPanel());	}    private ProjSettingsPanel createOptionPanel(boolean modal)    {        if (currentTabName.equals("Added Technologies"))            return new AddedTechnologiesTab(this, modal);        if (currentTabName.equals("CIF"))            return new CIFTab(this, modal);        if (currentTabName.equals("GDS"))            return new GDSTab(this, modal);        if (currentTabName.equals("DXF"))            return new DXFTab(this, modal);        if (currentTabName.equals("Logical Effort"))            return new LogicalEffortTab(this, modal);        if (currentTabName.equals("Netlists"))            return new NetlistsTab(this, modal);        if (currentTabName.equals("Parasitic"))            return new ParasiticTab(this, modal);        if (currentTabName.equals("Scale"))            return new ScaleTab(this, modal);        if (currentTabName.equals("Skill"))            return new SkillTab(this, modal);        if (currentTabName.equals("Technology"))            return new TechnologyTab(this, modal);        if (currentTabName.equals("Verilog"))            return new VerilogTab(this, modal);        if (currentTabName.equals("Static Timing Analysis"))            return getPluginPanel(staClass, this, modal);        return null;    }	protected void escapePressed() { cancelActionPerformed(); }    /**     * Change project settings according to changeBatch and close dialog on success.     * @param changeBatch batch of changed project settings     * @param dialogToClose dialog to close on success.     */    public static void updateProjectSettings(Setting.SettingChangeBatch changeBatch, EDialog dialogToClose) {        new OKUpdate(dialogToClose, changeBatch, false, false);    }    private ProjSettingsPanel getPluginPanel(String className, ProjectSettingsFrame frame, boolean modal) {        try {            Class<?> panelClass = Class.forName(className);            Object panel = panelClass.getConstructor(ProjectSettingsFrame.class, Boolean.class).newInstance(frame, Boolean.valueOf(modal));            return (ProjSettingsPanel)panel;        } catch (Exception e) {            System.out.println("Exception while loading plugin class "+className+": "+e.getMessage());        }        return null;    }    /**	 * Class to update primitive node information.	 */	private static class OKUpdate extends Job	{		private transient EDialog dialog;		private Setting.SettingChangeBatch changeBatch;        private boolean issueWarning;        private boolean checkAndRepair;        private OKUpdate(EDialog dialog, Setting.SettingChangeBatch changeBatch, boolean issueWarning, boolean checkAndRepair) {			super("Update Project Settings", User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER);            this.dialog = dialog;            this.changeBatch = changeBatch;            this.issueWarning = issueWarning;            this.checkAndRepair = checkAndRepair;            startJob();        }		public boolean doIt() throws JobException		{			Setting.implementSettingChanges(changeBatch);			return true;		}		public void terminateOK()		{            if (issueWarning) {                if (ProjSettings.getLastProjectSettingsFile() != null) {                    Job.getUserInterface().showInformationMessage("Warning: These changes are only valid for this session of Electric."+                    "\nTo save them permanently, use File -> Export -> Project Settings", "Saving Project Setting Changes");                } else {                	// see if any libraries are not marked for saving                	boolean saveAny = false;                    for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )                    {                        Library lib = it.next();                        if (lib.isHidden()) continue;                        if (!lib.isChanged()) saveAny = true;                    }                    if (saveAny)                    {                    	// some libraries may need to be marked for saving	                    Library curLib = Library.getCurrent();	                    String [] options;	                    String defaultOption;	                    int markCurrent, saveSettings;	                    if (curLib.isChanged())	                    {	                    	options = new String [] { "Mark All Libs", "Write Proj Settings file", "Do nothing"};	                      	defaultOption = options[2];	                      	markCurrent = 1000;	                      	saveSettings = 1;	                    } else	                    {	                      	options = new String [] { "Mark All Libs", "Mark Lib \""+curLib.getName()+"\"", "Write Proj Settings file", "Do nothing"};	                      	defaultOption = options[0];	                      	markCurrent = 1;	                      	saveSettings = 2;	                    }	                    int i = JOptionPane.showOptionDialog(dialog, "Warning: Changed settings must be saved to Library or Project Settings file.\nPlease choose which Libraries to mark for saving, or write project settings file:",	                    	"Saving Project Setting Changes", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, defaultOption);	                    if (i == 0) {	                        CircuitChangeJobs.markAllLibrariesForSavingCommand();	                    } else if (i == markCurrent) {	                        CircuitChangeJobs.markCurrentLibForSavingCommand();	                    } else if (i == saveSettings) {	                        ProjSettings.exportSettings();	                    }                    }                }            }            if (dialog != null) {                dialog.setVisible(false);                dialog.dispose();            }//            dialog.closeDialog(null);            if (checkAndRepair) {                // Repair libraries in case number of layers was changed.                CircuitChanges.checkAndRepairCommand(true);            }		}	}	private static class TreeHandler implements MouseListener, TreeExpansionListener	{		private ProjectSettingsFrame dialog;		TreeHandler(ProjectSettingsFrame dialog) { this.dialog = dialog; }		public void mouseClicked(MouseEvent e) {}		public void mouseEntered(MouseEvent e) {}		public void mouseExited(MouseEvent e) {}		public void mouseReleased(MouseEvent e) {}		public void mousePressed(MouseEvent e)		{			TreePath currentPath = dialog.optionTree.getPathForLocation(e.getX(), e.getY());			if (currentPath == null) return;			dialog.optionTree.setSelectionPath(currentPath);			DefaultMutableTreeNode node = (DefaultMutableTreeNode)currentPath.getLastPathComponent();			currentTabName = (String)node.getUserObject();			dialog.optionTree.expandPath(currentPath);			if (!currentTabName.endsWith(" "))			{				dialog.loadOptionPanel();			}			dialog.pack();		}		public void treeCollapsed(TreeExpansionEvent e)		{			dialog.pack();		}		public void treeExpanded(TreeExpansionEvent e)		{			TreePath tp = e.getPath();			if (tp.getPathCount() == 2)			{				// opened a path down to the bottom: close all others				TreePath topPath = dialog.optionTree.getPathForRow(0);				DefaultMutableTreeNode node = (DefaultMutableTreeNode)topPath.getLastPathComponent();				int numChildren = node.getChildCount();				for(int i=0; i<numChildren; i++)				{					DefaultMutableTreeNode child = (DefaultMutableTreeNode)node.getChildAt(i);					TreePath descentPath = topPath.pathByAddingChild(child);					if (!descentPath.getLastPathComponent().equals(tp.getLastPathComponent()))					{						dialog.optionTree.collapsePath(descentPath);					}				}			}			dialog.pack();		}	}	/** Closes the dialog */	private void closeDialog(WindowEvent evt)	{		setVisible(false);		dispose();	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -