public ToolBarNavigator ( final Composite parent, final int style, final ViewManager viewManager ) { this.viewManager = viewManager; this.toolbar = new ToolBar ( parent, style ); this.resourceManager = new LocalResourceManager ( JFaceResources.getResources ( parent.getDisplay () ) ); this.toolbar.addDisposeListener ( new DisposeListener () { @Override public void widgetDisposed ( final DisposeEvent e ) { handleDispose (); } } ); viewManager.addViewManagerListener ( this ); }
public CommandStackTableViewer(Composite parent, TableColumnLayout tcl, CommandStackView styleProvider) { super(new Table(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.HIDE_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL)); this.styleProvider = styleProvider; resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent); greenBubble = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandStackTableViewer.class, "icons/obj16/ok.png")); redBubble = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandStackTableViewer.class, "icons/obj16/nok.png")); grayBubble = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandStackTableViewer.class, "icons/obj16/undef.png")); waitingImage = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandStackTableViewer.class, "icons/obj16/waiting.png")); getTable().setHeaderVisible(true); getTable().setLinesVisible(true); addFixedColumns(tcl); contentProvider = new CommandStackTableContentProvider(this); setContentProvider(contentProvider); setInput(contentProvider); // ! otherwise refresh() deletes everything... }
/** Initialize * @param parent * @param table_layout * @param operations_manager */ public AxesTableHandler(final Composite parent, final TableColumnLayout table_layout, final UndoableActionManager operations_manager) { color_registry = new LocalResourceManager(JFaceResources.getResources(), parent); this.operations_manager = operations_manager; axes_table = new TableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL); final Table table = axes_table.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); createColumns(table_layout); axes_table.setContentProvider(this); createContextMenu(); }
@PostConstruct public void postConstruct(Composite parent) { ResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent); TreeViewer viewer = new TreeViewer(parent); viewer.setContentProvider(new TreeContentProvider()); viewer.getTree().setHeaderVisible(true); viewer.getTree().setLinesVisible(true); viewer.getTree().setFont(resourceManager.createFont(FontDescriptor.createFrom("Arial", 32, SWT.ITALIC))); TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, SWT.NONE); viewerColumn.getColumn().setWidth(300); viewerColumn.getColumn().setText("Names"); viewerColumn.setLabelProvider(new ColumnLabelProvider()); viewer.setInput(new String[] { "Simon Scholz", "Lars Vogel", "Dirk Fauth", "Wim Jongman", "Tom Schindl" }); GridLayoutFactory.fillDefaults().generateLayout(parent); }
public KeyTreeViewer ( final Composite parent ) { this.resourceManager = new LocalResourceManager ( JFaceResources.getResources ( parent.getDisplay () ), parent ); this.viewer = new TreeViewer ( parent ); this.viewer.getControl ().setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) ); this.viewer.setAutoExpandLevel ( AbstractTreeViewer.ALL_LEVELS ); this.contentProvider = new ObservableListTreeContentProvider ( new FactoryImpl (), null ); this.viewer.setContentProvider ( this.contentProvider ); this.viewer.setLabelProvider ( this.labelProvider = new LabelProviderImpl ( this.resourceManager, this.contentProvider.getRealizedElements () ) ); }
public AbstractInputViewer ( final DataBindingContext dbc, final DataSeries element, final ChartViewer viewer, final ResourceManager resourceManager, final AxisLocator<XAxis, XAxisViewer> xLocator, final AxisLocator<YAxis, YAxisViewer> yLocator ) { this.element = element; this.viewer = viewer; this.dbc = dbc; this.resourceManager = new LocalResourceManager ( resourceManager ); this.xLocator = xLocator; this.yLocator = yLocator; addBinding ( dbc.bindValue ( PojoObservables.observeValue ( this, "x" ), EMFObservables.observeValue ( element, ChartPackage.Literals.DATA_SERIES__X ) ) ); //$NON-NLS-1$ addBinding ( dbc.bindValue ( PojoObservables.observeValue ( this, "y" ), EMFObservables.observeValue ( element, ChartPackage.Literals.DATA_SERIES__Y ) ) ); //$NON-NLS-1$ }
public SimpleRuleStyleGenerator () { this.resourceManager = new LocalResourceManager ( JFaceResources.getResources () ); this.colorBgDisconnected = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.disconnected.bg", this.resourceManager, COLOR_DISCONNECTED_BG ); //$NON-NLS-1$ this.colorBgError = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.error.bg", this.resourceManager, COLOR_ERROR_BG ); //$NON-NLS-1$ this.colorBgAlarm = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.alarm.bg", this.resourceManager, COLOR_ALARM_BG ); //$NON-NLS-1$ this.colorBgWarning = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.warning.bg", this.resourceManager, COLOR_WARNING_BG ); //$NON-NLS-1$ this.colorBgManual = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.manual.bg", this.resourceManager, COLOR_MANUAL_BG ); //$NON-NLS-1$ this.colorBgBlock = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.block.bg", this.resourceManager, COLOR_BLOCK_BG ); //$NON-NLS-1$ this.colorFgBlock = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.block.fg", this.resourceManager, COLOR_BLOCK_FG ); //$NON-NLS-1$ JFaceResources.getColorRegistry ().addListener ( this.listener ); }
public BlockControlImage ( final ControlImage controlImage, final int style, final RegistrationManager registrationManager ) { super ( controlImage.getClientSpace (), style ); this.controlImage = controlImage; this.registrationManager = registrationManager; setLayout ( new FillLayout () ); this.icon = new Label ( this, SWT.NONE ); this.icon.setImage ( getEmptyImage () ); this.icon.addMouseListener ( new MouseAdapter () { @Override public void mouseUp ( final MouseEvent e ) { toggleBlock (); } } ); this.registrationManager.addListener ( this ); final LocalResourceManager resources = new LocalResourceManager ( JFaceResources.getResources (), this.icon ); this.boldFont = resources.createFont ( JFaceResources.getDefaultFontDescriptor ().withStyle ( SWT.BOLD ) ); this.boldStyler = new Styler () { @Override public void applyStyles ( final TextStyle textStyle ) { textStyle.font = BlockControlImage.this.boldFont; } }; }
public URLImageLabel ( final Composite parent, final int style, final DataItemDescriptor descriptor, final URLImageComponent component ) { super ( parent, style, null, null ); this.component = component; final GridLayout layout = new GridLayout ( 2, false ); layout.marginHeight = layout.marginWidth = 3; layout.horizontalSpacing = layout.verticalSpacing = 3; setLayout ( layout ); this.resourceManager = new LocalResourceManager ( JFaceResources.getResources () ); this.controlImage = new ControlImage ( this, this.registrationManager ); this.label = new Label ( this, SWT.NONE ); final GridData gd = new GridData ( SWT.CENTER, SWT.CENTER, true, true ); if ( component.getHeight () != null && component.getWidth () != null ) { gd.minimumHeight = component.getHeight (); gd.minimumWidth = component.getWidth (); // this.label.setLayoutData ( new GridData ( component.getWidth (), component.getHeight () ) ); this.label.setSize ( component.getWidth (), component.getHeight () ); } this.label.setLayoutData ( gd ); if ( descriptor != null ) { this.controlImage.setDetailItem ( descriptor.asItem () ); this.registrationManager.registerItem ( "value", descriptor.getItemId (), descriptor.getConnectionInformation (), false, false ); } showUrl ( component.getFallbackImageUrl () ); if ( component.getReloadTimer () != null ) { triggerReload ( component.getReloadTimer () ); } }
public BrowserComponent ( final Composite parent, final int style, final DataItemDescriptor descriptor, final org.eclipse.scada.vi.details.model.BrowserComponent component ) { super ( parent, style, null, null ); this.component = component; final GridLayout layout = new GridLayout ( 2, false ); layout.marginHeight = layout.marginWidth = 3; layout.horizontalSpacing = layout.verticalSpacing = 3; setLayout ( layout ); this.resourceManager = new LocalResourceManager ( JFaceResources.getResources () ); this.controlImage = new ControlImage ( this, this.registrationManager ); this.browser = new Browser ( this, SWT.NONE ); final GridData gd = new GridData ( SWT.CENTER, SWT.CENTER, true, true ); if ( component.getHeight () != null && component.getWidth () != null ) { gd.minimumHeight = component.getHeight (); gd.minimumWidth = component.getWidth (); // this.label.setLayoutData ( new GridData ( component.getWidth (), component.getHeight () ) ); this.browser.setSize ( component.getWidth (), component.getHeight () ); } this.browser.setLayoutData ( gd ); if ( descriptor != null ) { this.controlImage.setDetailItem ( descriptor.asItem () ); this.registrationManager.registerItem ( "value", descriptor.getItemId (), descriptor.getConnectionInformation (), false, false ); } showUrl ( makeUrl () ); if ( component.getReloadTimer () != null && component.getReloadTimer () > 0 ) { triggerReload ( component.getReloadTimer () ); } }
public DataItemToolTip ( final Control control, final int style, final boolean manualActivation, final Item item ) { super ( control, style, manualActivation ); this.resourceManager = new LocalResourceManager ( JFaceResources.getResources () ); this.item = item; }
public DataItemToolTip ( final Control control, final Item item ) { super ( control ); this.resourceManager = new LocalResourceManager ( JFaceResources.getResources () ); this.item = item; }
@Override public void createPart ( final Composite parent ) { this.resourceManager = new LocalResourceManager ( JFaceResources.getResources () ); super.createPart ( parent ); }
public void start ( final BundleContext context ) throws Exception { resources = new LocalResourceManager ( JFaceResources.getResources () ); super.start ( context ); plugin = this; }
public DepcyGraphLabelProvider(Control owner) { LocalResourceManager lrm = new LocalResourceManager(JFaceResources.getResources(), owner); colorHighlight = owner.getDisplay().getSystemColor(SWT.COLOR_YELLOW); colorLBlue = lrm.createColor(RGB_LBLUE); colorLGreen = lrm.createColor(RGB_LGREEN); colorDBlue = lrm.createColor(RGB_DBLUE); }
public Preview(Composite composite) { SWTUtils.createLabel(composite, Policy.bind("SVNDecoratorPreferencesPage.preview")); //$NON-NLS-1$ fImageCache= new LocalResourceManager(JFaceResources.getResources()); fViewer = new TreeViewer(composite); GridData data = SWTUtils.createHVFillGridData(); data.heightHint = 225; fViewer.getControl().setLayoutData(data); fViewer.setContentProvider(this); fViewer.setLabelProvider(this); fViewer.setInput(ROOT); fViewer.expandAll(); }
@Override public void createPartControl(Composite parent) { tk = new FormToolkit(parent.getDisplay()); Composite formWrapper = tk.createComposite(parent); GridLayout gl = new GridLayout(); formWrapper.setLayout(gl); form = tk.createScrolledForm(formWrapper); form.setText("Style Editor"); form.setLayoutData(new GridData(GridData.FILL_BOTH)); gl = new GridLayout(); form.getBody().setLayout(gl); Section section = tk.createSection(form.getBody(), Section.TITLE_BAR); section.setText("Colors"); section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); StyleDefinition def = loadData(parent.getDisplay()); ManagedForm managedForm = new ManagedForm(tk, form); resourceManager = new LocalResourceManager(JFaceResources.getResources()); new ThemeColorBlock(def, parent.getDisplay(), resourceManager).createContent(managedForm); ManagedForm fontsMForm = new ManagedForm(tk, form); section = tk.createSection(form.getBody(), Section.TITLE_BAR); section.setText("Fonts"); section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new ThemeColorBlock(def, parent.getDisplay(), resourceManager).createContent(fontsMForm); }
@Override public void create() { super.create(); setTitle("Connect to " + nvl(conf.getName(), conf.getPrimaryConnectionString())); setMessage("Please provide your credentials"); ResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), getShell()); Image titleImage = resourceManager .createImage(RCPUtils.getImageDescriptor(LoginDialog.class, "icons/yamcs_banner.png")); setTitleImage(titleImage); }
public MarriedLabelProvider() { LocalResourceManager resourceMgr = new LocalResourceManager(JFaceResources.getResources()); Bundle bundle = FrameworkUtil.getBundle(getClass()); URL checked = FileLocator.find(bundle, new Path("icons/checked.gif"), null); URL unchecked = FileLocator.find(bundle, new Path("icons/unchecked.gif"), null); this.checkedImg = resourceMgr.createImage(ImageDescriptor.createFromURL(checked)); this.uncheckedImg = resourceMgr.createImage(ImageDescriptor.createFromURL(unchecked)); }
@Override protected Control createControl( Composite parent ) { resourceManager = new LocalResourceManager( JFaceResources.getResources( parent.getDisplay() ) ); Composite result = createControls( parent ); layoutControls( result ); attachContextMenu(); JUnitCore.addTestRunListener( testRunListener ); return result; }
public LaunchConfigLabelProvider( Display display, DuplicatesDetector duplicatesDetector, LabelMode labelMode ) { this.resourceManager = new LocalResourceManager( JFaceResources.getResources( display ) ); this.duplicatesDetector = duplicatesDetector; this.labelMode = labelMode; this.debugModelPresentation = DebugUITools.newDebugModelPresentation(); }
@Before public void setUp() { launchesListeners = new ArrayList<>(); launchManager = mockLaunchManager(); resourceManager = new LocalResourceManager( getResources( displayHelper.getDisplay() ) ); progressUI = mock( ProgressUI.class ); testRunListener = new JUnitTestRunListener( launchManager, resourceManager, progressUI ); }
public void fill(Menu parent, int index) { if (menuItem == null || menuItem.isDisposed()) { if (index >= 0) { menuItem = new MenuItem(parent, SWT.CASCADE, index); } else { menuItem = new MenuItem(parent, SWT.CASCADE); } String text = getMenuText(); if (text != null) { menuItem.setText(text); } if (image != null) { LocalResourceManager localManager = new LocalResourceManager( JFaceResources.getResources()); menuItem.setImage(localManager.createImage(image)); disposeOldImages(); imageManager = localManager; } if (!menuExist()) { menu = new Menu(parent); menu.setData(MANAGER_KEY, this); } menuItem.setMenu(menu); initializeMenu(); setDirty(true); } }
public CordovaPluginWizardResources(Display display) { this.resourceManager = new LocalResourceManager(JFaceResources.getResources(display)); this.h2FontDescriptor = createFontDescriptor(SWT.BOLD, 1.15f); this.h2ItalicFontDescriptor = createFontDescriptor(SWT.BOLD | SWT.ITALIC, 1.15f); this.subFontDescriptor = createFontDescriptor(SWT.NONE, 0.75f); this.italicFontDescriptor = createFontDescriptor(SWT.ITALIC, 1); }
@Override public void fill(Menu parent, int index) { if ((menuItem == null) || menuItem.isDisposed()) { if (index >= 0) { menuItem = new MenuItem(parent, SWT.CASCADE, index); } else { menuItem = new MenuItem(parent, SWT.CASCADE); } final String text = getMenuText(); if (text != null) { menuItem.setText(text); } if (image != null) { final LocalResourceManager localManager = new LocalResourceManager( JFaceResources.getResources()); menuItem.setImage(localManager.createImage(image)); disposeOldImages(); imageManager = localManager; } if (! menuExist()) { menu = new Menu(parent); menu.setData(MANAGER_KEY, this); } menuItem.setMenu(menu); initializeMenu(); setDirty(true); } }
/******************************************************* * This constructor should only be called from the createPartControl() * method of the ViewPart class. It creates a simplified image registry that * deals with all the internal setup and loading and storing images. * * @param owner * The parent view part * @param parent * The parent control *******************************************************/ public SimpleImageRegistry(ViewPart owner, Composite parent) { mOwner = owner; // Get the default JFace resource manager ResourceManager rm = JFaceResources.getResources(); // Create a local resource manager LocalResourceManager lrm = new LocalResourceManager(rm, parent); // Create the internal image registry mImageRegistery = new ImageRegistry(lrm); }
private void updateToolBar( ) { if ( toolbar != null ) { ResourceManager parentResourceManager = JFaceResources.getResources( ); LocalResourceManager localManager = new LocalResourceManager( parentResourceManager ); for ( int i = 0; i < toolbar.getItemCount( ); i++ ) { ToolItem item = toolbar.getItem( i ); IAction action = (IAction) actionMap.get( item ); if ( action != null ) { ImageDescriptor image = null; if ( action.getImageDescriptor( ) != null ) image = action.getImageDescriptor( ); if ( image != null ) item.setImage( localManager.createImageWithDefault( image ) ); item.setToolTipText( action.getToolTipText( ) ); if ( IAction.AS_CHECK_BOX == action.getStyle( ) ) { item.setSelection( action.isChecked( ) ); } item.setEnabled( action.isEnabled( ) ); } } disposeOldImages( ); imageManager = localManager; if ( toolbar.isFocusControl( ) ) toolbar.setFocus( ); } }
@Override public void fill(Menu parent, int index) { if (menuItem == null || menuItem.isDisposed()) { if (index >= 0) { menuItem = new MenuItem(parent, SWT.CASCADE, index); } else { menuItem = new MenuItem(parent, SWT.CASCADE); } String text = getMenuText(); if (text != null) { menuItem.setText(text); } if (image != null) { LocalResourceManager localManager = new LocalResourceManager(JFaceResources.getResources()); menuItem.setImage(localManager.createImage(image)); disposeOldImages(); imageManager = localManager; } if (!menuExist()) { menu = new Menu(parent); } menuItem.setMenu(menu); initializeMenu(); setDirty(true); } }
public AbstractNotificationPopup(Display display, int style) { super(new Shell(display)); setShellStyle(style); this.display = display; resources = new LocalResourceManager(JFaceResources.getResources()); initResources(); closeJob.setSystem(true); }
public ChartAreaRenderer ( final Composite control ) { super ( new LocalResourceManager ( JFaceResources.getResources ( control.getDisplay () ), control ) ); this.realm = new DisplayRealm ( control.getDisplay () ); this.control = control; }
@Override public void createPartControl ( final Composite parent ) { this.manager = new LocalResourceManager ( JFaceResources.getResources () ); parent.setLayout ( new FillLayout () ); // selection this.selectionProvider = new AbstractSelectionProvider (); getSite ().setSelectionProvider ( this.selectionProvider ); final List<ExtensionDescriptor> extensions = Activator.getExtensionDescriptors (); final Composite wrapper = new Composite ( parent, SWT.NONE ); final GridLayout gridLayout = new GridLayout ( 3, false ); gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0; gridLayout.marginHeight = gridLayout.marginWidth = 0; wrapper.setLayout ( gridLayout ); final Composite topComposite = new Composite ( wrapper, SWT.NONE ); topComposite.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, false, 3, 1 ) ); topComposite.setLayout ( createExtensionGridLayout () ); final Composite leftComposite = new Composite ( wrapper, SWT.NONE ); leftComposite.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, false, true ) ); leftComposite.setLayout ( createExtensionGridLayout () ); // create main this.viewHolder = new Composite ( wrapper, SWT.NONE ); this.viewHolder.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) ); this.viewHolder.setLayout ( this.stackLayout = new StackLayout () ); final Composite rightComposite = new Composite ( wrapper, SWT.NONE ); rightComposite.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, false, true ) ); rightComposite.setLayout ( createExtensionGridLayout () ); final Composite bottomComposite = new Composite ( wrapper, SWT.NONE ); bottomComposite.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, false, 3, 1 ) ); bottomComposite.setLayout ( createExtensionGridLayout () ); try { createExtensions ( extensions, topComposite, "TOP", true ); createExtensions ( extensions, bottomComposite, "BOTTOM", true ); createExtensions ( extensions, leftComposite, "LEFT", false ); createExtensions ( extensions, rightComposite, "RIGHT", false ); } catch ( final CoreException e ) { StatusManager.getManager ().handle ( e, Activator.PLUGIN_ID ); } for ( final ViewInstanceDescriptor descriptor : this.descriptors ) { createAndAddView ( descriptor ); } activateNextMain (); }
public LineInput ( final ResourceManager resourceManager ) { this.resourceManager = new LocalResourceManager ( resourceManager ); }
public SystemMessageLabel ( final Composite parent, final String connectionId, final String itemId ) { super ( parent, connectionId, itemId ); this.resourceManager = new LocalResourceManager ( JFaceResources.getResources ( parent.getDisplay () ), this.label ); }
private void doCreateRenderer () { this.resourceManager = new LocalResourceManager ( this.parentResourceManager ); this.renderer = new FigureRenderer ( this, this.resourceManager ); this.viewer = new ChartViewer ( this.display, this.renderer, this.configuration != null ? this.configuration : makeDefaultConfiguration (), new NullExtensionSpace (), null ); }
public BoolLEDComposite ( final Composite parent, final int style, final DataItemDescriptor descriptor, final String format, final boolean expectedValue, final boolean isAlarm, final boolean isOnOff, final String attribute ) { super ( parent, style, null, null ); this.resourceManager = new LocalResourceManager ( JFaceResources.getResources () ); this.imageGreen = this.resourceManager.createImageWithDefault ( ImageDescriptor.createFromFile ( BoolLEDComposite.class, "icons/ledGreen.png" ) ); //$NON-NLS-1$ this.imageGray = this.resourceManager.createImageWithDefault ( ImageDescriptor.createFromFile ( BoolLEDComposite.class, "icons/ledGray.png" ) ); //$NON-NLS-1$ this.imageRed = this.resourceManager.createImageWithDefault ( ImageDescriptor.createFromFile ( BoolLEDComposite.class, "icons/ledRed.png" ) ); //$NON-NLS-1$ this.imageOn = this.resourceManager.createImageWithDefault ( ImageDescriptor.createFromFile ( BoolLEDComposite.class, "icons/on.png" ) ); //$NON-NLS-1$ this.imageOff = this.resourceManager.createImageWithDefault ( ImageDescriptor.createFromFile ( BoolLEDComposite.class, "icons/off.png" ) ); //$NON-NLS-1$ final RowLayout layout = new RowLayout (); layout.wrap = false; layout.center = true; layout.spacing = 3; setLayout ( layout ); this.expectedValue = expectedValue; this.isAlarm = isAlarm; this.isOnOff = isOnOff; this.attribute = attribute; this.controlImage = new ControlImage ( this, this.registrationManager ); this.controlImage.setDetailItem ( descriptor.asItem () ); this.signalLabel = new Label ( this, SWT.NONE ); this.signalLabel.setImage ( this.imageGray ); new DescriptorLabel ( this, SWT.NONE, format, descriptor ); if ( descriptor != null ) { this.registrationManager.registerItem ( "value", descriptor.getItemId (), descriptor.getConnectionInformation (), false, false ); //$NON-NLS-1$ } if ( Boolean.getBoolean ( "org.eclipse.scada.developer" ) ) //$NON-NLS-1$ { if ( this.isAlarm == true ) { this.signalLabel.setToolTipText ( "Red" ); } else { this.signalLabel.setToolTipText ( "Green" ); } } }
public EntryLabelProvider () { this.resourceManager = new LocalResourceManager ( JFaceResources.getResources () ); }
public NameLabelProvider ( final Display display, final IObservableSet elements ) { super ( EMFProperties.value ( InfrastructurePackage.Literals.NAMED_APPLICATION__NAME ).observeDetail ( PojoProperties.value ( "master" ).observeDetail ( elements ) ) ); this.resourceManager = new LocalResourceManager ( JFaceResources.getResources ( display ) ); this.adapterFactory = new ComposedAdapterFactory ( ComposedAdapterFactory.Descriptor.Registry.INSTANCE ); }
public DbStorePicker(Composite parent, final IPreferenceStore prefStore, boolean useFileSources, boolean useDirSources, boolean onlyCombo) { super(parent, SWT.NONE); this.useFileSources = useFileSources; this.useDirSources = useDirSources; this.lrm = new LocalResourceManager(JFaceResources.getResources(), this); this.prefStore = prefStore; GridLayout gl = new GridLayout(onlyCombo ? 1 : 3, false); gl.marginWidth = gl.marginHeight = 0; setLayout(gl); if (!onlyCombo) { new Label(this, SWT.NONE).setText(useFileSources || useDirSources ? Messages.DbStorePicker_db_schema_source : Messages.DbStorePicker_db_connection); } cmbDbNames = new ComboViewer(this, SWT.READ_ONLY | SWT.DROP_DOWN); cmbDbNames.setContentProvider(ArrayContentProvider.getInstance()); cmbDbNames.setLabelProvider(new DbStoreLabelProvider()); cmbDbNames.addSelectionChangedListener(new DbStoreSelectionListener()); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = new PixelConverter(cmbDbNames.getControl()).convertWidthInCharsToPixels(26); cmbDbNames.getControl().setLayoutData(gd); if (!onlyCombo) { Button btnEditStore = new Button(this, SWT.PUSH); btnEditStore.setImage(lrm.createImage(ImageDescriptor.createFromURL( Activator.getContext().getBundle().getResource(FILE.ICONEDIT)))); btnEditStore.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn( getShell(), PREF_PAGE.DB_STORE, null, null); if (prefDialog.open() == PreferenceDialog.OK) { loadStore(); } } }); } final IPropertyChangeListener dbStoreChangeListener = (PropertyChangeEvent event) -> { if (PREF.DB_STORE.equals(event.getProperty()) && !Objects.equals(event.getNewValue(), event.getOldValue())) { UiSync.exec(DbStorePicker.this, () -> { if (!isDisposed()) { loadStore(); } }); } }; prefStore.addPropertyChangeListener(dbStoreChangeListener); cmbDbNames.getControl().addDisposeListener(e -> prefStore .removePropertyChangeListener(dbStoreChangeListener)); if (useDirSources) { // load projects in ctor for now, Workspace listener and dynamic list may be added later IProject[] projs = ResourcesPlugin.getWorkspace().getRoot().getProjects(); for (int i = 0; i < MAX_FILES_HISTORY && i < projs.length; ++i) { try { if (projs[i].isOpen() && projs[i].hasNature(NATURE.ID)) { this.projects.add(projs[i].getLocation().toFile()); } } catch (CoreException ex) { Log.log(ex); } } } loadStore(); }