Search in sources :

Example 41 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.

the class TalendEditorPaletteFactory method createEntryFrom.

public static TalendCombinedTemplateCreationEntry createEntryFrom(IComponent component) {
    if (component == null) {
        return null;
    }
    String name = component.getName();
    ImageDescriptor imageSmall = component.getIcon16();
    IPreferenceStore store = DesignerPlugin.getDefault().getPreferenceStore();
    ImageDescriptor imageLarge;
    final String string = store.getString(TalendDesignerPrefConstants.LARGE_ICONS_SIZE);
    if (string.equals("24")) {
        //$NON-NLS-1$
        imageLarge = component.getIcon24();
    } else {
        imageLarge = component.getIcon32();
    }
    TalendCombinedTemplateCreationEntry newEntry = new TalendCombinedTemplateCreationEntry(name, name, Node.class, component, imageSmall, imageLarge);
    newEntry.setDescription(component.getLongName());
    return newEntry;
}
Also used : ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) TalendCombinedTemplateCreationEntry(org.talend.designer.core.ui.editor.palette.TalendCombinedTemplateCreationEntry)

Example 42 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.

the class DownloadCheckUpdatesDialog method createDialogArea.

/**
     * Create contents of the dialog.
     * 
     * @param parent
     */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(container, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    GridData gd_composite = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_composite.heightHint = 188;
    gd_composite.widthHint = 423;
    composite.setLayoutData(gd_composite);
    Label lblNewLabel = new Label(composite, SWT.NONE);
    GridData gd_lblNewLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_lblNewLabel.heightHint = 92;
    gd_lblNewLabel.widthHint = 406;
    lblNewLabel.setLayoutData(gd_lblNewLabel);
    lblNewLabel.setText("\nThere are newer versions of some items you have downloaded\nfrom the Talend Exchange.");
    Label lblNewLabel_1 = new Label(composite, SWT.NONE);
    lblNewLabel_1.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    lblNewLabel_1.setText("Total available updates : ");
    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);
    Button btnCheckButton = new Button(composite, SWT.CHECK);
    btnCheckButton.setText("Don't ask again ");
    new Label(composite, SWT.NONE);
    btnCheckButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            IPreferenceStore prefStore = PlatformUI.getPreferenceStore();
            prefStore.setValue(ITalendCorePrefConstants.EXCHANGE_DOWNLOADED_CHECK_UPDATES, true);
            cancelPressed();
        }
    });
    return container;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 43 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.

the class BusinessRulersAndGridComposite method initializeControls.

/**
     * 
     * Sets up controls with proper layouts and groups
     * 
     * @param parent
     */
