|
Lines 13-18
Link Here
|
| 13 |
|
13 |
|
| 14 |
import org.eclipse.core.runtime.CoreException; |
14 |
import org.eclipse.core.runtime.CoreException; |
| 15 |
import org.eclipse.core.runtime.IProgressMonitor; |
15 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
|
16 |
import org.eclipse.core.runtime.IStatus; |
| 17 |
import org.eclipse.core.runtime.Status; |
| 16 |
import org.eclipse.jface.resource.ImageDescriptor; |
18 |
import org.eclipse.jface.resource.ImageDescriptor; |
| 17 |
|
19 |
|
| 18 |
/** |
20 |
/** |
|
Lines 43-48
Link Here
|
| 43 |
* @since 3.3 |
45 |
* @since 3.3 |
| 44 |
*/ |
46 |
*/ |
| 45 |
public boolean show(IWorkbenchPage page) { |
47 |
public boolean show(IWorkbenchPage page) { |
|
|
48 |
if (page == null) { |
| 49 |
// I wish it was easier to avoid warnings about unused parameters |
| 50 |
} |
| 46 |
return false; |
51 |
return false; |
| 47 |
} |
52 |
} |
| 48 |
|
53 |
|
|
Lines 142-145
Link Here
|
| 142 |
*/ |
147 |
*/ |
| 143 |
public abstract int hashCode(); |
148 |
public abstract int hashCode(); |
| 144 |
|
149 |
|
|
|
150 |
/** |
| 151 |
* Prepares this saveable for a background save operation. Returns false if |
| 152 |
* this saveable cannot be saved in the background at this time. Returns |
| 153 |
* true if the saveable has been prepared for a background save operation |
| 154 |
* successfully. This method is called in the UI thread and should do only |
| 155 |
* minimal work. In particular, it should not change the visual appearance |
| 156 |
* of the Saveable in the UI, or disable any controls. However, since |
| 157 |
* {@link #doBackgroundSave(IProgressMonitor)} will not be called on the UI |
| 158 |
* thread, this method should copy any state that can only be accessed from |
| 159 |
* the UI thread so that {@link #doBackgroundSave(IProgressMonitor)} will be |
| 160 |
* able to access it. |
| 161 |
* |
| 162 |
* <p> |
| 163 |
* The default implementation of this method returns <code>false</code>. |
| 164 |
* </p> |
| 165 |
* |
| 166 |
* @return <code>false</code> if this saveable cannot be saved in the |
| 167 |
* background at this time, or <code>true</code> if the saveable |
| 168 |
* has been prepared for a background save operation successfully |
| 169 |
* |
| 170 |
* @since 3.3 |
| 171 |
*/ |
| 172 |
public boolean prepareBackgroundSave() { |
| 173 |
return false; |
| 174 |
} |
| 175 |
|
| 176 |
/** |
| 177 |
* Saves the contents of this saveable. This method is not called on the UI |
| 178 |
* thread. It will only be called after a preceding call to |
| 179 |
* {@link #prepareBackgroundSave()} returned <code>true</code>. |
| 180 |
* <p> |
| 181 |
* If the save is cancelled through user action, or for any other reason, |
| 182 |
* the part should invoke <code>setCancelled</code> on the |
| 183 |
* <code>IProgressMonitor</code> to inform the caller. |
| 184 |
* </p> |
| 185 |
* <p> |
| 186 |
* This method is long-running; progress and cancellation are provided by |
| 187 |
* the given progress monitor. |
| 188 |
* </p> |
| 189 |
* |
| 190 |
* @param monitor |
| 191 |
* @return a status object |
| 192 |
* |
| 193 |
* @since 3.3 |
| 194 |
*/ |
| 195 |
public IStatus doBackgroundSave(IProgressMonitor monitor) { |
| 196 |
if (monitor == null) { |
| 197 |
// avoids warning about unused parameters |
| 198 |
} |
| 199 |
return Status.CANCEL_STATUS; |
| 200 |
} |
| 201 |
|
| 202 |
/** |
| 203 |
* Disable the user interface that can change the state of this saveable. |
| 204 |
* This method will be called on the UI thread during a background save |
| 205 |
* operation before processing UI events, so that saveables can disable |
| 206 |
* their UI. If this method is called during a background save operation, a |
| 207 |
* call to {@link #enableUI()} will follow. |
| 208 |
*/ |
| 209 |
public void disableUI() { |
| 210 |
} |
| 211 |
|
| 212 |
/** |
| 213 |
* Enable the user interface after a corresponding call to disableUI. This |
| 214 |
* method will be called on the UI thread after a background save operation |
| 215 |
* if the saveable's UI was disabled during the background save operation. |
| 216 |
*/ |
| 217 |
public void enableUI() { |
| 218 |
} |
| 219 |
|
| 145 |
} |
220 |
} |