[prev in list] [next in list] [prev in thread] [next in thread]
List: jboss-cvs-commits
Subject: [jboss-cvs] contrib/jbosside/org.jboss.ide.eclipse.deployer.ui/src/org/jboss/ide/eclipse/deployer/ui
From: Laurent Etiemble <letiemble () users ! sourceforge ! net>
Date: 2003-07-31 21:47:46
[Download RAW message or body]
User: letiemble
Date: 03/07/31 14:47:46
Added: jbosside/org.jboss.ide.eclipse.deployer.ui/src/org/jboss/ide/eclipse/deployer/ui/dialogs
FileSystemCopyEditDialog.java
LocalMainDeployerEditDialog.java
TargetChoiceDialog.java TargetEditDialog.java
Log:
First iteration for the Deployer Plugin
I18N to be done
Javadoc to be completed
Need for more tests
Revision Changes Path
1.1 \
contrib/jbosside/org.jboss.ide.eclipse.deployer.ui/src/org/jboss/ide/eclipse/deployer/ui/dialogs/FileSystemCopyEditDialog.java
Index: FileSystemCopyEditDialog.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at www.gnu.org.
*/
package org.jboss.ide.eclipse.deployer.ui.dialogs;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.jboss.ide.eclipse.deployer.core.target.FileSystemCopy;
import org.jboss.ide.eclipse.deployer.core.target.ITarget;
import org.jboss.ide.eclipse.deployer.ui.DeployerUIPlugin;
/**
* @author Laurent Etiemble
* @created 18 mars 2003
* @version $Revision: 1.1 $
*/
public class FileSystemCopyEditDialog extends TargetEditDialog
{
private Button browseButton;
private Text nameText;
private Text pathText;
private FileSystemCopy target;
private FileSystemCopy tempTarget;
/**
*Constructor for the AttributeEditDialog object
*
* @param parentShell Description of the Parameter
* @param target Description of the Parameter
*/
public FileSystemCopyEditDialog(Shell parentShell, ITarget target)
{
super(parentShell);
this.setStatusLineAboveButtons(true);
this.target = (FileSystemCopy) target;
this.tempTarget = (FileSystemCopy) this.target.clone();
}
/** Description of the Method */
protected void assign()
{
this.nameText.addModifyListener(
new ModifyListener()
{
public void modifyText(ModifyEvent e)
{
tempTarget.setName(((Text) e.widget).getText());
validate();
}
});
this.browseButton.addSelectionListener(
new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
addSelectExternal();
refresh();
validate();
}
});
}
/**
* Description of the Method
*
* @param shell Description of the Parameter
*/
protected void configureShell(Shell shell)
{
this.setTitle("FileSystem Target Properties");
super.configureShell(shell);
}
/**
* Description of the Method
*
* @param parent Description of the Parameter
* @return Description of the Return Value
* @see \
org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent)
{
GridData layoutData;
Composite global = (Composite) super.createDialogArea(parent);
GridLayout gridLayout = new GridLayout(3, false);
global.setLayout(gridLayout);
Label descLabel = new Label(global, SWT.NONE);
descLabel.setText("description");//$NON-NLS-1$
layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.horizontalSpan = 3;
descLabel.setLayoutData(layoutData);
Label fileLabel = new Label(global, SWT.NONE);
fileLabel.setText("Name :");//$NON-NLS-1$
layoutData = new GridData();
layoutData.horizontalAlignment = SWT.END;
fileLabel.setLayoutData(layoutData);
this.nameText = new Text(global, SWT.BORDER);
layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.horizontalSpan = 2;
layoutData.grabExcessHorizontalSpace = true;
this.nameText.setLayoutData(layoutData);
Label pathLabel = new Label(global, SWT.NONE);
pathLabel.setText("Path :");//$NON-NLS-1$
layoutData = new GridData();
layoutData.horizontalAlignment = SWT.END;
pathLabel.setLayoutData(layoutData);
this.pathText = new Text(global, SWT.BORDER);
this.pathText.setEditable(false);
layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.grabExcessHorizontalSpace = true;
this.pathText.setLayoutData(layoutData);
this.browseButton = new Button(global, SWT.PUSH);
this.browseButton.setText("Browse...");//$NON-NLS-1$
layoutData = new GridData(GridData.FILL_HORIZONTAL);
this.browseButton.setLayoutData(layoutData);
this.assign();
this.refresh();
return parent;
}
/** Description of the Method */
protected void okPressed()
{
// Copy modified content
this.target.setName(this.tempTarget.getName());
this.target.setURL(this.tempTarget.getURL());
super.okPressed();
}
/** Description of the Method */
protected void validate()
{
IStatus status = null;
if (this.tempTarget.getURL() != null)
{
status = new Status(IStatus.OK, DeployerUIPlugin.getUniqueIdentifier(), 0, \
"", null); }
else
{
status = new Status(IStatus.ERROR, DeployerUIPlugin.getUniqueIdentifier(), \
0, "The path is not valid", null); }
this.updateStatus(status);
}
/** Adds a feature to the SelectLocalFile attribute of the FileEditDialog object \
*/ private void addSelectExternal()
{
DirectoryDialog dialog = new DirectoryDialog(DeployerUIPlugin.getShell(), \
SWT.OPEN); String result = dialog.open();
if (result != null)
{
try
{
File path = new File(result);
URL url = path.toURL();
this.tempTarget.setURL(url);
this.refresh();
}
catch (MalformedURLException mfue)
{
DeployerUIPlugin.logError("Error while converting path to URL (" + \
result + ")", mfue); }
}
}
/** Description of the Method */
private void refresh()
{
this.nameText.setText(this.tempTarget.getName());
if (this.tempTarget.getURL() != null)
{
this.pathText.setText(this.tempTarget.getURL().toString());
}
}
}
1.1 \
contrib/jbosside/org.jboss.ide.eclipse.deployer.ui/src/org/jboss/ide/eclipse/deployer/ui/dialogs/LocalMainDeployerEditDialog.java
Index: LocalMainDeployerEditDialog.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at www.gnu.org.
*/
package org.jboss.ide.eclipse.deployer.ui.dialogs;
import java.io.IOException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.jboss.ide.eclipse.deployer.core.target.ITarget;
import org.jboss.ide.eclipse.deployer.core.target.LocalMainDeployer;
import org.jboss.ide.eclipse.deployer.ui.DeployerUIPlugin;
/**
* @author Laurent Etiemble
* @created 18 mars 2003
* @version $Revision: 1.1 $
*/
public class LocalMainDeployerEditDialog extends TargetEditDialog
{
private Text hostText;
private Text nameText;
private Button pingButton;
private Text portText;
private LocalMainDeployer target;
private LocalMainDeployer tempTarget;
/**
*Constructor for the AttributeEditDialog object
*
* @param parentShell Description of the Parameter
* @param target Description of the Parameter
*/
public LocalMainDeployerEditDialog(Shell parentShell, ITarget target)
{
super(parentShell);
this.setStatusLineAboveButtons(true);
this.target = (LocalMainDeployer) target;
this.tempTarget = (LocalMainDeployer) this.target.clone();
}
/** Description of the Method */
protected void assign()
{
this.nameText.addModifyListener(
new ModifyListener()
{
public void modifyText(ModifyEvent e)
{
tempTarget.setName(((Text) e.widget).getText());
}
});
this.hostText.addModifyListener(
new ModifyListener()
{
public void modifyText(ModifyEvent e)
{
tempTarget.setHost(((Text) e.widget).getText());
validate();
}
});
this.portText.addModifyListener(
new ModifyListener()
{
public void modifyText(ModifyEvent e)
{
tempTarget.setPort(((Text) e.widget).getText());
validate();
}
});
this.pingButton.addSelectionListener(
new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
doPing();
}
});
}
/**
* Description of the Method
*
* @param shell Description of the Parameter
*/
protected void configureShell(Shell shell)
{
this.setTitle("FileSystem Target Properties");
super.configureShell(shell);
}
/**
* Description of the Method
*
* @param parent Description of the Parameter
* @return Description of the Return Value
* @see \
org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent)
{
GridData layoutData;
Composite global = (Composite) super.createDialogArea(parent);
GridLayout gridLayout = new GridLayout(2, false);
global.setLayout(gridLayout);
Label descLabel = new Label(global, SWT.NONE);
descLabel.setText("description");//$NON-NLS-1$
layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.horizontalSpan = 2;
descLabel.setLayoutData(layoutData);
Label fileLabel = new Label(global, SWT.NONE);
fileLabel.setText("Name :");//$NON-NLS-1$
layoutData = new GridData();
layoutData.horizontalAlignment = SWT.END;
fileLabel.setLayoutData(layoutData);
this.nameText = new Text(global, SWT.BORDER);
layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.grabExcessHorizontalSpace = true;
this.nameText.setLayoutData(layoutData);
Label hostLabel = new Label(global, SWT.NONE);
hostLabel.setText("Hostname :");//$NON-NLS-1$
layoutData = new GridData();
layoutData.horizontalAlignment = SWT.END;
hostLabel.setLayoutData(layoutData);
this.hostText = new Text(global, SWT.BORDER);
layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.grabExcessHorizontalSpace = true;
this.hostText.setLayoutData(layoutData);
Label portLabel = new Label(global, SWT.NONE);
portLabel.setText("Port :");//$NON-NLS-1$
layoutData = new GridData();
layoutData.horizontalAlignment = SWT.END;
portLabel.setLayoutData(layoutData);
this.portText = new Text(global, SWT.BORDER);
layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.grabExcessHorizontalSpace = true;
this.portText.setLayoutData(layoutData);
this.pingButton = new Button(global, SWT.PUSH);
this.pingButton.setText("Test Connection");//$NON-NLS-1$
layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.horizontalSpan = 2;
this.pingButton.setLayoutData(layoutData);
this.assign();
this.refresh();
return parent;
}
/** Description of the Method */
protected void okPressed()
{
// Copy modified content
this.target.setName(this.tempTarget.getName());
this.target.setHost(this.tempTarget.getHost());
this.target.setPort(this.tempTarget.getPort());
super.okPressed();
}
/** Description of the Method */
protected void validate()
{
String temp;
IStatus status = null;
temp = this.tempTarget.getHost();
if ((temp == null) || ("".equals(temp)))
{
status = new Status(IStatus.ERROR, DeployerUIPlugin.getUniqueIdentifier(), \
0, "The hostname is not valid", null); }
if (status == null)
{
temp = this.tempTarget.getHost();
if ((temp == null) || ("".equals(temp)))
{
status = new Status(IStatus.ERROR, \
DeployerUIPlugin.getUniqueIdentifier(), 0, "The port is not valid", null); }
}
if (status == null)
{
status = new Status(IStatus.OK, DeployerUIPlugin.getUniqueIdentifier(), 0, \
"", null); this.updateStatus(status);
}
}
/** Description of the Method */
private void doPing()
{
try
{
this.tempTarget.ping();
DeployerUIPlugin.getDefault().showInfoMessage(this.tempTarget.toString() + \
" is reachable"); }
catch (IOException ioe)
{
DeployerUIPlugin.getDefault().showErrorMessage("The test failed with the \
following message :\n" + ioe.getMessage()); }
}
/** Description of the Method */
private void refresh()
{
this.nameText.setText(this.tempTarget.getName());
if (this.tempTarget.getHost() != null)
{
this.hostText.setText(this.tempTarget.getHost().toString());
}
if (this.tempTarget.getHost() != null)
{
this.portText.setText(this.tempTarget.getPort().toString());
}
}
}
1.1 \
contrib/jbosside/org.jboss.ide.eclipse.deployer.ui/src/org/jboss/ide/eclipse/deployer/ui/dialogs/TargetChoiceDialog.java
Index: TargetChoiceDialog.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at www.gnu.org.
*/
package org.jboss.ide.eclipse.deployer.ui.dialogs;
import java.util.Collection;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.internal.dialogs.ListContentProvider;
import org.jboss.ide.eclipse.deployer.core.target.ITarget;
import org.jboss.ide.eclipse.deployer.ui.util.TargetLabelProvider;
import org.jboss.ide.eclipse.ui.util.StringViewSorter;
/**
* @author Laurent Etiemble
* @created 18 mars 2003
* @version $Revision: 1.1 $
*/
public class TargetChoiceDialog extends Dialog
{
/** Description of the Field */
private Collection choices;
/** Description of the Field */
private ITarget data = null;
/** Description of the Field */
private StructuredViewer viewer;
/**
*Constructor for the DataChoiceDialog object
*
* @param parentShell Description of the Parameter
* @param choices Description of the Parameter
*/
public TargetChoiceDialog(Shell parentShell, Collection choices)
{
super(parentShell);
this.data = null;
this.choices = choices;
}
/**
* Gets the xDocletData attribute of the DataChoiceDialog object
*
* @return The xDocletData value
*/
public ITarget getTarget()
{
return this.data;
}
/**
* Description of the Method
*
* @param shell Description of the Parameter
*/
protected void configureShell(Shell shell)
{
super.configureShell(shell);
shell.setText("Target Choice");//$NON-NLS-1$
}
/**
* Description of the Method
*
* @param parent Description of the Parameter
* @return Description of the Return Value
* @see \
org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent)
{
Composite composite = (Composite) super.createDialogArea(parent);
composite.setLayout(new FillLayout(SWT.HORIZONTAL));
Table dataList = new Table(composite, SWT.BORDER | SWT.SINGLE | \
SWT.V_SCROLL); dataList.setLayoutData(new GridData(GridData.FILL_BOTH));
this.viewer = new TableViewer(dataList);
this.viewer.setContentProvider(new ListContentProvider());
this.viewer.setLabelProvider(new TargetLabelProvider());
this.viewer.setSorter(new StringViewSorter());
this.viewer.setInput(this.choices);
return composite;
}
/** Description of the Method */
protected void okPressed()
{
IStructuredSelection selection = (IStructuredSelection) \
this.viewer.getSelection(); if (!selection.isEmpty())
{
this.data = (ITarget) selection.getFirstElement();
}
super.okPressed();
}
}
1.1 \
contrib/jbosside/org.jboss.ide.eclipse.deployer.ui/src/org/jboss/ide/eclipse/deployer/ui/dialogs/TargetEditDialog.java
Index: TargetEditDialog.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at www.gnu.org.
*/
package org.jboss.ide.eclipse.deployer.ui.dialogs;
import org.eclipse.jdt.internal.ui.dialogs.StatusDialog;
import org.eclipse.swt.widgets.Shell;
/**
* @author letiemble
* @created 28 juillet 2003
* @version $Revision: 1.1 $
*/
public abstract class TargetEditDialog extends StatusDialog
{
/**
*Constructor for the TargetEditDialog object
*
* @param shell Description of the Parameter
*/
protected TargetEditDialog(Shell shell)
{
super(shell);
}
protected abstract void validate();
}
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic