History log of /sdk/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/MarginChooser.java
Revision Date Author Comments
ff5737a0e5d4ddc7330b3733757f7fc693618d53 22-Sep-2012 Tor Norbye <tnorbye@google.com> Make resource chooser include resources from library projects

The resource chooser was only showing resources from the current
project. This changeset fixes this such that it will merge in
resources from library projects as well.

It also cleans up the ResourceChooser class such that it has a couple
of convenience factory methods, and simplified various call sites to
use the factory instead.

Finally, it similarly fixes the Go To Declaration hyperlink resolver
to also look at library projects when resolving source locations.

Change-Id: Id20d14e4d9c6d9133b827ef3a3854e47c65b73fb
d7f5ef53fe74b55f0c8b385b32e94fae6671910a 22-Dec-2011 Tor Norbye <tnorbye@google.com> Add textfield to resource chooser for @string resources

This changeset adds a new textfield to the bottom of the resource
chooser in some scenarios, such as when editing @string resources via
Edit Text in the layout editor.

This text field updates to show the @string/resourceName value
whenever you update the selection in the filter, but it also allows
you to edit the text to anything else, such as a literla String (not a
resource). This makes it easy to edit simple labels. See the following
adt-dev thread for some background on this:

http://groups.google.com/group/adt-dev/browse_thread/
thread/d53e71c2970ce369?pli=1

There is also a new label below the text field which shows the
"resolved value". For example, if you've chosen "hello" in the filter
list, the new value text will show "@string/hello", and the new label
will show "Hello World". This will hopefully make it more obvious what
it is you're editing. And, similar to the widget render preview for
drawable resources, this makes it easier to browse and pick labels,
especially when browsing framework resources. This is currently only
enabled for @string and @dimen resources, but we could conceivably add
it for other resource types too.

Longer term, we need inline editing of widgets (where values entered
automatically get translated into resources), but this is a stopgap
measure which makes it easier to build simple apps quickly, and which
still makes it simple to create new strings or select existing ones
from the filter list. (And we have both Lint and the Extract String
refactoring to help identify and fix hardcoded strings later on.)

While working on this I also discovered the root cause for this bug:
20589: The reference chooser is not usable for framework styles
Turns out org.eclipse.ui.dialogs.AbstractElementListSelectionDialog
has a handleEmptyList() method which calls setEnabled(false) on the
filter list when the list is empty. Crucially, there is no
corresponding setEnabled(true) call when the list is made non-empty!
When the user switches between framework and project resources, the
list is temporarily empty, so the list gets disabled, and that's why
it's not responding to menu clicks at all. This changeset also fixes
that bug.

Change-Id: Id441104d617fa4440daba3da2dc63e2c999f48c1
ab36f4e7488358dea4ab6b54ee2b7bef3da0232b 21-Dec-2011 Tor Norbye <tnorbye@google.com> Update SDK codebase to JDK 6

This changeset makes the SDK codebase compile with source=1.6 (which
means it also requires JDK 6). This means that methods implementing an
interface requires @Override's. It also means we can start using APIs
like the ArrayDeque class and methods like String#isEmpty().

