Commit 11bba82c authored by Romain Bioteau's avatar Romain Bioteau

fix gtk3 style in properties

parent 1a0a46c7
......@@ -124,7 +124,11 @@ public abstract class AbstractNamePropertySectionContribution implements IExtens
final GridLayout rl = new GridLayout(3, false);
composite.setLayout(rl);
text = widgetFactory.createText(composite, "", GTKStyleHandler.removeBorderFlag(SWT.BORDER)); //$NON-NLS-1$
text = new Text(composite, GTKStyleHandler.removeBorderFlag(SWT.BORDER));
if (!GTKStyleHandler.isGTK3()) {
widgetFactory.adapt(text, true, true);
}
final GridData rd = new GridData(SWT.NONE, SWT.CENTER, false, false);
rd.widthHint = 250;
......
......@@ -21,33 +21,28 @@ import org.bonitasoft.studio.common.jface.databinding.validator.EmptyInputValida
import org.bonitasoft.studio.common.jface.databinding.validator.UTF8InputValidator;
import org.bonitasoft.studio.common.properties.ExtensibleGridPropertySection;
import org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution;
import org.bonitasoft.studio.common.widgets.GTKStyleHandler;
import org.bonitasoft.studio.model.process.AbstractProcess;
import org.bonitasoft.studio.model.process.Lane;
import org.bonitasoft.studio.model.process.MainProcess;
import org.bonitasoft.studio.model.process.Pool;
import org.bonitasoft.studio.model.process.ProcessPackage;
import org.bonitasoft.studio.properties.i18n.Messages;
import org.bonitasoft.studio.ui.widget.TextWidget;
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.emf.databinding.EMFDataBindingContext;
import org.eclipse.emf.databinding.edit.EMFEditObservables;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
public class VersionGridPropertySectionContribution implements IExtensibleGridPropertySectionContribution {
private Text text;
private AbstractProcess process;
private TransactionalEditingDomain editingDomain;
private EMFDataBindingContext context;
......@@ -56,49 +51,35 @@ public class VersionGridPropertySectionContribution implements IExtensibleGridPr
@Override
public void createControl(Composite composite, TabbedPropertySheetWidgetFactory widgetFactory, ExtensibleGridPropertySection page) {
composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
composite.setLayout(new RowLayout());
text = widgetFactory.createText(composite, "", GTKStyleHandler.removeBorderFlag(SWT.BORDER));
RowData rd = new RowData();
rd.width = 80 ;
text.setLayoutData(rd);
if(process instanceof MainProcess || process instanceof Pool) {
text.setEnabled(false) ;
}
context = new EMFDataBindingContext() ;
createBinding(context) ;
}
composite.setLayout(GridLayoutFactory.fillDefaults().create());
context = new EMFDataBindingContext();
protected void createBinding(EMFDataBindingContext context) {
UpdateValueStrategy versionUpdate = new UpdateValueStrategy();
versionUpdate.setAfterGetValidator(new EmptyInputValidator(Messages.GeneralSection_Version));
versionUpdate.setBeforeSetValidator(new UTF8InputValidator(Messages.GeneralSection_Version));
ISWTObservableValue observable = SWTObservables.observeDelayedValue(400, SWTObservables.observeText(text, SWT.Modify));
context.bindValue(observable, EMFEditObservables.observeValue(editingDomain, process, ProcessPackage.Literals.ABSTRACT_PROCESS__VERSION),versionUpdate,versionUpdate);
new TextWidget.Builder()
.widthHint(100)
.inContext(context)
.withDelay(400)
.bindTo(EMFEditObservables.observeValue(editingDomain, process,
ProcessPackage.Literals.ABSTRACT_PROCESS__VERSION))
.withTargetToModelStrategy(versionUpdate)
.readOnly(process instanceof MainProcess || process instanceof Pool)
.adapt(widgetFactory)
.createIn(composite);
}
/* (non-Javadoc)
* @see org.bonitasoft.studio.properties.sections.general.IExtenstibleGridPropertySectionContribution#getLabel()
*/
@Override
public String getLabel() {
return Messages.GeneralSection_Version;
}
/* (non-Javadoc)
* @see org.bonitasoft.studio.properties.sections.general.IExtenstibleGridPropertySectionContribution#refresh()
*/
@Override
public void refresh() {
}
/* (non-Javadoc)
* @see org.bonitasoft.studio.properties.sections.general.IExtenstibleGridPropertySectionContribution#setEObject(org.eclipse.emf.ecore.EObject)
*/
@Override
public void setEObject(EObject object) {
if(object instanceof Lane){
......@@ -116,25 +97,16 @@ public class VersionGridPropertySectionContribution implements IExtensibleGridPr
this.editingDomain = editingDomain;
}
/* (non-Javadoc)
* @see org.bonitasoft.studio.properties.sections.general.IExtenstibleGridPropertySectionContribution#isRelevantFor(org.eclipse.emf.ecore.EObject)
*/
@Override
public boolean isRelevantFor(EObject eObject) {
return eObject instanceof AbstractProcess || eObject instanceof Lane;
}
/* (non-Javadoc)
* @see org.bonitasoft.studio.properties.sections.general.IExtenstibleGridPropertySectionContribution#setSelection(org.eclipse.jface.viewers.ISelection)
*/
@Override
public void setSelection(ISelection selection) {
// NOTHING
}
/* (non-Javadoc)
* @see org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution#dispose()
*/
@Override
public void dispose() {
if(context != null){
......
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