mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
further swingworker stuff
This commit is contained in:
@@ -775,6 +775,8 @@ public class ASTGenerator {
|
||||
private String lastPredictedWord = " ";
|
||||
|
||||
public void preparePredictions(final String word, final int line, final int lineStartNonWSOffset) {
|
||||
// This method is called from TextArea.fetchPhrase, which is called via a SwingWorker instance
|
||||
// in TextArea.processKeyEvent
|
||||
if(caretWithinLineComment()){
|
||||
log("No predictions.");
|
||||
return;
|
||||
|
||||
@@ -243,26 +243,21 @@ public class ErrorBar extends JPanel {
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
SwingWorker worker = new SwingWorker() {
|
||||
SwingWorker worker = new SwingWorker() {
|
||||
|
||||
protected Object doInBackground() throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void done() {
|
||||
for (ErrorMarker eMarker : errorPoints) {
|
||||
// -2 and +2 are extra allowance, clicks in the
|
||||
// vicinity of the markers register that way
|
||||
if (e.getY() >= eMarker.getY() - 2
|
||||
&& e.getY() <= eMarker.getY() + 2
|
||||
+ errorMarkerHeight) {
|
||||
errorCheckerService
|
||||
.scrollToErrorLine(eMarker.getProblem());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
protected Object doInBackground() throws Exception {
|
||||
for (ErrorMarker eMarker : errorPoints) {
|
||||
// -2 and +2 are extra allowance, clicks in the
|
||||
// vicinity of the markers register that way
|
||||
if (e.getY() >= eMarker.getY() - 2
|
||||
&& e.getY() <= eMarker.getY() + 2 + errorMarkerHeight) {
|
||||
errorCheckerService.scrollToErrorLine(eMarker.getProblem());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
worker.execute();
|
||||
@@ -281,14 +276,10 @@ public class ErrorBar extends JPanel {
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void mouseMoved(final MouseEvent evt) {
|
||||
// System.out.println(e);
|
||||
SwingWorker worker = new SwingWorker() {
|
||||
// System.out.println(e);
|
||||
SwingWorker worker = new SwingWorker() {
|
||||
|
||||
protected Object doInBackground() throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void done() {
|
||||
protected Object doInBackground() throws Exception {
|
||||
for (ErrorMarker eMarker : errorPoints) {
|
||||
if (evt.getY() >= eMarker.getY() - 2
|
||||
&& evt.getY() <= eMarker.getY() + 2 + errorMarkerHeight) {
|
||||
@@ -296,13 +287,13 @@ public class ErrorBar extends JPanel {
|
||||
String msg = (p.isError() ? "Error: " : "Warning: ")
|
||||
+ p.getMessage();
|
||||
setToolTipText(msg);
|
||||
setCursor(Cursor
|
||||
.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
try {
|
||||
worker.execute();
|
||||
|
||||
@@ -199,13 +199,13 @@ public class SketchOutline {
|
||||
private void updateSelection(){
|
||||
SwingWorker worker = new SwingWorker() {
|
||||
protected Object doInBackground() throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void done() {
|
||||
String text = searchField.getText().toLowerCase();
|
||||
tempNode = new DefaultMutableTreeNode();
|
||||
filterTree(text, tempNode, soNode);
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void done() {
|
||||
soTree.setModel(new DefaultTreeModel(tempNode));
|
||||
((DefaultTreeModel) soTree.getModel()).reload();
|
||||
for (int i = 0; i < soTree.getRowCount(); i++) {
|
||||
@@ -249,10 +249,6 @@ public class SketchOutline {
|
||||
}
|
||||
DefaultMutableTreeNode tnode = (DefaultMutableTreeNode) soTree
|
||||
.getLastSelectedPathComponent();
|
||||
if (tnode.getUserObject() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (tnode.getUserObject() instanceof ASTNodeWrapper) {
|
||||
ASTNodeWrapper awrap = (ASTNodeWrapper) tnode.getUserObject();
|
||||
// log(awrap);
|
||||
|
||||
Reference in New Issue
Block a user