Package hidb2.gui.util

Source Code of hidb2.gui.util.AbstractEditor

/**
* This file is part of HIDB2.
*
* HIDB2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HIDB2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Lesser Public License for more details.
*
* You should have received a copy of the GNU Lesser Public License
* along with HIDB2. If not, see <http://www.gnu.org/licenses/>.
*/
package hidb2.gui.util;

import hidb2.gui.editor.HIDB2Toolkit;
import hidb2.kern.HIDBConst;

import java.util.logging.Logger;

import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.part.EditorPart;

/**
* Code Factorisation for current IEditorPart of HIDB2
*/
abstract public class AbstractEditor extends EditorPart implements HIDBConst, IContextPart
  {
  final protected static Logger log = Logger.getLogger("hidb2.gui.editor");

  protected boolean dirty = false;

  protected HIDB2Toolkit toolkit;

  protected void initToolkit(Display dsp)
    {
    toolkit = new HIDB2Toolkit(dsp);
    }

  protected void setDirty(boolean value)
    {
    dirty = value;
    firePropertyChange(PROP_DIRTY);
    }

  public HIDB2Toolkit getTk()
    {
    return toolkit;
    }

  @Override
  public boolean isDirty()
    {
    return dirty;
    }

  @Override
  public void fireSaveNeeded()
    {
    setDirty(true);
    }

  @Override
  public String getContextId()
    {
    return null;
    }

  @Override
  public void doSaveAs()
    {
    }

  @Override
  public boolean isSaveAsAllowed()
    {
    return false;
    }

  @Override
  public boolean isEditable()
    {
    return true;
    }

  @Override
  public void setFocus()
    {
    }

  @Override
  public void cancelEdit()
    {
    }

  }
TOP

Related Classes of hidb2.gui.util.AbstractEditor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.