Author: xcoulon
Date: 2012-05-25 09:54:21 -0400 (Fri, 25 May 2012)
New Revision: 41420
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/TailServerLogAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/ApplicationPortForwardingActionProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/ShowEnvironmentActionProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/ApplicationPortForwardingActionProvider.java
Removed:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingActionProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleRemoveAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogAction.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
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/console/UserModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ShowEnvironmentAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/AbstractServerViewerActionProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/TailServerLogActionProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/TailServerLogActionProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
Log:
In progress - JBIDE-11841
Make OpenShift Explorer actions available from Server Adapter
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-05-25
13:42:22 UTC (rev 41419)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-05-25
13:54:21 UTC (rev 41420)
@@ -162,7 +162,7 @@
<viewerActionBinding
viewerId="org.eclipse.wst.server.ui.ServersView">
<includes>
<actionExtension
-
pattern="org.jboss.tools.openshift.express.internal.ui.serverviewer.actionDelegate.tailServerLogActionProvider"/>
+
pattern="org.jboss.tools.openshift.express.internal.ui.serverviewer.actionDelegate.*"/>
</includes>
</viewerActionBinding>
</extension>
@@ -174,13 +174,34 @@
id="org.jboss.tools.openshift.express.internal.ui.serverviewer.actionDelegate.tailServerLogActionProvider">
<enablement>
<and>
- <instanceof
- value="org.eclipse.wst.server.core.IServer">
- </instanceof>
- </and>
-
+ <instanceof
+ value="org.eclipse.wst.server.core.IServer">
+ </instanceof>
+ </and>
</enablement>
</actionProvider>
+ <actionProvider
+ class="org.jboss.tools.openshift.express.internal.ui.serverviewer.actionDelegate.ShowEnvironmentActionProvider"
+ id="org.jboss.tools.openshift.express.internal.ui.serverviewer.actionDelegate.showEnvironmentActionProvider">
+ <enablement>
+ <and>
+ <instanceof
+ value="org.eclipse.wst.server.core.IServer">
+ </instanceof>
+ </and>
+ </enablement>
+ </actionProvider>
+ <actionProvider
+ class="org.jboss.tools.openshift.express.internal.ui.serverviewer.actionDelegate.ApplicationPortForwardingActionProvider"
+ id="org.jboss.tools.openshift.express.internal.ui.serverviewer.actionDelegate.applicationPortForwardingActionProvider">
+ <enablement>
+ <and>
+ <instanceof
+ value="org.eclipse.wst.server.core.IServer">
+ </instanceof>
+ </and>
+ </enablement>
+ </actionProvider>
</extension>
<extension
@@ -318,8 +339,8 @@
<includes>
<actionExtension
pattern="org.jboss.tools.openshift.express.internal.ui.viewer.actionProvider.*"/>
- <actionExtension
-
pattern="org.jboss.tools.openshift.express.internal.core.portforward.applicationPortForwardActionProvider"/>
+ <!--actionExtension
+
pattern="org.jboss.tools.openshift.express.internal.core.portforward.applicationPortForwardActionProvider"/-->
</includes>
</viewerActionBinding>
<viewerContentBinding
@@ -422,8 +443,8 @@
</enablement>
</actionProvider>
<actionProvider
-
class="org.jboss.tools.openshift.express.internal.core.portforward.ApplicationPortForwardingActionProvider"
-
id="org.jboss.tools.openshift.express.internal.core.portforward.applicationPortForwardActionProvider">
+
class="org.jboss.tools.openshift.express.internal.ui.viewer.actionProvider.ApplicationPortForwardingActionProvider"
+
id="org.jboss.tools.openshift.express.internal.ui.viewer.actionProvider.applicationPortForwardingActionProvider">
<enablement>
<and>
<instanceof
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-05-25
13:42:22 UTC (rev 41419)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -48,58 +48,62 @@
import com.openshift.client.OpenShiftException;
/**
- * This class holds the attribute names whose values will be
- * stored inside a server object, as well as the utility methods
- * used to get and set them for a server.
- *
+ * This class holds the attribute names whose values will be stored inside a
+ * server object, as well as the utility methods used to get and set them for a
+ * server.
+ *
* @author Rob Stryker
*/
@SuppressWarnings("restriction")
public class ExpressServerUtils {
/* Server Settings */
- 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";
-
+ 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";
- 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_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_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_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_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_DEFAULT = "origin";
+ // public static final String ATTRIBUTE_PASSWORD =
+ // "org.jboss.tools.openshift.express.internal.core.behaviour.Password";
+ public static final String ATTRIBUTE_REMOTE_NAME_DEFAULT = "origin";
public static final String ATTRIBUTE_DEPLOY_FOLDER_DEFAULT = "deployments";
-
+
public static final String PREFERENCE_IGNORE_CONTEXT_ROOT =
"org.jboss.tools.openshift.express.internal.core.behaviour.IgnoreContextRoot";
-
- /** the OpensHift Server Type as defined in the plugin.xml.*/
+
+ /** the OpensHift Server Type as defined in the plugin.xml. */
public static final String OPENSHIFT_SERVER_TYPE =
"org.jboss.tools.openshift.express.openshift.server.type";
-
+
/* For use inside express wizard fragment */
public static final String TASK_WIZARD_ATTR_USER = "user";
public static final String TASK_WIZARD_ATTR_DOMAIN = "domain";
public static final String TASK_WIZARD_ATTR_APP_LIST = "appList";
public static final String TASK_WIZARD_ATTR_SELECTED_APP = "application";
-
- /* For use in finding not just the effective value, but values stored either in project
or server */
+
+ /*
+ * 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 )
+ if (project == null)
return defaultVal;
String qualifier = OpenShiftUIActivator.getDefault().getBundle().getSymbolicName();
IScopeContext context = new ProjectScope(project);
@@ -107,77 +111,101 @@
return node.get(attributeName, defaultVal);
}
+ /**
+ * Look-up the OpenShift application associated with the given server. This
+ * operation can be time-consuming since it may need to perform a request on
+ * OpenShift if the user's applications list had not been loaded before.
+ * Callers should use this methd without blocking the UI.
+ *
+ * @param server the server
+ * @return the openshift application or null if it could not be located.
+ * @throws OpenShiftException
+ */
+ public static IApplication getApplication(IServer server) {
+ final String appName = getExpressApplicationName(server);
+ final String userName = getExpressUsername(server);
+ try {
+ final UserDelegate ud = UserModel.getDefault().findUser(userName);
+ if (ud != null) {
+ return ud.getApplicationByName(appName); // May be long running
+ }
+ } catch (OpenShiftException e) {
+ Logger.error(NLS.bind("Failed to retrieve application ''{0}''
from user ''{1}}'", appName, userName), e);
+ }
+ return null;
+ }
+
/* 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));
+ public static String getExpressApplicationName(IServerAttributes attributes) {
+ return getProjectAttribute(getExpressDeployProject2(attributes),
SETTING_APPLICATION_NAME,
+ attributes.getAttribute(ATTRIBUTE_APPLICATION_NAME, (String) null));
}
- public static String getExpressApplicationId(IServerAttributes attributes ) {
- return getProjectAttribute(getExpressDeployProject2(attributes),
SETTING_APPLICATION_ID,
- attributes.getAttribute(ATTRIBUTE_APPLICATION_ID, (String)null));
+ public static String getExpressApplicationId(IServerAttributes attributes) {
+ return getProjectAttribute(getExpressDeployProject2(attributes),
SETTING_APPLICATION_ID,
+ attributes.getAttribute(ATTRIBUTE_APPLICATION_ID, (String) null));
}
- public static String getExpressDomain(IServerAttributes attributes ) {
- return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_DOMAIN,
- attributes.getAttribute(ATTRIBUTE_DOMAIN, (String)null));
+ public static String getExpressDomain(IServerAttributes attributes) {
+ return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_DOMAIN,
+ attributes.getAttribute(ATTRIBUTE_DOMAIN, (String) null));
}
- public static String getExpressUsername(IServerAttributes attributes ) {
- return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_USERNAME,
- attributes.getAttribute(ATTRIBUTE_USERNAME, (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 ) {
- if( getOverridesProject(attributes))
+ public static String getExpressDeployFolder(IServerAttributes attributes) {
+ 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 ) {
- if( getOverridesProject(attributes))
+
+ public static String getExpressRemoteName(IServerAttributes attributes) {
+ 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 getExpressDeployFolder(IServerAttributes attributes, int fromWhere
) {
- String fromServer =
attributes.getAttribute(ATTRIBUTE_DEPLOY_FOLDER_NAME,(String)null);
- if( fromWhere == SETTING_FROM_SERVER)
+ 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)
+ if (fromWhere == SETTING_FROM_PROJECT)
return fromProject;
- if( getOverridesProject(attributes))
+ 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)
+
+ 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)
+ if (fromWhere == SETTING_FROM_PROJECT)
return fromProject;
- if( getOverridesProject(attributes))
+ 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));
+ 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);
}
@@ -193,7 +221,7 @@
}
/**
- * Fills an already-created server with the proper openshift details.
+ * Fills an already-created server with the proper openshift details.
*
* @param server
* @param host
@@ -205,70 +233,72 @@
* @return
* @throws CoreException
*/
- public static IServer fillServerWithOpenShiftDetails(IServer server, String host,
+ public static IServer fillServerWithOpenShiftDetails(IServer server, String host,
String deployProject, String remote) throws CoreException {
- ServerWorkingCopy wc = (ServerWorkingCopy)server.createWorkingCopy();
- fillServerWithOpenShiftDetails((IServerWorkingCopy)wc, host, deployProject,remote);
+ ServerWorkingCopy wc = (ServerWorkingCopy) server.createWorkingCopy();
+ 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 remote) {
- if( host != null ) {
- if( host.indexOf("://") != -1)
+ public static void fillServerWithOpenShiftDetails(IServerWorkingCopy wc, String host,
+ String deployProject, String remote) {
+
+ if (host != null) {
+ if (host.indexOf("://") != -1)
host = host.substring(host.indexOf("://") + 3);
- if( host.endsWith("/"))
- host = host.substring(0, host.length()-1);
+ if (host.endsWith("/"))
+ host = host.substring(0, host.length() - 1);
}
wc.setHost(host);
wc.setAttribute(IDeployableServer.SERVER_MODE, ExpressBehaviourDelegate.OPENSHIFT_ID);
wc.setAttribute(ATTRIBUTE_DEPLOY_PROJECT, deployProject);
-// 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_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, remote);
- ((ServerWorkingCopy)wc).setAutoPublishSetting(Server.AUTO_PUBLISH_DISABLE);
+ ((ServerWorkingCopy) wc).setAutoPublishSetting(Server.AUTO_PUBLISH_DISABLE);
wc.setAttribute(IJBossToolingConstants.IGNORE_LAUNCH_COMMANDS, "true");
wc.setAttribute(IJBossToolingConstants.WEB_PORT, 80);
wc.setAttribute(IJBossToolingConstants.WEB_PORT_DETECT, "false");
wc.setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE,
IDeployableServer.DEPLOY_CUSTOM);
wc.setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, true);
}
-
-
+
public static IServer createServerAndRuntime(String runtimeID, String serverID,
String location, String configuration) throws CoreException {
IRuntime runtime = RuntimeUtils.createRuntime(runtimeID, location, configuration);
return createServer(runtime, serverID);
}
-
+
public static IServer createServer(IRuntime runtime, String serverID) throws
CoreException {
return createServer2(runtime, ServerCore.findServerType(serverID), serverID);
}
-
- public static IServer createServer(IRuntime runtime, IServerType serverType, String
serverName) throws CoreException {
+
+ public static IServer createServer(IRuntime runtime, IServerType serverType, String
serverName)
+ throws CoreException {
return createServer2(runtime, serverType, serverName);
}
-
- public static IServer createServer2(IRuntime currentRuntime, IServerType serverType,
String serverName) throws CoreException {
+
+ public static IServer createServer2(IRuntime currentRuntime, IServerType serverType,
String serverName)
+ throws CoreException {
IServerWorkingCopy serverWC = serverType.createServer(null, null,
new NullProgressMonitor());
serverWC.setRuntime(currentRuntime);
serverWC.setName(serverName);
serverWC.setServerConfiguration(null);
- serverWC.setAttribute(IDeployableServer.SERVER_MODE,
ExpressBehaviourDelegate.OPENSHIFT_ID);
+ serverWC.setAttribute(IDeployableServer.SERVER_MODE,
ExpressBehaviourDelegate.OPENSHIFT_ID);
return serverWC.save(true, new NullProgressMonitor());
}
-
/**
* Returns true if the given server is an OpenShift one, false otherwise.
- * @param server the server to check
+ *
+ * @param server
+ * the server to check
* @return true or false
*/
public static boolean isOpenShiftRuntime(IServerAttributes server) {
@@ -278,33 +308,36 @@
/**
* Returns true if the given server is a server using an openshift behaviour
- * @param server the server to check
+ *
+ * @param server
+ * the server to check
* @return true or false
*/
public static boolean isInOpenshiftBehaviourMode(IServer server) {
IDeployableServer ds = ServerConverter.getDeployableServer(server);
- if( ds != null ) {
+ if (ds != null) {
IJBossServerPublishMethodType type =
DeploymentPreferenceLoader.getCurrentDeploymentMethodType(server);
- if( type != null ) {
+ if (type != null) {
String id = type.getId();
- if( ExpressBinaryBehaviourDelegate.OPENSHIFT_BINARY_ID.equals(id) ||
ExpressBehaviourDelegate.OPENSHIFT_ID.equals(id))
+ if (ExpressBinaryBehaviourDelegate.OPENSHIFT_BINARY_ID.equals(id)
+ || ExpressBehaviourDelegate.OPENSHIFT_ID.equals(id))
return true;
}
}
return false;
}
- public static IApplication findApplicationForProject(IProject p,
List<IApplication> applications)
+ public static IApplication findApplicationForProject(IProject p,
List<IApplication> applications)
throws OpenShiftException, CoreException {
List<URIish> uris = EGitUtils.getRemoteURIs(p);
Iterator<IApplication> i = applications.iterator();
- while(i.hasNext()) {
+ while (i.hasNext()) {
IApplication a = i.next();
String gitUri = a.getGitUrl();
Iterator<URIish> j = uris.iterator();
- while(j.hasNext()) {
+ while (j.hasNext()) {
String projUri = j.next().toPrivateString();
- if( projUri.equals(gitUri)) {
+ if (projUri.equals(gitUri)) {
return a;
}
}
@@ -313,59 +346,59 @@
}
/**
- * This method will search available projects for one that has a
- * git remote URI that matches that of this IApplication
+ * 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 )
+ if (application == null)
return null;
final String gitUri = application.getGitUrl();
final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for( int i = 0; i < projects.length; i++ ) {
+ for (int i = 0; i < projects.length; i++) {
List<URIish> uris = null;
try {
uris = EGitUtils.getRemoteURIs(projects[i]);
Iterator<URIish> it = uris.iterator();
- while(it.hasNext()) {
+ while (it.hasNext()) {
String projURI = it.next().toPrivateString();
- if( projURI.equals(gitUri))
+ if (projURI.equals(gitUri))
results.add(projects[i]);
}
- } catch(CoreException ce) {
+ } catch (CoreException ce) {
// Log? Not 100 required, just skip this project?
}
}
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
+ * 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 ) {
+ 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 ) {
+ 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];
@@ -386,13 +419,13 @@
String appName = ExpressServerUtils.getExpressApplicationName(server);
IApplication app = user2 == null ? null : user2.getApplicationByName(appName);
return app;
- } catch(OpenShiftException ose) {
+ } catch (OpenShiftException ose) {
Logger.error(NLS.bind("Could not find application for server {0}",
server.getName()));
return null;
}
}
-
- public static void updateOpenshiftProjectSettings(IProject project, IApplication app,
+
+ 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);
@@ -409,21 +442,22 @@
OpenShiftUIActivator.log(e);
}
}
-
+
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 setExpressRemoteName(IServer server, String val) throws
CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
wc.setAttribute(ATTRIBUTE_REMOTE_NAME, val);
return wc.save(false, new NullProgressMonitor());
}
-
- /* Deprecated: These details cannot be changed and are no longer stored in the server
- * Delete when certain no problems will be caused.
+ /*
+ * 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 {
@@ -431,12 +465,14 @@
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();
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-05-25
13:42:22 UTC (rev 41419)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -129,6 +129,9 @@
}
public UserDelegate findUser(String username) {
+ if(username == null) {
+ return null;
+ }
return allUsers.get(username);
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingAction.java 2012-05-25
13:42:22 UTC (rev 41419)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingAction.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -1,10 +1,16 @@
package org.jboss.tools.openshift.express.internal.core.portforward;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
import org.jboss.tools.openshift.express.internal.ui.action.AbstractAction;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
@@ -15,28 +21,63 @@
public ApplicationPortForwardingAction() {
super("Port forwarding...",
DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_LCL_DISCONNECT));
}
+
/**
- * Operation called when the user clicks on 'Show In>Remote Console'. If no
Console/Worker existed, a new one is
- * created, otherwise, it is displayed. {@inheritDoc}
+ * Operation called when the user clicks on 'Show In>Remote Console'. If no
+ * Console/Worker existed, a new one is created, otherwise, it is displayed.
+ * {@inheritDoc}
*/
@Override
- public void run() {
- if (selection != null && selection instanceof ITreeSelection ) {
- Object sel = ((ITreeSelection)selection).getFirstElement();
- if( sel instanceof IApplication) {
- IApplication application = (IApplication)sel;
- try {
- ApplicationPortForwardingWizard wizard = new
ApplicationPortForwardingWizard(application);
- WizardDialog dialog = new
ApplicationPortForwardingWizardDialog(Display.getCurrent().getActiveShell(), wizard);
- dialog.setMinimumPageSize(700, 300);
- dialog.create();
- dialog.open();
- } catch (Exception e) {
- Logger.error("Failed to perform 'port-forwarding' for application
'" + application.getName() + "'", e);
- }
+ public void run() {
+ if (selection != null && selection instanceof ITreeSelection) {
+ Object sel = ((ITreeSelection) selection).getFirstElement();
+ IApplication application = null;
+ if (sel instanceof IApplication) {
+ application = (IApplication) sel;
+ } else if (sel instanceof IServer) {
+ openPortForwarding((IServer) sel);
}
+ if (application != null) {
+ openPortForwarding(application);
+ }
}
}
+ /**
+ * @param sel
+ * @return
+ */
+ private void openPortForwarding(final IServer server) {
+ Job job = new Job("Retrieving application's forwardable ports...") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ final IApplication application = ExpressServerUtils.getApplication(server);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ openPortForwarding(application);
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ };
+ job.setUser(true);
+ job.schedule();
+ }
+ /**
+ * @param application
+ */
+ private void openPortForwarding(IApplication application) {
+ try {
+ ApplicationPortForwardingWizard wizard = new
ApplicationPortForwardingWizard(application);
+ WizardDialog dialog = new
ApplicationPortForwardingWizardDialog(Display.getCurrent().getActiveShell(),
+ wizard);
+ dialog.setMinimumPageSize(700, 300);
+ dialog.create();
+ dialog.open();
+ } catch (Exception e) {
+ Logger.error("Failed to perform 'port-forwarding' for application
'" + application.getName() + "'", e);
+ }
+ }
+
}
Deleted:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingActionProvider.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingActionProvider.java 2012-05-25
13:42:22 UTC (rev 41419)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingActionProvider.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -1,10 +0,0 @@
-package org.jboss.tools.openshift.express.internal.core.portforward;
-
-import
org.jboss.tools.openshift.express.internal.ui.viewer.actionProvider.AbstractOpenShiftExplorerViewerActionProvider;
-
-public class ApplicationPortForwardingActionProvider extends
AbstractOpenShiftExplorerViewerActionProvider {
-
- public ApplicationPortForwardingActionProvider() {
- super(new ApplicationPortForwardingAction(), "group.showIn");
- }
-}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java 2012-05-25
13:42:22 UTC (rev 41419)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -41,52 +41,42 @@
}
/**
- * Operation called when the user clicks on 'Show In>Remote Console'. If no
Console/Worker existed, a new one is
- * created, otherwise, it is displayed. {@inheritDoc}
+ * Operation called when the user clicks on 'Show In>Remote Console'. If no
+ * Console/Worker existed, a new one is created, otherwise, it is displayed.
+ * {@inheritDoc}
*/
@Override
public void run() {
if (selection != null && selection instanceof ITreeSelection) {
Object sel = ((ITreeSelection) selection).getFirstElement();
if (sel instanceof UserDelegate) {
- UserDelegate user = (UserDelegate) sel;
- OpenShiftExpressApplicationWizard wizard = new
NewOpenShiftExpressApplicationWizard(user);
- new WizardDialog(new Shell(), wizard).open();
+ final UserDelegate user = (UserDelegate) sel;
+ final OpenShiftExpressApplicationWizard wizard = new
NewOpenShiftExpressApplicationWizard(user);
+ final WizardDialog wizardDialog = new WizardDialog(new Shell(), wizard);
+ wizardDialog.open();
}
}
}
/**
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- super.selectionChanged(event);
- enableWhenDomainExists();
- }
-
- @Override
- public void setSelection(ISelection selection) {
- super.setSelection(selection);
- enableWhenDomainExists();
- }
-
- * Enables the current action if the selected User has a default domain. Otherwise, the
action is disabled.
- private void enableWhenDomainExists() {
- if (selection != null && selection instanceof ITreeSelection) {
- Object sel = ((ITreeSelection) selection).getFirstElement();
- if (sel instanceof UserDelegate) {
- UserDelegate user = (UserDelegate) sel;
- try {
- final IDomain defaultDomain = user.getDefaultDomain();
- setEnabled(defaultDomain != null);
- } catch (SocketTimeoutException e) {
- Logger.error("Failed to check if selected user has a domain", e);
- } catch (OpenShiftException e) {
- Logger.error("Failed to check if selected user has a domain", e);
- }
- }
- }
- }
+ * @Override public void selectionChanged(SelectionChangedEvent event) {
+ * super.selectionChanged(event); enableWhenDomainExists(); }
+ * @Override public void setSelection(ISelection selection) {
+ * super.setSelection(selection); enableWhenDomainExists(); }
+ *
+ * Enables the current action if the selected User has a default
+ * domain. Otherwise, the action is disabled. private void
+ * enableWhenDomainExists() { if (selection != null && selection
+ * instanceof ITreeSelection) { Object sel = ((ITreeSelection)
+ * selection).getFirstElement(); if (sel instanceof UserDelegate)
+ * { UserDelegate user = (UserDelegate) sel; try { final IDomain
+ * defaultDomain = user.getDefaultDomain();
+ * setEnabled(defaultDomain != null); } catch
+ * (SocketTimeoutException e) {
+ * Logger.error("Failed to check if selected user has a domain",
+ * e); } catch (OpenShiftException e) {
+ * Logger.error("Failed to check if selected user has a domain",
+ * e); } } } }
*/
-
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ShowEnvironmentAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ShowEnvironmentAction.java 2012-05-25
13:42:22 UTC (rev 41419)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ShowEnvironmentAction.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -20,7 +20,9 @@
import
org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
import org.jboss.tools.openshift.express.internal.ui.utils.OpenShiftSshSessionFactory;
+import com.jcraft.jsch.JSchException;
import com.openshift.client.IApplication;
+import com.openshift.client.OpenShiftSSHOperationException;
/**
* @author Xavier Coulon
@@ -41,24 +43,33 @@
final ITreeSelection treeSelection = (ITreeSelection) selection;
if (selection instanceof ITreeSelection && treeSelection.getFirstElement()
instanceof IApplication) {
final IApplication application = (IApplication) treeSelection.getFirstElement();
- if(!application.hasSSHSession()) {
- application.setSSHSession(OpenShiftSshSessionFactory.getInstance().createSession(application));
- }
- List<String> props = application.getEnvironmentProperties();
- final MessageConsole console =
ConsoleUtils.findMessageConsole(getMessageConsoleName(application));
- console.clearConsole();
- MessageConsoleStream stream = console.newMessageStream();
- for (String prop : props) {
- stream.println(prop);
- }
- ConsoleUtils.displayConsoleView(console);
-
+ showEnvironmentProperties(application);
}
} catch (Exception e) {
OpenShiftUIActivator.createErrorStatus("Failed to display remote environment
variables", e);
}
}
+
+ /**
+ * @param application
+ * @throws JSchException
+ * @throws OpenShiftSSHOperationException
+ */
+ private void showEnvironmentProperties(final IApplication application) throws
JSchException,
+ OpenShiftSSHOperationException {
+ if(!application.hasSSHSession()) {
+ application.setSSHSession(OpenShiftSshSessionFactory.getInstance().createSession(application));
+ }
+ List<String> props = application.getEnvironmentProperties();
+ final MessageConsole console =
ConsoleUtils.findMessageConsole(getMessageConsoleName(application));
+ console.clearConsole();
+ MessageConsoleStream stream = console.newMessageStream();
+ for (String prop : props) {
+ stream.println(prop);
+ }
+ ConsoleUtils.displayConsoleView(console);
+ }
/**
* @return
Copied:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/TailServerLogAction.java
(from rev 41405,
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogAction.java)
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/TailServerLogAction.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/TailServerLogAction.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -0,0 +1,238 @@
+package org.jboss.tools.openshift.express.internal.ui.action;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jgit.transport.CredentialsProvider;
+import org.eclipse.jgit.transport.RemoteSession;
+import org.eclipse.jgit.transport.SshSessionFactory;
+import org.eclipse.jgit.transport.URIish;
+import org.eclipse.jgit.util.FS;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.IConsoleListener;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.views.IViewDescriptor;
+import org.eclipse.ui.views.IViewRegistry;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.ui.IServerModule;
+import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
+import org.jboss.tools.openshift.express.internal.ui.console.ConsoleUtils;
+import org.jboss.tools.openshift.express.internal.ui.console.JschToEclipseLogger;
+import org.jboss.tools.openshift.express.internal.ui.console.TailServerLogWorker;
+import
org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
+import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.openshift.client.IApplication;
+import com.openshift.client.OpenShiftException;
+import com.openshift.client.utils.Base64Coder;
+
+/**
+ * The action associated with the "Show In>Remote Console" menu item.
+ *
+ * @author Xavier Coulon
+ *
+ */
+public class TailServerLogAction extends AbstractAction implements IConsoleListener {
+
+ /**
+ * The message consoles associated with the 'tail' workers that write the
output.
+ */
+ private Map<String, TailServerLogWorker> consoleWorkers = new HashMap<String,
TailServerLogWorker>();
+
+ /**
+ * Constructor
+ */
+ public TailServerLogAction() {
+ super(OpenShiftExpressUIMessages.TAIL_SERVER_LOG_ACTION, true);
+ IViewRegistry reg = PlatformUI.getWorkbench().getViewRegistry();
+ IViewDescriptor desc = reg.find(IConsoleConstants.ID_CONSOLE_VIEW);
+ setImageDescriptor(desc.getImageDescriptor());
+ ConsoleUtils.registerConsoleListener(this);
+ }
+
+ /**
+ * Operation called when the user clicks on 'Show In>Remote Console'. If no
Console/Worker existed, a new one is
+ * created, otherwise, it is displayed. {@inheritDoc}
+ */
+ @Override
+ public void run() {
+ try {
+
+ if (selection instanceof IStructuredSelection) {
+ final Object selectedItem = ((IStructuredSelection) selection).getFirstElement();
+ if (selectedItem instanceof IServer) {
+ final IServer server = ((IServer) selectedItem);
+ run(server);
+ } else if (selectedItem instanceof IServerModule) {
+ final IServer server = ((IServerModule) selectedItem).getServer();
+ run(server);
+ } else if (selectedItem instanceof IApplication) {
+ final IApplication application = (IApplication) selectedItem;
+ run(application);
+ }
+ }
+ } catch (Exception e) {
+ Logger.error("Failed to open Remote Console", e);
+ }
+ }
+
+ private void run(final IApplication application) throws OpenShiftException,
MalformedURLException {
+ final String host = new URL(application.getApplicationUrl()).getHost();
+ final String appId = application.getUUID();
+ final String appName = application.getName();
+ final MessageConsole console = ConsoleUtils.findMessageConsole(createConsoleId(appName,
host));
+ ConsoleUtils.displayConsoleView(console);
+ console.newMessageStream().println("Loading....");
+ if (!this.consoleWorkers.containsKey(console.getName())) {
+ launchTailServerJob(host, appId, appName, console);
+ }
+ }
+
+ private static String createConsoleId(String appName, String host) {
+ return host;
+ }
+
+ private void run(final IServer server) {
+ if (ExpressServerUtils.isOpenShiftRuntime(server) ||
ExpressServerUtils.isInOpenshiftBehaviourMode(server)) {
+ final String host = server.getHost();
+ final String appId = ExpressServerUtils.getExpressApplicationId(server);
+ final String appName = ExpressServerUtils.getExpressApplicationName(server);
+ final MessageConsole console =
ConsoleUtils.findMessageConsole(createConsoleId(appName, host));
+ ConsoleUtils.displayConsoleView(console);
+ console.newMessageStream().println("Loading....");
+ if (!this.consoleWorkers.containsKey(console.getName())) {
+ launchTailServerJob(host, appId, appName, console);
+ }
+ }
+ }
+
+ private void launchTailServerJob(final String host, final String appId, final String
appName,
+ final MessageConsole console) {
+ new Job("Launching Tail Server Operation") {
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ final TailServerLogWorker tailServerLogWorker = startTailProcess(host, appId,
appName, console);
+ consoleWorkers.put(console.getName(), tailServerLogWorker);
+ Thread thread = new Thread(tailServerLogWorker);
+ thread.start();
+ } catch (Exception e) {
+ Logger.error("Failed to retrieve remote server logs", e);
+ console.newMessageStream().println("Failed to retrieve remote server logs:
" + e.getMessage());
+ console.newMessageStream().println("Please make sure your ssh key is added to
your ssh preferences");
+ }
+ return Status.OK_STATUS;
+ }
+
+ }.schedule();
+ }
+
+ /**
+ * Starting the tail process on the remote OpenShift Platform. This method relies on the
JGit SSH support (including
+ * JSch) to open a connection AND execute a command in a single invocation. The
connection establishement requires
+ * an SSH key, and the passphrase is prompted to the user if necessary.
+ *
+ * @param server
+ * the server adapter on which the action is performed
+ * @param console
+ * the console into which the tail should be writtent
+ * @return the Worker that encapsulate the established RemoteSession, the tail Process
and the output console
+ * @throws JSchException
+ * in case of underlying exception
+ * @throws IOException
+ * in case of underlying exception
+ */
+ private TailServerLogWorker startTailProcess(final String host, final String appId,
final String appName,
+ final MessageConsole console) throws JSchException, IOException {
+ final String logFilePath = appName + "/logs/*.log";
+ final String options = "-f -n 100";
+
+ JSch.setLogger(new JschToEclipseLogger());
+ final SshSessionFactory sshSessionFactory = SshSessionFactory.getInstance();
+ final URIish uri = new URIish().setHost(host).setUser(appId);
+ RemoteSession remoteSession = sshSessionFactory.getSession(uri,
CredentialsProvider.getDefault(), FS.DETECTED,
+ 0);
+
+ // the rhc-tail-files command template
+ // ssh_cmd =
+ // "ssh -t #{app_uuid}(a)#{app}-#{namespace}.#{rhc_domain}
'tail#{opt['opts'] ? ' --opts ' +
Base64::encode64(opt['opts']).chomp : ''} #{file_glob}'"
+ final String command = buildCommand(logFilePath, options);
+ Process process = remoteSession.exec(command, 0);
+ return new TailServerLogWorker(console, process, remoteSession);
+
+ }
+
+ /**
+ * Builds the 'ssh tail' command that should be executed on the remote OpenShift
platform.
+ *
+ * @param filePath
+ * @param options
+ * @return
+ * @throws UnsupportedEncodingException
+ */
+ private String buildCommand(final String filePath, final String options) throws
UnsupportedEncodingException {
+ StringBuilder commandBuilder = new StringBuilder("tail ");
+ if (options != null && !options.isEmpty()) {
+ final String opts = new String(Base64Coder.encode(options.getBytes()));
+ commandBuilder.append("--opts ").append(opts).append(" ");
+ }
+ commandBuilder.append(filePath);
+ final String command = commandBuilder.toString();
+ Logger.debug("ssh command to execute: " + command);
+ return command;
+ }
+
+ public Object getSelection() {
+ if (selection instanceof IStructuredSelection) {
+ final Object selectedItem = ((IStructuredSelection) selection).getFirstElement();
+ if (selectedItem instanceof IServer) {
+ return ((IServer) selectedItem);
+ }
+ if (selectedItem instanceof IServerModule) {
+ return ((IServerModule) selectedItem).getServer();
+ }
+ if (selectedItem instanceof IApplication) {
+
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void consolesAdded(IConsole[] consoles) {
+ // don't do anything special
+ }
+
+ /**
+ * Operation to perform when the console is removed (through the CloseConsoleAction that
was brung by the
+ * <code>TailConsolePageParticipant</code>). In the current case, the
associated worker is stopped and the
+ * console/worker are removed from the map, so that further 'Show In>Remote
Console' invocation will trigger a new
+ * worker process.
+ */
+ @Override
+ public void consolesRemoved(IConsole[] consoles) {
+ // if the console is associated with a 'tail' process, stop that process
+ for (IConsole console : consoles) {
+ final String consoleName = console.getName();
+ if (consoleWorkers.containsKey(consoleName)) {
+ final TailServerLogWorker worker = consoleWorkers.get(consoleName);
+ worker.stop();
+ consoleWorkers.remove(consoleName);
+ }
+ }
+
+ }
+
+}
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/TailServerLogAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleRemoveAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleRemoveAction.java 2012-05-25
13:42:22 UTC (rev 41419)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleRemoveAction.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -1,13 +0,0 @@
-package org.jboss.tools.openshift.express.internal.ui.console;
-
-import org.eclipse.jface.action.Action;
-
-public class ConsoleRemoveAction extends Action {
-
- ConsoleRemoveAction() {
- }
-
- @Override
- public void run() {
- }
-}
\ No newline at end of file
Deleted:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogAction.java 2012-05-25
13:42:22 UTC (rev 41419)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogAction.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -1,236 +0,0 @@
-package org.jboss.tools.openshift.express.internal.ui.console;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jgit.transport.CredentialsProvider;
-import org.eclipse.jgit.transport.RemoteSession;
-import org.eclipse.jgit.transport.SshSessionFactory;
-import org.eclipse.jgit.transport.URIish;
-import org.eclipse.jgit.util.FS;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsoleConstants;
-import org.eclipse.ui.console.IConsoleListener;
-import org.eclipse.ui.console.MessageConsole;
-import org.eclipse.ui.views.IViewDescriptor;
-import org.eclipse.ui.views.IViewRegistry;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.IServerModule;
-import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
-import org.jboss.tools.openshift.express.internal.ui.action.AbstractAction;
-import
org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
-import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
-
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.JSchException;
-import com.openshift.client.IApplication;
-import com.openshift.client.OpenShiftException;
-import com.openshift.client.utils.Base64Coder;
-
-/**
- * The action associated with the "Show In>Remote Console" menu item.
- *
- * @author Xavier Coulon
- *
- */
-public class TailServerLogAction extends AbstractAction implements IConsoleListener {
-
- /**
- * The message consoles associated with the 'tail' workers that write the
output.
- */
- private Map<String, TailServerLogWorker> consoleWorkers = new HashMap<String,
TailServerLogWorker>();
-
- /**
- * Constructor
- */
- public TailServerLogAction() {
- super(OpenShiftExpressUIMessages.TAIL_SERVER_LOG_ACTION, true);
- IViewRegistry reg = PlatformUI.getWorkbench().getViewRegistry();
- IViewDescriptor desc = reg.find(IConsoleConstants.ID_CONSOLE_VIEW);
- setImageDescriptor(desc.getImageDescriptor());
- ConsoleUtils.registerConsoleListener(this);
- }
-
- /**
- * Operation called when the user clicks on 'Show In>Remote Console'. If no
Console/Worker existed, a new one is
- * created, otherwise, it is displayed. {@inheritDoc}
- */
- @Override
- public void run() {
- try {
-
- if (selection instanceof IStructuredSelection) {
- final Object selectedItem = ((IStructuredSelection) selection).getFirstElement();
- if (selectedItem instanceof IServer) {
- final IServer server = ((IServer) selectedItem);
- run(server);
- } else if (selectedItem instanceof IServerModule) {
- final IServer server = ((IServerModule) selectedItem).getServer();
- run(server);
- } else if (selectedItem instanceof IApplication) {
- final IApplication application = (IApplication) selectedItem;
- run(application);
- }
- }
- } catch (Exception e) {
- Logger.error("Failed to open Remote Console", e);
- }
- }
-
- private void run(final IApplication application) throws OpenShiftException,
MalformedURLException {
- final String host = new URL(application.getApplicationUrl()).getHost();
- final String appId = application.getUUID();
- final String appName = application.getName();
- final MessageConsole console = ConsoleUtils.findMessageConsole(createConsoleId(appName,
host));
- ConsoleUtils.displayConsoleView(console);
- console.newMessageStream().println("Loading....");
- if (!this.consoleWorkers.containsKey(console.getName())) {
- launchTailServerJob(host, appId, appName, console);
- }
- }
-
- private static String createConsoleId(String appName, String host) {
- return host;
- }
-
- private void run(final IServer server) {
- if (ExpressServerUtils.isOpenShiftRuntime(server) ||
ExpressServerUtils.isInOpenshiftBehaviourMode(server)) {
- final String host = server.getHost();
- final String appId = ExpressServerUtils.getExpressApplicationId(server);
- final String appName = ExpressServerUtils.getExpressApplicationName(server);
- final MessageConsole console =
ConsoleUtils.findMessageConsole(createConsoleId(appName, host));
- ConsoleUtils.displayConsoleView(console);
- console.newMessageStream().println("Loading....");
- if (!this.consoleWorkers.containsKey(console.getName())) {
- launchTailServerJob(host, appId, appName, console);
- }
- }
- }
-
- private void launchTailServerJob(final String host, final String appId, final String
appName,
- final MessageConsole console) {
- new Job("Launching Tail Server Operation") {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- final TailServerLogWorker tailServerLogWorker = startTailProcess(host, appId,
appName, console);
- consoleWorkers.put(console.getName(), tailServerLogWorker);
- Thread thread = new Thread(tailServerLogWorker);
- thread.start();
- } catch (Exception e) {
- Logger.error("Failed to retrieve remote server logs", e);
- console.newMessageStream().println("Failed to retrieve remote server logs:
" + e.getMessage());
- console.newMessageStream().println("Please make sure your ssh key is added to
your ssh preferences");
- }
- return Status.OK_STATUS;
- }
-
- }.schedule();
- }
-
- /**
- * Starting the tail process on the remote OpenShift Platform. This method relies on the
JGit SSH support (including
- * JSch) to open a connection AND execute a command in a single invocation. The
connection establishement requires
- * an SSH key, and the passphrase is prompted to the user if necessary.
- *
- * @param server
- * the server adapter on which the action is performed
- * @param console
- * the console into which the tail should be writtent
- * @return the Worker that encapsulate the established RemoteSession, the tail Process
and the output console
- * @throws JSchException
- * in case of underlying exception
- * @throws IOException
- * in case of underlying exception
- */
- private TailServerLogWorker startTailProcess(final String host, final String appId,
final String appName,
- final MessageConsole console) throws JSchException, IOException {
- final String logFilePath = appName + "/logs/*.log";
- final String options = "-f -n 100";
-
- JSch.setLogger(new JschToEclipseLogger());
- final SshSessionFactory sshSessionFactory = SshSessionFactory.getInstance();
- final URIish uri = new URIish().setHost(host).setUser(appId);
- RemoteSession remoteSession = sshSessionFactory.getSession(uri,
CredentialsProvider.getDefault(), FS.DETECTED,
- 0);
-
- // the rhc-tail-files command template
- // ssh_cmd =
- // "ssh -t #{app_uuid}(a)#{app}-#{namespace}.#{rhc_domain}
'tail#{opt['opts'] ? ' --opts ' +
Base64::encode64(opt['opts']).chomp : ''} #{file_glob}'"
- final String command = buildCommand(logFilePath, options);
- Process process = remoteSession.exec(command, 0);
- return new TailServerLogWorker(console, process, remoteSession);
-
- }
-
- /**
- * Builds the 'ssh tail' command that should be executed on the remote OpenShift
platform.
- *
- * @param filePath
- * @param options
- * @return
- * @throws UnsupportedEncodingException
- */
- private String buildCommand(final String filePath, final String options) throws
UnsupportedEncodingException {
- StringBuilder commandBuilder = new StringBuilder("tail ");
- if (options != null && !options.isEmpty()) {
- final String opts = new String(Base64Coder.encode(options.getBytes()));
- commandBuilder.append("--opts ").append(opts).append(" ");
- }
- commandBuilder.append(filePath);
- final String command = commandBuilder.toString();
- Logger.debug("ssh command to execute: " + command);
- return command;
- }
-
- public Object getSelection() {
- if (selection instanceof IStructuredSelection) {
- final Object selectedItem = ((IStructuredSelection) selection).getFirstElement();
- if (selectedItem instanceof IServer) {
- return ((IServer) selectedItem);
- }
- if (selectedItem instanceof IServerModule) {
- return ((IServerModule) selectedItem).getServer();
- }
- if (selectedItem instanceof IApplication) {
-
- }
- }
- return null;
- }
-
- @Override
- public void consolesAdded(IConsole[] consoles) {
- // don't do anything special
- }
-
- /**
- * Operation to perform when the console is removed (through the CloseConsoleAction that
was brung by the
- * <code>TailConsolePageParticipant</code>). In the current case, the
associated worker is stopped and the
- * console/worker are removed from the map, so that further 'Show In>Remote
Console' invocation will trigger a new
- * worker process.
- */
- @Override
- public void consolesRemoved(IConsole[] consoles) {
- // if the console is associated with a 'tail' process, stop that process
- for (IConsole console : consoles) {
- final String consoleName = console.getName();
- if (consoleWorkers.containsKey(consoleName)) {
- final TailServerLogWorker worker = consoleWorkers.get(consoleName);
- worker.stop();
- consoleWorkers.remove(consoleName);
- }
- }
-
- }
-
-}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/AbstractServerViewerActionProvider.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/AbstractServerViewerActionProvider.java 2012-05-25
13:42:22 UTC (rev 41419)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/AbstractServerViewerActionProvider.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.serverviewer.actionDelegate;
+import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -18,14 +19,18 @@
import org.eclipse.ui.navigator.ICommonViewerSite;
import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.ui.internal.cnf.ServerActionProvider;
import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
import org.jboss.tools.openshift.express.internal.ui.action.AbstractAction;
/**
* @author Xavier Coulon
*/
+@SuppressWarnings("restriction")
public abstract class AbstractServerViewerActionProvider extends CommonActionProvider {
+ private static final String OPENSHIFT_SERVER_ADAPTER_MENU =
"org.jboss.tools.openshift.express.serverviewer.menu";
+
protected final AbstractAction action;
protected ICommonActionExtensionSite actionExtensionSite;
@@ -52,16 +57,32 @@
IServer server = (IServer) sel;
if (ExpressServerUtils.isOpenShiftRuntime(server) ||
ExpressServerUtils.isInOpenshiftBehaviourMode(server)) {
action.validate();
- if (action != null/* && action.isEnabled() */) {
- MenuManager openshiftMenu = new MenuManager("Openshift...",
- "org.jboss.tools.openshift.express.serverviewer.menu");
+ if (action != null) {
+ MenuManager openshiftMenu = getOpenShiftMenuManager(menu);
openshiftMenu.add(action);
- menu.add(openshiftMenu);
}
}
}
}
+ /**
+ * @param menu
+ * @return
+ */
+ private MenuManager getOpenShiftMenuManager(IMenuManager menu) {
+ for(IContributionItem item : menu.getItems()) {
+ // make this call in this way, since item id can be null
+ if(OPENSHIFT_SERVER_ADAPTER_MENU.equals(item.getId())) {
+ return (MenuManager) item;
+ }
+ }
+ MenuManager openshiftMenu = new MenuManager("Openshift...",
+ OPENSHIFT_SERVER_ADAPTER_MENU);
+ menu.add(openshiftMenu);
+ menu.insertBefore(ServerActionProvider.TOP_SECTION_END_SEPARATOR, openshiftMenu);
+ return openshiftMenu;
+ }
+
protected Object getSelection() {
ICommonViewerSite site = actionExtensionSite.getViewSite();
IStructuredSelection selection = null;
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/ApplicationPortForwardingActionProvider.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/ApplicationPortForwardingActionProvider.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/ApplicationPortForwardingActionProvider.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -0,0 +1,10 @@
+package org.jboss.tools.openshift.express.internal.ui.serverviewer.actionDelegate;
+
+import
org.jboss.tools.openshift.express.internal.core.portforward.ApplicationPortForwardingAction;
+
+public class ApplicationPortForwardingActionProvider extends
AbstractServerViewerActionProvider {
+
+ public ApplicationPortForwardingActionProvider() {
+ super(new ApplicationPortForwardingAction());
+ }
+}
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/ApplicationPortForwardingActionProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/ShowEnvironmentActionProvider.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/ShowEnvironmentActionProvider.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/ShowEnvironmentActionProvider.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.serverviewer.actionDelegate;
+
+import org.jboss.tools.openshift.express.internal.ui.action.ShowEnvironmentAction;
+
+/**
+ * @author Xavier Coulon
+ */
+public class ShowEnvironmentActionProvider extends AbstractServerViewerActionProvider {
+
+ public ShowEnvironmentActionProvider() {
+ super(new ShowEnvironmentAction());
+ }
+
+}
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/ShowEnvironmentActionProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/TailServerLogActionProvider.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/TailServerLogActionProvider.java 2012-05-25
13:42:22 UTC (rev 41419)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/serverviewer/actionDelegate/TailServerLogActionProvider.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -1,6 +1,6 @@
package org.jboss.tools.openshift.express.internal.ui.serverviewer.actionDelegate;
-import org.jboss.tools.openshift.express.internal.ui.console.TailServerLogAction;
+import org.jboss.tools.openshift.express.internal.ui.action.TailServerLogAction;
public class TailServerLogActionProvider extends AbstractServerViewerActionProvider {
Copied:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/ApplicationPortForwardingActionProvider.java
(from rev 41405,
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingActionProvider.java)
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/ApplicationPortForwardingActionProvider.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/ApplicationPortForwardingActionProvider.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -0,0 +1,10 @@
+package org.jboss.tools.openshift.express.internal.ui.viewer.actionProvider;
+
+import
org.jboss.tools.openshift.express.internal.core.portforward.ApplicationPortForwardingAction;
+
+public class ApplicationPortForwardingActionProvider extends
AbstractOpenShiftExplorerViewerActionProvider {
+
+ public ApplicationPortForwardingActionProvider() {
+ super(new ApplicationPortForwardingAction(), "group.showIn");
+ }
+}
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/ApplicationPortForwardingActionProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/TailServerLogActionProvider.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/TailServerLogActionProvider.java 2012-05-25
13:42:22 UTC (rev 41419)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/TailServerLogActionProvider.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.viewer.actionProvider;
-import org.jboss.tools.openshift.express.internal.ui.console.TailServerLogAction;
+import org.jboss.tools.openshift.express.internal.ui.action.TailServerLogAction;
/**
* @author Xavier Coulon
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-05-25
13:42:22 UTC (rev 41419)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-05-25
13:54:21 UTC (rev 41420)
@@ -75,7 +75,7 @@
setNeedsProgressMonitor(true);
this.wizardModel = new OpenShiftExpressApplicationWizardModel(user, project,
application,
useExistingApplication);
- this.skipCredentialsPage = (user != null);
+ this.skipCredentialsPage = (user != null && user.isConnected());
}
OpenShiftExpressApplicationWizardModel getWizardModel() {