org.eclipse.jface.resource.LocalResourceManager Java Examples

The following examples show how to use org.eclipse.jface.resource.LocalResourceManager. 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: TimelineComposite.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public TimelineComposite(Composite parent, int style) {
	super(parent, style);

	fResourceManager = new LocalResourceManager(JFaceResources.getResources(), this);

	final FillLayout layout = new FillLayout();
	layout.marginHeight = 10;
	layout.marginWidth = 10;
	setLayout(layout);

	setBackground(ColorConstants.black);

	final Canvas canvas = new Canvas(this, SWT.DOUBLE_BUFFERED);
	canvas.setBackground(ColorConstants.black);
	final LightweightSystem lightWeightSystem = new LightweightSystem(canvas);

	fRootFigure = new RootFigure(fResourceManager);
	fRootFigure.setFont(parent.getFont());
	lightWeightSystem.setContents(fRootFigure);

	// draw2d does not directly support mouseWheelEvents, so register on canvas
	canvas.addMouseWheelListener(new TimelineScaler(this));
}
 
Example #2
Source File: ImportBosArchiveControlSupplier.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Control createControl(Composite parent, IWizardContainer container, DataBindingContext ctx) {
    this.wizardContainer = container;
    final Composite mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayout(
            GridLayoutFactory.fillDefaults().margins(10, 10).spacing(LayoutConstants.getSpacing().x, 25).create());
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().create());
    final LocalResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(),
            mainComposite);
    this.errorColor = resourceManager.createColor(ColorConstants.ERROR_RGB);
    this.successColor = resourceManager.createColor(ColorConstants.SUCCESS_RGB);
    doFileLocationBrowser(mainComposite, ctx);
    doCreateAdditionalControl(mainComposite, ctx);
    doCreateFileTree(mainComposite, ctx);

    treeSection.setVisible(filePath != null);
    textWidget.addTextListener(SWT.Modify, e -> {
        treeSection.setVisible(textWidget.getText() != null && !textWidget.getText().isEmpty());
        treeSection.layout();
    });

    return mainComposite;
}
 
Example #3
Source File: SmartImportBdmPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Control createControl(Composite parent, IWizardContainer wizardContainer, DataBindingContext ctx) {
    resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(GridLayoutFactory.fillDefaults().create());
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    super.createControl(composite, wizardContainer, ctx);
    Composite importComposite = createImportComposite(composite);
    filePathObservable.addValueChangeListener(e -> parseInput());
    ctx.bindValue(WidgetProperties.visible().observe(importComposite), new ComputedValue<Boolean>() {

        @Override
        protected Boolean calculate() {
            return filePathObservable.getValue() != null;
        }
    });

    ctx.bindValue(new WritableValue(), importBdmModelObservable, // Purpose: disable on finish button when input isn't correct
            UpdateStrategyFactory.neverUpdateValueStrategy().create(),
            UpdateStrategyFactory.updateValueStrategy()
                    .withValidator(new SmartImportBdmModelValidator())
                    .create());

    return composite;
}
 
Example #4
Source File: AdditionalResourcesPropertySection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void createContent(Composite parent) {
    Composite mainComposite = getWidgetFactory().createComposite(parent);
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10).create());
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    LocalResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), mainComposite);
    descriptionStyler = new AdditionalResourceStyler(resourceManager.createColor(ColorConstants.SIMPLE_TYPE_RGB));

    createButtons(mainComposite);
    createViewer(mainComposite);

    DataBindingContext ctx = new DataBindingContext();
    ComputedValue<Boolean> selectionNotNullObservable = new ComputedValueBuilder<Boolean>()
            .withSupplier(() -> selectionObservable.getValue() != null)
            .build();
    ctx.bindValue(WidgetProperties.enabled().observe(editButton), selectionNotNullObservable);
    ctx.bindValue(WidgetProperties.enabled().observe(removeButton), selectionNotNullObservable);
}
 
Example #5
Source File: TableViewerFontSize.java    From codeexamples-eclipse with Eclipse Public License 1.0 6 votes vote down vote up
@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);
}
 
Example #6
Source File: ToolBarNavigator.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
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 );
}
 
Example #7
Source File: LaunchConfigLabelProvider.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
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();
}
 
Example #8
Source File: JFaceViewerIntegrationExample.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public MarriedLabelProvider() {
	LocalResourceManager resourceMgr = new LocalResourceManager(JFaceResources.getResources());
	URL checked = JFaceViewerIntegrationExample.class.getResource("images/checked.gif");
	URL unchecked = JFaceViewerIntegrationExample.class.getResource("images/unchecked.gif");
	this.checkedImg = resourceMgr.createImage(ImageDescriptor.createFromURL(checked));
	this.uncheckedImg = resourceMgr.createImage(ImageDescriptor.createFromURL(unchecked));
}
 
