mirror of
https://github.com/processing/processing4.git
synced 2026-02-11 09:39:19 +01:00
fixing up editor for 71
This commit is contained in:
@@ -46,6 +46,8 @@ public class PdeEditorHeader extends JComponent {
|
||||
JMenu menu;
|
||||
JPopupMenu popup;
|
||||
|
||||
JMenuItem renameItem;
|
||||
|
||||
int menuLeft;
|
||||
int menuRight;
|
||||
|
||||
@@ -166,6 +168,9 @@ public class PdeEditorHeader extends JComponent {
|
||||
tabRight = new int[sketch.codeCount];
|
||||
}
|
||||
|
||||
// disable rename on the first tab
|
||||
renameItem.setEnabled(sketch.current != sketch.code[0]);
|
||||
|
||||
int x = PdePreferences.GUI_SMALL;
|
||||
for (int i = 0; i < sketch.codeCount; i++) {
|
||||
PdeCode code = sketch.code[i];
|
||||
@@ -293,6 +298,7 @@ public class PdeEditorHeader extends JComponent {
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
renameItem = item;
|
||||
|
||||
item = new JMenuItem("Delete");
|
||||
item.addActionListener(new ActionListener() {
|
||||
|
||||
@@ -704,7 +704,7 @@ public class PdeSketch {
|
||||
}
|
||||
|
||||
// make sure they aren't the same file
|
||||
if (sourceFile.equals(destFile)) {
|
||||
if (!addingCode && sourceFile.equals(destFile)) {
|
||||
PdeBase.showWarning("You can't fool me",
|
||||
"This file has already been copied to the\n" +
|
||||
"location where you're trying to add it.\n" +
|
||||
@@ -712,12 +712,16 @@ public class PdeSketch {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
PdeBase.copyFile(sourceFile, destFile);
|
||||
} catch (IOException e) {
|
||||
PdeBase.showWarning("Error adding file",
|
||||
"Could not add '" + filename +
|
||||
"' to the sketch.", e);
|
||||
// in case the user is "adding" the code in an attempt
|
||||
// to update the sketch's tabs
|
||||
if (!sourceFile.equals(destFile)) {
|
||||
try {
|
||||
PdeBase.copyFile(sourceFile, destFile);
|
||||
} catch (IOException e) {
|
||||
PdeBase.showWarning("Error adding file",
|
||||
"Could not add '" + filename +
|
||||
"' to the sketch.", e);
|
||||
}
|
||||
}
|
||||
|
||||
// make the tabs update after this guy is added
|
||||
|
||||
Reference in New Issue
Block a user