JBoss Tools SVN: r40557 - trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2012-04-27 06:24:36 -0400 (Fri, 27 Apr 2012)
New Revision: 40557
Modified:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java
Log:
JBIDE-10919: Forge: "Home" and "End" keys do not work as expected
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java 2012-04-27 10:15:56 UTC (rev 40556)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java 2012-04-27 10:24:36 UTC (rev 40557)
@@ -17,9 +17,11 @@
public class ForgeTextViewer extends TextViewer {
+ private static String START_LINE = new Character((char)1).toString();
private static String PREV_CHAR = new Character((char)2).toString();
private static String CTRL_C = new Character((char)3).toString();
private static String CTRL_D = new Character((char)4).toString();
+ private static String END_LINE = new Character((char)5).toString();
private static String NEXT_CHAR = new Character((char)6).toString();
private static String DELETE_PREV_CHAR = new Character((char)8).toString();
private static String PREV_HISTORY = new Character((char)16).toString();
@@ -96,6 +98,14 @@
StyledText styledText= new StyledText(parent, styles) {
public void invokeAction(int action) {
switch (action) {
+ case ST.LINE_END:
+ getRuntime().sendInput(END_LINE);
+ System.out.println("line end");
+ break;
+ case ST.LINE_START:
+ getRuntime().sendInput(START_LINE);
+ System.out.println("line start");
+ break;
case ST.LINE_UP:
getRuntime().sendInput(PREV_HISTORY);
break;
12 years, 8 months
JBoss Tools SVN: r40556 - in trunk: central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-04-27 06:15:56 -0400 (Fri, 27 Apr 2012)
New Revision: 40556
Added:
trunk/central/plugins/org.jboss.tools.central/icons/ear_background.gif
trunk/central/plugins/org.jboss.tools.central/icons/gwt_background.png
trunk/central/plugins/org.jboss.tools.central/icons/html5_background.png
trunk/central/plugins/org.jboss.tools.central/icons/richfaces_background.png
trunk/central/plugins/org.jboss.tools.central/icons/spring_background.png
trunk/central/plugins/org.jboss.tools.central/icons/web_background.gif
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/AbstractJBossCentralProjectWizard.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewGwtProjectWizard.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewHtml5ProjectWizard.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeEarProjectWizard.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeWarProjectWizard.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewRichfacesProjectWizard.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewSpringMvcProjectWizard.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesLocationPage.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesMainPage.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesReadyPage.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesRequirementsPage.java
Log:
JBIDE-10692 : use contextual background image for wizards in Central
Removed imagedescriptor from individual pages as it prevents them to inherit image from the wizard.
Added: trunk/central/plugins/org.jboss.tools.central/icons/ear_background.gif
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/ear_background.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/gwt_background.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/gwt_background.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/html5_background.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/html5_background.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/richfaces_background.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/richfaces_background.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/spring_background.png
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/spring_background.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/central/plugins/org.jboss.tools.central/icons/web_background.gif
===================================================================
(Binary files differ)
Property changes on: trunk/central/plugins/org.jboss.tools.central/icons/web_background.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/AbstractJBossCentralProjectWizard.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/AbstractJBossCentralProjectWizard.java 2012-04-27 09:50:16 UTC (rev 40555)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/AbstractJBossCentralProjectWizard.java 2012-04-27 10:15:56 UTC (rev 40556)
@@ -17,8 +17,13 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.jboss.tools.central.JBossCentralActivator;
import org.jboss.tools.central.jobs.RefreshTutorialsJob;
+import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.model.ProjectExample;
import org.jboss.tools.project.examples.wizard.NewProjectExamplesWizard2;
@@ -98,5 +103,15 @@
}
}
+ protected void initializeDefaultPageImageDescriptor() {
+ String imagePath = getWizardBackgroundImagePath();
+ ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(JBossCentralActivator.PLUGIN_ID,
+ imagePath);
+ setDefaultPageImageDescriptor(desc);
+ }
+ protected String getWizardBackgroundImagePath() {
+ return "icons/new_wiz.gif";
+ }
+
}
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewGwtProjectWizard.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewGwtProjectWizard.java 2012-04-27 09:50:16 UTC (rev 40555)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewGwtProjectWizard.java 2012-04-27 10:15:56 UTC (rev 40556)
@@ -15,4 +15,8 @@
public NewGwtProjectWizard() {
super("gwt-webapp");
}
+
+ protected String getWizardBackgroundImagePath() {
+ return "icons/gwt_background.png";
+ }
}
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewHtml5ProjectWizard.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewHtml5ProjectWizard.java 2012-04-27 09:50:16 UTC (rev 40555)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewHtml5ProjectWizard.java 2012-04-27 10:15:56 UTC (rev 40556)
@@ -15,4 +15,8 @@
public NewHtml5ProjectWizard() {
super("jboss-javaee6-poh5-archetype");
}
+
+ protected String getWizardBackgroundImagePath() {
+ return "icons/html5_background.png";
+ }
}
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeEarProjectWizard.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeEarProjectWizard.java 2012-04-27 09:50:16 UTC (rev 40555)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeEarProjectWizard.java 2012-04-27 10:15:56 UTC (rev 40556)
@@ -15,4 +15,8 @@
public NewJavaeeEarProjectWizard() {
super("multi-javaee6-archetype");
}
+
+ protected String getWizardBackgroundImagePath() {
+ return "icons/ear_background.gif";
+ }
}
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeWarProjectWizard.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeWarProjectWizard.java 2012-04-27 09:50:16 UTC (rev 40555)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeWarProjectWizard.java 2012-04-27 10:15:56 UTC (rev 40556)
@@ -15,4 +15,8 @@
public NewJavaeeWarProjectWizard() {
super("jboss-javaee6-webapp");
}
+
+ protected String getWizardBackgroundImagePath() {
+ return "icons/web_background.gif";
+ }
}
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewRichfacesProjectWizard.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewRichfacesProjectWizard.java 2012-04-27 09:50:16 UTC (rev 40555)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewRichfacesProjectWizard.java 2012-04-27 10:15:56 UTC (rev 40556)
@@ -15,4 +15,8 @@
public NewRichfacesProjectWizard() {
super("richfaces-archetype-simpleapp");
}
+
+ protected String getWizardBackgroundImagePath() {
+ return "icons/richfaces_background.png";
+ }
}
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewSpringMvcProjectWizard.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewSpringMvcProjectWizard.java 2012-04-27 09:50:16 UTC (rev 40555)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewSpringMvcProjectWizard.java 2012-04-27 10:15:56 UTC (rev 40556)
@@ -15,4 +15,8 @@
public NewSpringMvcProjectWizard() {
super("spring-mvc-webapp");
}
+
+ protected String getWizardBackgroundImagePath() {
+ return "icons/spring_background.png";
+ }
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesLocationPage.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesLocationPage.java 2012-04-27 09:50:16 UTC (rev 40555)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesLocationPage.java 2012-04-27 10:15:56 UTC (rev 40556)
@@ -49,7 +49,6 @@
super("org.jboss.tools.project.examples.location"); //$NON-NLS-1$
setTitle( "Location" );
setDescription( "Project Example Location and Workspace" );
- setImageDescriptor( ProjectExamplesActivator.imageDescriptorFromPlugin(ProjectExamplesActivator.PLUGIN_ID, "icons/new_wiz.gif")); //$NON-NLS-1$
fWorkingSetGroup= new WorkingSetGroup();
setWorkingSets(new IWorkingSet[0]);
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesMainPage.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesMainPage.java 2012-04-27 09:50:16 UTC (rev 40555)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesMainPage.java 2012-04-27 10:15:56 UTC (rev 40556)
@@ -82,7 +82,6 @@
super("org.jboss.tools.project.examples.main"); //$NON-NLS-1$
setTitle( Messages.NewProjectExamplesWizardPage_Project_Example );
setDescription( Messages.NewProjectExamplesWizardPage_Import_Project_Example );
- setImageDescriptor( ProjectExamplesActivator.imageDescriptorFromPlugin(ProjectExamplesActivator.PLUGIN_ID, "icons/new_wiz.gif")); //$NON-NLS-1$
this.requirementsPage = requirementsPage;
//this.readyPage = readyPage;
this.pages = pages;
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesReadyPage.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesReadyPage.java 2012-04-27 09:50:16 UTC (rev 40555)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesReadyPage.java 2012-04-27 10:15:56 UTC (rev 40556)
@@ -28,7 +28,6 @@
public NewProjectExamplesReadyPage(List<ProjectExample> projectExamples) {
super("org.jboss.tools.project.examples.ready"); //$NON-NLS-1$
- setImageDescriptor( ProjectExamplesActivator.imageDescriptorFromPlugin(ProjectExamplesActivator.PLUGIN_ID, "icons/new_wiz.gif")); //$NON-NLS-1$
this.projectExamples = projectExamples;
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesRequirementsPage.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesRequirementsPage.java 2012-04-27 09:50:16 UTC (rev 40555)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesRequirementsPage.java 2012-04-27 10:15:56 UTC (rev 40556)
@@ -107,7 +107,6 @@
protected NewProjectExamplesRequirementsPage() {
super(PAGE_NAME);
setTitleAndDescription(null);
- setImageDescriptor( ProjectExamplesActivator.imageDescriptorFromPlugin(ProjectExamplesActivator.PLUGIN_ID, "icons/new_wiz.gif")); //$NON-NLS-1$
checkboxOn = RuntimeUIActivator.imageDescriptorFromPlugin(RuntimeUIActivator.PLUGIN_ID, "/icons/xpl/complete_tsk.gif").createImage();
checkboxOff = RuntimeUIActivator.imageDescriptorFromPlugin(RuntimeUIActivator.PLUGIN_ID, "/icons/xpl/incomplete_tsk.gif").createImage();
}
12 years, 8 months
JBoss Tools SVN: r40555 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-04-27 05:50:16 -0400 (Fri, 27 Apr 2012)
New Revision: 40555
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java
Log:
JBIDE-10527
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-27 09:28:41 UTC (rev 40554)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java 2012-04-27 09:50:16 UTC (rev 40555)
@@ -30,6 +30,7 @@
private NewServerWizardBehaviourCallback callback;
public ExpressWizardFragment() {
+ System.out.println("NEW FRAGMENT");
}
public boolean hasComposite() {
@@ -40,7 +41,7 @@
}
public boolean isComplete() {
- return composite.getErrorString() == null;
+ return composite != null && composite.getErrorString() == null;
}
public Composite createComposite(Composite parent, IWizardHandle handle) {
@@ -71,5 +72,10 @@
public void performFinish(IProgressMonitor monitor) throws CoreException {
super.performFinish(monitor);
composite.finish(monitor);
+ composite = null;
}
+ public void performCancel(IProgressMonitor monitor) throws CoreException {
+ composite = null;
+ }
+
}
12 years, 8 months
JBoss Tools SVN: r40554 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types.
by jbosstools-commits@lists.jboss.org
Author: rhopp
Date: 2012-04-27 05:28:41 -0400 (Fri, 27 Apr 2012)
New Revision: 40554
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
Log:
Reverting "New OpenShift Application" title back to "Nwe OpenShift Express Application" as it's not in gui yet.
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2012-04-27 09:14:20 UTC (rev 40553)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2012-04-27 09:28:41 UTC (rev 40554)
@@ -839,7 +839,7 @@
public static final String NEW_DYNAMIC_WEB_PROJECT = "New Dynamic Web Project";
public static final String PROJECT_EXAMPLE = "New Project Example";
public static final String NEW_JBOSS_PROJECT = "New JBoss Project";
- public static final String OPENSHIFT_APP_WIZARD = "New OpenShift Application";
+ public static final String OPENSHIFT_APP_WIZARD = "New OpenShift Express Application";
}
public static class NewViewDialog{
12 years, 8 months
JBoss Tools SVN: r40553 - in trunk/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: rob.stryker(a)jboss.com
Date: 2012-04-27 05:14:20 -0400 (Fri, 27 Apr 2012)
New Revision: 40553
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/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/wizard/OpenShiftExpressApplicationWizard.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 clean up of settings
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-27 08:09:18 UTC (rev 40552)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-04-27 09:14:20 UTC (rev 40553)
@@ -16,9 +16,12 @@
import java.util.List;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IRuntime;
@@ -38,11 +41,12 @@
import org.jboss.tools.openshift.egit.core.EGitUtils;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
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;
-import com.openshift.client.IDomain;
import com.openshift.client.OpenShiftException;
/**
@@ -54,19 +58,31 @@
*/
@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";
+
+ /* 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";
+ public static final String ATTRIBUTE_REMOTE_NAME = "org.jboss.tools.openshift.express.internal.core.behaviour.RemoteName";
public static final String ATTRIBUTE_APPLICATION_NAME = "org.jboss.tools.openshift.express.internal.core.behaviour.ApplicationName";
public static final String ATTRIBUTE_APPLICATION_ID = "org.jboss.tools.openshift.express.internal.core.behaviour.ApplicationId";
- public static final String ATTRIBUTE_DEPLOY_PROJECT = "org.jboss.tools.openshift.express.internal.core.behaviour.binary.deployProject";
public static final String ATTRIBUTE_DOMAIN = "org.jboss.tools.openshift.express.internal.core.behaviour.Domain";
public static final String ATTRIBUTE_USERNAME = "org.jboss.tools.openshift.express.internal.core.behaviour.Username";
public static final String ATTRIBUTE_DEPLOY_FOLDER_NAME = "org.jboss.tools.openshift.express.internal.core.behaviour.DEPLOY_FOLDER_LOC";
-
+
+ /* New Settings inside the project */
+ public static final String SETTING_REMOTE_NAME = "org.jboss.tools.openshift.RemoteName";
+ public static final String SETTING_APPLICATION_NAME = "org.jboss.tools.openshift.ApplicationName";
+ public static final String SETTING_APPLICATION_ID = "org.jboss.tools.openshift.ApplicationId";
+ public static final String SETTING_DOMAIN = "org.jboss.tools.openshift.Domain";
+ public static final String SETTING_USERNAME = "org.jboss.tools.openshift.Username";
+ public static final String SETTING_DEPLOY_FOLDER_NAME = "org.jboss.tools.openshift.DeployFolder";
+
// Legacy, not to be used
//public static final String ATTRIBUTE_PASSWORD = "org.jboss.tools.openshift.express.internal.core.behaviour.Password";
- public static final String ATTRIBUTE_REMOTE_NAME = "org.jboss.tools.openshift.express.internal.core.behaviour.RemoteName";
public static final String ATTRIBUTE_REMOTE_NAME_DEFAULT = "origin";
public static final String ATTRIBUTE_DEPLOY_FOLDER_DEFAULT = "deployments";
@@ -81,81 +97,55 @@
public static final String TASK_WIZARD_ATTR_APP_LIST = "appList";
public static final String TASK_WIZARD_ATTR_SELECTED_APP = "application";
-
- public static String getExpressMode(IServerAttributes attributes ) {
- return attributes.getAttribute(ATTRIBUTE_EXPRESS_MODE, EXPRESS_SOURCE_MODE);
+ public static String getExpressDeployProject(IServerAttributes attributes ) {
+ return attributes.getAttribute(ATTRIBUTE_DEPLOY_PROJECT,
+ attributes.getAttribute(ATTRIBUTE_DEPLOY_PROJECT_LEGACY, (String)null));
}
-
- public static String getExpressModeAsString(IServerAttributes attributes) {
- String mode = getExpressMode(attributes);
- if( mode.equals(EXPRESS_SOURCE_MODE))
- return "Source";
- return "Binary";
+
+ private static IProject getExpressDeployProject2(IServerAttributes attributes) {
+ String name = getExpressDeployProject(attributes);
+ return name == null ? null : ResourcesPlugin.getWorkspace().getRoot().getProject(name);
}
- public static IServer setExpressMode(IServer server, String val) throws CoreException {
- IServerWorkingCopy wc = server.createWorkingCopy();
- wc.setAttribute(ATTRIBUTE_EXPRESS_MODE, val);
- return wc.save(false, new NullProgressMonitor());
+ public static String getProjectAttribute(IProject project, String attributeName, String defaultVal) {
+ if( project == null )
+ return defaultVal;
+ String qualifier = OpenShiftUIActivator.getDefault().getBundle().getSymbolicName();
+ IScopeContext context = new ProjectScope(project);
+ IEclipsePreferences node = context.getNode(qualifier);
+ return node.get(attributeName, defaultVal);
}
-
+
public static String getExpressApplicationName(IServerAttributes attributes ) {
- return attributes.getAttribute(ATTRIBUTE_APPLICATION_NAME, (String)null);
+ return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_APPLICATION_NAME,
+ attributes.getAttribute(ATTRIBUTE_APPLICATION_NAME, (String)null));
}
- public static IServer setExpressApplication(IServer server, String val) throws CoreException {
- IServerWorkingCopy wc = server.createWorkingCopy();
- wc.setAttribute(ATTRIBUTE_APPLICATION_NAME, val);
- return wc.save(false, new NullProgressMonitor());
- }
-
- public static String getExpressDeployProject(IServerAttributes attributes ) {
- return attributes.getAttribute(ATTRIBUTE_DEPLOY_PROJECT, (String)null);
- }
- public static IServer setExpressDeployProject(IServer server, String val) throws CoreException {
- IServerWorkingCopy wc = server.createWorkingCopy();
- wc.setAttribute(ATTRIBUTE_DEPLOY_PROJECT, val);
- return wc.save(false, new NullProgressMonitor());
- }
-
public static String getExpressApplicationId(IServerAttributes attributes ) {
- return attributes.getAttribute(ATTRIBUTE_APPLICATION_ID, (String)null);
+ return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_APPLICATION_ID,
+ attributes.getAttribute(ATTRIBUTE_APPLICATION_ID, (String)null));
}
public static String getExpressDomain(IServerAttributes attributes ) {
- return attributes.getAttribute(ATTRIBUTE_DOMAIN, (String)null);
+ return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_DOMAIN,
+ attributes.getAttribute(ATTRIBUTE_DOMAIN, (String)null));
}
- 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());
- }
-
public static String getExpressDeployFolder(IServerAttributes attributes ) {
- return attributes.getAttribute(ATTRIBUTE_DEPLOY_FOLDER_NAME, ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
+ return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_DEPLOY_FOLDER_NAME,
+ attributes.getAttribute(ATTRIBUTE_DEPLOY_FOLDER_NAME, (String)null));
}
public static String getExpressRemoteName(IServerAttributes attributes ) {
- return attributes.getAttribute(ATTRIBUTE_REMOTE_NAME, IOpenShiftExpressWizardModel.NEW_PROJECT_REMOTE_NAME_DEFAULT);
+ return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_REMOTE_NAME,
+ attributes.getAttribute(ATTRIBUTE_REMOTE_NAME,(String)null));
}
- 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 getExpressUsername(IServerAttributes attributes ) {
- return attributes.getAttribute(ATTRIBUTE_USERNAME, (String)null);
+ return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_USERNAME,
+ attributes.getAttribute(ATTRIBUTE_USERNAME, (String)null));
}
- 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 boolean getIgnoresContextRoot(IServerAttributes server) {
return server.getAttribute(PREFERENCE_IGNORE_CONTEXT_ROOT, true);
}
@@ -165,27 +155,6 @@
wc.setAttribute(ATTRIBUTE_REMOTE_NAME, val);
return wc.save(false, new NullProgressMonitor());
}
-
- /*
- public static IServer fillServerWithOpenShiftDetails(IServer server, IApplication application,
- IUser user, String deployProject, String projectRelativeFolder,
- String mode, String remoteName) throws CoreException, OpenShiftException {
- return fillServerWithOpenShiftDetails(server, application.getApplicationUrl(),
- user.getRhlogin(), user.getPassword(), user.getDomain().getNamespace(),
- application.getName(), application.getUUID(), deployProject, projectRelativeFolder, mode, remoteName);
- }*/
-
- public static void fillServerWithOpenShiftDetails(IServerWorkingCopy wc, IApplication application,
- UserDelegate user, IDomain domain, String mode, String deployProject,
- String projectRelativeFolder, String remoteName) throws OpenShiftException {
- fillServerWithOpenShiftDetails(wc,
- application == null ? null : application.getApplicationUrl(),
- user == null ? null : user.getRhlogin(),
- domain == null ? null : domain.getId(),
- application == null ? null : application.getName(),
- application == null ? null : application.getUUID(),
- deployProject, projectRelativeFolder, mode, remoteName);
- }
/**
* Fills an already-created server with the proper openshift details.
@@ -202,20 +171,16 @@
*/
@SuppressWarnings("restriction")
public static IServer fillServerWithOpenShiftDetails(IServer server, String host,
- String username, String password, String domain, String appName, String appId,
- String deployProject, String projectRelativeFolder,
- String mode, String remoteName) throws CoreException {
+ String deployProject) throws CoreException {
ServerWorkingCopy wc = (ServerWorkingCopy)server.createWorkingCopy();
- fillServerWithOpenShiftDetails(wc, host, username, domain, appName, appId,
- deployProject, projectRelativeFolder, mode, remoteName);
+ fillServerWithOpenShiftDetails((IServerWorkingCopy)wc, host, deployProject);
IServer saved = wc.save(true, new NullProgressMonitor());
return saved;
}
public static void fillServerWithOpenShiftDetails(IServerWorkingCopy wc, String host,
- String username, String domain, String appName, String appId,
- String deployProject, String projectRelativeFolder,
- String mode, String remoteName) {
+ String deployProject) {
+
if( host != null ) {
if( host.indexOf("://") != -1)
host = host.substring(host.indexOf("://") + 3);
@@ -224,14 +189,14 @@
}
wc.setHost(host);
wc.setAttribute(IDeployableServer.SERVER_MODE, ExpressBehaviourDelegate.OPENSHIFT_ID);
- wc.setAttribute(ATTRIBUTE_USERNAME, username);
- wc.setAttribute(ATTRIBUTE_DOMAIN, domain);
- wc.setAttribute(ATTRIBUTE_APPLICATION_NAME, appName);
- wc.setAttribute(ATTRIBUTE_APPLICATION_ID, appId);
wc.setAttribute(ATTRIBUTE_DEPLOY_PROJECT, deployProject);
- wc.setAttribute(ATTRIBUTE_DEPLOY_FOLDER_NAME, projectRelativeFolder);
- wc.setAttribute(ATTRIBUTE_EXPRESS_MODE, mode);
- wc.setAttribute(ATTRIBUTE_REMOTE_NAME, remoteName);
+// wc.setAttribute(ATTRIBUTE_USERNAME, username);
+// wc.setAttribute(ATTRIBUTE_DOMAIN, domain);
+// wc.setAttribute(ATTRIBUTE_APPLICATION_NAME, appName);
+// 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);
((ServerWorkingCopy)wc).setAutoPublishSetting(Server.AUTO_PUBLISH_DISABLE);
wc.setAttribute(IJBossToolingConstants.IGNORE_LAUNCH_COMMANDS, "true");
wc.setAttribute(IJBossToolingConstants.WEB_PORT, 80);
@@ -352,4 +317,67 @@
return null;
}
}
+
+ 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);
+ node.put(ExpressServerUtils.SETTING_APPLICATION_ID, app.getUUID());
+ node.put(ExpressServerUtils.SETTING_APPLICATION_NAME, app.getName());
+ node.put(ExpressServerUtils.SETTING_USERNAME, user.getRhlogin());
+ node.put(ExpressServerUtils.SETTING_DOMAIN, app.getDomain().getId());
+ node.put(ExpressServerUtils.SETTING_REMOTE_NAME, remoteName);
+ node.put(ExpressServerUtils.SETTING_DEPLOY_FOLDER_NAME, deployFolder);
+ try {
+ node.flush();
+ } catch (BackingStoreException e) {
+ OpenShiftUIActivator.log(e);
+ }
+ }
+
+
+ /* Deprecated */
+ public static IServer setExpressMode(IServer server, String val) throws CoreException {
+ IServerWorkingCopy wc = server.createWorkingCopy();
+ wc.setAttribute(ATTRIBUTE_EXPRESS_MODE, val);
+ return wc.save(false, new NullProgressMonitor());
+ }
+ public static IServer setExpressApplication(IServer server, String val) throws CoreException {
+ IServerWorkingCopy wc = server.createWorkingCopy();
+ wc.setAttribute(ATTRIBUTE_APPLICATION_NAME, val);
+ return wc.save(false, new NullProgressMonitor());
+ }
+ public static IServer setExpressDeployProject(IServer server, String val) throws CoreException {
+ IServerWorkingCopy wc = server.createWorkingCopy();
+ wc.setAttribute(ATTRIBUTE_DEPLOY_PROJECT, val);
+ return wc.save(false, new NullProgressMonitor());
+ }
+ 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());
+ }
+ 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-27 08:09:18 UTC (rev 40552)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-04-27 09:14:20 UTC (rev 40553)
@@ -46,6 +46,7 @@
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.Link;
import org.eclipse.swt.widgets.Text;
@@ -114,11 +115,16 @@
this.composite = fill;
this.showVerify = showVerify;
this.showImportLink = showVerify;
- initModel();
- createWidgets(fill);
- fillWidgets();
- addListeners();
- quickValidate();
+ try {
+ initModel();
+ createWidgets(fill);
+ fillWidgets();
+ addListeners();
+ quickValidate();
+ } catch(RuntimeException e) {
+ e.printStackTrace();
+ throw e;
+ }
}
public Composite getComposite() {
@@ -168,7 +174,9 @@
this.pass = this.user == null ? null : UserModel.getDefault().getPasswordFromSecureStorage(this.user);
this.deployFolder = ExpressServerUtils.getExpressDeployFolder(server);
+ this.deployFolder = this.deployFolder == null ? ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT : this.deployFolder;
this.remote = ExpressServerUtils.getExpressRemoteName(server);
+ this.remote = this.remote == null ? ExpressServerUtils.ATTRIBUTE_REMOTE_NAME_DEFAULT : this.remote;
}
/* Set widgets initial values */
@@ -268,10 +276,16 @@
GridData gd = GridDataFactory.fillDefaults().span(2, 1).create();
importLink.setLayoutData(gd);
}
- Label zipDestLabel = new Label(composite, SWT.NONE);
+
+
+ Group projectSettings = new Group(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(2,1).applyTo(projectSettings);
+ projectSettings.setLayout(new GridLayout(2, false));
+
+ Label zipDestLabel = new Label(projectSettings, SWT.NONE);
zipDestLabel.setText("Output Directory: ");
- Composite zipDestComposite = new Composite(composite, SWT.NONE);
+ Composite zipDestComposite = new Composite(projectSettings, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(zipDestComposite);
zipDestComposite.setLayout(new FormLayout());
browseDestButton = new Button(zipDestComposite, SWT.PUSH);
@@ -282,12 +296,13 @@
- Label remoteLabel = new Label(composite, SWT.NONE);
+ Label remoteLabel = new Label(projectSettings, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(remoteLabel);
- remoteText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ 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");
userLabel.setText("Username: ");
if( passLabel != null ) passLabel.setText("Password: ");
remoteLabel.setText("Remote: ");
@@ -392,8 +407,40 @@
}
});
}
+
+ deployProjectCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ deployProjectChanged();
+ }
+ });
}
+ 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);
+ }
+ }
+ }
+
private void browsePressed() {
IFolder f = chooseFolder();
if( f != null ) {
@@ -569,6 +616,7 @@
UserModel.getDefault().clearPasswordInSecureStorage(fuser.getRhlogin());
}
fillServerWithDetails();
+ updateProjectSettings();
} catch(OpenShiftException ose) {
throw new CoreException(new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID, ose.getMessage(), ose));
}
@@ -577,10 +625,23 @@
// Fill the server working copy
// update the values
IServerWorkingCopy wc = callback.getServer();
- ExpressServerUtils.fillServerWithOpenShiftDetails(wc, fapplication,
- fuser, fdomain, mode, deployProject, deployFolder, remote);
+ String host = fapplication == null ? null : fapplication.getApplicationUrl();
+ ExpressServerUtils.fillServerWithOpenShiftDetails(wc, host, deployProject);
}
+
+ private void updateProjectSettings() {
+ IProject depProj = ResourcesPlugin.getWorkspace().getRoot().getProject(deployProject);
+ String projRemote = ExpressServerUtils.getProjectAttribute(depProj,
+ ExpressServerUtils.SETTING_REMOTE_NAME, null);
+ String projDepFolder = ExpressServerUtils.getProjectAttribute(depProj,
+ ExpressServerUtils.SETTING_DEPLOY_FOLDER_NAME, null);
+ if( projRemote == null && projDepFolder == null ) {
+ ExpressServerUtils.updateOpenshiftProjectSettings(
+ depProj, fapplication, fuser, remote, deployFolder);
+ }
+ }
+
private String[] getAppNamesAsStrings(List<IApplication> allApps) {
String[] appNames = new String[allApps.size()];
for (int i = 0; i < allApps.size(); i++) {
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-27 08:09:18 UTC (rev 40552)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java 2012-04-27 09:14:20 UTC (rev 40553)
@@ -10,42 +10,22 @@
*******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.behaviour;
-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.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.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.Composite;
-import org.eclipse.swt.widgets.Display;
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.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.views.navigator.ResourceComparator;
-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.ServerWorkingCopyPropertyCommand;
import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
public class ExpressDetailsSection extends ServerEditorSection {
@@ -53,7 +33,7 @@
protected Text userText, remoteText;
protected Text deployFolderText;
protected Text appNameText, deployProjectText;
- protected Button verifyButton, browseDestButton;
+ protected Button verifyButton; // browseDestButton;
public void init(IEditorSite site, IEditorInput input) {
super.init(site, input);
@@ -75,7 +55,7 @@
section.setClient(c);
initWidgets();
- addListeners();
+// addListeners();
}
protected void initWidgets() {
@@ -94,7 +74,8 @@
String remote = ExpressServerUtils.getExpressRemoteName(server);
deployFolderText.setText(outDir == null ? "" : outDir);
remoteText.setText(remote == null ? "" : remote);
-
+ remoteText.setEnabled(false);
+ deployFolderText.setEnabled(false);
}
protected Composite createComposite(Section section) {
@@ -104,6 +85,12 @@
private void createWidgets(Composite composite) {
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);
+
+
Label userLabel = new Label(composite, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(userLabel);
userText = new Text(composite, SWT.SINGLE | SWT.BORDER);
@@ -114,19 +101,16 @@
appNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(appNameText);
- 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);
-
Label zipDestLabel = new Label(composite, SWT.NONE);
- 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(zipDestComposite, SWT.SINGLE | SWT.BORDER);
- deployFolderText.setLayoutData(UIUtil.createFormData2(0,5,100,-5,0,0,browseDestButton,-5));
+// 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);
@@ -139,76 +123,76 @@
zipDestLabel.setText("Output Directory: ");
userLabel.setText("Username: ");
remoteLabel.setText("Remote: ");
- browseDestButton.setText("Browse...");
+// browseDestButton.setText("Browse...");
}
- 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;
+// 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();
+// }
+// });
- }
+// }
+//
+// private void browsePressed() {
+// IFolder f = chooseFolder();
+// if( f != null ) {
+// deployFolderText.setText(f.getFullPath().removeFirstSegments(1).makeRelative().toOSString());
+// }
+// }
- 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 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 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);
+// }
+// }
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-04-27 08:09:18 UTC (rev 40552)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-04-27 09:14:20 UTC (rev 40553)
@@ -15,10 +15,14 @@
import java.net.SocketTimeoutException;
import java.net.URISyntaxException;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -150,11 +154,10 @@
if (success) {
success = importProject();
}
-
wizardModel.addUserToModel();
return success;
}
-
+
private boolean importProject() {
try {
final DelegatingProgressMonitor delegatingMonitor = new DelegatingProgressMonitor();
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-27 08:09:18 UTC (rev 40552)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-04-27 09:14:20 UTC (rev 40553)
@@ -6,6 +6,7 @@
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
@@ -14,25 +15,31 @@
import java.util.concurrent.FutureTask;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.egit.core.EGitUtils;
import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
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.messages.OpenShiftExpressUIMessages;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ConfigureGitSharedProject;
import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ConfigureUnsharedProject;
import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportNewProject;
import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ServerAdapterFactory;
+import org.osgi.service.prefs.BackingStoreException;
import com.openshift.client.IApplication;
import com.openshift.client.ICartridge;
@@ -87,9 +94,27 @@
, getRemoteName()
, getRepositoryFile())
.execute(monitor);
+ addSettingsFiles(importedProjects);
createServerAdapter(monitor, importedProjects);
}
+ private void addSettingsFiles(List<IProject> imported) {
+ Iterator<IProject> i = imported.iterator();
+ while(i.hasNext()) {
+ IProject p = i.next();
+ if( p.getFolder(".git").exists()) {
+ // This is our project
+ IApplication app = getApplication();
+ IProject project = p;
+ // Add the settings here!
+ ExpressServerUtils.updateOpenshiftProjectSettings(project, app,
+ getUser(), getRemoteName(),
+ ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
+ return;
+ }
+ }
+ }
+
/**
* Enables the user chosen, unshared project to be used on the chosen
* OpenShift application. Clones the application git repository, copies the
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-27 08:09:18 UTC (rev 40552)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java 2012-04-27 09:14:20 UTC (rev 40553)
@@ -114,10 +114,8 @@
String serverName = org.jboss.ide.eclipse.as.core.util.ServerUtil.getDefaultServerName(serverNameBase);
IServer server = ExpressServerUtils.createServer(rt, serverType, serverName);
- ExpressServerUtils.fillServerWithOpenShiftDetails(server, application.getApplicationUrl(),
- user.getRhlogin(), user.getPassword(), user.getDefaultDomain().getId(),
- application.getName(), application.getUUID(), deployProject,
- ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT, mode, remoteName);
+ ExpressServerUtils.fillServerWithOpenShiftDetails(server,
+ application.getApplicationUrl(), deployProject);
return server;
}
12 years, 8 months
JBoss Tools SVN: r40552 - trunk/openshift/plugins/org.jboss.tools.openshift.express.client.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-04-27 04:09:18 -0400 (Fri, 27 Apr 2012)
New Revision: 40552
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.client/
Log:
ignoring source jar here
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.client
___________________________________________________________________
Modified: svn:ignore
- build
bin
target
buildlog.latest.txt
+ build
bin
target
buildlog.latest.txt
openshift-java-client-2.0.0-SNAPSHOT-sources.jar
12 years, 8 months
JBoss Tools SVN: r40551 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-04-27 04:08:22 -0400 (Fri, 27 Apr 2012)
New Revision: 40551
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java
Log:
In progress - JBIDE-11073
OpenShift Express Tool: Create a way to invoke rhc-port-forward functionality which enables users to debug their cloud environments with their local tools
in progress - JBIDE-11670
portforward: when duplicate remote ports the 127.0.0.1 is not good
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardModel.java 2012-04-27 08:07:55 UTC (rev 40550)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardModel.java 2012-04-27 08:08:22 UTC (rev 40551)
@@ -1,9 +1,14 @@
package org.jboss.tools.openshift.express.internal.core.portforward;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
+import org.eclipse.jdt.launching.SocketUtil;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
import org.jboss.tools.common.databinding.ObservablePojo;
+import org.jboss.tools.openshift.express.internal.ui.console.ConsoleUtils;
import com.jcraft.jsch.JSchException;
import com.openshift.client.IApplication;
@@ -13,13 +18,19 @@
public class ApplicationPortForwardingWizardModel extends ObservablePojo {
public static final String PROPERTY_USE_DEFAULT_LOCAL_IP_ADDRESS = "useDefaultLocalIpAddress";
-
+
public static final String PROPERTY_FORWARDABLE_PORTS = "forwardablePorts";
-
+
+ public static final String PROPERTY_USE_FREE_PORTS = "useFreePorts";
+
+ public static final String PROPERTY_PORT_FORWARDING = "portForwarding";
+
private Boolean useDefaultLocalIpAddress = Boolean.TRUE;
-
+
+ private Boolean useFreePorts = Boolean.FALSE;
+
private final IApplication application;
-
+
public ApplicationPortForwardingWizardModel(final IApplication application) {
this.application = application;
}
@@ -31,49 +42,132 @@
return application;
}
+ public List<IApplicationPortForwarding> getForwardablePorts() throws OpenShiftSSHOperationException {
+ return application.getForwardablePorts();
+ }
+
+ public boolean getPortForwarding() throws OpenShiftSSHOperationException {
+ return this.application.isPortFowardingStarted();
+ }
+
+ public void startPortForwarding() throws OpenShiftSSHOperationException {
+ if (this.application.isPortFowardingStarted()) {
+ return;
+ }
+ final MessageConsole console = ConsoleUtils.findMessageConsole(application.getUUID());
+ ConsoleUtils.displayConsoleView(console);
+ MessageConsoleStream stream = console.newMessageStream();
+ stream.println("Starting port-forwarding...");
+ this.application.startPortForwarding();
+ for (IApplicationPortForwarding port : this.application.getForwardablePorts()) {
+ stream.println(" " + getPortStatus(port));
+ }
+ stream.println("done.");
+ firePropertyChange(PROPERTY_PORT_FORWARDING, false, this.application.isPortFowardingStarted());
+ }
+
+ public void stopPortForwarding() throws OpenShiftSSHOperationException {
+ if (!this.application.isPortFowardingStarted()) {
+ return;
+ }
+ final MessageConsole console = ConsoleUtils.findMessageConsole(application.getUUID());
+ ConsoleUtils.displayConsoleView(console);
+ MessageConsoleStream stream = console.newMessageStream();
+ stream.println("Stopping port-forwarding...");
+ this.application.stopPortForwarding();
+ for (IApplicationPortForwarding port : this.application.getForwardablePorts()) {
+ stream.println(" " + getPortStatus(port));
+ }
+ stream.println("done.");
+
+ firePropertyChange(PROPERTY_PORT_FORWARDING, true, this.application.isPortFowardingStarted());
+ }
+
/**
+ * @param port
+ * @return
+ * @throws OpenShiftSSHOperationException
+ */
+ private String getPortStatus(IApplicationPortForwarding port) throws OpenShiftSSHOperationException {
+ return port.getName() + " " + port.getLocalAddress() + ":" + port.getLocalPort() + " -> "
+ + port.getRemoteAddress() + ":" + port.getRemotePort() + " "
+ + (port.isStarted(application.getSSHSession()) ? "(started)" : "(stopped)");
+ }
+
+ /**
* @return the useDefaultLocalIpAddress
*/
public final Boolean getUseDefaultLocalIpAddress() {
return useDefaultLocalIpAddress;
}
-
- public List<IApplicationPortForwarding> getForwardablePorts() throws OpenShiftSSHOperationException {
- return application.getForwardablePorts();
- }
-
/**
- * @param useDefaultLocalIpAddress the useDefaultLocalIpAddress to set
- * @throws IOException
- * @throws JSchException
+ * @param useDefaultLocalIpAddress
+ * the useDefaultLocalIpAddress to set
+ * @throws IOException
+ * @throws JSchException
*/
- public final void setUseDefaultLocalIpAddress(final Boolean useDefaultLocalIpAddress) throws OpenShiftSSHOperationException {
- updateLocalBindingValues(useDefaultLocalIpAddress);
+ public final void setUseDefaultLocalIpAddress(final Boolean useDefaultLocalIpAddress)
+ throws OpenShiftSSHOperationException {
+ updateLocalAddressBindings(useDefaultLocalIpAddress);
firePropertyChange(PROPERTY_USE_DEFAULT_LOCAL_IP_ADDRESS, this.useDefaultLocalIpAddress,
this.useDefaultLocalIpAddress = useDefaultLocalIpAddress);
}
- private void updateLocalBindingValues(final boolean useLocalIpAddress) throws OpenShiftSSHOperationException {
- for (IApplicationPortForwarding port : application.getForwardablePorts()) {
+ /**
+ * @return the useFreePorts
+ */
+ public Boolean getUseFreePorts() {
+ return useFreePorts;
+ }
+
+ /**
+ * @param useFreePorts
+ * the useFreePorts to set
+ * @throws OpenShiftSSHOperationException
+ */
+ public void setUseFreePorts(Boolean useFreePorts) throws OpenShiftSSHOperationException {
+ updateLocalPortBindings(useFreePorts);
+ firePropertyChange(PROPERTY_USE_DEFAULT_LOCAL_IP_ADDRESS, this.useFreePorts, this.useFreePorts = useFreePorts);
+ }
+
+ private void updateLocalAddressBindings(final boolean useLocalIpAddress) throws OpenShiftSSHOperationException {
+ final List<IApplicationPortForwarding> ports = application.getForwardablePorts();
+ for (IApplicationPortForwarding port : ports) {
port.setLocalAddress(useLocalIpAddress ? "127.0.0.1" : port.getRemoteAddress());
- if (port.getLocalPort() == null) {
- port.setLocalPort(port.getRemotePort());
+ }
+ }
+
+ private void updateLocalPortBindings(final boolean useFreePorts) throws OpenShiftSSHOperationException {
+ final List<IApplicationPortForwarding> ports = application.getForwardablePorts();
+ final List<String> bindings = new ArrayList<String>();
+ // update local bindings while avoiding duplicates
+ for (IApplicationPortForwarding port : ports) {
+ // find duplicate
+ String key = null;
+ int remotePort = port.getRemotePort();
+ while (key == null || bindings.contains(key)) {
+ if (useFreePorts) {
+ port.setLocalPort(SocketUtil.findFreePort());
+ } else {
+ port.setLocalPort(remotePort);
+ }
+ key = port.getRemotePort() + ":" + port.getLocalPort();
+ remotePort++;
}
- }
+ bindings.add(key);
+ }
}
public void loadForwardablePorts() throws OpenShiftSSHOperationException {
getApplication().getForwardablePorts();
refreshForwardablePorts();
}
-
+
public void refreshForwardablePorts() throws OpenShiftSSHOperationException {
application.refreshForwardablePorts();
- updateLocalBindingValues(this.useDefaultLocalIpAddress);
+ updateLocalAddressBindings(this.useDefaultLocalIpAddress);
+ updateLocalPortBindings(this.useFreePorts);
}
-
-
-
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java 2012-04-27 08:07:55 UTC (rev 40550)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java 2012-04-27 08:08:22 UTC (rev 40551)
@@ -28,6 +28,8 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.common.ui.databinding.InvertingBooleanConverter;
+import org.jboss.tools.common.ui.databinding.ValueBindingBuilder;
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.AbstractOpenShiftWizardPage;
@@ -85,6 +87,7 @@
startButton.setEnabled(true);
GridDataFactory.fillDefaults().hint(110, SWT.DEFAULT).align(SWT.FILL, SWT.TOP).applyTo(startButton);
startButton.addSelectionListener(onStartPortForwarding());
+
stopButton = new Button(container, SWT.PUSH);
stopButton.setText("Stop All");
@@ -93,11 +96,11 @@
stopButton.addSelectionListener(onStopPortForwarding());
// checkbox to use the default "127.0.0.1" local IP address
- Button useLocalIpAddressButton = new Button(container, SWT.CHECK);
- useLocalIpAddressButton.setText("Use '127.0.0.1' as the local address for all ports");
- GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).grab(false, false)
+ final Button useLocalIpAddressButton = new Button(container, SWT.CHECK);
+ useLocalIpAddressButton.setText("Use '127.0.0.1' as the local address for all Services");
+ GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).grab(false, false)
.applyTo(useLocalIpAddressButton);
- IObservableValue useLocalIpAddressObservable = BeanProperties.value(
+ final IObservableValue useLocalIpAddressObservable = BeanProperties.value(
ApplicationPortForwardingWizardModel.PROPERTY_USE_DEFAULT_LOCAL_IP_ADDRESS).observe(wizardModel);
final IObservableValue useLocalIpAddressButtonSelection = WidgetProperties.selection().observe(
useLocalIpAddressButton);
@@ -108,6 +111,36 @@
refreshViewerInput();
}
});
+
+ // checkbox to use the default "127.0.0.1" local IP address
+ final Button findFreesPortButton = new Button(container, SWT.CHECK);
+ findFreesPortButton.setText("Find free ports for all Services");
+ GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).grab(false, false)
+ .applyTo(findFreesPortButton);
+ final IObservableValue findFreePortsButtonObservable = BeanProperties.value(
+ ApplicationPortForwardingWizardModel.PROPERTY_USE_FREE_PORTS).observe(wizardModel);
+ final IObservableValue findFreePortsButtonSelection = WidgetProperties.selection().observe(
+ findFreesPortButton);
+ dbc.bindValue(findFreePortsButtonSelection, findFreePortsButtonObservable);
+ findFreePortsButtonObservable.addValueChangeListener(new IValueChangeListener() {
+ @Override
+ public void handleValueChange(ValueChangeEvent event) {
+ refreshViewerInput();
+ }
+ });
+
+ // enabling/disabling controls
+ IObservableValue portForwardingStartedObservable = BeanProperties.value(
+ ApplicationPortForwardingWizardModel.PROPERTY_PORT_FORWARDING).observe(wizardModel);
+ ValueBindingBuilder.bind(WidgetProperties.enabled().observe(startButton))
+ .notUpdating(portForwardingStartedObservable).converting(new InvertingBooleanConverter()).in(dbc);
+ ValueBindingBuilder.bind(WidgetProperties.enabled().observe(stopButton))
+ .notUpdating(portForwardingStartedObservable).in(dbc);
+ ValueBindingBuilder.bind(WidgetProperties.enabled().observe(useLocalIpAddressButton))
+ .notUpdating(portForwardingStartedObservable).converting(new InvertingBooleanConverter()).in(dbc);
+ ValueBindingBuilder.bind(WidgetProperties.enabled().observe(findFreesPortButton))
+ .notUpdating(portForwardingStartedObservable).converting(new InvertingBooleanConverter()).in(dbc);
+
}
/*
@@ -128,6 +161,7 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
+ verifyApplicationSSHSession();
wizardModel.refreshForwardablePorts();
refreshViewerInput();
} catch (Exception e) {
@@ -153,8 +187,7 @@
protected IStatus run(IProgressMonitor monitor) {
try {
verifyApplicationSSHSession();
- wizardModel.getApplication().startPortForwarding();
- wizardModel.getApplication().getForwardablePorts();
+ wizardModel.startPortForwarding();
refreshViewerInput();
} catch (Exception e) {
Logger.error("Failed to start port-forwarding", e);
@@ -187,7 +220,7 @@
protected IStatus run(IProgressMonitor monitor) {
try {
verifyApplicationSSHSession();
- wizardModel.getApplication().stopPortForwarding();
+ wizardModel.stopPortForwarding();
refreshViewerInput();
} catch (Exception e) {
Logger.error("Failed to stop Port-forwarding", e);
@@ -233,7 +266,7 @@
@Override
public void update(ViewerCell cell) {
IApplicationPortForwarding port = (IApplicationPortForwarding) cell.getElement();
- cell.setText(port.getLocalPort());
+ cell.setText(Integer.toString(port.getLocalPort()));
}
}, viewer, tableLayout);
@@ -249,7 +282,7 @@
@Override
public void update(ViewerCell cell) {
IApplicationPortForwarding port = (IApplicationPortForwarding) cell.getElement();
- cell.setText(port.getRemotePort());
+ cell.setText(Integer.toString(port.getRemotePort()));
}
}, viewer, tableLayout);
@@ -260,7 +293,7 @@
IApplicationPortForwarding port = (IApplicationPortForwarding) cell.getElement();
try {
final boolean started = port.isStarted(wizardModel.getApplication().getSSHSession());
- cell.setText(started ? "Enabled" : "Disabled");
+ cell.setText(started ? "Started" : "Stopped");
} catch (OpenShiftSSHOperationException e) {
cell.setText("Unknown");
}
@@ -295,11 +328,11 @@
monitor.worked(1);
return Status.OK_STATUS;
} catch (Exception e) {
- return OpenShiftUIActivator.createErrorStatus("Could not load forwardable ports for application", e);
+ return OpenShiftUIActivator.createErrorStatus(
+ "Could not load forwardable ports for application", e);
}
}
-
}, getContainer(), getDataBindingContext());
} catch (Exception e) {
// ignore
@@ -307,13 +340,14 @@
}
/**
- * @param monitor
+ * @param monitor
* @throws JSchException
*/
+ //TODO : move this method into the WizardModel ?
private void verifyApplicationSSHSession() throws JSchException {
final boolean hasSSHSession = wizardModel.getApplication().hasSSHSession();
- if(!hasSSHSession) {
- Logger.info("Opening a new SSH Session for application '" + wizardModel.getApplication().getName() + "'");
+ if (!hasSSHSession) {
+ Logger.debug("Opening a new SSH Session for application '" + wizardModel.getApplication().getName() + "'");
final Session session = OpenShiftSshSessionFactory.getInstance().createSession(
getSshUri(wizardModel.getApplication()));
wizardModel.getApplication().setSSHSession(session);
12 years, 8 months
JBoss Tools SVN: r40550 - branches.
by jbosstools-commits@lists.jboss.org
Author: dpalmer
Date: 2012-04-27 04:07:55 -0400 (Fri, 27 Apr 2012)
New Revision: 40550
Added:
branches/soatools-3.3.0.Beta1/
Log:
Creating branch for SOA tools 3.3.0.Beta1
12 years, 8 months
JBoss Tools SVN: r40549 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-04-27 04:06:38 -0400 (Fri, 27 Apr 2012)
New Revision: 40549
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.properties
Log:
Renaming the 'Delete' action as 'Disconnect' to avoid the confusion
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.properties
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.properties 2012-04-27 08:01:40 UTC (rev 40548)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.properties 2012-04-27 08:06:38 UTC (rev 40549)
@@ -17,7 +17,7 @@
SHOW_PROPERTIES_VIEW_ACTION=Properties
REFRESH_VIEWER_ACTION=Refresh
-DELETE_CONNECTION_ACTION=Delete
+DELETE_CONNECTION_ACTION=Disconnect
USER_NOT_CONNECTED_LABEL=<User is not connected>
LOADING_USER_APPLICATIONS_LABEL=Loading
12 years, 8 months
JBoss Tools SVN: r40548 - trunk/openshift/plugins/org.jboss.tools.openshift.express.client.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-04-27 04:01:40 -0400 (Fri, 27 Apr 2012)
New Revision: 40548
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.client/openshift-java-client-2.0.0-SNAPSHOT.jar
Log:
latest version of the binary client lib
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.client/openshift-java-client-2.0.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
12 years, 8 months