This rationalization helps to better follow the swing abstractions
of table models and increase separation of concerns.
(WIP: ContributedPlatforms needs a similar refactoring that will be
done in the next commits)
When a sketch has unsaved changes, a temporary copy of the sketch is
made with those changes applied. This copy is then passed to
arduino-builder.
Previously, the name of this directory contained a hash of the main
sketch filename, so the same directory would be used between builds. Now
that this directory is deleted after every build, it can just use a
randomized directory name, which is what this commit does.
Addtionally, the prefix used for generating the name is changed from
"arduino_" to "arduino_modified_sketch_" to make it slightly clearer
what the directory is for (just in case it somehow survives the build,
or a user sees it during the build).
When a sketch has unsaved changes, a temporary copy of the sketch is
made with those changes applied. This copy is then passed to
arduino-builder.
Previously, this temporary copy was kept around and only deleted when
the IDE was closed. However, all files were written to it again on every
build, so keeping the old files around did not serve any real purpose.
When a file was renamed in the IDE, the original name would still be
present in the temporary copy, and could cause linker errors because
both were compiled.
This commit makes sure the temporary copy is deleted after every build,
instead of at IDE exit, which fixes this problem with renames.
When a file is deleted from the sketch, the file would also be deleted
from the temporary copy, presumably to fix this same problem for
deletes (but renames were forgotten). With this commit, this special
handling for deleting files is no longer needed, so it is removed.
This fixes#4335
The error triggered inside ContributioIndexer.mergeContributions()
while trying to remove a platform:
if (platform != null) {
targetPackage.getPlatforms().remove(platform);
}
remove() method calls ContributedPlatform.equals() to find the
element to remove but since the parentPackage fields are resolved
*after* merging contributions, the equls() method will fail with
a NullPointerException.
Previously, there was a handler on the text area that consumed most
KEY_TYPED events with control pressed. This was added a long time ago to
fix a problem with ctrl-slash doing both the toggle comment action and
inserting a /. Further investigation shows that with RSyntaxTextArea
this problem is still present, but is caused by a weird binding on the
slash key that Arduino is not even using. Removing that binding is a
cleaner workaround for this problem, so this commit switches to that
workaround.
Ideally this would be fixed in RSyntaxTextArea, see
https://github.com/bobbylight/RSyntaxTextArea/issues/157
In the previous commit, these bindings were moved to EditorTab and
registered in a cleaner way, but this move also allows more components
to hijack these keystrokes and prevent them from reaching EditorTab.
This commit makes the keybindings work again, by preventing other
components from handling the keys. In particular:
- JSplitPane had a binding to switch between its two panes, which is
now removed after creating the JSplitPane.
- The default focus traversal manager in Swing uses these keys to
traverse focus (in addition to the the normal tab and shift-tab
keys). By removing these keys from the set of "focus traversal keys"
defined for the window, this should be prevented when the focus is on
any component inside the window.
- JTextPane didn't respond to the previous modification of the
window-default focus traversal keys, since it defines its own set (to
only contain ctrl-tab and ctrl-shift-tab, but not tab and shift-tab,
for undocumented reasons). To fix this, focus traversal is simply
disabled on the JTextPane, since this wasn't really being used
anyway.
There was some code in SketchTextArea that tried to modify the focus
traversal keys for just the text area, which is now removed. This code
wasn't really useful, since focus traversal is disabled for the text
area already. Also, the code contained a bug where it would not actually
set the new set of keys for the backward focus traversal.
Closes#195
Previously, EditorListener handled these keys, by registering a handler
in the text area. This meant that they would only work while the text
area was focused. By registering the keys as WHEN_IN_FOCUSED_WINDOW
bindings, they can always be handled, and EditorHeader seems like a more
appropriate place.
Note that this does not currently work (so this commit breaks these
keys), since these keys are also handled in a few different places as
well, preventing these newly added keybindings to take effect. This will
be fixed in the next commit.
One additional change is that previously, these keybindings did not work
when the text area was readonly. This was probably a remnant from when
EditorListener took care of a lot of other editing keybindings, but
this does not make much sense anymore now.
Finally, with the old bindings, ctrl-shift-tab did not (seem to) work.
What happened is that the binding for ctrl-tab did not check the shift
state, so both bindings would fire on ctrl-shift-tab, switching forward
and back again, making it seem the keys did not work. The Swing
keybinding mechanism that is now used for these bindings checks the
complete keystroke, including all modifier keys, so this problem is
fixed by this change.
References #195