1 11 package org.eclipse.jface.action; 12 13 import org.eclipse.core.runtime.IProgressMonitor; 14 import org.eclipse.swt.graphics.Image; 15 16 21 public class SubStatusLineManager extends SubContributionManager implements 22 IStatusLineManager { 23 26 private String message; 27 28 31 private String errorMessage; 32 33 36 private Image messageImage; 37 38 41 private Image errorImage; 42 43 50 public SubStatusLineManager(IStatusLineManager mgr) { 51 super(mgr); 52 } 53 54 58 protected final IStatusLineManager getParentStatusLineManager() { 59 return (IStatusLineManager) getParent(); 62 } 63 64 67 public IProgressMonitor getProgressMonitor() { 68 return getParentStatusLineManager().getProgressMonitor(); 69 } 70 71 74 public boolean isCancelEnabled() { 75 return getParentStatusLineManager().isCancelEnabled(); 76 } 77 78 81 public void setCancelEnabled(boolean enabled) { 82 getParentStatusLineManager().setCancelEnabled(enabled); 83 } 84 85 88 public void setErrorMessage(String message) { 89 this.errorImage = null; 90 this.errorMessage = message; 91 if (isVisible()) { 92 getParentStatusLineManager().setErrorMessage(errorMessage); 93 } 94 } 95 96 99 public void setErrorMessage(Image image, String message) { 100 this.errorImage = image; 101 this.errorMessage = message; 102 if (isVisible()) { 103 getParentStatusLineManager().setErrorMessage(errorImage, 104 errorMessage); 105 } 106 } 107 108 111 public void setMessage(String message) { 112 this.messageImage = null; 113 this.message = message; 114 if (isVisible()) { 115 getParentStatusLineManager().setMessage(message); 116 } 117 } 118 119 122 public void setMessage(Image image, String message) { 123 this.messageImage = image; 124 this.message = message; 125 if (isVisible()) { 126 getParentStatusLineManager().setMessage(messageImage, message); 127 } 128 } 129 130 133 public void setVisible(boolean visible) { 134 super.setVisible(visible); 135 if (visible) { 136 getParentStatusLineManager().setErrorMessage(errorImage, 137 errorMessage); 138 getParentStatusLineManager().setMessage(messageImage, message); 139 } else { 140 getParentStatusLineManager().setMessage(null, null); 141 getParentStatusLineManager().setErrorMessage(null, null); 142 } 143 } 144 145 148 public void update(boolean force) { 149 getParentStatusLineManager().update(force); 153 } 154 } 155 | Popular Tags |