当前位置: 首页>>代码示例>>Java>>正文


Java SafeRunner类代码示例

本文整理汇总了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);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:20,代码来源:EvaluateContributionsHandler.java

示例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 ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:20,代码来源:DisplayBlinkServiceImpl.java

示例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 );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:20,代码来源:ComboFieldEditor2.java

示例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 );
            }
        } );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:30,代码来源:AbstractVisibilityProvider.java

示例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();
			}
		}
	});
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:29,代码来源:DwprofileCodeFoldingManager.java

示例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);
	}
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:26,代码来源:SVNProviderPlugin.java

示例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);
	}
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:26,代码来源:SVNProviderPlugin.java

示例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);
	}
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:25,代码来源:SVNProviderPlugin.java

示例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);
	}
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:25,代码来源:SVNProviderPlugin.java

示例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);
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:17,代码来源:PreferenceManager.java

示例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];
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:24,代码来源:BundleUtilsTest.java

示例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);
			}
		});
	}
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:18,代码来源:BookmarkMappingsStore.java

示例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);
			}
		});
	}
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:17,代码来源:ProxySelectionProviderTest.java

示例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);
			}
		});
	}
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:25,代码来源:PageRoot.java

示例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);
					}
				});
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:21,代码来源:ScopedPreferenceStore.java


注:本文中的org.eclipse.core.runtime.SafeRunner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。