Commit e6b6f609 authored by Romain Bioteau's avatar Romain Bioteau Committed by GitHub

fix(document) fix stacktrace when editing a document (#1430)

parent 675a149c
......@@ -130,7 +130,7 @@ public abstract class FileStoreSelectDialog extends Dialog {
private void createListViewer(final Composite listComposite) {
fileStoreListViewer = new ListViewer(listComposite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
fileStoreListViewer.getList().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 300).create());
fileStoreListViewer.getList().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(400, 300).create());
fileStoreListViewer.setContentProvider(new ArrayContentProvider());
fileStoreListViewer.setLabelProvider(new FileStoreLabelProvider());
final IRepositoryStore<?> ars = (IRepositoryStore<?>) RepositoryManager.getInstance().getRepositoryStore(getRepositoryStoreClass());
......
......@@ -113,10 +113,10 @@ public class DocumentWizard extends Wizard {
final Pool pool = (Pool) ModelHelper.getParentProcess(context);
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(context);
if (document == null) {
editingDomain.getCommandStack().execute(new AddCommand(editingDomain, pool.getDocuments(), documentWorkingCopy));
editingDomain.getCommandStack()
.execute(new AddCommand(editingDomain, pool.getDocuments(), EcoreUtil.copy(documentWorkingCopy)));
} else {
final boolean cancelled = performFinishOnEdition(editingDomain);
if (cancelled) {
if (!performFinishOnEdition(editingDomain)) {
return false;
}
}
......@@ -127,15 +127,12 @@ public class DocumentWizard extends Wizard {
private boolean performFinishOnEdition(final TransactionalEditingDomain editingDomain) {
final RefactorDocumentOperation refactorDocumentOperation = createRefactorOperation(editingDomain);
try {
getContainer().run(false, false, refactorDocumentOperation);
} catch (final InvocationTargetException e) {
BonitaStudioLog.error(e);
} catch (final InterruptedException e) {
} catch (final InvocationTargetException | InterruptedException e) {
BonitaStudioLog.error(e);
}
return refactorDocumentOperation.isCancelled();
return !refactorDocumentOperation.isCancelled();
}
private RefactorDocumentOperation createRefactorOperation(final TransactionalEditingDomain editingDomain) {
......
......@@ -88,3 +88,4 @@ buildDoneTitle=Build successful
buildDoneMessage=The process %s has been built successfully in %s.
buildFailedTitle=Build failed
startingEngineServer=Starting engine server...
deployingProcessesFrom=Deploying all processes from %s...
\ No newline at end of file
......@@ -35,11 +35,16 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.databinding.validation.ValidationStatus;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.progress.ProgressMonitorFocusJobDialog;
public class DeployDiagramHandler extends AbstractHandler {
......@@ -60,12 +65,26 @@ public class DeployDiagramHandler extends AbstractHandler {
deployOperation.setConfigurationId(configurationId);
deployOperation.setDisablePopup(false);
processes.forEach(deployOperation::addProcessToDeploy);
try {
PlatformUI.getWorkbench().getProgressService().run(true, false, deployOperation::run);
displayDeployResult(deployOperation);
} catch (InvocationTargetException | InterruptedException e) {
throw new ExecutionException("An error occured during the deploy operation", e);
}
Job deployJob = new Job(String.format(Messages.deployingProcessesFrom, diagramFileStore.getName())) {
@Override
protected IStatus run(IProgressMonitor monitor) {
deployOperation.run(monitor);
return deployOperation.getStatus();
}
};
deployJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
Display.getDefault().asyncExec(() -> displayDeployResult(deployOperation));
}
});
deployJob.setUser(true);
deployJob.schedule();
Shell activeShell = Display.getDefault().getActiveShell();
ProgressMonitorFocusJobDialog dialog = new ProgressMonitorFocusJobDialog(activeShell);
dialog.show(deployJob, activeShell);
}
return null;
}
......
......@@ -177,6 +177,7 @@ public class Messages extends NLS {
public static String buildDoneMessage;
public static String buildFailedTitle;
public static String startingEngineServer;
public static String deployingProcessesFrom;
static {
......
......@@ -1036,18 +1036,21 @@ public class ExpressionViewer extends ContentViewer implements ExpressionConstan
}
private void refreshMessageDecoration() {
final String message = status.getMessage();
if (message != null && !message.isEmpty()) {
messageDecoration.setDescriptionText(message);
messageDecoration.setShowOnlyOnFocus(false);
final Image icon = getImageForMessageKind(status);
if (icon != null) {
messageDecoration.setImage(icon);
}
messageDecoration.show();
if (messageDecoration.getControl() != null
&& !messageDecoration.getControl().isDisposed()) {
final String message = status.getMessage();
if (message != null && !message.isEmpty()) {
messageDecoration.setDescriptionText(message);
messageDecoration.setShowOnlyOnFocus(false);
final Image icon = getImageForMessageKind(status);
if (icon != null) {
messageDecoration.setImage(icon);
}
messageDecoration.show();
} else {
messageDecoration.hide();
} else {
messageDecoration.hide();
}
}
}
......
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