| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library service_ref_element; | 5 library service_ref_element; |
| 6 | 6 |
| 7 import 'package:polymer/polymer.dart'; | 7 import 'package:polymer/polymer.dart'; |
| 8 import 'observatory_element.dart'; | 8 import 'observatory_element.dart'; |
| 9 | 9 |
| 10 @CustomTag('service-ref') | 10 @CustomTag('service-ref') |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 if (ref == null) { | 31 if (ref == null) { |
| 32 return ''; | 32 return ''; |
| 33 } | 33 } |
| 34 // Return the VM name by default. | 34 // Return the VM name by default. |
| 35 var name = ref['name']; | 35 var name = ref['name']; |
| 36 return name != null ? name : ''; | 36 return name != null ? name : ''; |
| 37 } | 37 } |
| 38 | 38 |
| 39 String get name { | 39 String get name { |
| 40 if (ref == null) { | 40 if (ref == null) { |
| 41 return ''; | 41 return 'NULL REF'; |
| 42 } | 42 } |
| 43 String name_key = internal ? 'name' : 'user_name'; | 43 String name_key = internal ? 'name' : 'user_name'; |
| 44 if (ref[name_key] != null) { | 44 if (ref[name_key] != null) { |
| 45 return ref[name_key]; | 45 return ref[name_key]; |
| 46 } else if (ref['name'] != null) { | 46 } else if (ref['name'] != null) { |
| 47 return ref['name']; | 47 return ref['name']; |
| 48 } else if (ref['user_name'] != null) { |
| 49 return ref['user_name']; |
| 48 } | 50 } |
| 49 return ''; | 51 return ''; |
| 50 } | 52 } |
| 51 | 53 |
| 52 void isolateChanged(oldValue) { | 54 void isolateChanged(oldValue) { |
| 53 notifyPropertyChange(#relativeLink, 0, 1); | 55 notifyPropertyChange(#relativeLink, 0, 1); |
| 54 } | 56 } |
| 55 | 57 |
| 56 @observable | 58 @observable |
| 57 String relativeLink(String link) { | 59 String relativeLink(String link) { |
| 58 if (app == null) { | 60 if (app == null) { |
| 59 return ''; | 61 return ''; |
| 60 } else if (isolate == null) { | 62 } else if (isolate == null) { |
| 61 return app.locationManager.currentIsolateRelativeLink(link); | 63 return app.locationManager.currentIsolateRelativeLink(link); |
| 62 } else { | 64 } else { |
| 63 return app.locationManager.relativeLink(isolate.id, link); | 65 return app.locationManager.relativeLink(isolate.id, link); |
| 64 } | 66 } |
| 65 } | 67 } |
| 66 } | 68 } |
| OLD | NEW |