1 11 package org.eclipse.pde.internal.ui.editor; 12 13 import org.eclipse.jface.action.IStatusLineManager; 14 import org.eclipse.jface.text.ITextSelection; 15 import org.eclipse.jface.text.TextSelection; 16 import org.eclipse.pde.internal.ui.parts.FormEntry; 17 import org.eclipse.pde.internal.ui.parts.IFormEntryListener; 18 import org.eclipse.ui.IActionBars; 19 import org.eclipse.ui.forms.events.HyperlinkEvent; 20 21 public class FormEntryAdapter implements IFormEntryListener { 22 private IContextPart contextPart; 23 protected IActionBars actionBars; 24 25 public FormEntryAdapter(IContextPart contextPart) { 26 this(contextPart, null); 27 } 28 public FormEntryAdapter(IContextPart contextPart, IActionBars actionBars) { 29 this.contextPart = contextPart; 30 this.actionBars = actionBars; 31 } 32 public void focusGained(FormEntry entry) { 33 ITextSelection selection = new TextSelection(1,1); 34 contextPart.getPage().getPDEEditor().getContributor().updateSelectableActions(selection); 35 } 36 39 public void textDirty(FormEntry entry) { 40 contextPart.fireSaveNeeded(); 41 } 42 45 public void textValueChanged(FormEntry entry) { 46 } 47 50 public void browseButtonSelected(FormEntry entry) { 51 } 52 55 public void linkEntered(HyperlinkEvent e) { 56 if (actionBars==null) return; 57 IStatusLineManager mng = actionBars.getStatusLineManager(); 58 mng.setMessage(e.getLabel()); 59 } 60 63 public void linkExited(HyperlinkEvent e) { 64 if (actionBars==null) return; 65 IStatusLineManager mng = actionBars.getStatusLineManager(); 66 mng.setMessage(null); 67 } 68 71 public void linkActivated(HyperlinkEvent e) { 72 } 73 public void selectionChanged(FormEntry entry) { 74 ITextSelection selection = new TextSelection(1,1); 75 contextPart.getPage().getPDEEditor().getContributor().updateSelectableActions(selection); 76 } 77 } 78 | Popular Tags |