Search in sources :

Example 1 with UserActivityWatcher

use of com.intellij.ui.UserActivityWatcher in project intellij-community by JetBrains.

the class DomUIFactoryImpl method setupErrorOutdatingUserActivityWatcher.

@Override
public void setupErrorOutdatingUserActivityWatcher(final CommittablePanel panel, final DomElement... elements) {
    final UserActivityWatcher userActivityWatcher = createEditorAwareUserActivityWatcher();
    userActivityWatcher.addUserActivityListener(new UserActivityListener() {

        private boolean isProcessingChange;

        @Override
        public void stateChanged() {
            if (isProcessingChange)
                return;
            isProcessingChange = true;
            try {
                for (final DomElement element : elements) {
                    DomElementAnnotationsManagerImpl.outdateProblemHolder(element);
                }
                CommittableUtil.updateHighlighting(panel);
            } finally {
                isProcessingChange = false;
            }
        }
    }, panel);
    userActivityWatcher.register(panel.getComponent());
}
Also used : DomElement(com.intellij.util.xml.DomElement) UserActivityWatcher(com.intellij.ui.UserActivityWatcher) UserActivityListener(com.intellij.ui.UserActivityListener)

Example 2 with UserActivityWatcher

use of com.intellij.ui.UserActivityWatcher in project intellij-community by JetBrains.

the class SettingsEditor method installWatcher.

protected void installWatcher(JComponent c) {
    myWatcher = new UserActivityWatcher();
    myWatcher.register(c);
    UserActivityListener userActivityListener = new UserActivityListener() {

        @Override
        public void stateChanged() {
            fireEditorStateChanged();
        }
    };
    myWatcher.addUserActivityListener(userActivityListener, this);
}
Also used : UserActivityWatcher(com.intellij.ui.UserActivityWatcher) UserActivityListener(com.intellij.ui.UserActivityListener)

Example 3 with UserActivityWatcher

use of com.intellij.ui.UserActivityWatcher in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudSdkPanel method initEvents.

private void initEvents() {
    // track all changes in UI to report settings changes.
    UserActivityWatcher activityWatcher = new UserActivityWatcher();
    activityWatcher.register(cloudSdkPanel);
    activityWatcher.addUserActivityListener(() -> settingsModified = true);
    ButtonGroup sdkChoiceGroup = new ButtonGroup();
    sdkChoiceGroup.add(managedRadioButton);
    sdkChoiceGroup.add(customRadioButton);
    managedRadioButton.addActionListener((e) -> {
        setManagedSdkUiAvailable(true);
        setCustomSdkUiAvailable(false);
        selectedCloudSdkServiceType = CloudSdkServiceType.MANAGED_SDK;
    });
    customRadioButton.addActionListener((e) -> {
        setCustomSdkUiAvailable(true);
        setManagedSdkUiAvailable(false);
        selectedCloudSdkServiceType = CloudSdkServiceType.CUSTOM_SDK;
    });
    checkForUpdatesHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        protected void hyperlinkActivated(HyperlinkEvent e) {
        // TODO(ivanporty) will call ManagedSdk#update if it's installed and active.
        }
    });
    cloudSdkDirectoryField.addBrowseFolderListener(GctBundle.message("cloudsdk.location.browse.window.title"), null, /* description */
    null, /* project */
    FileChooserDescriptorFactory.createSingleFolderDescriptor());
    cloudSdkDirectoryField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(DocumentEvent event) {
            checkSdkInBackground();
        }
    });
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) ButtonGroup(javax.swing.ButtonGroup) UserActivityWatcher(com.intellij.ui.UserActivityWatcher) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent) HyperlinkAdapter(com.intellij.ui.HyperlinkAdapter)

Example 4 with UserActivityWatcher

use of com.intellij.ui.UserActivityWatcher in project intellij-leiningen-plugin by derkork.

the class LeiningenSettings method createComponent.

public JComponent createComponent() {
    JPanel outerPanel = new JPanel(new BorderLayout());
    JPanel leinPanel = new JPanel(new FormLayout("80dlu, fill:80dlu:grow, 20dlu, 80dlu", "p,p,p"));
    CellConstraints c = new CellConstraints();
    int row = 1;
    leinPanel.add(new JBLabel("Leiningen executable:"), c.xy(1, row));
    this.leinBinSelectorField = new TextFieldWithBrowseButton();
    leinBinSelectorField.addBrowseFolderListener("Select the Leiningen executable", "'lein' on Linux/MacOS, 'lein.bat' on Windows. ", null, new FileChooserDescriptor(true, false, false, false, false, false));
    leinPanel.add(leinBinSelectorField, c.xy(2, row));
    row++;
    leinPanel.add(new JBLabel("Leiningen Home:"), c.xy(1, row));
    this.leinHomeSelectorField = new TextFieldWithBrowseButton();
    leinHomeSelectorField.addBrowseFolderListener("Select the Leiningen home directory", "usually at $USER_HOME/.lein", null, new FileChooserDescriptor(false, true, false, false, false, false));
    leinPanel.add(leinHomeSelectorField, c.xy(2, row));
    this.overrideLeinHome = new JBCheckBox();
    leinPanel.add(overrideLeinHome, c.xy(3, row));
    leinPanel.add(new JBLabel("Override"), c.xy(4, row));
    row++;
    leinPanel.add(new JBLabel("Leiningen Jar:"), c.xy(1, row));
    this.leinJarSelectorField = new TextFieldWithBrowseButton();
    leinJarSelectorField.addBrowseFolderListener("Select the Leiningen Jar", "usually at $USER_HOME/.lein/self-installs/leinigen-VERSION-standalone.jar", null, new FileChooserDescriptor(true, false, true, true, false, false));
    leinPanel.add(leinJarSelectorField, c.xy(2, row));
    this.overrideLeinJar = new JBCheckBox();
    leinPanel.add(overrideLeinJar, c.xy(3, row));
    leinPanel.add(new JBLabel("Override"), c.xy(4, row));
    outerPanel.add(leinPanel, BorderLayout.NORTH);
    myWatcher = new UserActivityWatcher();
    myWatcher.register(outerPanel);
    myWatcher.addUserActivityListener(new UserActivityListener() {

        public void stateChanged() {
            changed = true;
            leinJarSelectorField.setEnabled(overrideLeinJar.isSelected());
            leinHomeSelectorField.setEnabled(overrideLeinHome.isSelected());
        }
    });
    return outerPanel;
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) JBLabel(com.intellij.ui.components.JBLabel) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) UserActivityWatcher(com.intellij.ui.UserActivityWatcher) UserActivityListener(com.intellij.ui.UserActivityListener) CellConstraints(com.jgoodies.forms.layout.CellConstraints) JBCheckBox(com.intellij.ui.components.JBCheckBox)

Aggregations

UserActivityWatcher (com.intellij.ui.UserActivityWatcher)4 UserActivityListener (com.intellij.ui.UserActivityListener)3 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)1 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)1 DocumentAdapter (com.intellij.ui.DocumentAdapter)1 HyperlinkAdapter (com.intellij.ui.HyperlinkAdapter)1 JBCheckBox (com.intellij.ui.components.JBCheckBox)1 JBLabel (com.intellij.ui.components.JBLabel)1 DomElement (com.intellij.util.xml.DomElement)1 CellConstraints (com.jgoodies.forms.layout.CellConstraints)1 FormLayout (com.jgoodies.forms.layout.FormLayout)1 ButtonGroup (javax.swing.ButtonGroup)1 DocumentEvent (javax.swing.event.DocumentEvent)1 HyperlinkEvent (javax.swing.event.HyperlinkEvent)1