Commit 7af9db20 authored by Romain Bioteau's avatar Romain Bioteau

fix stack when using Finish & Create Button in Data wizard

parent fa99091a
......@@ -103,6 +103,8 @@ public class Repository implements IRepository, IJavaContainer, IRenamable {
public static final IProgressMonitor NULL_PROGRESS_MONITOR = new NullProgressMonitor();
private static final String XTEXT_BUILDER_ID = "org.eclipse.xtext.ui.shared.xtextBuilder";
public static final Set<String> LEGACY_REPOSITORIES = new HashSet<>();
static {
......@@ -885,4 +887,14 @@ public class Repository implements IRepository, IJavaContainer, IRenamable {
}
}
public void buildXtext() {
try {
getProject()
.build(IncrementalProjectBuilder.FULL_BUILD, XTEXT_BUILDER_ID, Collections.<String, String> emptyMap(),
null);
} catch (CoreException e) {
BonitaStudioLog.error(e);
}
}
}
......@@ -14,7 +14,6 @@
*/
package org.bonitasoft.studio.data.ui.property.section;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......@@ -48,8 +47,6 @@ import org.eclipse.core.databinding.conversion.Converter;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.map.IObservableMap;
import org.eclipse.core.databinding.observable.set.IObservableSet;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.databinding.EMFDataBindingContext;
import org.eclipse.emf.databinding.EMFObservables;
......@@ -92,8 +89,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public abstract class AbstractDataSection extends AbstractBonitaDescriptionSection implements IDoubleClickListener, IBonitaVariableContext, IAddData {
private static final String XTEXT_BUILDER_ID = "org.eclipse.xtext.ui.shared.xtextBuilder";
private Button updateDataButton;
private Button removeDataButton;
......@@ -288,17 +283,7 @@ public abstract class AbstractDataSection extends AbstractBonitaDescriptionSecti
wizard.setIsOverviewContext(isOverViewContext());
if (new DataWizardDialog(Display.getCurrent().getActiveShell(), wizard, this).open() == Dialog.OK) {
dataTableViewer.refresh();
refreshXtextReferences();
}
}
protected void refreshXtextReferences() {
try {
RepositoryManager.getInstance().getCurrentRepository().getProject()
.build(IncrementalProjectBuilder.FULL_BUILD, XTEXT_BUILDER_ID, Collections.<String, String> emptyMap(),
null);
} catch (final CoreException e) {
BonitaStudioLog.error(e, DataPlugin.PLUGIN_ID);
RepositoryManager.getInstance().getCurrentRepository().buildXtext();
}
}
......
......@@ -19,6 +19,7 @@ import java.util.List;
import org.bonitasoft.studio.common.jface.DataStyledTreeLabelProvider;
import org.bonitasoft.studio.common.jface.SWTBotConstants;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.common.repository.RepositoryManager;
import org.bonitasoft.studio.data.commands.MoveDataCommand;
import org.bonitasoft.studio.data.i18n.Messages;
import org.bonitasoft.studio.data.ui.property.section.IAddData;
......@@ -109,8 +110,11 @@ public class ProcessDataViewer extends DataViewer implements IAddData {
@Override
public void addData() {
final DataAware container = (DataAware) getDataContainerObservable().getValue();
new DataWizardDialog(Display.getDefault().getActiveShell(), dataWizardFactory.createAddWizard(TransactionUtil.getEditingDomain(container), container),
this).open();
if (new DataWizardDialog(Display.getDefault().getActiveShell(),
dataWizardFactory.createAddWizard(TransactionUtil.getEditingDomain(container), container),
this).open() == Dialog.OK) {
RepositoryManager.getInstance().getCurrentRepository().buildXtext();
}
}
private ViewerFilter hideBusinessObjectData() {
......
......@@ -19,6 +19,7 @@ import java.util.Collections;
import org.bonitasoft.studio.common.DataTypeLabels;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.jface.CustomWizardDialog;
import org.bonitasoft.studio.common.repository.RepositoryManager;
import org.bonitasoft.studio.data.i18n.Messages;
import org.bonitasoft.studio.expression.editor.provider.IDataProposalListener;
import org.bonitasoft.studio.model.process.AbstractProcess;
......@@ -62,6 +63,7 @@ public class CreateVariableProposalListener implements IDataProposalListener {
newWizard.setIsPageFlowContext(isPageFlowContext);
final CustomWizardDialog wizardDialog = new CustomWizardDialog(activeShell(), newWizard, IDialogConstants.FINISH_LABEL);
if (wizardDialog.open() == Dialog.OK) {
RepositoryManager.getInstance().getCurrentRepository().buildXtext();
final Data newData = newWizard.getNewData();
if (newData != null) {
return newData.getName();
......
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