Search in sources :

Example 16 with PropertyChangeEvent

use of org.eclipse.jface.util.PropertyChangeEvent in project translationstudio8 by heartsome.

the class WorkingSetActionProvider method init.

public void init(ICommonActionExtensionSite aSite) {
    viewer = (CommonViewer) aSite.getStructuredViewer();
    contentService = aSite.getContentService();
    filterService = (NavigatorFilterService) contentService.getFilterService();
    extensionStateModel = contentService.findStateModel(WorkingSetsContentProvider.EXTENSION_ID);
    workingSetActionGroup = new WorkingSetFilterActionGroup(aSite.getViewSite().getShell(), filterChangeListener);
    workingSetRootModeActionGroup = new WorkingSetRootModeActionGroup(viewer, extensionStateModel);
    topLevelModeListener = new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            setWorkingSet(workingSet);
            viewer.getFrameList().reset();
        }
    };
    if (contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) {
        managerChangeListener.listen();
        extensionStateModel.addPropertyChangeListener(topLevelModeListener);
    }
    contentService.getActivationService().addExtensionActivationListener(activationListener);
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) WorkingSetFilterActionGroup(org.eclipse.ui.actions.WorkingSetFilterActionGroup)

Example 17 with PropertyChangeEvent

use of org.eclipse.jface.util.PropertyChangeEvent in project tdi-studio-se by Talend.

the class HL7DragAndDrogDialog method createDialogArea.

/*
     * (non-Javadoc) Method declared on Dialog.
     */
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // composite.setLayout(new GridLayout());
    String[][] namevalues = null;
    if (hideAttr) {
        namevalues = new String[][] { { "Create as sub-element of target node", CREATE_AS_SUBELEMENT }, { "Add linker to target node", CREATE_AS_TEXT } };
    } else {
        namevalues = new String[][] { { "Create as sub-element of target node", CREATE_AS_SUBELEMENT }, { "Create as attribute of target node", CREATE_AS_ATTRIBUTE }, { "Add linker to target node", CREATE_AS_TEXT } };
    }
    RadioGroupFieldEditor rgfe = new RadioGroupFieldEditor("", "Select the operation:", 1, namevalues, composite, true);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 12;
    composite.setLayout(layout);
    rgfe.setPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            value = event.getNewValue().toString();
        }
    });
    applyDialogFont(composite);
    return composite;
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) RadioGroupFieldEditor(org.eclipse.jface.preference.RadioGroupFieldEditor) GridLayout(org.eclipse.swt.layout.GridLayout) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite)

Example 18 with PropertyChangeEvent

use of org.eclipse.jface.util.PropertyChangeEvent in project tdi-studio-se by Talend.

the class AttributeSelectionDialog method createColorSelector.

/**
     * Creates the color selector.
     * 
     * @param parent The parent composite
     * @return The color selector
     */
private ColorSelector createColorSelector(Composite parent) {
    final ColorSelector selector = new ColorSelector(parent);
    selector.addListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            AttributeNode attribute = (AttributeNode) selection.getFirstElement();
            if (attribute != null) {
                attribute.setRgb(selector.getColorValue());
            }
        }
    });
    selector.setEnabled(false);
    return selector;
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ColorSelector(org.eclipse.jface.preference.ColorSelector)

Example 19 with PropertyChangeEvent

use of org.eclipse.jface.util.PropertyChangeEvent in project tdi-studio-se by Talend.

the class ConfigureChartDialog method createColorSelector.

/**
     * Creates the color selector.
     * 
     * @param parent The parent composite
     * @return The color selector
     */
private ColorSelector createColorSelector(Composite parent) {
    final ColorSelector selector = new ColorSelector(parent);
    selector.addListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            IStructuredSelection selection = (IStructuredSelection) attributesViewer.getSelection();
            MBeanAttribute attribute = (MBeanAttribute) selection.getFirstElement();
            if (attribute != null) {
                attribute.setRgb(selector.getColorValue());
            }
        }
    });
    selector.setEnabled(false);
    return selector;
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ColorSelector(org.eclipse.jface.preference.ColorSelector)

Example 20 with PropertyChangeEvent

use of org.eclipse.jface.util.PropertyChangeEvent in project sling by apache.

the class ServersActionModeFiddlerActionDelegate method selectionChanged.

