Java Code Examples for org.eclipse.jface.util.SafeRunnable#run()

The following examples show how to use org.eclipse.jface.util.SafeRunnable#run() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TabContents.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * If controls have been created, refresh all sections on the page.
 */
public void refresh() {
    if (controlsCreated) {
        for (final ISection section : sections) {
            ISafeRunnable runnable = new SafeRunnable() {

                @Override
	public void run()
                    throws Exception {
                    section.refresh();
                }
            };
            SafeRunnable.run(runnable);
        }
    }
}
 
Example 2
Source File: WizardBaseDialog.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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 );
			}
		} );
	}
}
 
Example 3
Source File: PreferenceWrapper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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 );
				}
			} );
		}
	}
}
 
Example 4
Source File: AbstractPropertyDialog.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 
 * @param event
 */
protected 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 );
			}
		} );
	}
}
 
Example 5
Source File: TSWizardDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Notifies any page changing listeners that the currently selected dialog
 * page is changing. Only listeners registered at the time this method is
 * called are notified.
 * 
 * @param event
 *            a selection changing event
 * 
 * @see IPageChangingListener#handlePageChanging(PageChangingEvent)
 * @since 3.3
 */
protected void firePageChanging(final PageChangingEvent event) {
	Object[] listeners = pageChangingListeners.getListeners();
	for (int i = 0; i < listeners.length; ++i) {
		final IPageChangingListener l = (IPageChangingListener) listeners[i];
		SafeRunnable.run(new SafeRunnable() {
			public void run() {
				l.handlePageChanging(event);
			}
		});
	}
}
 
Example 6
Source File: TabContents.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets page's sections input objects.
 *
 * @param part
 * @param selection
 */
public void setInput(final IWorkbenchPart part, final ISelection selection) {
    for (final ISection section : sections) {
        ISafeRunnable runnable = new SafeRunnable() {

            @Override
public void run()
                throws Exception {
                section.setInput(part, selection);
            }
        };
        SafeRunnable.run(runnable);
    }
}
 
Example 7
Source File: TabContents.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sends the lifecycle event to the page's sections.
 */
public void aboutToBeHidden() {
    for (final ISection section : sections) {
        ISafeRunnable runnable = new SafeRunnable() {

            @Override
public void run()
                throws Exception {
                section.aboutToBeHidden();
            }
        };
        SafeRunnable.run(runnable);
    }
}
 
Example 8
Source File: TabContents.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sends the lifecycle event to the page's sections.
 */
public void aboutToBeShown() {
    for (final ISection section : sections) {
        ISafeRunnable runnable = new SafeRunnable() {

            @Override
public void run()
                throws Exception {
                section.aboutToBeShown();
            }
        };
        SafeRunnable.run(runnable);
    }
}
 
Example 9
Source File: TabContents.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Dispose of page's sections controls.
 */
public void dispose() {
    for (final ISection section : sections) {
        ISafeRunnable runnable = new SafeRunnable() {

            @Override
public void run()
                throws Exception {
                section.dispose();
            }
        };
        SafeRunnable.run(runnable);
    }
}
 
Example 10
Source File: TabContents.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates page's sections controls.
 *
 * @param parent
 * @param page
 */
public void createControls(Composite parent,
        final TabbedPropertySheetPage page) {
    Composite pageComposite = page.getWidgetFactory().createComposite(
        parent, SWT.NO_FOCUS);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.verticalSpacing = 0;
    pageComposite.setLayout(layout);

    for (final ISection section : sections) {
        final Composite sectionComposite = page.getWidgetFactory()
            .createComposite(pageComposite, SWT.NO_FOCUS);
        sectionComposite.setLayout(new FillLayout());
        int style = (section.shouldUseExtraSpace()) ? GridData.FILL_BOTH
            : GridData.FILL_HORIZONTAL;
        GridData data = new GridData(style);
        data.heightHint = section.getMinimumHeight();
        sectionComposite.setLayoutData(data);

        ISafeRunnable runnable = new SafeRunnable() {

            @Override
public void run()
                throws Exception {
                section.createControls(sectionComposite, page);
            }
        };
        SafeRunnable.run(runnable);
    }
    controlsCreated = true;
}
 
Example 11
Source File: CDateTimeSelectionProvider.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Notifies any selection changed listeners that the viewer's selection has changed.
 * Only listeners registered at the time this method is called are notified.
 *
 * @param event a selection changed event
 *
 * @see ISelectionChangedListener#selectionChanged
 */
