Commit 7dee2efc authored by Romain Bioteau's avatar Romain Bioteau Committed by GitHub

fix(open) better handle perspective switch and diagram renaming (#1512)

parent be19cfd4
......@@ -22,17 +22,11 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
/**
* @author Mickael Istria
*
*/
public class OpenIntroCommandHandler extends AbstractHandler {
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
PlatformUtil.openIntro();
//PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true);
PlatformUtil.openIntro();
return null;
}
......
......@@ -28,7 +28,7 @@ public final class AutomaticSwitchPerspectivePartListener implements IPartListen
@Override
public void partActivated(final MPart part) {
switchPerspective(part);
}
@Override
......@@ -48,6 +48,10 @@ public final class AutomaticSwitchPerspectivePartListener implements IPartListen
@Override
public void partVisible(final MPart part) {
switchPerspective(part);
}
protected void switchPerspective(final MPart part) {
if (!isSwitching) {
isSwitching = true;
try {
......
......@@ -133,10 +133,7 @@ public class DiagramFileStore extends EMFFileStore implements IDeployable, IRena
return URI.createPlatformResourceURI(fullPath.toOSString(), true);
}
/*
* (non-Javadoc)
* @see org.bonitasoft.studio.common.repository.filestore.EMFFileStore#getIcon()
*/
@Override
public Image getIcon() {
return Pics.getImage("ProcessDiagramFile.gif", Activator.getDefault());
......@@ -260,15 +257,13 @@ public class DiagramFileStore extends EMFFileStore implements IDeployable, IRena
@Override
protected IWorkbenchPart doOpen() {
final IWorkbenchPage activePage = closeOpenedEditorWithoutSaving();
IEditorPart part = null;
final Resource emfResource = getEMFResource();
final MainProcess content = getContent();
Assert.isLegal(content != null);
Assert.isLegal(emfResource != null && emfResource.isLoaded());
final Diagram diagram = ModelHelper.getDiagramFor(content, emfResource);
part = EditorService.getInstance().openEditor(new URIEditorInput(EcoreUtil.getURI(diagram)));
part = EditorService.getInstance().openEditor(new URIEditorInput(EcoreUtil.getURI(diagram).trimFragment()));
if (part instanceof DiagramEditor) {
final DiagramEditor editor = (DiagramEditor) part;
final MainProcess mainProcess = (MainProcess) editor.getDiagramEditPart().resolveSemanticElement();
......
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