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

📄 explorertree.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
					currentSelectedPaths = new TreePath[1];					currentSelectedPaths[0] = cp;					clearSelection();					addSelectionPath(cp);					updateUI();				}			}		}		private void cacheEvent(MouseEvent e)		{//			currentPath = getPathForLocation(e.getX(), e.getY());//			if (currentPath == null) { currentSelectedObject = null;   return; }//			setSelectionPath(currentPath);//			for(int i=0; i<currentPaths.length; i++)//			{//				DefaultMutableTreeNode node = (DefaultMutableTreeNode)currentPaths[i].getLastPathComponent();//				if (i == 0) selectedNode = node;//				Object newSelection = node.getUserObject();//				if (newSelection != currentSelectedObject)//				{//					currentSelectedObject = newSelection;//					// update highlighting to match this selection//					for(Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); )//					{//						WindowFrame wf = it.next();//						if (wf.getExplorerTab() == tree)//						{//							// initiate crossprobing from WaveformWindow//							if (wf.getContent() instanceof WaveformWindow)//							{//								WaveformWindow ww = (WaveformWindow)wf.getContent();//								ww.crossProbeWaveformToEditWindow();//							}//						}//					}//				}//			}			// determine the source of this event			currentMouseEvent = e;		}        /**         * Method to add the GetInfoMenu option in all ExplorerTree nodes to be consistent         * @param origMenu         */        private void addGetInfoMenu(JPopupMenu origMenu)        {            JPopupMenu menu = origMenu;            if (menu == null)            {                menu = new JPopupMenu("Get Info");            }            JMenuItem menuItemGetInfo = new JMenuItem("Get Info");            // Get info menu            if (origMenu != null)                menu.addSeparator();            menu.add(menuItemGetInfo);            menuItemGetInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { showGetInfoGeneral(); } });            if (origMenu == null)                menu.show((Component)currentMouseEvent.getSource(), currentMouseEvent.getX(), currentMouseEvent.getY());        }        /**         * Method to add standard open/close menus in the Explorer         * @param menu         */        private void addOpenCloseMenus(JPopupMenu menu)        {            JMenuItem menuItem = new JMenuItem("Open");            menu.add(menuItem);            menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { openAction(); } });            menuItem = new JMenuItem("Open all below here");            menu.add(menuItem);            menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { recursiveOpenAction(); } });            menuItem = new JMenuItem("Close all below here");            menu.add(menuItem);            menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { recursiveCloseAction(); } });            menu.addSeparator();        }        private void doContextMenu()		{			// see what is selected			Object selectedObject = null;            boolean allSame = true;            int numSelectedElems = numCurrentlySelectedObjects();            for(int i=0; i<numSelectedElems; i++)			{                Object obj = getCurrentlySelectedObject(i);                if (obj == null) continue;				if (selectedObject == null)                {                    selectedObject = obj;                } else				{					Class clz = selectedObject.getClass();					if (!clz.isInstance(obj))					{                        allSame = false;                    }				}			}            JPopupMenu menu;            JMenuItem menuItem;            // handle actions that allow multiple selections			if (allSame && selectedObject instanceof SweepSignal)			{				menu = new JPopupMenu("Sweep Signal");				menuItem = new JMenuItem("Include");				menu.add(menuItem);				menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setSweepAction(true); } });				menuItem = new JMenuItem("Exclude");				menu.add(menuItem);				menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setSweepAction(false); } });				menuItem = new JMenuItem("Highlight");				menu.add(menuItem);				menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { highlightSweepAction(); } });				menu.show((Component)currentMouseEvent.getSource(), currentMouseEvent.getX(), currentMouseEvent.getY());				return;			}			if (allSame && selectedObject instanceof Signal)			{				menu = new JPopupMenu("Signals");				menuItem = new JMenuItem("Add to current panel");				menu.add(menuItem);				menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addToWaveform(false); } });				menuItem = new JMenuItem("Add in new panel");				menu.add(menuItem);				menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addToWaveform(true); } });				menu.show((Component)currentMouseEvent.getSource(), currentMouseEvent.getX(), currentMouseEvent.getY());				return;			}			// restricted set of options when multiple things are selected			if (allSame && numCurrentlySelectedObjects() > 1)			{				if (selectedObject instanceof ExplorerTreeModel.CellAndCount)				{					ExplorerTreeModel.CellAndCount cc = (ExplorerTreeModel.CellAndCount)selectedObject;					selectedObject = cc.getCell();				}				if (selectedObject instanceof Cell)				{					Cell cell = (Cell)selectedObject;					menu = new JPopupMenu("Cell");					menuItem = new JMenuItem("Delete Cell");					menu.add(menuItem);					menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { deleteCellAction(); } });					if (cell.getView() == View.ICON)					{						menuItem = new JMenuItem("Cannot Change View of Icon Cell");						menuItem.setEnabled(false);						menu.add(menuItem);					} else					{						JMenu subMenu = new JMenu("Change View");						menu.add(subMenu);						for(View view : View.getOrderedViews())						{							if (cell.getView() == view) continue;							JMenuItem subMenuItem = new JMenuItem(view.getFullName());							subMenu.add(subMenuItem);							subMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { reViewCellAction(e); } });						}						JMenuItem subMenuItem = new JMenuItem("Icon (cannot change into Icon view)");						subMenu.add(subMenuItem);						subMenuItem.setEnabled(false);					}					menuItem = new JMenuItem("Change Cell Group...");	                menu.add(menuItem);	                menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { changeCellGroupAction(); }});					if (CVS.isEnabled()) {                        JMenu cvsMenu = new JMenu("CVS");                        menu.add(cvsMenu);                        addCVSMenu(cvsMenu);                    }					menu.show((Component)currentMouseEvent.getSource(), currentMouseEvent.getX(), currentMouseEvent.getY());					return;				}			}			// restrict to a single selection			if (numCurrentlySelectedObjects() > 1 && CVS.isEnabled() &&                    (getCurrentlySelectedLibraries().size() > 0 || getCurrentlySelectedCells().size() > 0))			{				menu = new JPopupMenu("CVS");                JMenu cvsMenu = new JMenu("CVS");                menu.add(cvsMenu);                addCVSMenu(cvsMenu);                menu.show((Component)currentMouseEvent.getSource(), currentMouseEvent.getX(), currentMouseEvent.getY());				return;			}			// show Job menu if user clicked on a Job			if (selectedObject instanceof JobTree.JobTreeNode)			{				JobTree.JobTreeNode job = (JobTree.JobTreeNode)selectedObject;				JPopupMenu popup = JobTree.getPopupStatus(job);				popup.show((Component)currentMouseEvent.getSource(), currentMouseEvent.getX(), currentMouseEvent.getY());				return;			}			if (selectedObject instanceof ExplorerTreeModel.CellAndCount)			{				ExplorerTreeModel.CellAndCount cc = (ExplorerTreeModel.CellAndCount)selectedObject;				selectedObject = cc.getCell();			}			if (selectedObject instanceof Cell)			{				Cell cell = (Cell)selectedObject;				menu = new JPopupMenu("Cell");				menuItem = new JMenuItem("Edit");				menu.add(menuItem);				menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { editCellAction(false); } });				menuItem = new JMenuItem("Edit in New Window");				menu.add(menuItem);				menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { editCellAction(true); } });				int projStatus = Project.getCellStatus(cell);				if (projStatus != Project.OLDVERSION &&					(projStatus != Project.NOTMANAGED || Project.isLibraryManaged(cell.getLibrary())))				{					menu.addSeparator();					if (projStatus == Project.CHECKEDIN)					{						menuItem = new JMenuItem("Check Out");						menu.add(menuItem);						menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CheckOutJob.checkOut((Cell)getCurrentlySelectedObject(0)); } });					}					if (projStatus == Project.CHECKEDOUTTOYOU)					{						menuItem = new JMenuItem("Check In...");						menu.add(menuItem);						menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CheckInJob.checkIn((Cell)getCurrentlySelectedObject(0)); } });						menuItem = new JMenuItem("Rollback and Release Check-Out");						menu.add(menuItem);						menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelCheckOutJob.cancelCheckOut((Cell)getCurrentlySelectedObject(0)); } });					}					if (projStatus == Project.NOTMANAGED)					{						menuItem = new JMenuItem("Add To Repository");						menu.add(menuItem);						menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AddCellJob.addCell((Cell)getCurrentlySelectedObject(0)); } });					} else					{						menuItem = new JMenuItem("Show History of This Cell...");						menu.add(menuItem);						menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { HistoryDialog.examineHistory((Cell)getCurrentlySelectedObject(0)); } });					}					if (projStatus == Project.CHECKEDIN || projStatus == Project.CHECKEDOUTTOYOU)					{						menuItem = new JMenuItem("Remove From Repository");						menu.add(menuItem);						menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DeleteCellJob.removeCell((Cell)getCurrentlySelectedObject(0)); } });					}				}				menu.addSeparator();				menuItem = new JMenuItem("Place Instance of Cell");				menu.add(menuItem);				menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { newCellInstanceAction(); } });				menuItem = new JMenuItem("Create New Cell");				menu.add(menuItem);				menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { newCellAction(); } });				menu.addSeparator();				menuItem = new JMenuItem("Create New Version of Cell");				menu.add(menuItem);				menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { newCellVersionAction(); } });				menuItem = new JMenuItem("Duplicate Cell");				menu.add(menuItem);				menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { duplicateCellAction(); } });				menuItem = new JMenuItem("Delete Cell");				menu.add(menuItem);				menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { deleteCellAction(); } });                JMenu subMenu = new JMenu("Copy Cell");				menu.add(subMenu);                prepareForCopyAction(subMenu, selectedObject);                menu.addSeparator();				menuItem = new JMenuItem("Rename Cell");				menu.add(menuItem);				menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { renameCellAction(); } });				if (cell.getView() == View.ICON)				{					menuItem = new JMenuItem("Cannot Change View of Icon Cell");					menuItem.setEnabled(false);					menu.add(menuItem);				} else				{					subMenu = new JMenu("Change View");					menu.add(subMenu);					for(View view : View.getOrderedViews())					{						if (cell.getView() == view) continue;						if (view == View.ICON) continue;						JMenuItem subMenuItem = new JMenuItem(view.getFullName());						subMenu.add(subMenuItem);						subMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { reViewCellAction(e); } });					}					JMenuItem subMenuItem = new JMenuItem("Icon (cannot change into Icon view)");					subMenu.add(subMenuItem);					subMenuItem.setEnabled(false);				}                if (CVS.isEnabled()) {                    menu.addSeparator();                    JMenu cvsMenu = new JMenu("CVS");                    menu.add(cvsMenu);                    addCVSMenu(cvsMenu);                }                menu.addSeparator();//				if (cell.isSchematic() && cell.getNewestVersion() == cell &&//					cell.getCellGroup().getMainSchematics() != cell)//				{//					menuItem = new JMenuItem("Make This the Main Schematic");//					menu.add(menuItem);//					menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { makeCellMainSchematic(); }});//				}                menuItem = new JMenuItem("Change Cell Group...");                menu.add(menuItem);                menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { changeCellGroupAction

⌨️ 快捷键说明

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