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());
}
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);
}
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();
}
});
}
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;
}
Aggregations