本文整理汇总了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();
}
});
}
示例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();
}
});
}
示例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();
}
});
}
示例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();
}
});
}
示例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);
}
});
}
}
}
示例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);
}
});
}
}
示例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);
}
});
}
}
示例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);
}
});
}
}
示例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);
}
});
}
}
示例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);
}
});
}
}
示例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);
}
});
}
}
示例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);
}
});
}
}
示例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));
}
});
}
}
示例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 );
}
} );
}
}
}
示例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 );
}
} );
}
}