use of org.eclipse.core.runtime.ISafeRunnable in project translationstudio8 by heartsome.
the class TmImporter method runExtension.
/**
* 加载记忆库匹配实现 ;
*/
private void runExtension() {
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TMIMPORTER_EXTENSION_ID);
try {
for (IConfigurationElement e : config) {
final Object o = e.createExecutableExtension("class");
if (o instanceof ITmImporter) {
ISafeRunnable runnable = new ISafeRunnable() {
public void handleException(Throwable exception) {
logger.error(Messages.getString("importer.TmImporter.logger1"), exception);
}
public void run() throws Exception {
tmImporter = (ITmImporter) o;
}
};
SafeRunner.run(runnable);
}
}
} catch (CoreException ex) {
logger.error(Messages.getString("importer.TmImporter.logger1"), ex);
}
}
use of org.eclipse.core.runtime.ISafeRunnable in project translationstudio8 by heartsome.
the class TmMatcher method runExtension.
/**
* 加哉记忆库匹配实现 ;
*/
private void runExtension() {
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TMMATCH_EXTENSION_ID);
try {
for (IConfigurationElement e : config) {
final Object o = e.createExecutableExtension("class");
if (o instanceof ITmMatch) {
ISafeRunnable runnable = new ISafeRunnable() {
public void handleException(Throwable exception) {
logger.error(Messages.getString("match.TmMatcher.logger1"), exception);
}
public void run() throws Exception {
tmTranslation = (ITmMatch) o;
}
};
SafeRunner.run(runnable);
}
}
} catch (CoreException ex) {
logger.error(Messages.getString("match.TmMatcher.logger1"), ex);
}
}
use of org.eclipse.core.runtime.ISafeRunnable in project translationstudio8 by heartsome.
the class SimpleMatcherFactory method runExtension.
/**
* 加载记忆库匹配实现 ;
*/
private void runExtension() {
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
try {
for (IConfigurationElement e : config) {
final Object o = e.createExecutableExtension("class");
if (o instanceof ISimpleMatcher) {
ISafeRunnable runnable = new ISafeRunnable() {
public void handleException(Throwable exception) {
logger.error(Messages.getString("simpleMatch.SimpleMatcherFactory.logger1"), exception);
}
public void run() throws Exception {
ISimpleMatcher simpleMatcher = (ISimpleMatcher) o;
matchers.add(simpleMatcher);
}
};
SafeRunner.run(runnable);
}
}
} catch (CoreException ex) {
logger.error(Messages.getString("simpleMatch.SimpleMatcherFactory.logger1"), ex);
}
}
use of org.eclipse.core.runtime.ISafeRunnable in project eclipse.platform.text by eclipse.
the class HyperlinkDetectorDescriptor method createHyperlinkDetectorImplementation.
/**
* Creates a new {@link IHyperlinkDetector}.
*
* @return the hyperlink detector or <code>null</code> if the plug-in isn't loaded yet
* @throws CoreException if a failure occurred during creation
* @since 3.9
*/
public IHyperlinkDetector createHyperlinkDetectorImplementation() throws CoreException {
final Throwable[] exception = new Throwable[1];
final IHyperlinkDetector[] result = new IHyperlinkDetector[1];
String message = NLSUtility.format(EditorMessages.Editor_error_HyperlinkDetector_couldNotCreate_message, new String[] { getId(), fElement.getContributor().getName() });
ISafeRunnable code = new SafeRunnable(message) {
@Override
public void run() throws Exception {
String pluginId = fElement.getContributor().getName();
boolean isPlugInActivated = Platform.getBundle(pluginId).getState() == Bundle.ACTIVE;
if (isPlugInActivated || canActivatePlugIn())
result[0] = (IHyperlinkDetector) fElement.createExecutableExtension(CLASS_ATTRIBUTE);
}
@Override
public void handleException(Throwable ex) {
super.handleException(ex);
exception[0] = ex;
}
};
SafeRunner.run(code);
if (exception[0] == null)
return result[0];
throw new CoreException(new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, IStatus.OK, message, exception[0]));
}
use of org.eclipse.core.runtime.ISafeRunnable in project eclipse.platform.text by eclipse.
the class SpellingConfigurationBlock method dispose.
@Override
public void dispose() {
for (Iterator<ISpellingPreferenceBlock> it = fProviderPreferences.values().iterator(); it.hasNext(); ) {
final ISpellingPreferenceBlock block = it.next();
ISafeRunnable runnable = new ISafeRunnable() {
@Override
public void run() throws Exception {
block.dispose();
}
@Override
public void handleException(Throwable x) {
}
};
SafeRunner.run(runnable);
}
}
Aggregations