Skip to content
Snippets Groups Projects
Commit 518f4ab8 authored by Lukas Ladenberger's avatar Lukas Ladenberger
Browse files

fixed some bugs

parent a5047735
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@ public class BMSPerspectiveFactory implements IPerspectiveFactory {
IFolderLayout right2 = layout.createFolder("right2",
IPageLayout.BOTTOM, 0.60f, "right1");
right2.addView(LibraryView.ID);
right2.addView("fr.systerel.explorer.navigator.view");
// ProB State View + ProB History + ProB Event Error View (Right)
// IFolderLayout right2 = layout.createFolder("right2",
......
......@@ -79,7 +79,8 @@ public class BMotionOutlinePage extends ContentOutlinePage {
this.viewPart.getSelectionSynchronizer().removeViewer(getViewer());
if (graphicalViewer != null) {
if (graphicalViewer.getControl() != null
&& !graphicalViewer.getControl().isDisposed())
&& !graphicalViewer.getControl().isDisposed()
&& disposeListener != null)
graphicalViewer.getControl().removeDisposeListener(
disposeListener);
}
......@@ -88,7 +89,7 @@ public class BMotionOutlinePage extends ContentOutlinePage {
@Override
public void createControl(Composite parent) {
GraphicalViewer graphicalViewer = viewPart.getGraphicalViewer();
if (graphicalViewer != null) {
if (graphicalViewer != null && graphicalViewer.getControl() != null) {
initializeOverview(parent);
graphicalViewer.getControl().addDisposeListener(disposeListener);
configureOutlineViewer();
......
......@@ -236,7 +236,6 @@ public class BMotionStudioEditor extends EditorPart implements
@Override
public void dispose() {
// getCommandStack().removeCommandStackListener(getCommandStackListener());
IWorkbenchPage activePage = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
if (activePage != null)
......@@ -312,15 +311,14 @@ public class BMotionStudioEditor extends EditorPart implements
Visualization vis = visView.getVisualization();
vis.setProjectFile(file);
// String partName = visView.getPartName();
IViewReference viewReference = site.getPage()
.findViewReference(VisualizationViewPart.ID, secId);
// IViewReference viewReference = site.getPage()
// .findViewReference(VisualizationViewPart.ID, secId);
// Check if view already exists
if (viewReference != null) {
} else {
// if (viewReference != null) {
// } else {
// If not, create a new one
createVisualizationViewPart(secId, visView);
}
// }
}
......@@ -358,6 +356,9 @@ public class BMotionStudioEditor extends EditorPart implements
private VisualizationViewPart createVisualizationViewPart(String secId,
VisualizationView visualizationView)
throws PartInitException {
System.out.println("CREATE VISUALIZATION PART: " + secId);
IWorkbenchWindow window = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow();
IWorkbenchPage activePage = window.getActivePage();
......@@ -496,30 +497,14 @@ public class BMotionStudioEditor extends EditorPart implements
this.simulation = simulation;
}
// private CommandStackListener commandStackListener = new
// CommandStackListener() {
// public void commandStackChanged(EventObject event) {
// setDirty(getCommandStack().isDirty());
// }
// };
// protected CommandStackListener getCommandStackListener() {
// return commandStackListener;
// }
// public CommandStack getCommandStack() {
// return getEditDomain().getCommandStack();
// }
// protected EditDomain getEditDomain() {
// return editDomain;
// }
@Override
public void partActivated(IWorkbenchPartReference partRef) {
// IWorkbenchPart part = partRef.getPart(false);
// if (part == this)
// openPerspective(partRef.getPage());
if (partRef.getPart(false) == this) {
IPerspectiveDescriptor currentPerspective = getSite().getPage()
.getPerspective();
if (!currentPerspective.getId().equals(perspective.getId()))
openPerspective(getSite().getPage());
}
}
@Override
......@@ -529,6 +514,7 @@ public class BMotionStudioEditor extends EditorPart implements
@Override
public void partClosed(IWorkbenchPartReference partRef) {
if (partRef.getPart(false) == this) {
switchPerspective(perspective.getId());
partRef.getPage().savePerspectiveAs(perspective);
exportPerspective(perspective);
closePerspective(partRef.getPage(), perspective);
......
......@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.EventObject;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
......@@ -86,6 +87,8 @@ public class VisualizationViewPart extends PageBookView implements
private Composite container;
private Simulation simulation;
private BMotionStudioEditor editor;
private BMotionSelectionSynchronizer selectionSynchronizer;
......@@ -134,15 +137,17 @@ public class VisualizationViewPart extends PageBookView implements
return selectionSynchronizer;
}
// Workaround for prevent recursive activiation of part
// Workaround for prevent recursive activation of part
@Override
public void setFocus() {
container.setFocus();
this.container.setFocus();
super.setFocus();
}
public Visualization getVisualization() {
if (this.visualizationView != null)
return this.visualizationView.getVisualization();
return null;
}
public GraphicalViewer getGraphicalViewer() {
......@@ -171,20 +176,25 @@ public class VisualizationViewPart extends PageBookView implements
if (part instanceof BMotionStudioEditor) {
editor = (BMotionStudioEditor) part;
Simulation simulation = editor.getSimulation();
BMotionStudioEditor cEditor = (BMotionStudioEditor) part;
if (simulation == null)
this.simulation = cEditor.getSimulation();
if (this.simulation == null)
return null;
this.editDomain = new EditDomain();
getCommandStack().addCommandStackListener(this);
Map<String, VisualizationView> visualizationViews = this.simulation
.getVisualizationViews();
this.visualizationView = visualizationViews
.get(getViewSite().getSecondaryId());
this.visualizationView = simulation.getVisualizationViews().get(
getViewSite().getSecondaryId());
if (visualizationView == null)
return null;
this.editor = cEditor;
this.editDomain = new EditDomain();
this.editDomain.getCommandStack().addCommandStackListener(this);
createActions();
page = new VisualizationViewPage();
......@@ -212,6 +222,7 @@ public class VisualizationViewPart extends PageBookView implements
@Override
protected void doDestroyPage(IWorkbenchPart part, PageRec rec) {
unregister();
VisualizationViewPage page = (VisualizationViewPage) rec.page;
page.dispose();
rec.dispose();
......@@ -592,17 +603,21 @@ public class VisualizationViewPart extends PageBookView implements
@Override
public void dispose() {
unregister();
super.dispose();
}
private void unregister() {
if (getCommandStack() != null)
getCommandStack().removeCommandStackListener(this);
if (getActionRegistry() != null)
getActionRegistry().dispose();
super.dispose();
}
@Override
public void commandStackChanged(EventObject event) {
updateActions(stackActions);
editor.setDirty(getCommandStack().isDirty());
this.editor.setDirty(getCommandStack().isDirty());
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment