]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.document.ui/src/org/simantics/document/ui/DocumentView.java
Several Wiki documentation view improvements.
[simantics/platform.git] / bundles / org.simantics.document.ui / src / org / simantics / document / ui / DocumentView.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2012 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.document.ui;\r
13 \r
14 import org.eclipse.jface.action.Action;\r
15 import org.eclipse.jface.action.IAction;\r
16 import org.eclipse.swt.widgets.Composite;\r
17 import org.eclipse.ui.IWorkbenchPart;\r
18 import org.simantics.ui.workbench.IPropertyPage;\r
19 import org.simantics.utils.ui.BundleUtils;\r
20 import org.simantics.views.swt.ModelledView;\r
21 \r
22 /**\r
23  * @author Antti Villberg\r
24  */\r
25 public class DocumentView extends ModelledView {\r
26 \r
27     private boolean pinSelection = false;\r
28 \r
29     @Override\r
30     protected String configurationURI() {\r
31         return DocumentUIResource.URIs.View;\r
32     }\r
33 \r
34     @Override\r
35     protected IPropertyPage getPropertyPage() {\r
36         return null;\r
37     }\r
38 \r
39     @Override\r
40     protected void inputChanged(IWorkbenchPart provider, Object input) {\r
41         if (pinSelection)\r
42             return;\r
43         super.inputChanged(provider, input);\r
44     }\r
45 \r
46     @Override\r
47     public void createPartControl(Composite parent) {\r
48         super.createPartControl(parent);\r
49         getViewSite().getActionBars().getToolBarManager().add(new PinSelection());\r
50     }\r
51 \r
52     private class PinSelection extends Action {\r
53         public PinSelection() {\r
54             super("Pin Selection", IAction.AS_CHECK_BOX);\r
55             setImageDescriptor(\r
56                     BundleUtils.getImageDescriptorFromPlugin(\r
57                             "org.eclipse.ui",\r
58                             "icons/full/etool16/pin_editor.png"));\r
59         }\r
60 \r
61         @Override\r
62         public void run() {\r
63             pinSelection = isChecked();\r
64         }\r
65     }\r
66 \r
67 }\r