Search in sources :

Example 76 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project webtools.sourceediting by eclipse.

the class XSLSyntaxColoringPage method createContents.

@Override
protected Control createContents(final Composite parent) {
    initializeDialogUnits(parent);
    defaultForeground = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
    defaultBackground = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
    Composite pageComponent = createComposite(parent, 2);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent, IHelpContextIds.XML_PREFWEBX_STYLES_HELPID);
    Link link = new Link(pageComponent, SWT.WRAP);
    link.setText(Messages.XSLSyntaxColoringPage);
    link.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            PreferencesUtil.createPreferenceDialogOn(parent.getShell(), e.text, null, null);
        }
    });
    GridData linkData = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1);
    // only expand further if anyone else requires
    linkData.widthHint = 150;
    // it
    link.setLayoutData(linkData);
    new Label(pageComponent, SWT.NONE).setLayoutData(new GridData());
    new Label(pageComponent, SWT.NONE).setLayoutData(new GridData());
    SashForm editor = new SashForm(pageComponent, SWT.VERTICAL);
    GridData gridData2 = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData2.horizontalSpan = 2;
    editor.setLayoutData(gridData2);
    SashForm top = new SashForm(editor, SWT.HORIZONTAL);
    Composite styleEditor = createComposite(top, 1);
    ((GridLayout) styleEditor.getLayout()).marginRight = 5;
    ((GridLayout) styleEditor.getLayout()).marginLeft = 0;
    createLabel(styleEditor, XMLUIMessages.SyntaxColoringPage_0);
    stylesViewer = createStylesViewer(styleEditor);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.horizontalIndent = 0;
    Iterator iterator = styleToDescriptionMap.values().iterator();
    while (iterator.hasNext()) {
        gridData.widthHint = Math.max(gridData.widthHint, convertWidthInCharsToPixels(iterator.next().toString().length()));
    }
    gridData.heightHint = convertHeightInCharsToPixels(5);
    stylesViewer.getControl().setLayoutData(gridData);
    Composite editingComposite = createComposite(top, 1);
    ((GridLayout) styleEditor.getLayout()).marginLeft = 5;
    // $NON-NLS-1$
    createLabel(editingComposite, "");
    Button enabler = createCheckbox(editingComposite, XMLUIMessages.SyntaxColoringPage_2);
    enabler.setEnabled(false);
    enabler.setSelection(true);
    Composite editControls = createComposite(editingComposite, 2);
    ((GridLayout) editControls.getLayout()).marginLeft = 20;
    foregroundLabel = createLabel(editControls, SSEUIMessages.Foreground_UI_);
    ((GridData) foregroundLabel.getLayoutData()).verticalAlignment = SWT.CENTER;
    foregroundLabel.setEnabled(false);
    foregroundColorEditor = new ColorSelector(editControls);
    Button fForegroundColor = foregroundColorEditor.getButton();
    GridData gd = new GridData(SWT.BEGINNING, SWT.FILL, false, false);
    fForegroundColor.setLayoutData(gd);
    foregroundColorEditor.setEnabled(false);
    backgroundLabel = createLabel(editControls, SSEUIMessages.Background_UI_);
    ((GridData) backgroundLabel.getLayoutData()).verticalAlignment = SWT.CENTER;
    backgroundLabel.setEnabled(false);
    backgroundColorEditor = new ColorSelector(editControls);
    Button fBackgroundColor = backgroundColorEditor.getButton();
    gd = new GridData(SWT.BEGINNING, SWT.FILL, false, false);
    fBackgroundColor.setLayoutData(gd);
    backgroundColorEditor.setEnabled(false);
    bold = createCheckbox(editControls, XMLUIMessages.SyntaxColoringPage_3);
    bold.setEnabled(false);
    ((GridData) bold.getLayoutData()).horizontalSpan = 2;
    italic = createCheckbox(editControls, XMLUIMessages.SyntaxColoringPage_4);
    italic.setEnabled(false);
    ((GridData) italic.getLayoutData()).horizontalSpan = 2;
    strike = createCheckbox(editControls, XMLUIMessages.SyntaxColoringPage_5);
    strike.setEnabled(false);
    ((GridData) strike.getLayoutData()).horizontalSpan = 2;
    underline = createCheckbox(editControls, XMLUIMessages.SyntaxColoringPage_6);
    underline.setEnabled(false);
    ((GridData) underline.getLayoutData()).horizontalSpan = 2;
    clearStyle = new Button(editingComposite, SWT.PUSH);
    // = "Restore Default"
    clearStyle.setText(SSEUIMessages.Restore_Default_UI_);
    clearStyle.setLayoutData(new GridData(SWT.BEGINNING));
    ((GridData) clearStyle.getLayoutData()).horizontalIndent = 20;
    clearStyle.setEnabled(false);
    Composite sampleArea = createComposite(editor, 1);
    ((GridLayout) sampleArea.getLayout()).marginLeft = 5;
    ((GridLayout) sampleArea.getLayout()).marginTop = 5;
    // = "&Sample text:"
    createLabel(sampleArea, SSEUIMessages.Sample_text__UI_);
    SourceViewer viewer = new SourceViewer(sampleArea, null, SWT.BORDER | SWT.LEFT_TO_RIGHT | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY);
    styledText = viewer.getTextWidget();
    GridData gridData3 = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData3.widthHint = convertWidthInCharsToPixels(20);
    gridData3.heightHint = convertHeightInCharsToPixels(5);
    gridData3.horizontalSpan = 2;
    styledText.setLayoutData(gridData3);
    styledText.setEditable(false);
    styledText.setFont(JFaceResources.getFont(// $NON-NLS-1$
    "org.eclipse.wst.sse.ui.textfont"));
    styledText.addKeyListener(getTextKeyListener());
    styledText.addSelectionListener(getTextSelectionListener());
    styledText.addMouseListener(getTextMouseListener());
    styledText.addTraverseListener(getTraverseListener());
    setAccessible(styledText, SSEUIMessages.Sample_text__UI_);
    try {
        File file = XSLUIPlugin.makeFileFor(XSLSyntaxColoringPage.XSLFILES_DIR, XSLSyntaxColoringPage.SYNTAXCOLORING_XSL);
        document = StructuredModelManager.getModelManager().createStructuredDocumentFor(file.getAbsolutePath(), new FileInputStream(file), null);
    } catch (Exception ex) {
        XSLUIPlugin.log(ex);
    }
    viewer.setDocument(document);
    top.setWeights(new int[] { 1, 1 });
    editor.setWeights(new int[] { 1, 1 });
    PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent, IHelpContextIds.XML_PREFWEBX_STYLES_HELPID);
    stylesViewer.setInput(getStylePreferenceKeys());
    applyStyles();
    stylesViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            if (!event.getSelection().isEmpty()) {
                Object o = ((IStructuredSelection) event.getSelection()).getFirstElement();
                String namedStyle = o.toString();
                activate(namedStyle);
                if (namedStyle == null)
                    return;
            }
        }
    });
    foregroundColorEditor.addListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals(ColorSelector.PROP_COLORCHANGE)) {
                Object o = ((IStructuredSelection) stylesViewer.getSelection()).getFirstElement();
                String namedStyle = o.toString();
                String prefString = getOverlayStore().getString(namedStyle);
                String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
                if (stylePrefs != null) {
                    String oldValue = stylePrefs[0];
                    // open color dialog to get new color
                    String newValue = ColorHelper.toRGBString(foregroundColorEditor.getColorValue());
                    if (!newValue.equals(oldValue)) {
                        stylePrefs[0] = newValue;
                        String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
                        getOverlayStore().setValue(namedStyle, newPrefString);
                        applyStyles();
                        styledText.redraw();
                    }
                }
            }
        }
    });
    backgroundColorEditor.addListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals(ColorSelector.PROP_COLORCHANGE)) {
                Object o = ((IStructuredSelection) stylesViewer.getSelection()).getFirstElement();
                String namedStyle = o.toString();
                String prefString = getOverlayStore().getString(namedStyle);
                String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
                if (stylePrefs != null) {
                    String oldValue = stylePrefs[1];
                    // open color dialog to get new color
                    String newValue = ColorHelper.toRGBString(backgroundColorEditor.getColorValue());
                    if (!newValue.equals(oldValue)) {
                        stylePrefs[1] = newValue;
                        String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
                        getOverlayStore().setValue(namedStyle, newPrefString);
                        applyStyles();
                        styledText.redraw();
                        activate(namedStyle);
                    }
                }
            }
        }
    });
    bold.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            // get current (newly old) style
            Object o = ((IStructuredSelection) stylesViewer.getSelection()).getFirstElement();
            String namedStyle = o.toString();
            String prefString = getOverlayStore().getString(namedStyle);
            String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
            if (stylePrefs != null) {
                String oldValue = stylePrefs[2];
                String newValue = String.valueOf(bold.getSelection());
                if (!newValue.equals(oldValue)) {
                    stylePrefs[2] = newValue;
                    String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
                    getOverlayStore().setValue(namedStyle, newPrefString);
                    applyStyles();
                    styledText.redraw();
                }
            }
        }
    });
    italic.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            // get current (newly old) style
            Object o = ((IStructuredSelection) stylesViewer.getSelection()).getFirstElement();
            String namedStyle = o.toString();
            String prefString = getOverlayStore().getString(namedStyle);
            String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
            if (stylePrefs != null) {
                String oldValue = stylePrefs[3];
                String newValue = String.valueOf(italic.getSelection());
                if (!newValue.equals(oldValue)) {
                    stylePrefs[3] = newValue;
                    String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
                    getOverlayStore().setValue(namedStyle, newPrefString);
                    applyStyles();
                    styledText.redraw();
                }
            }
        }
    });
    strike.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            // get current (newly old) style
            Object o = ((IStructuredSelection) stylesViewer.getSelection()).getFirstElement();
            String namedStyle = o.toString();
            String prefString = getOverlayStore().getString(namedStyle);
            String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
            if (stylePrefs != null) {
                String oldValue = stylePrefs[4];
                String newValue = String.valueOf(strike.getSelection());
                if (!newValue.equals(oldValue)) {
                    stylePrefs[4] = newValue;
                    String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
                    getOverlayStore().setValue(namedStyle, newPrefString);
                    applyStyles();
                    styledText.redraw();
                }
            }
        }
    });
    underline.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            // get current (newly old) style
            Object o = ((IStructuredSelection) stylesViewer.getSelection()).getFirstElement();
            String namedStyle = o.toString();
            String prefString = getOverlayStore().getString(namedStyle);
            String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
            if (stylePrefs != null) {
                String oldValue = stylePrefs[5];
                String newValue = String.valueOf(underline.getSelection());
                if (!newValue.equals(oldValue)) {
                    stylePrefs[5] = newValue;
                    String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
                    getOverlayStore().setValue(namedStyle, newPrefString);
                    applyStyles();
                    styledText.redraw();
                }
            }
        }
    });
    clearStyle.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (stylesViewer.getSelection().isEmpty())
                return;
            String namedStyle = ((IStructuredSelection) stylesViewer.getSelection()).getFirstElement().toString();
            getOverlayStore().setToDefault(namedStyle);
            applyStyles();
            styledText.redraw();
            activate(namedStyle);
        }
    });
    return pageComponent;
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) SourceViewer(org.eclipse.jface.text.source.SourceViewer) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Label(org.eclipse.swt.widgets.Label) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) FileInputStream(java.io.FileInputStream) SashForm(org.eclipse.swt.custom.SashForm) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) Iterator(java.util.Iterator) ColorSelector(org.eclipse.jface.preference.ColorSelector) File(java.io.File) Link(org.eclipse.swt.widgets.Link)

