* in Industry THTH ry.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* in Industry THTH ry.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
*******************************************************************************/
package org.simantics.diagram.ui;
*******************************************************************************/
package org.simantics.diagram.ui;
- if (site != null && site.getSelectionProvider() != this) {
- swt.asyncExec(new Runnable() {
- @Override
- public void run() {
- if (site.getSelectionProvider() != WorkbenchSelectionProvider.this)
- site.setSelectionProvider(WorkbenchSelectionProvider.this);
- }
- });
- }
+ swt.asyncExec(() -> {
+ if (site != null && site.getSelectionProvider() != WorkbenchSelectionProvider.this)
+ site.setSelectionProvider(WorkbenchSelectionProvider.this);
+ });
- if (site != null && site.getSelectionProvider() == this) {
- swt.asyncExec(new Runnable() {
- @Override
- public void run() {
- if (site.getSelectionProvider() == WorkbenchSelectionProvider.this)
- site.setSelectionProvider(null);
- }
- });
- }
+ swt.asyncExec(() -> {
+ if (site != null && site.getSelectionProvider() == WorkbenchSelectionProvider.this)
+ site.setSelectionProvider(null);
+ });
public void fireSelection(Iterable<?> selection) {
final ISelection s = constructAdaptableSelection(selection);
public void fireSelection(Iterable<?> selection) {
final ISelection s = constructAdaptableSelection(selection);
- swt.asyncExec(new Runnable() {
- @Override
- public void run() {
- currentSelection = s;
- fireSelectionChanged(s);
- schedulePostSelectionChanged(s);
- }
+ swt.asyncExec(() -> {
+ currentSelection = s;
+ fireSelectionChanged(s);
+ schedulePostSelectionChanged(s);
@HintListener(Class = Selection.class, Field = "SELECTION0")
public void hintRemoved(IHintObservable sender, Key key, Object oldValue) {
//System.out.println("selection removed: " + oldValue);
@HintListener(Class = Selection.class, Field = "SELECTION0")
public void hintRemoved(IHintObservable sender, Key key, Object oldValue) {
//System.out.println("selection removed: " + oldValue);
- ThreadUtils.getNonBlockingWorkExecutor().schedule(new Runnable() {
- @Override
- public void run() {
- int newCount = modCount;
- if (count != newCount)
- return;
- if (isRemoved())
- return;
- swt.asyncExec(new Runnable() {
- @Override
- public void run() {
- if (isRemoved())
- return;
- firePostSelectionChanged(s);
- }
- });
- }
+ ThreadUtils.getNonBlockingWorkExecutor().schedule(() -> {
+ int newCount = modCount;
+ if (count != newCount)
+ return;
+ if (isRemoved())
+ return;
+ swt.asyncExec(() -> {
+ if (!isRemoved())
+ firePostSelectionChanged(s);
+ });