private void fireSelectionChanged(final SelectionChangedEvent event) {
    Object[] listeners = selectionChangedListeners.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);
            }
        });
    }
}
 
Example 12
Source File: TSWizardDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Notifies any page changing listeners that the currently selected dialog
 * page is changing. Only listeners registered at the time this method is
 * called are notified.
 * 
 * @param event
 *            a selection changing event
 * 
 * @see IPageChangingListener#handlePageChanging(PageChangingEvent)
 * @since 3.3
 */
protected void firePageChanging(final PageChangingEvent event) {
	Object[] listeners = pageChangingListeners.getListeners();
	for (int i = 0; i < listeners.length; ++i) {
		final IPageChangingListener l = (IPageChangingListener) listeners[i];
		SafeRunnable.run(new SafeRunnable() {
			public void run() {
				l.handlePageChanging(event);
			}
		});
	}
}
 
Example 13
Source File: TmfEventsTable.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Notifies any selection changed listeners that the viewer's selection has
 * changed. Only listeners registered at the time this method is called are
 * notified.
 *
 * @param event
 *            a selection changed event
 *
 * @see ISelectionChangedListener#selectionChanged
 */
protected void fireSelectionChanged(final SelectionChangedEvent event) {
    Object[] listeners = fSelectionChangedListeners.getListeners();
    for (int i = 0; i < listeners.length; ++i) {
        final ISelectionChangedListener l = (ISelectionChangedListener) listeners[i];
        SafeRunnable.run(new SafeRunnable() {
            @Override
            public void run() {
                l.selectionChanged(event);
            }
        });
    }
}
 
Example 14
Source File: TmfEventsEditor.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Notifies any selection changed listeners that the viewer's selection has changed.
 * Only listeners registered at the time this method is called are notified.
 *
 * @param event a selection changed event
 *
 * @see ISelectionChangedListener#selectionChanged
 */
protected void fireSelectionChanged(final SelectionChangedEvent event) {
    Object[] listeners = fSelectionChangedListeners.getListeners();
    for (int i = 0; i < listeners.length; ++i) {
        final ISelectionChangedListener l = (ISelectionChangedListener) listeners[i];
        SafeRunnable.run(new SafeRunnable() {
            @Override
            public void run() {
                l.selectionChanged(event);
            }
        });
    }
}
 
Example 15
Source File: GenericSelectionProvider.java    From tlaplus with MIT License 5 votes vote down vote up
/**
 * Notifies any selection changed listeners that the viewer's selection has changed.
 * Only listeners registered at the time this method is called are notified.
 *
 * @param event a selection changed event
 *
 * @see ISelectionChangedListener#selectionChanged
 */
protected void fireSelectionChanged(final SelectionChangedEvent event) {
    Object[] listeners = selectionChangedListeners.getListeners();
    for (int i = 0; i < listeners.length; ++i) {
        final ISelectionChangedListener listener = (ISelectionChangedListener) listeners[i];
        SafeRunnable.run(new SafeRunnable() {
            public void run() {
                listener.selectionChanged(event);
            }
        });
    }
}
 
Example 16
Source File: EnhancedCheckBoxTableViewer.java    From eclipse-cs with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Notifies any check state listeners that a check state changed has been received. Only listeners
 * registered at the time this method is called are notified.
 *
 * @param event
 *          a check state changed event
 * @see ICheckStateListener#checkStateChanged
 */
private void fireCheckStateChanged(final CheckStateChangedEvent event) {
  Object[] array = checkStateListeners.getListeners();
  for (int i = 0; i < array.length; i++) {
    final ICheckStateListener l = (ICheckStateListener) array[i];
    SafeRunnable.run(new SafeRunnable() {
      @Override
      public void run() {
        l.checkStateChanged(event);
      }
    });
  }
}
 
Example 17
Source File: CDateTimeSelectionProvider.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Notifies any selection changed listeners that the viewer's selection has changed.
 * Only listeners registered at the time this method is called are notified.
 *
 * @param event a selection changed event
 *
 * @see ISelectionChangedListener#selectionChanged
 */
private void fireSelectionChanged(final SelectionChangedEvent event) {
    Object[] listeners = selectionChangedListeners.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);
            }
        });
    }
}
 
Example 18
Source File: TSWizardDialog.java    From tmxeditor8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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 3.1
 */
protected 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);
			}
		});
	}
}
 
Example 19
Source File: TSWizardDialog.java    From translationstudio8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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 3.1
 */
protected 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);
			}
		});
	}
}