|
Added
Link Here
|
| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2008 Matthew Hall and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
| 8 |
* Contributors: |
| 9 |
* Matthew Hall - initial API and implementation (bug 194734) |
| 10 |
******************************************************************************/ |
| 11 |
|
| 12 |
package org.eclipse.core.internal.databinding.property.list; |
| 13 |
|
| 14 |
import java.util.ArrayList; |
| 15 |
import java.util.Collection; |
| 16 |
import java.util.Collections; |
| 17 |
import java.util.ConcurrentModificationException; |
| 18 |
import java.util.Iterator; |
| 19 |
import java.util.List; |
| 20 |
import java.util.ListIterator; |
| 21 |
|
| 22 |
import org.eclipse.core.databinding.observable.Diffs; |
| 23 |
import org.eclipse.core.databinding.observable.ObservableTracker; |
| 24 |
import org.eclipse.core.databinding.observable.Realm; |
| 25 |
import org.eclipse.core.databinding.observable.list.AbstractObservableList; |
| 26 |
import org.eclipse.core.databinding.observable.list.ListDiff; |
| 27 |
import org.eclipse.core.databinding.observable.list.ListDiffEntry; |
| 28 |
import org.eclipse.core.databinding.property.INativePropertyListener; |
| 29 |
import org.eclipse.core.databinding.property.IProperty; |
| 30 |
import org.eclipse.core.databinding.property.IPropertyObservable; |
| 31 |
import org.eclipse.core.databinding.property.ISimplePropertyListener; |
| 32 |
import org.eclipse.core.databinding.property.SimplePropertyEvent; |
| 33 |
import org.eclipse.core.databinding.property.list.ISimpleListProperty; |
| 34 |
|
| 35 |
/** |
| 36 |
* @since 1.2 |
| 37 |
* |
| 38 |
*/ |
| 39 |
public class SimpleListPropertyObservableList extends AbstractObservableList |
| 40 |
implements IPropertyObservable { |
| 41 |
private Object source; |
| 42 |
private ISimpleListProperty property; |
| 43 |
|
| 44 |
private volatile boolean updating = false; |
| 45 |
|
| 46 |
private volatile int modCount = 0; |
| 47 |
|
| 48 |
private INativePropertyListener listener; |
| 49 |
|
| 50 |
private List cachedList; |
| 51 |
|
| 52 |
/** |
| 53 |
* @param realm |
| 54 |
* @param source |
| 55 |
* @param property |
| 56 |
*/ |
| 57 |
public SimpleListPropertyObservableList(Realm realm, Object source, |
| 58 |
ISimpleListProperty property) { |
| 59 |
super(realm); |
| 60 |
this.source = source; |
| 61 |
this.property = property; |
| 62 |
} |
| 63 |
|
| 64 |
protected void firstListenerAdded() { |
| 65 |
if (!isDisposed()) { |
| 66 |
cachedList = getList(); |
| 67 |
|
| 68 |
if (listener == null) { |
| 69 |
listener = property |
| 70 |
.adaptListener(new ISimplePropertyListener() { |
| 71 |
public void handlePropertyChange( |
| 72 |
final SimplePropertyEvent event) { |
| 73 |
modCount++; |
| 74 |
if (!isDisposed() && !updating) { |
| 75 |
getRealm().exec(new Runnable() { |
| 76 |
public void run() { |
| 77 |
notifyIfChanged((ListDiff) event.diff); |
| 78 |
} |
| 79 |
}); |
| 80 |
} |
| 81 |
} |
| 82 |
}); |
| 83 |
} |
| 84 |
property.addListener(source, listener); |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
protected void lastListenerRemoved() { |
| 89 |
if (listener != null) { |
| 90 |
property.removeListener(source, listener); |
| 91 |
} |
| 92 |
|
| 93 |
cachedList = null; |
| 94 |
} |
| 95 |
|
| 96 |
private void getterCalled() { |
| 97 |
ObservableTracker.getterCalled(this); |
| 98 |
} |
| 99 |
|
| 100 |
public Object getElementType() { |
| 101 |
return property.getElementType(); |
| 102 |
} |
| 103 |
|
| 104 |
// Queries |
| 105 |
|
| 106 |
private List getList() { |
| 107 |
return property.getList(source); |
| 108 |
} |
| 109 |
|
| 110 |
protected int doGetSize() { |
| 111 |
return getList().size(); |
| 112 |
} |
| 113 |
|
| 114 |
public boolean contains(Object o) { |
| 115 |
getterCalled(); |
| 116 |
return getList().contains(o); |
| 117 |
} |
| 118 |
|
| 119 |
public boolean containsAll(Collection c) { |
| 120 |
getterCalled(); |
| 121 |
return getList().containsAll(c); |
| 122 |
} |
| 123 |
|
| 124 |
public Object get(int index) { |
| 125 |
getterCalled(); |
| 126 |
return getList().get(index); |
| 127 |
} |
| 128 |
|
| 129 |
public int indexOf(Object o) { |
| 130 |
getterCalled(); |
| 131 |
return getList().indexOf(o); |
| 132 |
} |
| 133 |
|
| 134 |
public boolean isEmpty() { |
| 135 |
getterCalled(); |
| 136 |
return getList().isEmpty(); |
| 137 |
} |
| 138 |
|
| 139 |
public int lastIndexOf(Object o) { |
| 140 |
getterCalled(); |
| 141 |
return getList().lastIndexOf(o); |
| 142 |
} |
| 143 |
|
| 144 |
public Object[] toArray() { |
| 145 |
getterCalled(); |
| 146 |
return getList().toArray(); |
| 147 |
} |
| 148 |
|
| 149 |
public Object[] toArray(Object[] a) { |
| 150 |
getterCalled(); |
| 151 |
return getList().toArray(a); |
| 152 |
} |
| 153 |
|
| 154 |
// Single change operations |
| 155 |
|
| 156 |
public boolean add(Object o) { |
| 157 |
checkRealm(); |
| 158 |
add(getList().size(), o); |
| 159 |
return true; |
| 160 |
} |
| 161 |
|
| 162 |
public void add(int index, Object o) { |
| 163 |
checkRealm(); |
| 164 |
boolean wasUpdating = updating; |
| 165 |
updating = true; |
| 166 |
List list = new ArrayList(getList()); |
| 167 |
list.add(index, o); |
| 168 |
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(index, |
| 169 |
true, o)); |
| 170 |
try { |
| 171 |
property.setList(source, list, diff); |
| 172 |
modCount++; |
| 173 |
} finally { |
| 174 |
updating = wasUpdating; |
| 175 |
} |
| 176 |
|
| 177 |
notifyIfChanged(null); |
| 178 |
} |
| 179 |
|
| 180 |
public Iterator iterator() { |
| 181 |
getterCalled(); |
| 182 |
return new Iterator() { |
| 183 |
int expectedModCount = modCount; |
| 184 |
List list = new ArrayList(getList()); |
| 185 |
ListIterator iterator = list.listIterator(); |
| 186 |
|
| 187 |
Object lastElement = null; |
| 188 |
int lastIndex = -1; |
| 189 |
|
| 190 |
public boolean hasNext() { |
| 191 |
getterCalled(); |
| 192 |
checkForComodification(); |
| 193 |
return iterator.hasNext(); |
| 194 |
} |
| 195 |
|
| 196 |
public Object next() { |
| 197 |
getterCalled(); |
| 198 |
checkForComodification(); |
| 199 |
Object next = lastElement = iterator.next(); |
| 200 |
lastIndex = iterator.previousIndex(); |
| 201 |
return next; |
| 202 |
} |
| 203 |
|
| 204 |
public void remove() { |
| 205 |
checkRealm(); |
| 206 |
checkForComodification(); |
| 207 |
if (lastIndex == -1) |
| 208 |
throw new IllegalStateException(); |
| 209 |
|
| 210 |
iterator.remove(); // stay in sync |
| 211 |
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry( |
| 212 |
lastIndex, false, lastElement)); |
| 213 |
|
| 214 |
boolean wasUpdating = updating; |
| 215 |
updating = true; |
| 216 |
try { |
| 217 |
property.setList(source, list, diff); |
| 218 |
modCount++; |
| 219 |
} finally { |
| 220 |
updating = wasUpdating; |
| 221 |
} |
| 222 |
|
| 223 |
notifyIfChanged(null); |
| 224 |
|
| 225 |
lastElement = null; |
| 226 |
lastIndex = -1; |
| 227 |
|
| 228 |
expectedModCount = modCount; |
| 229 |
} |
| 230 |
|
| 231 |
private void checkForComodification() { |
| 232 |
if (expectedModCount != modCount) |
| 233 |
throw new ConcurrentModificationException(); |
| 234 |
} |
| 235 |
}; |
| 236 |
} |
| 237 |
|
| 238 |
public Object move(int oldIndex, int newIndex) { |
| 239 |
checkRealm(); |
| 240 |
|
| 241 |
List list = getList(); |
| 242 |
int size = list.size(); |
| 243 |
if (oldIndex < 0 || oldIndex >= size || newIndex < 0 |
| 244 |
|| newIndex >= size) |
| 245 |
throw new IndexOutOfBoundsException(); |
| 246 |
|
| 247 |
if (oldIndex == newIndex) |
| 248 |
return list.get(oldIndex); |
| 249 |
|
| 250 |
list = new ArrayList(list); |
| 251 |
Object element = list.remove(oldIndex); |
| 252 |
list.add(newIndex, element); |
| 253 |
|
| 254 |
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry( |
| 255 |
oldIndex, false, element), Diffs.createListDiffEntry(newIndex, |
| 256 |
true, element)); |
| 257 |
|
| 258 |
boolean wasUpdating = updating; |
| 259 |
updating = true; |
| 260 |
try { |
| 261 |
property.setList(source, list, diff); |
| 262 |
modCount++; |
| 263 |
} finally { |
| 264 |
updating = wasUpdating; |
| 265 |
} |
| 266 |
|
| 267 |
notifyIfChanged(null); |
| 268 |
|
| 269 |
return element; |
| 270 |
} |
| 271 |
|
| 272 |
public boolean remove(Object o) { |
| 273 |
checkRealm(); |
| 274 |
|
| 275 |
int index = getList().indexOf(o); |
| 276 |
if (index == -1) |
| 277 |
return false; |
| 278 |
|
| 279 |
remove(index); |
| 280 |
|
| 281 |
return true; |
| 282 |
} |
| 283 |
|
| 284 |
public ListIterator listIterator() { |
| 285 |
return listIterator(0); |
| 286 |
} |
| 287 |
|
| 288 |
public ListIterator listIterator(final int index) { |
| 289 |
getterCalled(); |
| 290 |
return new ListIterator() { |
| 291 |
int expectedModCount = modCount; |
| 292 |
List list = new ArrayList(getList()); |
| 293 |
ListIterator iterator = list.listIterator(index); |
| 294 |
|
| 295 |
Object lastElement = null; |
| 296 |
int lastIndex = -1; |
| 297 |
|
| 298 |
public boolean hasNext() { |
| 299 |
getterCalled(); |
| 300 |
checkForComodification(); |
| 301 |
return iterator.hasNext(); |
| 302 |
} |
| 303 |
|
| 304 |
public int nextIndex() { |
| 305 |
getterCalled(); |
| 306 |
checkForComodification(); |
| 307 |
return iterator.nextIndex(); |
| 308 |
} |
| 309 |
|
| 310 |
public Object next() { |
| 311 |
getterCalled(); |
| 312 |
checkForComodification(); |
| 313 |
lastElement = iterator.next(); |
| 314 |
lastIndex = iterator.previousIndex(); |
| 315 |
return lastElement; |
| 316 |
} |
| 317 |
|
| 318 |
public boolean hasPrevious() { |
| 319 |
getterCalled(); |
| 320 |
checkForComodification(); |
| 321 |
return iterator.hasPrevious(); |
| 322 |
} |
| 323 |
|
| 324 |
public int previousIndex() { |
| 325 |
getterCalled(); |
| 326 |
checkForComodification(); |
| 327 |
return iterator.previousIndex(); |
| 328 |
} |
| 329 |
|
| 330 |
public Object previous() { |
| 331 |
getterCalled(); |
| 332 |
checkForComodification(); |
| 333 |
lastElement = iterator.previous(); |
| 334 |
lastIndex = iterator.nextIndex(); |
| 335 |
return lastElement; |
| 336 |
} |
| 337 |
|
| 338 |
public void add(Object o) { |
| 339 |
checkRealm(); |
| 340 |
checkForComodification(); |
| 341 |
int index = iterator.nextIndex(); |
| 342 |
|
| 343 |
iterator.add(o); // keep in sync |
| 344 |
|
| 345 |
List list = getList(); |
| 346 |
list.add(index, o); |
| 347 |
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry( |
| 348 |
index, true, o)); |
| 349 |
boolean wasUpdating = updating; |
| 350 |
updating = true; |
| 351 |
try { |
| 352 |
property.setList(source, list, diff); |
| 353 |
modCount++; |
| 354 |
} finally { |
| 355 |
updating = wasUpdating; |
| 356 |
} |
| 357 |
|
| 358 |
notifyIfChanged(null); |
| 359 |
|
| 360 |
lastElement = null; |
| 361 |
lastIndex = -1; |
| 362 |
expectedModCount = modCount; |
| 363 |
} |
| 364 |
|
| 365 |
public void set(Object o) { |
| 366 |
checkRealm(); |
| 367 |
checkForComodification(); |
| 368 |
|
| 369 |
iterator.set(o); |
| 370 |
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry( |
| 371 |
lastIndex, false, lastElement), Diffs |
| 372 |
.createListDiffEntry(lastIndex, true, o)); |
| 373 |
|
| 374 |
boolean wasUpdating = updating; |
| 375 |
updating = true; |
| 376 |
try { |
| 377 |
property.setList(source, list, diff); |
| 378 |
modCount++; |
| 379 |
} finally { |
| 380 |
updating = wasUpdating; |
| 381 |
} |
| 382 |
|
| 383 |
notifyIfChanged(null); |
| 384 |
|
| 385 |
lastElement = o; |
| 386 |
expectedModCount = modCount; |
| 387 |
} |
| 388 |
|
| 389 |
public void remove() { |
| 390 |
checkRealm(); |
| 391 |
checkForComodification(); |
| 392 |
if (lastIndex == -1) |
| 393 |
throw new IllegalStateException(); |
| 394 |
|
| 395 |
iterator.remove(); // keep in sync |
| 396 |
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry( |
| 397 |
lastIndex, false, lastElement)); |
| 398 |
|
| 399 |
boolean wasUpdating = updating; |
| 400 |
updating = true; |
| 401 |
try { |
| 402 |
property.setList(source, list, diff); |
| 403 |
modCount++; |
| 404 |
} finally { |
| 405 |
updating = wasUpdating; |
| 406 |
} |
| 407 |
|
| 408 |
notifyIfChanged(null); |
| 409 |
|
| 410 |
lastElement = null; |
| 411 |
lastIndex = -1; |
| 412 |
expectedModCount = modCount; |
| 413 |
} |
| 414 |
|
| 415 |
private void checkForComodification() { |
| 416 |
if (expectedModCount != modCount) |
| 417 |
throw new ConcurrentModificationException(); |
| 418 |
} |
| 419 |
}; |
| 420 |
} |
| 421 |
|
| 422 |
public Object remove(int index) { |
| 423 |
checkRealm(); |
| 424 |
|
| 425 |
List list = new ArrayList(getList()); |
| 426 |
Object element = list.remove(index); |
| 427 |
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(index, |
| 428 |
false, element)); |
| 429 |
|
| 430 |
boolean wasUpdating = updating; |
| 431 |
updating = true; |
| 432 |
try { |
| 433 |
property.setList(source, list, diff); |
| 434 |
modCount++; |
| 435 |
} finally { |
| 436 |
updating = wasUpdating; |
| 437 |
} |
| 438 |
|
| 439 |
notifyIfChanged(null); |
| 440 |
|
| 441 |
return element; |
| 442 |
} |
| 443 |
|
| 444 |
public Object set(int index, Object o) { |
| 445 |
checkRealm(); |
| 446 |
|
| 447 |
List list = new ArrayList(getList()); |
| 448 |
Object oldElement = list.set(index, o); |
| 449 |
|
| 450 |
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(index, |
| 451 |
false, oldElement), Diffs.createListDiffEntry(index, true, o)); |
| 452 |
|
| 453 |
boolean wasUpdating = updating; |
| 454 |
updating = true; |
| 455 |
try { |
| 456 |
property.setList(source, list, diff); |
| 457 |
modCount++; |
| 458 |
} finally { |
| 459 |
updating = wasUpdating; |
| 460 |
} |
| 461 |
|
| 462 |
notifyIfChanged(null); |
| 463 |
|
| 464 |
return oldElement; |
| 465 |
} |
| 466 |
|
| 467 |
public List subList(int fromIndex, int toIndex) { |
| 468 |
getterCalled(); |
| 469 |
return Collections.unmodifiableList(getList().subList(fromIndex, |
| 470 |
toIndex)); |
| 471 |
} |
| 472 |
|
| 473 |
// Bulk change operations |
| 474 |
|
| 475 |
public boolean addAll(Collection c) { |
| 476 |
checkRealm(); |
| 477 |
|
| 478 |
return addAll(getList().size(), c); |
| 479 |
} |
| 480 |
|
| 481 |
public boolean addAll(int index, Collection c) { |
| 482 |
checkRealm(); |
| 483 |
|
| 484 |
if (c.isEmpty()) |
| 485 |
return false; |
| 486 |
|
| 487 |
List list = new ArrayList(getList()); |
| 488 |
list.addAll(index, c); |
| 489 |
|
| 490 |
ListDiffEntry[] entries = new ListDiffEntry[c.size()]; |
| 491 |
int offsetIndex = 0; |
| 492 |
for (Iterator it = c.iterator(); it.hasNext();) { |
| 493 |
Object element = it.next(); |
| 494 |
entries[offsetIndex] = Diffs.createListDiffEntry(index |
| 495 |
+ offsetIndex, true, element); |
| 496 |
offsetIndex++; |
| 497 |
} |
| 498 |
ListDiff diff = Diffs.createListDiff(entries); |
| 499 |
|
| 500 |
boolean wasUpdating = updating; |
| 501 |
updating = true; |
| 502 |
try { |
| 503 |
property.setList(source, list, diff); |
| 504 |
modCount++; |
| 505 |
} finally { |
| 506 |
updating = wasUpdating; |
| 507 |
} |
| 508 |
|
| 509 |
notifyIfChanged(null); |
| 510 |
|
| 511 |
return true; |
| 512 |
} |
| 513 |
|
| 514 |
public boolean removeAll(Collection c) { |
| 515 |
checkRealm(); |
| 516 |
|
| 517 |
if (c.isEmpty()) |
| 518 |
return false; |
| 519 |
|
| 520 |
List list = getList(); |
| 521 |
if (list.isEmpty()) |
| 522 |
return false; |
| 523 |
|
| 524 |
list = new ArrayList(list); |
| 525 |
List entries = new ArrayList(); |
| 526 |
ListDiff diff; |
| 527 |
|
| 528 |
boolean wasUpdating = updating; |
| 529 |
updating = true; |
| 530 |
try { |
| 531 |
for (ListIterator it = list.listIterator(); it.hasNext();) { |
| 532 |
Object element = it.next(); |
| 533 |
int index = it.previousIndex(); |
| 534 |
if (c.contains(element)) { |
| 535 |
it.remove(); |
| 536 |
entries.add(Diffs |
| 537 |
.createListDiffEntry(index, false, element)); |
| 538 |
} |
| 539 |
} |
| 540 |
if (entries.isEmpty()) |
| 541 |
return false; |
| 542 |
|
| 543 |
diff = Diffs.createListDiff((ListDiffEntry[]) entries |
| 544 |
.toArray(new ListDiffEntry[entries.size()])); |
| 545 |
property.setList(source, list, diff); |
| 546 |
modCount++; |
| 547 |
} finally { |
| 548 |
updating = wasUpdating; |
| 549 |
} |
| 550 |
|
| 551 |
notifyIfChanged(null); |
| 552 |
|
| 553 |
return !diff.isEmpty(); |
| 554 |
} |
| 555 |
|
| 556 |
public boolean retainAll(Collection c) { |
| 557 |
checkRealm(); |
| 558 |
|
| 559 |
List list = getList(); |
| 560 |
if (list.isEmpty()) |
| 561 |
return false; |
| 562 |
|
| 563 |
if (c.isEmpty()) { |
| 564 |
clear(); |
| 565 |
return true; |
| 566 |
} |
| 567 |
|
| 568 |
list = new ArrayList(list); |
| 569 |
List entries = new ArrayList(); |
| 570 |
ListDiff diff; |
| 571 |
|
| 572 |
boolean wasUpdating = updating; |
| 573 |
updating = true; |
| 574 |
try { |
| 575 |
for (ListIterator it = list.listIterator(); it.hasNext();) { |
| 576 |
Object element = it.next(); |
| 577 |
int index = it.previousIndex(); |
| 578 |
if (!c.contains(element)) { |
| 579 |
it.remove(); |
| 580 |
entries.add(Diffs |
| 581 |
.createListDiffEntry(index, false, element)); |
| 582 |
} |
| 583 |
} |
| 584 |
if (entries.isEmpty()) |
| 585 |
return false; |
| 586 |
|
| 587 |
diff = Diffs.createListDiff((ListDiffEntry[]) entries |
| 588 |
.toArray(new ListDiffEntry[entries.size()])); |
| 589 |
property.setList(source, list, diff); |
| 590 |
modCount++; |
| 591 |
} finally { |
| 592 |
updating = wasUpdating; |
| 593 |
} |
| 594 |
|
| 595 |
notifyIfChanged(null); |
| 596 |
|
| 597 |
return !diff.isEmpty(); |
| 598 |
} |
| 599 |
|
| 600 |
public void clear() { |
| 601 |
checkRealm(); |
| 602 |
|
| 603 |
List list = getList(); |
| 604 |
if (list.isEmpty()) |
| 605 |
return; |
| 606 |
|
| 607 |
List entries = new ArrayList(); |
| 608 |
for (Iterator it = list.iterator(); it.hasNext();) { |
| 609 |
// always report 0 as the remove index |
| 610 |
entries.add(Diffs.createListDiffEntry(0, false, it.next())); |
| 611 |
} |
| 612 |
|
| 613 |
ListDiff diff = Diffs.createListDiff((ListDiffEntry[]) entries |
| 614 |
.toArray(new ListDiffEntry[entries.size()])); |
| 615 |
boolean wasUpdating = updating; |
| 616 |
updating = true; |
| 617 |
try { |
| 618 |
property.setList(source, Collections.EMPTY_LIST, diff); |
| 619 |
modCount++; |
| 620 |
} finally { |
| 621 |
updating = wasUpdating; |
| 622 |
} |
| 623 |
|
| 624 |
notifyIfChanged(null); |
| 625 |
} |
| 626 |
|
| 627 |
private void notifyIfChanged(ListDiff diff) { |
| 628 |
if (hasListeners()) { |
| 629 |
List oldList = cachedList; |
| 630 |
List newList = cachedList = property.getList(source); |
| 631 |
if (diff == null) |
| 632 |
diff = Diffs.computeListDiff(oldList, newList); |
| 633 |
if (!diff.isEmpty()) { |
| 634 |
fireListChange(diff); |
| 635 |
} |
| 636 |
} |
| 637 |
} |
| 638 |
|
| 639 |
public boolean equals(Object o) { |
| 640 |
getterCalled(); |
| 641 |
return getList().equals(o); |
| 642 |
} |
| 643 |
|
| 644 |
public int hashCode() { |
| 645 |
getterCalled(); |
| 646 |
return getList().hashCode(); |
| 647 |
} |
| 648 |
|
| 649 |
public Object getObserved() { |
| 650 |
return source; |
| 651 |
} |
| 652 |
|
| 653 |
public IProperty getProperty() { |
| 654 |
return property; |
| 655 |
} |
| 656 |
|
| 657 |
public synchronized void dispose() { |
| 658 |
if (!isDisposed()) { |
| 659 |
if (listener != null) |
| 660 |
property.removeListener(source, listener); |
| 661 |
property = null; |
| 662 |
source = null; |
| 663 |
listener = null; |
| 664 |
} |
| 665 |
super.dispose(); |
| 666 |
} |
| 667 |
} |