import java.util.*;
import java.util.zip.*;
import java.util.List;
import java.util.regex.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.table.*;
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
import java.lang.ref.*;
import java.lang.management.*;
import java.security.*;
import java.security.spec.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.imageio.*;
import java.math.*;
import org.pushingpixels.substance.api.*;
import org.pushingpixels.substance.api.skin.*;
import javax.swing.event.AncestorListener;
import javax.swing.event.AncestorEvent;
import javax.swing.Timer;
import java.text.*;
import javax.net.ssl.*;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
import org.fife.rsta.ui.CollapsibleSectionPanel;
import org.fife.rsta.ui.GoToDialog;
import org.fife.rsta.ui.SizeGripIcon;
import org.fife.rsta.ui.search.FindDialog;
import org.fife.rsta.ui.search.ReplaceDialog;
import org.fife.rsta.ui.search.ReplaceToolBar;
import org.fife.rsta.ui.search.SearchEvent;
import org.fife.rsta.ui.search.SearchListener;
import org.fife.rsta.ui.search.FindToolBar;
import org.fife.ui.rsyntaxtextarea.ErrorStrip;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rtextarea.RTextScrollPane;
import org.fife.ui.rtextarea.SearchContext;
import org.fife.ui.rtextarea.SearchEngine;
import org.fife.ui.rtextarea.SearchResult;
import java.awt.datatransfer.StringSelection;
import org.fife.ui.rsyntaxtextarea.*;
class main {
static String snippetID;
static String savedText, remoteText;
static EditorFrame e;
static class JavaXTokenizer extends AbstractTokenMaker {
public TokenMap getWordsToHighlight() {
return new TokenMap();
}
int currentTokenStart, currentTokenType, startTokenType;
/**
* Returns a list of tokens representing the given text.
*
* @param text The text to break into tokens.
* @param startTokenType The token with which to start tokenizing.
* @param startOffset The offset at which the line of tokens begins.
* @return A linked list of tokens representing text
.
*/
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
resetTokenList();
char[] array = text.array;
int offset = text.offset;
int count = text.count;
int end = offset + count;
// Token starting offsets are always of the form:
// 'startOffset + (currentTokenStart-offset)', but since startOffset and
// offset are constant, tokens' starting positions become:
// 'newStartOffset+currentTokenStart'.
int newStartOffset = startOffset - offset;
currentTokenStart = offset;
currentTokenType = startTokenType;
for (int i=offset; i p = testBracketHygieneExt(text);
String status = "";
if (remoteText != null && neq(remoteText, text))
status = "Changes. ";
if (p == null)
status += "Hygienic";
else {
status += p.b;
//setCaretPosition(ta, p.a);
}
silentStatus(trim(status));
}
static void status(String s) {
silentStatus(infoBoxAndReturn(s));
}
static void silentStatus(String s) {
e.setStatus(s);
}
static void saveSnippetThen(final Runnable next) {
if (empty(snippetID)) return;
final String text = getText(e.textArea);
status("Saving...");
{ Thread _t_0 = new Thread() {
public void run() { try {
final String page = editSnippet(snippetID, text);
remoteText = text; // TODO: check save result
status("Saved snippet: " + page);
awtCallF(next);
} catch (Throwable __e) { printStackTrace2(__e); } }
};
startThread(_t_0); }
}
static void _butterReload() {
{ long _startTime_0 = sysNow(); try { butterReload(snippetID); } finally { _startTime_0 = sysNow()-_startTime_0; saveTiming(_startTime_0); } }
infoBox("Reloaded in " + lastTiming_format100ms());
}
static void transpile(final boolean medium) {
saveSnippetThen(new Runnable() { public void run() { try { _transpile(medium) ;
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "_transpile(medium)"; }});
}
static void _transpile(final boolean medium) {
status("Transpiling...");
//jdisable(btnEleuReload);
{ Thread _t_0 = new Thread("Transpiling") {
public void run() { try {
try {
final Pair p = transpileOnServer(snippetID, medium ? "medium" : "quick");
swingLater(new Runnable() { public void run() { try {
if (p.a)
status("Transpiled OK!");
else {
status("Transpilation error. " + p.b);
showText("Transpilation Error", p.b);
}
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "if (p.a)\n status(\"Transpiled OK!\");\n else {\n status(..."; }});
} catch (Throwable e) { printException(e);
status("Transpilation problem. " + e);
}
//jenable(btnEleuReload);
} catch (Throwable __e) { printStackTrace2(__e); } }
};
startThread(_t_0); }
}
static void _loadSnippet(String snippetID) {
e.textArea.setText(remoteText = loadSnippet(snippetID));
setAndSave("snippetID", snippetID);
frameTitle(e, snippetID);
}
static void newText() {
setAndSave("snippetID" , null);
remoteText = null;
String lastText = e.getText();
if (nempty(lastText)) logQuotedWithDate("saved-texts.log", lastText);
e.setText("");
frameTitle(e, programTitle());
}
static void cleanMeUp() {
setAndSaveIfChanged("savedText" , e.getText());
}
static VF1 vf1(final Object f) {
return new VF1