Author: rob.stryker(a)jboss.com
Date: 2010-12-07 01:32:52 -0500 (Tue, 07 Dec 2010)
New Revision: 27200
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/ServerPasswordSection.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java
Log:
JBIDE-7825
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml 2010-12-06 23:40:26 UTC (rev
27199)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml 2010-12-07 06:32:52 UTC (rev
27200)
@@ -121,5 +121,13 @@
serverTypes="org.jboss.ide.eclipse.as.ssh.server.remoteServerType">
</publishMethod>
</extension>
-
+ <extension
+ point="org.eclipse.wst.server.ui.editorPageSections">
+ <section
+
class="org.jboss.ide.eclipse.as.ssh.ui.editor.ServerPasswordSection"
+ id="org.jboss.ide.eclipse.as.ui.editor.passwordSection"
+ insertionId="org.eclipse.wst.server.editor.overview.left"
+ order="10"
+
typeIds="org.jboss.ide.eclipse.as.ssh.server.remoteServerType"/>
+ </extension>
</plugin>
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java 2010-12-06
23:40:26 UTC (rev 27199)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java 2010-12-07
06:32:52 UTC (rev 27200)
@@ -15,6 +15,7 @@
public class Messages extends NLS {
private static final String BUNDLE_NAME =
"org.jboss.ide.eclipse.as.ssh.Messages"; //$NON-NLS-1$
+ public static String SCPEditorLoginCredentials;
public static String browse;
public static String UserLabel;
public static String PassLabel;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties 2010-12-06
23:40:26 UTC (rev 27199)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties 2010-12-07
06:32:52 UTC (rev 27200)
@@ -9,4 +9,5 @@
EditorSetDeployCommandLabel=Set Remote Deployment Folder
SCPDeploymentSectionTitle=SCP Deployment
SCPDeploymentDescription=Deploy your modules via SCP file transfer
-SCPServerDescription=A server which allows remote deployment via SCP
\ No newline at end of file
+SCPServerDescription=A server which allows remote deployment via SCP
+SCPEditorLoginCredentials=Remote Server Login Credentials
\ No newline at end of file
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/ServerPasswordSection.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/ServerPasswordSection.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/ServerPasswordSection.java 2010-12-07
06:32:52 UTC (rev 27200)
@@ -0,0 +1,148 @@
+/**
+ * JBoss by Red Hat
+ * Copyright 2006-2009, Red Hat Middleware, LLC, and individual contributors as
indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.ssh.ui.editor;
+
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.ui.editor.ServerEditorSection;
+import org.eclipse.wst.server.ui.internal.command.ServerCommand;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.ssh.server.ISSHDeploymentConstants;
+import org.jboss.ide.eclipse.as.ui.Messages;
+
+/**
+ *
+ * @author Rob Stryker <rob.stryker(a)redhat.com>
+ *
+ */
+public class ServerPasswordSection extends ServerEditorSection {
+
+ private ModifyListener nameModifyListener, passModifyListener;
+ private Text nameText, passText;
+ private ServerAttributeHelper helper;
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+ helper = new ServerAttributeHelper(server.getOriginal(), server);
+ }
+
+ public void createSection(Composite parent) {
+ super.createSection(parent);
+ FormToolkit toolkit = new FormToolkit(parent.getDisplay());
+
+ Section section = toolkit.createSection(parent,
ExpandableComposite.TWISTIE|ExpandableComposite.EXPANDED|ExpandableComposite.TITLE_BAR);
+ section.setText(org.jboss.ide.eclipse.as.ssh.Messages.SCPEditorLoginCredentials);
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
GridData.VERTICAL_ALIGN_FILL));
+
+ Composite composite = toolkit.createComposite(section);
+
+ composite.setLayout(new GridLayout(2, false));
+
+ Label username = toolkit.createLabel(composite, Messages.swf_Username);
+ username.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ String n = helper.getAttribute(ISSHDeploymentConstants.USERNAME, "");
//$NON-NLS-1$
+ String p = helper.getAttribute(ISSHDeploymentConstants.PASSWORD, "");
//$NON-NLS-1$
+ nameText = toolkit.createText(composite, n);
+ Label password = toolkit.createLabel(composite, Messages.swf_Password);
+ password.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ passText = toolkit.createText(composite, p);
+
+ GridData d = new GridData();
+ d = new GridData(); d.grabExcessHorizontalSpace = true; d.widthHint = 100;
+ nameText.setLayoutData(d);
+ d = new GridData(); d.grabExcessHorizontalSpace = true; d.widthHint = 100;
+ passText.setLayoutData(d);
+
+ nameModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ execute(new SetUserCommand(server));
+ }
+ };
+
+ passModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ execute(new SetPassCommand(server));
+ }
+ };
+
+ nameText.addModifyListener(nameModifyListener);
+ passText.addModifyListener(passModifyListener);
+ toolkit.paintBordersFor(composite);
+ section.setClient(composite);
+ }
+
+
+ public class SetUserCommand extends SetVarCommand {
+ public SetUserCommand(IServerWorkingCopy server) {
+ super(server, Messages.EditorChangeUsernameCommandName, nameText, nameText.getText(),
+ ISSHDeploymentConstants.USERNAME, nameModifyListener);
+ }
+ }
+
+ public class SetPassCommand extends SetVarCommand {
+ public SetPassCommand(IServerWorkingCopy server) {
+ super(server, Messages.EditorChangePasswordCommandName, passText, passText.getText(),
+ ISSHDeploymentConstants.PASSWORD, passModifyListener);
+ }
+ }
+
+ public class SetVarCommand extends ServerCommand {
+ private String oldVal;
+ private String newVal;
+ private String key;
+ private Text text;
+ private ModifyListener listener;
+
+ public SetVarCommand(IServerWorkingCopy wc, String name,
+ Text text, String newVal, String attributeKey,
+ ModifyListener listener) {
+ super(wc, name);
+ this.text = text;
+ this.key = attributeKey;
+ this.newVal = newVal;
+ this.listener = listener;
+ this.oldVal = helper.getAttribute(attributeKey, ""); //$NON-NLS-1$
+ }
+
+ public void execute() {
+ helper.setAttribute(key, newVal);
+ }
+
+ public void undo() {
+ text.removeModifyListener(listener);
+ helper.setAttribute(key, oldVal);
+ text.setText(oldVal);
+ text.addModifyListener(listener);
+ }
+ }
+}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java 2010-12-06
23:40:26 UTC (rev 27199)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java 2010-12-07
06:32:52 UTC (rev 27200)
@@ -1,36 +1,27 @@
package org.jboss.ide.eclipse.as.ssh.ui.wizard;
-import java.io.File;
-
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jst.j2ee.model.internal.validation.ValidateBMPBean;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
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.FileDialog;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.TaskModel;
import org.eclipse.wst.server.ui.internal.ImageResource;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
-import org.jboss.ide.eclipse.as.core.util.ServerUtil;
import org.jboss.ide.eclipse.as.ssh.Messages;
import org.jboss.ide.eclipse.as.ssh.server.SSHServerDelegate;
@@ -135,5 +126,7 @@
server.setPassword(pass); //$NON-NLS-1$
server.setHostsFile(null);
server.setDeployFolder(deploy);
+ IServer tmp = serverWC.save(true, monitor);
+ getTaskModel().putObject(TaskModel.TASK_SERVER, tmp);
}
}