Example #9
Source File: IndexEditionControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public IndexEditionControl(Section parent, AbstractBdmFormPage formPage, DataBindingContext ctx,
        IObservableValue<Index> selectedIndexObservable, IObservableList<Field> actualsFieldsObservable) {
    super(parent, SWT.NONE);
    formPage.getToolkit().adapt(this);
    setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    setLayout(GridLayoutFactory.fillDefaults().margins(15, 10).create());

    this.formPage = formPage;
    this.selectedIndexObservable = selectedIndexObservable;
    this.actualsFieldsObservable = actualsFieldsObservable;
    this.indexableFieldFilter = new IndexableFieldFilter();
    this.fieldStyleStringProvider = new FieldStyleStringProvider();
    this.cursorHand = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
    this.cursorArrow = new Cursor(parent.getDisplay(), SWT.CURSOR_ARROW);
    this.errorColor = new LocalResourceManager(JFaceResources.getResources(),
            parent).createColor(ColorConstants.ERROR_RGB);

    indexedFieldNameObservable = EMFObservables.observeDetailList(Realm.getDefault(), selectedIndexObservable,
            BusinessDataModelPackage.Literals.INDEX__FIELD_NAMES);
    indexedFieldsObservable = new WritableList<>();

    bindIndexedFieldObservableLists(ctx, actualsFieldsObservable);

    createLabels();

    Composite viewersComposite = formPage.getToolkit().createComposite(this);
    viewersComposite.setLayout(GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 10, 0).numColumns(2).create());
    viewersComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    createAvailableAttributesTableViewer(viewersComposite);
    createIndexedAttributesTableViewer(viewersComposite);

    indexedFieldsObservable.addChangeListener(e -> availableAttributesTableViewer.refresh());
}
 
Example #10
Source File: ConstraintEditionControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public ConstraintEditionControl(Composite parent,
        AbstractBdmFormPage formPage,
        DataBindingContext ctx) {
    this.formPage = formPage;
    this.fieldStyleStringProvider = new FieldStyleStringProvider();
    this.actualsFieldsObservable = EMFObservables.observeDetailList(Realm.getDefault(),
            formPage.observeBusinessObjectSelected(),
            BusinessDataModelPackage.Literals.BUSINESS_OBJECT__FIELDS);
    this.constraintsObservable = EMFObservables.observeDetailList(Realm.getDefault(),
            formPage.observeBusinessObjectSelected(),
            BusinessDataModelPackage.Literals.BUSINESS_OBJECT__UNIQUE_CONSTRAINTS);
    this.errorColor = new LocalResourceManager(JFaceResources.getResources(),
            parent).createColor(ColorConstants.ERROR_RGB);

    this.mainComposite = formPage.getToolkit().createComposite(parent);
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    createConstraintDefinitionSection();
    createConstraintEditionComposite(ctx);
    enableButtons(ctx);

    ctx.bindSet(ViewerProperties.checkedElements(Field.class).observe((ICheckable) constraintEditionViewer),
            attributesSetObservable);
    selectedConstraintObservable.addValueChangeListener(e -> {
        attributesSetObservable.clear();
        if (e.diff.getNewValue() != null) {
            e.diff.getNewValue().getFieldNames().stream()
                    .map(this::findCorrespondingField)
                    .forEach(attributesSetObservable::add);
            constraintEditionViewer.refresh();
        }
    });
}
 
Example #11
Source File: WidgetMessageDecorator.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public WidgetMessageDecorator(Composite parent, Optional<String> defaultMessage) {
    createComposite(parent);
    this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
    errorColor = resourceManager.createColor(ColorConstants.ERROR_RGB);
    warningColor = resourceManager.createColor(ColorConstants.WARNING_RGB);
    this.defaultMessage = defaultMessage;
    messageLabel = new CLabel(composite, SWT.NONE);
    messageLabel.setTopMargin(1);
    messageLabel.setLeftMargin(0);
    messageLabel.setFont(getMessageFont());
    messageLabel.setText(defaultMessage.orElse(""));
    foregroundColor = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);
    updateExpandState();
}
 
Example #12
Source File: EditableControlWidget.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected EditableControlWidget(Composite parent, String id, boolean labelAbove, int horizontalLabelAlignment,
        int verticalLabelAlignment, int labelHint, boolean readOnly, String labelValue, String message,
        boolean useCompositeMessageDecorator, Optional<String> buttonLabel, Optional<FormToolkit> toolkit) {
    super(parent, id, labelAbove, horizontalLabelAlignment, verticalLabelAlignment, labelHint, readOnly, labelValue,
            message, buttonLabel, toolkit);
    this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
    this.useCompositeMessageDecorator = useCompositeMessageDecorator;
    errorColor = resourceManager.createColor(ColorConstants.ERROR_RGB);
    warningColor = resourceManager.createColor(ColorConstants.WARNING_RGB);
}
 
