List of usage examples for org.eclipse.jface.resource JFaceResources getResources
public static ResourceManager getResources(final Display toQuery)
From source file:org.eclipse.scada.ui.chart.viewer.ChartViewer.java
License:Open Source License
public ChartViewer(final Display display, final ChartRenderer chartRenderer, final Chart chart, final ExtensionSpaceProvider extensionSpaceProvider, final ResetHandler resetHandler) { this.chart = chart; this.display = display; this.resourceManager = new LocalResourceManager(JFaceResources.getResources(this.display)); this.ctx = new DataBindingContext(SWTObservables.getRealm(this.display)); final AggregateValidationStatus status = new AggregateValidationStatus(this.ctx, AggregateValidationStatus.MERGED); status.addValueChangeListener(new IValueChangeListener() { @Override/*from www . j a v a2 s. c o m*/ public void handleValueChange(final ValueChangeEvent event) { if (event.diff.getNewValue() == null) { return; } final Status value = (Status) event.diff.getNewValue(); if (value.isOK() || value.getException() == null) { return; } logger.warn("Changed", value.getException()); } }); // create content this.manager = chartRenderer; this.manager.setStale(true); this.realm = new DisplayRealm(this.display); this.manager.createDropTarget(new Transfer[] { LocalSelectionTransfer.getTransfer() }, createDropTarget()); this.titleRenderer = new TitleRenderer(this.manager); this.manager.addRenderer(this.titleRenderer, -100); this.leftManager = new YAxisManager(this.ctx, this.manager, true); this.ctx.bindList(this.leftManager.getList(), EMFObservables.observeList(chart, ChartPackage.Literals.CHART__LEFT)); this.rightManager = new YAxisManager(this.ctx, this.manager, false); this.ctx.bindList(this.rightManager.getList(), EMFObservables.observeList(chart, ChartPackage.Literals.CHART__RIGHT)); this.topManager = new XAxisManager(this.ctx, this.manager, true); this.ctx.bindList(this.topManager.getList(), EMFObservables.observeList(chart, ChartPackage.Literals.CHART__TOP)); this.bottomManager = new XAxisManager(this.ctx, this.manager, false); this.ctx.bindList(this.bottomManager.getList(), EMFObservables.observeList(chart, ChartPackage.Literals.CHART__BOTTOM)); this.xLocator = new SimpleAxisLocator<XAxis, XAxisViewer>(this.topManager, this.bottomManager); this.yLocator = new SimpleAxisLocator<YAxis, YAxisViewer>(this.leftManager, this.rightManager); this.inputManager = new InputManager(this.ctx, this, this.resourceManager, this.xLocator, this.yLocator); this.ctx.bindList(this.inputManager.getList(), EMFObservables.observeList(chart, ChartPackage.Literals.CHART__INPUTS)); this.ctx.bindValue(PojoObservables.observeValue(this.titleRenderer, "title"), //$NON-NLS-1$ EMFObservables.observeValue(this.chart, ChartPackage.Literals.CHART__TITLE)); this.ctx.bindValue(PojoObservables.observeValue(this, "showCurrentTimeRuler"), //$NON-NLS-1$ EMFObservables.observeValue(this.chart, ChartPackage.Literals.CHART__SHOW_CURRENT_TIME_RULER)); this.ctx.bindValue(PojoObservables.observeValue(this, "mutable"), //$NON-NLS-1$ EMFObservables.observeValue(this.chart, ChartPackage.Literals.CHART__MUTABLE)); this.ctx.bindValue(PojoObservables.observeValue(this, "hoverable"), //$NON-NLS-1$ EMFObservables.observeValue(this.chart, ChartPackage.Literals.CHART__HOVERABLE)); this.ctx.bindValue(PojoObservables.observeValue(this, "chartBackground"), //$NON-NLS-1$ EMFObservables.observeValue(this.chart, ChartPackage.Literals.CHART__BACKGROUND_COLOR)); this.ctx.bindValue(PojoObservables.observeValue(this, "timeRulerAxis"), //$NON-NLS-1$ EMFObservables.observeValue(this.chart, ChartPackage.Literals.CHART__TIME_RULER_AXIS)); this.ctx.bindList(this.selectedXAxis, EMFObservables.observeList(chart, ChartPackage.Literals.CHART__SELECTED_XAXIS), null, new UpdateListStrategy().setConverter( new AxisConverter<>(XAxis.class, org.eclipse.scada.chart.XAxis.class, this.xLocator))); this.chartContext = new ChartContextImpl(this.xLocator, this.yLocator, extensionSpaceProvider, chartRenderer, chart, resetHandler, this.unmodItems); this.controllerManager = new ControllerManager(this.ctx, this.ctx.getValidationRealm(), this.chartContext); this.ctx.bindList(this.controllerManager.getList(), EMFObservables.observeList(chart, ChartPackage.Literals.CHART__CONTROLLERS)); this.profileManager = new ProfileManager(this.ctx, this.ctx.getValidationRealm(), extensionSpaceProvider, this.chartContext); this.ctx.bindList(this.profileManager.getList(), EMFObservables.observeList(chart, ChartPackage.Literals.CHART__PROFILES)); this.ctx.bindValue(PojoObservables.observeValue(this.profileManager, "type"), //$NON-NLS-1$ EMFObservables.observeValue(chart, ChartPackage.Literals.CHART__PROFILE_SWITCHER_TYPE)); this.ctx.bindValue(PojoObservables.observeValue(this.profileManager, "activeProfile"), //$NON-NLS-1$ EMFObservables.observeValue(chart, ChartPackage.Literals.CHART__ACTIVE_PROFILE)); this.manager.setStale(false); startTimer(); this.manager.addDisposeListener(new DisposeListener() { @Override public void onDispose() { handleDispose(); } }); setSelection(new StructuredSelection(this)); updateState(); }
From source file:org.eclipse.scada.vi.ui.user.navigation.ToolBarNavigator.java
License:Open Source License
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/*from w w w . j av a2 s .co m*/ public void widgetDisposed(final DisposeEvent e) { handleDispose(); } }); viewManager.addViewManagerListener(this); }
From source file:org.eclipse.servicesregistry.search.ui.internal.classifications.ClassificationsTreeLabelProvider.java
License:Open Source License
private ResourceManager createResourceManager() { return new LocalResourceManager(JFaceResources.getResources(PlatformUI.getWorkbench().getDisplay())); }
From source file:org.eclipse.thym.ui.plugins.internal.CordovaPluginWizardResources.java
License:Open Source License
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); }
From source file:org.eclipse.ui.dialogs.EditorSelectionDialog.java
License:Open Source License
/** * Create an instance of this class./* w w w .j a v a 2 s . co m*/ * * @param parentShell * the parent shell */ public EditorSelectionDialog(Shell parentShell) { super(parentShell); resourceManager = new LocalResourceManager(JFaceResources.getResources(parentShell.getDisplay())); }
From source file:org.eclipse.ui.internal.decorators.DecoratorManager.java
License:Open Source License
/** * Returns the resource manager used to created images for the light weight * decorator.//from w w w . j a va2s .co m * * @return the resource manager */ public ResourceManager getResourceManager() { if (resourceManager == null) { resourceManager = new LocalResourceManager( JFaceResources.getResources(PlatformUI.getWorkbench().getDisplay())); } return resourceManager; }
From source file:org.eclipse.ui.internal.decorators.OverlayCache.java
License:Open Source License
/** * /*w w w . jav a 2 s.c om*/ */ public OverlayCache() { super(); //As we are not in the UI Thread lookup the Display resourceManager = new LocalResourceManager( JFaceResources.getResources(PlatformUI.getWorkbench().getDisplay())); }
From source file:org.eclipse.viatra.query.tooling.localsearch.ui.debugger.provider.OperationListLabelProvider.java
License:Open Source License
@Override public void update(final ViewerCell cell) { localResourceManager = new LocalResourceManager(JFaceResources.getResources(Display.getCurrent())); final SearchOperationViewerNode node = (SearchOperationViewerNode) cell.getElement(); StyledString text = new StyledString(); text.append(node.getLabelText());/* w w w.j a v a 2s . c o m*/ switch (node.getOperationStatus()) { case EXECUTED: cell.setImage(imageRegistry.get(LocalSearchToolingActivator.ICON_APPLIED_OPERATION)); text.setStyle(0, text.length(), new Styler() { public void applyStyles(TextStyle textStyle) { textStyle.font = localResourceManager .createFont(FontDescriptor.createFrom("Arial", 10, SWT.BOLD)); doColoring(node, textStyle); } }); break; case CURRENT: cell.setImage(imageRegistry.get(LocalSearchToolingActivator.ICON_CURRENT_OPERATION)); text.setStyle(0, text.length(), new Styler() { public void applyStyles(TextStyle textStyle) { LocalResourceManager localResMan = new LocalResourceManager( JFaceResources.getResources(Display.getCurrent())); textStyle.font = localResMan .createFont(FontDescriptor.createFrom("Arial", 10, SWT.BOLD | SWT.ITALIC)); doColoring(node, textStyle); textStyle.background = localResourceManager.createColor(new RGB(200, 235, 255)); } }); break; case QUEUED: cell.setImage(imageRegistry.get(LocalSearchToolingActivator.ICON_NOT_APPLIED_OPERATION)); text.setStyle(0, text.length(), new Styler() { public void applyStyles(TextStyle textStyle) { LocalResourceManager localResMan = new LocalResourceManager( JFaceResources.getResources(Display.getCurrent())); textStyle.font = localResMan.createFont(FontDescriptor.createFrom("Arial", 10, SWT.NORMAL)); doColoring(node, textStyle); } }); break; default: throw new UnsupportedOperationException("Unknown operation status: " + node.getOperationStatus()); } cell.setText(text.toString()); cell.setStyleRanges(text.getStyleRanges()); super.update(cell); }
From source file:org.kalypso.ui.editor.gmleditor.part.GMLLabelProvider.java
License:Open Source License
public GMLLabelProvider() { final IWorkbench workbench = PlatformUI.getWorkbench(); m_decoratorManager = workbench.getDecoratorManager(); synchronized (workbench) { if (m_resourceManager == null) m_resourceManager = new LocalResourceManager(JFaceResources.getResources(workbench.getDisplay())); }//from w ww .j av a 2s . c om // TODO: check if this is ok? We change the global decoration context here... ((DecorationContext) DecorationContext.DEFAULT_CONTEXT).putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE); m_decoratorManager.addListener(m_decoratorListener); }
From source file:org.marketcetera.photon.commons.ui.ColorManager.java
/** * Initializes the colors for the current {@link Display}. Calling multiple * times on the same thread is a no-op unless the current display has * changed, in which case an IllegalStateException will be thrown. The * exception can be avoided by first calling {@link #disposeColors()}; * <p>/*from w w w . j a v a 2 s. c o m*/ * If this method completes successfully, {@link #getColor(ColorDescriptor)} will return a * valid color for each ColorDescriptor that was used to instantiate this * manager. * * @throws IllegalStateException * if called from a non-UI thread, i.e. one for which * Display.getCurrent() is null * @throws IllegalStateException * on subsequent invocations from the same thread if * Display.getCurrent() has changed since the previous call */ public void initColors() { SWTUtils.checkThread(); Display display = Display.getCurrent(); synchronized (this) { if (mResources != null) { if (!mResources.isInitializedFor(display)) { throw new IllegalStateException(Messages.COLOR_MANAGER_ALREADY_INITIALIZED.getText()); } else { return; } } mResources = new Resources(JFaceResources.getResources(display)); } }