use of com.intellij.ui.DocumentAdapter in project watchdog by TestRoots.
the class WelcomeStepBase method createLoginJPanel.
/**
* Creates and returns an input field, in which user can enter their
* existing WatchDog ID.
*/
private JPanel createLoginJPanel(final JPanel parent) {
JPanel panel = UIUtils.createFlowJPanelLeft(parent);
userInput = UIUtils.createLinkedFieldInput(panel, labelText, ID_LENGTH, inputToolTip);
userInput.setDocument(new UIUtils.JTextFieldLimit(ID_LENGTH));
userInput.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
if (userInput.getText().length() == ID_LENGTH) {
setErrorMessageAndStepComplete(null);
} else {
setErrorMessageAndStepComplete("Not a valid id.");
}
parent.updateUI();
getWizard().updateButtons();
}
});
return panel;
}
use of com.intellij.ui.DocumentAdapter in project watchdog by TestRoots.
the class PreferencePage method createComponent.
@Nullable
@Override
public JComponent createComponent() {
main = new JPanel();
main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));
JPanel localGroup = UIUtils.createGroup(main, "Local Settings", 1);
UIUtils.createLabel(localGroup, "Here you can define the local WatchDog settings for this project.");
UIUtils.createLabel(localGroup, "");
JPanel projectJPanel = UIUtils.createFlowJPanelLeft(localGroup);
UIUtils.createLabel(projectJPanel, "Project-ID ");
projectIDInput = UIUtils.createLimitedTextInputField(projectJPanel, ID_LENGTH);
ProjectPreferenceSetting projectSetting = preferences.getOrCreateProjectSetting(WatchDogUtils.getProjectName());
projectIDInput.setText(projectSetting.projectId);
enableWatchdogInput = UIUtils.createCheckBox(localGroup, "Monitor this project with WatchDog ");
enableWatchdogInput.setSelected(projectSetting.enableWatchdog);
UIUtils.createLabel(main, "");
JPanel globalGroup = UIUtils.createGroup(main, "Global Settings", 1);
UIUtils.createLabel(globalGroup, "Here you can enter settings that will affect WatchDog no matter which project you have opened. ");
UIUtils.createLabel(globalGroup, "");
JPanel userJPanel = UIUtils.createFlowJPanelLeft(globalGroup);
UIUtils.createLabel(userJPanel, "User-ID ");
userIDInput = UIUtils.createLimitedTextInputField(userJPanel, ID_LENGTH);
userIDInput.setText(preferences.getUserId());
JPanel serverJPanel = UIUtils.createFlowJPanelLeft(globalGroup);
UIUtils.createLabel(serverJPanel, "Server-URL ");
serverURLInput = UIUtils.createTextInputField(serverJPanel, WatchDogGlobals.DEFAULT_SERVER_URI.length());
serverURLInput.setMinimumSize(serverURLInput.getPreferredSize());
serverURLInput.setMaximumSize(serverURLInput.getPreferredSize());
serverURLInput.setText(preferences.getServerURI());
serverURLInput.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
isModified = true;
}
});
enableAuthentication = UIUtils.createCheckBox(globalGroup, "Enable Authentication");
enableAuthentication.setSelected(preferences.isAuthenticationEnabled());
enableLogging = UIUtils.createCheckBox(globalGroup, "Enable Logging");
enableLogging.setSelected(preferences.isLoggingEnabled());
addModificationListeners();
return main;
}
use of com.intellij.ui.DocumentAdapter in project watchdog by TestRoots.
the class PreferencePage method addModificationListeners.
private void addModificationListeners() {
enableWatchdogInput.getAccessibleContext().addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
isModified = true;
}
});
projectIDInput.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
isModified = true;
}
});
enableAuthentication.getAccessibleContext().addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
isModified = true;
}
});
userIDInput.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
isModified = true;
}
});
enableLogging.getAccessibleContext().addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
isModified = true;
}
});
}
use of com.intellij.ui.DocumentAdapter in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoSdkConfigurable method listenForPathUpdate.
private void listenForPathUpdate() {
JTextField textField = mySdkPathField.getTextField();
Ref<String> prevPathRef = Ref.create(StringUtil.notNullize(textField.getText()));
textField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
String sdkPath = StringUtil.notNullize(textField.getText());
String prevPath = prevPathRef.get();
if (!prevPath.equals(sdkPath)) {
asyncUpdateSdkVersion(sdkPath);
prevPathRef.set(sdkPath);
}
}
});
}
use of com.intellij.ui.DocumentAdapter in project ballerina by ballerina-lang.
the class BallerinaSdkConfigurable method listenForPathUpdate.
private void listenForPathUpdate() {
JTextField textField = mySdkPathField.getTextField();
Ref<String> prevPathRef = Ref.create(StringUtil.notNullize(textField.getText()));
textField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
String sdkPath = StringUtil.notNullize(textField.getText());
String prevPath = prevPathRef.get();
if (!prevPath.equals(sdkPath)) {
asyncUpdateSdkVersion(sdkPath);
prevPathRef.set(sdkPath);
}
}
});
}
Aggregations