RSyntaxTextArea appears to support using a single instance and replacing
the underlying text and document when switching between tabs, but in
practice this support is not complete and even though the
RSyntaxTextArea developers did some work to improve the situation, they
recommend to just use a seperate instance for each tab.
This commit implements exactly that. A new class EditorTab is introduce
to wrap the RSyntaxTextArea and containing scroll pane, and to
encapsulate the code related to handling the text area itself. Doing so
removes some quirks and prepares for some later additions. In
particular, error highlights are now no longer shared between all tabs,
which was previously the case.
This commit mostly moves code from Editor into EditorTab, and updates
the callers to use getCurrentTab() and call methods on the result
instead of calling them on Editor. Some code is added to take care of
creating multiple EditorTab objects and switching between them. Some
small changes have been made to make the flow of opening files work,
though these are mostly a bit hacky.
While moving code, changes to the rest of the code were kept minimal,
retaining existing interfaces as much as possible. This sometimes result
in less than ideal code, which should be cleaned up in subsequent
commits.
The SketchCodeDocument class has been pretty much emptied out, since
it was mostly used to store things for tabs in the background, which are
now just stored in each RSyntaxTextArea separately. The last remaining
bits of this class can probably be moved or implemented differently
later, so it can be removed.
The entire flow of working with sketches and files needs to be cleaned
up next, so no thorough attempt at testing this commit was done. It is
likely that there are plenty of corner cases and race conditions, which
will be fixed once the reset of the code is cleaned up.
Fixes#3441
For some toolbar buttons, when it is clicked while shift is pressed, its
function changes. When handling the click event, this information is
directly taken from KeyEvent.isShiftDown(). However, to also show the
proper tooltip *before* clicking, EditorToolbar listened to key events
on the main text area, to know when shift is (not) pressed.
This approach means that pressing shift while the text area is not
focused will not change the tooltip, and creates some unwanted coupling
between the toolbar and the text area.
This commit changes this approach to instead use the global
KeyboardFocusManager. Any key presses pass through there before being
dispatched to the currently focused component, so this makes sure that
any shift presses are caught, as well as making EditorToolbar a bit more
self-contained.
This fix a regression introduced in:
048a8a61 (VersionHelper now correctly strip snapshot info)
actually neither 048a8a61 nor the version before are correct becuase:
048a8a61 - strips all the extra `-snapshot` and `+build`
previous - doesn't handle the case `x.y-snapshot`
Now both are handled correctly and a test has been added to verify this.
To be completely semver compliant we should deny versions in the
format `x.y`, but this will break all legacy version that have been
published until now, so this changed should be postponed for the next
major release of the IDE.
Fix#5251
There is no reason to bundle this file.
If the index file is not available an empty index is
returned by the parser.
Fix#5143
(together with e80c08: Use a specific hardware/package_index_bundled.json)
Previously if a 3rd party core would require a tool already bundled
in the IDE then boards manager skipped the installation of that tool.
This is could lead to missing tools if the IDE is upgraded and the
bundled tools may change.
This patch fixes the bug by always installing tools when needed, even
if they are already bundled.
This covers a very convoluted use-case that may be reproduce this way:
1. Using an previous version of the IDE, a new AVR core is installed
using the board manager.
2. The IDE is then updated so the core installed in 1. is now also the
bundled one
3. The AVR core installed 1. is now removed using the board manager
4. The board manager will uninstall the (presumably) no longer used tools,
from the built-in folder leaving, in fact, the IDE without the
bundled tools that are supposed to be read-only.
This commit fix this bug by actually making the built-in tool read-only
Previously, during the build, the full package_index.json was downloaded
and distributed with the Arduino IDE.
This lead to a situation where it was difficult to test new AVR cores
before publishing them to the public package_index.json.
Now the bundled AVR core is specificed in the file:
`hardware/package_index_bundled.json`
this index is loaded from the IDE at startup and the package_index.json
is overlayed on it.
This should also solve part of #5143 (Repeatable builds and snapshots of
package/library indexes)
This reverts commits:
385edd26fc (Removed "macosx-fix-bundled-toolchain-missing-symlinks" build task)
f5fd6423c3 (Updated avrdude to 6.3-arduino2)
5a01929b8f (avrdude 6.3: fixed IDE build for macosx)
And part of this commit:
05b647721c (Update avr-gcc to 4.9.2 and avrdude to 6.3)
ApacheCommons do some command-line tweaking that doesnt fit well
with argument passing to arduino-builder, in particular for -prefs
arguments containing spaces.
Previously a NullPointer exception was thrown.
Now the build go on and fails when the recipe cannot be replaced
the correct tool path, that is a much more informative error.