本文整理汇总了Java中org.eclipse.core.runtime.SafeRunner类的典型用法代码示例。如果您正苦于以下问题:Java SafeRunner类的具体用法?Java SafeRunner怎么用?Java SafeRunner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SafeRunner类属于org.eclipse.core.runtime包,在下文中一共展示了SafeRunner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeExtension
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
/**
* Execute extension.
* @param object the object instance found
*/
private void executeExtension(final Object object) {
ISafeRunnable runnable = new ISafeRunnable() {
@Override
public void handleException(Throwable e) {
System.out.println("Exception in client");
}
@Override
public void run() throws Exception {
System.err.println(object.toString());
}
};
SafeRunner.run(runnable);
}
示例2: processTick
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
private void processTick ()
{
this.scheduled = false;
this.globalCounter++;
for ( final BlinkCallback tc : this.callbacks )
{
SafeRunner.run ( new SafeRunnable () {
@Override
public void run () throws Exception
{
tc.toggle ( DisplayBlinkServiceImpl.this.globalCounter );
}
} );
}
schedule ();
}
示例3: fireValueChanged
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
@Override
protected void fireValueChanged ( final String property, final Object oldValue, final Object newValue )
{
if ( VALUE.equals ( property ) )
{
if ( this.callback != null )
{
SafeRunner.run ( new SafeRunnable () {
@Override
public void run () throws Exception
{
ComboFieldEditor2.this.callback.valueChange ( newValue );
}
} );
}
}
super.fireValueChanged ( property, oldValue, newValue );
}
示例4: fireChange
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
/**
* Fire visibility change
* <p>
* The change will only be fired if the state really changed.
* </p>
*
* @param state
* the new state
*/
protected void fireChange ( final boolean state )
{
if ( this.state == state )
{
return;
}
this.state = state;
for ( final Listener listener : this.listeners )
{
SafeRunner.run ( new SafeRunnable () {
@Override
public void run () throws Exception
{
listener.visibilityChanged ( state );
}
} );
}
}
示例5: restoreCodeFoldingStateFromFile
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
/**
* <p>
* Restores the code folding state from a XML file in the state location.
* </p>
*
* @param uriString the key to determine the file to load the state from
*/
public void restoreCodeFoldingStateFromFile(String uriString) {
final File stateFile = getCodeFoldingStateFile(uriString);
if (stateFile == null || !stateFile.exists()) {
calculatePositions();
return;
}
SafeRunner.run(new SafeRunnable("Unable to read code folding state. The state will be reset.") {
public void run() throws Exception {
FileInputStream input = new FileInputStream(stateFile);
BufferedReader reader = new BufferedReader(new InputStreamReader(input, "utf-8"));
IMemento memento = XMLMemento.createReadRoot(reader);
reader.close();
String sourceText = sourceViewer.getDocument().get();
if (memento.getString(VERIFY_KEY).equals(makeMD5(sourceText))) {
restoreCodeFolding(memento);
} else {
calculatePositions();
}
}
});
}
示例6: broadcastSyncInfoChanges
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
/**
* This method is called by SyncFileChangeListener when metafiles have
* changed
*/
public static void broadcastSyncInfoChanges(final IResource[] resources, final boolean initializeListeners) {
IResourceStateChangeListener[] toNotify;
synchronized(listeners) {
toNotify = (IResourceStateChangeListener[])listeners.toArray(new IResourceStateChangeListener[listeners.size()]);
}
for (int i = 0; i < toNotify.length; ++i) {
final IResourceStateChangeListener listener = toNotify[i];
ISafeRunnable code = new ISafeRunnable() {
public void run() throws Exception {
if (initializeListeners) listener.initialize();
listener.resourceSyncInfoChanged(resources);
}
public void handleException(Throwable e) {
// don't log the exception....it is already being logged in
// Platform#run
}
};
SafeRunner.run(code);
}
}
示例7: broadcastModificationStateChanges
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
/**
* This method is called by FileModificationManager when some resources have
* changed
*/
public static void broadcastModificationStateChanges(
final IResource[] resources) {
IResourceStateChangeListener[] toNotify;
synchronized(listeners) {
toNotify = (IResourceStateChangeListener[])listeners.toArray(new IResourceStateChangeListener[listeners.size()]);
}
for (int i = 0; i < toNotify.length; ++i) {
final IResourceStateChangeListener listener = toNotify[i];
ISafeRunnable code = new ISafeRunnable() {
public void run() throws Exception {
listener.resourceModified(resources);
}
public void handleException(Throwable e) {
// don't log the exception....it is already being logged in
// Platform#run
}
};
SafeRunner.run(code);
}
}
示例8: broadcastProjectConfigured
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
/**
* This method is called by SVNTeamProvider.configureProject which is
* invoked when a project is mapped
*/
protected static void broadcastProjectConfigured(final IProject project) {
IResourceStateChangeListener[] toNotify;
synchronized(listeners) {
toNotify = (IResourceStateChangeListener[])listeners.toArray(new IResourceStateChangeListener[listeners.size()]);
}
for (int i = 0; i < toNotify.length; ++i) {
final IResourceStateChangeListener listener = toNotify[i];
ISafeRunnable code = new ISafeRunnable() {
public void run() throws Exception {
listener.projectConfigured(project);
}
public void handleException(Throwable e) {
// don't log the exception....it is already being logged in
// Platform#run
}
};
SafeRunner.run(code);
}
}
示例9: broadcastProjectDeconfigured
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
/**
* This method is called by SVNTeamProvider.deconfigured which is invoked
* after a provider has been unmaped
*/
protected static void broadcastProjectDeconfigured(final IProject project) {
IResourceStateChangeListener[] toNotify;
synchronized(listeners) {
toNotify = (IResourceStateChangeListener[])listeners.toArray(new IResourceStateChangeListener[listeners.size()]);
}
for (int i = 0; i < toNotify.length; ++i) {
final IResourceStateChangeListener listener = toNotify[i];
ISafeRunnable code = new ISafeRunnable() {
public void run() throws Exception {
listener.projectDeconfigured(project);
}
public void handleException(Throwable e) {
// don't log the exception....it is already being logged in
// Platform#run
}
};
SafeRunner.run(code);
}
}
示例10: preferencesChanged
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
private void preferencesChanged(Preferences oldPreferences, Preferences newPreferences) {
for (final IPreferencesChangeListener listener : preferencesChangeListeners) {
ISafeRunnable job = new ISafeRunnable() {
@Override
public void handleException(Throwable e) {
JavaLanguageServerPlugin.log(new CoreException(StatusFactory.newErrorStatus(e.getMessage(), e)));
}
@Override
public void run() throws Exception {
listener.preferencesChange(oldPreferences, newPreferences);
}
};
SafeRunner.run(job);
}
}
示例11: getBundleExtensionResult
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
private String getBundleExtensionResult() {
IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSIONPOINT_ID);
assertEquals("Expect one extension point", 1, elements.length);
final String[] resultValues = new String[] { "" };
for (IConfigurationElement e : elements) {
if ("java".equals(e.getAttribute("type"))) {
SafeRunner.run(new ISafeRunnable() {
@Override
public void run() throws Exception {
final Object extInstance = e.createExecutableExtension("class");
resultValues[0] = extInstance.toString();
}
@Override
public void handleException(Throwable ex) {
IStatus status = new Status(IStatus.ERROR, JavaLanguageServerPlugin.PLUGIN_ID, IStatus.OK, "Error in JDT Core during launching debug server", ex); //$NON-NLS-1$
JavaLanguageServerPlugin.log(status);
}
});
}
}
return resultValues[0];
}
示例12: fireMappingAdded
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
private void fireMappingAdded(BookmarkId bookmarkFolderId) {
Object[] listeners = listenerList.getListeners();
for (int i = 0; i < listeners.length; i++) {
final IBookmarkMappingsListener listener = (IBookmarkMappingsListener) listeners[i];
SafeRunner.run(new ISafeRunnable() {
public void run() throws Exception {
listener.mappingAdded(bookmarkFolderId);
}
public void handleException(Throwable exception) {
StatusHelper.logError("Error when mapping added", exception);
}
});
}
}
示例13: setSelection
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
@Override
public void setSelection(ISelection selection) {
theSelection = selection;
final SelectionChangedEvent e = new SelectionChangedEvent(this, selection);
Object[] listenersArray = listeners.toArray();
for (int i = 0; i < listenersArray.length; i++) {
final ISelectionChangedListener l = (ISelectionChangedListener) listenersArray[i];
SafeRunner.run(new SafeRunnable() {
@Override
public void run() {
l.selectionChanged(e);
}
});
}
}
示例14: fire
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
protected void fire() {
IElementChangedListener[] listeners;
synchronized (elementChangedListeners) {
listeners = new IElementChangedListener[elementChangedListeners.size()];
elementChangedListeners.toArray(listeners);
}
int offset = editor.getCursorOffset();
IElement part = partAtOffset(offset);
final ElementChangedEvent event = new ElementChangedEvent(this, part, ElementChangedEvent.POST_CHANGE);
for (IElementChangedListener listener : listeners) {
SafeRunner.run(new ISafeRunnable() {
@Override
public void run() throws Exception {
listener.elementChanged(event);
}
@Override
public void handleException(Throwable exception) {
Log.error("Exception during change notification", exception);
}
});
}
}
示例15: firePropertyChangeEvent
import org.eclipse.core.runtime.SafeRunner; //导入依赖的package包/类
public void firePropertyChangeEvent(String name, Object oldValue,
Object newValue) {
// important: create intermediate array to protect against listeners
// being added/removed during the notification
final Object[] list = getListeners();
if (list.length == 0) {
return;
}
final PropertyChangeEvent event = new PropertyChangeEvent(this, name,
oldValue, newValue);
for (int i = 0; i < list.length; i++) {
final IPropertyChangeListener listener = (IPropertyChangeListener) list[i];
SafeRunner.run(new SafeRunnable(JFaceResources
.getString("PreferenceStore.changeError")) { //$NON-NLS-1$
public void run() {
listener.propertyChange(event);
}
});
}
}