mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
bring back trailing whitespaces
This commit is contained in:
@@ -90,8 +90,8 @@ import processing.mode.java.JavaEditor;
|
||||
*
|
||||
* @author Martin Leopold <m@martinleopold.com>
|
||||
* @author Manindra Moharana <me@mkmoharana.com>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
// important fields from superclass
|
||||
@@ -134,7 +134,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
protected VariableInspector vi; // the variable inspector frame
|
||||
protected TextArea ta; // the text area
|
||||
|
||||
|
||||
|
||||
protected ErrorBar errorBar;
|
||||
/**
|
||||
* Show Console button
|
||||
@@ -156,46 +156,46 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
* panes
|
||||
*/
|
||||
protected JPanel consoleProblemsPane;
|
||||
|
||||
|
||||
protected XQErrorTable errorTable;
|
||||
|
||||
|
||||
/**
|
||||
* Enable/Disable compilation checking
|
||||
*/
|
||||
protected boolean compilationCheckEnabled = true;
|
||||
|
||||
|
||||
/**
|
||||
* Show warnings menu item
|
||||
*/
|
||||
protected JCheckBoxMenuItem showWarnings;
|
||||
|
||||
|
||||
/**
|
||||
* Check box menu item for show/hide Problem Window
|
||||
*/
|
||||
public JCheckBoxMenuItem problemWindowMenuCB;
|
||||
|
||||
|
||||
/**
|
||||
* Enable/Disable debug ouput
|
||||
*/
|
||||
protected JCheckBoxMenuItem debugMessagesEnabled;
|
||||
|
||||
|
||||
/**
|
||||
* Show outline view
|
||||
*/
|
||||
protected JMenuItem showOutline;
|
||||
|
||||
|
||||
/**
|
||||
* Enable/Disable error logging
|
||||
*/
|
||||
protected JCheckBoxMenuItem writeErrorLog;
|
||||
|
||||
|
||||
/**
|
||||
* Enable/Disable code completion
|
||||
*/
|
||||
protected JCheckBoxMenuItem completionsEnabled;
|
||||
|
||||
|
||||
protected AutoSaveUtil autosaver;
|
||||
|
||||
|
||||
public DebugEditor(Base base, String path, EditorState state, Mode mode) {
|
||||
super(base, path, state, mode);
|
||||
|
||||
@@ -210,7 +210,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
|
||||
// access to customized (i.e. subclassed) text area
|
||||
ta = (TextArea) textarea;
|
||||
|
||||
|
||||
// Add show usage option
|
||||
JMenuItem showUsageItem = new JMenuItem("Show Usage..");
|
||||
showUsageItem.addActionListener(new ActionListener() {
|
||||
@@ -219,15 +219,15 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
}
|
||||
});
|
||||
ta.getRightClickPopup().add(showUsageItem);
|
||||
|
||||
|
||||
// add refactor option
|
||||
JMenuItem renameItem = new JMenuItem("Rename..");
|
||||
renameItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
handleRefactor();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// TODO: Add support for word select on right click and rename.
|
||||
// ta.customPainter.addMouseListener(new MouseAdapter() {
|
||||
// public void mouseClicked(MouseEvent evt) {
|
||||
@@ -256,11 +256,11 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
dbg.setBreakpoint(lineID);
|
||||
}
|
||||
getSketch().setModified(false); // setting breakpoints will flag sketch as modified, so override this here
|
||||
|
||||
|
||||
checkForJavaTabs();
|
||||
initializeErrorChecker();
|
||||
ta.setECSandThemeforTextArea(errorCheckerService, dmode);
|
||||
addXQModeUI();
|
||||
addXQModeUI();
|
||||
debugToolbarEnabled = new AtomicBoolean(false);
|
||||
//log("Sketch Path: " + path);
|
||||
|
||||
@@ -269,9 +269,9 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
// random port for OSC (0xff0 - 0xfff0)
|
||||
oscPort = (int)(Math.random()*0xf000) + 0xff0;
|
||||
}
|
||||
|
||||
|
||||
private void addXQModeUI(){
|
||||
|
||||
|
||||
// Adding ErrorBar
|
||||
JPanel textAndError = new JPanel();
|
||||
Box box = (Box) textarea.getParent();
|
||||
@@ -282,7 +282,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
textarea.setBounds(0, 0, errorBar.getX() - 1, textarea.getHeight());
|
||||
textAndError.add(textarea);
|
||||
box.add(textAndError);
|
||||
|
||||
|
||||
// Adding Error Table in a scroll pane
|
||||
errorTableScrollPane = new JScrollPane();
|
||||
errorTable = new XQErrorTable(errorCheckerService);
|
||||
@@ -320,14 +320,14 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
consoleProblemsPane.add(errorTableScrollPane, XQConsoleToggle.ERRORSLIST);
|
||||
consoleProblemsPane.add(console, XQConsoleToggle.CONSOLE);
|
||||
consolePanel.add(consoleProblemsPane, BorderLayout.CENTER);
|
||||
|
||||
|
||||
// ensure completion gets hidden on editor losing focus
|
||||
addWindowFocusListener(new WindowFocusListener() {
|
||||
addWindowFocusListener(new WindowFocusListener() {
|
||||
public void windowLostFocus(WindowEvent e) {
|
||||
ta.hideSuggestion();
|
||||
}
|
||||
}
|
||||
public void windowGainedFocus(WindowEvent e) {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -353,16 +353,16 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
public void dispose() {
|
||||
//System.out.println("window dispose");
|
||||
// quit running debug session
|
||||
dbg.stopDebug();
|
||||
dbg.stopDebug();
|
||||
// remove var.inspector
|
||||
vi.dispose();
|
||||
errorCheckerService.stopThread();
|
||||
// original dispose
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
// Added temporarily to dump error log. TODO: Remove this later
|
||||
public void internalCloseRunner(){
|
||||
public void internalCloseRunner(){
|
||||
if(ExperimentalMode.errorLogsEnabled) writeErrorsToFile();
|
||||
// if(autosaver != null && !viewingAutosaveBackup) {
|
||||
// log("stopping autosaver in internalCloseRunner");
|
||||
@@ -370,7 +370,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
// }
|
||||
super.internalCloseRunner();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Writes all error messages to a csv file.
|
||||
* For analytics purposes only.
|
||||
@@ -445,14 +445,14 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
});
|
||||
return buildSketchMenu(new JMenuItem[]{runItem, presentItem, stopItem});
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* Whether debug toolbar is enabled
|
||||
*/
|
||||
AtomicBoolean debugToolbarEnabled;
|
||||
|
||||
|
||||
protected EditorToolbar javaToolbar, debugToolbar;
|
||||
|
||||
|
||||
/**
|
||||
* Toggles between java mode and debug mode toolbar
|
||||
*/
|
||||
@@ -474,16 +474,16 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
debugToolbarEnabled.set(true);
|
||||
log("Switching to Debugger Toolbar");
|
||||
}
|
||||
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
Box upper = (Box)splitPane.getComponent(0);
|
||||
Box upper = (Box)splitPane.getComponent(0);
|
||||
upper.remove(0);
|
||||
upper.add(nextToolbar, 0);
|
||||
upper.validate();
|
||||
nextToolbar.repaint();
|
||||
toolbar = nextToolbar;
|
||||
// The toolbar responds to shift down/up events
|
||||
// The toolbar responds to shift down/up events
|
||||
// in order to show the alt version of toolbar buttons.
|
||||
// With toolbar switch, KeyListener has to be changed as well
|
||||
for (KeyListener kl : textarea.getKeyListeners()) {
|
||||
@@ -511,7 +511,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
|
||||
JCheckBoxMenuItem toggleDebugger = new JCheckBoxMenuItem("Show Debug Toolbar");
|
||||
toggleDebugger.setSelected(false);
|
||||
toggleDebugger.addActionListener(new ActionListener() {
|
||||
toggleDebugger.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switchToolbars();
|
||||
}
|
||||
@@ -586,7 +586,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
// TweakMode code end
|
||||
|
||||
// XQMode menu items
|
||||
/*
|
||||
/*
|
||||
JCheckBoxMenuItem item;
|
||||
item = new JCheckBoxMenuItem("Error Checker Enabled");
|
||||
item.setSelected(ExperimentalMode.errorCheckEnabled);
|
||||
@@ -632,7 +632,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
}
|
||||
});
|
||||
debugMenu.add(showWarnings);
|
||||
|
||||
|
||||
completionsEnabled = new JCheckBoxMenuItem("Code Completion Enabled");
|
||||
completionsEnabled.setSelected(ExperimentalMode.codeCompletionsEnabled);
|
||||
completionsEnabled.addActionListener(new ActionListener() {
|
||||
@@ -644,7 +644,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
}
|
||||
});
|
||||
debugMenu.add(completionsEnabled);
|
||||
|
||||
|
||||
debugMessagesEnabled = new JCheckBoxMenuItem("Show Debug Messages");
|
||||
debugMessagesEnabled.setSelected(ExperimentalMode.DEBUG);
|
||||
debugMessagesEnabled.addActionListener(new ActionListener() {
|
||||
@@ -655,12 +655,12 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
dmode.savePreferences();
|
||||
}
|
||||
});
|
||||
debugMenu.add(debugMessagesEnabled);
|
||||
|
||||
debugMenu.add(debugMessagesEnabled);
|
||||
|
||||
showOutline = Toolkit.newJMenuItem("Show Outline", KeyEvent.VK_L);
|
||||
showOutline.addActionListener(this);
|
||||
debugMenu.add(showOutline);
|
||||
|
||||
|
||||
writeErrorLog = new JCheckBoxMenuItem("Write Errors to Log");
|
||||
writeErrorLog.setSelected(ExperimentalMode.errorLogsEnabled);
|
||||
writeErrorLog.addActionListener(new ActionListener() {
|
||||
@@ -672,23 +672,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
}
|
||||
});
|
||||
debugMenu.add(writeErrorLog);
|
||||
|
||||
// TweakMode code
|
||||
debugMenu.addSeparator();
|
||||
enableTweakCB = new JCheckBoxMenuItem("Tweak Enabled");
|
||||
enableTweakCB.setSelected(ExperimentalMode.enableTweak);
|
||||
enableTweakCB.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ExperimentalMode.enableTweak = ((JCheckBoxMenuItem) e
|
||||
.getSource()).isSelected();
|
||||
dmode.savePreferences();
|
||||
}
|
||||
});
|
||||
debugMenu.add(enableTweakCB);
|
||||
// TweakMode code end
|
||||
|
||||
|
||||
debugMenu.addSeparator();
|
||||
JMenuItem jitem = new JMenuItem("PDE X on GitHub");
|
||||
jitem.addActionListener(new ActionListener() {
|
||||
@@ -701,7 +685,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
*/
|
||||
return debugMenu;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JMenu buildModeMenu() {
|
||||
return buildDebugMenu();
|
||||
@@ -885,10 +869,10 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
@Override
|
||||
public boolean handleSave(boolean immediately) {
|
||||
//System.out.println("handleSave " + immediately);
|
||||
|
||||
|
||||
log("handleSave, viewing autosave? " + viewingAutosaveBackup);
|
||||
/* If user wants to save a backup, the backup sketch should get
|
||||
* copied to the main sketch directory, simply reload the main sketch.
|
||||
* copied to the main sketch directory, simply reload the main sketch.
|
||||
*/
|
||||
if(viewingAutosaveBackup){
|
||||
/*
|
||||
@@ -916,7 +900,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
//viewingAutosaveBackup = false;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
// note modified tabs
|
||||
final List<String> modified = new ArrayList();
|
||||
for (int i = 0; i < getSketch().getCodeCount(); i++) {
|
||||
@@ -977,9 +961,9 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
// autosaver.reloadAutosaveDir();
|
||||
return saved;
|
||||
}
|
||||
|
||||
|
||||
private boolean viewingAutosaveBackup;
|
||||
|
||||
|
||||
/**
|
||||
* Loads and starts the auto save service
|
||||
* Also handles the case where an auto save backup is found.
|
||||
@@ -987,7 +971,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
*/
|
||||
private void loadAutoSaver(){
|
||||
log("Load Auto Saver()");
|
||||
autosaver = new AutoSaveUtil(this, ExperimentalMode.autoSaveInterval);
|
||||
autosaver = new AutoSaveUtil(this, ExperimentalMode.autoSaveInterval);
|
||||
if(!autosaver.checkForPastSave()) {
|
||||
autosaver.init();
|
||||
return;
|
||||
@@ -1002,7 +986,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
"was closed unexpectedly last time.",
|
||||
"Select YES to view it or NO to delete the backup.");
|
||||
if(response == JOptionPane.YES_OPTION){
|
||||
handleOpenInternal(pastSave.getAbsolutePath());
|
||||
handleOpenInternal(pastSave.getAbsolutePath());
|
||||
// Base.showMessage("Save it..", "Remember to save the backup sketch to a specific location if you want to.");
|
||||
//log(getSketch().getMainFilePath());
|
||||
log("loadAutoSaver, viewing autosave? " + viewingAutosaveBackup);
|
||||
@@ -1124,7 +1108,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
return ta;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Grab current contents of the sketch window, advance the console, stop any
|
||||
* other running sketches, auto-save the user's code... not in that order.
|
||||
@@ -1235,8 +1219,8 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
statusError(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Access variable inspector window.
|
||||
*
|
||||
@@ -1542,7 +1526,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
public void statusHalted() {
|
||||
statusNotice("Debugger halted.");
|
||||
}
|
||||
|
||||
|
||||
public static final int STATUS_EMPTY = 100, STATUS_COMPILER_ERR = 200,
|
||||
STATUS_WARNING = 300, STATUS_INFO = 400, STATUS_ERR = 500;
|
||||
public int statusMessageType = STATUS_EMPTY;
|
||||
@@ -1562,13 +1546,13 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
super.statusError(what);
|
||||
break;
|
||||
case STATUS_INFO:
|
||||
case STATUS_WARNING:
|
||||
statusNotice(what);
|
||||
case STATUS_WARNING:
|
||||
statusNotice(what);
|
||||
break;
|
||||
}
|
||||
// Don't need to clear compiler error messages
|
||||
if(type == STATUS_COMPILER_ERR) return;
|
||||
|
||||
|
||||
// Clear the message after a delay
|
||||
SwingWorker s = new SwingWorker<Void, Void>() {
|
||||
@Override
|
||||
@@ -1584,15 +1568,15 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
};
|
||||
s.execute();
|
||||
}
|
||||
|
||||
|
||||
public void statusEmpty(){
|
||||
statusMessage = null;
|
||||
statusMessageType = STATUS_EMPTY;
|
||||
super.statusEmpty();
|
||||
}
|
||||
|
||||
|
||||
ErrorCheckerService errorCheckerService;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes and starts Error Checker Service
|
||||
*/
|
||||
@@ -1614,7 +1598,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the error bar
|
||||
* @param problems
|
||||
@@ -1625,7 +1609,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
|
||||
/**
|
||||
* Toggle between Console and Errors List
|
||||
*
|
||||
*
|
||||
* @param buttonName
|
||||
* - Button Label
|
||||
*/
|
||||
@@ -1633,7 +1617,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
CardLayout cl = (CardLayout) consoleProblemsPane.getLayout();
|
||||
cl.show(consoleProblemsPane, buttonName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the error table
|
||||
* @param tableModel
|
||||
@@ -1642,7 +1626,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
synchronized public boolean updateTable(final TableModel tableModel) {
|
||||
return errorTable.updateTable(tableModel);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle whether the tiny red error indicator is shown near the error button
|
||||
* at the bottom of the PDE
|
||||
@@ -1651,7 +1635,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
btnShowErrors.updateMarker(ExperimentalMode.errorCheckEnabled
|
||||
&& errorCheckerService.hasErrors(), errorBar.errorColor);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle refactor operation
|
||||
*/
|
||||
@@ -1660,7 +1644,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
log(ta.getLineText(ta.getCaretLine()));
|
||||
errorCheckerService.getASTGenerator().handleRefactor();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle show usage operation
|
||||
*/
|
||||
@@ -1669,7 +1653,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
log(ta.getLineText(ta.getCaretLine()));
|
||||
errorCheckerService.getASTGenerator().handleShowUsage();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the sketch contains java tabs. If it does, XQMode ain't built
|
||||
* for it, yet. Also, user should really start looking at Eclipse. Disable
|
||||
@@ -1688,7 +1672,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void applyPreferences() {
|
||||
super.applyPreferences();
|
||||
if (dmode != null) {
|
||||
|
||||
@@ -49,15 +49,15 @@ import processing.mode.java.runner.Runner;
|
||||
|
||||
|
||||
/**
|
||||
* Experimental Mode for Processing, combines Debug Mode and XQMode and
|
||||
* Experimental Mode for Processing, combines Debug Mode and XQMode and
|
||||
* starts us working toward our next generation editor/debugger setup.
|
||||
*/
|
||||
public class ExperimentalMode extends JavaMode {
|
||||
public static final boolean VERBOSE_LOGGING = true;
|
||||
//public static final boolean VERBOSE_LOGGING = false;
|
||||
//public static final boolean VERBOSE_LOGGING = false;
|
||||
public static final int LOG_SIZE = 512 * 1024; // max log file size (in bytes)
|
||||
public static boolean DEBUG = !true;
|
||||
|
||||
|
||||
public ExperimentalMode(Base base, File folder) {
|
||||
super(base, folder);
|
||||
|
||||
@@ -118,14 +118,14 @@ public class ExperimentalMode extends JavaMode {
|
||||
public String getTitle() {
|
||||
return "PDE X";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public File[] getKeywordFiles() {
|
||||
return new File[] {
|
||||
Base.getContentFile("modes/java/keywords.txt")
|
||||
return new File[] {
|
||||
Base.getContentFile("modes/java/keywords.txt")
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public File getContentFile(String path) {
|
||||
// workaround for #45
|
||||
if (path.startsWith("application" + File.separator)) {
|
||||
@@ -134,7 +134,7 @@ public class ExperimentalMode extends JavaMode {
|
||||
}
|
||||
return new File(folder, path);
|
||||
}
|
||||
|
||||
|
||||
volatile public static boolean errorCheckEnabled = true,
|
||||
warningsEnabled = true, codeCompletionsEnabled = true,
|
||||
debugOutputEnabled = false, errorLogsEnabled = false,
|
||||
@@ -142,7 +142,7 @@ public class ExperimentalMode extends JavaMode {
|
||||
defaultAutoSaveEnabled = true, // ,untitledAutoSaveEnabled;
|
||||
ccTriggerEnabled = false;
|
||||
public static int autoSaveInterval = 3; //in minutes
|
||||
|
||||
|
||||
/**
|
||||
* After how many typed characters, code completion is triggered
|
||||
*/
|
||||
@@ -154,7 +154,7 @@ public class ExperimentalMode extends JavaMode {
|
||||
prefDebugOP = "pdex.dbgOutput",
|
||||
prefErrorLogs = "pdex.writeErrorLogs",
|
||||
prefAutoSaveInterval = "pdex.autoSaveInterval",
|
||||
prefAutoSave = "pdex.autoSave.autoSaveEnabled", // prefUntitledAutoSave = "pdex.autoSave.untitledAutoSaveEnabled",
|
||||
prefAutoSave = "pdex.autoSave.autoSaveEnabled", // prefUntitledAutoSave = "pdex.autoSave.untitledAutoSaveEnabled",
|
||||
prefAutoSavePrompt = "pdex.autoSave.promptDisplay",
|
||||
prefDefaultAutoSave = "pdex.autoSave.autoSaveByDefault",
|
||||
prefCCTriggerEnabled = "pdex.ccTriggerEnabled";
|
||||
@@ -214,7 +214,7 @@ public class ExperimentalMode extends JavaMode {
|
||||
Preferences.setBoolean(prefErrorLogs, errorLogsEnabled);
|
||||
if (Preferences.get(prefAutoSaveInterval) == null)
|
||||
Preferences.setInteger(prefAutoSaveInterval, autoSaveInterval);
|
||||
// if(Preferences.get(prefUntitledAutoSave) == null)
|
||||
// if(Preferences.get(prefUntitledAutoSave) == null)
|
||||
// Preferences.setBoolean(prefUntitledAutoSave,untitledAutoSaveEnabled);
|
||||
if (Preferences.get(prefAutoSave) == null)
|
||||
Preferences.setBoolean(prefAutoSave, autoSaveEnabled);
|
||||
@@ -257,7 +257,7 @@ public class ExperimentalMode extends JavaMode {
|
||||
Logger.getLogger(getClass().getName()).log(Level.WARNING, "Error loading String: {0}", attribute);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load a Color value from theme.txt
|
||||
@@ -276,7 +276,7 @@ public class ExperimentalMode extends JavaMode {
|
||||
Logger.getLogger(ExperimentalMode.class.getName()).log(Level.WARNING, "Error loading Color: {0}", attribute);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
protected ImageIcon classIcon, fieldIcon, methodIcon, localVarIcon;
|
||||
protected void loadIcons(){
|
||||
String iconPath = getContentFile("data")
|
||||
@@ -286,13 +286,13 @@ public class ExperimentalMode extends JavaMode {
|
||||
methodIcon = new ImageIcon(iconPath + File.separator
|
||||
+ "methpub_obj.png");
|
||||
fieldIcon = new ImageIcon(iconPath + File.separator
|
||||
+ "field_protected_obj.png");
|
||||
+ "field_protected_obj.png");
|
||||
localVarIcon = new ImageIcon(iconPath + File.separator
|
||||
+ "field_default_obj.png");
|
||||
log("Icons loaded");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ClassLoader getJavaModeClassLoader() {
|
||||
for (Mode m : base.getModeList()) {
|
||||
if (m.getClass() == JavaMode.class) {
|
||||
@@ -303,7 +303,7 @@ public class ExperimentalMode extends JavaMode {
|
||||
// badness
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* System.out.println()
|
||||
*/
|
||||
@@ -311,7 +311,7 @@ public class ExperimentalMode extends JavaMode {
|
||||
if(ExperimentalMode.DEBUG)
|
||||
System.out.println(message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* System.err.println()
|
||||
*/
|
||||
@@ -319,7 +319,7 @@ public class ExperimentalMode extends JavaMode {
|
||||
if(ExperimentalMode.DEBUG)
|
||||
System.err.println(message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* System.out.print
|
||||
*/
|
||||
@@ -327,7 +327,7 @@ public class ExperimentalMode extends JavaMode {
|
||||
if(ExperimentalMode.DEBUG)
|
||||
System.out.print(message);
|
||||
}
|
||||
|
||||
|
||||
public String[] getIgnorable() {
|
||||
return new String[] {
|
||||
"applet",
|
||||
|
||||
@@ -44,7 +44,7 @@ import processing.app.syntax.JEditTextArea;
|
||||
import processing.app.syntax.TextAreaDefaults;
|
||||
/**
|
||||
* Customized text area. Adds support for line background colors.
|
||||
*
|
||||
*
|
||||
* @author Martin Leopold <m@martinleopold.com>
|
||||
*/
|
||||
public class TextArea extends JEditTextArea {
|
||||
@@ -135,7 +135,7 @@ public class TextArea extends JEditTextArea {
|
||||
|
||||
/**
|
||||
* Sets ErrorCheckerService and loads theme for TextArea(XQMode)
|
||||
*
|
||||
*
|
||||
* @param ecs
|
||||
* @param mode
|
||||
*/
|
||||
@@ -150,7 +150,7 @@ public class TextArea extends JEditTextArea {
|
||||
* Code completion begins from here.
|
||||
*/
|
||||
public void processKeyEvent(KeyEvent evt) {
|
||||
|
||||
|
||||
if(evt.getKeyCode() == KeyEvent.VK_ESCAPE){
|
||||
if(suggestion != null){
|
||||
if(suggestion.isVisible()){
|
||||
@@ -165,15 +165,15 @@ public class TextArea extends JEditTextArea {
|
||||
if (suggestion != null) {
|
||||
if (suggestion.isVisible()) {
|
||||
if (suggestion.insertSelection()) {
|
||||
hideSuggestion(); // Kill it!
|
||||
hideSuggestion(); // Kill it!
|
||||
evt.consume();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (evt.getID() == KeyEvent.KEY_PRESSED) {
|
||||
switch (evt.getKeyCode()) {
|
||||
case KeyEvent.VK_DOWN:
|
||||
@@ -209,7 +209,7 @@ public class TextArea extends JEditTextArea {
|
||||
super.processKeyEvent(evt);
|
||||
|
||||
if (evt.getID() == KeyEvent.KEY_TYPED) {
|
||||
|
||||
|
||||
char keyChar = evt.getKeyChar();
|
||||
if (keyChar == KeyEvent.VK_ENTER || keyChar == KeyEvent.VK_ESCAPE) {
|
||||
return;
|
||||
@@ -240,7 +240,7 @@ public class TextArea extends JEditTextArea {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SwingWorker worker = new SwingWorker() {
|
||||
protected Object doInBackground() throws Exception {
|
||||
// errorCheckerService.runManualErrorCheck();
|
||||
@@ -259,12 +259,12 @@ public class TextArea extends JEditTextArea {
|
||||
worker.execute();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the word on which the mouse pointer is present
|
||||
* @param evt - the MouseEvent which triggered this method
|
||||
* @param evt - the MouseEvent which triggered this method
|
||||
* @return
|
||||
*/
|
||||
private String fetchPhrase(MouseEvent evt) {
|
||||
@@ -327,16 +327,16 @@ public class TextArea extends JEditTextArea {
|
||||
return word.trim();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the current word typed just before the caret.
|
||||
* Then triggers code completion for that word.
|
||||
*
|
||||
* @param evt - the KeyEvent which triggered this method
|
||||
*
|
||||
* @param evt - the KeyEvent which triggered this method
|
||||
* @return
|
||||
*/
|
||||
private String fetchPhrase(KeyEvent evt) {
|
||||
|
||||
|
||||
int off = getCaretPosition();
|
||||
log2("off " + off);
|
||||
if (off < 0)
|
||||
@@ -356,7 +356,7 @@ public class TextArea extends JEditTextArea {
|
||||
if(x >= s.length() || x < 0)
|
||||
return null; //TODO: Does this check cause problems? Verify.
|
||||
log2(" x char: " + s.charAt(x));
|
||||
//int xLS = off - getLineStartNonWhiteSpaceOffset(line);
|
||||
//int xLS = off - getLineStartNonWhiteSpaceOffset(line);
|
||||
|
||||
String word = (x < s.length() ? s.charAt(x) : "") + "";
|
||||
if (s.trim().length() == 1) {
|
||||
@@ -366,7 +366,7 @@ public class TextArea extends JEditTextArea {
|
||||
word = word.trim();
|
||||
if (word.endsWith("."))
|
||||
word = word.substring(0, word.length() - 1);
|
||||
|
||||
|
||||
errorCheckerService.getASTGenerator().preparePredictions(word, line
|
||||
+ errorCheckerService.mainClassOffset,0);
|
||||
return word;
|
||||
@@ -444,7 +444,7 @@ public class TextArea extends JEditTextArea {
|
||||
|
||||
/**
|
||||
* Retrieve the total width of the gutter area.
|
||||
*
|
||||
*
|
||||
* @return gutter width in pixels
|
||||
*/
|
||||
protected int getGutterWidth() {
|
||||
@@ -464,7 +464,7 @@ public class TextArea extends JEditTextArea {
|
||||
/**
|
||||
* Retrieve the width of margins applied to the left and right of the gutter
|
||||
* text.
|
||||
*
|
||||
*
|
||||
* @return margins in pixels
|
||||
*/
|
||||
protected int getGutterMargins() {
|
||||
@@ -476,7 +476,7 @@ public class TextArea extends JEditTextArea {
|
||||
|
||||
/**
|
||||
* Set the gutter text of a specific line.
|
||||
*
|
||||
*
|
||||
* @param lineIdx
|
||||
* the line index (0-based)
|
||||
* @param text
|
||||
@@ -489,7 +489,7 @@ public class TextArea extends JEditTextArea {
|
||||
|
||||
/**
|
||||
* Set the gutter text and color of a specific line.
|
||||
*
|
||||
*
|
||||
* @param lineIdx
|
||||
* the line index (0-based)
|
||||
* @param text
|
||||
@@ -504,7 +504,7 @@ public class TextArea extends JEditTextArea {
|
||||
|
||||
/**
|
||||
* Clear the gutter text of a specific line.
|
||||
*
|
||||
*
|
||||
* @param lineIdx
|
||||
* the line index (0-based)
|
||||
*/
|
||||
@@ -525,7 +525,7 @@ public class TextArea extends JEditTextArea {
|
||||
|
||||
/**
|
||||
* Retrieve the gutter text of a specific line.
|
||||
*
|
||||
*
|
||||
* @param lineIdx
|
||||
* the line index (0-based)
|
||||
* @return the gutter text
|
||||
@@ -536,7 +536,7 @@ public class TextArea extends JEditTextArea {
|
||||
|
||||
/**
|
||||
* Retrieve the gutter text color for a specific line.
|
||||
*
|
||||
*
|
||||
* @param lineIdx
|
||||
* the line index
|
||||
* @return the gutter text color
|
||||
@@ -547,7 +547,7 @@ public class TextArea extends JEditTextArea {
|
||||
|
||||
/**
|
||||
* Set the background color of a line.
|
||||
*
|
||||
*
|
||||
* @param lineIdx
|
||||
* 0-based line number
|
||||
* @param col
|
||||
@@ -560,7 +560,7 @@ public class TextArea extends JEditTextArea {
|
||||
|
||||
/**
|
||||
* Clear the background color of a line.
|
||||
*
|
||||
*
|
||||
* @param lineIdx
|
||||
* 0-based line number
|
||||
*/
|
||||
@@ -581,7 +581,7 @@ public class TextArea extends JEditTextArea {
|
||||
|
||||
/**
|
||||
* Get a lines background color.
|
||||
*
|
||||
*
|
||||
* @param lineIdx
|
||||
* 0-based line number
|
||||
* @return the color or null if no color was set for the specified line
|
||||
@@ -593,7 +593,7 @@ public class TextArea extends JEditTextArea {
|
||||
/**
|
||||
* Convert a character offset to a horizontal pixel position inside the text
|
||||
* area. Overridden to take gutter width into account.
|
||||
*
|
||||
*
|
||||
* @param line
|
||||
* the 0-based line number
|
||||
* @param offset
|
||||
@@ -608,7 +608,7 @@ public class TextArea extends JEditTextArea {
|
||||
/**
|
||||
* Convert a horizontal pixel position to a character offset. Overridden to
|
||||
* take gutter width into account.
|
||||
*
|
||||
*
|
||||
* @param line
|
||||
* the 0-based line number
|
||||
* @param x
|
||||
@@ -650,7 +650,7 @@ public class TextArea extends JEditTextArea {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (me.getButton() == MouseEvent.BUTTON3) {
|
||||
fetchPhrase(me);
|
||||
}
|
||||
@@ -756,8 +756,8 @@ public class TextArea extends JEditTextArea {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates location of caret and displays the suggestion popup at the location.
|
||||
*
|
||||
* Calculates location of caret and displays the suggestion popup at the location.
|
||||
*
|
||||
* @param defListModel
|
||||
* @param subWord
|
||||
*/
|
||||
@@ -788,7 +788,7 @@ public class TextArea extends JEditTextArea {
|
||||
location,editor);
|
||||
// else
|
||||
// suggestion.updateList(defListModel, subWord, location, position);
|
||||
//
|
||||
//
|
||||
// suggestion.setVisible(true);
|
||||
requestFocusInWindow();
|
||||
// SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@@ -49,7 +49,7 @@ import processing.app.syntax.TokenMarker;
|
||||
/**
|
||||
* Customized line painter. Adds support for background colors, left hand gutter
|
||||
* area with background color and text.
|
||||
*
|
||||
*
|
||||
* @author Martin Leopold <m@martinleopold.com>
|
||||
*/
|
||||
public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
@@ -160,7 +160,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
}
|
||||
if (Character.isDigit(word.charAt(0)))
|
||||
return;
|
||||
|
||||
|
||||
log(errorCheckerService.mainClassOffset + line +
|
||||
"|" + line + "| offset " + xLS + word + " <= \n");
|
||||
errorCheckerService.getASTGenerator()
|
||||
@@ -180,7 +180,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
/**
|
||||
* Paint a line. Paints the gutter (with background color and text) then the
|
||||
* line (background color and text).
|
||||
*
|
||||
*
|
||||
* @param gfx
|
||||
* the graphics context
|
||||
* @param tokenMarker
|
||||
@@ -193,7 +193,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
protected void paintLine(Graphics gfx, TokenMarker tokenMarker, int line,
|
||||
int x) {
|
||||
try {
|
||||
//TODO: This line is causing NPE's randomly ever since I added the toggle for
|
||||
//TODO: This line is causing NPE's randomly ever since I added the toggle for
|
||||
//Java Mode/Debugger toolbar.
|
||||
super.paintLine(gfx, tokenMarker, line, x + ta.getGutterWidth());
|
||||
} catch (Exception e) {
|
||||
@@ -202,22 +202,22 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
if(ta.editor.debugToolbarEnabled != null && ta.editor.debugToolbarEnabled.get()){
|
||||
// paint gutter
|
||||
paintGutterBg(gfx, line, x);
|
||||
|
||||
|
||||
// disabled line background after P5 2.1, since it adds highlight by default
|
||||
//paintLineBgColor(gfx, line, x + ta.getGutterWidth());
|
||||
|
||||
//paintLineBgColor(gfx, line, x + ta.getGutterWidth());
|
||||
|
||||
paintGutterLine(gfx, line, x);
|
||||
|
||||
|
||||
// paint gutter symbol
|
||||
paintGutterText(gfx, line, x);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
paintErrorLine(gfx, line, x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Paint the gutter background (solid color).
|
||||
*
|
||||
*
|
||||
* @param gfx
|
||||
* the graphics context
|
||||
* @param line
|
||||
@@ -233,7 +233,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
|
||||
/**
|
||||
* Paint the vertical gutter separator line.
|
||||
*
|
||||
*
|
||||
* @param gfx
|
||||
* the graphics context
|
||||
* @param line
|
||||
@@ -250,7 +250,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
|
||||
/**
|
||||
* Paint the gutter text.
|
||||
*
|
||||
*
|
||||
* @param gfx
|
||||
* the graphics context
|
||||
* @param line
|
||||
@@ -287,7 +287,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
|
||||
/**
|
||||
* Paint the background color of a line.
|
||||
*
|
||||
*
|
||||
* @param gfx
|
||||
* the graphics context
|
||||
* @param line
|
||||
@@ -314,7 +314,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
|
||||
/**
|
||||
* Paints the underline for an error/warning line
|
||||
*
|
||||
*
|
||||
* @param gfx
|
||||
* the graphics context
|
||||
* @param tokenMarker
|
||||
@@ -334,7 +334,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
boolean notFound = true;
|
||||
boolean isWarning = false;
|
||||
Problem problem = null;
|
||||
|
||||
|
||||
// Check if current line contains an error. If it does, find if it's an
|
||||
// error or warning
|
||||
for (ErrorMarker emarker : errorCheckerService.getEditor().errorBar.errorPoints) {
|
||||
@@ -362,7 +362,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
int start = ta.getLineStartOffset(line) + problem.getPDELineStartOffset();
|
||||
int pLength = problem.getPDELineStopOffset() + 1
|
||||
- problem.getPDELineStartOffset();
|
||||
|
||||
|
||||
try {
|
||||
String badCode = null;
|
||||
String goodCode = null;
|
||||
@@ -394,7 +394,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
// gfx.fillRect(x1, y, rw, height);
|
||||
|
||||
// Let the painting begin!
|
||||
|
||||
|
||||
// Little rect at starting of a line containing errors - disabling it for now
|
||||
// gfx.setColor(errorMarkerColor);
|
||||
// if (isWarning) {
|
||||
@@ -402,7 +402,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
// }
|
||||
// gfx.fillRect(1, y + 2, 3, height - 2);
|
||||
|
||||
|
||||
|
||||
gfx.setColor(errorColor);
|
||||
if (isWarning) {
|
||||
gfx.setColor(warningColor);
|
||||
@@ -430,7 +430,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
|
||||
/**
|
||||
* Trims out trailing whitespaces (to the right)
|
||||
*
|
||||
*
|
||||
* @param string
|
||||
* @return - String
|
||||
*/
|
||||
@@ -447,7 +447,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
|
||||
|
||||
/**
|
||||
* Sets ErrorCheckerService and loads theme for TextAreaPainter(XQMode)
|
||||
*
|
||||
*
|
||||
* @param ecs
|
||||
* @param mode
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user