Package de.innovationgate.eclipse.editors.tml

Source Code of de.innovationgate.eclipse.editors.tml.HTMLInformationControlCreator

/*******************************************************************************
*  * Copyright (c) 2009, 2010 Innovation Gate GmbH.
* 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:
*     Innovation Gate GmbH - initial API and implementation
******************************************************************************/
package de.innovationgate.eclipse.editors.tml;

import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.IInformationControlCreatorExtension;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Shell;

public class HTMLInformationControlCreator implements IInformationControlCreator, IInformationControlCreatorExtension {

  private HTMLInformationControl _control;
  private int _width = - 1;
  private int _height = -1;

  public HTMLInformationControlCreator() {   
  }
 
  public HTMLInformationControlCreator(int initalControlWidth, int initalControlHeight) {
    _width = initalControlWidth;
    _height = initalControlHeight;
  }

  public IInformationControl createInformationControl(Shell parent) {
    _control = new HTMLInformationControl(parent, _width, _height);
    _control.addDisposeListener(new DisposeListener() {
      public void widgetDisposed(DisposeEvent e) {
        _control= null;
      }
    });
    return _control;
  }

  /*
   * @see org.eclipse.jface.text.IInformationControlCreatorExtension#canReuse(org.eclipse.jface.text.IInformationControl)
   */
  public boolean canReuse(IInformationControl control) {
    return _control == control && _control != null;
  }

  /*
   * @see org.eclipse.jface.text.IInformationControlCreatorExtension#canReplace(org.eclipse.jface.text.IInformationControlCreator)
   */
  public boolean canReplace(IInformationControlCreator creator) {
    return (creator != null && getClass() == creator.getClass());
  }
}
TOP

Related Classes of de.innovationgate.eclipse.editors.tml.HTMLInformationControlCreator

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.