Example #13
Source File: KeyTreeViewer.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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 () ) );
}
 
Example #14
Source File: ScriptExpressionEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Control createExpressionEditor(final Composite parent, final EMFDataBindingContext ctx) {
    mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().create());

    new Label(mainComposite, SWT.NONE)
            .setLayoutData(GridDataFactory.fillDefaults().indent(0, -LayoutConstants.getSpacing().y + 1).create()); //filler

    inputNameComposite = new Composite(mainComposite, SWT.NONE);
    inputNameComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).create());
    inputNameComposite.setLayoutData(GridDataFactory.fillDefaults().create());

    final Label scriptNameLabel = new Label(inputNameComposite, SWT.NONE);
    scriptNameLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    scriptNameLabel.setText(Messages.name);

    expressionNameText = new Text(inputNameComposite, SWT.BORDER | SWT.SINGLE);
    expressionNameText.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).grab(false, false)
            .hint(400, SWT.DEFAULT).create());

    LocalResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
    Color errorColor = resourceManager.createColor(new RGB(214, 77, 77));

    errorLabel = new CLabel(inputNameComposite, SWT.NONE);
    errorLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).create());
    errorLabel.setForeground(errorColor);

    final IScriptLanguageProvider provider = ScriptLanguageService.getInstance().getScriptLanguageProvider(languageId);
    editor = provider.getExpressionEditor();
    editor.setIsPageFlowContext(isPageFlowContext);
    final Composite editorComposite = new Composite(mainComposite, SWT.NONE);
    editorComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    editorComposite.setLayout(GridLayoutFactory.fillDefaults().create());
    editor.createExpressionEditor(editorComposite, ctx);

    createReturnTypeComposite(editorComposite);

    return mainComposite;
}
 
Example #15
Source File: TabbedPropertyTitle.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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( );
	}
}
 
Example #16
Source File: CordovaPluginWizardResources.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
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);
}
 
Example #17
Source File: SVNDecoratorPreferencesPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
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();
}
 
Example #18
Source File: JUnitTestRunListenerTest.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
@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 );
}
 
Example #19
Source File: JUnitStatusContributionItem.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
@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;
}
 
Example #20
Source File: AbstractInputViewer.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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$
}
 
Example #21
Source File: ManualOverride.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createPart ( final Composite parent )
{
    this.resourceManager = new LocalResourceManager ( JFaceResources.getResources () );

    super.createPart ( parent );
}
 
Example #22
Source File: DataItemToolTip.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public DataItemToolTip ( final Control control, final Item item )
{
    super ( control );

    this.resourceManager = new LocalResourceManager ( JFaceResources.getResources () );

    this.item = item;
}
 
Example #23
Source File: DataItemToolTip.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example #24
Source File: BrowserComponent.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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 () );
    }
}
 
Example #25
Source File: SimpleRuleStyleGenerator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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 );
}
 
Example #26
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public void start ( final BundleContext context ) throws Exception
{
    resources = new LocalResourceManager ( JFaceResources.getResources () );
    super.start ( context );

    plugin = this;
}
 
Example #27
Source File: URLImageLabel.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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 () );
    }
}
 
Example #28
Source File: BlockControlImage.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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;
        }
    };
}
 
Example #29
Source File: SamplePart.java    From codeexamples-eclipse with Eclipse Public License 1.0 4 votes vote down vote up
@PostConstruct
public void createComposite(Composite parent) {
	addFonts(display);
	
	ResourceManager resManager = 
			  new LocalResourceManager(JFaceResources.getResources(), parent);
	FontDescriptor fontDescriptor = FontDescriptor.createFrom("Roboto-ThinItalic", 11, SWT.NORMAL);

	Font font = resManager.createFont(fontDescriptor);
	parent.setLayout(new GridLayout(1, false));
	
	txtInput = new Text(parent, SWT.BORDER);
	txtInput.setFont(font);
	txtInput.setMessage("Enter text to mark part as dirty");
	txtInput.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			dirty.setDirty(true);
		}
	});
	FontData fd = txtInput.getFont().getFontData()[0];
	txtInput.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	Text txtInput2 = new Text(parent, SWT.BORDER);
	txtInput2.setMessage("Enter text to mark part as dirty");
	txtInput2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	Button button = new Button(parent, SWT.PUSH);
	button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
	button.setFont(font);
	button.setText("Press me");
	
	
	
	Button button2 = new Button(parent, SWT.PUSH);
	button2.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
	button2.setText("Press me");

	tableViewer = new TableViewer(parent);

	tableViewer.setContentProvider(ArrayContentProvider.getInstance());;
	tableViewer.setInput(createInitialDataModel());
	tableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
}
 
Example #30
Source File: LineInput.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
public LineInput ( final ResourceManager resourceManager )
{
    this.resourceManager = new LocalResourceManager ( resourceManager );
}