{ GetVDBManager manager = (GetVDBManager)CommandManager.getInstance().getCommand("GetVDBManager");  LineVertex startingLineVertex = manager.getManager().createLineVertex(null); lineVertex = manager.getManager().createLineVertex(startingLineVertex);  startingLineVertex.setPartnerVertex(lineVertex); lineVertex.setIsArrow(LineVertex.getCurrentIsArrow()); }
createLine();
public void mouseClicked(MouseEvent e) {	ViewState view = ViewState.getInstance();	// check for drags!	int cx = e.getX()-view.getX0();	int cy = e.getY()-view.getY0();	if ((cx>0) && (cy>0) && (cx<width) && (cy<height)) {//		System.out.println("mouseClicked ("+cx+", "+cy+")");		VisibleObject hilited = view.getHilitedObject();		if (hilited!=null) {						// linking support			if (tmplink!=null) {				if (hilited instanceof LinkManagerObject) {					linkCommand((LinkManagerObject)hilited, null);					return;				}				else if (hilited instanceof EPICSVarLink) {					EPICSVarLink varlink = (EPICSVarLink)hilited;					if ((tmplink.getType()!=DBDConstants.DBF_FWDLINK) ||		// !!! proc						varlink.getFieldData().getName().equalsIgnoreCase("PROC")) {						linkCommand((LinkManagerObject)varlink.getParent(), varlink.getFieldData());						return;					}				}			}						if (e.isControlDown() || (e.getClickCount()==1)) {				if (!e.isControlDown()) view.deselectAll();			// deselect all				if (hilited instanceof Selectable) {				// invert selection					if (view.isSelected(hilited))						view.deselectObject(hilited);					else						view.setAsSelected(hilited);					repaint();				}			}			else if (e.getClickCount()>=2) {				if (hilited instanceof Selectable) {				// invert selection					if (view.isSelected(hilited))						view.deselectObject(hilited);					else						view.setAsSelected(hilited);				}								if (hilited instanceof Inspectable) 					InspectorManager.getInstance().requestInspectorFor((Inspectable)hilited);				else {					if (hilited instanceof Group) {						viewGroup = (Group)hilited;						ViewState.getInstance().set(viewGroup);						//createNavigatorImage();						viewGroup.unconditionalValidateSubObjects(isFlat());						SetWorkspaceGroup cmd = (SetWorkspaceGroup)CommandManager.getInstance().getCommand("SetGroup");						cmd.setGroup(viewGroup.getAbsoluteName());						cmd.execute();											updateWorkspaceScale();												forceRedraw = true;						repaint();					}				}			}		}		else {			pressedX=cx; pressedY=cy;			if (e.getClickCount()==1 && e.getButton()==MouseEvent.BUTTON3)			{								ActionListener al = new ActionListener()				{					public void actionPerformed(ActionEvent e) {						String action = e.getActionCommand();						if (action.equals(newRecordString))							CommandManager.getInstance().execute("ShowNewDialog");						else							createTemplateInstance(null, action, true);					}							};												JPopupMenu popUp = new JPopupMenu();								JMenuItem item = new JMenuItem(newRecordString);				item.addActionListener(al);				popUp.add(item);								JMenu templatesMenu = new JMenu(newTemplesString);				popUp.add(templatesMenu);								// add templates				Enumeration templates = VDBData.getTemplates().keys();				while (templates.hasMoreElements())				{					JMenuItem item2 = new JMenuItem(templates.nextElement().toString());					item2.addActionListener(al);					templatesMenu.add(item2);				}					if (templatesMenu.getItemCount()==0)					templatesMenu.setEnabled(false);								popUp.show(getWorkspacePanel(), e.getX(), e.getY());							}			else 						if((e.getClickCount() >= 1) && (lineVertex != null))				lineVertex = null;			else if((e.getClickCount() >= 1) && (boxVertex != null))				boxVertex = null;			else if((e.getClickCount() >= 1) && (textBoxVertex != null))			{				textBoxVertex.getPartnerVertex().setIsAlwaysDrawn(false);				textBoxVertex.setIsAlwaysDrawn(false);				textBoxVertex = null;			}			else if (e.getClickCount()>=2)			{				if(VisualDCT.getInstance().getLineButtonEnabled())				{					GetVDBManager manager =						(GetVDBManager)CommandManager.getInstance().getCommand("GetVDBManager");					LineVertex startingLineVertex = manager.getManager().createLineVertex(null);					lineVertex = manager.getManager().createLineVertex(startingLineVertex);										startingLineVertex.setPartnerVertex(lineVertex);					lineVertex.setIsArrow(LineVertex.getCurrentIsArrow());				}				else if(VisualDCT.getInstance().getBoxButtonEnabled())				{					GetVDBManager manager =						(GetVDBManager)CommandManager.getInstance().getCommand("GetVDBManager");					BoxVertex startingBoxVertex = manager.getManager().createBoxVertex(null);					boxVertex = manager.getManager().createBoxVertex(startingBoxVertex);					startingBoxVertex.setPartnerVertex(boxVertex);				}				else if(VisualDCT.getInstance().getTextBoxButtonEnabled())				{					GetVDBManager manager =						(GetVDBManager)CommandManager.getInstance().getCommand("GetVDBManager");					TextBoxVertex startingTextBoxVertex = manager.getManager().createTextBoxVertex(null);					textBoxVertex = manager.getManager().createTextBoxVertex(startingTextBoxVertex);					startingTextBoxVertex.setPartnerVertex(textBoxVertex);					manager.getManager().createTextBox(startingTextBoxVertex, textBoxVertex);				}				else					CommandManager.getInstance().execute("ShowNewDialog");			}			else if (view.deselectAll()) 				repaint();					// deselect all		}				stopLinking();				}}