Commit 5f8ea2d0 authored by Romain Bioteau's avatar Romain Bioteau
Browse files

BS-10726

parent ce53ef28
......@@ -443,8 +443,7 @@ public class PageComponentSwitchBuilder {
if (parameter != null) {
createFieldLabel(composite, SWT.CENTER, object.getId(), input.isMandatory());
final ExpressionViewer viewer = new GroovyOnlyExpressionViewer(composite, SWT.BORDER,
ConnectorConfigurationPackage.Literals.CONNECTOR_PARAMETER__EXPRESSION);
final ExpressionViewer viewer = new GroovyOnlyExpressionViewer(composite, SWT.BORDER | SWT.SHORT);
viewer.setIsPageFlowContext(isPageFlowContext);
viewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
viewer.setContext(container);
......
......@@ -215,4 +215,16 @@
name="DBConnectors">
</page>
</extension>
<extension
point="org.bonitasoft.studio.connectors.connectorWizard">
<connectorWizard
DefinitionId="scripting-groovy-script"
priority="1"
useDefaultGeneratedPages="false"
useDefaultOutputPage="true">
<configurationPage
page="org.bonitasoft.studio.connectors.ui.wizard.custom.GroovyScriptConfigurationWizardPage">
</configurationPage>
</connectorWizard>
</extension>
</plugin>
......@@ -400,6 +400,13 @@
<classifier>connector</classifier>
<type>zip</type>
</artifactItem>
<artifactItem>
<groupId>org.bonitasoft.connectors</groupId>
<artifactId>bonita-connector-scripting-groovy-script-impl</artifactId>
<version>1.0.0</version>
<classifier>connector</classifier>
<type>zip</type>
</artifactItem>
<artifactItem>
<groupId>org.bonitasoft.connectors</groupId>
<artifactId>bonita-connector-scripting-shell-impl</artifactId>
......
......@@ -83,8 +83,7 @@ public class GroovyScriptConfigurationWizardPage extends AbstractConnectorConfig
final ConnectorParameter dependenciesParameter = getConnectorParameter(getInput(DEPENDENCIES_INPUT_NAME));
final ConnectorParameter parameter = buildScriptConnectorParameter();
builder.createFieldLabel(composite, SWT.CENTER, SCRIPT_INPUT_NAME, true);
final ExpressionViewer viewer = new GroovyOnlyExpressionViewer(composite, SWT.BORDER,
ConnectorConfigurationPackage.Literals.CONNECTOR_PARAMETER__EXPRESSION);
final ExpressionViewer viewer = new GroovyOnlyExpressionViewer(composite, SWT.BORDER | SWT.SHORT);
viewer.setIsPageFlowContext(isPageFlowContext());
viewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
viewer.setContext(getElementContainer());
......
......@@ -68,7 +68,7 @@ public class DocumentWizardPageTest {
doReturn(expressionViewerMock).when(documentWizardPageUnderTest).createExpressionViewer(Mockito.any(Composite.class), Mockito.any(EReference.class));
when(groovyOnlyExpressionViewerMock.getControl()).thenReturn(mock(Control.class));
doReturn(groovyOnlyExpressionViewerMock).when(documentWizardPageUnderTest).createExpressionViewerWitrhGroovyScriptOnly(Mockito.any(Composite.class));
doReturn(groovyOnlyExpressionViewerMock).when(documentWizardPageUnderTest).createExpressionViewerWithGroovyScriptOnly(Mockito.any(Composite.class));
}
......@@ -99,7 +99,7 @@ public class DocumentWizardPageTest {
@Test
public void should_createDocumentInitialMultipleContent_should_create_ExpressionViwer_with_filter_accepting_only_Groovy_script() throws Exception {
documentWizardPageUnderTest.createDocumentInitialMultipleContent(mock(Composite.class));
verify(documentWizardPageUnderTest).createExpressionViewerWitrhGroovyScriptOnly(Mockito.any(Composite.class));
verify(documentWizardPageUnderTest).createExpressionViewerWithGroovyScriptOnly(Mockito.any(Composite.class));
}
}
......@@ -259,9 +259,8 @@ public class DocumentWizardPage extends WizardPage {
return new ExpressionViewer(parent, SWT.BORDER);
}
protected GroovyOnlyExpressionViewer createExpressionViewerWitrhGroovyScriptOnly(final Composite parent) {
return new GroovyOnlyExpressionViewer(parent, SWT.READ_ONLY | SWT.BORDER,
ProcessPackage.Literals.DOCUMENT__INITIAL_MULTIPLE_CONTENT);
protected GroovyOnlyExpressionViewer createExpressionViewerWithGroovyScriptOnly(final Composite parent) {
return new GroovyOnlyExpressionViewer(parent, SWT.READ_ONLY | SWT.BORDER);
}
private void createDocumentManageMimeTypeLink(final Composite detailsComposite) {
......@@ -408,7 +407,7 @@ public class DocumentWizardPage extends WizardPage {
}
protected void createDocumentInitialMultipleContent(final Composite parent) {
multipleInitialContentExpressionViewer = createExpressionViewerWitrhGroovyScriptOnly(parent);
multipleInitialContentExpressionViewer = createExpressionViewerWithGroovyScriptOnly(parent);
multipleInitialContentExpressionViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
multipleInitialContentExpressionViewer.setInput(document);
}
......
......@@ -30,16 +30,16 @@ import org.eclipse.swt.widgets.Shell;
*/
public class GroovyOnlyEditExpressionDialog extends EditExpressionDialog {
protected GroovyOnlyEditExpressionDialog(Shell parentShell,boolean isPassword, Expression inputExpression,EObject context,EditingDomain domain, ViewerFilter[] viewerTypeFilters,ExpressionViewer expressionViewer) {
protected GroovyOnlyEditExpressionDialog(final Shell parentShell,final boolean isPassword, final Expression inputExpression,final EObject context,final EditingDomain domain, final ViewerFilter[] viewerTypeFilters,final ExpressionViewer expressionViewer) {
super(parentShell,isPassword,inputExpression,context,domain,viewerTypeFilters,expressionViewer);
this.inputExpression.setType(ExpressionConstants.SCRIPT_TYPE) ;
}
@Override
protected void createExpressionTypePanel(Composite parentForm) {
protected void createExpressionTypePanel(final Composite parentForm) {
}
@Override
public void create() {
super.create();
......@@ -47,4 +47,9 @@ public class GroovyOnlyEditExpressionDialog extends EditExpressionDialog {
getShell().layout(true,true);
}
public void setShowScriptHeader(final boolean displayHeader) {
// TODO Auto-generated method stub
}
}
......@@ -18,9 +18,9 @@ package org.bonitasoft.studio.expression.editor.viewer;
import org.bonitasoft.studio.common.ExpressionConstants;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
/**
......@@ -29,16 +29,22 @@ import org.eclipse.swt.widgets.Composite;
*/
public class GroovyOnlyExpressionViewer extends ExpressionViewer {
public GroovyOnlyExpressionViewer(final Composite composite, final int style,final EReference expressionReference) {
super(composite, style, expressionReference);
private final boolean displayHeader;
public GroovyOnlyExpressionViewer(final Composite composite, final int style) {
super(composite, style);
displayHeader = (style & SWT.SHORT) == 0;
getContentAssistText().getToolbar().getItem(0).setEnabled(false);
}
@Override
protected EditExpressionDialog createEditDialog(final EObject editInput) {
return new GroovyOnlyEditExpressionDialog(control.getShell(), isPassword, EcoreUtil.copy(getSelectedExpression()), editInput, getEditingDomain(),
final GroovyOnlyEditExpressionDialog groovyOnlyEditExpressionDialog = new GroovyOnlyEditExpressionDialog(control.getShell(), isPassword,
EcoreUtil.copy(getSelectedExpression()), editInput, getEditingDomain(),
filters.toArray(new ViewerFilter[filters.size()]), this);
groovyOnlyEditExpressionDialog.setShowScriptHeader(displayHeader);
return groovyOnlyEditExpressionDialog;
}
@Override
......
Supports Markdown
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