| Index: dart/site/try/src/ui.dart
|
| diff --git a/dart/site/try/src/ui.dart b/dart/site/try/src/ui.dart
|
| index 8898f7a88ae7457dbe26cd854310d1873af75099..e6dad6fdddbbd15f759348b47594b839095f2632 100644
|
| --- a/dart/site/try/src/ui.dart
|
| +++ b/dart/site/try/src/ui.dart
|
| @@ -11,8 +11,6 @@ import 'dart:async' show
|
| Timer,
|
| scheduleMicrotask;
|
|
|
| -import 'dart:convert' show JSON;
|
| -
|
| import 'cache.dart' show
|
| onLoad,
|
| updateCacheStatus;
|
| @@ -39,6 +37,9 @@ import 'user_option.dart';
|
|
|
| import 'messages.dart' show messages;
|
|
|
| +import 'compilation_unit.dart' show
|
| + CompilationUnit;
|
| +
|
| // TODO(ahe): Make internal to buildUI once all interactions have been moved to
|
| // the manager.
|
| InteractionManager interaction;
|
| @@ -92,6 +93,8 @@ void onCodeChange(Event event) {
|
| buildUI() {
|
| interaction = new InteractionManager();
|
|
|
| + CompilationUnit.onChanged.listen(interaction.onCompilationUnitChanged);
|
| +
|
| window.localStorage['currentSample'] = '$currentSample';
|
|
|
| buildCode(interaction);
|
| @@ -229,27 +232,21 @@ buildCode(InteractionManager interaction) {
|
| var htmlGroup = new OptGroupElement()..label = 'HTML';
|
| var benchmarkGroup = new OptGroupElement()..label = 'Benchmarks';
|
|
|
| - new Future(() => HttpRequest.getString('project?list').then(
|
| - (String response) {
|
| + interaction.projectFileNames().then((List<String> names) {
|
| OptionElement none = new OptionElement()
|
| ..appendText('--')
|
| ..disabled = true;
|
| - codePicker.append(none);
|
| - for (String projectFile in JSON.decode(response)) {
|
| - codePicker.append(buildTab(projectFile, projectFile, (_) {
|
| - mainEditorPane.contentEditable = 'false';
|
| - HttpRequest.getString('project/$projectFile').then((String text) {
|
| - mainEditorPane
|
| - ..contentEditable = 'true'
|
| - ..nodes.clear();
|
| - observer.takeRecords();
|
| - mainEditorPane.appendText(text);
|
| - });
|
| + codePicker
|
| + ..append(none)
|
| + ..style.visibility = 'visible'
|
| + ..selectedIndex = 0;
|
| +
|
| + for (String name in names) {
|
| + codePicker.append(buildTab(name, name, (event) {
|
| + interaction.onProjectFileSelected(name);
|
| }));
|
| }
|
| - codePicker.style.visibility = 'visible';
|
| - codePicker.selectedIndex = 0;
|
| - })).catchError((error) {
|
| + }).catchError((error) {
|
| codePicker.style.visibility = 'visible';
|
| print(error);
|
| OptionElement none = new OptionElement()
|
|
|