Author: rob.stryker(a)jboss.com
Date: 2007-09-05 12:59:39 -0400 (Wed, 05 Sep 2007)
New Revision: 3464
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
JBIDE-400
username / password added to server editor
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2007-09-05
16:27:31 UTC (rev 3463)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2007-09-05
16:59:39 UTC (rev 3464)
@@ -16,10 +16,10 @@
swf_Title=Create a new JBoss Server
swf_Description=
swf_RuntimeInformation=Runtime Information
-swf_AuthorizationDescription=Authorization Details
swf_Explanation=A JBoss Server manages starting and stopping instances of JBoss. \nIt
manages command line arguments and keeps track of which modules have been deployed.
swf_Explanation2=If the runtime information below is incorrect, please press back,
Installed Runtimes..., \nand then Add to create a new runtime from a different location.
-swf_AuthenticationGroup=Set the login and password for your server
+swf_AuthorizationDescription=Set the login and password for your server.\nThis will
ensure it starts and stops properly.
+swf_AuthenticationGroup=Login Credentials
swf_Username=User Name
swf_Password=Password
swf_BaseName=JBoss _VERSION_ Server
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java 2007-09-05
16:59:39 UTC (rev 3464)
@@ -0,0 +1,99 @@
+package org.jboss.ide.eclipse.as.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.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.core.internal.ServerWorkingCopy;
+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.JBossServer;
+import org.jboss.ide.eclipse.as.ui.Messages;
+
+public class ServerPasswordSection extends ServerEditorSection {
+
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+ }
+
+ 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(Messages.swf_AuthenticationGroup);
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
GridData.VERTICAL_ALIGN_FILL));
+
+ Composite composite = toolkit.createComposite(section);
+
+ composite.setLayout(new GridLayout(2, false));
+ Label explanation = toolkit.createLabel(composite,
Messages.swf_AuthorizationDescription);
+ GridData d = new GridData(); d.horizontalSpan = 2;
+ explanation.setLayoutData(d);
+
+ Label name = toolkit.createLabel(composite, Messages.swf_Username);
+ final Text nameText = toolkit.createText(composite,
((ServerWorkingCopy)server).getAttribute(JBossServer.SERVER_USERNAME, ""));
+ Label pass = toolkit.createLabel(composite, Messages.swf_Password);
+ final Text passText = toolkit.createText(composite,
((ServerWorkingCopy)server).getAttribute(JBossServer.SERVER_PASSWORD, ""));
+
+ d = new GridData(); d.grabExcessHorizontalSpace = true; d.widthHint = 100;
+ nameText.setLayoutData(d);
+ d = new GridData(); d.grabExcessHorizontalSpace = true; d.widthHint = 100;
+ passText.setLayoutData(d);
+
+
+ nameText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ execute(new SetVarCommand(server, nameText, nameText.getText(),
JBossServer.SERVER_USERNAME));
+ }
+ });
+
+ passText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ execute(new SetVarCommand(server, passText, passText.getText(),
JBossServer.SERVER_PASSWORD));
+ }
+ });
+
+ toolkit.paintBordersFor(composite);
+ section.setClient(composite);
+ }
+
+
+ public static class SetVarCommand extends ServerCommand {
+ private String oldVal;
+ private String newVal;
+ private String key;
+ private Text text;
+
+ public SetVarCommand(IServerWorkingCopy wc, Text text, String newVal, String
attributeKey) {
+ super(wc, "SetVarCommand");
+ this.text = text;
+ this.key = attributeKey;
+ this.newVal = newVal;
+ if( wc instanceof ServerWorkingCopy ) {
+ this.oldVal = ((ServerWorkingCopy)wc).getAttribute(attributeKey, "");
+ }
+ }
+
+ public void execute() {
+ if( server instanceof ServerWorkingCopy )
+ ((ServerWorkingCopy)server).setAttribute(key, newVal);
+ }
+
+ public void undo() {
+ if( server instanceof ServerWorkingCopy )
+ ((ServerWorkingCopy)server).setAttribute(key, oldVal);
+ text.setText(oldVal);
+ }
+ }
+
+}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2007-09-05
16:27:31 UTC (rev 3463)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2007-09-05
16:59:39 UTC (rev 3464)
@@ -217,7 +217,7 @@
}
protected void createAuthenticationGroup(Composite main) {
- authenticationGroup = new Group(main, SWT.BORDER);
+ authenticationGroup = new Group(main, SWT.NONE);
authenticationGroup.setText(Messages.swf_AuthenticationGroup);
FormData groupData = new FormData();
groupData.left = new FormAttachment(0,5);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2007-09-05 16:27:31 UTC (rev
3463)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2007-09-05 16:59:39 UTC (rev
3464)
@@ -212,10 +212,16 @@
point="org.eclipse.wst.server.ui.editorPageSections">
<section
class="org.jboss.ide.eclipse.as.ui.editor.StrippedServerDeploySection"
- id="org.jboss.ide.eclipse.as.ui.deployServer.deployDir"
+ id="org.jboss.ide.eclipse.as.ui.exitor.deployServer.deployDir"
insertionId="org.eclipse.wst.server.editor.overview.left"
order="10"
typeIds="org.jboss.ide.eclipse.as.systemCopyServer"/>
+ <section
+ class="org.jboss.ide.eclipse.as.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.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42"/>
</extension>
Show replies by date