use of org.eclipse.ui.forms.IMessageManager in project bndtools by bndtools.
the class RepositorySelectionPart method reloadRepos.
private void reloadRepos() {
final IMessageManager messages = getManagedForm().getMessageManager();
messages.removeMessage(MESSAGE_KEY, runReposViewer.getControl());
final List<Repository> allRepos = new ArrayList<>();
try {
allRepos.addAll(repositories.getOrdered());
runReposViewer.setInput(allRepos);
} catch (Exception e) {
messages.addMessage(MESSAGE_KEY, "Repository List: Unable to load OSGi Repositories. " + e.getMessage(), e, IMessageProvider.ERROR, runReposViewer.getControl());
// Load the repos and clear the error message if the Workspace is initialised later.
Central.onWorkspaceInit(new Success<Workspace, Void>() {
@Override
public Promise<Void> call(final Promise<Workspace> resolved) throws Exception {
final Deferred<Void> completion = new Deferred<>();
SWTConcurrencyUtil.execForControl(runReposViewer.getControl(), true, new Runnable() {
@Override
public void run() {
try {
allRepos.clear();
allRepos.addAll(resolved.getValue().getPlugins(Repository.class));
runReposViewer.setInput(allRepos);
messages.removeMessage(MESSAGE_KEY, runReposViewer.getControl());
completion.resolve(null);
} catch (Exception e) {
completion.fail(e);
}
}
});
return completion.getPromise();
}
});
}
updateButtons();
}
use of org.eclipse.ui.forms.IMessageManager in project bndtools by bndtools.
the class ImportPatternsListPart method validate.
@Override
public void validate() {
IMessageManager msgs = getManagedForm().getMessageManager();
msgs.setDecorationPosition(SWT.TOP | SWT.RIGHT);
String noStarWarning = null;
String actionMessage = null;
List<ImportPattern> patterns = getClauses();
if (!patterns.isEmpty()) {
for (Iterator<ImportPattern> iter = patterns.iterator(); iter.hasNext(); ) {
ImportPattern pattern = iter.next();
if (pattern.getName().equals("*") && iter.hasNext()) {
noStarWarning = "The catch-all pattern \"*\" should be in the last position.";
actionMessage = "Move \"*\" pattern to the last position.";
break;
}
}
if (noStarWarning == null) {
ImportPattern last = patterns.get(patterns.size() - 1);
if (!last.getName().equals("*")) {
noStarWarning = "The catch-all pattern \"*\" should be present and in the last position.";
actionMessage = "Add missing \"*\" pattern.";
}
}
}
if (noStarWarning != null) {
msgs.addMessage("_warning_no_star", noStarWarning, new FixMissingStarsAction(actionMessage), IMessageProvider.WARNING);
} else {
msgs.removeMessage("_warning_no_star");
}
}
use of org.eclipse.ui.forms.IMessageManager in project bndtools by bndtools.
the class ProjectBuildPage method reportProblemsInHeader.
void reportProblemsInHeader() {
IManagedForm mform = getManagedForm();
if (mform == null)
return;
if (mform.getForm().isDisposed())
// We were called asynchronously after dialog was closed
return;
IMessageManager manager = mform.getMessageManager();
manager.removeMessages();
for (Entry<String, Integer> entry : messageSeverityMap.entrySet()) {
// severities in IMessageProvider are 1 higher than in IMarker
int mappedSeverity = entry.getValue() + 1;
// may be null
IAction[] fixes = messageFixesMap.get(entry.getKey());
manager.addMessage(entry.getKey(), entry.getKey(), fixes, mappedSeverity);
}
}
Aggregations