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 net.sourceforge.phpdt.internal.ui.text.java.hover.SourceViewerInformationControl;
15 import org.eclipse.jface.text.IInformationControl;
16 import org.eclipse.jface.text.IInformationControlCreator;
17 import org.eclipse.jface.text.IInformationControlCreatorExtension;
18 import org.eclipse.swt.events.DisposeEvent;
19 import org.eclipse.swt.events.DisposeListener;
20 import org.eclipse.swt.widgets.Shell;
22 final public class TemplateInformationControlCreator implements
23 IInformationControlCreator, IInformationControlCreatorExtension {
25 private SourceViewerInformationControl fControl;
27 public TemplateInformationControlCreator() {
31 * @see org.eclipse.jface.text.IInformationControlCreator#createInformationControl(org.eclipse.swt.widgets.Shell)
33 public IInformationControl createInformationControl(Shell parent) {
34 fControl = new SourceViewerInformationControl(parent);
35 fControl.addDisposeListener(new DisposeListener() {
36 public void widgetDisposed(DisposeEvent e) {
44 * @see org.eclipse.jface.text.IInformationControlCreatorExtension#canReuse(org.eclipse.jface.text.IInformationControl)
46 public boolean canReuse(IInformationControl control) {
47 return fControl == control && fControl != null;
51 * @see org.eclipse.jface.text.IInformationControlCreatorExtension#canReplace(org.eclipse.jface.text.IInformationControlCreator)
53 public boolean canReplace(IInformationControlCreator creator) {
54 return (creator != null && getClass() == creator.getClass());