@Override protected IStatus run(IProgressMonitor monitor) { String tmp = NO_HELP_CONTENT; if (template != null) { URI uri = template.getHelpContent(); if (uri != null) { try { URLConnection conn = uri.toURL().openConnection(); conn.setUseCaches(false); tmp = IO.collect(conn.getInputStream()); } catch (IOException e) { log.log( new Status( IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error loading template help content.", e)); } } } final String text = tmp; if (control != null && !control.isDisposed()) { control .getDisplay() .asyncExec( new Runnable() { @Override public void run() { if (!control.isDisposed()) control.setText(text); } }); } return Status.OK_STATUS; }
public void setTemplate(final Template template) { Template old = this.selected; this.selected = template; propSupport.firePropertyChange(PROP_TEMPLATE, old, template); if (template != null) { txtDescription.setText( String.format( "<form>Loading help content for template '%s'...</form>", template.getName())); Job updateDescJob = new UpdateDescriptionJob(template, txtDescription); updateDescJob.setSystem(true); updateDescJob.schedule(); } else { txtDescription.setText(NO_HELP_CONTENT); } }