JBoss Tools SVN: r38869 - in trunk: openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-02-17 08:22:08 -0500 (Fri, 17 Feb 2012)
New Revision: 38869
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
Log:
patch for the recurring 'already publishing' error
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2012-02-17 13:17:15 UTC (rev 38868)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2012-02-17 13:22:08 UTC (rev 38869)
@@ -84,10 +84,13 @@
protected void publishFinish(IProgressMonitor monitor) throws CoreException {
if( method == null )
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Not publishing")); //$NON-NLS-1$
- int result = method.publishFinish(this, monitor);
- setServerPublishState(result);
- publishTaskModel = null;
- method = null;
+ try {
+ int result = method.publishFinish(this, monitor);
+ setServerPublishState(result);
+ } finally {
+ publishTaskModel = null;
+ method = null;
+ }
}
protected void setPublishData(String key, Object val) {
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2012-02-17 13:17:15 UTC (rev 38868)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2012-02-17 13:22:08 UTC (rev 38869)
@@ -137,6 +137,9 @@
}
} catch(CoreException ce) {
// Comes if either commit or push has failed
+ if( ce.getMessage().contains("UP_TO_DATE"))
+ return null;
+
try {
result = EGitUtils.pushForce(remoteName, repository, new SubProgressMonitor(monitor, 100));
monitor.done();
12 years, 7 months
JBoss Tools SVN: r38868 - trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2012-02-17 08:17:15 -0500 (Fri, 17 Feb 2012)
New Revision: 38868
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhone3ResizableSkin.java
Log:
https://issues.jboss.org/browse/JBIDE-10943 BrowserSim: the browser area is transparent
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhone3ResizableSkin.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhone3ResizableSkin.java 2012-02-17 13:15:28 UTC (rev 38867)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhone3ResizableSkin.java 2012-02-17 13:17:15 UTC (rev 38868)
@@ -1,5 +1,7 @@
package org.jboss.tools.vpe.browsersim.ui.skin.ios;
+import java.util.Arrays;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
@@ -21,13 +23,15 @@
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.vpe.browsersim.browser.BrowserSimBrowser;
import org.jboss.tools.vpe.browsersim.browser.IBrowserSimBrowserFactory;
-import org.jboss.tools.vpe.browsersim.model.Device;
import org.jboss.tools.vpe.browsersim.model.DeviceOrientation;
import org.jboss.tools.vpe.browsersim.ui.ControlHandler;
+import org.jboss.tools.vpe.browsersim.ui.skin.AppleIPhone3Skin;
import org.jboss.tools.vpe.browsersim.ui.skin.BrowserSimSkin;
public class AppleIPhone3ResizableSkin implements BrowserSimSkin {
- private static final Point VERTICAL_BORDERS_SIZE = new Point(384 - 320, 727 - 480);
+ private static final Point NORMAL_SKREEN_SIZE = new Point(320, 480);
+ private static final Point NORMAL_SKIN_SIZE = new Point(384, 727);
+ private static final Point VERTICAL_BORDERS_SIZE = new Point(NORMAL_SKIN_SIZE.x - NORMAL_SKREEN_SIZE.x, NORMAL_SKIN_SIZE.y - NORMAL_SKREEN_SIZE.y);
private static final Point HORIZONTAL_BORDERS_SIZE = new Point(VERTICAL_BORDERS_SIZE.y, VERTICAL_BORDERS_SIZE.x);
private static final IPhoneSkinDescriptor VERTICAL_IPHONE3_DESCRIPTOR;
static {
@@ -125,32 +129,67 @@
}
private void setShellRegion() {
- shell.setRegion(null);
- display.asyncExec(new Runnable() {
-
- @Override
- public void run() {
- Region region = new Region();
-// shellRegion.add(AppleIPhone3Skin.VISIBLE_REGION[0]);
- GC gc = new GC(shell);
- final Image screenshot = new Image(display, shell.getBounds());
- gc.copyArea(screenshot, 0, 0);
- gc.dispose();
- ImageData imageData = screenshot.getImageData();
- region.add(0, 0, imageData.width, imageData.height);
- int firstPixel = imageData.getPixel(0, 0);
- for (int i = 0; i < imageData.height; i++) {
- for (int j = 0; j < imageData.width; j++) {
- if (imageData.getPixel(j, i) == firstPixel) {
- region.subtract(j, i, 1, 1);
- }
- }
- }
- screenshot.dispose();
- shell.setRegion(region);
- region.dispose();
+ int[] normalRegion;
+ if (vertical) {
+ normalRegion = AppleIPhone3Skin.VISIBLE_REGION[0];
+ } else {
+ normalRegion = AppleIPhone3Skin.VISIBLE_REGION[1];
+ }
+
+ Point normalRegionSize = new Point(0, 0);
+ for (int i = 0; i < normalRegion.length; i += 2) {
+ if (normalRegionSize.x < normalRegion[i]) {
+ normalRegionSize.x = normalRegion[i];
}
- });
+ if (normalRegionSize.y < normalRegion[i + 1]) {
+ normalRegionSize.y = normalRegion[i + 1];
+ }
+ }
+
+ Point normalRegionCenter = new Point(normalRegionSize.x / 2, normalRegionSize.y / 2);
+ Point shellSize = shell.getSize();
+ Point regionIncrement = new Point(shellSize.x - normalRegionSize.x, shellSize.y - normalRegionSize.y);
+
+ int[] shellRegion = Arrays.copyOf(normalRegion, normalRegion.length);
+ for (int i = 0; i < shellRegion.length; i += 2) {
+ if (shellRegion[i] > normalRegionCenter.x) {
+ shellRegion[i] += regionIncrement.x;
+ }
+ if (shellRegion[i + 1] > normalRegionCenter.y) {
+ shellRegion[i + 1] += regionIncrement.y;
+ }
+ }
+ Region region = new Region();
+ region.add(shellRegion);
+ shell.setRegion(region);
+ region.dispose();
+ ////////////////////////////////
+// shell.setRegion(null);
+// display.asyncExec(new Runnable() {
+//
+// @Override
+// public void run() {
+// Region region = new Region();
+//// shellRegion.add(AppleIPhone3Skin.VISIBLE_REGION[0]);
+// GC gc = new GC(shell);
+// final Image screenshot = new Image(display, shell.getBounds());
+// gc.copyArea(screenshot, 0, 0);
+// gc.dispose();
+// ImageData imageData = screenshot.getImageData();
+// region.add(0, 0, imageData.width, imageData.height);
+// int firstPixel = imageData.getPixel(0, 0);
+// for (int i = 0; i < imageData.height; i++) {
+// for (int j = 0; j < imageData.width; j++) {
+// if (imageData.getPixel(j, i) == firstPixel) {
+// region.subtract(j, i, 1, 1);
+// }
+// }
+// }
+// screenshot.dispose();
+// shell.setRegion(region);
+// region.dispose();
+// }
+// });
}
private void bindIPhoneCompositeControls() {
12 years, 7 months
JBoss Tools SVN: r38867 - trunk/maven/tests/org.jboss.tools.maven.ui.bot.test.
by jbosstools-commits@lists.jboss.org
Author: rawagner
Date: 2012-02-17 08:15:28 -0500 (Fri, 17 Feb 2012)
New Revision: 38867
Modified:
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/pom.xml
Log:
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/pom.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/pom.xml 2012-02-17 12:57:08 UTC (rev 38866)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/pom.xml 2012-02-17 13:15:28 UTC (rev 38867)
@@ -136,7 +136,7 @@
</dependency>
<dependency>
<type>p2-installable-unit</type>
- <artifactId>org.jboss.tools.maven.project.profiles.feature.feature.group</artifactId>
+ <artifactId>org.jboss.tools.maven.profiles.feature.feature.group</artifactId>
<version>0.0.0</version>
</dependency>
</dependencies>
12 years, 7 months
JBoss Tools SVN: r38866 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-02-17 07:57:08 -0500 (Fri, 17 Feb 2012)
New Revision: 38866
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java
Log:
Renaming the wizard (at the title bar level)
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java 2012-02-17 12:37:39 UTC (rev 38865)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java 2012-02-17 12:57:08 UTC (rev 38866)
@@ -18,7 +18,7 @@
* Constructor
*/
public ImportOpenShiftExpressApplicationWizard() {
- super("Import OpenShift Express Application");
+ super("Import OpenShift Application");
}
/**
@@ -28,6 +28,6 @@
* @param application
*/
public ImportOpenShiftExpressApplicationWizard(IUser user, IProject project, IApplication application) {
- super(user, project, application, "Import OpenShift Express Application");
+ super(user, project, application, "Import OpenShift Application");
}
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java 2012-02-17 12:37:39 UTC (rev 38865)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java 2012-02-17 12:57:08 UTC (rev 38866)
@@ -15,10 +15,10 @@
* Constructor
*/
public NewOpenShiftExpressApplicationWizard() {
- super("New OpenShift Express Application");
+ super("New OpenShift Application");
}
public NewOpenShiftExpressApplicationWizard(IUser user) {
- super(user, null, null, "New OpenShift Express Application");
+ super(user, null, null, "New OpenShift Application");
}
}
12 years, 7 months
JBoss Tools SVN: r38865 - trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2012-02-17 07:37:39 -0500 (Fri, 17 Feb 2012)
New Revision: 38865
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/pom.xml
Log:
changed screenshots directory
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/pom.xml
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/pom.xml 2012-02-17 12:32:37 UTC (rev 38864)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/pom.xml 2012-02-17 12:37:39 UTC (rev 38865)
@@ -16,7 +16,7 @@
<jbosstools.test.jboss-gatein.home>${requirement.build.root}/GateIn-3.1.0-GA</jbosstools.test.jboss-gatein.home>
<jbosstools.test.jboss-seam.home>${requirement.build.root}/jboss-seam-2.2.1.CR2</jbosstools.test.jboss-seam.home> <!--TODO setup default path -->
<configurations.dir>resources/project_config_files</configurations.dir>
- <systemProperties>-Djbosstools.test.jboss-gatein.home=${jbosstools.test.jboss-gatein.home} -Djbosstools.test.jboss-seam.home=${jbosstools.test.jboss-seam.home} -Dtest.configurations.dir=${configurations.dir} -Dorg.eclipse.swtbot.screenshots.dir=${project.build.outputDirectory}/screenshots</systemProperties>
+ <systemProperties>-Djbosstools.test.jboss-gatein.home=${jbosstools.test.jboss-gatein.home} -Djbosstools.test.jboss-seam.home=${jbosstools.test.jboss-seam.home} -Dtest.configurations.dir=${configurations.dir} -Dorg.eclipse.swtbot.screenshots.dir=${project.build.directory}/screenshots</systemProperties>
<test.class>org.jboss.tools.portlet.ui.bot.test.AllTestsSuite</test.class>
</properties>
12 years, 7 months
JBoss Tools SVN: r38864 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard: appimport and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-02-17 07:32:37 -0500 (Fri, 17 Feb 2012)
New Revision: 38864
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java
Log:
JBIDE-10511 - fixed it
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-02-17 10:34:22 UTC (rev 38863)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-02-17 12:32:37 UTC (rev 38864)
@@ -16,6 +16,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.ServerCore;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
@@ -81,8 +82,27 @@
, getRemoteName()
, getRepositoryFile())
.execute(monitor);
- createServerAdapter(monitor, importedProjects);
+ String appName = getApplication().getName();
+ String host = getApplication().getApplicationUrl();
+ IServer found = findServer(appName, host);
+ if( found == null )
+ createServerAdapter(monitor, importedProjects);
+ else {
+ new ServerAdapterFactory().addModules(found, importedProjects, monitor);
+ }
}
+
+ private IServer findServer(String appName, String host) {
+ IServer[] all = ServerCore.getServers();
+ for( int i = 0; i < all.length; i++ ) {
+ String host1 = all[i].getHost();
+ String app1 = ExpressServerUtils.getExpressApplicationName(all[i]);
+ if( (host.endsWith("/" + host1 + "/") || (host.endsWith("/" + host1)))
+ && appName.equals(app1))
+ return all[i];
+ }
+ return null;
+ }
/**
* Enables the user chosen, unshared project to be used on the chosen
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java 2012-02-17 10:34:22 UTC (rev 38863)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java 2012-02-17 12:32:37 UTC (rev 38864)
@@ -112,6 +112,10 @@
application.getName(), application.getUUID(), mode, remoteName);
return server;
}
+
+ public void addModules(IServer server, List<IProject> importedProjects, IProgressMonitor monitor) throws CoreException {
+ addModules(getModules(importedProjects), server, monitor);
+ }
private void addModules(List<IModule> modules, IServer server, IProgressMonitor monitor) throws CoreException {
if (modules == null
12 years, 7 months
JBoss Tools SVN: r38863 - trunk/openshift/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: 2012-02-17 05:34:22 -0500 (Fri, 17 Feb 2012)
New Revision: 38863
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
Log:
increased timeout to 2 minutes
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-02-17 09:32:10 UTC (rev 38862)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-02-17 10:34:22 UTC (rev 38863)
@@ -39,7 +39,7 @@
protected HashMap<String, Object> dataModel = new HashMap<String, Object>();
- private static final int APP_CREATION_TIMEOUT = 60;
+ private static final int APP_CREATION_TIMEOUT = 120;
private static final String KEY_SELECTED_EMBEDDABLE_CARTRIDGES = "selectedEmbeddableCartridges";
public OpenShiftExpressApplicationWizardModel(IUser user) {
12 years, 7 months
JBoss Tools SVN: r38862 - in trunk: as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-02-17 04:32:10 -0500 (Fri, 17 Feb 2012)
New Revision: 38862
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/IPasswordPrompter.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegator.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/RequiredCredentialsDialog.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/UserPassCredentialProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/IUserModelListener.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java
Log:
JBIDE-10908 - any user with an empty password should prompt for password before doing any operations.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/RequiredCredentialsDialog.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/RequiredCredentialsDialog.java 2012-02-17 07:55:47 UTC (rev 38861)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/RequiredCredentialsDialog.java 2012-02-17 09:32:10 UTC (rev 38862)
@@ -25,7 +25,6 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.ui.Messages;
import org.jboss.ide.eclipse.as.ui.UIUtil;
@@ -37,18 +36,28 @@
public static final int IGNORE_ID = IDialogConstants.CLIENT_ID | 3;
private String user, pass;
private boolean save;
- private JBossServer jbs;
-
- public RequiredCredentialsDialog(Shell parentShell, JBossServer jbs) {
+ private boolean canModifyUser = true;
+ private String description;
+ public RequiredCredentialsDialog(Shell parentShell, String initialUser, String initialPass) {
super(parentShell);
setShellStyle(getShellStyle() | SWT.RESIZE);
- this.jbs = jbs;
+ this.user = initialUser;
+ this.pass = initialPass;
+ this.description = Messages.credentials_warning;
}
+ public void setCanModifyUser(boolean val) {
+ canModifyUser = val;
+ }
+
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(Messages.RequiredCredentialsDialog_ShellText);
}
+
+ public void setDescription(String desc) {
+ this.description = desc;
+ }
protected Control createDialogArea(Composite parent) {
Composite c = (Composite) super.createDialogArea(parent);
@@ -74,7 +83,7 @@
passText.setLayoutData(u.createFormData(passLabel, 5, null, 0, 0,5, 100, -5));
saveCredentials.setLayoutData(u.createFormData(passText, 10, null, 0, 0,5, 100, -5));
- top.setText(Messages.credentials_warning);
+ top.setText(description);
userLabel.setText(Messages.swf_Username);
passLabel.setText(Messages.swf_Password);
saveCredentials.setText(Messages.credentials_save);
@@ -101,11 +110,13 @@
saveCredentials.addSelectionListener(listener2);
// defaults
- userText.setText(jbs.getUsername());
- userText.setSelection(0, jbs.getUsername() == null ? 0 : jbs.getUsername().length());
- passText.setText(jbs.getPassword());
+ userText.setText(user);
+ userText.setSelection(0, user == null ? 0 : user.length());
+ passText.setText(pass);
// save by default
saveCredentials.setSelection(true);
+
+ userText.setEnabled(canModifyUser);
return c;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/UserPassCredentialProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/UserPassCredentialProvider.java 2012-02-17 07:55:47 UTC (rev 38861)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/UserPassCredentialProvider.java 2012-02-17 09:32:10 UTC (rev 38862)
@@ -56,7 +56,10 @@
IServer server = inNeed.getServer();
IServerWorkingCopy copy = server.createWorkingCopy();
JBossServer jbs = ServerConverter.getJBossServer(copy);
- RequiredCredentialsDialog d = new RequiredCredentialsDialog(new Shell(), jbs);
+ String initialUser = jbs.getUsername();
+ String initialPass = jbs.getPassword();
+ RequiredCredentialsDialog d = new RequiredCredentialsDialog(
+ new Shell(), initialUser, initialPass);
if( d.open() == Window.OK) {
if( d.getSave() ) {
jbs.setPassword(d.getPass());
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/IPasswordPrompter.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/IPasswordPrompter.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/IPasswordPrompter.java 2012-02-17 09:32:10 UTC (rev 38862)
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.openshift.express.internal.core.console;
+
+import com.openshift.express.client.IUser;
+
+public interface IPasswordPrompter {
+ public String getPasswordFor(IUser user);
+}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/IUserModelListener.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/IUserModelListener.java 2012-02-17 07:55:47 UTC (rev 38861)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/IUserModelListener.java 2012-02-17 09:32:10 UTC (rev 38862)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.openshift.express.internal.core.console;
import com.openshift.express.client.IUser;
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegator.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegator.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegator.java 2012-02-17 09:32:10 UTC (rev 38862)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.openshift.express.internal.core.console;
+
+import java.util.List;
+
+import com.openshift.express.client.IApplication;
+import com.openshift.express.client.ICartridge;
+import com.openshift.express.client.IDomain;
+import com.openshift.express.client.IEmbeddableCartridge;
+import com.openshift.express.client.ISSHPublicKey;
+import com.openshift.express.client.IUser;
+import com.openshift.express.client.OpenShiftException;
+
+public class UserDelegator implements IUser {
+ private IUser delegate;
+ public UserDelegator(IUser user) {
+ this.delegate = user;
+ }
+
+ public String getRhlogin() {
+ return delegate.getRhlogin();
+ }
+ public String getPassword() {
+ return delegate.getPassword();
+ }
+ protected void checkForPassword() {
+ if( delegate.getPassword() == null || "".equals(delegate.getPassword())) {
+ try {
+ String newPw = UserModel.promptForPassword(this);
+ delegate = UserModel.getDefault().createUser(delegate.getRhlogin(), newPw);
+ } catch( Exception e ) {
+ // TODO log handle everything
+ }
+ }
+ }
+
+ public IApplication createApplication(String arg0, ICartridge arg1)
+ throws OpenShiftException {
+ checkForPassword();
+ return delegate.createApplication(arg0, arg1);
+ }
+
+ public IDomain createDomain(String arg0, ISSHPublicKey arg1)
+ throws OpenShiftException {
+ checkForPassword();
+ return delegate.createDomain(arg0, arg1);
+ }
+ public IApplication getApplicationByName(String arg0)
+ throws OpenShiftException {
+ checkForPassword();
+ return delegate.getApplicationByName(arg0);
+ }
+ public List<IApplication> getApplications() throws OpenShiftException {
+ checkForPassword();
+ return delegate.getApplications();
+ }
+ public List<IApplication> getApplicationsByCartridge(ICartridge arg0)
+ throws OpenShiftException {
+ checkForPassword();
+ return delegate.getApplicationsByCartridge(arg0);
+ }
+ public String getAuthIV() {
+ checkForPassword();
+ return delegate.getAuthIV();
+ }
+ public String getAuthKey() {
+ checkForPassword();
+ return delegate.getAuthKey();
+ }
+ public ICartridge getCartridgeByName(String arg0) throws OpenShiftException {
+ checkForPassword();
+ return delegate.getCartridgeByName(arg0);
+ }
+ public List<ICartridge> getCartridges() throws OpenShiftException {
+ checkForPassword();
+ return delegate.getCartridges();
+ }
+ public IDomain getDomain() throws OpenShiftException {
+ checkForPassword();
+ return delegate.getDomain();
+ }
+ public List<IEmbeddableCartridge> getEmbeddableCartridges()
+ throws OpenShiftException {
+ checkForPassword();
+ return delegate.getEmbeddableCartridges();
+ }
+ public ISSHPublicKey getSshKey() throws OpenShiftException {
+ checkForPassword();
+ return delegate.getSshKey();
+ }
+ public String getUUID() throws OpenShiftException {
+ checkForPassword();
+ return delegate.getUUID();
+ }
+ public boolean hasApplication(String arg0) throws OpenShiftException {
+ checkForPassword();
+ return delegate.hasApplication(arg0);
+ }
+ public boolean hasApplication(ICartridge arg0) throws OpenShiftException {
+ checkForPassword();
+ return delegate.hasApplication(arg0);
+ }
+ public boolean hasDomain() throws OpenShiftException {
+ checkForPassword();
+ return delegate.hasDomain();
+ }
+ public boolean isValid() throws OpenShiftException {
+ checkForPassword();
+ return delegate.isValid();
+ }
+ public void refresh() throws OpenShiftException {
+ checkForPassword();
+ delegate.refresh();
+ }
+}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-02-17 07:55:47 UTC (rev 38861)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-02-17 09:32:10 UTC (rev 38862)
@@ -41,6 +41,14 @@
return model;
}
+ private static IPasswordPrompter prompter;
+ public static void setPasswordPrompt(IPasswordPrompter prompt) {
+ prompter =prompt;
+ }
+ public static String promptForPassword(IUser user) {
+ return prompter == null ? null : prompter.getPasswordFor(user);
+ }
+
/** The most recent user connected on OpenShift. */
private IUser recentUser = null;
private HashMap<String, IUser> allUsers = new HashMap<String, IUser>();
@@ -139,7 +147,7 @@
try {
String password = getPasswordFromSecureStorage(users[i]);
IUser u = createUser(users[i], password);
- addUser(u);
+ addUser(new UserDelegator(u));
} catch (OpenShiftException ose) {
// TODO
} catch (IOException ioe) {
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java 2012-02-17 07:55:47 UTC (rev 38861)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java 2012-02-17 09:32:10 UTC (rev 38862)
@@ -8,16 +8,23 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.ide.eclipse.as.ui.dialogs.RequiredCredentialsDialog;
+import org.jboss.tools.openshift.express.internal.core.console.IPasswordPrompter;
import org.jboss.tools.openshift.express.internal.core.console.UserModel;
import org.osgi.framework.BundleContext;
+import com.openshift.express.client.IUser;
+
/**
* The activator class controls the plug-in life cycle
*/
-public class OpenShiftUIActivator extends AbstractUIPlugin {
+public class OpenShiftUIActivator extends AbstractUIPlugin implements IPasswordPrompter {
// The plug-in ID
public static final String PLUGIN_ID = "org.jboss.tools.openshift.express.ui"; //$NON-NLS-1$
@@ -41,6 +48,7 @@
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ UserModel.setPasswordPrompt(this);
}
/*
@@ -117,4 +125,21 @@
URL imageFileUrl = FileLocator.find(this.getBundle(), imageFilePath, null);
return ImageDescriptor.createFromURL(imageFileUrl);
}
+
+ public String getPasswordFor(final IUser user) {
+ final String[] val =new String[1];
+ val[0] = null;
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ Shell shell = Display.getDefault().getActiveShell();
+ RequiredCredentialsDialog d = new RequiredCredentialsDialog(shell, user.getRhlogin(), user.getPassword());
+ d.setCanModifyUser(false);
+ d.setDescription("Provide enter the password for your express server");
+ if( d.open() == Window.OK) {
+ val[0] = d.getPass();
+ }
+ }
+ });
+ return val[0];
+ }
}
12 years, 7 months
JBoss Tools SVN: r38861 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-02-17 02:55:47 -0500 (Fri, 17 Feb 2012)
New Revision: 38861
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java
Log:
JBIDE-10733 and JBIDE-10734
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2012-02-17 07:06:33 UTC (rev 38860)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2012-02-17 07:55:47 UTC (rev 38861)
@@ -13,6 +13,7 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
+import java.util.ArrayList;
import java.util.HashMap;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -38,6 +39,7 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
@@ -72,6 +74,7 @@
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
import org.jboss.ide.eclipse.as.ui.Messages;
+import org.jboss.ide.eclipse.as.ui.UIUtil;
public class DeploymentModuleOptionCompositeAssistant implements PropertyChangeListener {
public static interface IDeploymentPageCallback {
@@ -132,6 +135,11 @@
return beh.openBrowseDialog(page, original);
}
+ // Combo strings - TODO extract to messages
+ private static final String ALL = "All";
+ private static final String DEPLOYED = "Deployed";
+ private static final String BY_MODNAME = "By Module Name";
+ private static final String BY_MODTYPE = "By Module Type";
protected static final String COLUMN_NAME = IJBossToolingConstants.LOCAL_DEPLOYMENT_NAME;
@@ -150,6 +158,11 @@
private Button zipDeployWTPProjects;
private String lastCustomDeploy, lastCustomTemp;
+ private Combo filterCombo;
+ private Text filterText;
+
+
+
private IServerWorkingCopy lastWC;
public DeploymentModuleOptionCompositeAssistant() {
@@ -735,21 +748,36 @@
public void widgetDefaultSelected(SelectionEvent e) {
}
});
- FormData linkData = new FormData();
- linkData.bottom = new FormAttachment(100,-5);
- linkData.left = new FormAttachment(0, 5);
+
+ FormData linkData = UIUtil.createFormData2(null, 0, 100,-10, 0,5,null,0);
link.setLayoutData(linkData);
- FormData treeData = new FormData();
- treeData.top = new FormAttachment(0, 5);
- treeData.bottom = new FormAttachment(link, -5);
- treeData.left = new FormAttachment(0, 5);
- treeData.right = new FormAttachment(100, -5);
+ FormData treeData = UIUtil.createFormData2(0, 5, link,-5, 0,5,100,-5);
viewer.getTree().setLayoutData(treeData);
+ // Newer stuff
+ Label comboLabel = new Label(root, SWT.NULL);
+ comboLabel.setText("Filter by:");
+ filterCombo = new Combo(root, SWT.READ_ONLY);
+ filterCombo.setItems(new String[]{ALL, DEPLOYED, BY_MODNAME});
+ filterCombo.select(0);
+
+ filterText = new Text(root, SWT.SINGLE |SWT.BORDER);
+
+ comboLabel.setLayoutData(UIUtil.createFormData2(null,0,100,-8,link,5,null,0));
+ filterCombo.setLayoutData(UIUtil.createFormData2(null,0,100,-3,comboLabel,5,null,0));
+ filterText.setLayoutData(UIUtil.createFormData2(null,0,100,-3,filterCombo,5,100,-5));
+
+ ModifyListener ml =new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ viewer.setInput("");
+ }
+ };
+ filterCombo.addModifyListener(ml);
+ filterText.addModifyListener(ml);
return root;
}
-
+
private void refreshViewer() {
page.refreshPossibleModules();
viewer.setInput(""); //$NON-NLS-1$
@@ -811,7 +839,7 @@
}
public Object[] getElements(Object inputElement) {
- return page.getPossibleModules();
+ return getFilteredModules();
}
public boolean hasChildren(Object element) {
@@ -827,6 +855,27 @@
}
}
+ private Object[] getFilteredModules(){
+ if( filterCombo == null )
+ return page.getPossibleModules();
+ if( filterCombo.getItem(filterCombo.getSelectionIndex()).equals(ALL))
+ return page.getPossibleModules();
+ if( filterCombo.getItem(filterCombo.getSelectionIndex()).equals(DEPLOYED))
+ return page.getServer().getModules();
+ if( filterCombo.getItem(filterCombo.getSelectionIndex()).equals(BY_MODNAME)) {
+ IModule[] mods = page.getPossibleModules();
+ String txt = filterText.getText();
+ ArrayList<IModule> result = new ArrayList<IModule>();
+ for( int i = 0; i < mods.length; i++) {
+ if( mods[i].getName().startsWith(txt)) {
+ result.add(mods[i]);
+ }
+ }
+ return result.toArray(new IModule[result.size()]);
+ }
+ return new Object[]{};
+ }
+
private class ModulePageLabelProvider implements ITableLabelProvider {
public Image getColumnImage(Object element, int columnIndex) {
if (element instanceof IModule && columnIndex == 0) {
12 years, 7 months
JBoss Tools SVN: r38860 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-02-17 02:06:33 -0500 (Fri, 17 Feb 2012)
New Revision: 38860
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java
Log:
/JBIDE-10518 - fixed
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java 2012-02-17 05:46:21 UTC (rev 38859)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java 2012-02-17 07:06:33 UTC (rev 38860)
@@ -11,17 +11,17 @@
package org.jboss.ide.eclipse.as.ui.editor;
import java.util.ArrayList;
-import java.util.Iterator;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.fieldassist.FieldDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.SWT;
@@ -121,6 +121,7 @@
IJBossServerConstants.JNDI_PORT_DETECT,
IJBossServerConstants.JNDI_PORT,
IJBossServerConstants.JNDI_PORT_DEFAULT_XPATH,
+ IJBossToolingConstants.JNDI_DEFAULT_PORT,
Messages.EditorChangeJNDICommandName);
}
}
@@ -132,6 +133,7 @@
IJBossServerConstants.WEB_PORT_DETECT,
IJBossServerConstants.WEB_PORT,
IJBossServerConstants.WEB_PORT_DEFAULT_XPATH,
+ IJBossToolingConstants.JBOSS_WEB_DEFAULT_PORT,
Messages.EditorChangeWebCommandName);
}
}
@@ -143,6 +145,7 @@
IJBoss6Server.JMX_RMI_PORT_DETECT,
IJBoss6Server.JMX_RMI_PORT,
IJBoss6Server.JMX_RMI_PORT_DEFAULT_XPATH,
+ IJBoss6Server.JMX_RMI_DEFAULT_PORT,
Messages.EditorChangeJMXRMICommandName);
}
}
@@ -154,6 +157,7 @@
IJBossToolingConstants.AS7_MANAGEMENT_PORT_DETECT,
IJBossToolingConstants.AS7_MANAGEMENT_PORT,
IJBossToolingConstants.AS7_MANAGEMENT_PORT_DEFAULT_XPATH,
+ IJBossToolingConstants.AS7_MANAGEMENT_PORT_DEFAULT_PORT,
Messages.EditorChangeAS7ManagementCommandName);
}
}
@@ -169,8 +173,12 @@
protected ServerAttributeHelper helper;
protected Listener listener;
protected PortSection section;
+ protected int defaultValue;
+ private ControlDecoration decoration;
+
public PortEditorExtension(String labelText, String currentXPathKey,
String detectXPathKey, String overrideValueKey, String defaultXPath,
+ int defaultValue,
String changeValueCommandName) {
this.labelText = labelText;
this.currentXPathKey = currentXPathKey;
@@ -178,6 +186,7 @@
this.overrideValueKey = overrideValueKey;
this.defaultXPath = defaultXPath;
this.changeValueCommandName = changeValueCommandName;
+ this.defaultValue = defaultValue;
}
public void setServerAttributeHelper(ServerAttributeHelper helper) {
this.helper = helper;
@@ -189,6 +198,13 @@
createUI(parent);
initialize();
addListeners();
+
+ decoration = new ControlDecoration(text,
+ SWT.LEFT | SWT.TOP);
+ FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
+ .getFieldDecoration(FieldDecorationRegistry.DEC_WARNING);
+ decoration.setImage(fieldDecoration.getImage());
+ validate();
}
protected void createUI(Composite parent) {
@@ -228,9 +244,9 @@
text.setEnabled(!shouldDetect);
text.setEditable(!shouldDetect);
currentXPath = helper.getAttribute(currentXPathKey, defaultXPath);
- if( shouldDetect )
- text.setText(findPort(helper.getServer(), new Path(currentXPath)));
- else
+ if( shouldDetect ) {
+ text.setText(findPortWithDefault(helper.getServer(), new Path(currentXPath), defaultValue));
+ } else
text.setText(helper.getAttribute(overrideValueKey, "")); //$NON-NLS-1$
}
protected void addListeners() {
@@ -275,10 +291,25 @@
public String getValue() {
return text.getText();
}
+ public void validate() {
+ decoration.hide();
+ String v = null;
+ String errorText;
+ if( detect.getSelection()) {
+ v = findPort(helper.getServer(), new Path(defaultXPath));
+ errorText = "This port cannot be automatically located. A default value is being displayed";
+ } else {
+ v = text.getText();
+ errorText = "The empty string is not a valid port.";
+ }
+ if( "".equals(v)) {
+ decoration.setDescriptionText(errorText);
+ decoration.show();
+ }
+ }
}
protected void createUI(Composite parent) {
-
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE|ExpandableComposite.EXPANDED|ExpandableComposite.TITLE_BAR);
section.setText(Messages.EditorServerPorts);
@@ -296,14 +327,12 @@
addUIAdditions(composite, description);
toolkit.paintBordersFor(composite);
section.setClient(composite);
- getSaveStatus();
}
private void addUIAdditions(Composite parent, Control top) {
IPortEditorExtension[] extensions = (IPortEditorExtension[]) sectionList.toArray(new IPortEditorExtension[sectionList.size()]);
FormData data;
- Control c;
Composite wrapper = new Composite(parent, SWT.NONE);
GridLayoutFactory.fillDefaults().margins(6, 10).numColumns(4).applyTo(wrapper);
data = new FormData();
@@ -342,6 +371,8 @@
String xpath;
Link link;
PortSection pSection;
+ int defVal;
+ PortEditorExtension ext;
public SetPortCommand(IServerWorkingCopy server, ServerAttributeHelper helper, String name,
String textAttribute, String overrideAttribute, String overridePathAttribute,
String pathDefault, PortEditorExtension ext) { //Text text, Button button, String xpath, Listener listener) {
@@ -356,13 +387,15 @@
this.listener = ext.listener;
this.xpath = ext.currentXPath;
this.link = ext.link;
- pSection = ext.section;
+ this.pSection = ext.section;
+ this.defVal = ext.defaultValue;
+ this.ext = ext;
}
public void execute() {
preText = helper.getAttribute(textAttribute, (String)null);
if( preText == null )
- preText = findPort(helper.getServer(), new Path(defaultPath));
+ preText = text.getText();
prePath = helper.getAttribute(overridePathAttribute, (String)defaultPath);
preOverride = helper.getAttribute(overrideAttribute, true);
helper.setAttribute(textAttribute, text.getText());
@@ -374,10 +407,10 @@
text.setEditable(!button.getSelection());
if( button.getSelection() ) {
text.removeListener(SWT.Modify, listener);
- text.setText(findPort(helper.getServer(), new Path(xpath)));
+ text.setText(findPortWithDefault(helper.getServer(), new Path(xpath), this.defVal));
text.addListener(SWT.Modify, listener);
}
- pSection.getSaveStatus();
+ validate();
}
public void undo() {
@@ -397,11 +430,22 @@
text.setEditable(!preOverride);
button.addListener(SWT.Selection, listener);
text.addListener(SWT.Modify, listener);
-
- pSection.getSaveStatus();
+ validate();
}
+
+ private void validate() {
+ ext.validate();
+ }
}
+ protected static String findPortWithDefault(IServer server, IPath path, int defaultValue) {
+ String s = findPort(server, path);
+ if( s.equals("")) { //$NON-NLS-1$
+ s = new Integer(defaultValue).toString();
+ }
+ return s;
+ }
+
protected static String findPort(IServer server, IPath path) {
XPathQuery query = XPathModel.getDefault().getQuery(server, path);
String result = ""; //$NON-NLS-1$
@@ -418,26 +462,4 @@
}
return result;
}
-
- public IStatus[] getSaveStatus() {
- Iterator<IPortEditorExtension> i = sectionList.iterator();
- IPortEditorExtension ext1;
- int temp;
- boolean errorFound = false;
- while(i.hasNext()) {
- ext1 = i.next();
- try {
- temp = Integer.parseInt(ext1.getValue());
- if( temp < 0 )
- errorFound = true;
- } catch(NumberFormatException nfe) {
- errorFound = true;
- }
- }
- setErrorMessage(errorFound ? Messages.EditorPortInvalid : null);
- return errorFound ?
- new IStatus[] { new Status(IStatus.WARNING, JBossServerUIPlugin.PLUGIN_ID, Messages.EditorPortInvalid)}
- : new IStatus[]{};
- }
-
}
12 years, 7 months