/** * Creates a new List that displays and responds to changes in the source list. * List elements are formatted using the provided {@link ItemFormat}. * * @param source the EventList that provides the elements * @param list the list * @param itemFormat an {@link ItemFormat} for formatting the displayed values * * @see ItemFormat * @see GlazedListsSWT#beanItemFormat(String) */ public EventListViewer(EventList<E> source, List list, ItemFormat<? super E> itemFormat) { super(createProxyList(source, list.getDisplay()), list, itemFormat); disposeSource = (this.source != source); }
/** * Creates a new List that displays and responds to changes in the source list. * List elements are formatted using the provided {@link ItemFormat}. * * @param source the EventList that provides the elements * @param list the list * @param itemFormat an {@link ItemFormat} for formatting the displayed values * * @see ItemFormat * @see GlazedListsSWT#beanItemFormat(String) */ public EventListViewer(EventList<E> source, List list, ItemFormat<? super E> itemFormat) { super(createProxyList(source, list.getDisplay()), list, itemFormat); disposeSource = (this.source != source); }
private void initialize() { initializeFields(); for (int i= 0; i < fAppearanceColorListModel.length; i++) fAppearanceColorList.add(fAppearanceColorListModel[i][0]); fAppearanceColorList.getDisplay().asyncExec(new Runnable() { public void run() { if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) { fAppearanceColorList.select(0); handleAppearanceColorListSelection(); } } }); }
private void initialize() { initializeFields(); for (int i= 0; i < fAppearanceColorListModel.length; i++) fAppearanceColorList.add(fAppearanceColorListModel[i][0]); fAppearanceColorList.getDisplay().asyncExec(new Runnable() { @Override public void run() { if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) { fAppearanceColorList.select(0); handleAppearanceColorListSelection(); } } }); }
/** * Creates a new List that displays and responds to changes in the source list. * List elements are formatted using the provided {@link ItemFormat}. * While holding a read lock, this method wraps the source list using * {@link GlazedListsSWT#swtThreadProxyList(EventList, Display)}. * * <p>The returned viewer is <strong>not thread-safe</strong>. Unless otherwise * noted, all methods are only safe to be called from the SWT event handler thread. * </p> * * @param source the EventList that provides the elements * @param list the list * @param itemFormat an {@link ItemFormat} for formatting the displayed values */ public static <E> DefaultEventListViewer<E> eventListViewerWithThreadProxyList(EventList<E> source, List list, ItemFormat<? super E> itemFormat) { final EventList<E> proxySource = createSwtThreadProxyListWithLock(source, list.getDisplay()); return new DefaultEventListViewer<E>(proxySource, list, itemFormat, true); }
public void initialize() { super.initialize(); initializeDefaultColors(); for (int i= 0; i < fAppearanceColorListModel.length; i++) fAppearanceColorList.add(fAppearanceColorListModel[i][0]); fAppearanceColorList.getDisplay().asyncExec(new Runnable() { public void run() { if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) { fAppearanceColorList.select(0); handleAppearanceColorListSelection(); } } }); }
/** * Creates a new List that displays and responds to changes in the source list. * List elements are formatted using the provided {@link ItemFormat}. * While holding a read lock, this method wraps the source list using * {@link GlazedListsSWT#swtThreadProxyList(EventList, Display)}. * * <p>The returned viewer is <strong>not thread-safe</strong>. Unless otherwise * noted, all methods are only safe to be called from the SWT event handler thread. * </p> * * @param source the EventList that provides the elements * @param list the list * @param itemFormat an {@link ItemFormat} for formatting the displayed values */ public static <E> DefaultEventListViewer<E> eventListViewerWithThreadProxyList(EventList<E> source, List list, ItemFormat<? super E> itemFormat) { final EventList<E> proxySource = createSwtThreadProxyListWithLock(source, list.getDisplay()); return new DefaultEventListViewer<E>(proxySource, list, itemFormat, true); }
/** * Copy the contents of the statuses to the clipboard. */ private void copyToClipboard() { if (clipboard != null) { clipboard.dispose(); } StringBuilder statusBuffer = new StringBuilder(); populateCopyBuffer(status, statusBuffer, 0); clipboard = new Clipboard(list.getDisplay()); clipboard.setContents(new Object[] { statusBuffer.toString() }, new Transfer[] { TextTransfer.getInstance() }); }
/** * Copy the contents of the statuses to the clipboard. */ private void copyToClipboard() { if (clipboard != null) { clipboard.dispose(); } StringBuffer statusBuffer = new StringBuffer(); populateCopyBuffer(status, statusBuffer, 0); clipboard = new Clipboard(list.getDisplay()); clipboard.setContents(new Object[] { statusBuffer.toString() }, new Transfer[] { TextTransfer.getInstance() }); }
@Override public void initialize() { initializeBracketHighlightingPreferences(); super.initialize(); // also updates state of slaves, hence it is the second call initializeDefaultColors(); for (int i= 0; i < fAppearanceColorListModel.length; i++) fAppearanceColorList.add(fAppearanceColorListModel[i][0]); fAppearanceColorList.getDisplay().asyncExec(new Runnable() { @Override public void run() { if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) { fAppearanceColorList.select(0); handleAppearanceColorListSelection(); } } }); }
@Override public void initialize() { initializeBracketHighlightingPreferences(); super.initialize(); // also updates state of slaves, hence it is the second call initializeDefaultColors(); for (int i= 0; i < fAppearanceColorListModel.length; i++) fAppearanceColorList.add(fAppearanceColorListModel[i][0]); fAppearanceColorList.getDisplay().asyncExec(new Runnable() { @Override public void run() { if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) { fAppearanceColorList.select(0); handleAppearanceColorListSelection(); } } }); }
/** * @see org.eclipse.jface.preference.FieldEditorPreferencePage#initialize() */ @Override protected void initialize() { super.initialize(); for (int i = 0; i < fAppearanceColorListModel.length; i++) { fConsoleColorList.add(fAppearanceColorListModel[i][0]); } fConsoleColorList.getDisplay().asyncExec(() -> { if (fConsoleColorList != null && !fConsoleColorList.isDisposed()) { fConsoleColorList.select(0); handleAppearanceColorListSelection(); } }); }
/** * Creates a new List that displays and responds to changes in the source list. * List elements will simply be displayed as the result of calling * toString() on the contents of the source list. * While holding a read lock, this method wraps the source list using * {@link GlazedListsSWT#swtThreadProxyList(EventList, Display)}. * * <p>The returned viewer is <strong>not thread-safe</strong>. Unless otherwise * noted, all methods are only safe to be called from the SWT event handler thread. * </p> * * @param source the EventList that provides the elements * @param list the list */ public static <E> DefaultEventListViewer<E> eventListViewerWithThreadProxyList(EventList<E> source, List list) { final EventList<E> proxySource = createSwtThreadProxyListWithLock(source, list.getDisplay()); return new DefaultEventListViewer<E>(proxySource, list, new DefaultItemFormat<E>(), true); }
/** * Creates a new List that displays and responds to changes in the source list. * List elements will simply be displayed as the result of calling * toString() on the contents of the source list. * While holding a read lock, this method wraps the source list using * {@link GlazedListsSWT#swtThreadProxyList(EventList, Display)}. * * <p>The returned viewer is <strong>not thread-safe</strong>. Unless otherwise * noted, all methods are only safe to be called from the SWT event handler thread. * </p> * * @param source the EventList that provides the elements * @param list the list */ public static <E> DefaultEventListViewer<E> eventListViewerWithThreadProxyList(EventList<E> source, List list) { final EventList<E> proxySource = createSwtThreadProxyListWithLock(source, list.getDisplay()); return new DefaultEventListViewer<E>(proxySource, list, new DefaultItemFormat<E>(), true); }
/** * Initializes the default colors. * * @since 3.3 */ private void initializeDefaultColors() { if (getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT)) { RGB rgb= fAppearanceColorList.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(); PreferenceConverter.setValue(getPreferenceStore(), PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR, rgb); } }
GdkColor temp = getDisplay().COLOR_LIST_BACKGROUND; background = display.toGdkRGBA (temp); } else { background = rgba; GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION; GdkRGBA selectedBackground = display.toGdkRGBA (defaultColor); if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
/** * Initializes the default colors. * * @since 3.3 */ private void initializeDefaultColors() { if (getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT)) { Display display= fAppearanceColorList.getDisplay(); RGB rgb= SourceViewerInformationControl.getVisibleBackgroundColor(display); if (rgb == null) rgb= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(); PreferenceConverter.setValue(getPreferenceStore(), PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR, rgb); } }
GdkColor temp = getDisplay().COLOR_LIST_BACKGROUND; background = display.toGdkRGBA (temp); } else { background = rgba; GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION; GdkRGBA selectedBackground = display.toGdkRGBA (defaultColor); if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
/** * Initializes the default colors. * * @since 3.3 */ private void initializeDefaultColors() { if (getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT)) { Display display= fAppearanceColorList.getDisplay(); RGB rgb= SourceViewerInformationControl.getVisibleBackgroundColor(display); if (rgb == null) rgb= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(); PreferenceConverter.setValue(getPreferenceStore(), PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR, rgb); } }
/** * Creates a new List that displays and responds to changes in source. * List elements are formatted using the provided {@link ILabelProvider}. */ public EventListViewer(EventList<E> source, List list, ILabelProvider labelProvider) { // lock the source list for reading since we want to prevent writes // from occurring until we fully initialize this EventListViewer source.getReadWriteLock().readLock().lock(); try { swtThreadSource = GlazedListsSWT.swtThreadProxyList(source, list.getDisplay()); this.list = list; this.labelProvider = labelProvider; // Enable the selection lists selection = new SelectionManager<E>(swtThreadSource, new SelectableList()); // setup initial values for(int i = 0, n = swtThreadSource.size(); i < n; i++) { addRow(i, swtThreadSource.get(i)); } // listen for changes swtThreadSource.addListEventListener(this); } finally { source.getReadWriteLock().readLock().unlock(); } }