Merge branch 'stable-2.6'

* stable-2.6:
  Handle 'Event.ONPASTE' in CreateGroupScreen
  OnEditEnabler can disable the widget
  Re-add comment why connection pooling is turned off for MySQL
  Fix issues with Prolog files in Eclipse
This commit is contained in:
Shawn Pearce
2013-05-06 07:31:51 -07:00
4 changed files with 45 additions and 3 deletions

View File

@@ -27,11 +27,14 @@ import com.google.gerrit.client.ui.OnEditEnabler;
import com.google.gerrit.client.ui.Screen;
import com.google.gerrit.client.ui.SmallHeading;
import com.google.gerrit.common.PageLinks;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.VerticalPanel;
@@ -74,7 +77,24 @@ public class CreateGroupScreen extends Screen {
addPanel.setStyleName(Gerrit.RESOURCES.css().addSshKeyPanel());
addPanel.add(new SmallHeading(Util.C.headingCreateGroup()));
addTxt = new NpTextBox();
addTxt = new NpTextBox() {
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
if (event.getTypeInt() == Event.ONPASTE) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
if (addTxt.getValue().trim().length() != 0) {
addNew.setEnabled(true);
}
}
});
}
}
};
addTxt.sinkEvents(Event.ONPASTE);
addTxt.setVisibleLength(60);
addTxt.addKeyPressHandler(new KeyPressHandler() {
@Override

View File

@@ -33,6 +33,7 @@ import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.FocusWidget;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.TextBoxBase;
import com.google.gwt.user.client.ui.ValueBoxBase;
import java.util.HashMap;
import java.util.Map;
@@ -139,6 +140,17 @@ public class OnEditEnabler implements KeyPressHandler, KeyDownHandler,
if (widget.isEnabled() ||
! (e.getSource() instanceof FocusWidget) ||
! ((FocusWidget) e.getSource()).isEnabled() ) {
if (e.getSource() instanceof ValueBoxBase) {
final TextBoxBase box = ((TextBoxBase) e.getSource());
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
if (box.getValue().trim().length() == 0) {
widget.setEnabled(false);
}
}
});
}
return;
}

View File

@@ -47,6 +47,10 @@ class MySql extends BaseDataSourceType {
@Override
public boolean usePool() {
// MySQL has given us trouble with the connection pool,
// sometimes the backend disconnects and the pool winds
// up with a stale connection. Fortunately opening up
// a new MySQL connection is usually very fast.
return false;
}
}

10
pom.xml
View File

@@ -421,7 +421,10 @@ limitations under the License.
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
<execute>
<runOnIncremental>false</runOnIncremental>
<runOnConfiguration>true</runOnConfiguration>
</execute>
</action>
</pluginExecution>
<pluginExecution>
@@ -434,7 +437,10 @@ limitations under the License.
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
<execute>
<runOnIncremental>false</runOnIncremental>
<runOnConfiguration>true</runOnConfiguration>
</execute>
</action>
</pluginExecution>
</pluginExecutions>