JBoss Tools SVN: r35843 - trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-20 09:40:01 -0400 (Thu, 20 Oct 2011)
New Revision: 35843
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/ValueBindingBuilder.java
Log:
[JBIDE-9947] added binding builder to have nicer binding semantics
Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/ValueBindingBuilder.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/ValueBindingBuilder.java 2011-10-20 13:38:27 UTC (rev 35842)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/ValueBindingBuilder.java 2011-10-20 13:40:01 UTC (rev 35843)
@@ -58,10 +58,6 @@
return (PARTICIPANT) this;
}
- protected void assertObservable(String message) {
- Assert.isLegal(this.observable != null, message);
- }
-
public IObservableValue getObservable() {
return observable;
}
@@ -78,10 +74,8 @@
}
public ModelDefinition to(IObservableValue model) {
- assertObservable("You have to set the target first. call #bind(target).");
return new ModelDefinition(model, this);
}
-
}
public static class ModelDefinition extends BindingParticipantDefinition<ModelDefinition> {
13 years, 2 months
JBoss Tools SVN: r35842 - in trunk: common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-20 09:38:27 -0400 (Thu, 20 Oct 2011)
New Revision: 35842
Added:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/ValueBindingBuilder.java
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
Log:
[JBIDE-9947] added binding builder to have nicer binding semantics
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-20 13:03:18 UTC (rev 35841)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-20 13:38:27 UTC (rev 35842)
@@ -62,6 +62,7 @@
import org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.tools.common.ui.databinding.ValueBindingBuilder;
import org.jboss.tools.common.ui.databinding.DataBindingUtils;
import org.jboss.tools.common.ui.databinding.InvertingBooleanConverter;
import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
@@ -72,7 +73,7 @@
/**
* @author André Dietisheim
* @author Rob Stryker
- *
+ *
*/
public class AdapterWizardPage extends AbstractOpenShiftWizardPage implements IWizardPage, PropertyChangeListener {
private Text gitUriValueText;
@@ -322,11 +323,11 @@
domainLabel.setText("Host");
domainValueLabel = new Label(c, SWT.NONE);
DataBindingContext dbc = getDatabindingContext();
- dbc.bindValue(
- WidgetProperties.text().observe(domainValueLabel)
- , BeanProperties.value(AdapterWizardPageModel.PROPERTY_APPLICATION_URL).observe(model)
- , new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER)
- , null);
+ ValueBindingBuilder
+ .bind(WidgetProperties.text().observe(domainValueLabel))
+ .withoutUpdate()
+ .to(BeanProperties.value(AdapterWizardPageModel.PROPERTY_APPLICATION_URL).observe(model))
+ .using(dbc);
// appLabel = new Label(c, SWT.NONE);
Label modeLabel = new Label(c, SWT.NONE);
modeLabel.setText("Mode");
@@ -375,12 +376,14 @@
SelectedRuntimeValidator selectedRuntimeValidator = new SelectedRuntimeValidator();
dbc.addValidationStatusProvider(selectedRuntimeValidator);
-// ControlDecorationSupport.create(selectedRuntimeValidator, SWT.TOP | SWT.LEFT);
+ // ControlDecorationSupport.create(selectedRuntimeValidator, SWT.TOP |
+ // SWT.LEFT);
}
private void updateSelectedRuntimeDelegate() {
if (!(new Integer(-1).equals(selectedRuntimeObservable.getValue()))) {
- String selectedRuntimeName = (String) suitableRuntimesObservable.get((Integer) selectedRuntimeObservable.getValue());
+ String selectedRuntimeName = (String) suitableRuntimesObservable.get((Integer) selectedRuntimeObservable
+ .getValue());
runtimeDelegate = ServerCore.findRuntime(selectedRuntimeName);
} else {
runtimeDelegate = null;
@@ -433,7 +436,7 @@
selectedRuntimeObservable.setValue(0);
updateSelectedRuntimeDelegate();
}
-
+
IRuntimeType type = getValidRuntimeType();
addRuntimeLink.setEnabled(type != null);
modeValueLabel.setText("Source");
@@ -462,7 +465,7 @@
IRuntime[] runtimes = getRuntimesOfType(type.getId());
fillRuntimeCombo(runtimes);
} else {
-// suitableRuntimesCombo.setItems(new String[0]);
+ // suitableRuntimesCombo.setItems(new String[0]);
selectedRuntimeObservable.setValue(0);
}
}
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-10-20 13:03:18 UTC (rev 35841)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-10-20 13:38:27 UTC (rev 35842)
@@ -38,8 +38,6 @@
public static final String SERVER_TYPE = "serverType";
private ImportProjectWizardModel wizardModel;
-// private String gitUri;
-// private String applicationUrl;
private boolean loading;
public AdapterWizardPageModel(ImportProjectWizardModel wizardModel) {
@@ -49,7 +47,7 @@
public void loadGitUri() throws OpenShiftException {
setLoading(true);
- setGitUri(null);
+ setGitUri("Loading...");
setGitUri(getGitUri());
setLoading(false);
}
@@ -68,7 +66,7 @@
public void loadApplicationUrl() throws OpenShiftException {
setLoading(true);
- setApplicationUrl(null);
+ setApplicationUrl("Loading...");
setApplicationUrl(getApplicationUrl());
setLoading(false);
}
Added: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/ValueBindingBuilder.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/ValueBindingBuilder.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/ValueBindingBuilder.java 2011-10-20 13:38:27 UTC (rev 35842)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.ui.databinding;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.runtime.Assert;
+
+/**
+ *
+ * A builder that offers a nice(r) semantic to build bindings.
+ *
+ * @author André Dietisheim
+ * @see DataBindingContext#bindValue(IObservableValue, IObservableValue)
+ *
+ */
+public class ValueBindingBuilder {
+
+ public static TargetDefinition bind(IObservableValue target) {
+ return new TargetDefinition(target);
+ }
+
+ private static Binding bind(TargetDefinition targetDefinition, ModelDefinition modelDefinition,
+ DataBindingContext dbc) {
+ return dbc.bindValue(
+ targetDefinition.getObservable()
+ , modelDefinition.getObservable()
+ , targetDefinition.getStrategy()
+ , modelDefinition.getStrategy());
+ }
+
+ private abstract static class BindingParticipantDefinition<PARTICIPANT> {
+
+ private IObservableValue observable;
+ private UpdateValueStrategy strategy;
+
+ public BindingParticipantDefinition(IObservableValue observable) {
+ this.observable = observable;
+ }
+
+ public PARTICIPANT withoutUpdate() {
+ return withStrategy(new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
+ }
+
+ @SuppressWarnings("unchecked")
+ public PARTICIPANT withStrategy(UpdateValueStrategy strategy) {
+ this.strategy = strategy;
+ return (PARTICIPANT) this;
+ }
+
+ protected void assertObservable(String message) {
+ Assert.isLegal(this.observable != null, message);
+ }
+
+ public IObservableValue getObservable() {
+ return observable;
+ }
+
+ public UpdateValueStrategy getStrategy() {
+ return strategy;
+ }
+ }
+
+ public static class TargetDefinition extends BindingParticipantDefinition<TargetDefinition> {
+
+ public TargetDefinition(IObservableValue target) {
+ super(target);
+ }
+
+ public ModelDefinition to(IObservableValue model) {
+ assertObservable("You have to set the target first. call #bind(target).");
+ return new ModelDefinition(model, this);
+ }
+
+ }
+
+ public static class ModelDefinition extends BindingParticipantDefinition<ModelDefinition> {
+
+ private TargetDefinition targetDefinition;
+
+ public ModelDefinition(IObservableValue model, TargetDefinition targetDefinition) {
+ super(model);
+ this.targetDefinition = targetDefinition;
+ }
+
+ public Binding using(DataBindingContext dbc) {
+ return bind(targetDefinition, this, dbc);
+ }
+ }
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/ValueBindingBuilder.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 2 months
JBoss Tools SVN: r35841 - trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-10-20 09:03:18 -0400 (Thu, 20 Oct 2011)
New Revision: 35841
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
Log:
https://issues.jboss.org/browse/JBIDE-9559
Rebuild class loader to clear cached user classes
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2011-10-20 12:16:25 UTC (rev 35840)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2011-10-20 13:03:18 UTC (rev 35841)
@@ -78,18 +78,26 @@
public ConsoleConfigurationPreferences prefs = null;
/**
- * Reset so a new configuration or sessionfactory is needed.
+ * Reset configuration, session factory, class loader and execution context.
*
*/
public boolean reset() {
- boolean res = false;
- // reseting state
+ boolean resetted = false;
if (configuration != null) {
configuration = null;
- res = true;
+ resetted = true;
}
- boolean tmp = closeSessionFactory();
- res = res || tmp;
+ resetted = resetted | closeSessionFactory() | cleanUpClassLoader();
+
+ if (resetted) {
+ fireConfigurationReset();
+ }
+ executionContext = null;
+ return resetted;
+ }
+
+ protected boolean cleanUpClassLoader() {
+ boolean resetted = false;
if (executionContext != null) {
executionContext.execute(new Command() {
public Object execute() {
@@ -107,59 +115,34 @@
}
if (fakeDrivers.size() > 0) {
fakeDrivers.clear();
- res = true;
+ resetted = true;
}
- tmp = cleanUpClassLoader();
- res = res || tmp;
- if (res) {
- fireConfigurationReset();
- }
- executionContext = null;
- return res;
- }
-
- protected boolean cleanUpClassLoader() {
- boolean res = false;
ClassLoader classLoaderTmp = classLoader;
while (classLoaderTmp != null) {
if (classLoaderTmp instanceof ConsoleConfigClassLoader) {
((ConsoleConfigClassLoader)classLoaderTmp).close();
- res = true;
+ resetted = true;
}
classLoaderTmp = classLoaderTmp.getParent();
}
if (classLoader != null) {
classLoader = null;
- res = true;
+ resetted = true;
}
- return res;
+ return resetted;
}
/**
* Create class loader - so it uses the original urls list from preferences.
*/
protected void reinitClassLoader() {
- boolean recreateFlag = true;
+ //the class loader caches user's compiled classes
+ //need to rebuild it on every console configuration rebuild to pick up latest versions.
final URL[] customClassPathURLs = PreferencesClassPathUtils.getCustomClassPathURLs(prefs);
- if (classLoader != null) {
- // check -> do not recreate class loader in case if urls list is the same
- final URL[] oldURLS = classLoader.getURLs();
- if (customClassPathURLs.length == oldURLS.length) {
- int i = 0;
- for (; i < oldURLS.length; i++) {
- if (!customClassPathURLs[i].sameFile(oldURLS[i])) {
- break;
- }
- }
- if (i == oldURLS.length) {
- recreateFlag = false;
- }
- }
- }
- if (recreateFlag) {
- reset();
- classLoader = createClassLoader(customClassPathURLs);
- }
+ //we could call cleanUpClassLoader() here if we don't want to release configuration field
+ //but in case user changed java sources it is not in a good state any more, so call reset.
+ reset();
+ classLoader = createClassLoader(customClassPathURLs);
}
public void build() {
@@ -391,21 +374,22 @@
}
public boolean closeSessionFactory() {
- boolean res = false;
+ boolean resetted = false;
if (sessionFactory != null) {
fireFactoryClosing(sessionFactory);
sessionFactory.close();
sessionFactory = null;
- res = true;
+ resetted = true;
}
- return res;
+ return resetted;
}
public Settings getSettings(final Configuration cfg) {
return (Settings) execute(new Command() {
- public Object execute() {
- return cfg.buildSettings();
+ public Object execute() {
+ return cfg.buildSettings();
+ }
}
- });
+ );
}
-}
\ No newline at end of file
+}
13 years, 2 months
JBoss Tools SVN: r35840 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-10-20 08:16:25 -0400 (Thu, 20 Oct 2011)
New Revision: 35840
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
Log:
https://issues.jboss.org/browse/JBIDE-9559
Revert changes
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2011-10-20 12:06:40 UTC (rev 35839)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2011-10-20 12:16:25 UTC (rev 35840)
@@ -19,7 +19,6 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
-import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
@@ -56,7 +55,6 @@
ILaunchConfigurationWorkingCopy wc = HibernateJpaPlatformUi.createDefaultLaunchConfig(projectName);
if (wc != null) {
String concoleConfigurationName = initPage.getConfigurationName();
- resetConsoleConfiguration(concoleConfigurationName);
wc.setAttribute(HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME, concoleConfigurationName);
wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR, initPage.getOutputDir());
@@ -80,13 +78,4 @@
}
return true;
}
-
- protected void resetConsoleConfiguration(String concoleConfigurationName){
- if (!initPage.isTemporaryConfiguration()){
- ConsoleConfiguration cc = KnownConfigurations.getInstance().find(concoleConfigurationName);
- if (cc.hasConfiguration()){
- cc.reset();
- }
- }
- }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2011-10-20 12:06:40 UTC (rev 35839)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2011-10-20 12:16:25 UTC (rev 35840)
@@ -16,7 +16,6 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
-import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
@@ -54,8 +53,7 @@
ILaunchConfigurationWorkingCopy wc = HibernateJpaPlatformUi.createDefaultLaunchConfig(projectName);
if (wc != null) {
// SHOULD PRESENT THE CONFIGURATION!!!
- String concoleConfigurationName = initPage.getConfigurationName();
- resetConsoleConfiguration(concoleConfigurationName);
+ String concoleConfigurationName = initPage.getConfigurationName();
wc.setAttribute(HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME, concoleConfigurationName);
wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR, initPage.getOutputDir());
@@ -84,14 +82,5 @@
}
return true;
}
-
- protected void resetConsoleConfiguration(String concoleConfigurationName){
- if (!initPage.isTemporaryConfiguration()){
- ConsoleConfiguration cc = KnownConfigurations.getInstance().find(concoleConfigurationName);
- if (cc.hasConfiguration()){
- cc.reset();
- }
- }
- }
}
13 years, 2 months
JBoss Tools SVN: r35839 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-20 08:06:40 -0400 (Thu, 20 Oct 2011)
New Revision: 35839
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
Log:
added authors
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-20 11:59:32 UTC (rev 35838)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-20 12:06:40 UTC (rev 35839)
@@ -29,7 +29,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
@@ -63,7 +62,6 @@
import org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
-import org.jboss.ide.eclipse.as.ui.UIUtil;
import org.jboss.tools.common.ui.databinding.DataBindingUtils;
import org.jboss.tools.common.ui.databinding.InvertingBooleanConverter;
import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
@@ -71,6 +69,11 @@
import org.jboss.tools.openshift.express.client.OpenShiftException;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+/**
+ * @author André Dietisheim
+ * @author Rob Stryker
+ *
+ */
public class AdapterWizardPage extends AbstractOpenShiftWizardPage implements IWizardPage, PropertyChangeListener {
private Text gitUriValueText;
13 years, 2 months
JBoss Tools SVN: r35838 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-20 07:59:32 -0400 (Thu, 20 Oct 2011)
New Revision: 35838
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
Log:
[JBIDE-9947] corrected layout and adapter validation
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-20 10:58:03 UTC (rev 35837)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-20 11:59:32 UTC (rev 35838)
@@ -18,7 +18,6 @@
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.beans.BeanProperties;
-import org.eclipse.core.databinding.conversion.Converter;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -30,6 +29,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
@@ -43,7 +43,6 @@
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
@@ -79,8 +78,8 @@
private Combo suitableRuntimesCombo;
private IServerType serverTypeToCreate;
private IRuntime runtimeDelegate;
- private Label domainLabel;
- private Label modeLabel;
+ private Label domainValueLabel;
+ private Label modeValueLabel;
private Link addRuntimeLink;
private Label runtimeLabel;
private Button serverAdapterCheckbox;
@@ -288,13 +287,14 @@
suitableRuntimesCombo.setEnabled(enabled);
runtimeLabel.setEnabled(enabled);
addRuntimeLink.setEnabled(enabled);
- // domainLabel.setEnabled(enabled);
- modeLabel.setEnabled(enabled);
+ domainValueLabel.setEnabled(enabled);
+ modeValueLabel.setEnabled(enabled);
}
private void fillServerAdapterGroup(Group serverAdapterGroup) {
Composite c = new Composite(serverAdapterGroup, SWT.NONE);
- c.setLayout(new FormLayout());
+ GridLayoutFactory.fillDefaults().numColumns(3).margins(6, 6).spacing(12, 8).applyTo(c);
+
serverAdapterCheckbox = new Button(c, SWT.CHECK);
serverAdapterCheckbox.setText("Create a JBoss server adapter");
serverAdapterCheckbox.addSelectionListener(new SelectionListener() {
@@ -309,32 +309,25 @@
});
runtimeLabel = new Label(c, SWT.NONE);
- runtimeLabel.setText("Local Runtime: ");
+ runtimeLabel.setText("Local Runtime");
suitableRuntimesCombo = new Combo(c, SWT.READ_ONLY);
addRuntimeLink = new Link(c, SWT.NONE);
addRuntimeLink.setText("<a>" + Messages.addRuntime + "</a>");
- domainLabel = new Label(c, SWT.NONE);
+ Label domainLabel = new Label(c, SWT.NONE);
+ domainLabel.setText("Host");
+ domainValueLabel = new Label(c, SWT.NONE);
DataBindingContext dbc = getDatabindingContext();
dbc.bindValue(
- WidgetProperties.text().observe(domainLabel)
+ WidgetProperties.text().observe(domainValueLabel)
, BeanProperties.value(AdapterWizardPageModel.PROPERTY_APPLICATION_URL).observe(model)
, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER)
- , new UpdateValueStrategy().setConverter(new Converter(String.class, String.class) {
-
- @Override
- public Object convert(Object fromObject) {
- String host = "";
- if (fromObject instanceof String && ((String) fromObject).length() > 0) {
- host = (String) fromObject;
- }
- return "Host: " + host;
- }
-
- }));
+ , null);
// appLabel = new Label(c, SWT.NONE);
- modeLabel = new Label(c, SWT.NONE);
+ Label modeLabel = new Label(c, SWT.NONE);
+ modeLabel.setText("Mode");
+ modeValueLabel = new Label(c, SWT.NONE);
suitableRuntimesCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
@@ -344,26 +337,28 @@
addRuntimeLink.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
IRuntimeType type = getValidRuntimeType();
- if (type != null) {
- int result = showRuntimeWizard(type);
- if( result == Window.OK ) {
- suitableRuntimesCombo.select(0);
- selectedRuntimeObservable.setValue(0);
- updateSelectedRuntimeDelegate();
- }
- }
+ if (type != null)
+ showRuntimeWizard(type);
}
});
- serverAdapterCheckbox.setLayoutData(UIUtil.createFormData2(0, 5, null, 0, 0, 5, null, 0));
- runtimeLabel.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, 0, 5, null, 0));
- addRuntimeLink.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, null, 0, 100, -5));
- suitableRuntimesCombo.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, runtimeLabel, 5,
- addRuntimeLink, -5));
- domainLabel.setLayoutData(UIUtil.createFormData2(suitableRuntimesCombo, 5, null, 0, 0, 5, 100, 0));
- // appLabel.setLayoutData(UIUtil.createFormData2(domainLabel, 5, null,
- // 0, 0, 5, 100, 0));
- modeLabel.setLayoutData(UIUtil.createFormData2(domainLabel, 5, null, 0, 0, 5, 100, 0));
+ GridDataFactory.fillDefaults()
+ .span(3, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(serverAdapterCheckbox);
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(runtimeLabel);
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(runtimeLabel);
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(suitableRuntimesCombo);
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(domainLabel);
+ GridDataFactory.fillDefaults()
+ .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(domainValueLabel);
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(modeLabel);
+ GridDataFactory.fillDefaults()
+ .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(modeValueLabel);
+
model.getParentModel().setProperty(AdapterWizardPageModel.CREATE_SERVER,
serverAdapterCheckbox.getSelection());
@@ -374,13 +369,16 @@
this.serverAdapterCheckboxObservable =
WidgetProperties.selection().observe(serverAdapterCheckbox);
- dbc.addValidationStatusProvider(new SelectedRuntimeValidator());
+ SelectedRuntimeValidator selectedRuntimeValidator = new SelectedRuntimeValidator();
+ dbc.addValidationStatusProvider(selectedRuntimeValidator);
+
+// ControlDecorationSupport.create(selectedRuntimeValidator, SWT.TOP | SWT.LEFT);
}
private void updateSelectedRuntimeDelegate() {
- if (suitableRuntimesCombo.getSelectionIndex() != -1) {
- runtimeDelegate = ServerCore.findRuntime(suitableRuntimesCombo.getItem(suitableRuntimesCombo
- .getSelectionIndex()));
+ if (!(new Integer(-1).equals(selectedRuntimeObservable.getValue()))) {
+ String selectedRuntimeName = (String) suitableRuntimesObservable.get((Integer) selectedRuntimeObservable.getValue());
+ runtimeDelegate = ServerCore.findRuntime(selectedRuntimeName);
} else {
runtimeDelegate = null;
}
@@ -413,13 +411,13 @@
return validRuntimes.toArray(new IRuntime[validRuntimes.size()]);
}
- private void fillRuntimeCombo(Combo combo, IRuntime[] runtimes) {
+ private void fillRuntimeCombo(IRuntime[] runtimes) {
+ suitableRuntimesObservable.clear();
String[] names = new String[runtimes.length];
for (int i = 0; i < runtimes.length; i++) {
names[i] = runtimes[i].getName();
suitableRuntimesObservable.add(runtimes[i].getName());
}
- combo.setItems(names);
}
protected void onPageActivated(DataBindingContext dbc) {
@@ -428,18 +426,16 @@
serverTypeToCreate = getServerTypeToCreate();
model.getParentModel().setProperty(AdapterWizardPageModel.SERVER_TYPE, serverTypeToCreate);
refreshValidRuntimes();
- if (suitableRuntimesCombo.getItemCount() > 0) {
- suitableRuntimesCombo.select(0);
+ if (suitableRuntimesObservable.size() > 0) {
selectedRuntimeObservable.setValue(0);
updateSelectedRuntimeDelegate();
}
+
IRuntimeType type = getValidRuntimeType();
addRuntimeLink.setEnabled(type != null);
- modeLabel.setText("Mode: Source");
+ modeValueLabel.setText("Source");
model.getParentModel().setProperty(AdapterWizardPageModel.MODE, AdapterWizardPageModel.MODE_SOURCE);
- setPageComplete(false);
- getWizard().getContainer().updateButtons();
onPageActivatedBackground(dbc);
}
@@ -461,9 +457,10 @@
IRuntimeType type = getValidRuntimeType();
if (type != null) {
IRuntime[] runtimes = getRuntimesOfType(type.getId());
- fillRuntimeCombo(suitableRuntimesCombo, runtimes);
+ fillRuntimeCombo(runtimes);
} else {
- suitableRuntimesCombo.setItems(new String[0]);
+// suitableRuntimesCombo.setItems(new String[0]);
+ selectedRuntimeObservable.setValue(0);
}
}
13 years, 2 months
JBoss Tools SVN: r35837 - in trunk/as/plugins: org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-10-20 06:58:03 -0400 (Thu, 20 Oct 2011)
New Revision: 35837
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
Log:
trunk - cleanup for astools including runtime validation in the new openshift proj wizard, synchronized state, second message box for forced push, etc
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java 2011-10-20 10:57:03 UTC (rev 35836)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java 2011-10-20 10:58:03 UTC (rev 35837)
@@ -459,13 +459,13 @@
IteratorService.createInitialIterator(repo));
indexDiff.diff(jgitMonitor, 0, 0, NLS.bind(
UIText.CommitActionHandler_repository, repo.getDirectory().getPath()));
- System.out.println(indexDiff.getAdded().size());
- System.out.println(indexDiff.getChanged().size());
- System.out.println(indexDiff.getConflicting().size());
- System.out.println(indexDiff.getMissing().size());
- System.out.println(indexDiff.getModified().size());
- System.out.println(indexDiff.getRemoved().size());
- System.out.println(indexDiff.getUntracked().size());
+// System.out.println(indexDiff.getAdded().size());
+// System.out.println(indexDiff.getChanged().size());
+// System.out.println(indexDiff.getConflicting().size());
+// System.out.println(indexDiff.getMissing().size());
+// System.out.println(indexDiff.getModified().size());
+// System.out.println(indexDiff.getRemoved().size());
+// System.out.println(indexDiff.getUntracked().size());
return indexDiff.getModified().size();
} catch( IOException ioe ) {
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2011-10-20 10:57:03 UTC (rev 35836)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2011-10-20 10:58:03 UTC (rev 35837)
@@ -44,26 +44,43 @@
int state = behaviour.getServer().getModulePublishState(module);
IProject p = module[module.length-1].getProject();
int changed = EGitUtils.countCommitableChanges(p, new NullProgressMonitor() );
- if( changed != 0 && (kind == IServer.PUBLISH_FULL || state == IServer.PUBLISH_STATE_FULL)) {
- if( requestApproval(module)) {
+ if( changed == 0 || (kind == IServer.PUBLISH_FULL || state == IServer.PUBLISH_STATE_FULL)) {
+ if( changed != 0 && requestCommitAndPushApproval(module)) {
monitor.beginTask("Publishing " + p.getName(), 200);
EGitUtils.commit(p, new SubProgressMonitor(monitor, 100));
EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
- return IServer.PUBLISH_STATE_NONE;
+ monitor.done();
+ } else if( changed == 0 && requestPushApproval(module)) {
+ monitor.beginTask("Publishing " + p.getName(), 100);
+ EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
+ monitor.done();
}
+ return IServer.PUBLISH_STATE_NONE;
}
return IServer.PUBLISH_STATE_INCREMENTAL;
}
- private boolean requestApproval(final IModule[] module) {
+ private boolean requestCommitAndPushApproval(final IModule[] module) {
+ String projName = module[module.length-1].getProject().getName();
+ String msg = "Do you wish to publish \"" + projName + "\" to OpenShift by commiting and pushing its git repository?";
+ String title = "Publish " + projName + "?";
+ return requestApproval(module, msg, title);
+ }
+
+ private boolean requestPushApproval(final IModule[] module) {
+ String projName = module[module.length-1].getProject().getName();
+ String msg = "Do you wish to publish \"" + projName + "\" to OpenShift by pushing its git repository?";
+ String title = "Publish " + projName + "?";
+ return requestApproval(module, msg, title);
+ }
+
+ private boolean requestApproval(final IModule[] module, final String message, final String title) {
final boolean[] b = new boolean[1];
Display.getDefault().syncExec(new Runnable() {
public void run() {
MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
- String projName = module[module.length-1].getProject().getName();
- String msg = "Do you wish to publish \"" + projName + "\" to OpenShift by commiting and pushing it's git repository?";
- messageBox.setMessage(msg);
- messageBox.setText("Publish " + projName + "?");
+ messageBox.setMessage(message);
+ messageBox.setText(title);
int response = messageBox.open();
if (response == SWT.YES)
b[0] = true;
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-20 10:57:03 UTC (rev 35836)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-20 10:58:03 UTC (rev 35837)
@@ -344,8 +344,14 @@
addRuntimeLink.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
IRuntimeType type = getValidRuntimeType();
- if (type != null)
- showRuntimeWizard(type);
+ if (type != null) {
+ int result = showRuntimeWizard(type);
+ if( result == Window.OK ) {
+ suitableRuntimesCombo.select(0);
+ selectedRuntimeObservable.setValue(0);
+ updateSelectedRuntimeDelegate();
+ }
+ }
}
});
@@ -411,6 +417,7 @@
String[] names = new String[runtimes.length];
for (int i = 0; i < runtimes.length; i++) {
names[i] = runtimes[i].getName();
+ suitableRuntimesObservable.add(runtimes[i].getName());
}
combo.setItems(names);
}
@@ -423,6 +430,7 @@
refreshValidRuntimes();
if (suitableRuntimesCombo.getItemCount() > 0) {
suitableRuntimesCombo.select(0);
+ selectedRuntimeObservable.setValue(0);
updateSelectedRuntimeDelegate();
}
IRuntimeType type = getValidRuntimeType();
13 years, 2 months
JBoss Tools SVN: r35836 - in branches/jbosstools-3.3.0.M4/as/plugins: org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-10-20 06:57:03 -0400 (Thu, 20 Oct 2011)
New Revision: 35836
Modified:
branches/jbosstools-3.3.0.M4/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java
branches/jbosstools-3.3.0.M4/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
branches/jbosstools-3.3.0.M4/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
Log:
Last minute cleanup for astools including runtime validation in the new openshift proj wizard, synchronized state, second message box for forced push, etc
Modified: branches/jbosstools-3.3.0.M4/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java
===================================================================
--- branches/jbosstools-3.3.0.M4/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java 2011-10-20 10:16:20 UTC (rev 35835)
+++ branches/jbosstools-3.3.0.M4/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java 2011-10-20 10:57:03 UTC (rev 35836)
@@ -459,13 +459,6 @@
IteratorService.createInitialIterator(repo));
indexDiff.diff(jgitMonitor, 0, 0, NLS.bind(
UIText.CommitActionHandler_repository, repo.getDirectory().getPath()));
- System.out.println(indexDiff.getAdded().size());
- System.out.println(indexDiff.getChanged().size());
- System.out.println(indexDiff.getConflicting().size());
- System.out.println(indexDiff.getMissing().size());
- System.out.println(indexDiff.getModified().size());
- System.out.println(indexDiff.getRemoved().size());
- System.out.println(indexDiff.getUntracked().size());
return indexDiff.getModified().size();
} catch( IOException ioe ) {
Modified: branches/jbosstools-3.3.0.M4/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
===================================================================
--- branches/jbosstools-3.3.0.M4/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2011-10-20 10:16:20 UTC (rev 35835)
+++ branches/jbosstools-3.3.0.M4/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2011-10-20 10:57:03 UTC (rev 35836)
@@ -44,26 +44,43 @@
int state = behaviour.getServer().getModulePublishState(module);
IProject p = module[module.length-1].getProject();
int changed = EGitUtils.countCommitableChanges(p, new NullProgressMonitor() );
- if( changed != 0 && (kind == IServer.PUBLISH_FULL || state == IServer.PUBLISH_STATE_FULL)) {
- if( requestApproval(module)) {
+ if( changed == 0 || (kind == IServer.PUBLISH_FULL || state == IServer.PUBLISH_STATE_FULL)) {
+ if( changed != 0 && requestCommitAndPushApproval(module)) {
monitor.beginTask("Publishing " + p.getName(), 200);
EGitUtils.commit(p, new SubProgressMonitor(monitor, 100));
EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
- return IServer.PUBLISH_STATE_NONE;
+ monitor.done();
+ } else if( changed == 0 && requestPushApproval(module)) {
+ monitor.beginTask("Publishing " + p.getName(), 100);
+ EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
+ monitor.done();
}
+ return IServer.PUBLISH_STATE_NONE;
}
return IServer.PUBLISH_STATE_INCREMENTAL;
}
- private boolean requestApproval(final IModule[] module) {
+ private boolean requestCommitAndPushApproval(final IModule[] module) {
+ String projName = module[module.length-1].getProject().getName();
+ String msg = "Do you wish to publish \"" + projName + "\" to OpenShift by commiting and pushing its git repository?";
+ String title = "Publish " + projName + "?";
+ return requestApproval(module, msg, title);
+ }
+
+ private boolean requestPushApproval(final IModule[] module) {
+ String projName = module[module.length-1].getProject().getName();
+ String msg = "Do you wish to publish \"" + projName + "\" to OpenShift by pushing its git repository?";
+ String title = "Publish " + projName + "?";
+ return requestApproval(module, msg, title);
+ }
+
+ private boolean requestApproval(final IModule[] module, final String message, final String title) {
final boolean[] b = new boolean[1];
Display.getDefault().syncExec(new Runnable() {
public void run() {
MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
- String projName = module[module.length-1].getProject().getName();
- String msg = "Do you wish to publish \"" + projName + "\" to OpenShift by commiting and pushing it's git repository?";
- messageBox.setMessage(msg);
- messageBox.setText("Publish " + projName + "?");
+ messageBox.setMessage(message);
+ messageBox.setText(title);
int response = messageBox.open();
if (response == SWT.YES)
b[0] = true;
Modified: branches/jbosstools-3.3.0.M4/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
--- branches/jbosstools-3.3.0.M4/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-20 10:16:20 UTC (rev 35835)
+++ branches/jbosstools-3.3.0.M4/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-20 10:57:03 UTC (rev 35836)
@@ -19,9 +19,11 @@
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.beans.BeanProperties;
import org.eclipse.core.databinding.conversion.Converter;
+import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.MultiValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -74,7 +76,7 @@
private Text gitUriValueText;
private AdapterWizardPageModel model;
- private Combo suitableRuntimes;
+ private Combo suitableRuntimesCombo;
private IServerType serverTypeToCreate;
private IRuntime runtimeDelegate;
private Label domainLabel;
@@ -83,6 +85,10 @@
private Label runtimeLabel;
private Button serverAdapterCheckbox;
+ private IObservableValue serverAdapterCheckboxObservable;
+ private IObservableValue selectedRuntimeObservable;
+ private IObservableList suitableRuntimesObservable;
+
public AdapterWizardPage(ImportProjectWizard wizard, ImportProjectWizardModel model) {
super(
"Import Project",
@@ -102,7 +108,7 @@
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(projectGroup);
- Group serverAdapterGroup = createAdapterGroup(parent);
+ Group serverAdapterGroup = createAdapterGroup(parent, dbc);
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(serverAdapterGroup);
}
@@ -266,7 +272,7 @@
};
}
- private Group createAdapterGroup(Composite parent) {
+ private Group createAdapterGroup(Composite parent, DataBindingContext dbc) {
Group serverAdapterGroup = new Group(parent, SWT.BORDER);
serverAdapterGroup.setText("JBoss Server adapter");
FillLayout fillLayout = new FillLayout();
@@ -279,7 +285,7 @@
}
protected void enableServerWidgets(boolean enabled) {
- suitableRuntimes.setEnabled(enabled);
+ suitableRuntimesCombo.setEnabled(enabled);
runtimeLabel.setEnabled(enabled);
addRuntimeLink.setEnabled(enabled);
// domainLabel.setEnabled(enabled);
@@ -291,12 +297,11 @@
c.setLayout(new FormLayout());
serverAdapterCheckbox = new Button(c, SWT.CHECK);
serverAdapterCheckbox.setText("Create a JBoss server adapter");
- final Button serverAdapterCheckbox2 = serverAdapterCheckbox;
serverAdapterCheckbox.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
model.getParentModel().setProperty(AdapterWizardPageModel.CREATE_SERVER,
- serverAdapterCheckbox2.getSelection());
- enableServerWidgets(serverAdapterCheckbox2.getSelection());
+ serverAdapterCheckbox.getSelection());
+ enableServerWidgets(serverAdapterCheckbox.getSelection());
}
public void widgetDefaultSelected(SelectionEvent e) {
@@ -306,7 +311,7 @@
runtimeLabel = new Label(c, SWT.NONE);
runtimeLabel.setText("Local Runtime: ");
- suitableRuntimes = new Combo(c, SWT.READ_ONLY);
+ suitableRuntimesCombo = new Combo(c, SWT.READ_ONLY);
addRuntimeLink = new Link(c, SWT.NONE);
addRuntimeLink.setText("<a>" + Messages.addRuntime + "</a>");
@@ -331,7 +336,7 @@
// appLabel = new Label(c, SWT.NONE);
modeLabel = new Label(c, SWT.NONE);
- suitableRuntimes.addModifyListener(new ModifyListener() {
+ suitableRuntimesCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateSelectedRuntimeDelegate();
}
@@ -339,28 +344,43 @@
addRuntimeLink.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
IRuntimeType type = getValidRuntimeType();
- if (type != null)
- showRuntimeWizard(type);
+ if (type != null) {
+ int result = showRuntimeWizard(type);
+ if( result == Window.OK ) {
+ suitableRuntimesCombo.select(0);
+ selectedRuntimeObservable.setValue(0);
+ updateSelectedRuntimeDelegate();
+ }
+ }
}
});
serverAdapterCheckbox.setLayoutData(UIUtil.createFormData2(0, 5, null, 0, 0, 5, null, 0));
runtimeLabel.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, 0, 5, null, 0));
addRuntimeLink.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, null, 0, 100, -5));
- suitableRuntimes.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, runtimeLabel, 5,
+ suitableRuntimesCombo.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, runtimeLabel, 5,
addRuntimeLink, -5));
- domainLabel.setLayoutData(UIUtil.createFormData2(suitableRuntimes, 5, null, 0, 0, 5, 100, 0));
+ domainLabel.setLayoutData(UIUtil.createFormData2(suitableRuntimesCombo, 5, null, 0, 0, 5, 100, 0));
// appLabel.setLayoutData(UIUtil.createFormData2(domainLabel, 5, null,
// 0, 0, 5, 100, 0));
modeLabel.setLayoutData(UIUtil.createFormData2(domainLabel, 5, null, 0, 0, 5, 100, 0));
- serverAdapterCheckbox.setSelection(true);
model.getParentModel().setProperty(AdapterWizardPageModel.CREATE_SERVER,
- serverAdapterCheckbox2.getSelection());
+ serverAdapterCheckbox.getSelection());
+
+ this.selectedRuntimeObservable =
+ WidgetProperties.singleSelectionIndex().observe(suitableRuntimesCombo);
+ this.suitableRuntimesObservable =
+ WidgetProperties.items().observe(suitableRuntimesCombo);
+ this.serverAdapterCheckboxObservable =
+ WidgetProperties.selection().observe(serverAdapterCheckbox);
+
+ dbc.addValidationStatusProvider(new SelectedRuntimeValidator());
}
private void updateSelectedRuntimeDelegate() {
- if (suitableRuntimes.getSelectionIndex() != -1) {
- runtimeDelegate = ServerCore.findRuntime(suitableRuntimes.getItem(suitableRuntimes.getSelectionIndex()));
+ if (suitableRuntimesCombo.getSelectionIndex() != -1) {
+ runtimeDelegate = ServerCore.findRuntime(suitableRuntimesCombo.getItem(suitableRuntimesCombo
+ .getSelectionIndex()));
} else {
runtimeDelegate = null;
}
@@ -397,6 +417,7 @@
String[] names = new String[runtimes.length];
for (int i = 0; i < runtimes.length; i++) {
names[i] = runtimes[i].getName();
+ suitableRuntimesObservable.add(runtimes[i].getName());
}
combo.setItems(names);
}
@@ -407,8 +428,9 @@
serverTypeToCreate = getServerTypeToCreate();
model.getParentModel().setProperty(AdapterWizardPageModel.SERVER_TYPE, serverTypeToCreate);
refreshValidRuntimes();
- if (suitableRuntimes.getItemCount() > 0) {
- suitableRuntimes.select(0);
+ if (suitableRuntimesCombo.getItemCount() > 0) {
+ suitableRuntimesCombo.select(0);
+ selectedRuntimeObservable.setValue(0);
updateSelectedRuntimeDelegate();
}
IRuntimeType type = getValidRuntimeType();
@@ -439,9 +461,9 @@
IRuntimeType type = getValidRuntimeType();
if (type != null) {
IRuntime[] runtimes = getRuntimesOfType(type.getId());
- fillRuntimeCombo(suitableRuntimes, runtimes);
+ fillRuntimeCombo(suitableRuntimesCombo, runtimes);
} else {
- suitableRuntimes.setItems(new String[0]);
+ suitableRuntimesCombo.setItems(new String[0]);
}
}
@@ -473,8 +495,8 @@
refreshValidRuntimes();
if (returnValue != Window.CANCEL) {
IRuntime rt = (IRuntime) taskModel.getObject(TaskModel.TASK_RUNTIME);
- if (rt != null && rt.getName() != null && suitableRuntimes.indexOf(rt.getName()) != -1) {
- suitableRuntimes.select(suitableRuntimes.indexOf(rt.getName()));
+ if (rt != null && rt.getName() != null && suitableRuntimesCombo.indexOf(rt.getName()) != -1) {
+ suitableRuntimesCombo.select(suitableRuntimesCombo.indexOf(rt.getName()));
}
}
return returnValue;
@@ -493,11 +515,34 @@
serverTypeToCreate = getServerTypeToCreate();
boolean canCreateServer = serverTypeToCreate != null;
serverAdapterCheckbox.setEnabled(canCreateServer);
- serverAdapterCheckbox.setSelection(canCreateServer);
+ // serverAdapterCheckbox.setSelection(canCreateServer);
+ serverAdapterCheckboxObservable.setValue(true);
enableServerWidgets(canCreateServer);
refreshValidRuntimes();
model.getParentModel().setProperty(AdapterWizardPageModel.SERVER_TYPE, serverTypeToCreate);
model.getParentModel().setProperty(AdapterWizardPageModel.CREATE_SERVER, canCreateServer);
}
+ private class SelectedRuntimeValidator extends MultiValidator {
+
+ @Override
+ protected IStatus validate() {
+ /**
+ * WARNING: it is important to evaluate the validation state on
+ * behalf of observable values (not widgets!). The multi validator
+ * is tracking what observables are read to know when he has to
+ * recalculate it's state.
+ */
+ if (Boolean.FALSE.equals(serverAdapterCheckboxObservable.getValue())) {
+ return ValidationStatus.ok();
+ }
+ if (new Integer(-1).equals(selectedRuntimeObservable.getValue())) {
+ if (suitableRuntimesObservable.size() == 0) {
+ return ValidationStatus.error("Please add a new valid runtime.");
+ }
+ return ValidationStatus.error("Please select a runtime");
+ }
+ return ValidationStatus.ok();
+ }
+ }
}
13 years, 2 months
JBoss Tools SVN: r35834 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-20 05:13:05 -0400 (Thu, 20 Oct 2011)
New Revision: 35834
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
Log:
[JBIDE-9947] fixed validation of the server adapter group
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-20 08:56:00 UTC (rev 35833)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-20 09:13:05 UTC (rev 35834)
@@ -19,9 +19,11 @@
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.beans.BeanProperties;
import org.eclipse.core.databinding.conversion.Converter;
+import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.MultiValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -74,7 +76,7 @@
private Text gitUriValueText;
private AdapterWizardPageModel model;
- private Combo suitableRuntimes;
+ private Combo suitableRuntimesCombo;
private IServerType serverTypeToCreate;
private IRuntime runtimeDelegate;
private Label domainLabel;
@@ -83,6 +85,10 @@
private Label runtimeLabel;
private Button serverAdapterCheckbox;
+ private IObservableValue serverAdapterCheckboxObservable;
+ private IObservableValue selectedRuntimeObservable;
+ private IObservableList suitableRuntimesObservable;
+
public AdapterWizardPage(ImportProjectWizard wizard, ImportProjectWizardModel model) {
super(
"Import Project",
@@ -102,7 +108,7 @@
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(projectGroup);
- Group serverAdapterGroup = createAdapterGroup(parent);
+ Group serverAdapterGroup = createAdapterGroup(parent, dbc);
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(serverAdapterGroup);
}
@@ -266,7 +272,7 @@
};
}
- private Group createAdapterGroup(Composite parent) {
+ private Group createAdapterGroup(Composite parent, DataBindingContext dbc) {
Group serverAdapterGroup = new Group(parent, SWT.BORDER);
serverAdapterGroup.setText("JBoss Server adapter");
FillLayout fillLayout = new FillLayout();
@@ -279,7 +285,7 @@
}
protected void enableServerWidgets(boolean enabled) {
- suitableRuntimes.setEnabled(enabled);
+ suitableRuntimesCombo.setEnabled(enabled);
runtimeLabel.setEnabled(enabled);
addRuntimeLink.setEnabled(enabled);
// domainLabel.setEnabled(enabled);
@@ -291,12 +297,11 @@
c.setLayout(new FormLayout());
serverAdapterCheckbox = new Button(c, SWT.CHECK);
serverAdapterCheckbox.setText("Create a JBoss server adapter");
- final Button serverAdapterCheckbox2 = serverAdapterCheckbox;
serverAdapterCheckbox.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
model.getParentModel().setProperty(AdapterWizardPageModel.CREATE_SERVER,
- serverAdapterCheckbox2.getSelection());
- enableServerWidgets(serverAdapterCheckbox2.getSelection());
+ serverAdapterCheckbox.getSelection());
+ enableServerWidgets(serverAdapterCheckbox.getSelection());
}
public void widgetDefaultSelected(SelectionEvent e) {
@@ -306,7 +311,7 @@
runtimeLabel = new Label(c, SWT.NONE);
runtimeLabel.setText("Local Runtime: ");
- suitableRuntimes = new Combo(c, SWT.READ_ONLY);
+ suitableRuntimesCombo = new Combo(c, SWT.READ_ONLY);
addRuntimeLink = new Link(c, SWT.NONE);
addRuntimeLink.setText("<a>" + Messages.addRuntime + "</a>");
@@ -331,7 +336,7 @@
// appLabel = new Label(c, SWT.NONE);
modeLabel = new Label(c, SWT.NONE);
- suitableRuntimes.addModifyListener(new ModifyListener() {
+ suitableRuntimesCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateSelectedRuntimeDelegate();
}
@@ -347,20 +352,29 @@
serverAdapterCheckbox.setLayoutData(UIUtil.createFormData2(0, 5, null, 0, 0, 5, null, 0));
runtimeLabel.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, 0, 5, null, 0));
addRuntimeLink.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, null, 0, 100, -5));
- suitableRuntimes.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, runtimeLabel, 5,
+ suitableRuntimesCombo.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, runtimeLabel, 5,
addRuntimeLink, -5));
- domainLabel.setLayoutData(UIUtil.createFormData2(suitableRuntimes, 5, null, 0, 0, 5, 100, 0));
+ domainLabel.setLayoutData(UIUtil.createFormData2(suitableRuntimesCombo, 5, null, 0, 0, 5, 100, 0));
// appLabel.setLayoutData(UIUtil.createFormData2(domainLabel, 5, null,
// 0, 0, 5, 100, 0));
modeLabel.setLayoutData(UIUtil.createFormData2(domainLabel, 5, null, 0, 0, 5, 100, 0));
- serverAdapterCheckbox.setSelection(true);
model.getParentModel().setProperty(AdapterWizardPageModel.CREATE_SERVER,
- serverAdapterCheckbox2.getSelection());
+ serverAdapterCheckbox.getSelection());
+
+ this.selectedRuntimeObservable =
+ WidgetProperties.singleSelectionIndex().observe(suitableRuntimesCombo);
+ this.suitableRuntimesObservable =
+ WidgetProperties.items().observe(suitableRuntimesCombo);
+ this.serverAdapterCheckboxObservable =
+ WidgetProperties.selection().observe(serverAdapterCheckbox);
+
+ dbc.addValidationStatusProvider(new SelectedRuntimeValidator());
}
private void updateSelectedRuntimeDelegate() {
- if (suitableRuntimes.getSelectionIndex() != -1) {
- runtimeDelegate = ServerCore.findRuntime(suitableRuntimes.getItem(suitableRuntimes.getSelectionIndex()));
+ if (suitableRuntimesCombo.getSelectionIndex() != -1) {
+ runtimeDelegate = ServerCore.findRuntime(suitableRuntimesCombo.getItem(suitableRuntimesCombo
+ .getSelectionIndex()));
} else {
runtimeDelegate = null;
}
@@ -407,8 +421,8 @@
serverTypeToCreate = getServerTypeToCreate();
model.getParentModel().setProperty(AdapterWizardPageModel.SERVER_TYPE, serverTypeToCreate);
refreshValidRuntimes();
- if (suitableRuntimes.getItemCount() > 0) {
- suitableRuntimes.select(0);
+ if (suitableRuntimesCombo.getItemCount() > 0) {
+ suitableRuntimesCombo.select(0);
updateSelectedRuntimeDelegate();
}
IRuntimeType type = getValidRuntimeType();
@@ -439,9 +453,9 @@
IRuntimeType type = getValidRuntimeType();
if (type != null) {
IRuntime[] runtimes = getRuntimesOfType(type.getId());
- fillRuntimeCombo(suitableRuntimes, runtimes);
+ fillRuntimeCombo(suitableRuntimesCombo, runtimes);
} else {
- suitableRuntimes.setItems(new String[0]);
+ suitableRuntimesCombo.setItems(new String[0]);
}
}
@@ -473,8 +487,8 @@
refreshValidRuntimes();
if (returnValue != Window.CANCEL) {
IRuntime rt = (IRuntime) taskModel.getObject(TaskModel.TASK_RUNTIME);
- if (rt != null && rt.getName() != null && suitableRuntimes.indexOf(rt.getName()) != -1) {
- suitableRuntimes.select(suitableRuntimes.indexOf(rt.getName()));
+ if (rt != null && rt.getName() != null && suitableRuntimesCombo.indexOf(rt.getName()) != -1) {
+ suitableRuntimesCombo.select(suitableRuntimesCombo.indexOf(rt.getName()));
}
}
return returnValue;
@@ -493,11 +507,34 @@
serverTypeToCreate = getServerTypeToCreate();
boolean canCreateServer = serverTypeToCreate != null;
serverAdapterCheckbox.setEnabled(canCreateServer);
- serverAdapterCheckbox.setSelection(canCreateServer);
+ // serverAdapterCheckbox.setSelection(canCreateServer);
+ serverAdapterCheckboxObservable.setValue(true);
enableServerWidgets(canCreateServer);
refreshValidRuntimes();
model.getParentModel().setProperty(AdapterWizardPageModel.SERVER_TYPE, serverTypeToCreate);
model.getParentModel().setProperty(AdapterWizardPageModel.CREATE_SERVER, canCreateServer);
}
+ private class SelectedRuntimeValidator extends MultiValidator {
+
+ @Override
+ protected IStatus validate() {
+ /**
+ * WARNING: it is important to evaluate the validation state on
+ * behalf of observable values (not widgets!). The multi validator
+ * is tracking what observables are read to know when he has to
+ * recalculate it's state.
+ */
+ if (Boolean.FALSE.equals(serverAdapterCheckboxObservable.getValue())) {
+ return ValidationStatus.ok();
+ }
+ if (new Integer(-1).equals(selectedRuntimeObservable.getValue())) {
+ if (suitableRuntimesObservable.size() == 0) {
+ return ValidationStatus.error("Please add a new valid runtime.");
+ }
+ return ValidationStatus.error("Please select a runtime");
+ }
+ return ValidationStatus.ok();
+ }
+ }
}
13 years, 2 months
JBoss Tools SVN: r35833 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-10-20 04:56:00 -0400 (Thu, 20 Oct 2011)
New Revision: 35833
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
Log:
https://issues.jboss.org/browse/JBIDE-9559
Force console configuration rebuild on generation
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2011-10-20 07:13:34 UTC (rev 35832)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2011-10-20 08:56:00 UTC (rev 35833)
@@ -19,6 +19,7 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
@@ -55,6 +56,7 @@
ILaunchConfigurationWorkingCopy wc = HibernateJpaPlatformUi.createDefaultLaunchConfig(projectName);
if (wc != null) {
String concoleConfigurationName = initPage.getConfigurationName();
+ resetConsoleConfiguration(concoleConfigurationName);
wc.setAttribute(HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME, concoleConfigurationName);
wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR, initPage.getOutputDir());
@@ -78,4 +80,13 @@
}
return true;
}
+
+ protected void resetConsoleConfiguration(String concoleConfigurationName){
+ if (!initPage.isTemporaryConfiguration()){
+ ConsoleConfiguration cc = KnownConfigurations.getInstance().find(concoleConfigurationName);
+ if (cc.hasConfiguration()){
+ cc.reset();
+ }
+ }
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2011-10-20 07:13:34 UTC (rev 35832)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2011-10-20 08:56:00 UTC (rev 35833)
@@ -16,6 +16,7 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
@@ -53,7 +54,8 @@
ILaunchConfigurationWorkingCopy wc = HibernateJpaPlatformUi.createDefaultLaunchConfig(projectName);
if (wc != null) {
// SHOULD PRESENT THE CONFIGURATION!!!
- String concoleConfigurationName = initPage.getConfigurationName();
+ String concoleConfigurationName = initPage.getConfigurationName();
+ resetConsoleConfiguration(concoleConfigurationName);
wc.setAttribute(HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME, concoleConfigurationName);
wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR, initPage.getOutputDir());
@@ -82,5 +84,14 @@
}
return true;
}
+
+ protected void resetConsoleConfiguration(String concoleConfigurationName){
+ if (!initPage.isTemporaryConfiguration()){
+ ConsoleConfiguration cc = KnownConfigurations.getInstance().find(concoleConfigurationName);
+ if (cc.hasConfiguration()){
+ cc.reset();
+ }
+ }
+ }
}
13 years, 2 months