Example 77 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project epp.mpc by eclipse.

the class MarketplaceViewer method doCreateHeaderControls.

@Override
protected void doCreateHeaderControls(Composite parent) {
    header = parent;
    final int originalChildCount = parent.getChildren().length;
    for (CatalogFilter filter : getConfiguration().getFilters()) {
        if (filter instanceof MarketplaceFilter) {
            MarketplaceFilter marketplaceFilter = (MarketplaceFilter) filter;
            marketplaceFilter.createControl(parent);
            marketplaceFilter.addPropertyChangeListener(new IPropertyChangeListener() {

                public void propertyChange(PropertyChangeEvent event) {
                    if (AbstractTagFilter.PROP_SELECTED.equals(event.getProperty())) {
                        doQuery();
                    }
                }
            });
        }
    }
    Control[] children = parent.getChildren();
    for (int x = originalChildCount; x < children.length; ++x) {
        Control child = children[x];
        GridDataFactory.swtDefaults().hint(135, SWT.DEFAULT).applyTo(child);
    }
    Button goButton = new Button(parent, SWT.PUSH);
    goButton.setText(Messages.MarketplaceViewer_go);
    goButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            doQuery();
        }
    });
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) CatalogFilter(org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogFilter) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) TextSearchControl(org.eclipse.equinox.internal.p2.ui.discovery.util.TextSearchControl) Control(org.eclipse.swt.widgets.Control) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 78 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project janrufmonitor by tbrandt77.

