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

reactivated property sheet page

parent 6ca1f3fe
No related branches found
No related tags found
No related merge requests found
Showing
with 104 additions and 42 deletions
......@@ -85,6 +85,13 @@
name="Outline"
restorable="true">
</view>
<view
category="de.bmotionstudio.views"
class="de.bmotionstudio.gef.editor.BMotionPropertyView"
id="de.bmotionstudio.gef.editor.PropertyView"
name="Properties"
restorable="true">
</view>
</extension>
<extension
point="org.eclipse.ui.menus">
......
......@@ -60,7 +60,7 @@ public class BMSPerspectiveFactory implements IPerspectiveFactory {
// views
IFolderLayout bottom = layout.createFolder("bottom2",
IPageLayout.BOTTOM, 0.65f, "bottom1");
bottom.addView(IPageLayout.ID_PROP_SHEET);
bottom.addView(BMotionPropertyView.ID);
bottom.addView(ObserverView.ID);
}
......
......@@ -82,14 +82,16 @@ public class BMotionOutlinePage extends ContentOutlinePage {
@Override
public void createControl(Composite parent) {
GraphicalViewer graphicalViewer = viewPart.getGraphicalViewer();
if (graphicalViewer != null) {
initializeOverview(parent);
viewPart.getGraphicalViewer().getControl()
.addDisposeListener(disposeListener);
graphicalViewer.getControl().addDisposeListener(disposeListener);
configureOutlineViewer();
// hookOutlineViewer();
initializeOutlineViewer();
createMenu();
}
}
private void initializeOutlineViewer() {
getViewer().setContents(viewPart.getVisualization());
......@@ -129,7 +131,10 @@ public class BMotionOutlinePage extends ContentOutlinePage {
}
protected void initializeOverview(Composite parent) {
private void initializeOverview(Composite parent) {
GraphicalViewer graphicalViewer = this.viewPart.getGraphicalViewer();
sash = new SashForm(parent, SWT.VERTICAL);
getViewer().createControl(sash);
......@@ -140,11 +145,10 @@ public class BMotionOutlinePage extends ContentOutlinePage {
LightweightSystem lws = new LightweightSystem(canvas);
thumbnail = new ScrollableThumbnail(
(Viewport) ((ScalableRootEditPart) this.viewPart
.getGraphicalViewer().getRootEditPart()).getFigure());
thumbnail.setSource(((ScalableRootEditPart) this.viewPart
.getGraphicalViewer().getRootEditPart())
.getLayer(LayerConstants.PRINTABLE_LAYERS));
(Viewport) ((ScalableRootEditPart) graphicalViewer
.getRootEditPart()).getFigure());
thumbnail.setSource(((ScalableRootEditPart) graphicalViewer
.getRootEditPart()).getLayer(LayerConstants.PRINTABLE_LAYERS));
lws.setContents(thumbnail);
......@@ -156,6 +160,7 @@ public class BMotionOutlinePage extends ContentOutlinePage {
}
}
};
}
public Control getControl() {
......
......@@ -6,18 +6,21 @@
package de.bmotionstudio.gef.editor;
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.gef.ui.properties.UndoablePropertySheetPage;
import org.eclipse.jface.action.IAction;
import org.eclipse.ui.views.properties.IPropertySheetEntry;
import org.eclipse.ui.views.properties.PropertySheetPage;
import org.eclipse.ui.views.properties.PropertySheetSorter;
/**
* @author Lukas Ladenberger
*
*/
public class BMotionStudioPropertySheet extends PropertySheetPage {
public class BMotionPropertyPage extends UndoablePropertySheetPage {
public BMotionStudioPropertySheet() {
super();
public BMotionPropertyPage(CommandStack commandStack, IAction undoAction,
IAction redoAction) {
super(commandStack, undoAction, redoAction);
setSorter(new PropertySheetSorter() {
@Override
public int compare(IPropertySheetEntry entryA,
......
package de.bmotionstudio.gef.editor;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.views.properties.PropertySheet;
public class BMotionPropertyView extends PropertySheet {
public static final String ID = "de.bmotionstudio.gef.editor.PropertyView";
@Override
protected IWorkbenchPart getBootstrapPart() {
IWorkbenchPage page = getSite().getPage();
IViewPart view = page.findView(VisualizationViewPart.ID);
if (view != null)
return view;
return null;
}
@Override
protected boolean isImportant(IWorkbenchPart part) {
return part instanceof VisualizationViewPart;
}
}
......@@ -87,8 +87,6 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import com.thoughtworks.xstream.XStream;
......@@ -279,17 +277,17 @@ public class BMotionStudioEditorPage extends GraphicalEditor {
@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class type) {
if (type == ZoomManager.class)
return ((ScalableRootEditPart) getGraphicalViewer()
.getRootEditPart()).getZoomManager();
if (type == IContentOutlinePage.class)
return new BMotionOutlinePage();
if (type == IPropertySheetPage.class) {
BMotionStudioPropertySheet page = new BMotionStudioPropertySheet();
page.setRootEntry(new CustomSortPropertySheetEntry(
getCommandStack()));
return page;
}
// if (type == ZoomManager.class)
// return ((ScalableRootEditPart) getGraphicalViewer()
// .getRootEditPart()).getZoomManager();
// if (type == IContentOutlinePage.class)
// return new BMotionOutlinePage();
// if (type == IPropertySheetPage.class) {
// BMotionPropertyPage page = new BMotionPropertyPage();
// page.setRootEntry(new CustomSortPropertySheetEntry(
// getCommandStack()));
// return page;
// }
return super.getAdapter(type);
}
......
......@@ -33,6 +33,7 @@ public class CustomSortPropertySheetEntry extends UndoablePropertySheetEntry {
super(stack);
}
@Override
protected PropertySheetEntry createChildEntry() {
return new CustomSortPropertySheetEntry(getCommandStack());
}
......
......@@ -6,8 +6,10 @@ import org.eclipse.gef.EditDomain;
import org.eclipse.gef.GraphicalViewer;
import org.eclipse.gef.SnapToGeometry;
import org.eclipse.gef.SnapToGrid;
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.gef.editparts.ScalableRootEditPart;
import org.eclipse.gef.rulers.RulerProvider;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
import org.eclipse.gef.ui.rulers.RulerComposite;
import org.eclipse.swt.SWT;
......@@ -15,6 +17,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.part.IPage;
import org.eclipse.ui.part.MessagePage;
import org.eclipse.ui.part.Page;
......@@ -41,9 +44,13 @@ public class VisualizationViewPart extends PageBookView {
private VisualizationViewPage page;
private ActionRegistry actionRegistry;
@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class type) {
// System.out.println("Try to get adapter: " + type);
// // Adapter for zoom manager
// if (type == ZoomManager.class)
// return ((ScalableRootEditPart) getGraphicalViewer()
......@@ -54,9 +61,12 @@ public class VisualizationViewPart extends PageBookView {
//
// Adapter for property page
if (type == IPropertySheetPage.class) {
BMotionStudioPropertySheet page = new BMotionStudioPropertySheet();
page.setRootEntry(new CustomSortPropertySheetEntry(editDomain
.getCommandStack()));
BMotionPropertyPage page = new BMotionPropertyPage(
getCommandStack(), getActionRegistry().getAction(
ActionFactory.UNDO.getId()), getActionRegistry()
.getAction(ActionFactory.REDO.getId()));
page.setRootEntry(new CustomSortPropertySheetEntry(
getCommandStack()));
return page;
}
......@@ -68,12 +78,20 @@ public class VisualizationViewPart extends PageBookView {
public void setFocus() {
}
protected ActionRegistry getActionRegistry() {
if (actionRegistry == null)
actionRegistry = new ActionRegistry();
return actionRegistry;
}
public Visualization getVisualization() {
return this.visualizationView.getVisualization();
}
public GraphicalViewer getGraphicalViewer() {
if (page != null)
return page.getGraphicalViewer();
return null;
}
@Override
......@@ -87,6 +105,7 @@ public class VisualizationViewPart extends PageBookView {
@Override
protected PageRec doCreatePage(IWorkbenchPart part) {
System.out.println("DO CREATE PAGE");
if (part instanceof BMotionStudioEditor) {
BMotionStudioEditor editor = (BMotionStudioEditor) part;
Simulation simulation = editor.getSimulation();
......@@ -125,6 +144,10 @@ public class VisualizationViewPart extends PageBookView {
return editDomain;
}
protected CommandStack getCommandStack() {
return getEditDomain().getCommandStack();
}
public void setEditDomain(EditDomain editDomain) {
this.editDomain = editDomain;
}
......@@ -156,9 +179,15 @@ public class VisualizationViewPart extends PageBookView {
graphicalViewer.createControl(container);
configureGraphicalViewer();
initGraphicalViewer();
hookGraphicalViewer();
setPartName(getVisualizationView().getName());
}
protected void hookGraphicalViewer() {
// getSelectionSynchronizer().addViewer(getGraphicalViewer());
getSite().setSelectionProvider(getGraphicalViewer());
}
public void configureGraphicalViewer() {
ScalableRootEditPart rootEditPart = new ScalableRootEditPart();
rootEditPart.setViewer(graphicalViewer);
......
......@@ -43,17 +43,10 @@ public class BMSTreeEditPartFactory implements EditPartFactory {
}
}
// else if (model instanceof Observer) {
// part = new ObserverTreeEditPart();
// } else if (model instanceof ObserverRootVirtualTreeNode) {
// part = new ObserverRootTreeEditpart();
// }
if (part != null)
part.setModel(model);
System.out.println("CREATE EDIT PART!!! " + part);
return part;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment