X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Felement%2Fhandler%2Fimpl%2FEnabledImpl.java;h=18fe6ccde0a7f566939e65c7e9555c467a110b42;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=661270ce8d8aafe55b17b26a0fa9128e1903e443;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/EnabledImpl.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/EnabledImpl.java index 661270ce8..18fe6ccde 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/EnabledImpl.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/EnabledImpl.java @@ -1,58 +1,58 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * 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: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.g2d.element.handler.impl; - -import org.simantics.g2d.diagram.IDiagram; -import org.simantics.g2d.element.ElementHints; -import org.simantics.g2d.element.IElement; -import org.simantics.g2d.element.handler.Stateful; -import org.simantics.g2d.element.handler.LifeCycle; - -/** - * @author Toni Kalajainen - */ -public class EnabledImpl implements Stateful, LifeCycle { - - private static final long serialVersionUID = -9001251146906678336L; - - public static final EnabledImpl ENABLED_BY_DEFAULT = new EnabledImpl(); - public static final EnabledImpl DISABLED_BY_DEFAULT = new EnabledImpl(); - - @Override - public boolean isEnabled(IElement e) { - Boolean b = e.getHint(ElementHints.KEY_ENABLED); - return b==null ? false : b; - } - - @Override - public void setEnabled(IElement e, boolean enabled) { - e.setHint(ElementHints.KEY_ENABLED, enabled); - } - - @Override - public void onElementActivated(IDiagram d, IElement e) { - } - - @Override - public void onElementCreated(IElement e) { - e.setHint(ElementHints.KEY_ENABLED, true); - } - - @Override - public void onElementDeactivated(IDiagram d, IElement e) { - } - - @Override - public void onElementDestroyed(IElement e) { - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * 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: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.g2d.element.handler.impl; + +import org.simantics.g2d.diagram.IDiagram; +import org.simantics.g2d.element.ElementHints; +import org.simantics.g2d.element.IElement; +import org.simantics.g2d.element.handler.Stateful; +import org.simantics.g2d.element.handler.LifeCycle; + +/** + * @author Toni Kalajainen + */ +public class EnabledImpl implements Stateful, LifeCycle { + + private static final long serialVersionUID = -9001251146906678336L; + + public static final EnabledImpl ENABLED_BY_DEFAULT = new EnabledImpl(); + public static final EnabledImpl DISABLED_BY_DEFAULT = new EnabledImpl(); + + @Override + public boolean isEnabled(IElement e) { + Boolean b = e.getHint(ElementHints.KEY_ENABLED); + return b==null ? false : b; + } + + @Override + public void setEnabled(IElement e, boolean enabled) { + e.setHint(ElementHints.KEY_ENABLED, enabled); + } + + @Override + public void onElementActivated(IDiagram d, IElement e) { + } + + @Override + public void onElementCreated(IElement e) { + e.setHint(ElementHints.KEY_ENABLED, true); + } + + @Override + public void onElementDeactivated(IDiagram d, IElement e) { + } + + @Override + public void onElementDestroyed(IElement e) { + } + +}