Commit f49dd2e8 authored by apupier's avatar apupier
Browse files

BS-13254: add tooltip with information icon on Description column of a

Contract Input
parent 3658c1f2
......@@ -58,4 +58,5 @@ attributeName = Attribute name
warningAddFromData_noDataAvailable=Please create first a business variable from Data view.
warningAddFromData_noDataSelected=Please select a business variable in the list.
reminderForStepMessage=Reminder: if you want to update business data with contract input values, you need to define operations.
reminderForProcessMessage=Reminder: if you want to initialize a business variable with a contract input value, edit the business variable definition and add a script or a query that uses the contract input value to set the default value.
\ No newline at end of file
reminderForProcessMessage=Reminder: if you want to initialize a business variable with a contract input value, edit the business variable definition and add a script or a query that uses the contract input value to set the default value.
contractInputDescriptionTooltip=Used in the automatically generated forms as user hint
......@@ -18,6 +18,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.bonitasoft.studio.model.process.builders.ContractBuilder.aContract;
import static org.bonitasoft.studio.model.process.builders.PoolBuilder.aPool;
import static org.bonitasoft.studio.model.process.builders.TaskBuilder.aTask;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
......@@ -43,6 +44,7 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.progress.IProgressService;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
......@@ -82,15 +84,19 @@ public class ContractPropertySectionTest extends AbstractSWTTestCase {
@Mock
private IWorkbenchPart part;
@Mock
private ISharedImages sharedImages;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
parent = createDisplayAndRealm();
section = spy(new ContractPropertySection(eclipseContext, selectionProvider, progressService));
section = spy(new ContractPropertySection(sharedImages,eclipseContext, selectionProvider, progressService));
when(tabbedPropertySheetPage.getWidgetFactory()).thenReturn(new TabbedPropertySheetWidgetFactory());
doReturn(contributionItem).when(section).newContributionItem(CreateAndEditFormContributionItem.class);
doReturn(createImage()).when(sharedImages).getImage(anyString());
}
/**
......
......@@ -36,6 +36,7 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.forms.IMessageManager;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.progress.IProgressService;
......@@ -59,6 +60,8 @@ public class ContractInputTreeViewerTest extends AbstractSWTTestCase {
private IProgressService progressService;
@Mock
private IMessageManager messageManager;
@Mock
private ISharedImages sharedImages;
/**
* @throws java.lang.Exception
......@@ -67,7 +70,7 @@ public class ContractInputTreeViewerTest extends AbstractSWTTestCase {
public void setUp() throws Exception {
parent = createDisplayAndRealm();
FileActionDialog.setDisablePopup(true);
inputTreeViewer = new ContractInputTreeViewer(parent, new FormToolkit(display), progressService);
inputTreeViewer = new ContractInputTreeViewer(parent, new FormToolkit(display), progressService, sharedImages);
final ContractInputController inputController = spy(new ContractInputController(new FakeProgressService()));
doReturn(new TransactionalEditingDomainImpl(new ProcessItemProviderAdapterFactory())).when(inputController).editingDomain(any(Contract.class));
inputTreeViewer.initialize(inputController, messageManager, new EMFDataBindingContext());
......
......@@ -87,5 +87,6 @@ public class Messages extends NLS {
public static String warningAddFromData_noDataSelected;
public static String reminderForStepMessage;
public static String reminderForProcessMessage;
public static String contractInputDescriptionTooltip;
}
......@@ -66,6 +66,7 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.progress.IProgressService;
......@@ -86,12 +87,16 @@ public class ContractPropertySection extends AbstractBonitaDescriptionSection {
private final IProgressService progressService;
private final ISharedImages sharedImages;
@Inject
public ContractPropertySection(final IEclipseContext eclipseContext, final ContractContainerAdaptableSelectionProvider selectionProvider,
public ContractPropertySection(final ISharedImages sharedImages, final IEclipseContext eclipseContext,
final ContractContainerAdaptableSelectionProvider selectionProvider,
final IProgressService progressService) {
this.eclipseContext = eclipseContext;
this.selectionProvider = selectionProvider;
this.progressService = progressService;
this.sharedImages = sharedImages;
}
@Override
......@@ -198,7 +203,7 @@ public class ContractPropertySection extends AbstractBonitaDescriptionSection {
final Button addChildButton = createButton(buttonsComposite, Messages.addChild);
final Button removeButton = createButton(buttonsComposite, Messages.remove);
final ContractInputTreeViewer inputsTableViewer = new ContractInputTreeViewer(parent, getWidgetFactory(), progressService);
final ContractInputTreeViewer inputsTableViewer = new ContractInputTreeViewer(parent, getWidgetFactory(), progressService, sharedImages);
inputsTableViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(500, SWT.DEFAULT).create());
inputsTableViewer.initialize(inputController, getMessageManager(), context);
inputsTableViewer.setInput(observeContractValue);
......
/**
* Copyright (C) 2014 BonitaSoft S.A.
* BonitaSoft, 32 rue Gustave Eiffel - 38000 Grenoble
* Copyright (C) 2014-2015 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
......@@ -51,6 +51,7 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.forms.IMessageManager;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.progress.IProgressService;
......@@ -66,11 +67,13 @@ public class ContractInputTreeViewer extends TreeViewer {
private EMFDataBindingContext emfDataBindingContext;
private final IProgressService progressService;
private IMessageManager messageManager;
private final ISharedImages sharedImages;
public ContractInputTreeViewer(final Composite parent, final FormToolkit toolkit, final IProgressService progressService) {
public ContractInputTreeViewer(final Composite parent, final FormToolkit toolkit, final IProgressService progressService, final ISharedImages sharedImages) {
super(toolkit.createTree(parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI));
getTree().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, SWTBotConstants.SWTBOT_ID_CONTRACT_INPUT_TREE);
this.progressService = progressService;
this.sharedImages = sharedImages;
}
public void createAddListener(final Button button) {
......@@ -167,8 +170,10 @@ public class ContractInputTreeViewer extends TreeViewer {
protected void createInputDescriptionColumn() {
final TreeViewerColumn descriptionColumnViewer = createColumnViewer(Messages.description, SWT.FILL);
descriptionColumnViewer.setLabelProvider(new DescriptionCellLabelProvider(propertySourceProvider,
knownElements()));
final TreeColumn column = descriptionColumnViewer.getColumn();
column.setToolTipText(Messages.contractInputDescriptionTooltip);
column.setImage(sharedImages.getImage(ISharedImages.IMG_OBJS_INFO_TSK));
descriptionColumnViewer.setLabelProvider(new DescriptionCellLabelProvider(propertySourceProvider, knownElements()));
final DescriptionObservableEditingSupport editingSupport = new DescriptionObservableEditingSupport(this,
messageManager, emfDataBindingContext);
editingSupport.setControlId(SWTBotConstants.SWTBOT_ID_INPUT_DESCRIPTION_TEXTEDITOR);
......
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