Example usage for org.eclipse.jface.util IPropertyChangeListener propertyChange

List of usage examples for org.eclipse.jface.util IPropertyChangeListener propertyChange

Introduction

In this page you can find the example usage for org.eclipse.jface.util IPropertyChangeListener propertyChange.

Prototype

public void propertyChange(PropertyChangeEvent event);

Source Link

Document

Notification that a property has changed.

Usage

From source file:at.nucle.e4.plugin.preferences.core.internal.context.PreferenceScopeContext.java

License:Open Source License

@Override
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;//from  w  ww.j a v a2  s .  co  m
    }
    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("PreferenceScopeContext.changeError")) { //$NON-NLS-1$

            @Override
            public void run() {
                listener.propertyChange(event);
            }
        });
    }
}

From source file:au.gov.ga.earthsci.core.preferences.ScopedPreferenceStore.java

License:Open Source License

@Override
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;/*from   w w  w  .j  a  va2  s.c o  m*/
    }
    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$
            @Override
            public void run() {
                listener.propertyChange(event);
            }
        });
    }
}

From source file:cc.warlock.rcp.util.FontSelector.java

License:Open Source License

public FontSelector(Composite parent) {
    listeners = new ArrayList<IPropertyChangeListener>();
    button = new Button(parent, SWT.PUSH);
    button.setText("Choose...");
    button.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);//from  ww  w  .j  a v a 2 s  . c  o  m
        }

        public void widgetSelected(SelectionEvent e) {
            FontDialog dialog = new FontDialog(button.getShell());
            if (fontData != null)
                dialog.setFontList(new FontData[] { fontData });

            FontData oldData = fontData;
            fontData = dialog.open();

            if (fontData != null) {
                font = new Font(button.getDisplay(), fontData);

                for (IPropertyChangeListener listener : listeners)
                    listener.propertyChange(
                            new PropertyChangeEvent(FontSelector.this, "fontData", oldData, fontData));
            }
        }
    });
}

From source file:ccw.editors.clojure.SimpleSourceViewerConfiguration.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent event) {
    for (IPropertyChangeListener listener : propertyChangeListeners) {
        listener.propertyChange(event);
    }/*w w w . j a v a 2  s .  c  o  m*/
}

From source file:ch.elexis.core.ui.preferences.SettingsPreferenceStore.java

License:Open Source License

public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
    for (IPropertyChangeListener l : listeners) {
        l.propertyChange(new PropertyChangeEvent(this, name, oldValue, newValue));
    }/* w w  w  .jav a2 s .  c  o  m*/
}

From source file:ch.unibe.iam.scg.archie.actions.NewStatisticsAction.java

License:Open Source License

/**
 * This method is being called as soon as the job this action observes,
 * finishes. The action is enabled as soon as the last job finishes. This
 * method also creates and sets the result table in the result view as well
 * as information about the parameters of the active provider in the header
 * of the result panel./*from w w w . j  a  v a  2 s  .com*/
 * 
 * @param event
 */
public void done(final IJobChangeEvent event) {
    // allow other threads to update this UI thread
    // @see http://www.eclipse.org/swt/faq.php#uithread
    UiDesk.getDisplay().syncExec(new Runnable() {
        public void run() {
            final ResultPanel results = NewStatisticsAction.this.view.getResultPanel();
            final AbstractDataProvider provider = ProviderManager.getInstance().getProvider();
            final DataSet dataset = provider.getDataSet();

            results.removeLoadingMessage();
            if (dataset.isEmpty()) {
                results.showEmptyMessage();
            } else {
                // create result table
                TableFactory tableFactory = TableFactory.getInstance();
                TableViewer viewer = tableFactory.createTableFromData(results, dataset,
                        provider.getLabelProvider(), provider.getContentProvider());

                // add column dataset sorter and add table to the manager
                new DatasetTableColumnSorter(viewer.getTable(), dataset);
                TableManager.getInstance().setTable(viewer.getTable());

                // add selection menu
                MenuManager menuManager = new MenuManager();
                Menu menu = menuManager.createContextMenu(viewer.getTable());
                viewer.getTable().setMenu(menu);

                NewStatisticsAction.this.view.getSite().registerContextMenu(menuManager, viewer);
                NewStatisticsAction.this.view.getSite().setSelectionProvider(viewer);
            }

            // remove old chart models
            ChartModelManager.getInstance().clean();

            // layout results at last
            results.layout();

            // enable all actions back again
            NewStatisticsAction.this.view.setActionsEnabled(true);
            NewStatisticsAction.this.setEnabled(true);

            // delegate property change event
            for (IPropertyChangeListener listener : NewStatisticsAction.this.listeners) {
                listener.propertyChange(new PropertyChangeEvent(NewStatisticsAction.this,
                        NewStatisticsAction.JOB_DONE, null, null));
            }
        }
    });
}

From source file:ch.unibe.iam.scg.archie.actions.NewStatisticsAction.java

License:Open Source License

/**
 * Updated the IPropertyChangeListener listeners for this action with a new
 * PropertyChangeEvent containing the jobs current status.
 *//*from  ww  w  .  jav  a 2s  .c  o m*/
private void updateListeners() {
    // delegate property change event
    for (IPropertyChangeListener listener : this.listeners) {
        listener.propertyChange(new PropertyChangeEvent(this, NewStatisticsAction.JOB_RUNNING, null, null));
    }
}

From source file:chuck.terran.admin.ui.jface.LineSelector.java

License:Open Source License

/**
 * Activate the editor for this selector. This causes the color selection
 * dialog to appear and wait for user input.
 *
 * @since 3.2// w w w .j a  v  a 2s .  co  m
 */
public void open() {
    LineDialog lineDialog = new LineDialog(fButton.getShell());
    lineDialog.setAttributes(fLineValue);
    LineAttributes newLine = lineDialog.openDialog();
    if (newLine != null) {
        LineAttributes oldValue = fLineValue;
        fLineValue = newLine;
        final Object[] finalListeners = getListeners();
        if (finalListeners.length > 0) {
            PropertyChangeEvent pEvent = new PropertyChangeEvent(this, PROP_LINECHANGE, oldValue, newLine);
            for (int i = 0; i < finalListeners.length; ++i) {
                IPropertyChangeListener listener = (IPropertyChangeListener) finalListeners[i];
                listener.propertyChange(pEvent);
            }
        }
        updateLineImage();
    }
}

From source file:com.agynamix.platform.frontend.preferences.ApplicationPreferenceStore.java

License:Open Source License

public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
    final Object[] finalListeners = this.listeners.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) {
            IPropertyChangeListener l = (IPropertyChangeListener) finalListeners[i];
            l.propertyChange(pe);
        }/*from   ww  w  .  ja va2s .  com*/
        //      }
        //    });
    }
}

From source file:com.agynamix.platform.frontend.preferences.PlatformFieldEditorPreferencePage.java

License:Open Source License

public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);
    if (!event.getNewValue().equals(event.getOldValue())) {
        FieldEditor fe = (FieldEditor) event.getSource();
        List<IPropertyChangeListener> l = listeners.get(fe);
        if (l != null) {
            for (IPropertyChangeListener listener : l) {
                listener.propertyChange(event);
            }//from   w  w  w .j ava2 s.c om
        }
        // call IPreferenceDialogListeners
        for (IPreferenceDialogListener listener : preferenceDialogListeners) {
            listener.propertyChange(event);
        }
    }
}