the class InitFritzBoxVariantPage method createControl.

public void createControl(Composite parent) {
    setTitle(this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "title", "label", this.m_language));
    setDescription(this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "description", "label", this.m_language));
    final Composite c = new Composite(parent, SWT.NONE);
    c.setLayout(new GridLayout(1, false));
    c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    BooleanFieldEditor bfe = new BooleanFieldEditor("activemonitor", this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "activemonitor2", "label", this.m_language), c);
    bfe.setPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null && e.getNewValue() instanceof Boolean)
                m_active = ((Boolean) e.getNewValue()).booleanValue();
            setPageComplete(isComplete());
        }
    });
    new Label(c, SWT.LEFT);
    StringFieldEditor sfe = new StringFieldEditor("boxip", this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "boxip", "label", this.m_language), c);
    sfe.setStringValue("fritz.box");
    this.m_boxip = "fritz.box";
    sfe.setPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String)
                m_boxip = (String) e.getNewValue();
            setPageComplete(isComplete());
        }
    });
    ComboFieldEditor mode = new ComboFieldEditor("boxloginmode", this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "boxloginmode", "label", this.m_language), new String[][] { { this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "userpassword", "label", this.m_language), "0" }, { this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "password_only", "label", this.m_language), "1" } }, c);
    final StringFieldEditor sfe1 = new StringFieldEditor("boxuser", this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "boxuser", "label", this.m_language), c);
    sfe1.setStringValue("");
    this.m_boxuser = "";
    mode.setPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String) {
                String state = (String) e.getNewValue();
                if (state.equalsIgnoreCase("1")) {
                    sfe1.setEnabled(false, c);
                    sfe1.setStringValue("");
                    sfe1.getTextControl(c).setBackground(new Color(DisplayManager.getDefaultDisplay(), 190, 190, 190));
                    m_boxuser = "";
                } else {
                    sfe1.setEnabled(true, c);
                    sfe1.getTextControl(c).setBackground(new Color(DisplayManager.getDefaultDisplay(), 255, 255, 255));
                }
            }
        }
    });
    sfe1.setPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String)
                m_boxuser = (String) e.getNewValue();
            setPageComplete(isComplete());
        }
    });
    sfe = new StringFieldEditor("boxpassword", this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "boxpassword", "label", this.m_language), c);
    sfe.getTextControl(c).setEchoChar('*');
    sfe.setStringValue("");
    this.m_boxpassword = "";
    sfe.setPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String)
                m_boxpassword = (String) e.getNewValue();
            setPageComplete(isComplete());
        }
    });
    new Label(c, SWT.LEFT);
    bfe = new BooleanFieldEditor("usemsns", this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "usemsns", "label", this.m_language), c);
    bfe.setPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null && e.getNewValue() instanceof Boolean)
                m_usemsns = ((Boolean) e.getNewValue()).booleanValue();
            setPageComplete(isComplete());
        }
    });
    new Label(c, SWT.LEFT);
    Text l = new Text(c, SWT.LEFT | SWT.WRAP);
    l.setText(this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "openfb", "label", this.m_language));
    l.setEditable(false);
    l.setBackground(parent.getBackground());
    new Label(c, SWT.LEFT);
    HyperLink hl = new HyperLink(c, SWT.LEFT | SWT.WRAP);
    hl.setText(this.m_i18n.getString("ui.jface.configuration.pages.FritzBoxVoip", "openfb2", "label", this.m_language));
    hl.addMouseListener(new MouseAdapter() {

        public void mouseDown(MouseEvent e) {
            if (e.button == 1)
                Program.launch("http://www.janrufmonitor.de/fritzbox-freischalten");
        }
    });
    setPageComplete(isComplete());
    setControl(c);
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) Color(org.eclipse.swt.graphics.Color) Label(org.eclipse.swt.widgets.Label) MouseAdapter(org.eclipse.swt.events.MouseAdapter) BooleanFieldEditor(de.janrufmonitor.ui.jface.configuration.controls.BooleanFieldEditor) Text(org.eclipse.swt.widgets.Text) ComboFieldEditor(org.eclipse.jface.preference.ComboFieldEditor) HyperLink(de.janrufmonitor.ui.jface.application.controls.HyperLink) StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData)

