1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-17 06:52:18 +01:00

Base: removed dead code

This commit is contained in:
Federico Fissore 2015-07-08 17:44:57 +02:00
parent 09e2fedf52
commit a906f23287

View File

@ -1910,25 +1910,6 @@ public class Base {
}
// someone needs to be slapped
//static KeyStroke closeWindowKeyStroke;
/**
* Return true if the key event was a Ctrl-W or an ESC,
* both indicators to close the window.
* Use as part of a keyPressed() event handler for frames.
*/
/*
static public boolean isCloseWindowEvent(KeyEvent e) {
if (closeWindowKeyStroke == null) {
int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
closeWindowKeyStroke = KeyStroke.getKeyStroke('W', modifiers);
}
return ((e.getKeyCode() == KeyEvent.VK_ESCAPE) ||
KeyStroke.getKeyStrokeForEvent(e).equals(closeWindowKeyStroke));
}
*/
/**
* Registers key events for a Ctrl-W and ESC with an ActionListener
* that will take care of disposing the window.
@ -2038,158 +2019,6 @@ public class Base {
}
// ...................................................................
// incomplete
static public int showYesNoCancelQuestion(Editor editor, String title,
String primary, String secondary) {
if (!OSUtils.isMacOS()) {
int result =
JOptionPane.showConfirmDialog(null, primary + "\n" + secondary, title,
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE);
return result;
// if (result == JOptionPane.YES_OPTION) {
//
// } else if (result == JOptionPane.NO_OPTION) {
// return true; // ok to continue
//
// } else if (result == JOptionPane.CANCEL_OPTION) {
// return false;
//
// } else {
// throw new IllegalStateException();
// }
} else {
JOptionPane pane =
new JOptionPane("<html> " +
"<head> <style type=\"text/css\">" +
"b { font: 13pt \"Lucida Grande\" }" +
"p { font: 11pt \"Lucida Grande\"; margin-top: 8px }" +
"</style> </head>" +
"<b>Do you want to save changes to this sketch<BR>" +
" before closing?</b>" +
"<p>If you don't save, your changes will be lost.",
JOptionPane.QUESTION_MESSAGE);
String[] options = new String[]{
"Save", "Cancel", "Don't Save"
};
pane.setOptions(options);
// highlight the safest option ala apple hig
pane.setInitialValue(options[0]);
JDialog dialog = pane.createDialog(editor, null);
dialog.setVisible(true);
Object result = pane.getValue();
if (result == options[0]) {
return JOptionPane.YES_OPTION;
} else if (result == options[1]) {
return JOptionPane.CANCEL_OPTION;
} else if (result == options[2]) {
return JOptionPane.NO_OPTION;
} else {
return JOptionPane.CLOSED_OPTION;
}
}
}
//if (result == JOptionPane.YES_OPTION) {
//
// } else if (result == JOptionPane.NO_OPTION) {
// return true; // ok to continue
//
// } else if (result == JOptionPane.CANCEL_OPTION) {
// return false;
//
// } else {
// throw new IllegalStateException();
// }
static public int showYesNoQuestion(Frame editor, String title,
String primary, String secondary) {
if (!OSUtils.isMacOS()) {
return JOptionPane.showConfirmDialog(editor,
"<html><body>" +
"<b>" + primary + "</b>" +
"<br>" + secondary, title,
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);
} else {
JOptionPane pane =
new JOptionPane("<html> " +
"<head> <style type=\"text/css\">" +
"b { font: 13pt \"Lucida Grande\" }" +
"p { font: 11pt \"Lucida Grande\"; margin-top: 8px }" +
"</style> </head>" +
"<b>" + primary + "</b>" +
"<p>" + secondary + "</p>",
JOptionPane.QUESTION_MESSAGE);
String[] options = new String[]{
"Yes", "No"
};
pane.setOptions(options);
// highlight the safest option ala apple hig
pane.setInitialValue(options[0]);
JDialog dialog = pane.createDialog(editor, null);
dialog.setVisible(true);
Object result = pane.getValue();
if (result == options[0]) {
return JOptionPane.YES_OPTION;
} else if (result == options[1]) {
return JOptionPane.NO_OPTION;
} else {
return JOptionPane.CLOSED_OPTION;
}
}
}
/**
* Retrieve a path to something in the Processing folder. Eventually this
* may refer to the Contents subfolder of Processing.app, if we bundle things
* up as a single .app file with no additional folders.
*/
// static public String getContentsPath(String filename) {
// String basePath = System.getProperty("user.dir");
// /*
// // do this later, when moving to .app package
// if (PApplet.platform == PConstants.MACOSX) {
// basePath = System.getProperty("processing.contents");
// }
// */
// return basePath + File.separator + filename;
// }
/**
* Get a path for something in the Processing lib folder.
*/
/*
static public String getLibContentsPath(String filename) {
String libPath = getContentsPath("lib/" + filename);
File libDir = new File(libPath);
if (libDir.exists()) {
return libPath;
}
// was looking into making this run from Eclipse, but still too much mess
// libPath = getContents("build/shared/lib/" + what);
// libDir = new File(libPath);
// if (libDir.exists()) {
// return libPath;
// }
return null;
}
*/
static public File getContentFile(String name) {
return BaseNoGui.getContentFile(name);
}