blob: df2fbc25eff2de8a0402da09afef1c76bd280579 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2003, 2005 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.wst.server.ui.internal.view.servers;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.ui.internal.Messages;
import org.eclipse.wst.server.ui.internal.viewers.MonitorComposite;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
/**
* Dialog that prompts a user to monitor ports from a given server.
*/
public class MonitorServerDialog extends Dialog {
protected IServer server;
protected MonitorComposite monitorComp;
/**
* MonitorServerDialog constructor comment.
* @param parentShell the parent shell
* @param server the server
*/
public MonitorServerDialog(Shell parentShell, IServer server) {
super(parentShell);
this.server = server;
setBlockOnOpen(true);
}
/**
*
*/
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(Messages.dialogMonitorTitle);
}
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}
/**
*
*/
protected Control createDialogArea(Composite parent) {
// create a composite with standard margins and spacing
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
GridData data = new GridData(GridData.FILL_BOTH);
data.widthHint = 550;
composite.setLayoutData(data);
composite.setFont(parent.getFont());
//WorkbenchHelp.setHelp(composite, ContextIds.TERMINATE_SERVER_DIALOG);
Label label = new Label(composite, SWT.WRAP);
label.setText(NLS.bind(Messages.dialogMonitorDescription, new String[] { server.getName() } ));
data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
label.setLayoutData(data);
monitorComp = new MonitorComposite(composite, SWT.NONE, null, server);
monitorComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
Dialog.applyDialogFont(composite);
return composite;
}
}