/* * (non-Javadoc) * * @see java.awt.event.MouseWheelListener#mouseWheelMoved(java.awt.event. * MouseWheelEvent) */ @Override public void mouseWheelMoved(MouseWheelEvent ev) { // checks if the graph exists and if the control key is pressed DirectedWeightedGraph canvasGraph = _canvas.get_graph(); if (canvasGraph != null && ev.isControlDown()) { // We search the name of canvas parent CanvasPanel panelParent; String panel = _canvas.getParent().getClass().getName(); if (panel.equals("acide.gui.debugPanel.traceSQLPanel.AcideTraceSQLPanel")) panelParent = CanvasPanel.TraceSQL; else if (panel.equals("acide.gui.debugPanel.debugSQLPanel.AcideDebugSQLPanel")) panelParent = CanvasPanel.DebugSQL; else if (panel.equals("acide.gui.debugPanel.traceDatalogPanel.AcideTraceDatalogPanel")) panelParent = CanvasPanel.TraceData; else panelParent = null; // gets the coordinates of the event int difx = ev.getX() - _canvas.getX0(); int dify = ev.getY() - _canvas.getY0(); // checks the wheel rotation direction if (ev.getWheelRotation() < 0) { // zooms in the canvas and move the graph _canvas.zoomIn(panelParent); int difx2 = ev.getX() - _canvas.getX0(); int dify2 = ev.getY() - _canvas.getY0(); _canvas.moveGraph(difx2 - difx, dify2 - dify); } else { // zooms out the canvas and move the graph _canvas.zoomOut(panelParent); int difx2 = ev.getX() - _canvas.getX0(); int dify2 = ev.getY() - _canvas.getY0(); _canvas.moveGraph(difx2 - difx, dify2 - dify); } // repaint the canvas _canvas.repaint(); } }
/* * (non-Javadoc) * * @see java.lang.Runnable#run() */ @Override public void run() { InputStream in = new ByteArrayInputStream(_input.getBytes()); if (!AcideProjectConfiguration.getInstance().isDebugPanelShowed()) { AcideMainWindow.getInstance().getDebugPanel().showDebugPanel(); AcideProjectConfiguration.getInstance().setIsDebugPanelShowed(true); // Updates the show debug panel check box menu item state AcideMainWindow.getInstance() .getMenu() .getViewMenu() .getShowDebugPanelCheckBoxMenuItem() .setSelected(AcideProjectConfiguration.getInstance().isDebugPanelShowed()); // If it is not the default project if (!AcideProjectConfiguration.getInstance().isDefaultProject()) // The project has been modified AcideProjectConfiguration.getInstance().setIsModified(true); } // // parses the result and generates the graph if (_method.equals(PARSE_TAPI_PDG)) { if (_destiny.equals(DESTINY_PATH)) try { // parses the input to obtain the graph ArrayList<Node> g = AcideDebugCanvas.parsePathGraphTapi(in); // sets the path graph _canvas.setPathGraph(g); // updates the success flag _success = true; } catch (AcideDebugCanvasParseInputEqualsErrorException e) { // sets empty graphs on the path and the main graph of the canvas _canvas.set_graph(new DirectedWeightedGraph()); _canvas.setPathGraph(new ArrayList<Node>()); _canvas.repaint(); if (_showErrorMessage) { // shows the error message new AcideDebugPanelErrorMessageDialog( AcideLanguageManager.getInstance().getLabels().getString("s157"), e.getMessage()); } // updates the succes flag _success = false; } if (_destiny.equals(DESTINY_MAIN)) { // parses the input to obtain the graph _canvas.set_graph(AcideDebugCanvas.parseGraphTapi(in)); // sets the main graph _success = true; } } // // parses the result and generates the graph if (_method.equals(PARSE_TAPI_RDG)) { if (_destiny.equals(DESTINY_PATH)) try { // parses the input to obtain the graph ArrayList<Node> g = AcideDebugCanvas.parsePathGraphTapi(in); // sets the path graph _canvas.setPathGraph(g); // updates the success flag _success = true; } catch (AcideDebugCanvasParseInputEqualsErrorException e) { // sets empty graphs on the path and the main graph of the canvas _canvas.set_graph(new DirectedWeightedGraph()); _canvas.setPathGraph(new ArrayList<Node>()); _canvas.repaint(); if (_showErrorMessage) { // shows the error message new AcideDebugPanelErrorMessageDialog( AcideLanguageManager.getInstance().getLabels().getString("s157"), e.getMessage()); } // updates the succes flag _success = false; } if (_destiny.equals(DESTINY_MAIN)) { // parses the input to obtain the graph _canvas.set_graph(AcideDebugCanvas.parseGraphTapi(in)); // sets the main graph _success = true; } } _canvas.repaint(); }