1 /*******************************************************************************
 
   2  * Copyright (c) 2000, 2004 IBM Corporation and others.
 
   3  * All rights reserved. This program and the accompanying materials 
 
   4  * are made available under the terms of the Common Public License v1.0
 
   5  * which accompanies this distribution, and is available at
 
   6  * http://www.eclipse.org/legal/cpl-v10.html
 
   9  *     IBM Corporation - initial API and implementation
 
  10  *******************************************************************************/
 
  11 package net.sourceforge.phpdt.internal.ui.text.template.contentassist;
 
  13 import org.eclipse.swt.events.DisposeEvent;
 
  14 import org.eclipse.swt.events.DisposeListener;
 
  15 import org.eclipse.swt.widgets.Shell;
 
  17 import org.eclipse.jface.text.IInformationControl;
 
  18 import org.eclipse.jface.text.IInformationControlCreator;
 
  19 import org.eclipse.jface.text.IInformationControlCreatorExtension;
 
  21 import net.sourceforge.phpdt.internal.ui.text.java.hover.SourceViewerInformationControl;
 
  24 final public class TemplateInformationControlCreator implements IInformationControlCreator, IInformationControlCreatorExtension {
 
  26         private SourceViewerInformationControl fControl;
 
  28         public TemplateInformationControlCreator()  {
 
  32          * @see org.eclipse.jface.text.IInformationControlCreator#createInformationControl(org.eclipse.swt.widgets.Shell)
 
  34         public IInformationControl createInformationControl(Shell parent) {
 
  35                 fControl= new SourceViewerInformationControl(parent);
 
  36                 fControl.addDisposeListener(new DisposeListener() {
 
  37                         public void widgetDisposed(DisposeEvent e) {
 
  45          * @see org.eclipse.jface.text.IInformationControlCreatorExtension#canReuse(org.eclipse.jface.text.IInformationControl)
 
  47         public boolean canReuse(IInformationControl control) {
 
  48                 return fControl == control && fControl != null;
 
  52          * @see org.eclipse.jface.text.IInformationControlCreatorExtension#canReplace(org.eclipse.jface.text.IInformationControlCreator)
 
  54         public boolean canReplace(IInformationControlCreator creator) {
 
  55                 return (creator != null && getClass() == creator.getClass());