1 11 12 package org.eclipse.ui.internal.progress; 13 14 import java.util.HashMap ; 15 16 import org.eclipse.ui.progress.IProgressConstants; 17 import org.eclipse.ui.statushandlers.StatusAdapter; 18 19 24 public class StatusAdapterHelper { 25 private static StatusAdapterHelper instance; 26 27 private HashMap map; 28 29 private StatusAdapterHelper() { 30 } 31 32 36 public static StatusAdapterHelper getInstance() { 37 if (instance == null) { 38 instance = new StatusAdapterHelper(); 39 } 40 return instance; 41 } 42 43 48 public void putStatusAdapter(JobInfo info, StatusAdapter statusAdapter) { 49 if (map == null) { 50 map = new HashMap (); 51 } 52 map.put(info, statusAdapter); 53 } 54 55 60 public StatusAdapter getStatusAdapter(JobInfo info) { 61 if (map == null) { 62 return null; 63 } 64 StatusAdapter statusAdapter = (StatusAdapter) map.remove(info); 65 statusAdapter.setProperty( 66 IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, 67 Boolean.FALSE); 68 return statusAdapter; 69 } 70 71 public void clear() { 72 if (map != null) { 73 map.clear(); 74 } 75 } 76 } 77 | Popular Tags |