-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bug where traces on recursive functions were coming out
backwards! Timestamps in microseconds for time spent in functions Copy/Delete traces Trace all exported functions in a module.
- Loading branch information
Andy Till
committed
Jul 28, 2015
1 parent
336bc3c
commit 1ac80ff
Showing
12 changed files
with
274 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package erlyberly; | ||
|
||
|
||
import java.util.ArrayList; | ||
|
||
import javafx.collections.ObservableList; | ||
import javafx.event.ActionEvent; | ||
import javafx.event.EventHandler; | ||
import javafx.scene.control.ContextMenu; | ||
import javafx.scene.control.MenuItem; | ||
import javafx.scene.input.Clipboard; | ||
import javafx.scene.input.ClipboardContent; | ||
import javafx.scene.input.KeyCombination; | ||
|
||
public class TraceContextMenu extends ContextMenu { | ||
|
||
private ObservableList<TraceLog> items, selectedItems; | ||
|
||
public TraceContextMenu() { | ||
getItems().add(menuItem("Copy All", "shortcut+c", this::onCopy)); | ||
getItems().add(menuItem("Copy Function Call", null, this::onCopyCalls)); | ||
getItems().add(menuItem("Delete", "delete", this::onDelete)); | ||
} | ||
|
||
private MenuItem menuItem(String text, String accelerator, EventHandler<ActionEvent> e) { | ||
MenuItem menuItem; | ||
|
||
menuItem = new MenuItem(text); | ||
menuItem.setOnAction(e); | ||
|
||
if(accelerator != null) | ||
menuItem.setAccelerator(KeyCombination.keyCombination(accelerator)); | ||
|
||
return menuItem; | ||
} | ||
|
||
private void onCopy(ActionEvent e) { | ||
StringBuilder sbuilder = new StringBuilder(); | ||
|
||
for (TraceLog traceLog : selectedItems) { | ||
sbuilder.append(traceLog.toString()).append("\n"); | ||
} | ||
|
||
copyToClipboard(sbuilder); | ||
} | ||
|
||
private void onCopyCalls(ActionEvent e) { | ||
StringBuilder sbuilder = new StringBuilder(); | ||
|
||
for (TraceLog traceLog : selectedItems) { | ||
sbuilder.append(traceLog.toCallString()).append("\n"); | ||
} | ||
|
||
copyToClipboard(sbuilder); | ||
} | ||
|
||
private void copyToClipboard(StringBuilder sbuilder) { | ||
final Clipboard clipboard = Clipboard.getSystemClipboard(); | ||
final ClipboardContent content = new ClipboardContent(); | ||
|
||
content.putString(sbuilder.toString()); | ||
clipboard.setContent(content); | ||
} | ||
|
||
private void onDelete(ActionEvent e) { | ||
ArrayList<TraceLog> arrayList = new ArrayList<TraceLog>(selectedItems); | ||
|
||
for (TraceLog traceLog : arrayList) { | ||
items.remove(traceLog); | ||
} | ||
} | ||
|
||
|
||
public void setSelectedItems(ObservableList<TraceLog> selectedItems2) { | ||
selectedItems = selectedItems2; | ||
} | ||
|
||
public void setItems(ObservableList<TraceLog> items2) { | ||
items = items2; | ||
} | ||
} |
Oops, something went wrong.