1 11 package org.eclipse.ant.internal.ui.editor.templates; 12 13 import org.eclipse.ant.internal.ui.editor.AntSourceViewerInformationControl; 14 import org.eclipse.jface.text.IInformationControl; 15 import org.eclipse.jface.text.IInformationControlCreator; 16 import org.eclipse.jface.text.IInformationControlCreatorExtension; 17 import org.eclipse.swt.events.DisposeEvent; 18 import org.eclipse.swt.events.DisposeListener; 19 import org.eclipse.swt.widgets.Shell; 20 21 22 public class AntTemplateInformationControlCreator implements IInformationControlCreator, IInformationControlCreatorExtension { 23 24 private AntSourceViewerInformationControl fControl; 25 26 public AntTemplateInformationControlCreator() { 27 } 28 29 32 public IInformationControl createInformationControl(Shell parent) { 33 fControl= new AntSourceViewerInformationControl(parent); 34 fControl.addDisposeListener(new DisposeListener() { 35 public void widgetDisposed(DisposeEvent e) { 36 fControl= null; 37 } 38 }); 39 return fControl; 40 } 41 42 45 public boolean canReuse(IInformationControl control) { 46 return fControl == control && fControl != null; 47 } 48 49 52 public boolean canReplace(IInformationControlCreator creator) { 53 return (creator != null && getClass() == creator.getClass()); 54 } 55 } 56 | Popular Tags |