@SuppressWarnings("unchecked")
	@Override
	public void mousePressed(MouseEvent e) {
		if (this.checkModifiers(e)) {

			this.viewer = (VisualizationViewer<ILayoutVertex, ILayoutEdge>) e
					.getSource();
			this.layout = this.viewer.getModel().getGraphLayout();
			final Point2D p = e.getPoint();
			GraphElementAccessor<ILayoutVertex, ILayoutEdge> pickSupport = this.viewer
					.getPickSupport();

			if (pickSupport != null) {
				Graph<ILayoutVertex, ILayoutEdge> graph = this.layout
						.getGraph();

				// set default edge type
				this.edgeIsDirected = EdgeType.DIRECTED;
				if (graph instanceof ILayoutGraph) {
					ILayoutGraph eg = (ILayoutGraph) graph;
					if (eg.getEdgeType() == EdgeType.UNDIRECTED) {
						this.edgeIsDirected = EdgeType.UNDIRECTED;
					}
				}

				final ILayoutVertex vertex = pickSupport.getVertex(this.layout,
						p.getX(), p.getY());

				if (vertex != null) {
					/* edge */
					this.startVertex = vertex;
					this.down = e.getPoint();
					this.transformEdgeShape(this.down, this.down);
					this.viewer.addPostRenderPaintable(this.edgePaintable);

					if ((e.getModifiers() & MouseEvent.SHIFT_MASK) != 0
							&& this.layout.getGraph() instanceof UndirectedGraph == false) {
						this.edgeIsDirected = EdgeType.DIRECTED;
					}

					if (this.edgeIsDirected == EdgeType.DIRECTED) {
						this.transformArrowShape(this.down, e.getPoint());
						this.viewer.addPostRenderPaintable(this.arrowPaintable);
					}
				} else {
					/* vertex */
					ILayoutVertex newVertex = this.vertexFactory.create();
					graph.addVertex(newVertex);

					Point2D point = this.viewer.getRenderContext()
							.getMultiLayerTransformer()
							.inverseTransform(e.getPoint());
					this.layout.setLocation(newVertex, point);
					newVertex.setLocation(point);
				}
			}
			this.viewer.repaint();
		}
	}