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


Java SafeRunnable.run方法代码示例

本文整理汇总了Java中org.eclipse.jface.util.SafeRunnable.run方法的典型用法代码示例。如果您正苦于以下问题:Java SafeRunnable.run方法的具体用法?Java SafeRunnable.run怎么用?Java SafeRunnable.run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.util.SafeRunnable的用法示例。


在下文中一共展示了SafeRunnable.run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addIncludedFeatures

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
public static void addIncludedFeatures(final IFeatureModel parentModel,
		final Collection<IFeatureModel> featureModelsToInclude) {
	SafeRunnable.run(new SafeRunnable() {
		@Override
		public void run() throws Exception {
			IFeature feature = parentModel.getFeature();

			Collection<IFeatureChild> includes = new TreeSet<IFeatureChild>(IDENTIFIABLE_COMPARATOR);
			includes.addAll(Arrays.asList(feature.getIncludedFeatures()));

			feature.removeIncludedFeatures(feature.getIncludedFeatures());
			for (IFeatureModel featureModelToInclude : featureModelsToInclude) {
				includes.add(createInclude(parentModel, featureModelToInclude));
			}

			feature.addIncludedFeatures(includes.toArray(new IFeatureChild[includes.size()]));
			((IEditableModel) parentModel).save();
		}
	});
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:21,代码来源:RefactoringSupport.java

示例2: addIncludedPlugins

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
public static void addIncludedPlugins(final IFeatureModel parentModel,
		final Collection<IPluginModelBase> pluginModelsToInclude) {
	SafeRunnable.run(new SafeRunnable() {
		@Override
		public void run() throws Exception {
			IFeature feature = parentModel.getFeature();

			Collection<IFeaturePlugin> includes = new TreeSet<IFeaturePlugin>(IDENTIFIABLE_COMPARATOR);
			includes.addAll(Arrays.asList(feature.getPlugins()));

			feature.removePlugins(feature.getPlugins());
			for (IPluginModelBase pluginModelToInclude : pluginModelsToInclude) {
				includes.add(createInclude(parentModel, pluginModelToInclude));
			}

			feature.addPlugins(includes.toArray(new IFeaturePlugin[includes.size()]));
			((IEditableModel) parentModel).save();
		}
	});
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:21,代码来源:RefactoringSupport.java

示例3: addProductFeatures

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
public static void addProductFeatures(final IProductModel productModel,
		final Collection<IFeatureModel> featureModelsToInclude) {
	SafeRunnable.run(new SafeRunnable() {
		@Override
		public void run() throws Exception {
			IProduct product = productModel.getProduct();

			Collection<IProductFeature> includes = new TreeSet<IProductFeature>(PRODUCT_FEATURE_COMPARATOR);
			includes.addAll(Arrays.asList(product.getFeatures()));

			product.removeFeatures(product.getFeatures());
			for (IFeatureModel featureModelToInclude : featureModelsToInclude) {
				includes.add(createInclude(productModel, featureModelToInclude));
			}

			product.addFeatures(includes.toArray(new IProductFeature[includes.size()]));
			((IEditableModel) productModel).save();
		}
	});
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:21,代码来源:RefactoringSupport.java

示例4: removeProductFeatures

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
public static void removeProductFeatures(final IProductModel productModel,
		final Collection<IProductFeature> featuresToRemove) {
	SafeRunnable.run(new SafeRunnable() {
		@Override
		public void run() throws Exception {
			IProduct product = productModel.getProduct();

			Collection<String> featureIdsToRemove = new HashSet<String>();
			for (IProductFeature featureToRemove : featuresToRemove) {
				featureIdsToRemove.add(featureToRemove.getId());
			}

			Collection<IProductFeature> removals = new ArrayList<IProductFeature>();
			for (IProductFeature feature : product.getFeatures()) {
				if (featureIdsToRemove.contains(feature.getId())) {
					removals.add(feature);
				}
			}

			product.removeFeatures(removals.toArray(new IProductFeature[removals.size()]));
			((IEditableModel) productModel).save();
		}
	});
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:25,代码来源:RefactoringSupport.java

示例5: firePropertyChangeEvent

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
@Override
public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
	final Object[] finalListeners = getListeners();
	// Do we need to fire an event.
	if (finalListeners.length > 0 && (oldValue == null || !oldValue.equals(newValue))) {
		final PropertyChangeEvent pe = new PropertyChangeEvent(this, name, oldValue, newValue);
		for (int i = 0; i < finalListeners.length; ++i) {
			final IPropertyChangeListener l = (IPropertyChangeListener) finalListeners[i];
			SafeRunnable.run(new SafeRunnable(JFaceResources.getString("PreferenceStore.changeError")) { //$NON-NLS-1$
						public void run() {
							l.propertyChange(pe);
						}
					});
		}
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:17,代码来源:JRContextPrefStore.java

示例6: setSelection

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
public void setSelection(ISelection selection) {

		if (selection == null) {
			return;
		}

		currentSelection = selection;

		final SelectionChangedEvent event = new SelectionChangedEvent(this, currentSelection);

		Object[] listeners = postSelectionListeners.getListeners();
		for (int i = 0; i < listeners.length; ++i) {
			final ISelectionChangedListener l = (ISelectionChangedListener) listeners[i];
			SafeRunnable.run(new SafeRunnable() {
				public void run() {
					l.selectionChanged(event);
				}
			});
		}
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:21,代码来源:PostSelectionProvider.java

示例7: fireOpenEvent

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
/**
 * Fire an open event that the dialog is opened or closes.
 */
private void fireOpenEvent(final boolean isOpened) {

	final Object[] listeners = _openListeners.getListeners();

	for (final Object listener : listeners) {

		final IColorSelectorListener colorSelectorListener = (IColorSelectorListener) listener;

		SafeRunnable.run(new SafeRunnable() {
			@Override
			public void run() {
				colorSelectorListener.colorDialogOpened(isOpened);
			}
		});
	}
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:20,代码来源:ColorSelectorExtended.java

示例8: fireOpenEvent

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
/**
 * Fire an open event that the dialog is opened or closes.
 */
private void fireOpenEvent(final boolean isOpened) {

	final Object[] listeners = _openListeners.getListeners();

	for (final Object listener : listeners) {

		final IFontDialogListener dialogListener = (IFontDialogListener) listener;

		SafeRunnable.run(new SafeRunnable() {
			@Override
			public void run() {
				dialogListener.fontDialogOpened(isOpened);
			}
		});
	}
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:20,代码来源:FontFieldEditorExtended.java

示例9: fireFontChanged

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
private void fireFontChanged(final FontData font) {

		FontData[] oldFont = _selectedFontData;

		if (oldFont == null) {
			oldFont = JFaceResources.getFontRegistry().defaultFont().getFontData();
		}

		final FontData[] newFontData = new FontData[1];
		newFontData[0] = font;

		updateFont(newFontData);

		final Object[] listeners = _fontListeners.getListeners();
		for (final Object listener : listeners) {

			final IFontEditorListener fontDialogListener = (IFontEditorListener) listener;

			SafeRunnable.run(new SafeRunnable() {
				@Override
				public void run() {
					fontDialogListener.fontSelected(font);
				}
			});
		}
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:27,代码来源:SimpleFontEditor.java

示例10: fireOpenEvent

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
/**
 * Fire an open event that the dialog is opened or closes.
 */
private void fireOpenEvent(final boolean isOpened) {

	final Object[] listeners = _fontListeners.getListeners();

	for (final Object listener : listeners) {

		final IFontEditorListener fontDialogListener = (IFontEditorListener) listener;

		SafeRunnable.run(new SafeRunnable() {
			@Override
			public void run() {
				fontDialogListener.fontDialogOpened(isOpened);
			}
		});
	}
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:20,代码来源:SimpleFontEditor.java

示例11: setSelection

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
@Override
public void setSelection(final ISelection selection) {

	if (selection == null) {
		return;
	}

	_currentSelection = selection;

	final SelectionChangedEvent event = new SelectionChangedEvent(this, _currentSelection);

	final Object[] listeners = _postSelectionListeners.getListeners();

	for (final Object listener : listeners) {
		final ISelectionChangedListener l = (ISelectionChangedListener) listener;
		SafeRunnable.run(new SafeRunnable() {
			@Override
			public void run() {
				l.selectionChanged(event);
			}
		});
	}
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:24,代码来源:PostSelectionProvider.java

示例12: setSelection

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
public void setSelection(final ISelection selection) {

		currentSelection = selection;

		final SelectionChangedEvent event = new SelectionChangedEvent(this, currentSelection);

		final Object[] listeners = selectionListeners.getListeners();
		for (int i = 0; i < listeners.length; ++i) {
			final ISelectionChangedListener l = (ISelectionChangedListener) listeners[i];
			SafeRunnable.run(new SafeRunnable() {
				public void run() {
					l.selectionChanged(event);
				}
			});
		}
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:17,代码来源:SelectionProvider.java

示例13: notifyButtonPressed

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
private void notifyButtonPressed(boolean isClosing) {
	final InPlaceDialogEvent event = new InPlaceDialogEvent(getReturnCode(), isClosing);
	for (final IInPlaceDialogListener listener : listeners) {
		SafeRunnable.run(new ISafeRunnable() {

			@Override
			public void run() throws Exception {
				listener.buttonPressed(event);
			}

			@Override
			public void handleException(Throwable exception) {
				LogUtil.error(new Status(IStatus.ERROR, "Multiselect Widget!", "Error while notifying IInPlaceCloseListener", exception));
			}
		});
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:18,代码来源:AbstractInPlaceDialog.java

示例14: firePreferenceChangeEvent

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
public void firePreferenceChangeEvent( String name, Object oldValue,
		Object newValue )
{
	final Object[] finalListeners = getListeners( );
	// Do we need to fire an event.
	if ( finalListeners.length > 0
			&& ( oldValue == null || !oldValue.equals( newValue ) ) )
	{
		final PreferenceChangeEvent pe = new PreferenceChangeEvent( this,
				name,
				oldValue,
				newValue );
		for ( int i = 0; i < finalListeners.length; ++i )
		{
			final IPreferenceChangeListener l = (IPreferenceChangeListener) finalListeners[i];
			SafeRunnable.run( new SafeRunnable( JFaceResources.getString( "PreferenceStore.changeError" ) ) { //$NON-NLS-1$

				public void run( )
				{
					l.preferenceChange( pe );
				}
			} );
		}
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:26,代码来源:PreferenceWrapper.java

示例15: firePageChanged

import org.eclipse.jface.util.SafeRunnable; //导入方法依赖的package包/类
/**
 * Notifies any selection changed listeners that the selected page has
 * changed. Only listeners registered at the time this method is called
 * are notified.
 * 
 * @param event
 *            a selection changed event
 * 
 * @see IPageChangedListener#pageChanged
 * 
 * @since 2.1
 */
void firePageChanged( final PageChangedEvent event )
{
	Object[] listeners = pageChangedListeners.getListeners( );
	for ( int i = 0; i < listeners.length; i++ )
	{
		final IPageChangedListener l = (IPageChangedListener) listeners[i];
		SafeRunnable.run( new SafeRunnable( ) {

			public void run( )
			{
				l.pageChanged( event );
			}
		} );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:28,代码来源:WizardBaseDialog.java


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