[224779] Tasks scrollbar
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerPreferencePage.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerPreferencePage.java
index 6aac639..dc23338 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerPreferencePage.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 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
@@ -72,7 +72,6 @@
showOnActivity.setSelection(uiPreferences.getShowOnActivity());
whs.setHelp(showOnActivity, ContextIds.PREF_GENERAL_SHOW_ON_ACTIVITY);
-
Dialog.applyDialogFont(composite);
return composite;
@@ -93,7 +92,6 @@
protected void performDefaults() {
showOnActivity.setSelection(uiPreferences.getDefaultShowOnActivity());
-
super.performDefaults();
}
@@ -103,7 +101,6 @@
public boolean performOk() {
uiPreferences.setShowOnActivity(showOnActivity.getSelection());
-
return true;
}
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPlugin.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPlugin.java
index f254a13..3a00449 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPlugin.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPlugin.java
@@ -440,7 +440,7 @@
return true;
return ServerUIPlugin.getInstance().getWorkbench().saveAllEditors(b == ServerUIPreferences.SAVE_EDITORS_PROMPT);
}
-
+
/**
* Prompts the user if the server is dirty. Returns true if the server was
* not dirty or if the user decided to continue anyway. Returns false if
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/TasksWizardFragment.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/TasksWizardFragment.java
index c5f4230..996ebd4 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/TasksWizardFragment.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/TasksWizardFragment.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 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
@@ -28,6 +28,8 @@
*
*/
public class TasksWizardFragment extends WizardFragment {
+ private static final int TASKS_PER_PAGE = 5;
+
public class TaskInfo implements IOrdered {
public int kind;
public String id;
@@ -117,7 +119,6 @@
if (tasks == null || tasks.isEmpty())
return;
- int TASKS_PER_PAGE = 5;
int size = tasks.size();
int pages = (size - 1) / TASKS_PER_PAGE + 1;
for (int i = 0; i < pages; i++) {
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksComposite.java
index 32f065a..ef81b4f 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksComposite.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 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
@@ -22,8 +22,10 @@
import org.eclipse.wst.server.ui.internal.wizard.fragment.TasksWizardFragment;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -32,14 +34,12 @@
/**
* A wizard page used to select server and module tasks.
*/
-public class TasksComposite extends Composite {
+public class TasksComposite extends ScrolledComposite {
protected IWizardHandle wizard;
-
- protected Composite comp;
// the list of elements to select from
protected List tasks;
-
+
protected boolean created;
/**
@@ -49,9 +49,9 @@
* @param wizard a wizard handle
*/
public TasksComposite(Composite parent, IWizardHandle wizard) {
- super(parent, SWT.NONE);
+ super(parent, SWT.H_SCROLL | SWT.V_SCROLL);
this.wizard = wizard;
-
+
wizard.setTitle(Messages.wizTaskTitle);
wizard.setDescription(Messages.wizTaskDescription);
wizard.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_WIZBAN_SELECT_SERVER));
@@ -70,8 +70,6 @@
}
}
- //createControl();
- //layout(true);
created = false;
}
@@ -81,8 +79,14 @@
public void createControl() {
if (created)
return;
+
+ setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Composite comp = new Composite(this, SWT.NONE);
+ setContent(comp);
TasksLayout layout = new TasksLayout(SWTUtil.convertVerticalDLUsToPixels(this, 4));
- setLayout(layout);
+ comp.setLayout(layout);
+ comp.setLayoutData(new GridData(GridData.FILL_BOTH));
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ContextIds.SELECT_TASK_WIZARD);
int size = 0;
@@ -92,7 +96,7 @@
for (int i = 0; i < size; i++) {
Object obj = tasks.get(i);
final TasksWizardFragment.TaskInfo sti = (TasksWizardFragment.TaskInfo) obj;
- final Button checkbox = new Button(this, SWT.CHECK | SWT.WRAP);
+ final Button checkbox = new Button(comp, SWT.CHECK | SWT.WRAP);
String label = sti.task2.getLabel();
if (label != null)
checkbox.setText(label);
@@ -108,7 +112,7 @@
}
});
- Label description = new Label(this, SWT.WRAP);
+ Label description = new Label(comp, SWT.WRAP);
String desc = sti.task2.getDescription();
if (desc != null)
description.setText(desc);
@@ -127,7 +131,13 @@
Trace.trace(Trace.SEVERE, "Task composite appeared with no tasks!");
Dialog.applyDialogFont(this);
+
+ setExpandHorizontal(true);
+ setExpandVertical(true);
+
+ setMinSize(comp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
layout(true, true);
+
created = true;
}
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksLayout.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksLayout.java
index 6519163..bd4d45c 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksLayout.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksLayout.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 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
@@ -30,7 +30,23 @@
* @see org.eclipse.swt.widgets.Layout#computeSize(org.eclipse.swt.widgets.Composite, int, int, boolean)
*/
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
- return new Point(wHint, hHint);
+ //return new Point(wHint, hHint);
+ Control[] children = composite.getChildren();
+
+ int y = 5;
+ if (children != null) {
+ int size = children.length;
+ for (int i = 0; i < size; i++) {
+ if (i % 2 == 0) {
+ int h = children[i].computeSize(wHint, SWT.DEFAULT).y;
+ y += h + verticalSpacing / 2;
+ } else {
+ int h = Math.max(45, children[i].computeSize(wHint, SWT.DEFAULT).y);
+ y += h + verticalSpacing;
+ }
+ }
+ }
+ return new Point(200, y); // + verticalSpacing);
}
/* (non-Javadoc)
@@ -47,10 +63,10 @@
if (i % 2 == 0) {
int h = children[i].computeSize(r.width - 10, SWT.DEFAULT).y;
children[i].setBounds(r.x + 5, y, r.width - 10, h);
- y += h + verticalSpacing;
+ y += h + verticalSpacing / 2;
} else {
- int h = Math.max(50, children[i].computeSize(r.width - 30, SWT.DEFAULT).y);
- children[i].setBounds(r.x + 25, y, r.width - 30, h);
+ int h = Math.max(45, children[i].computeSize(r.width - 25, SWT.DEFAULT).y);
+ children[i].setBounds(r.x + 20, y, r.width - 25, h);
y += h + verticalSpacing;
}
}