Commit 708d6f18 authored by Romain Bioteau's avatar Romain Bioteau

add double click listener in java method operator editor

parent f18ae83a
......@@ -39,6 +39,7 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
......@@ -140,7 +141,7 @@ public class JavaSetterOperatorEditor implements IOperatorEditor {
return JDTMethodHelper.retrieveQualifiedType(typeErasure, declaringType);
}
});
String className = null;
if (data.isMultiple()) {
className = List.class.getName();
......@@ -158,6 +159,11 @@ public class JavaSetterOperatorEditor implements IOperatorEditor {
}
return client;
}
@Override
public StructuredViewer getViewer() {
return javaTreeviewer;
}
protected void fireSelectionChange(final SelectionChangedEvent event) {
for (final ISelectionChangedListener l : listeners) {
......
......@@ -39,6 +39,8 @@ import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Button;
......@@ -191,6 +193,10 @@ public class OperatorSelectionDialog extends Dialog implements ISelectionChanged
if (editor.appliesTo(operatorType)) {
expand = true;
client = editor.createOpeartorEditor(parentSection, operator, sourceExpression);
StructuredViewer viewer = editor.getViewer();
if(viewer != null) {
viewer.addDoubleClickListener(event -> {if(editor.canFinish()) {close();}});
}
editor.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
......
......@@ -18,7 +18,10 @@ package org.bonitasoft.studio.expression.editor.provider;
import org.bonitasoft.studio.model.expression.Expression;
import org.bonitasoft.studio.model.expression.Operator;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Composite;
......@@ -35,5 +38,9 @@ public interface IOperatorEditor extends ISelectionProvider{
Composite createOpeartorEditor(Composite parent,final Operator operator,final Expression sourceExpression) ;
boolean appliesTo(Expression expression);
default StructuredViewer getViewer() {
return null;
}
}
......@@ -36,6 +36,7 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
......@@ -144,6 +145,12 @@ public class XPathOperatorEditor implements IOperatorEditor {
});
return composite ;
}
@Override
public StructuredViewer getViewer() {
return xsdViewer;
}
protected String computeXPath(ITreeSelection selection) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment