X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.views.swt.client%2Fsrc%2Forg%2Fsimantics%2Fviews%2Fswt%2Fclient%2Fbase%2FSWTRoot.java;h=36f874d787a4d5486bd14f45977535169ad19e1b;hb=refs%2Fchanges%2F38%2F238%2F2;hp=8ef29619072f87ffe3455500778fa124d08e018d;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.views.swt.client/src/org/simantics/views/swt/client/base/SWTRoot.java b/bundles/org.simantics.views.swt.client/src/org/simantics/views/swt/client/base/SWTRoot.java index 8ef296190..36f874d78 100644 --- a/bundles/org.simantics.views.swt.client/src/org/simantics/views/swt/client/base/SWTRoot.java +++ b/bundles/org.simantics.views.swt.client/src/org/simantics/views/swt/client/base/SWTRoot.java @@ -1,73 +1,73 @@ -package org.simantics.views.swt.client.base; - -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.resource.LocalResourceManager; -import org.eclipse.jface.resource.ResourceManager; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.IWorkbenchSite; - -public class SWTRoot extends SWTParentNode implements ISWTViewNode { - - private static final long serialVersionUID = -3208359073385767918L; - - private final IWorkbenchSite site; - - private LocalResourceManager resourceManager; - - private Composite body; - - public SWTRoot(IWorkbenchSite site) { - this.site = site; - } - - @Override - public void reset() { - } - - @Override - public SWTRoot getRootNode() { - // This is a root node! - return this; - } - - public ResourceManager getResourceManager() { - if (resourceManager == null) - throw new IllegalStateException("resource manager is null"); - return resourceManager; - } - - public ResourceManager peekResourceManager() { - return resourceManager; - } - - @Override - public Control getControl() { - return body; - } - - @Override - public IWorkbenchSite getSite() { - return site; - } - - public void setFocus() { - body.setFocus(); - } - - public void setVisible(boolean value) { - body.setVisible(value); - } - - public void createControls(Composite parent) { - body = parent; - resourceManager = new LocalResourceManager(JFaceResources.getResources(), body); - for(ISWTViewNode child : children.values()) child.createControls(body); - } - - public Control getSingleChild() { - if(children.size() != 1) throw new IllegalStateException("SWTRoot should have exactly one child (has " + children.size() + ")."); - return children.values().iterator().next().getControl(); - } - -} +package org.simantics.views.swt.client.base; + +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.resource.LocalResourceManager; +import org.eclipse.jface.resource.ResourceManager; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.IWorkbenchSite; + +public class SWTRoot extends SWTParentNode implements ISWTViewNode { + + private static final long serialVersionUID = -3208359073385767918L; + + private final IWorkbenchSite site; + + private LocalResourceManager resourceManager; + + private Composite body; + + public SWTRoot(IWorkbenchSite site) { + this.site = site; + } + + @Override + public void reset() { + } + + @Override + public SWTRoot getRootNode() { + // This is a root node! + return this; + } + + public ResourceManager getResourceManager() { + if (resourceManager == null) + throw new IllegalStateException("resource manager is null"); + return resourceManager; + } + + public ResourceManager peekResourceManager() { + return resourceManager; + } + + @Override + public Control getControl() { + return body; + } + + @Override + public IWorkbenchSite getSite() { + return site; + } + + public void setFocus() { + body.setFocus(); + } + + public void setVisible(boolean value) { + body.setVisible(value); + } + + public void createControls(Composite parent) { + body = parent; + resourceManager = new LocalResourceManager(JFaceResources.getResources(), body); + for(ISWTViewNode child : children.values()) child.createControls(body); + } + + public Control getSingleChild() { + if(children.size() != 1) throw new IllegalStateException("SWTRoot should have exactly one child (has " + children.size() + ")."); + return children.values().iterator().next().getControl(); + } + +}