@Override
public void selectionChanged(IAction action, ISelection selection) {
    server = null;
    modules = null;
    if (selection != null && (selection instanceof IStructuredSelection)) {
        IStructuredSelection iss = (IStructuredSelection) selection;
        Object first = iss.getFirstElement();
        if (first instanceof IServer) {
            server = (IServer) first;
            modules = null;
            if (iss.size() > 1) {
                // verify that all selected elements are of type IServer
                Iterator<?> it = iss.iterator();
                // skip the first, we have that above already
                it.next();
                while (it.hasNext()) {
                    Object next = it.next();
                    if (!(next instanceof IServer)) {
                        server = null;
                        modules = null;
                        break;
                    }
                }
            }
        } else if (first instanceof IServerModule) {
            modules = new LinkedList<>();
            IServerModule module = (IServerModule) first;
            modules.add(module.getModule());
            server = module.getServer();
            if (iss.size() > 1) {
                // verify that all selected elements are of type IServerModule
                // plus add the module[] to the modules list
                Iterator<?> it = iss.iterator();
                // skip the first, we have that above already
                it.next();
                while (it.hasNext()) {
                    Object next = it.next();
                    if (!(next instanceof IServerModule)) {
                        server = null;
                        module = null;
                        break;
                    } else {
                        module = (IServerModule) next;
                        modules.add(module.getModule());
                    }
                }
            }
        }
    }
    if (server != null) {
        if (server.getServerState() != IServer.STATE_STARTED) {
            server = null;
            modules = null;
        }
    }
    cleanAction.setEnabled(server != null);
    publishAction.setEnabled(server != null);
    action.setEnabled(true);
    final IAction serverRunAction = actionBars.getGlobalActionHandler("org.eclipse.wst.server.run");
    final IAction serverDebugAction = actionBars.getGlobalActionHandler("org.eclipse.wst.server.debug");
    IAction stopRunAction = actionBars.getGlobalActionHandler("org.eclipse.wst.server.stop");
    if (serverRunAction == null || stopRunAction == null || serverDebugAction == null) {
        return;
    }
    //		serverRunAction.setHoverImageDescriptor(SharedImages.SLING_LOG);
    serverRunAction.setHoverImageDescriptor(SharedImages.RUN_CONNECT);
    serverDebugAction.setHoverImageDescriptor(SharedImages.DEBUG_CONNECT);
    stopRunAction.setHoverImageDescriptor(SharedImages.DISCONNECT);
    findWstPublishAction();
    for (ActionContributionItem appendedAction : appendedToolbarActionContributionItems) {
        if (!contributionAdded(appendedAction)) {
            actionBars.getToolBarManager().add(appendedAction);
        }
    }
    if (wstPublishAction != null) {
        wstPublishAction.setVisible(false);
        publishActionContributionItem.setVisible(true);
    } else {
        // otherwise hide it, as it is an unexpected situation
        publishActionContributionItem.setVisible(false);
    }
    final String runText = "Connect to server in run mode";
    if (runTooltipListener == null) {
        runTooltipListener = new IPropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent event) {
                if (event.getProperty().equals(IAction.TOOL_TIP_TEXT)) {
                    if (!event.getNewValue().equals(runText)) {
                        serverRunAction.setToolTipText(runText);
                    }
                }
            }
        };
        serverRunAction.addPropertyChangeListener(runTooltipListener);
    }
    final String debugText = "Connect to server in debug mode";
    if (debugTooltipListener == null) {
        debugTooltipListener = new IPropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent event) {
                if (event.getProperty().equals(IAction.TOOL_TIP_TEXT)) {
                    if (!event.getNewValue().equals(debugText)) {
                        serverDebugAction.setToolTipText(debugText);
                    }
                }
            }
        };
        serverDebugAction.addPropertyChangeListener(debugTooltipListener);
    }
    final String disconnectText = "Disconnect from server";
    if (disconnectTooltipListener == null) {
        disconnectTooltipListener = new IPropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent event) {
                if (event.getProperty().equals(IAction.TOOL_TIP_TEXT)) {
                    if (!event.getNewValue().equals(disconnectText)) {
                        serverRunAction.setToolTipText(disconnectText);
                    }
                }
            }
        };
        stopRunAction.addPropertyChangeListener(disconnectTooltipListener);
    }
    serverRunAction.setToolTipText(runText);
    serverDebugAction.setToolTipText(debugText);
    stopRunAction.setToolTipText(disconnectText);
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) IServer(org.eclipse.wst.server.core.IServer) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) IAction(org.eclipse.jface.action.IAction) IServerModule(org.eclipse.wst.server.ui.IServerModule) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) LinkedList(java.util.LinkedList) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) Iterator(java.util.Iterator)

Aggregations

PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)31 IPropertyChangeListener (org.eclipse.jface.util.IPropertyChangeListener)27 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)8 GridData (org.eclipse.swt.layout.GridData)8 Composite (org.eclipse.swt.widgets.Composite)7 GridLayout (org.eclipse.swt.layout.GridLayout)6 ColorSelector (org.eclipse.jface.preference.ColorSelector)5 Label (org.eclipse.swt.widgets.Label)5 PreferenceStore (org.eclipse.jface.preference.PreferenceStore)4 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 ChainedPreferenceStore (org.eclipse.ui.texteditor.ChainedPreferenceStore)4 Test (org.junit.Test)4 ISelection (org.eclipse.jface.viewers.ISelection)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 Text (org.eclipse.swt.widgets.Text)3 IOException (java.io.IOException)2 Iterator (java.util.Iterator)2 MissingResourceException (java.util.MissingResourceException)2 IMenuManager (org.eclipse.jface.action.IMenuManager)2