Example 79 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project janrufmonitor by tbrandt77.

the class InitAreaCodePage method createControl.

public void createControl(Composite parent) {
    setTitle(this.m_i18n.getString(getNamespace(), "title", "label", this.m_language));
    setDescription(this.m_i18n.getString(getNamespace(), "description", "label", this.m_language));
    Composite c = new Composite(parent, SWT.NONE);
    c.setLayout(new GridLayout(1, false));
    c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    StringFieldEditor sfe = new StringFieldEditor("intarea", this.m_i18n.getString(getNamespace(), "intarea", "label", this.m_language), 5, c);
    sfe.setStringValue("49");
    this.m_newIntArea = "49";
    sfe.setPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null)
                m_newIntArea = (String) e.getNewValue();
            setPageComplete(isComplete());
        }
    });
    sfe = new StringFieldEditor("area", this.m_i18n.getString(getNamespace(), "area", "label", this.m_language), 10, c);
    sfe.setStringValue("030");
    this.m_newArea = "030";
    sfe.setPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null)
                m_newArea = (String) e.getNewValue();
            identify();
            setPageComplete(isComplete());
        }
    });
    new Label(c, SWT.LEFT);
    m_city = new Label(c, SWT.LEFT);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = 300;
    m_city.setText("Berlin");
    m_city.setLayoutData(gd);
    setPageComplete(isComplete());
    setControl(c);
}
Also used : StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) GridLayout(org.eclipse.swt.layout.GridLayout) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Example 80 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project janrufmonitor by tbrandt77.

