IFile file = null;
try {
- monitor.beginTask("Download Wiki Articles: ", 100);
+ int totalWork = files.length;
+ if (totalWork <= 0) {
+ totalWork = 100;
+ }
+ monitor.beginTask("Download Wiki Articles: ", totalWork);
// ArrayList wikiTitles = new ArrayList();
// for (int i = 0; i < files.length; i++) {
// wikiTitles.add( Util.getReadableWikiName(files[i]) );
// }
StringBuffer buffer = new StringBuffer();
HashMap map = new HashMap();
+ MediaWikiConnector mwConnector = new MediaWikiConnector();
String wikiTitle;
int titleCounter = 0;
for (int i = 0; i < files.length; i++) {
if (i != files.length - 1) {
buffer.append("\n");
}
- if (i % 10 == 0) {
- // read only 10 files at a time
- IStatus status = readWikisFromBuffer(buffer, map, monitor, console);
+ if (i % 5 == 0) {
+ // read only 5 files at a time
+ IStatus status = readWikisFromBuffer(mwConnector, buffer, map, monitor, console);
if (status.equals(Status.CANCEL_STATUS)) {
return Status.CANCEL_STATUS;
}
}
}
if (titleCounter > 0) {
- IStatus status = readWikisFromBuffer(buffer, map, monitor, console);
+ IStatus status = readWikisFromBuffer(mwConnector, buffer, map, monitor, console);
if (status.equals(Status.CANCEL_STATUS)) {
return Status.CANCEL_STATUS;
}
if (isModal(this)) {
// The progress dialog is still open show the message
- console.reportError();
} else {
// setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
// setProperty(IProgressConstants.ACTION_PROPERTY, getWikisCompletedAction());
}
if (isModal(this)) {
// The progress dialog is still open show the message
- console.reportError();
}
return Status.OK_STATUS;
}
* @throws UnexpectedAnswerException
* @throws MethodException
*/
- private IStatus readWikisFromBuffer(StringBuffer buffer, HashMap map, IProgressMonitor monitor, ProblemConsole console)
- throws UnexpectedAnswerException, InterruptedException, MethodException {
+ private IStatus readWikisFromBuffer(MediaWikiConnector mwConnector, StringBuffer buffer, HashMap map, IProgressMonitor monitor,
+ ProblemConsole console) throws UnexpectedAnswerException, InterruptedException, MethodException {
String wikiTitle;
boolean showConsole = WikiEditorPlugin.getDefault().getPreferenceStore().getBoolean(WikiEditorPlugin.CONSOLE_OUTPUT);
- MediaWikiConnector mwConnector = new MediaWikiConnector();
+
String url = actionURL;
if (url == null) {
url = configuration.getActionUrl() + "/" + configuration.getSpecialNs() + ":Export";
}
}
}
+ monitor.worked(1);
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}