private void initializeControls(Composite parent) {
    parent.setLayout(new GridLayout(1, false));
    // Top row composite
    Composite topComposite = widgetFactory.createComposite(parent);
    topComposite.setLayout(new GridLayout(2, false));
    // Create the groups for this section
    createDisplayGroup(topComposite);
    createMeasurementGroup(topComposite);
    // Bottom row composite
    Composite bottomComposite = widgetFactory.createComposite(parent);
    bottomComposite.setLayout(new GridLayout(2, false));
    // Create grid line settings
    createGridlineGroup(bottomComposite);
    Composite extraComposite = widgetFactory.createComposite(bottomComposite);
    extraComposite.setLayout(new GridLayout(1, false));
    // Create snap to grid checkbox
    snapToGridButton = widgetFactory.createButton(extraComposite, SNAP_TO_GRID_LABEL, SWT.CHECK);
    snapToGridButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            // Set the snap to grid workspace property
            setWorkspaceProperty(WorkspaceViewerProperties.SNAPTOGRID, snapToGridButton.getSelection());
        }
    });
    // Create snap to geometry checkbox
    snapToGeometryButton = widgetFactory.createButton(extraComposite, SNAP_TO_GEOMETRY_LABEL, SWT.CHECK);
    snapToGeometryButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            // Set the snap to geometry workspace property
            setWorkspaceProperty(WorkspaceViewerProperties.SNAPTOGEOMETRY, snapToGeometryButton.getSelection());
        }
    });
    // Create restore to preferences defaults
    restoreButton = widgetFactory.createButton(extraComposite, RESTORE_LABEL, SWT.PUSH);
    restoreButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            restorePreferenceValues();
        }

        private void restorePreferenceValues() {
            IPreferenceStore preferenceStore = getPreferenceStore();
            // The workspace properties will always exist because it is set
            //
            IPreferenceStore wsPrefStore = getWorkspaceViewerProperties();
            if (wsPrefStore.getBoolean(WorkspaceViewerProperties.GRIDORDER) == false) {
                wsPrefStore.setValue(WorkspaceViewerProperties.GRIDORDER, true);
            }
            if (wsPrefStore.getInt(WorkspaceViewerProperties.GRIDLINECOLOR) != LIGHT_GRAY_RGB) {
                wsPrefStore.setValue(WorkspaceViewerProperties.GRIDLINECOLOR, LIGHT_GRAY_RGB);
            }
            if (wsPrefStore.getInt(WorkspaceViewerProperties.GRIDLINESTYLE) != SWT.LINE_CUSTOM) {
                wsPrefStore.setValue(WorkspaceViewerProperties.GRIDLINESTYLE, SWT.LINE_CUSTOM);
            }
            if (wsPrefStore.getBoolean(WorkspaceViewerProperties.VIEWRULERS) != preferenceStore.getBoolean(IPreferenceConstants.PREF_SHOW_RULERS)) {
                wsPrefStore.setValue(WorkspaceViewerProperties.VIEWRULERS, preferenceStore.getBoolean(IPreferenceConstants.PREF_SHOW_RULERS));
            }
            if (wsPrefStore.getBoolean(WorkspaceViewerProperties.VIEWGRID) != preferenceStore.getBoolean(IPreferenceConstants.PREF_SHOW_GRID)) {
                wsPrefStore.setValue(WorkspaceViewerProperties.VIEWGRID, preferenceStore.getBoolean(IPreferenceConstants.PREF_SHOW_GRID));
            }
            if (wsPrefStore.getBoolean(WorkspaceViewerProperties.SNAPTOGRID) != preferenceStore.getBoolean(IPreferenceConstants.PREF_SNAP_TO_GRID)) {
                wsPrefStore.setValue(WorkspaceViewerProperties.SNAPTOGRID, preferenceStore.getBoolean(IPreferenceConstants.PREF_SNAP_TO_GRID));
            }
            if (wsPrefStore.getBoolean(WorkspaceViewerProperties.SNAPTOGEOMETRY) != preferenceStore.getBoolean(IPreferenceConstants.PREF_SNAP_TO_GEOMETRY)) {
                wsPrefStore.setValue(WorkspaceViewerProperties.SNAPTOGEOMETRY, preferenceStore.getBoolean(IPreferenceConstants.PREF_SNAP_TO_GEOMETRY));
            }
            if ((wsPrefStore.getInt(WorkspaceViewerProperties.RULERUNIT) != preferenceStore.getInt(IPreferenceConstants.PREF_RULER_UNITS)) || (wsPrefStore.getDouble(WorkspaceViewerProperties.GRIDSPACING) != preferenceStore.getDouble(IPreferenceConstants.PREF_GRID_SPACING))) {
                wsPrefStore.setValue(WorkspaceViewerProperties.RULERUNIT, preferenceStore.getInt(IPreferenceConstants.PREF_RULER_UNITS));
                wsPrefStore.setValue(WorkspaceViewerProperties.GRIDSPACING, preferenceStore.getDouble(IPreferenceConstants.PREF_GRID_SPACING));
            }
            // reset the input values
            setInput();
        }
    });
    setInput();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) AbstractTabComposite(org.talend.designer.core.ui.views.jobsettings.tabs.AbstractTabComposite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 44 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.

the class ComponentPreferenceInitializer method initializeDefaultPreferences.

public void initializeDefaultPreferences() {
    IPreferenceStore preferenceStore = CodeGeneratorActivator.getDefault().getPreferenceStore();
    //$NON-NLS-1$
    preferenceStore.putValue(IComponentPreferenceConstant.LIMIT, "1000");
    //$NON-NLS-1$
    preferenceStore.setDefault(IComponentPreferenceConstant.LIMIT, "1000");
    preferenceStore.putValue(IComponentPreferenceConstant.LINK_STYLE, LINK_STYLE.AUTO.toString());
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 45 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project tdi-studio-se by Talend.

the class MapPreferenceInitializer method initializeDefaultPreferences.

@Override
public void initializeDefaultPreferences() {
    IPreferenceStore prefs = getPluginPreferenceStore();
    prefs.putValue(MapPrefsConstants.LINK_STYLE, LINK_STYLE.AUTO.toString());
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Aggregations

IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)673 ArrayList (java.util.ArrayList)52 Test (org.junit.Test)36 File (java.io.File)32 RGB (org.eclipse.swt.graphics.RGB)26 GridData (org.eclipse.swt.layout.GridData)26 IOException (java.io.IOException)23 CoreException (org.eclipse.core.runtime.CoreException)23 GridLayout (org.eclipse.swt.layout.GridLayout)23 Composite (org.eclipse.swt.widgets.Composite)23 List (java.util.List)21 SelectionEvent (org.eclipse.swt.events.SelectionEvent)21 Before (org.junit.Before)21 FontData (org.eclipse.swt.graphics.FontData)20 Hashtable (java.util.Hashtable)19 Button (org.eclipse.swt.widgets.Button)18 StyledText (org.eclipse.swt.custom.StyledText)17 Font (org.eclipse.swt.graphics.Font)17 ChainedPreferenceStore (org.eclipse.ui.texteditor.ChainedPreferenceStore)17 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)16