This changeset looks big but the change is trivial: it's basically
adding @Override in all the places that need it, along with some other
automatic Eclipse cleanup in certain files (such as reordering imports
where they were incorrectly ordered (because older versions of Eclipse
didn't always handle inner classes right)), as well as cleaning up
trailing whitespace and removing some $NON-NLS-1$ markers on lines
where there aren't any string literals anymore.

This changeset also sets the source and target JDK level to 6 in the
Eclipse compiler .settings file, and synchronizes this file to all the
other Eclipse SDK projects.

Change-Id: I6a9585aa44c3dee9a5c00739ab22fbdbcb9f8275
4eacdfbcc84ad11f599020b12ad76aebed70537f 07-Jul-2011 Tor Norbye <tnorbye@google.com> Grid Layout Support.

This changeset adds basic support for grid layouts:

- Freeform mode where you can drag & drop anywhere in the layout, and
guidelines are offered to align with other left boundaries, right
boundaries, baseline vertical alignment and center layout horizontal
alingment. In addition, it also offers "preferred spacing"
positioning, using the recommended distance between widgets.

Also, during a drag a regular 16x16 grid is also (faintly) shown and
(when there are no alignment matches as explained above) the
position snaps to this grid.

We also show the grid-structure (rows and columns, not the regular
snapping grid) during drags to make it more obvious that behind the
scenes there is a grid (because some other operations might shift
rows and columns so it's important to present the right user model.)

The freeform grid layout editor will automatically create rows and
columns and size them using spacers which are hidden from the user,
and on deletion these are automatically cleaned up as well.

- Grid mode where you can drag to any given cell, or between any two
rows or columns.

- Some layout actions for manipulating the grid (add/remove row and
column, adjust the gravity, toggle modes.)

This CL also contains various diagnostics code for the grid mode, and
does not yet correctly support dragging multiple views simultaneously.

Change-Id: Ie9ec54805039645e3db78d19095da86b04e44ca0
026ba97e98e0527d910e15c4e1512893a777a8d2 18-Mar-2011 Xavier Ducrohet <xav@android.com> Move classes to ide-common

ResourceFolder/File and children classes (single/multi file)
ResourceItem and children classes
ResourceRepository (base and framework, project stays in ADT for now)
All the ResourceQualifiers and FolderConfiguration

Change-Id: I5adc9bdc4886a8fa0ab44860763d594cf7af4bd5
da02c18ad5b54d97a1fcfd5f6633062b0c873c22 01-Mar-2011 Xavier Ducrohet <xav@android.com> Resource management refactoring and clean-up.

- (I)ResourceRepository is now a common class instead of an
interface. This contains most of the code to control
a repository (which was extracted from ProjectResources)
ProjectResources extends it adding minor features such as
library support, and inline ID definition.
FrameworkResources extends it adding support for public
resources (which used to be duplicated and dispersed
in weird places).
Changed the way resources are reloaded on resource change event.
Instead of marking the resources as modified (using
Resource.touch()), the resources are now parsed as the files are
processed during the resource delta visitor. This makes more sense
as there are now other listeners to the resource changes (hyperlinks)
that access the resource list in their listeners, which wouldn't work
previously.
This also makes the code cleaner as the previous method had to query
the repo for items and return a list of new ones, which was kinda
crappy. The new code is much simpler, as is the post update process.

- ResourceItem is now the base class for resource items. It includes
all the small methods that were added by all the child classes or
interfaces.
Project/ConfigurableResourceItem are merged into the based class.
IIdResourceItem and IdResourceItem are gone and replaced by a
simpler InlineResourceItem.
FrameworkResourceItem is a simple override for framework resources.

- Also improved the API of a bit for the resource repository, making
more use of unmodifiable lists and emptyList/Map()

Change-Id: Ie3ac1995213fed66153c7e7ecbdd170ec257be62
a7da09b74d5f41667823ddf36c0cd7f145f54a2d 01-Feb-2011 Tor Norbye <tnorbye@google.com> Add Layout Actions toolbar

Add a new toolbar above the layout canvas (and to the right of the
palette). This toolbar shows various layout-related actions on its
left, and the canvas zoom controls on the right. The zoom controls
have been moved from the configuration panel, which has also been
reorganized a little with three of the dropdowns moved up to make more
horizontal width and take the place of the old zoom controls.

The toolbar items vary based on which layout is "active". The active
layout is the parent layout of the selection, or the root layout in
the canvas if there is no selection.

Some examples:

- In a LinearLayout, there are radio-button icons for switching
between horizontal and vertical orientation, and for toggling
baseline alignment

- There are toggle buttons for toggling between wrap_content and
match_parent (or fill_parent) for the layout_width and layout_height
properties

- There is a dropdown menu in LinearLayout and RelativeLayout which
lets you set the layout_gravity to one of the dozen gravity settings

- There is an action button which brings up a margin chooser dialog
where you can configure the margin settings for the currently
selected elements for layouts that support margins

There will be additional actions here in the future.

This changeset also adds a few new MenuAction subclasses and factories
to make it possible to do ordered lists of choices. It also adds
sorting keys to make it easier for parents and children to interleave
their actions with simple sorting keys rather than having to append,
prepend or merge their respective result lists. In a follow-up
changeset I will replace the context menu code to use these, as well
as attempt to make all actions stateless such that they can be cached
and reapplied for different targets.

Some misc cleanup.

Change-Id: I6a87144fcfd1d359e5561829bd5d63c852f16970