Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of ssh://shung@git.eclipse.org/gitroot/serverto…

…ols/webtools.servertools.git
  • Loading branch information...
commit 17eaea911c70edee4b2286ea6f41bd3993f910ed 2 parents 35c1404 + b24cd6d
@sghung sghung authored
Showing with 161 additions and 27 deletions.
  1. +7 −5 ...lipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/publishers/AntPublisher.java
  2. +1 −1  plugins/org.eclipse.wst.server.core/META-INF/MANIFEST.MF
  3. +45 −0 plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModule2.java
  4. +17 −1 plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerUtil.java
  5. +32 −3 plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Module.java
  6. +21 −1 plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleFactoryDelegate.java
  7. +2 −3 plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerLabelProvider.java
  8. +2 −2 plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerToolTip.java
  9. +13 −2 ...t.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerLaunchConfigurationDelegate.java
  10. +2 −4 plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/cnf/ServerLabelProvider.java
  11. +15 −2 plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModuleServer.java
  12. +2 −1  ...s/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ShowInDebugAction.java
  13. +2 −2 ...g.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java
View
12 ...se.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/publishers/AntPublisher.java
@@ -1,5 +1,5 @@
/***************************************************************************************************
- * Copyright (c) 2005, 2009 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
+ * Copyright (c) 2005, 2013 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
* accompanying materials are 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
@@ -20,6 +20,7 @@
import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+
import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -52,6 +53,7 @@
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IModuleArtifact;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
import org.osgi.framework.Bundle;
@@ -319,16 +321,16 @@ private IPath getProjectWorkingLocation() {
}
private String guessModuleName(IModule module) {
- String moduleName = module.getName();
+ String deployName = ServerUtil.getModuleDisplayName(module);
if ("jst.web".equals(getModuleTypeId())) { //$NON-NLS-1$
IWebModule webModule = (IWebModule) getModule()[0].loadAdapter(IWebModule.class, null);
if (webModule == null) {
- return module.getName();
+ return deployName;
}
String contextRoot = webModule.getURI(module);
- moduleName = contextRoot.substring(0, contextRoot.lastIndexOf('.'));
+ deployName = contextRoot.substring(0, contextRoot.lastIndexOf('.'));
}
- return moduleName;
+ return deployName;
}
private String guessContextRoot(IModule module) {
View
2  plugins/org.eclipse.wst.server.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.server.core; singleton:=true
-Bundle-Version: 1.4.100.qualifier
+Bundle-Version: 1.5.0.qualifier
Bundle-Activator: org.eclipse.wst.server.core.internal.ServerPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
View
45 plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModule2.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Red Hat Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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.eclipse.wst.server.core;
+
+/**
+ * A module that provides additional properties.
+ * Variable constants that starts with "PROP_" are reserved for further purpose. Classes
+ * that implements this class should not use variables with this naming convention.
+ *
+ * @see org.eclipse.wst.server.core.IModule
+ * @since 1.5
+ */
+public interface IModule2 extends IModule {
+
+ /**
+ * A property key to store a value for the module name to
+ * be displayed in servertools UI workflows
+ */
+ public static final String PROP_DISPLAY_NAME = "org.eclipse.wst.server.core.displayName";
+
+ /**
+ * A property key to store a value for the preferred name of the module
+ * to be used by publishers when deploying.
+ */
+ public static final String PROP_DEPLOY_NAME = "org.eclipse.wst.server.core.deployName";
+
+ /**
+ * Access a property of the module.
+ *
+ * @param key
+ * @see #PROP_DISPLAY_NAME
+ * @see #PROP_DEPLOY_NAME
+ * @return value of the property with the given key,
+ * or <code>null</code> if the value is not available on this module.
+ */
+ public String getProperty(String key);
+}
View
18 plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerUtil.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -137,6 +137,21 @@ public static IModule getModule(String moduleId) {
}
/**
+ * Get the display name of a given module
+ * @return the display name
+ * @since 1.5
+ */
+ public static String getModuleDisplayName(IModule curModule) {
+ if (curModule instanceof IModule2) {
+ String displayProp = ((IModule2)curModule).getProperty(IModule2.PROP_DISPLAY_NAME);
+ if (displayProp != null) {
+ return displayProp;
+ }
+ }
+ return curModule.getName();
+ }
+
+ /**
* Return all the available modules from all factories whose
* type matches the given module types.
* <p>
@@ -796,4 +811,5 @@ public static int getMonitoredPort(IServer server, int port, String contentType)
public static ISchedulingRule getServerSchedulingRule(IServer server) {
return server;
}
+
}
View
35 plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Module.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,16 +10,20 @@
*******************************************************************************/
package org.eclipse.wst.server.core.internal;
+import java.util.Map;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.server.core.*;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IModuleType;
+import org.eclipse.wst.server.core.IModule2;
import org.eclipse.wst.server.core.model.ModuleDelegate;
/**
*
*/
-public class Module implements IModule {
+public class Module implements IModule2 {
protected String id;
protected String name;
protected ModuleFactory factory;
@@ -28,6 +32,8 @@
protected ModuleDelegate delegate;
protected String id2;
+ protected Map<String, String> properties;
+
/**
* Module constructor.
*
@@ -39,6 +45,20 @@
* @param project
*/
public Module(ModuleFactory factory, String id, String name, String type, String version, IProject project) {
+ this(factory, id, name, type, version, project, null);
+ }
+
+ /**
+ * Module constructor with properties
+ *
+ * @param factory
+ * @param id
+ * @param name
+ * @param type
+ * @param version
+ * @param project
+ */
+ public Module(ModuleFactory factory, String id, String name, String type, String version, IProject project, Map<String, String> properties) {
super();
this.factory = factory;
this.project = project;
@@ -50,6 +70,7 @@ public Module(ModuleFactory factory, String id, String name, String type, String
else
id2 = ":";
id2 += id;
+ this.properties = properties;
}
/**
@@ -268,4 +289,12 @@ public boolean exists() {
public String toString() {
return "Module[" + name + "," + id2 + "]";
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.server.core.IModule2#getProperty(java.lang.String)
+ */
+ public String getProperty(String key) {
+ return properties == null || key == null ? null : properties.get(key);
+ }
}
View
22 plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleFactoryDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -123,6 +124,25 @@ protected final IModule createModule(String id, String name, String type, String
}
/**
+ * Creates a module instance with the given static information,
+ * including a map of properties.
+ *
+ * This method is used by module factory delegates to create module instances.
+ *
+ * @param id the module id
+ * @param name the module name
+ * @param type the module type id
+ * @param version the module version id
+ * @param project the project that the module is contained in
+ * @param properties a map of key/value pairs for additional information
+ * @return a module instance
+ * @since 1.4
+ */
+ protected final IModule createModule(String id, String name, String type, String version, IProject project, Map<String, String> properties) {
+ return new Module(factory, id, name, type, version, project, properties);
+ }
+
+ /**
* Creates the module delegate for a module with the given information.
* This method is called when a client needs to access the module delegate
* associated with the given module.
View
5 plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -251,8 +251,7 @@ public String getText(Object element) {
return decorate(module.getName(), modules);
} else if (element instanceof ModuleServer) {
ModuleServer ms = (ModuleServer) element;
- IModule module = ms.module[ms.module.length - 1];
- return decorate(module.getName(), ms);
+ return decorate(ms.getModuleDisplayName(), ms);
} else if (element instanceof IWorkbenchAdapter) {
return ((IWorkbenchAdapter) element).getLabel(null);
}
View
4 plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerToolTip.java
@@ -190,7 +190,7 @@ protected Composite createToolTipContentArea(Event event, Composite parent) {
if (module != null) {
IModule[] modules = module.getModule();
IModule m = modules[modules.length - 1];
- sText.setText("<b>" + m.getName() + "</b>");
+ sText.setText("<b>" + ServerUtil.getModuleDisplayName(m) + "</b>");
//sText.setText("<b>" + m.getName() + "</b></p>" + m.getModuleType().getName());
StyledText sText2 = new StyledText(parent, SWT.NONE);
@@ -329,4 +329,4 @@ private void loadExtensions() {
// // Auto-generated method stub
// }
// }
-}
+}
View
15 ...erver.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerLaunchConfigurationDelegate.java
@@ -140,8 +140,19 @@ public boolean supports(IServer server3, Object launchable2, String launchMode3)
IModule[] modules = new IModule[] { module }; // TODO: get parent hierarchy correct
int state = server.getServerState();
if (state == IServer.STATE_STARTING) {
- LaunchClientJob clientJob = new LaunchClientJob(server, modules, launchMode, moduleArtifact, launchableAdapter, client);
- clientJob.schedule();
+ final LaunchClientJob clientJob = new LaunchClientJob(server, modules, launchMode, moduleArtifact, launchableAdapter, client);
+ final IServer server2 = server;
+ if (server2.shouldPublish()) {
+ server2.publish(IServer.PUBLISH_INCREMENTAL, null, info, new IServer.IOperationListener() {
+ public void done(IStatus result) {
+ if (result.isOK()){
+ clientJob.schedule();
+ }
+ }
+ });
+ } else {
+ clientJob.schedule();
+ }
} else if (state == IServer.STATE_STARTED) {
boolean restart = false;
String mode = server.getMode();
View
6 plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/cnf/ServerLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008,2010 IBM Corporation and others.
+ * Copyright (c) 2008,2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -44,9 +44,7 @@ public String getText(Object element) {
ModuleServer ms = (ModuleServer) element;
if (ms.module == null)
return "";
- int size = ms.module.length;
- String name = ms.module[size - 1].getName();
- return name;
+ return ms.getModuleDisplayName();
}
if( element instanceof IServer ) {
View
17 ...ins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModuleServer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.ui.IServerModule;
/**
* A utility class for referencing a server and a module at the same time.
@@ -57,7 +58,19 @@ public IServer getServer() {
public IModule[] getModule() {
return module;
}
-
+
+ /**
+ * Get the display name of the module of this module server.
+ * @return the display name
+ */
+ public String getModuleDisplayName() {
+ int size = module.length;
+ if (size == 0) {
+ return null;
+ }
+ return ServerUtil.getModuleDisplayName(module[size - 1]);
+ }
+
/**
* @see Object#equals(Object)
*/
View
3  ...rg.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ShowInDebugAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -77,6 +77,7 @@ protected void selectProcess(IProcess process) {
if (part != null) {
IDebugView view = (IDebugView)part.getAdapter(IDebugView.class);
if (view != null) {
+ page.activate(part);
view.setFocus();
Viewer viewer = view.getViewer();
if (viewer != null) {
View
4 ...clipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -510,7 +510,7 @@ public int compare(Viewer viewer, Object e1, Object e2) {
if (e1 instanceof ModuleServer && e2 instanceof ModuleServer) {
ModuleServer s1 = (ModuleServer) e1;
ModuleServer s2 = (ModuleServer) e2;
- return (s1.module[s1.module.length - 1].getName().compareToIgnoreCase(s2.module[s2.module.length - 1].getName()));
+ return (s1.getModuleDisplayName().compareToIgnoreCase(s2.getModuleDisplayName()));
}
return super.compare(viewer, e1, e2);
Please sign in to comment.
Something went wrong with that request. Please try again.