the class InitNumberFormatPage method createControl.

public void createControl(Composite parent) {
    setTitle(this.m_i18n.getString(getNamespace(), "title", "label", this.m_language));
    setDescription(this.m_i18n.getString(getNamespace(), "description", "label", this.m_language));
    Composite c = new Composite(parent, SWT.NONE);
    c.setLayout(new GridLayout(1, false));
    c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    ComboFieldEditor cfe = new ComboFieldEditor(this.m_i18n.getString(getNamespace(), "name", "label", this.m_language), this.m_i18n.getString(getNamespace(), "label", "label", this.m_language), new String[][] { { this.m_i18n.getString(getNamespace(), "format1", "label", this.m_language), "+%intareacode% (%areacode%) %callnumber%" }, { this.m_i18n.getString(getNamespace(), "format2", "label", this.m_language), "00%intareacode% (%areacode%) %callnumber%" }, { this.m_i18n.getString(getNamespace(), "format3", "label", this.m_language), "(0%areacode%) %callnumber%" }, { this.m_i18n.getString(getNamespace(), "format4", "label", this.m_language), "0%areacode%-%callnumber%" } }, c);
    cfe.setPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null)
                m_newFormat = (String) e.getNewValue();
            setPageComplete(isComplete());
        }
    });
    setPageComplete(isComplete());
    setControl(c);
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) GridLayout(org.eclipse.swt.layout.GridLayout) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) ComboFieldEditor(org.eclipse.jface.preference.ComboFieldEditor)

Aggregations

IPropertyChangeListener (org.eclipse.jface.util.IPropertyChangeListener)126 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)120 Composite (org.eclipse.swt.widgets.Composite)55 GridData (org.eclipse.swt.layout.GridData)44 Label (org.eclipse.swt.widgets.Label)39 GridLayout (org.eclipse.swt.layout.GridLayout)37 SelectionEvent (org.eclipse.swt.events.SelectionEvent)31 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)25 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)22 Button (org.eclipse.swt.widgets.Button)22 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)21 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)20 ColorSelector (org.eclipse.jface.preference.ColorSelector)14 ComboViewer (org.eclipse.jface.viewers.ComboViewer)12 Text (org.eclipse.swt.widgets.Text)11 Iterator (java.util.Iterator)10 ISelection (org.eclipse.jface.viewers.ISelection)10 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)10 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)9 SashForm (org.eclipse.swt.custom.SashForm)9