X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.document.ui%2Fsrc%2Forg%2Fsimantics%2Fdocument%2Fui%2FDocumentView.java;h=025b88b0808348357691bbb9c0f169f3eb65c7f6;hp=ccbfbd5083fe415a6b570274ddeaee431934d0bd;hb=25b6c25959c1fb3c60bb41cd0e1f0808e7fc3769;hpb=ccc1271c9d6657fb9dcf4cf3cb115fa0c8cb9589 diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/DocumentView.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/DocumentView.java index ccbfbd508..025b88b08 100644 --- a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/DocumentView.java +++ b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/DocumentView.java @@ -11,7 +11,12 @@ *******************************************************************************/ package org.simantics.document.ui; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IWorkbenchPart; import org.simantics.ui.workbench.IPropertyPage; +import org.simantics.utils.ui.BundleUtils; import org.simantics.views.swt.ModelledView; /** @@ -19,6 +24,8 @@ import org.simantics.views.swt.ModelledView; */ public class DocumentView extends ModelledView { + private boolean pinSelection = false; + @Override protected String configurationURI() { return DocumentUIResource.URIs.View; @@ -29,4 +36,32 @@ public class DocumentView extends ModelledView { return null; } + @Override + protected void inputChanged(IWorkbenchPart provider, Object input) { + if (pinSelection) + return; + super.inputChanged(provider, input); + } + + @Override + public void createPartControl(Composite parent) { + super.createPartControl(parent); + getViewSite().getActionBars().getToolBarManager().add(new PinSelection()); + } + + private class PinSelection extends Action { + public PinSelection() { + super("Pin Selection", IAction.AS_CHECK_BOX); + setImageDescriptor( + BundleUtils.getImageDescriptorFromPlugin( + "org.eclipse.ui", + "icons/full/etool16/pin_editor.png")); + } + + @Override + public void run() { + pinSelection = isChecked(); + } + } + }