Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/PublishUtil.java16
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java3
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java46
3 files changed, 22 insertions, 43 deletions
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/PublishUtil.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/PublishUtil.java
index 3edc04f2b..f12e497de 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/PublishUtil.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/PublishUtil.java
@@ -278,7 +278,23 @@ public class PublishUtil {
}
}
+ /**
+ * Creates a new zip file containing the given module resources. Deletes the existing file
+ * (and doesn't create a new one) if resources is null or empty.
+ *
+ * @param resources
+ * @param zipPath
+ * @throws CoreException
+ */
public static void createZipFile(IModuleResource[] resources, IPath zipPath) throws CoreException {
+ if (resources == null || resources.length == 0) {
+ // should also check if resources consists of all empty directories
+ File file = zipPath.toFile();
+ if (file.exists())
+ file.delete();
+ return;
+ }
+
try {
BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(zipPath.toFile()));
ZipOutputStream zout = new ZipOutputStream(bout);
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java
index cf5bf9c8f..3bcb80790 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java
@@ -425,7 +425,8 @@ public class RunOnServerActionDelegate implements IWorkbenchWindowActionDelegate
IStructuredSelection select = (IStructuredSelection) sel;
Iterator iterator = select.iterator();
- selection = iterator.next();
+ if (iterator.hasNext())
+ selection = iterator.next();
if (iterator.hasNext()) { // more than one selection (should never happen)
action.setEnabled(false);
selection = null;
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java
index bf441c95c..9e2df33df 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java
@@ -288,7 +288,8 @@ public class ModifyModulesComposite extends Composite {
IModule module = (IModule) iterator.next();
try {
IModule[] children = server.getChildModules(new IModule[] { module }, null);
- childModuleMap.put(new ChildModuleMapKey(module), children);
+ if (children != null && children.length > 0)
+ childModuleMap.put(new ChildModuleMapKey(module), children);
} catch (Exception e) {
// ignore
}
@@ -299,7 +300,8 @@ public class ModifyModulesComposite extends Composite {
IModule module = (IModule) iterator.next();
try {
IModule[] children = server.getChildModules(new IModule[] { module }, null);
- childModuleMap.put(new ChildModuleMapKey(module), children);
+ if (children != null && children.length > 0)
+ childModuleMap.put(new ChildModuleMapKey(module), children);
} catch (Exception e) {
// ignore
}
@@ -515,46 +517,6 @@ public class ModifyModulesComposite extends Composite {
removeAll.setEnabled(deployed.size() > 1);
}
- /*protected void addChildren(TreeItem item, IModule[] module) {
- try {
- IModule[] children = (IModule[]) childModuleMap.get(new ChildModuleMapKey(module));
- if (children != null) {
- int size = children.length;
- for (int i = 0; i < size; i++) {
- IModule child = children[i];
- TreeItem childItem = new TreeItem(item, SWT.NONE);
- childItem.setText(slp.getText(child));
- childItem.setImage(slp.getImage(child));
- childItem.setData(child);
- parentTreeItemMap.put(childItem, item);
-
- int size2 = module.length;
- IModule[] module2 = new IModule[size2 + 1];
- System.arraycopy(module, 0, module2, 0, size2);
- module2[size2] = child;
- addChildren(childItem, module2);
- }
- }
- } catch (Exception e) {
- // ignore
- }
- }*/
-
- /*protected void fillTree(Tree tree, List modules2) {
- tree.removeAll();
-
- Iterator iterator = modules2.iterator();
- while (iterator.hasNext()) {
- IModule module = (IModule) iterator.next();
- TreeItem item = new TreeItem(tree, SWT.NONE);
- item.setText(slp.getText(module));
- item.setImage(slp.getImage(module));
- item.setData(module);
- parentTreeItemMap.put(item, item);
- addChildren(item, new IModule[] { module });
- }
- }*/
-
protected void add(boolean all) {
if (all) {
IModule[] modules2 = new IModule[modules.size()];

Back to the top