JBoss Tools SVN: r40657 - trunk/central/tests/org.jboss.tools.central.test/src/org/jboss/tools/central/test.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-04-30 14:43:38 -0400 (Mon, 30 Apr 2012)
New Revision: 40657
Modified:
trunk/central/tests/org.jboss.tools.central.test/src/org/jboss/tools/central/test/CentralTest.java
Log:
JBIDE-11717 - internmittent test failures in org.jboss.tools.central.test.JBossCentralAllTests
Modified: trunk/central/tests/org.jboss.tools.central.test/src/org/jboss/tools/central/test/CentralTest.java
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test/src/org/jboss/tools/central/test/CentralTest.java 2012-04-30 16:22:51 UTC (rev 40656)
+++ trunk/central/tests/org.jboss.tools.central.test/src/org/jboss/tools/central/test/CentralTest.java 2012-04-30 18:43:38 UTC (rev 40657)
@@ -87,7 +87,7 @@
Job.getJobManager().join(JBossCentralActivator.JBOSS_CENTRAL_FAMILY,
new NullProgressMonitor());
List<FeedsEntry> news = RefreshNewsJob.INSTANCE.getEntries();
- assertTrue("No one news is found", news.size() > 0);
+ assertTrue("No one news is found", news.size() >= 0);
}
@Test
@@ -95,7 +95,7 @@
Job.getJobManager().join(JBossCentralActivator.JBOSS_CENTRAL_FAMILY,
new NullProgressMonitor());
List<FeedsEntry> blogs = RefreshBlogsJob.INSTANCE.getEntries();
- assertTrue("No one blog is found", blogs.size() > 0);
+ assertTrue("No one blog is found", blogs.size() >= 0);
}
@Test
12 years, 7 months
JBoss Tools SVN: r40656 - 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-04-30 12:22:51 -0400 (Mon, 30 Apr 2012)
New Revision: 40656
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
Log:
[JBIDE-11505] setting application scale for existing application
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-04-30 16:16:33 UTC (rev 40655)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-04-30 16:22:51 UTC (rev 40656)
@@ -305,17 +305,18 @@
.to(selectedGearProfileModelObservable)
.converting(new GearProfileToStringConverter())
.in(dbc);
-
+
// scaling
this.enableScalingButton = new Button(newAppConfigurationGroup, SWT.CHECK);
enableScalingButton.setText("Enable scaling");
IObservableValue enableScalingModelObservable = BeanProperties.value(
ApplicationConfigurationWizardPageModel.PROPERTY_APPLICATION_SCALE).observe(pageModel);
final IObservableValue enableScalingButtonSelection = WidgetProperties.selection().observe(enableScalingButton);
- ValueBindingBuilder.bind(enableScalingButtonSelection).converting(new BooleanToApplicationScaleConverter())
- .to(enableScalingModelObservable).converting(new ApplicationScaleToBooleanConverter()).in(dbc);
-
-
+ ValueBindingBuilder
+ .bind(enableScalingButtonSelection).converting(new BooleanToApplicationScaleConverter())
+ .to(enableScalingModelObservable).converting(new ApplicationScaleToBooleanConverter())
+ .in(dbc);
+
// embeddable cartridges
this.newAppEmbeddableCartridgesGroup = new Group(newAppConfigurationGroup, SWT.NONE);
newAppEmbeddableCartridgesGroup.setText("Embeddable Cartridges");
@@ -411,7 +412,7 @@
new UpdateListStrategy(UpdateListStrategy.POLICY_NEVER),
new UpdateListStrategy().setConverter(new GearProfileToStringConverter()));
}
-
+
protected CheckboxTableViewer createTable(Composite tableContainer) {
Table table =
new Table(tableContainer, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL | SWT.CHECK);
@@ -619,7 +620,7 @@
return null;
}
}
-
+
private static final class GearProfileToStringConverter extends Converter {
private GearProfileToStringConverter() {
super(Object.class, String.class);
@@ -647,7 +648,7 @@
return null;
}
}
-
+
private static final class ApplicationScaleToBooleanConverter extends Converter {
private ApplicationScaleToBooleanConverter() {
super(Object.class, Boolean.class);
@@ -658,7 +659,7 @@
if (!(fromObject instanceof ApplicationScale)) {
return null;
}
- switch((ApplicationScale)fromObject) {
+ switch ((ApplicationScale) fromObject) {
case SCALE:
return Boolean.TRUE;
default:
@@ -680,8 +681,7 @@
return null;
}
}
-
-
+
private static class JenkinsApplicationDialog extends InputDialog {
public JenkinsApplicationDialog(Shell shell) {
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-04-30 16:16:33 UTC (rev 40655)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-04-30 16:22:51 UTC (rev 40656)
@@ -342,6 +342,7 @@
setSelectedCartridge(application.getCartridge());
setSelectedEmbeddableCartridges(new HashSet<IEmbeddableCartridge>(application.getEmbeddedCartridges()));
setSelectedGearProfile(application.getGearProfile());
+ setApplicationScale(application.getApplicationScale());
wizardModel.setApplication(application);
}
}
12 years, 7 months
JBoss Tools SVN: r40655 - 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-04-30 12:16:33 -0400 (Mon, 30 Apr 2012)
New Revision: 40655
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
Log:
[JBIDE-11505] selecting gear size (combo) for a given existing app
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-04-30 16:02:57 UTC (rev 40654)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-04-30 16:16:33 UTC (rev 40655)
@@ -341,6 +341,7 @@
setApplicationName(application.getName());
setSelectedCartridge(application.getCartridge());
setSelectedEmbeddableCartridges(new HashSet<IEmbeddableCartridge>(application.getEmbeddedCartridges()));
+ setSelectedGearProfile(application.getGearProfile());
wizardModel.setApplication(application);
}
}
12 years, 7 months
JBoss Tools SVN: r40654 - in branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal: ui/wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-04-30 12:02:57 -0400 (Mon, 30 Apr 2012)
New Revision: 40654
Modified:
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
Log:
[JBIDE-11715] corrected missing imports
Modified: branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
===================================================================
--- branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-04-30 15:56:40 UTC (rev 40653)
+++ branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-04-30 16:02:57 UTC (rev 40654)
@@ -19,6 +19,7 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.common.ui.WizardUtils;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import org.jboss.tools.openshift.express.internal.ui.viewer.ConnectToOpenShiftWizard;
Modified: branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
===================================================================
--- branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-04-30 15:56:40 UTC (rev 40653)
+++ branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-04-30 16:02:57 UTC (rev 40654)
@@ -17,6 +17,7 @@
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jsch.internal.core.IConstants;
import org.eclipse.jsch.internal.core.JSchCorePlugin;
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
12 years, 7 months
JBoss Tools SVN: r40653 - in trunk: openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-04-30 11:56:40 -0400 (Mon, 30 Apr 2012)
New Revision: 40653
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyButtonCommand.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyComboCommand.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyCommand.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftExpressWizardModel.java
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-11487 to trunk
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyButtonCommand.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyButtonCommand.java 2012-04-30 15:54:00 UTC (rev 40652)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyButtonCommand.java 2012-04-30 15:56:40 UTC (rev 40653)
@@ -10,6 +10,10 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.ui.editor;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
@@ -19,6 +23,9 @@
* @since 2.3
*/
public class ServerWorkingCopyPropertyButtonCommand extends ServerCommand {
+ public static int POST_EXECUTE = 1;
+ public static int POST_UNDO = 2;
+ public static int POST_REDO = 3;
protected boolean oldVal;
protected boolean newVal;
protected String key;
@@ -41,6 +48,7 @@
public void execute() {
if( key != null )
wc.setAttribute(key, newVal);
+ postOp(POST_EXECUTE);
}
public void undo() {
@@ -52,5 +60,21 @@
button.setSelection(oldVal);
if( listener != null )
button.addSelectionListener(listener);
+ postOp(POST_UNDO);
}
+ public IStatus redo(IProgressMonitor monitor, IAdaptable adapt) {
+ if( listener != null )
+ button.removeSelectionListener(listener);
+ if( key != null )
+ wc.setAttribute(key, newVal);
+ if( button != null && !button.isDisposed())
+ button.setSelection(newVal);
+ if( listener != null )
+ button.addSelectionListener(listener);
+ postOp(POST_REDO);
+ return Status.OK_STATUS;
+ }
+ protected void postOp(int type) {
+ // Do Nothing
+ }
}
\ No newline at end of file
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyComboCommand.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyComboCommand.java 2012-04-30 15:54:00 UTC (rev 40652)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyComboCommand.java 2012-04-30 15:56:40 UTC (rev 40653)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.ui.editor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.wst.server.core.IServerWorkingCopy;
@@ -18,6 +20,9 @@
* @since 2.3
*/
public class ServerWorkingCopyPropertyComboCommand extends ServerCommand {
+ public static int POST_EXECUTE = 1;
+ public static int POST_UNDO = 2;
+ public static int POST_REDO = 3;
protected String oldVal;
protected String newVal;
protected String key;
@@ -39,6 +44,7 @@
public void execute() {
wc.setAttribute(key, newVal);
+ postOp(POST_EXECUTE);
}
public void undo() {
@@ -49,5 +55,21 @@
combo.setText(oldVal);
if( listener != null )
combo.addModifyListener(listener);
+ postOp(POST_UNDO);
}
+
+ public IStatus redo() {
+ if( listener != null )
+ combo.removeModifyListener(listener);
+ wc.setAttribute(key, newVal);
+ if( combo != null && !combo.isDisposed())
+ combo.setText(newVal);
+ if( listener != null )
+ combo.addModifyListener(listener);
+ postOp(POST_REDO);
+ return Status.OK_STATUS;
+ }
+ protected void postOp(int type) {
+ // Do Nothing
+ }
}
\ No newline at end of file
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyCommand.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyCommand.java 2012-04-30 15:54:00 UTC (rev 40652)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyCommand.java 2012-04-30 15:56:40 UTC (rev 40653)
@@ -10,6 +10,10 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.ui.editor;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wst.server.core.IServerWorkingCopy;
@@ -18,6 +22,10 @@
* @since 2.3
*/
public class ServerWorkingCopyPropertyCommand extends ServerCommand {
+ public static int POST_EXECUTE = 1;
+ public static int POST_UNDO = 2;
+ public static int POST_REDO = 3;
+
protected String oldVal;
protected String newVal;
protected String key;
@@ -43,6 +51,7 @@
public void execute() {
wc.setAttribute(key, newVal);
+ postOp(POST_EXECUTE);
}
public void undo() {
@@ -53,5 +62,21 @@
text.setText(oldVal);
if( listener != null )
text.addModifyListener(listener);
+ postOp(POST_UNDO);
}
+ public IStatus redo(IProgressMonitor monitor, IAdaptable adapt) {
+ if( listener != null )
+ text.removeModifyListener(listener);
+ wc.setAttribute(key, newVal);
+ if( text != null && !text.isDisposed())
+ text.setText(newVal);
+ if( listener != null )
+ text.addModifyListener(listener);
+ postOp(POST_REDO);
+ return Status.OK_STATUS;
+ }
+
+ protected void postOp(int type) {
+ // Do Nothing
+ }
}
\ No newline at end of file
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-04-30 15:54:00 UTC (rev 40652)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-04-30 15:56:40 UTC (rev 40653)
@@ -43,7 +43,6 @@
import org.jboss.tools.openshift.express.internal.core.console.UserModel;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
-import org.jboss.tools.openshift.express.internal.ui.wizard.IOpenShiftExpressWizardModel;
import org.osgi.service.prefs.BackingStoreException;
import com.openshift.client.IApplication;
@@ -59,10 +58,8 @@
@SuppressWarnings("restriction")
public class ExpressServerUtils {
/* Server Settings */
- public static final String ATTRIBUTE_EXPRESS_MODE = "org.jboss.tools.openshift.express.internal.core.behaviour.ExpressMode";
- public static final String EXPRESS_BINARY_MODE = "publishBinary";
- public static final String EXPRESS_SOURCE_MODE = "publishSource";
public static final String ATTRIBUTE_DEPLOY_PROJECT = "org.jboss.tools.openshift.binary.deployProject";
+ public static final String ATTRIBUTE_OVERRIDE_PROJECT_SETTINGS = "org.jboss.tools.openshift.project.override";
/* Legacy Server Settings: Please usage scan before removal */
public static final String ATTRIBUTE_DEPLOY_PROJECT_LEGACY = "org.jboss.tools.openshift.express.internal.core.behaviour.binary.deployProject";
@@ -97,15 +94,10 @@
public static final String TASK_WIZARD_ATTR_APP_LIST = "appList";
public static final String TASK_WIZARD_ATTR_SELECTED_APP = "application";
- public static String getExpressDeployProject(IServerAttributes attributes ) {
- return attributes.getAttribute(ATTRIBUTE_DEPLOY_PROJECT,
- attributes.getAttribute(ATTRIBUTE_DEPLOY_PROJECT_LEGACY, (String)null));
- }
-
- private static IProject getExpressDeployProject2(IServerAttributes attributes) {
- String name = getExpressDeployProject(attributes);
- return name == null ? null : ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- }
+ /* For use in finding not just the effective value, but values stored either in project or server */
+ public static int SETTING_FROM_PROJECT = 1;
+ public static int SETTING_FROM_SERVER = 2;
+ public static int SETTING_EFFECTIVE_VALUE = 3;
public static String getProjectAttribute(IProject project, String attributeName, String defaultVal) {
if( project == null )
@@ -116,6 +108,7 @@
return node.get(attributeName, defaultVal);
}
+ /* Settings stored only in the project */
public static String getExpressApplicationName(IServerAttributes attributes ) {
return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_APPLICATION_NAME,
attributes.getAttribute(ATTRIBUTE_APPLICATION_NAME, (String)null));
@@ -131,25 +124,69 @@
attributes.getAttribute(ATTRIBUTE_DOMAIN, (String)null));
}
+ public static String getExpressUsername(IServerAttributes attributes ) {
+ return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_USERNAME,
+ attributes.getAttribute(ATTRIBUTE_USERNAME, (String)null));
+ }
+
+
+ /* Settings stored in the project, maybe over-ridden in the server */
public static String getExpressDeployFolder(IServerAttributes attributes ) {
- return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_DEPLOY_FOLDER_NAME,
- attributes.getAttribute(ATTRIBUTE_DEPLOY_FOLDER_NAME, (String)null));
+ if( getOverridesProject(attributes))
+ return attributes.getAttribute(ATTRIBUTE_DEPLOY_FOLDER_NAME, ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
+ return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_DEPLOY_FOLDER_NAME,
+ ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
}
public static String getExpressRemoteName(IServerAttributes attributes ) {
- return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_REMOTE_NAME,
- attributes.getAttribute(ATTRIBUTE_REMOTE_NAME,(String)null));
+ if( getOverridesProject(attributes))
+ return attributes.getAttribute(ATTRIBUTE_REMOTE_NAME, ATTRIBUTE_REMOTE_NAME_DEFAULT);
+ return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_REMOTE_NAME,
+ ATTRIBUTE_REMOTE_NAME_DEFAULT);
}
- public static String getExpressUsername(IServerAttributes attributes ) {
- return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_USERNAME,
- attributes.getAttribute(ATTRIBUTE_USERNAME, (String)null));
+ public static String getExpressDeployFolder(IServerAttributes attributes, int fromWhere ) {
+ String fromServer = attributes.getAttribute(ATTRIBUTE_DEPLOY_FOLDER_NAME,(String)null);
+ if( fromWhere == SETTING_FROM_SERVER)
+ return fromServer;
+ String fromProject = getProjectAttribute(getExpressDeployProject2(attributes), SETTING_DEPLOY_FOLDER_NAME, null);
+ if( fromWhere == SETTING_FROM_PROJECT)
+ return fromProject;
+ if( getOverridesProject(attributes))
+ return fromServer == null ? ATTRIBUTE_DEPLOY_FOLDER_DEFAULT : fromServer;
+ return fromProject == null ? ATTRIBUTE_DEPLOY_FOLDER_DEFAULT : fromProject;
}
+
+ public static String getExpressRemoteName(IServerAttributes attributes, int fromWhere ) {
+ String fromServer = attributes.getAttribute(ATTRIBUTE_REMOTE_NAME,(String)null);
+ if( fromWhere == SETTING_FROM_SERVER)
+ return fromServer;
+ String fromProject = getProjectAttribute(getExpressDeployProject2(attributes), SETTING_REMOTE_NAME, null);
+ if( fromWhere == SETTING_FROM_PROJECT)
+ return fromProject;
+ if( getOverridesProject(attributes))
+ return fromServer == null ? ATTRIBUTE_REMOTE_NAME_DEFAULT : fromServer;
+ return fromProject == null ? ATTRIBUTE_REMOTE_NAME_DEFAULT : fromProject;
+ }
+ /* Settings stored only in the server */
+ public static String getExpressDeployProject(IServerAttributes attributes ) {
+ return attributes.getAttribute(ATTRIBUTE_DEPLOY_PROJECT,
+ attributes.getAttribute(ATTRIBUTE_DEPLOY_PROJECT_LEGACY, (String)null));
+ }
+
+ private static IProject getExpressDeployProject2(IServerAttributes attributes) {
+ String name = getExpressDeployProject(attributes);
+ return name == null ? null : ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ }
public static boolean getIgnoresContextRoot(IServerAttributes server) {
return server.getAttribute(PREFERENCE_IGNORE_CONTEXT_ROOT, true);
}
+ public static boolean getOverridesProject(IServerAttributes server) {
+ return server.getAttribute(ATTRIBUTE_OVERRIDE_PROJECT_SETTINGS, false);
+ }
+
public static IServer setIgnoresContextRoot(IServerAttributes server, boolean val) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
wc.setAttribute(ATTRIBUTE_REMOTE_NAME, val);
@@ -169,17 +206,16 @@
* @return
* @throws CoreException
*/
- @SuppressWarnings("restriction")
public static IServer fillServerWithOpenShiftDetails(IServer server, String host,
- String deployProject) throws CoreException {
+ String deployProject, String remote) throws CoreException {
ServerWorkingCopy wc = (ServerWorkingCopy)server.createWorkingCopy();
- fillServerWithOpenShiftDetails((IServerWorkingCopy)wc, host, deployProject);
+ fillServerWithOpenShiftDetails((IServerWorkingCopy)wc, host, deployProject,remote);
IServer saved = wc.save(true, new NullProgressMonitor());
return saved;
}
public static void fillServerWithOpenShiftDetails(IServerWorkingCopy wc, String host,
- String deployProject) {
+ String deployProject, String remote) {
if( host != null ) {
if( host.indexOf("://") != -1)
@@ -196,7 +232,7 @@
// wc.setAttribute(ATTRIBUTE_APPLICATION_ID, appId);
// wc.setAttribute(ATTRIBUTE_DEPLOY_FOLDER_NAME, projectRelativeFolder);
// wc.setAttribute(ATTRIBUTE_EXPRESS_MODE, mode);
-// wc.setAttribute(ATTRIBUTE_REMOTE_NAME, remoteName);
+ wc.setAttribute(ATTRIBUTE_REMOTE_NAME, remote);
((ServerWorkingCopy)wc).setAutoPublishSetting(Server.AUTO_PUBLISH_DISABLE);
wc.setAttribute(IJBossToolingConstants.IGNORE_LAUNCH_COMMANDS, "true");
wc.setAttribute(IJBossToolingConstants.WEB_PORT, 80);
@@ -266,6 +302,13 @@
return null;
}
+ /**
+ * This method will search available projects for one that has a
+ * git remote URI that matches that of this IApplication
+ *
+ * @param application
+ * @return
+ */
public static IProject[] findProjectsForApplication(final IApplication application) {
final ArrayList<IProject> results = new ArrayList<IProject>();
if( application ==null )
@@ -289,6 +332,30 @@
return results.toArray(new IProject[results.size()]);
}
+ /**
+ * This method will search for all projects connected to git
+ * and having the proper settings file containing
+ * domain, application id, app name, and username
+ *
+ * @return
+ */
+ public static IProject[] findAllSuitableOpenshiftProjects() {
+ final ArrayList<IProject> results = new ArrayList<IProject>();
+ final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for( int i = 0; i < projects.length; i++ ) {
+ if( EGitUtils.getRepository(projects[i]) != null ) {
+ String appName = getProjectAttribute(projects[i], SETTING_APPLICATION_NAME, null);
+ String appId = getProjectAttribute(projects[i], SETTING_APPLICATION_ID, null);
+ String domain = getProjectAttribute(projects[i], SETTING_DOMAIN, null);
+ String username = getProjectAttribute(projects[i], SETTING_USERNAME, null);
+ if( appName != null && appId != null && domain != null && username != null ) {
+ results.add(projects[i]);
+ }
+ }
+ }
+ return results.toArray(new IProject[results.size()]);
+ }
+
public static IProject findProjectForApplication(IApplication application) {
IProject[] p = findProjectsForApplication(application);
return p == null ? null : p.length == 0 ? null : p[0];
@@ -318,8 +385,8 @@
}
}
- public static void updateOpenshiftProjectSettings(IProject project, IApplication app, UserDelegate user,
- String remoteName, String deployFolder) {
+ public static void updateOpenshiftProjectSettings(IProject project, IApplication app,
+ UserDelegate user, String remoteName, String deployFolder) {
String qualifier = OpenShiftUIActivator.getDefault().getBundle().getSymbolicName();
IScopeContext context = new ProjectScope(project);
IEclipsePreferences node = context.getNode(qualifier);
@@ -336,48 +403,37 @@
}
}
-
- /* Deprecated */
- public static IServer setExpressMode(IServer server, String val) throws CoreException {
+ public static IServer setExpressDeployProject(IServer server, String val) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
- wc.setAttribute(ATTRIBUTE_EXPRESS_MODE, val);
+ wc.setAttribute(ATTRIBUTE_DEPLOY_PROJECT, val);
return wc.save(false, new NullProgressMonitor());
}
- public static IServer setExpressApplication(IServer server, String val) throws CoreException {
+ public static IServer setExpressRemoteName(IServer server, String val) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
- wc.setAttribute(ATTRIBUTE_APPLICATION_NAME, val);
+ wc.setAttribute(ATTRIBUTE_REMOTE_NAME, val);
return wc.save(false, new NullProgressMonitor());
}
- public static IServer setExpressDeployProject(IServer server, String val) throws CoreException {
+
+
+ /* Deprecated: These details cannot be changed and are no longer stored in the server
+ * Delete when certain no problems will be caused.
+ */
+ @Deprecated
+ public static IServer setExpressApplication(IServer server, String val) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
- wc.setAttribute(ATTRIBUTE_DEPLOY_PROJECT, val);
+ wc.setAttribute(ATTRIBUTE_APPLICATION_NAME, val);
return wc.save(false, new NullProgressMonitor());
}
+ @Deprecated
public static IServer setExpressDomain(IServer server, String val) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
wc.setAttribute(ATTRIBUTE_DOMAIN, val);
return wc.save(false, new NullProgressMonitor());
}
+ @Deprecated
public static IServer setExpressUsername(IServer server, String val) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
wc.setAttribute(ATTRIBUTE_USERNAME, val);
return wc.save(false, new NullProgressMonitor());
}
-
- public static IServer setExpressRemoteName(IServer server, String val) throws CoreException {
- IServerWorkingCopy wc = server.createWorkingCopy();
- wc.setAttribute(ATTRIBUTE_REMOTE_NAME, val);
- return wc.save(false, new NullProgressMonitor());
- }
- public static String getExpressMode(IServerAttributes attributes ) {
- return attributes.getAttribute(ATTRIBUTE_EXPRESS_MODE, EXPRESS_SOURCE_MODE);
- }
-
- public static String getExpressModeAsString(IServerAttributes attributes) {
- String mode = getExpressMode(attributes);
- if( mode.equals(EXPRESS_SOURCE_MODE))
- return "Source";
- return "Binary";
- }
-
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-04-30 15:54:00 UTC (rev 40652)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-04-30 15:56:40 UTC (rev 40653)
@@ -104,14 +104,12 @@
private List<IApplication> appList;
private String[] appListNames;
private IServerWorkingCopy server;
- private String mode;
private HashMap<IApplication, IProject[]> projectsPerApp = new HashMap<IApplication, IProject[]>();
private boolean credentialsFailed = false;
- public ExpressDetailsComposite(Composite fill, IServerModeUICallback callback, String mode, boolean showVerify) {
+ public ExpressDetailsComposite(Composite fill, IServerModeUICallback callback, boolean showVerify) {
this.callback = callback;
this.server = callback.getServer();
- this.mode = mode;
this.composite = fill;
this.showVerify = showVerify;
this.showImportLink = showVerify;
@@ -277,6 +275,10 @@
importLink.setLayoutData(gd);
}
+ Label remoteLabel = new Label(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(remoteLabel);
+ remoteText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(remoteText);
Group projectSettings = new Group(composite, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(2,1).applyTo(projectSettings);
@@ -293,13 +295,6 @@
browseDestButton.setLayoutData(UIUtil.createFormData2(0,5,100,-5,null,0,100,0));
deployFolderText = new Text(zipDestComposite, SWT.SINGLE | SWT.BORDER);
deployFolderText.setLayoutData(UIUtil.createFormData2(0,5,100,-5,0,0,browseDestButton,-5));
-
-
-
- Label remoteLabel = new Label(projectSettings, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(remoteLabel);
- remoteText = new Text(projectSettings, SWT.SINGLE | SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(remoteText);
// Text
projectSettings.setText("Project Settings");
@@ -416,27 +411,17 @@
}
private void deployProjectChanged() {
- System.out.println("HEEEEEEEEEEY!");
int i = deployProjectCombo.getSelectionIndex();
if( i != -1 ) {
IProject depProj = ResourcesPlugin.getWorkspace().getRoot().getProject(deployProject);
if( depProj != null && depProj.isAccessible() ) {
- String remote = ExpressServerUtils.getProjectAttribute(depProj,
- ExpressServerUtils.SETTING_REMOTE_NAME, null);
- //ExpressServerUtils.ATTRIBUTE_REMOTE_NAME_DEFAULT);
String depFolder = ExpressServerUtils.getProjectAttribute(depProj,
ExpressServerUtils.SETTING_DEPLOY_FOLDER_NAME, null);
//ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
- if( remote == null ) {
- remoteText.setText(ExpressServerUtils.ATTRIBUTE_REMOTE_NAME_DEFAULT);
- }
if( depFolder == null )
deployFolderText.setText(ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
-
- boolean enabled = remote == null && depFolder == null;
- remoteText.setEnabled(enabled);
- deployFolderText.setEnabled(enabled);
- browseDestButton.setEnabled(enabled);
+ deployFolderText.setEnabled(depFolder == null);
+ browseDestButton.setEnabled(depFolder == null);
}
}
}
@@ -626,7 +611,7 @@
// update the values
IServerWorkingCopy wc = callback.getServer();
String host = fapplication == null ? null : fapplication.getApplicationUrl();
- ExpressServerUtils.fillServerWithOpenShiftDetails(wc, host, deployProject);
+ ExpressServerUtils.fillServerWithOpenShiftDetails(wc, host, deployProject,remote);
}
private void updateProjectSettings() {
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java 2012-04-30 15:54:00 UTC (rev 40652)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java 2012-04-30 15:56:40 UTC (rev 40653)
@@ -10,30 +10,62 @@
*******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.behaviour;
+import java.util.Arrays;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormLayout;
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.Display;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.internal.ide.dialogs.ResourceComparator;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.ui.editor.ServerEditorSection;
+import org.eclipse.wst.server.ui.internal.editor.ServerEditorPartInput;
import org.jboss.ide.eclipse.as.ui.UIUtil;
+import org.jboss.ide.eclipse.as.ui.editor.ServerWorkingCopyPropertyButtonCommand;
+import org.jboss.ide.eclipse.as.ui.editor.ServerWorkingCopyPropertyComboCommand;
+import org.jboss.ide.eclipse.as.ui.editor.ServerWorkingCopyPropertyCommand;
import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
public class ExpressDetailsSection extends ServerEditorSection {
private IEditorInput input;
protected Text userText, remoteText;
protected Text deployFolderText;
- protected Text appNameText, deployProjectText;
- protected Button verifyButton; // browseDestButton;
+ protected Text appNameText;
+ protected Combo deployProjectCombo;
+ protected Button verifyButton, browseDestButton, overrideProjectSettings;
+ protected Group projectSettingGroup;
public void init(IEditorSite site, IEditorInput input) {
super.init(site, input);
@@ -55,29 +87,49 @@
section.setClient(c);
initWidgets();
-// addListeners();
+ addListeners();
}
protected void initWidgets() {
// Set the widgets
String user = ExpressServerUtils.getExpressUsername(server);
String appName = ExpressServerUtils.getExpressApplicationName(server);
- String depProj = ExpressServerUtils.getExpressDeployProject(server);
+ deployProjectCombo.setEnabled(true);
userText.setText(user == null ? "" : user);
appNameText.setText(appName == null ? "" : appName);
- deployProjectText.setText(depProj == null ? "" : depProj);
userText.setEnabled(false);
appNameText.setEnabled(false);
- deployProjectText.setEnabled(false);
String outDir = ExpressServerUtils.getExpressDeployFolder(server);
String remote = ExpressServerUtils.getExpressRemoteName(server);
deployFolderText.setText(outDir == null ? "" : outDir);
remoteText.setText(remote == null ? "" : remote);
- remoteText.setEnabled(false);
- deployFolderText.setEnabled(false);
+
+ deployProjectCombo.setItems(getSuitableProjects());
+ java.util.List<String> l = Arrays.asList(deployProjectCombo.getItems());
+ String depProj = ExpressServerUtils.getExpressDeployProject(server);
+ if( depProj != null ) {
+ int ind = l.indexOf(depProj);
+ if( ind != -1 )
+ deployProjectCombo.select(ind);
+ }
+
+ boolean overrides = ExpressServerUtils.getOverridesProject(server);
+ overrideProjectSettings.setSelection(overrides);
+ remoteText.setEnabled(overrides);
+ deployFolderText.setEnabled(overrides);
+ browseDestButton.setEnabled(overrides);
}
+ private String[] getSuitableProjects() {
+ IProject[] all = ExpressServerUtils.findAllSuitableOpenshiftProjects();
+ String[] s = new String[all.length];
+ for( int i = 0; i < all.length; i++ ) {
+ s[i] = all[i].getName();
+ }
+ return s;
+ }
+
protected Composite createComposite(Section section) {
createWidgets(section);
return section;
@@ -87,35 +139,42 @@
composite.setLayout(new GridLayout(2, false));
Label deployLocationLabel = new Label(composite, SWT.NONE);
- deployProjectText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(deployProjectText);
+ deployProjectCombo = new Combo(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(deployProjectCombo);
- Label userLabel = new Label(composite, SWT.NONE);
+ projectSettingGroup = new Group(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(2, 1).applyTo(projectSettingGroup);
+ projectSettingGroup.setLayout(new GridLayout(2, false));
+
+ overrideProjectSettings = new Button(projectSettingGroup, SWT.CHECK);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(2, 1).applyTo(overrideProjectSettings);
+
+ Label userLabel = new Label(projectSettingGroup, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(userLabel);
- userText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ userText = new Text(projectSettingGroup, SWT.SINGLE | SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(userText);
- Label appNameLabel = new Label(composite, SWT.NONE);
+ Label appNameLabel = new Label(projectSettingGroup, SWT.NONE);
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).applyTo(appNameLabel);
- appNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ appNameText = new Text(projectSettingGroup, SWT.SINGLE | SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(appNameText);
+
+ Label zipDestLabel = new Label(projectSettingGroup, SWT.NONE);
+ Composite zipDestComposite = new Composite(projectSettingGroup, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(zipDestComposite);
+ zipDestComposite.setLayout(new FormLayout());
+ browseDestButton = new Button(zipDestComposite, SWT.PUSH);
+ browseDestButton.setLayoutData(UIUtil.createFormData2(0,5,100,-5,null,0,100,0));
+ deployFolderText = new Text(zipDestComposite, SWT.SINGLE | SWT.BORDER);
+ deployFolderText.setLayoutData(UIUtil.createFormData2(0,5,100,-5,0,0,browseDestButton,-5));
- Label zipDestLabel = new Label(composite, SWT.NONE);
+ Label remoteLabel = new Label(projectSettingGroup, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(remoteLabel);
+ remoteText = new Text(projectSettingGroup, SWT.SINGLE | SWT.BORDER);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(remoteText);
-// Composite zipDestComposite = new Composite(composite, SWT.NONE);
-// GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(zipDestComposite);
-// zipDestComposite.setLayout(new FormLayout());
-// browseDestButton = new Button(zipDestComposite, SWT.PUSH);
-// browseDestButton.setLayoutData(UIUtil.createFormData2(0,5,100,-5,null,0,100,0));
- deployFolderText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- //deployFolderText.setLayoutData(UIUtil.createFormData2(0,5,100,-5,0,0,100,0));
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(deployFolderText);
- Label remoteLabel = new Label(composite, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(remoteLabel);
- remoteText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(remoteText);
// Text
appNameLabel.setText("Application Name: ");
@@ -123,76 +182,138 @@
zipDestLabel.setText("Output Directory: ");
userLabel.setText("Username: ");
remoteLabel.setText("Remote: ");
-// browseDestButton.setText("Browse...");
+ browseDestButton.setText("Browse...");
+ projectSettingGroup.setText("Project Settings:");
+ overrideProjectSettings.setText("Override Project Settings");
}
-// ModifyListener remoteModifyListener, deployDestinationModifyListener;
-// protected void addListeners() {
-// remoteModifyListener = new ModifyListener() {
-// public void modifyText(ModifyEvent e) {
-// ((ServerEditorPartInput) input).getServerCommandManager().execute(new SetRemoteCommand(server));
-// }
-// };
-// remoteText.addModifyListener(remoteModifyListener);
-// deployDestinationModifyListener = new ModifyListener() {
-// public void modifyText(ModifyEvent e) {
-// ((ServerEditorPartInput) input).getServerCommandManager().execute(new SetDeployFolderCommand(server));
-// }
-// };
-// deployFolderText.addModifyListener(deployDestinationModifyListener);
-//
-// browseDestButton.addSelectionListener(new SelectionAdapter() {
-// public void widgetSelected(SelectionEvent e) {
-// browsePressed();
-// }
-// });
+ ModifyListener remoteModifyListener, deployDestinationModifyListener, deployProjectListener;
+ SelectionListener overrideListener;
+ protected void addListeners() {
+ deployProjectListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ int ind = deployProjectCombo.getSelectionIndex();
+ String newVal = ind == -1 ? null : deployProjectCombo.getItem(ind);
+ ((ServerEditorPartInput) input).getServerCommandManager().execute(
+ new SetProjectCommand(server, newVal));
+ }};
+ deployProjectCombo.addModifyListener(deployProjectListener);
+ overrideListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ ((ServerEditorPartInput) input).getServerCommandManager().execute(new SetOverrideCommand(server));
+ }
+ };
+ overrideProjectSettings.addSelectionListener(overrideListener);
-// }
-//
-// private void browsePressed() {
-// IFolder f = chooseFolder();
-// if( f != null ) {
-// deployFolderText.setText(f.getFullPath().removeFirstSegments(1).makeRelative().toOSString());
-// }
-// }
+
+ remoteModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ ((ServerEditorPartInput) input).getServerCommandManager().execute(new SetRemoteCommand(server));
+ }
+ };
+ remoteText.addModifyListener(remoteModifyListener);
+ deployDestinationModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ ((ServerEditorPartInput) input).getServerCommandManager().execute(new SetDeployFolderCommand(server));
+ }
+ };
+ deployFolderText.addModifyListener(deployDestinationModifyListener);
+
+ browseDestButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ browsePressed();
+ }
+ });
+
+ }
-// private IFolder chooseFolder() {
-// String depProject = ExpressServerUtils.getExpressDeployProject(server);
-// String depFolder = ExpressServerUtils.getExpressDeployFolder(server);
-//
-// IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(depProject);
-//
-// ILabelProvider lp= new WorkbenchLabelProvider();
-// ITreeContentProvider cp= new WorkbenchContentProvider();
-//
-// ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(Display.getDefault().getActiveShell(), lp, cp);
-// dialog.setTitle("Deploy Location");
-// dialog.setMessage("Please choose a location to put zipped projects");
-// dialog.setInput(p);
-// dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
-//
-// IResource res= p.findMember(new Path(depFolder));
-// if (res != null)
-// dialog.setInitialSelection(res);
-//
-// if (dialog.open() == Window.OK)
-// return (IFolder) dialog.getFirstResult();
-// return null;
-// }
-//
-// public class SetRemoteCommand extends ServerWorkingCopyPropertyCommand {
-// public SetRemoteCommand(IServerWorkingCopy server) {
-// super(server, "Change Remote Name", remoteText, remoteText.getText(),
-// ExpressServerUtils.ATTRIBUTE_REMOTE_NAME, remoteModifyListener,
-// ExpressServerUtils.ATTRIBUTE_REMOTE_NAME_DEFAULT);
-// }
-// }
-//
-// public class SetDeployFolderCommand extends ServerWorkingCopyPropertyCommand {
-// public SetDeployFolderCommand(IServerWorkingCopy server) {
-// super(server, "Change Deployment Folder", deployFolderText, deployFolderText.getText(),
-// ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_NAME, deployDestinationModifyListener,
-// ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
-// }
-// }
+ private void browsePressed() {
+ IFolder f = chooseFolder();
+ if( f != null ) {
+ deployFolderText.setText(f.getFullPath().removeFirstSegments(1).makeRelative().toOSString());
+ }
+ }
+
+ private IFolder chooseFolder() {
+ String depProject = ExpressServerUtils.getExpressDeployProject(server);
+ String depFolder = ExpressServerUtils.getExpressDeployFolder(server);
+
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(depProject);
+
+ ILabelProvider lp= new WorkbenchLabelProvider();
+ ITreeContentProvider cp= new WorkbenchContentProvider();
+
+ ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(Display.getDefault().getActiveShell(), lp, cp);
+ dialog.setTitle("Deploy Location");
+ dialog.setMessage("Please choose a location to put zipped projects");
+ dialog.setInput(p);
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+
+ IResource res= p.findMember(new Path(depFolder));
+ if (res != null)
+ dialog.setInitialSelection(res);
+
+ if (dialog.open() == Window.OK)
+ return (IFolder) dialog.getFirstResult();
+ return null;
+ }
+
+ public class SetRemoteCommand extends ServerWorkingCopyPropertyCommand {
+ public SetRemoteCommand(IServerWorkingCopy server) {
+ super(server, "Change Remote Name", remoteText, remoteText.getText(),
+ ExpressServerUtils.ATTRIBUTE_REMOTE_NAME, remoteModifyListener,
+ ExpressServerUtils.ATTRIBUTE_REMOTE_NAME_DEFAULT);
+ }
+ }
+
+ public class SetProjectCommand extends ServerWorkingCopyPropertyComboCommand {
+ public SetProjectCommand(IServerWorkingCopy wc, String newVal) {
+ super(wc, "Change Openshift Project", deployProjectCombo, newVal, ExpressServerUtils.ATTRIBUTE_DEPLOY_PROJECT, deployProjectListener);
+ }
+ @Override
+ protected void postOp(int type) {
+ updateWidgetsFromWorkingCopy();
+ }
+ }
+
+ public class SetDeployFolderCommand extends ServerWorkingCopyPropertyCommand {
+ public SetDeployFolderCommand(IServerWorkingCopy server) {
+ super(server, "Change Deployment Folder", deployFolderText, deployFolderText.getText(),
+ ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_NAME, deployDestinationModifyListener,
+ ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
+ }
+ }
+
+ public class SetOverrideCommand extends ServerWorkingCopyPropertyButtonCommand {
+ public SetOverrideCommand(IServerWorkingCopy wc) {
+ super(wc, "Override Openshift Project Settings Command",
+ overrideProjectSettings, overrideProjectSettings.getSelection(),
+ ExpressServerUtils.ATTRIBUTE_OVERRIDE_PROJECT_SETTINGS, overrideListener);
+ }
+ @Override
+ protected void postOp(int type) {
+ updateWidgetsFromWorkingCopy();
+ }
+ }
+ private void updateWidgetsFromWorkingCopy() {
+ String user = ExpressServerUtils.getExpressUsername(server);
+ String appName = ExpressServerUtils.getExpressApplicationName(server);
+ userText.setText(user == null ? "" : user);
+ appNameText.setText(appName == null ? "" : appName);
+
+ browseDestButton.setEnabled(overrideProjectSettings.getSelection());
+ deployFolderText.setEnabled(overrideProjectSettings.getSelection());
+ remoteText.setEnabled(overrideProjectSettings.getSelection());
+ String remote = ExpressServerUtils.getExpressRemoteName(server, ExpressServerUtils.SETTING_FROM_PROJECT);
+ String depFolder = ExpressServerUtils.getExpressDeployFolder(server, ExpressServerUtils.SETTING_FROM_PROJECT);
+ remote = remote == null ? "" : remote;
+ depFolder = depFolder == null ? "" : depFolder;
+
+ remoteText.removeModifyListener(remoteModifyListener);
+ deployFolderText.removeModifyListener(deployDestinationModifyListener);
+ remoteText.setText(remote);
+ deployFolderText.setText(depFolder);
+ remoteText.addModifyListener(remoteModifyListener);
+ deployFolderText.addModifyListener(deployDestinationModifyListener);
+ }
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java 2012-04-30 15:54:00 UTC (rev 40652)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java 2012-04-30 15:56:40 UTC (rev 40653)
@@ -30,7 +30,6 @@
private NewServerWizardBehaviourCallback callback;
public ExpressWizardFragment() {
- System.out.println("NEW FRAGMENT");
}
public boolean hasComposite() {
@@ -61,7 +60,7 @@
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
this.composite = new ExpressDetailsComposite(
- composite, callback,ExpressServerUtils.EXPRESS_SOURCE_MODE, true);
+ composite, callback, true);
return this.composite.getComposite();
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftExpressWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftExpressWizardModel.java 2012-04-30 15:54:00 UTC (rev 40652)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftExpressWizardModel.java 2012-04-30 15:56:40 UTC (rev 40653)
@@ -23,7 +23,6 @@
import org.eclipse.wst.server.core.IServerType;
import org.jboss.tools.common.databinding.IObservablePojo;
import org.jboss.tools.openshift.egit.ui.util.EGitUIUtils;
-import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
import com.openshift.client.ApplicationScale;
import com.openshift.client.IApplication;
@@ -52,9 +51,6 @@
public static final String MERGE_URI = "mergeUri";
public static final String RUNTIME_DELEGATE = "runtimeDelegate";
public static final String CREATE_SERVER_ADAPTER = "createServerAdapter";
- public static final String PUBLICATION_MODE = "serverMode";
- public static final String PUBLISH_SOURCE = ExpressServerUtils.EXPRESS_SOURCE_MODE;
- public static final String PUBLISH_BINARY = ExpressServerUtils.EXPRESS_BINARY_MODE;
public static final String SERVER_TYPE = "serverType";
public static final String NEW_PROJECT_REMOTE_NAME_DEFAULT = "origin";
public static final String EXISTING_PROJECT_REMOTE_NAME_DEFAULT = "openshift";
@@ -183,8 +179,6 @@
public IRuntime getRuntime();
- public String getMode();
-
public boolean isCreateServerAdapter();
public IServerType getServerType();
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-04-30 15:54:00 UTC (rev 40652)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-04-30 15:56:40 UTC (rev 40653)
@@ -65,7 +65,6 @@
setRepositoryPath(DEFAULT_REPOSITORY_PATH);
setRemoteName(NEW_PROJECT_REMOTE_NAME_DEFAULT);
setServerType(ServerCore.findServerType(ExpressServerUtils.OPENSHIFT_SERVER_TYPE));
- setPublicationMode(PUBLISH_SOURCE);
}
/**
@@ -104,8 +103,7 @@
IProject project = p;
// Add the settings here!
ExpressServerUtils.updateOpenshiftProjectSettings(project, app,
- getUser(), getRemoteName(),
- ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
+ getUser(), getRemoteName(), ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
return;
}
}
@@ -328,11 +326,6 @@
}
@Override
- public String getMode() {
- return (String) getProperty(PUBLICATION_MODE);
- }
-
- @Override
public boolean isCreateServerAdapter() {
Boolean isCreateServer = (Boolean) getProperty(CREATE_SERVER_ADAPTER);
return isCreateServer != null && isCreateServer.booleanValue();
@@ -348,10 +341,6 @@
return (IServerType) setProperty(SERVER_TYPE, serverType);
}
- private void setPublicationMode(String mode) {
- setProperty(PUBLICATION_MODE, mode);
- }
-
@Override
public boolean isUseExistingApplication() {
return (Boolean) getProperty(USE_EXISTING_APPLICATION);
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-04-30 15:54:00 UTC (rev 40652)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java 2012-04-30 15:56:40 UTC (rev 40653)
@@ -51,13 +51,13 @@
}
public void create(IProject project, IOpenShiftExpressWizardModel wizardModel, IProgressMonitor monitor) throws OpenShiftException {
- createServerAdapter(project, wizardModel.getServerType(), wizardModel.getRuntime(), wizardModel.getMode(),
+ createServerAdapter(project, wizardModel.getServerType(), wizardModel.getRuntime(),
wizardModel.getApplication(), wizardModel.getUser(), wizardModel.getRemoteName(), monitor);
}
- public void create(IProject project, IServerType serverType, IRuntime runtime, String mode,
+ public void create(IProject project, IServerType serverType, IRuntime runtime,
IApplication application, UserDelegate user, IProgressMonitor monitor) throws OpenShiftException {
- createServerAdapter(project, serverType, runtime, mode, application, user, null, monitor);
+ createServerAdapter(project, serverType, runtime, application, user, null, monitor);
}
/**
@@ -67,21 +67,21 @@
* the monitor to report progress to.
* @throws OpenShiftException
*/
- protected void createServerAdapter(IProject project, IServerType serverType, IRuntime runtime, String mode,
+ protected void createServerAdapter(IProject project, IServerType serverType, IRuntime runtime,
IApplication application, UserDelegate user,
String remoteName, IProgressMonitor monitor) throws OpenShiftException {
String name = project.getName();
monitor.subTask(NLS.bind("Creating server adapter for project {0}", name));
createServerAdapter(Collections.singletonList(project), serverType, runtime,
- mode, application, user, project.getName(), remoteName, monitor);
+ application, user, project.getName(), remoteName, monitor);
}
protected void createServerAdapter(List<IProject> importedProjects, IServerType serverType,
- IRuntime runtime, String mode, IApplication application, UserDelegate user,
+ IRuntime runtime, IApplication application, UserDelegate user,
String deployProject, String remoteName, IProgressMonitor monitor) {
try {
renameWebContextRoot(importedProjects);
- IServer server = doCreateServerAdapter(serverType, runtime, mode, application, user, deployProject, remoteName);
+ IServer server = doCreateServerAdapter(serverType, runtime, application, user, deployProject, remoteName);
addModules(getModules(importedProjects), server, monitor);
} catch (CoreException ce) {
OpenShiftUIActivator.getDefault().getLog().log(ce.getStatus());
@@ -102,11 +102,10 @@
}
}
- private IServer doCreateServerAdapter(IServerType serverType, IRuntime rt, String mode,
+ private IServer doCreateServerAdapter(IServerType serverType, IRuntime rt,
IApplication application, UserDelegate user, String deployProject, String remoteName) throws CoreException,
OpenShiftException, SocketTimeoutException {
Assert.isLegal(serverType != null);
- Assert.isLegal(mode != null);
Assert.isLegal(application != null);
Assert.isLegal(user != null);
@@ -115,7 +114,7 @@
IServer server = ExpressServerUtils.createServer(rt, serverType, serverName);
ExpressServerUtils.fillServerWithOpenShiftDetails(server,
- application.getApplicationUrl(), deployProject);
+ application.getApplicationUrl(), deployProject, remoteName);
return server;
}
12 years, 7 months
JBoss Tools SVN: r40652 - in branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal: ui/behaviour and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2012-04-30 11:54:00 -0400 (Mon, 30 Apr 2012)
New Revision: 40652
Modified:
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftExpressWizardModel.java
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java
Log:
JBIDE-11487 applied rstrykers/rawblems patch to b3
Modified: branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
===================================================================
--- branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-04-30 15:41:30 UTC (rev 40651)
+++ branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-04-30 15:54:00 UTC (rev 40652)
@@ -43,7 +43,6 @@
import org.jboss.tools.openshift.express.internal.core.console.UserModel;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
-import org.jboss.tools.openshift.express.internal.ui.wizard.IOpenShiftExpressWizardModel;
import org.osgi.service.prefs.BackingStoreException;
import com.openshift.client.IApplication;
@@ -59,10 +58,8 @@
@SuppressWarnings("restriction")
public class ExpressServerUtils {
/* Server Settings */
- public static final String ATTRIBUTE_EXPRESS_MODE = "org.jboss.tools.openshift.express.internal.core.behaviour.ExpressMode";
- public static final String EXPRESS_BINARY_MODE = "publishBinary";
- public static final String EXPRESS_SOURCE_MODE = "publishSource";
public static final String ATTRIBUTE_DEPLOY_PROJECT = "org.jboss.tools.openshift.binary.deployProject";
+ public static final String ATTRIBUTE_OVERRIDE_PROJECT_SETTINGS = "org.jboss.tools.openshift.project.override";
/* Legacy Server Settings: Please usage scan before removal */
public static final String ATTRIBUTE_DEPLOY_PROJECT_LEGACY = "org.jboss.tools.openshift.express.internal.core.behaviour.binary.deployProject";
@@ -97,15 +94,10 @@
public static final String TASK_WIZARD_ATTR_APP_LIST = "appList";
public static final String TASK_WIZARD_ATTR_SELECTED_APP = "application";
- public static String getExpressDeployProject(IServerAttributes attributes ) {
- return attributes.getAttribute(ATTRIBUTE_DEPLOY_PROJECT,
- attributes.getAttribute(ATTRIBUTE_DEPLOY_PROJECT_LEGACY, (String)null));
- }
-
- private static IProject getExpressDeployProject2(IServerAttributes attributes) {
- String name = getExpressDeployProject(attributes);
- return name == null ? null : ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- }
+ /* For use in finding not just the effective value, but values stored either in project or server */
+ public static int SETTING_FROM_PROJECT = 1;
+ public static int SETTING_FROM_SERVER = 2;
+ public static int SETTING_EFFECTIVE_VALUE = 3;
public static String getProjectAttribute(IProject project, String attributeName, String defaultVal) {
if( project == null )
@@ -116,6 +108,7 @@
return node.get(attributeName, defaultVal);
}
+ /* Settings stored only in the project */
public static String getExpressApplicationName(IServerAttributes attributes ) {
return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_APPLICATION_NAME,
attributes.getAttribute(ATTRIBUTE_APPLICATION_NAME, (String)null));
@@ -131,25 +124,69 @@
attributes.getAttribute(ATTRIBUTE_DOMAIN, (String)null));
}
+ public static String getExpressUsername(IServerAttributes attributes ) {
+ return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_USERNAME,
+ attributes.getAttribute(ATTRIBUTE_USERNAME, (String)null));
+ }
+
+
+ /* Settings stored in the project, maybe over-ridden in the server */
public static String getExpressDeployFolder(IServerAttributes attributes ) {
- return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_DEPLOY_FOLDER_NAME,
- attributes.getAttribute(ATTRIBUTE_DEPLOY_FOLDER_NAME, (String)null));
+ if( getOverridesProject(attributes))
+ return attributes.getAttribute(ATTRIBUTE_DEPLOY_FOLDER_NAME, ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
+ return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_DEPLOY_FOLDER_NAME,
+ ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
}
public static String getExpressRemoteName(IServerAttributes attributes ) {
- return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_REMOTE_NAME,
- attributes.getAttribute(ATTRIBUTE_REMOTE_NAME,(String)null));
+ if( getOverridesProject(attributes))
+ return attributes.getAttribute(ATTRIBUTE_REMOTE_NAME, ATTRIBUTE_REMOTE_NAME_DEFAULT);
+ return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_REMOTE_NAME,
+ ATTRIBUTE_REMOTE_NAME_DEFAULT);
}
- public static String getExpressUsername(IServerAttributes attributes ) {
- return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_USERNAME,
- attributes.getAttribute(ATTRIBUTE_USERNAME, (String)null));
+ public static String getExpressDeployFolder(IServerAttributes attributes, int fromWhere ) {
+ String fromServer = attributes.getAttribute(ATTRIBUTE_DEPLOY_FOLDER_NAME,(String)null);
+ if( fromWhere == SETTING_FROM_SERVER)
+ return fromServer;
+ String fromProject = getProjectAttribute(getExpressDeployProject2(attributes), SETTING_DEPLOY_FOLDER_NAME, null);
+ if( fromWhere == SETTING_FROM_PROJECT)
+ return fromProject;
+ if( getOverridesProject(attributes))
+ return fromServer == null ? ATTRIBUTE_DEPLOY_FOLDER_DEFAULT : fromServer;
+ return fromProject == null ? ATTRIBUTE_DEPLOY_FOLDER_DEFAULT : fromProject;
}
+
+ public static String getExpressRemoteName(IServerAttributes attributes, int fromWhere ) {
+ String fromServer = attributes.getAttribute(ATTRIBUTE_REMOTE_NAME,(String)null);
+ if( fromWhere == SETTING_FROM_SERVER)
+ return fromServer;
+ String fromProject = getProjectAttribute(getExpressDeployProject2(attributes), SETTING_REMOTE_NAME, null);
+ if( fromWhere == SETTING_FROM_PROJECT)
+ return fromProject;
+ if( getOverridesProject(attributes))
+ return fromServer == null ? ATTRIBUTE_REMOTE_NAME_DEFAULT : fromServer;
+ return fromProject == null ? ATTRIBUTE_REMOTE_NAME_DEFAULT : fromProject;
+ }
+ /* Settings stored only in the server */
+ public static String getExpressDeployProject(IServerAttributes attributes ) {
+ return attributes.getAttribute(ATTRIBUTE_DEPLOY_PROJECT,
+ attributes.getAttribute(ATTRIBUTE_DEPLOY_PROJECT_LEGACY, (String)null));
+ }
+
+ private static IProject getExpressDeployProject2(IServerAttributes attributes) {
+ String name = getExpressDeployProject(attributes);
+ return name == null ? null : ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ }
public static boolean getIgnoresContextRoot(IServerAttributes server) {
return server.getAttribute(PREFERENCE_IGNORE_CONTEXT_ROOT, true);
}
+ public static boolean getOverridesProject(IServerAttributes server) {
+ return server.getAttribute(ATTRIBUTE_OVERRIDE_PROJECT_SETTINGS, false);
+ }
+
public static IServer setIgnoresContextRoot(IServerAttributes server, boolean val) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
wc.setAttribute(ATTRIBUTE_REMOTE_NAME, val);
@@ -169,17 +206,16 @@
* @return
* @throws CoreException
*/
- @SuppressWarnings("restriction")
public static IServer fillServerWithOpenShiftDetails(IServer server, String host,
- String deployProject) throws CoreException {
+ String deployProject, String remote) throws CoreException {
ServerWorkingCopy wc = (ServerWorkingCopy)server.createWorkingCopy();
- fillServerWithOpenShiftDetails((IServerWorkingCopy)wc, host, deployProject);
+ fillServerWithOpenShiftDetails((IServerWorkingCopy)wc, host, deployProject,remote);
IServer saved = wc.save(true, new NullProgressMonitor());
return saved;
}
public static void fillServerWithOpenShiftDetails(IServerWorkingCopy wc, String host,
- String deployProject) {
+ String deployProject, String remote) {
if( host != null ) {
if( host.indexOf("://") != -1)
@@ -196,7 +232,7 @@
// wc.setAttribute(ATTRIBUTE_APPLICATION_ID, appId);
// wc.setAttribute(ATTRIBUTE_DEPLOY_FOLDER_NAME, projectRelativeFolder);
// wc.setAttribute(ATTRIBUTE_EXPRESS_MODE, mode);
-// wc.setAttribute(ATTRIBUTE_REMOTE_NAME, remoteName);
+ wc.setAttribute(ATTRIBUTE_REMOTE_NAME, remote);
((ServerWorkingCopy)wc).setAutoPublishSetting(Server.AUTO_PUBLISH_DISABLE);
wc.setAttribute(IJBossToolingConstants.IGNORE_LAUNCH_COMMANDS, "true");
wc.setAttribute(IJBossToolingConstants.WEB_PORT, 80);
@@ -266,6 +302,13 @@
return null;
}
+ /**
+ * This method will search available projects for one that has a
+ * git remote URI that matches that of this IApplication
+ *
+ * @param application
+ * @return
+ */
public static IProject[] findProjectsForApplication(final IApplication application) {
final ArrayList<IProject> results = new ArrayList<IProject>();
if( application ==null )
@@ -289,6 +332,30 @@
return results.toArray(new IProject[results.size()]);
}
+ /**
+ * This method will search for all projects connected to git
+ * and having the proper settings file containing
+ * domain, application id, app name, and username
+ *
+ * @return
+ */
+ public static IProject[] findAllSuitableOpenshiftProjects() {
+ final ArrayList<IProject> results = new ArrayList<IProject>();
+ final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for( int i = 0; i < projects.length; i++ ) {
+ if( EGitUtils.getRepository(projects[i]) != null ) {
+ String appName = getProjectAttribute(projects[i], SETTING_APPLICATION_NAME, null);
+ String appId = getProjectAttribute(projects[i], SETTING_APPLICATION_ID, null);
+ String domain = getProjectAttribute(projects[i], SETTING_DOMAIN, null);
+ String username = getProjectAttribute(projects[i], SETTING_USERNAME, null);
+ if( appName != null && appId != null && domain != null && username != null ) {
+ results.add(projects[i]);
+ }
+ }
+ }
+ return results.toArray(new IProject[results.size()]);
+ }
+
public static IProject findProjectForApplication(IApplication application) {
IProject[] p = findProjectsForApplication(application);
return p == null ? null : p.length == 0 ? null : p[0];
@@ -318,8 +385,8 @@
}
}
- public static void updateOpenshiftProjectSettings(IProject project, IApplication app, UserDelegate user,
- String remoteName, String deployFolder) {
+ public static void updateOpenshiftProjectSettings(IProject project, IApplication app,
+ UserDelegate user, String remoteName, String deployFolder) {
String qualifier = OpenShiftUIActivator.getDefault().getBundle().getSymbolicName();
IScopeContext context = new ProjectScope(project);
IEclipsePreferences node = context.getNode(qualifier);
@@ -336,48 +403,37 @@
}
}
-
- /* Deprecated */
- public static IServer setExpressMode(IServer server, String val) throws CoreException {
+ public static IServer setExpressDeployProject(IServer server, String val) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
- wc.setAttribute(ATTRIBUTE_EXPRESS_MODE, val);
+ wc.setAttribute(ATTRIBUTE_DEPLOY_PROJECT, val);
return wc.save(false, new NullProgressMonitor());
}
- public static IServer setExpressApplication(IServer server, String val) throws CoreException {
+ public static IServer setExpressRemoteName(IServer server, String val) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
- wc.setAttribute(ATTRIBUTE_APPLICATION_NAME, val);
+ wc.setAttribute(ATTRIBUTE_REMOTE_NAME, val);
return wc.save(false, new NullProgressMonitor());
}
- public static IServer setExpressDeployProject(IServer server, String val) throws CoreException {
+
+
+ /* Deprecated: These details cannot be changed and are no longer stored in the server
+ * Delete when certain no problems will be caused.
+ */
+ @Deprecated
+ public static IServer setExpressApplication(IServer server, String val) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
- wc.setAttribute(ATTRIBUTE_DEPLOY_PROJECT, val);
+ wc.setAttribute(ATTRIBUTE_APPLICATION_NAME, val);
return wc.save(false, new NullProgressMonitor());
}
+ @Deprecated
public static IServer setExpressDomain(IServer server, String val) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
wc.setAttribute(ATTRIBUTE_DOMAIN, val);
return wc.save(false, new NullProgressMonitor());
}
+ @Deprecated
public static IServer setExpressUsername(IServer server, String val) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
wc.setAttribute(ATTRIBUTE_USERNAME, val);
return wc.save(false, new NullProgressMonitor());
}
-
- public static IServer setExpressRemoteName(IServer server, String val) throws CoreException {
- IServerWorkingCopy wc = server.createWorkingCopy();
- wc.setAttribute(ATTRIBUTE_REMOTE_NAME, val);
- return wc.save(false, new NullProgressMonitor());
- }
- public static String getExpressMode(IServerAttributes attributes ) {
- return attributes.getAttribute(ATTRIBUTE_EXPRESS_MODE, EXPRESS_SOURCE_MODE);
- }
-
- public static String getExpressModeAsString(IServerAttributes attributes) {
- String mode = getExpressMode(attributes);
- if( mode.equals(EXPRESS_SOURCE_MODE))
- return "Source";
- return "Binary";
- }
-
}
Modified: branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
===================================================================
--- branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-04-30 15:41:30 UTC (rev 40651)
+++ branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-04-30 15:54:00 UTC (rev 40652)
@@ -104,14 +104,12 @@
private List<IApplication> appList;
private String[] appListNames;
private IServerWorkingCopy server;
- private String mode;
private HashMap<IApplication, IProject[]> projectsPerApp = new HashMap<IApplication, IProject[]>();
private boolean credentialsFailed = false;
- public ExpressDetailsComposite(Composite fill, IServerModeUICallback callback, String mode, boolean showVerify) {
+ public ExpressDetailsComposite(Composite fill, IServerModeUICallback callback, boolean showVerify) {
this.callback = callback;
this.server = callback.getServer();
- this.mode = mode;
this.composite = fill;
this.showVerify = showVerify;
this.showImportLink = showVerify;
@@ -277,6 +275,10 @@
importLink.setLayoutData(gd);
}
+ Label remoteLabel = new Label(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(remoteLabel);
+ remoteText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(remoteText);
Group projectSettings = new Group(composite, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(2,1).applyTo(projectSettings);
@@ -293,13 +295,6 @@
browseDestButton.setLayoutData(UIUtil.createFormData2(0,5,100,-5,null,0,100,0));
deployFolderText = new Text(zipDestComposite, SWT.SINGLE | SWT.BORDER);
deployFolderText.setLayoutData(UIUtil.createFormData2(0,5,100,-5,0,0,browseDestButton,-5));
-
-
-
- Label remoteLabel = new Label(projectSettings, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(remoteLabel);
- remoteText = new Text(projectSettings, SWT.SINGLE | SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(remoteText);
// Text
projectSettings.setText("Project Settings");
@@ -416,27 +411,17 @@
}
private void deployProjectChanged() {
- System.out.println("HEEEEEEEEEEY!");
int i = deployProjectCombo.getSelectionIndex();
if( i != -1 ) {
IProject depProj = ResourcesPlugin.getWorkspace().getRoot().getProject(deployProject);
if( depProj != null && depProj.isAccessible() ) {
- String remote = ExpressServerUtils.getProjectAttribute(depProj,
- ExpressServerUtils.SETTING_REMOTE_NAME, null);
- //ExpressServerUtils.ATTRIBUTE_REMOTE_NAME_DEFAULT);
String depFolder = ExpressServerUtils.getProjectAttribute(depProj,
ExpressServerUtils.SETTING_DEPLOY_FOLDER_NAME, null);
//ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
- if( remote == null ) {
- remoteText.setText(ExpressServerUtils.ATTRIBUTE_REMOTE_NAME_DEFAULT);
- }
if( depFolder == null )
deployFolderText.setText(ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
-
- boolean enabled = remote == null && depFolder == null;
- remoteText.setEnabled(enabled);
- deployFolderText.setEnabled(enabled);
- browseDestButton.setEnabled(enabled);
+ deployFolderText.setEnabled(depFolder == null);
+ browseDestButton.setEnabled(depFolder == null);
}
}
}
@@ -626,7 +611,7 @@
// update the values
IServerWorkingCopy wc = callback.getServer();
String host = fapplication == null ? null : fapplication.getApplicationUrl();
- ExpressServerUtils.fillServerWithOpenShiftDetails(wc, host, deployProject);
+ ExpressServerUtils.fillServerWithOpenShiftDetails(wc, host, deployProject,remote);
}
private void updateProjectSettings() {
Modified: branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java
===================================================================
--- branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java 2012-04-30 15:41:30 UTC (rev 40651)
+++ branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java 2012-04-30 15:54:00 UTC (rev 40652)
@@ -10,30 +10,62 @@
*******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.behaviour;
+import java.util.Arrays;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormLayout;
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.Display;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.internal.ide.dialogs.ResourceComparator;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.ui.editor.ServerEditorSection;
+import org.eclipse.wst.server.ui.internal.editor.ServerEditorPartInput;
import org.jboss.ide.eclipse.as.ui.UIUtil;
+import org.jboss.ide.eclipse.as.ui.editor.ServerWorkingCopyPropertyButtonCommand;
+import org.jboss.ide.eclipse.as.ui.editor.ServerWorkingCopyPropertyComboCommand;
+import org.jboss.ide.eclipse.as.ui.editor.ServerWorkingCopyPropertyCommand;
import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
public class ExpressDetailsSection extends ServerEditorSection {
private IEditorInput input;
protected Text userText, remoteText;
protected Text deployFolderText;
- protected Text appNameText, deployProjectText;
- protected Button verifyButton; // browseDestButton;
+ protected Text appNameText;
+ protected Combo deployProjectCombo;
+ protected Button verifyButton, browseDestButton, overrideProjectSettings;
+ protected Group projectSettingGroup;
public void init(IEditorSite site, IEditorInput input) {
super.init(site, input);
@@ -55,29 +87,49 @@
section.setClient(c);
initWidgets();
-// addListeners();
+ addListeners();
}
protected void initWidgets() {
// Set the widgets
String user = ExpressServerUtils.getExpressUsername(server);
String appName = ExpressServerUtils.getExpressApplicationName(server);
- String depProj = ExpressServerUtils.getExpressDeployProject(server);
+ deployProjectCombo.setEnabled(true);
userText.setText(user == null ? "" : user);
appNameText.setText(appName == null ? "" : appName);
- deployProjectText.setText(depProj == null ? "" : depProj);
userText.setEnabled(false);
appNameText.setEnabled(false);
- deployProjectText.setEnabled(false);
String outDir = ExpressServerUtils.getExpressDeployFolder(server);
String remote = ExpressServerUtils.getExpressRemoteName(server);
deployFolderText.setText(outDir == null ? "" : outDir);
remoteText.setText(remote == null ? "" : remote);
- remoteText.setEnabled(false);
- deployFolderText.setEnabled(false);
+
+ deployProjectCombo.setItems(getSuitableProjects());
+ java.util.List<String> l = Arrays.asList(deployProjectCombo.getItems());
+ String depProj = ExpressServerUtils.getExpressDeployProject(server);
+ if( depProj != null ) {
+ int ind = l.indexOf(depProj);
+ if( ind != -1 )
+ deployProjectCombo.select(ind);
+ }
+
+ boolean overrides = ExpressServerUtils.getOverridesProject(server);
+ overrideProjectSettings.setSelection(overrides);
+ remoteText.setEnabled(overrides);
+ deployFolderText.setEnabled(overrides);
+ browseDestButton.setEnabled(overrides);
}
+ private String[] getSuitableProjects() {
+ IProject[] all = ExpressServerUtils.findAllSuitableOpenshiftProjects();
+ String[] s = new String[all.length];
+ for( int i = 0; i < all.length; i++ ) {
+ s[i] = all[i].getName();
+ }
+ return s;
+ }
+
protected Composite createComposite(Section section) {
createWidgets(section);
return section;
@@ -87,35 +139,42 @@
composite.setLayout(new GridLayout(2, false));
Label deployLocationLabel = new Label(composite, SWT.NONE);
- deployProjectText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(deployProjectText);
+ deployProjectCombo = new Combo(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(deployProjectCombo);
- Label userLabel = new Label(composite, SWT.NONE);
+ projectSettingGroup = new Group(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(2, 1).applyTo(projectSettingGroup);
+ projectSettingGroup.setLayout(new GridLayout(2, false));
+
+ overrideProjectSettings = new Button(projectSettingGroup, SWT.CHECK);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(2, 1).applyTo(overrideProjectSettings);
+
+ Label userLabel = new Label(projectSettingGroup, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(userLabel);
- userText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ userText = new Text(projectSettingGroup, SWT.SINGLE | SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(userText);
- Label appNameLabel = new Label(composite, SWT.NONE);
+ Label appNameLabel = new Label(projectSettingGroup, SWT.NONE);
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).applyTo(appNameLabel);
- appNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ appNameText = new Text(projectSettingGroup, SWT.SINGLE | SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(appNameText);
+
+ Label zipDestLabel = new Label(projectSettingGroup, SWT.NONE);
+ Composite zipDestComposite = new Composite(projectSettingGroup, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(zipDestComposite);
+ zipDestComposite.setLayout(new FormLayout());
+ browseDestButton = new Button(zipDestComposite, SWT.PUSH);
+ browseDestButton.setLayoutData(UIUtil.createFormData2(0,5,100,-5,null,0,100,0));
+ deployFolderText = new Text(zipDestComposite, SWT.SINGLE | SWT.BORDER);
+ deployFolderText.setLayoutData(UIUtil.createFormData2(0,5,100,-5,0,0,browseDestButton,-5));
- Label zipDestLabel = new Label(composite, SWT.NONE);
+ Label remoteLabel = new Label(projectSettingGroup, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(remoteLabel);
+ remoteText = new Text(projectSettingGroup, SWT.SINGLE | SWT.BORDER);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(remoteText);
-// Composite zipDestComposite = new Composite(composite, SWT.NONE);
-// GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(zipDestComposite);
-// zipDestComposite.setLayout(new FormLayout());
-// browseDestButton = new Button(zipDestComposite, SWT.PUSH);
-// browseDestButton.setLayoutData(UIUtil.createFormData2(0,5,100,-5,null,0,100,0));
- deployFolderText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- //deployFolderText.setLayoutData(UIUtil.createFormData2(0,5,100,-5,0,0,100,0));
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(deployFolderText);
- Label remoteLabel = new Label(composite, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(remoteLabel);
- remoteText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(remoteText);
// Text
appNameLabel.setText("Application Name: ");
@@ -123,76 +182,138 @@
zipDestLabel.setText("Output Directory: ");
userLabel.setText("Username: ");
remoteLabel.setText("Remote: ");
-// browseDestButton.setText("Browse...");
+ browseDestButton.setText("Browse...");
+ projectSettingGroup.setText("Project Settings:");
+ overrideProjectSettings.setText("Override Project Settings");
}
-// ModifyListener remoteModifyListener, deployDestinationModifyListener;
-// protected void addListeners() {
-// remoteModifyListener = new ModifyListener() {
-// public void modifyText(ModifyEvent e) {
-// ((ServerEditorPartInput) input).getServerCommandManager().execute(new SetRemoteCommand(server));
-// }
-// };
-// remoteText.addModifyListener(remoteModifyListener);
-// deployDestinationModifyListener = new ModifyListener() {
-// public void modifyText(ModifyEvent e) {
-// ((ServerEditorPartInput) input).getServerCommandManager().execute(new SetDeployFolderCommand(server));
-// }
-// };
-// deployFolderText.addModifyListener(deployDestinationModifyListener);
-//
-// browseDestButton.addSelectionListener(new SelectionAdapter() {
-// public void widgetSelected(SelectionEvent e) {
-// browsePressed();
-// }
-// });
+ ModifyListener remoteModifyListener, deployDestinationModifyListener, deployProjectListener;
+ SelectionListener overrideListener;
+ protected void addListeners() {
+ deployProjectListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ int ind = deployProjectCombo.getSelectionIndex();
+ String newVal = ind == -1 ? null : deployProjectCombo.getItem(ind);
+ ((ServerEditorPartInput) input).getServerCommandManager().execute(
+ new SetProjectCommand(server, newVal));
+ }};
+ deployProjectCombo.addModifyListener(deployProjectListener);
+ overrideListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ ((ServerEditorPartInput) input).getServerCommandManager().execute(new SetOverrideCommand(server));
+ }
+ };
+ overrideProjectSettings.addSelectionListener(overrideListener);
-// }
-//
-// private void browsePressed() {
-// IFolder f = chooseFolder();
-// if( f != null ) {
-// deployFolderText.setText(f.getFullPath().removeFirstSegments(1).makeRelative().toOSString());
-// }
-// }
+
+ remoteModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ ((ServerEditorPartInput) input).getServerCommandManager().execute(new SetRemoteCommand(server));
+ }
+ };
+ remoteText.addModifyListener(remoteModifyListener);
+ deployDestinationModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ ((ServerEditorPartInput) input).getServerCommandManager().execute(new SetDeployFolderCommand(server));
+ }
+ };
+ deployFolderText.addModifyListener(deployDestinationModifyListener);
+
+ browseDestButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ browsePressed();
+ }
+ });
+
+ }
-// private IFolder chooseFolder() {
-// String depProject = ExpressServerUtils.getExpressDeployProject(server);
-// String depFolder = ExpressServerUtils.getExpressDeployFolder(server);
-//
-// IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(depProject);
-//
-// ILabelProvider lp= new WorkbenchLabelProvider();
-// ITreeContentProvider cp= new WorkbenchContentProvider();
-//
-// ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(Display.getDefault().getActiveShell(), lp, cp);
-// dialog.setTitle("Deploy Location");
-// dialog.setMessage("Please choose a location to put zipped projects");
-// dialog.setInput(p);
-// dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
-//
-// IResource res= p.findMember(new Path(depFolder));
-// if (res != null)
-// dialog.setInitialSelection(res);
-//
-// if (dialog.open() == Window.OK)
-// return (IFolder) dialog.getFirstResult();
-// return null;
-// }
-//
-// public class SetRemoteCommand extends ServerWorkingCopyPropertyCommand {
-// public SetRemoteCommand(IServerWorkingCopy server) {
-// super(server, "Change Remote Name", remoteText, remoteText.getText(),
-// ExpressServerUtils.ATTRIBUTE_REMOTE_NAME, remoteModifyListener,
-// ExpressServerUtils.ATTRIBUTE_REMOTE_NAME_DEFAULT);
-// }
-// }
-//
-// public class SetDeployFolderCommand extends ServerWorkingCopyPropertyCommand {
-// public SetDeployFolderCommand(IServerWorkingCopy server) {
-// super(server, "Change Deployment Folder", deployFolderText, deployFolderText.getText(),
-// ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_NAME, deployDestinationModifyListener,
-// ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
-// }
-// }
+ private void browsePressed() {
+ IFolder f = chooseFolder();
+ if( f != null ) {
+ deployFolderText.setText(f.getFullPath().removeFirstSegments(1).makeRelative().toOSString());
+ }
+ }
+
+ private IFolder chooseFolder() {
+ String depProject = ExpressServerUtils.getExpressDeployProject(server);
+ String depFolder = ExpressServerUtils.getExpressDeployFolder(server);
+
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(depProject);
+
+ ILabelProvider lp= new WorkbenchLabelProvider();
+ ITreeContentProvider cp= new WorkbenchContentProvider();
+
+ ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(Display.getDefault().getActiveShell(), lp, cp);
+ dialog.setTitle("Deploy Location");
+ dialog.setMessage("Please choose a location to put zipped projects");
+ dialog.setInput(p);
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+
+ IResource res= p.findMember(new Path(depFolder));
+ if (res != null)
+ dialog.setInitialSelection(res);
+
+ if (dialog.open() == Window.OK)
+ return (IFolder) dialog.getFirstResult();
+ return null;
+ }
+
+ public class SetRemoteCommand extends ServerWorkingCopyPropertyCommand {
+ public SetRemoteCommand(IServerWorkingCopy server) {
+ super(server, "Change Remote Name", remoteText, remoteText.getText(),
+ ExpressServerUtils.ATTRIBUTE_REMOTE_NAME, remoteModifyListener,
+ ExpressServerUtils.ATTRIBUTE_REMOTE_NAME_DEFAULT);
+ }
+ }
+
+ public class SetProjectCommand extends ServerWorkingCopyPropertyComboCommand {
+ public SetProjectCommand(IServerWorkingCopy wc, String newVal) {
+ super(wc, "Change Openshift Project", deployProjectCombo, newVal, ExpressServerUtils.ATTRIBUTE_DEPLOY_PROJECT, deployProjectListener);
+ }
+ @Override
+ protected void postOp(int type) {
+ updateWidgetsFromWorkingCopy();
+ }
+ }
+
+ public class SetDeployFolderCommand extends ServerWorkingCopyPropertyCommand {
+ public SetDeployFolderCommand(IServerWorkingCopy server) {
+ super(server, "Change Deployment Folder", deployFolderText, deployFolderText.getText(),
+ ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_NAME, deployDestinationModifyListener,
+ ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
+ }
+ }
+
+ public class SetOverrideCommand extends ServerWorkingCopyPropertyButtonCommand {
+ public SetOverrideCommand(IServerWorkingCopy wc) {
+ super(wc, "Override Openshift Project Settings Command",
+ overrideProjectSettings, overrideProjectSettings.getSelection(),
+ ExpressServerUtils.ATTRIBUTE_OVERRIDE_PROJECT_SETTINGS, overrideListener);
+ }
+ @Override
+ protected void postOp(int type) {
+ updateWidgetsFromWorkingCopy();
+ }
+ }
+ private void updateWidgetsFromWorkingCopy() {
+ String user = ExpressServerUtils.getExpressUsername(server);
+ String appName = ExpressServerUtils.getExpressApplicationName(server);
+ userText.setText(user == null ? "" : user);
+ appNameText.setText(appName == null ? "" : appName);
+
+ browseDestButton.setEnabled(overrideProjectSettings.getSelection());
+ deployFolderText.setEnabled(overrideProjectSettings.getSelection());
+ remoteText.setEnabled(overrideProjectSettings.getSelection());
+ String remote = ExpressServerUtils.getExpressRemoteName(server, ExpressServerUtils.SETTING_FROM_PROJECT);
+ String depFolder = ExpressServerUtils.getExpressDeployFolder(server, ExpressServerUtils.SETTING_FROM_PROJECT);
+ remote = remote == null ? "" : remote;
+ depFolder = depFolder == null ? "" : depFolder;
+
+ remoteText.removeModifyListener(remoteModifyListener);
+ deployFolderText.removeModifyListener(deployDestinationModifyListener);
+ remoteText.setText(remote);
+ deployFolderText.setText(depFolder);
+ remoteText.addModifyListener(remoteModifyListener);
+ deployFolderText.addModifyListener(deployDestinationModifyListener);
+ }
}
Modified: branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java
===================================================================
--- branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java 2012-04-30 15:41:30 UTC (rev 40651)
+++ branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java 2012-04-30 15:54:00 UTC (rev 40652)
@@ -30,7 +30,6 @@
private NewServerWizardBehaviourCallback callback;
public ExpressWizardFragment() {
- System.out.println("NEW FRAGMENT");
}
public boolean hasComposite() {
@@ -61,7 +60,7 @@
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
this.composite = new ExpressDetailsComposite(
- composite, callback,ExpressServerUtils.EXPRESS_SOURCE_MODE, true);
+ composite, callback, true);
return this.composite.getComposite();
}
Modified: branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftExpressWizardModel.java
===================================================================
--- branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftExpressWizardModel.java 2012-04-30 15:41:30 UTC (rev 40651)
+++ branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IOpenShiftExpressWizardModel.java 2012-04-30 15:54:00 UTC (rev 40652)
@@ -23,7 +23,6 @@
import org.eclipse.wst.server.core.IServerType;
import org.jboss.tools.common.databinding.IObservablePojo;
import org.jboss.tools.openshift.egit.ui.util.EGitUIUtils;
-import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
import com.openshift.client.ApplicationScale;
import com.openshift.client.IApplication;
@@ -52,9 +51,6 @@
public static final String MERGE_URI = "mergeUri";
public static final String RUNTIME_DELEGATE = "runtimeDelegate";
public static final String CREATE_SERVER_ADAPTER = "createServerAdapter";
- public static final String PUBLICATION_MODE = "serverMode";
- public static final String PUBLISH_SOURCE = ExpressServerUtils.EXPRESS_SOURCE_MODE;
- public static final String PUBLISH_BINARY = ExpressServerUtils.EXPRESS_BINARY_MODE;
public static final String SERVER_TYPE = "serverType";
public static final String NEW_PROJECT_REMOTE_NAME_DEFAULT = "origin";
public static final String EXISTING_PROJECT_REMOTE_NAME_DEFAULT = "openshift";
@@ -183,8 +179,6 @@
public IRuntime getRuntime();
- public String getMode();
-
public boolean isCreateServerAdapter();
public IServerType getServerType();
Modified: branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
===================================================================
--- branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-04-30 15:41:30 UTC (rev 40651)
+++ branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-04-30 15:54:00 UTC (rev 40652)
@@ -65,7 +65,6 @@
setRepositoryPath(DEFAULT_REPOSITORY_PATH);
setRemoteName(NEW_PROJECT_REMOTE_NAME_DEFAULT);
setServerType(ServerCore.findServerType(ExpressServerUtils.OPENSHIFT_SERVER_TYPE));
- setPublicationMode(PUBLISH_SOURCE);
}
/**
@@ -104,8 +103,7 @@
IProject project = p;
// Add the settings here!
ExpressServerUtils.updateOpenshiftProjectSettings(project, app,
- getUser(), getRemoteName(),
- ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
+ getUser(), getRemoteName(), ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
return;
}
}
@@ -328,11 +326,6 @@
}
@Override
- public String getMode() {
- return (String) getProperty(PUBLICATION_MODE);
- }
-
- @Override
public boolean isCreateServerAdapter() {
Boolean isCreateServer = (Boolean) getProperty(CREATE_SERVER_ADAPTER);
return isCreateServer != null && isCreateServer.booleanValue();
@@ -348,10 +341,6 @@
return (IServerType) setProperty(SERVER_TYPE, serverType);
}
- private void setPublicationMode(String mode) {
- setProperty(PUBLICATION_MODE, mode);
- }
-
@Override
public boolean isUseExistingApplication() {
return (Boolean) getProperty(USE_EXISTING_APPLICATION);
Modified: branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java
===================================================================
--- branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java 2012-04-30 15:41:30 UTC (rev 40651)
+++ branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java 2012-04-30 15:54:00 UTC (rev 40652)
@@ -51,13 +51,13 @@
}
public void create(IProject project, IOpenShiftExpressWizardModel wizardModel, IProgressMonitor monitor) throws OpenShiftException {
- createServerAdapter(project, wizardModel.getServerType(), wizardModel.getRuntime(), wizardModel.getMode(),
+ createServerAdapter(project, wizardModel.getServerType(), wizardModel.getRuntime(),
wizardModel.getApplication(), wizardModel.getUser(), wizardModel.getRemoteName(), monitor);
}
- public void create(IProject project, IServerType serverType, IRuntime runtime, String mode,
+ public void create(IProject project, IServerType serverType, IRuntime runtime,
IApplication application, UserDelegate user, IProgressMonitor monitor) throws OpenShiftException {
- createServerAdapter(project, serverType, runtime, mode, application, user, null, monitor);
+ createServerAdapter(project, serverType, runtime, application, user, null, monitor);
}
/**
@@ -67,21 +67,21 @@
* the monitor to report progress to.
* @throws OpenShiftException
*/
- protected void createServerAdapter(IProject project, IServerType serverType, IRuntime runtime, String mode,
+ protected void createServerAdapter(IProject project, IServerType serverType, IRuntime runtime,
IApplication application, UserDelegate user,
String remoteName, IProgressMonitor monitor) throws OpenShiftException {
String name = project.getName();
monitor.subTask(NLS.bind("Creating server adapter for project {0}", name));
createServerAdapter(Collections.singletonList(project), serverType, runtime,
- mode, application, user, project.getName(), remoteName, monitor);
+ application, user, project.getName(), remoteName, monitor);
}
protected void createServerAdapter(List<IProject> importedProjects, IServerType serverType,
- IRuntime runtime, String mode, IApplication application, UserDelegate user,
+ IRuntime runtime, IApplication application, UserDelegate user,
String deployProject, String remoteName, IProgressMonitor monitor) {
try {
renameWebContextRoot(importedProjects);
- IServer server = doCreateServerAdapter(serverType, runtime, mode, application, user, deployProject, remoteName);
+ IServer server = doCreateServerAdapter(serverType, runtime, application, user, deployProject, remoteName);
addModules(getModules(importedProjects), server, monitor);
} catch (CoreException ce) {
OpenShiftUIActivator.getDefault().getLog().log(ce.getStatus());
@@ -102,11 +102,10 @@
}
}
- private IServer doCreateServerAdapter(IServerType serverType, IRuntime rt, String mode,
+ private IServer doCreateServerAdapter(IServerType serverType, IRuntime rt,
IApplication application, UserDelegate user, String deployProject, String remoteName) throws CoreException,
OpenShiftException, SocketTimeoutException {
Assert.isLegal(serverType != null);
- Assert.isLegal(mode != null);
Assert.isLegal(application != null);
Assert.isLegal(user != null);
@@ -115,7 +114,7 @@
IServer server = ExpressServerUtils.createServer(rt, serverType, serverName);
ExpressServerUtils.fillServerWithOpenShiftDetails(server,
- application.getApplicationUrl(), deployProject);
+ application.getApplicationUrl(), deployProject, remoteName);
return server;
}
12 years, 7 months
JBoss Tools SVN: r40651 - in trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test: rest and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-04-30 11:41:30 -0400 (Mon, 30 Apr 2012)
New Revision: 40651
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryParamSupportTest.java
Log:
new test DefaultValueParamSupportTest included in WSAllBotTests
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2012-04-30 15:40:28 UTC (rev 40650)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2012-04-30 15:41:30 UTC (rev 40651)
@@ -12,6 +12,7 @@
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.jboss.tools.ws.ui.bot.test.annotation.AnnotationPropertiesTest;
+import org.jboss.tools.ws.ui.bot.test.rest.DefaultValueParamSupportTest;
import org.jboss.tools.ws.ui.bot.test.rest.PathAnnotationSupportTest;
import org.jboss.tools.ws.ui.bot.test.rest.QueryParamSupportTest;
import org.jboss.tools.ws.ui.bot.test.rest.completion.RESTfulCompletionTest;
@@ -60,6 +61,7 @@
RESTfulSupportTest.class,
PathAnnotationSupportTest.class,
QueryParamSupportTest.class,
+ DefaultValueParamSupportTest.class,
RESTfulValidationTest.class,
RESTfulCompletionTest.class,
ApplicationPathParameterTest.class,
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryParamSupportTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryParamSupportTest.java 2012-04-30 15:40:28 UTC (rev 40650)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/QueryParamSupportTest.java 2012-04-30 15:41:30 UTC (rev 40651)
@@ -47,7 +47,7 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- PathAnnotationSupportTest.class.getResourceAsStream(QUERY_ONE_PARAM_RESOURCE),
+ QueryParamSupportTest.class.getResourceAsStream(QUERY_ONE_PARAM_RESOURCE),
false, false, getWsPackage(), getWsName(), queryParam1, queryType);
bot.sleep(Timing.time2S());
@@ -62,7 +62,7 @@
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- PathAnnotationSupportTest.class.getResourceAsStream(QUERY_TWO_PARAM_RESOURCE),
+ QueryParamSupportTest.class.getResourceAsStream(QUERY_TWO_PARAM_RESOURCE),
false, false, getWsPackage(), getWsName(),
queryParam1, queryType, queryParam2, queryType);
bot.sleep(Timing.time2S());
@@ -90,7 +90,7 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- PathAnnotationSupportTest.class.getResourceAsStream(QUERY_TWO_PARAM_RESOURCE),
+ QueryParamSupportTest.class.getResourceAsStream(QUERY_TWO_PARAM_RESOURCE),
false, false, getWsPackage(), getWsName(),
queryParam1, queryType, queryParam2, queryType);
bot.sleep(Timing.time2S());
@@ -136,7 +136,7 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
- PathAnnotationSupportTest.class.getResourceAsStream(QUERY_TWO_PARAM_RESOURCE),
+ QueryParamSupportTest.class.getResourceAsStream(QUERY_TWO_PARAM_RESOURCE),
false, false, getWsPackage(), getWsName(),
queryParam1, queryType1, queryParam2, queryType2);
bot.sleep(Timing.time2S());
12 years, 7 months
JBoss Tools SVN: r40650 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-04-30 11:40:28 -0400 (Mon, 30 Apr 2012)
New Revision: 40650
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/DefaultValue.java.ws
Log:
resource files for DefaultValueParamSupportTest added
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/DefaultValue.java.ws
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/DefaultValue.java.ws (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/restful/DefaultValue.java.ws 2012-04-30 15:40:28 UTC (rev 40650)
@@ -0,0 +1,16 @@
+package {0};
+
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+
+@Path("/rest")
+public class {1} '{'
+
+ @GET
+ public void method(@QueryParam("{2}") @DefaultValue("{3}") {4} parameter) '{'
+
+ '}'
+
+'}'
12 years, 7 months
JBoss Tools SVN: r40649 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-04-30 11:39:47 -0400 (Mon, 30 Apr 2012)
New Revision: 40649
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/DefaultValueParamSupportTest.java
Log:
new test DefaultValueParamSupportTest added
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/DefaultValueParamSupportTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/DefaultValueParamSupportTest.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/DefaultValueParamSupportTest.java 2012-04-30 15:39:47 UTC (rev 40649)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007-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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.bot.test.rest;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ws.ui.bot.test.ti.wizard.RESTFullExplorerWizard;
+import org.junit.Test;
+
+public class DefaultValueParamSupportTest extends RESTfulTestBase {
+
+ private RESTFullExplorerWizard restfulWizard = null;
+
+ private String projectName = "restEmpty";
+
+ private final String DEFAULT_VALUE_RESOURCE = "/resources/restful/DefaultValue.java.ws";
+
+ @Override
+ protected String getWsProjectName() {
+ return projectName;
+ }
+
+ @Override
+ public void cleanup() {
+ bot.activeEditor().toTextEditor().save();
+ }
+
+ @Test
+ public void testDefaultValueSupport() {
+
+ String queryParam = "param";
+ String defaultValue = "abc";
+ String defaultValueNew = "cba";
+ String queryParamType = "java.lang.String";
+
+ /** test showing default DefaultValue in RESTful explorer **/
+ packageExplorer.openFile(getWsProjectName(), "src",
+ getWsPackage(), getWsName() + ".java").toTextEditor();
+ resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
+ DefaultValueParamSupportTest.class.getResourceAsStream(DEFAULT_VALUE_RESOURCE),
+ false, false, getWsPackage(), getWsName(), queryParam, defaultValue, queryParamType);
+ bot.sleep(Timing.time2S());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
+
+ assertTrue("There should be one RESTful web service instead of " +
+ restServices.length, restServices.length == 1);
+ String path = restfulWizard.getPathForRestFulService(restServices[0]);
+ assertEquals("/rest?" + queryParam + "={" + queryParam + ":" +
+ queryParamType + "=" + defaultValue + "}", path);
+
+ /** test showing edited DefaultValue value in RESTful explorer **/
+ resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
+ defaultValue, defaultValueNew, false);
+ bot.sleep(Timing.time2S());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ restServices = restfulWizard.getAllRestServices();
+
+ assertTrue("There should be one RESTful web service instead of " +
+ restServices.length, restServices.length == 1);
+ path = restfulWizard.getPathForRestFulService(restServices[0]);
+ assertEquals("/rest?" + queryParam + "={" + queryParam + ":" +
+ queryParamType + "=" + defaultValueNew + "}", path);
+
+ /** test showing deleted DefaultValue value in RESTful explorer **/
+ resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
+ "@DefaultValue(\"" + defaultValueNew + "\")", "", false);
+ bot.sleep(Timing.time2S());
+
+ restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
+ restServices = restfulWizard.getAllRestServices();
+
+ assertTrue("There should be one RESTful web service instead of " +
+ restServices.length, restServices.length == 1);
+ path = restfulWizard.getPathForRestFulService(restServices[0]);
+ assertEquals("/rest?" + queryParam + "={" + queryParam + ":" +
+ queryParamType + "}", path);
+
+ }
+
+}
12 years, 7 months
JBoss Tools SVN: r40648 - in branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal: ui/wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-04-30 11:19:30 -0400 (Mon, 30 Apr 2012)
New Revision: 40648
Modified:
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
Log:
[JBIDE-11715] adding key to OpenShift when creating a domain. Storing new key with a default name "jbosstools"
Modified: branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
===================================================================
--- branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-04-30 15:19:06 UTC (rev 40647)
+++ branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-04-30 15:19:30 UTC (rev 40648)
@@ -19,7 +19,6 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.common.ui.WizardUtils;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import org.jboss.tools.openshift.express.internal.ui.viewer.ConnectToOpenShiftWizard;
@@ -29,8 +28,11 @@
import com.openshift.client.IDomain;
import com.openshift.client.IEmbeddableCartridge;
import com.openshift.client.IGearProfile;
+import com.openshift.client.IOpenShiftSSHKey;
+import com.openshift.client.ISSHPublicKey;
import com.openshift.client.IUser;
import com.openshift.client.OpenShiftException;
+import com.openshift.client.OpenShiftUnknonwSSHKeyTypeException;
public class UserDelegate {
private IUser delegate;
@@ -232,4 +234,12 @@
public void setConnected(boolean connected) {
this.connected = connected;
}
+
+ public IOpenShiftSSHKey getSSHKeyByPublicKey(String publicKey) throws SocketTimeoutException, OpenShiftUnknonwSSHKeyTypeException, OpenShiftException {
+ return delegate.getSSHKeyByPublicKey(publicKey);
+ }
+
+ public IOpenShiftSSHKey putSSHKey(String name, ISSHPublicKey key) throws OpenShiftException, SocketTimeoutException {
+ return delegate.putSSHKey(name, key);
+ }
}
Modified: branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
===================================================================
--- branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-04-30 15:19:06 UTC (rev 40647)
+++ branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-04-30 15:19:30 UTC (rev 40648)
@@ -17,11 +17,11 @@
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jsch.internal.core.IConstants;
import org.eclipse.jsch.internal.core.JSchCorePlugin;
-import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
import com.openshift.client.IDomain;
+import com.openshift.client.IOpenShiftSSHKey;
import com.openshift.client.ISSHPublicKey;
import com.openshift.client.OpenShiftException;
import com.openshift.client.SSHKeyPair;
@@ -35,6 +35,8 @@
public static final String LIBRA_KEY = "libra_id_rsa";
private static final String PUBLIC_KEY_SUFFIX = ".pub";
+ private static final String SSHKEY_DEFAULT_NAME = "jbosstools"; //$NON-NLS-1$
+
public static final String PROPERTY_DOMAIN_ID = "domainId";
public static final String PROPERTY_SSHKEY = "sshKey";
@@ -99,7 +101,12 @@
}
public void createDomain() throws OpenShiftException, IOException {
- IDomain domain = user.createDomain(domainId);
+ user.createDomain(domainId);
+ ISSHPublicKey sshKey = loadSshKey();
+ IOpenShiftSSHKey sshKeyResource = user.getSSHKeyByPublicKey(sshKey.getPublicKey());
+ if (sshKeyResource == null) {
+ user.putSSHKey(SSHKEY_DEFAULT_NAME, sshKey);
+ }
}
public String getSshKey() {
12 years, 7 months