1 11 12 package org.eclipse.ui.views.markers.internal; 13 14 import org.eclipse.jface.viewers.ISelectionProvider; 15 import org.eclipse.jface.viewers.IStructuredSelection; 16 import org.eclipse.ui.IWorkbenchPart; 17 import org.eclipse.ui.actions.SelectionProviderAction; 18 19 23 public class ActionMarkerProperties extends SelectionProviderAction { 24 25 private IWorkbenchPart part; 26 27 private String markerName; 28 29 37 public ActionMarkerProperties(IWorkbenchPart part, 38 ISelectionProvider provider, String markerName) { 39 super(provider, MarkerMessages.propertiesAction_title); 40 setEnabled(false); 41 this.part = part; 42 this.markerName = markerName; 43 } 44 45 50 public void run() { 51 if (!isEnabled()) { 52 return; 53 } 54 Object obj = getStructuredSelection().getFirstElement(); 55 if (!(obj instanceof ConcreteMarker)) { 56 return; 57 } 58 ConcreteMarker marker = (ConcreteMarker) obj; 59 DialogMarkerProperties dialog = new DialogMarkerProperties(part 60 .getSite().getShell(), MarkerMessages.propertiesDialog_title, markerName); 61 dialog.setMarker(marker.getMarker()); 62 dialog.open(); 63 } 64 65 70 public void selectionChanged(IStructuredSelection selection) { 71 setEnabled(selection != null && selection.size() == 1); 72 } 73 } 74 | Popular Tags |