| /******************************************************************************* |
| * Copyright (c) 2014 Florian Thienel and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Florian Thienel - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.vex.ui.boxview; |
| |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.widgets.Composite; |
| import org.eclipse.ui.part.ViewPart; |
| import org.eclipse.vex.core.internal.widget.swt.BoxWidget; |
| |
| /** |
| * This is a viewer for the new box model - just to do visual experiments. |
| * |
| * @author Florian Thienel |
| */ |
| public class BoxView extends ViewPart { |
| |
| private Composite parent; |
| private BoxWidget boxWidget; |
| |
| @Override |
| public void createPartControl(final Composite parent) { |
| this.parent = parent; |
| refresh(); |
| } |
| |
| @Override |
| public void setFocus() { |
| boxWidget.setFocus(); |
| } |
| |
| public void refresh() { |
| if (boxWidget != null) { |
| boxWidget.dispose(); |
| } |
| boxWidget = new BoxWidget(parent, SWT.V_SCROLL); |
| parent.layout(); |
| } |
| } |