JBoss Tools SVN: r3274 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-08-22 10:16:00 -0400 (Wed, 22 Aug 2007)
New Revision: 3274
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-817
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java 2007-08-22 13:54:47 UTC (rev 3273)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java 2007-08-22 14:16:00 UTC (rev 3274)
@@ -153,7 +153,13 @@
private char[] autoActivChars;
public char[] getCompletionProposalAutoActivationCharacters() {
+ char[] superAutoActivChars = super.getCompletionProposalAutoActivationCharacters();
+ if(superAutoActivChars==null) {
+ return superAutoActivChars;
+ }
+
if(autoActivChars==null) {
+ autoActivChars = superAutoActivChars;
IPreferenceStore store = JSPUIPlugin.getDefault().getPreferenceStore();
if(store.isDefault(JSPUIPreferenceNames.AUTO_PROPOSE_CODE)) {
String superDefaultChars = store.getDefaultString(JSPUIPreferenceNames.AUTO_PROPOSE_CODE);
@@ -165,8 +171,6 @@
}
autoActivChars = new char[redhatDefaultChars.length()];
redhatDefaultChars.getChars(0, redhatDefaultChars.length(), autoActivChars, 0);
- } else {
- autoActivChars = super.getCompletionProposalAutoActivationCharacters();
}
}
return autoActivChars;
17 years, 5 months
JBoss Tools SVN: r3273 - trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-08-22 09:54:47 -0400 (Wed, 22 Aug 2007)
New Revision: 3273
Modified:
trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-components.meta
Log:
JBIDE-808
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-components.meta
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-components.meta 2007-08-22 13:32:03 UTC (rev 3272)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-components.meta 2007-08-22 13:54:47 UTC (rev 3273)
@@ -1101,23 +1101,23 @@
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
- WizardClassName="%Default%" displayName="Add Simple Property..."
- kind="action" name="AddProperty">
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Add Simple Property..." kind="action" name="AddProperty">
<EntityData EntityName="SeamProperty">
<AttributeData AttributeName="name"/>
<AttributeData AttributeName="value" Mandatory="no"/>
</EntityData>
</XActionItem>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
- WizardClassName="%Default%" displayName="Add List Property..."
- kind="action" name="AddListProperty">
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Add List Property..." kind="action" name="AddListProperty">
<EntityData EntityName="SeamPropertyList">
<AttributeData AttributeName="name"/>
</EntityData>
</XActionItem>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
- WizardClassName="%Default%" displayName="Add Map Property..."
- kind="action" name="AddMapProperty">
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Add Map Property..." kind="action" name="AddMapProperty">
<EntityData EntityName="SeamPropertyMap">
<AttributeData AttributeName="name"/>
</EntityData>
17 years, 5 months
JBoss Tools SVN: r3272 - trunk/documentation/development/usecases/en/modules.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-08-22 09:32:03 -0400 (Wed, 22 Aug 2007)
New Revision: 3272
Modified:
trunk/documentation/development/usecases/en/modules/seam.xml
Log:
initial rough usecase docs
Modified: trunk/documentation/development/usecases/en/modules/seam.xml
===================================================================
--- trunk/documentation/development/usecases/en/modules/seam.xml 2007-08-22 12:42:07 UTC (rev 3271)
+++ trunk/documentation/development/usecases/en/modules/seam.xml 2007-08-22 13:32:03 UTC (rev 3272)
@@ -12,11 +12,12 @@
<section>
<title>Overall Seam interaction</title>
- <para>The following scenario should be as smooth as possible. </para>
+ <para>The following scenario should be as smooth as possible and work for
+ both WAR and EAR. </para>
<itemizedlist>
<listitem>
- <para>New Seam Web Project</para>
+ <para><emphasis role="bold">New Seam Web Project</emphasis></para>
<para>Ask user the minimal set of questions to make this work.</para>
@@ -31,7 +32,7 @@
</listitem>
<listitem>
- <para>Run tests</para>
+ <para><emphasis role="bold">Run tests</emphasis></para>
<para>There won't be any tests initially, but the initial setup should
be ready.</para>
@@ -40,7 +41,7 @@
</listitem>
<listitem>
- <para>Deploy and run project</para>
+ <para><emphasis role="bold">Deploy and run project</emphasis></para>
<para>Run > Run As ... > Run On Server should deploy to already
chosen server and show the main page.</para>
@@ -53,7 +54,7 @@
</listitem>
<listitem>
- <para>Debug </para>
+ <para><emphasis role="bold">Debug </emphasis></para>
<para>Debug > Debug As ... > Debug On Server should deploy to
already chosen server and show the main page.</para>
@@ -74,52 +75,118 @@
already loaded and configured (no need to add project src to the
launch config)</para>
- <para>Add the following lines to change the behavior to only let users
- with different user/password in:</para>
+ <para>Change the method to only let users with different user/password
+ in and put a message about the error:</para>
- <para>if(identity.getUsername().equals(identity.getPassword())) {
- </para>
+ <para></para>
- <para> FacesMessages.instance().add("sorry - password and username
- need to be different."); </para>
+ <programlisting>public boolean authenticate()
+ {
+ log.info("authenticating #0", identity.getUsername());
+ if(identity.getUsername().equals(identity.getPassword())) {
+ FacesMessages.instance().add("sorry - password and username need to be different.");
+ return false;
+ }
+ identity.addRole("admin");
+ return true;
+ }</programlisting>
- <para> return false; </para>
-
- <para>} </para>
-
<para>Press save, and eclipse's hotswap should be in effect.</para>
<para>Click continue and the browser should complain that the user
- could not log in.</para>
+ could not log in and show the message "Sorry - password and username
+ need to be different." plus a Login Failed message.</para>
</listitem>
<listitem>
- <para>Edit an xhtml or another "web resource" like html, css etc. and
- save, refresh browser should work instantly</para>
+ <para><emphasis role="bold">Edit an xhtml or another "web resource"
+ like html, css etc. and save, refresh browser should work
+ instantly</emphasis></para>
<para>Edit login.xhtml, add some text in the main paragraph. Save, go
to browser and press refresh - changes should be there.</para>
- <para>On save files should be instantly available so users does not
- have to wait for it. (WTP has a 5 second default delay;
- usable?)</para>
+ <para>On save the file should be instantly available so users does not
+ have to wait for it. (WTP has a 5 second default delay; can we make
+ that better ?)</para>
</listitem>
<listitem>
- <para>Edit or add a java class should be available after clicking
- "Restart app"</para>
+ <para><emphasis role="bold">Edit or add a java class should be
+ available after clicking "Restart app"</emphasis></para>
<para>Restart App should *not* require restart of the application
server; just the application.</para>
<para>JBoss allows touching of descriptors to trigger restart. See
seam-gen on how it is done technically.</para>
+
+ <para>Old exadel studio had a "touch web.xml" file; not sure if that
+ still works ? (I couldn't see a difference)</para>
</listitem>
<listitem>
- <para>New Action</para>
+ <para><emphasis role="bold">New Action</emphasis></para>
- <para>Running new Action </para>
+ <para>Run New Action.</para>
+
+ <table>
+ <title></title>
+
+ <tgroup cols="3">
+ <tbody>
+ <row>
+ <entry>Seam Project</entry>
+
+ <entry> default based on selection</entry>
+
+ <entry></entry>
+ </row>
+
+ <row>
+ <entry>Component Name</entry>
+
+ <entry>Enter ping</entry>
+
+ <entry>ping</entry>
+ </row>
+
+ <row>
+ <entry>Local Interface</entry>
+
+ <entry>Default based on component name</entry>
+
+ <entry>PingBean</entry>
+ </row>
+
+ <row>
+ <entry>Method</entry>
+
+ <entry>default based on component name</entry>
+
+ <entry>ping</entry>
+ </row>
+
+ <row>
+ <entry>Page</entry>
+
+ <entry>default based on component name</entry>
+
+ <entry>ping</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>Clicking finish should generate a class called PingBean.java
+ with @Name("ping") and corresponding ping.xhtml and
+ PingTest.java.</para>
+
+ <para>Go to browser and go to the page called /ping.seam and you
+ should have a input field where in you can enter text and the result
+ should come back on the next page.</para>
+
+ <para>The generated PingTest.java should be </para>
</listitem>
</itemizedlist>
</section>
@@ -136,13 +203,20 @@
...but we should work with both so using the normal wizard is probably the
best start)</para>
- <para>There should be support for two types of projects: EAR and
- WAR.</para>
+ <para>There should be support for two types of projects: EAR and WAR. Each
+ setup would require more than one project to work in eclipse and it would
+ probably make sense to define a working set that defines the Seam Project.
+ e.g. working set called "SeamPhoto" for a project called "SeamPhoto" and
+ the corresponding projects would be named "seamphoto.war",
+ "seamphoto.model", "seamphoto.ear", "seamphoto.test" (this names are
+ *defaults* and our code should not depend on the naming pattern to figure
+ out what kind a project is)</para>
<para>The best way to see what should go where is to use seam-gen to
generate two projects, one for war and the other for ear - when built
exploded-archives will contain the .ear/.war/.jar with the libs needed in
- the various places.</para>
+ the various places. the only thing not done by seam-gen is the seperation
+ of the test code/libs.</para>
<section>
<title>War</title>
@@ -171,6 +245,9 @@
<para>To run unittests we probably need a <projectname>-test
project that depends on the war project and contains the jars/resources
to run tests.</para>
+
+ <para>Both the war, utility-jar and test project should be marked as a
+ Seam project.</para>
</section>
<section>
@@ -213,7 +290,13 @@
<section>
<title>Seam New Action</title>
- <para></para>
+ <para>public boolean authenticate() { log.info("authenticating #0",
+ identity.getUsername());
+ if(identity.getUsername().equals(identity.getPassword())) {
+ FacesMessages.instance().add("sorry - password and username need to be
+ different."); return false; } //write your authentication logic here,
+ //return true if the authentication was //successful, false otherwise
+ identity.addRole("admin"); return true; }</para>
</section>
<section>
17 years, 5 months
JBoss Tools SVN: r3271 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp: format and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-08-22 08:42:07 -0400 (Wed, 22 Aug 2007)
New Revision: 3271
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/format/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/format/HTMLExtendedElementFormatter.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/format/HTMLFormatProcessor.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationHTML.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-801
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationHTML.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationHTML.java 2007-08-22 12:17:17 UTC (rev 3270)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationHTML.java 2007-08-22 12:42:07 UTC (rev 3271)
@@ -18,6 +18,8 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.formatter.IContentFormatter;
+import org.eclipse.jface.text.formatter.MultiPassContentFormatter;
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jst.jsp.core.text.IJSPPartitions;
@@ -25,12 +27,12 @@
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.wst.html.core.text.IHTMLPartitions;
import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
-import org.osgi.framework.Bundle;
-
-import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy;
import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorBuilder;
import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorDefinition;
import org.jboss.tools.jst.jsp.contentassist.RedHatHtmlContentAssistProcessor;
+import org.jboss.tools.jst.jsp.format.HTMLFormatProcessor;
+import org.osgi.framework.Bundle;
public class ExtendedStructuredTextViewerConfigurationHTML extends StructuredTextViewerConfigurationHTML {
@@ -130,4 +132,14 @@
}
return result;
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML#getContentFormatter(org.eclipse.jface.text.source.ISourceViewer)
+ */
+ public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
+ MultiPassContentFormatter formatter = new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer), IHTMLPartitions.HTML_DEFAULT);
+ formatter.setMasterStrategy(new StructuredFormattingStrategy(new HTMLFormatProcessor()));
+ return formatter;
+ }
}
\ No newline at end of file
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/format/HTMLExtendedElementFormatter.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/format/HTMLExtendedElementFormatter.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/format/HTMLExtendedElementFormatter.java 2007-08-22 12:42:07 UTC (rev 3271)
@@ -0,0 +1,90 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.format;
+
+import java.util.ArrayList;
+
+import org.eclipse.wst.html.core.internal.format.HTMLElementFormatter;
+import org.eclipse.wst.html.core.internal.provisional.HTMLFormatContraints;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Formatter for html elements
+ * Extends HTMLElementFormatter but doesn't format EL
+ * @author Alexey Kazakov
+ */
+public class HTMLExtendedElementFormatter extends HTMLElementFormatter {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.html.core.internal.format.HTMLElementFormatter#formatNode(org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode, org.eclipse.wst.html.core.internal.provisional.HTMLFormatContraints)
+ */
+ protected void formatNode(IDOMNode node, HTMLFormatContraints contraints) {
+ if (node == null) {
+ return;
+ }
+ IDOMElement element = (IDOMElement) node;
+ String oldStyleValue = null;
+ Attr style = element.getAttributeNode("style");//$NON-NLS-1$
+ if (style != null) {
+ oldStyleValue = style.getValue();
+ }
+ super.formatNode(node, contraints);
+ if(oldStyleValue!=null && oldStyleValue.indexOf("#{")>-1) {
+ style.setValue(oldStyleValue);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.html.core.internal.format.HTMLFormatter#formatChildNodes(org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode, org.eclipse.wst.html.core.internal.provisional.HTMLFormatContraints)
+ */
+ protected void formatChildNodes(IDOMNode node, HTMLFormatContraints contraints) {
+ if (node == null || !node.hasChildNodes()) {
+ return;
+ }
+ ArrayList<Attr> styles = new ArrayList<Attr>();
+ ArrayList<String> oldValues = new ArrayList<String>();
+ collectAllStyleAttributesOfNodeChildren(node, styles, oldValues);
+ super.formatChildNodes(node, contraints);
+ for(int i=0; i<styles.size(); i++) {
+ Attr style = styles.get(i);
+ String oldValue = oldValues.get(i);
+ style.setNodeValue(oldValue);
+ }
+ }
+
+ private void collectAllStyleAttributesOfNodeChildren(Node node, ArrayList<Attr> styles, ArrayList<String> oldValues) {
+ if (!node.hasChildNodes()) {
+ return;
+ }
+ NodeList children = node.getChildNodes();
+ for(int i=0; i<children.getLength(); i++) {
+ Node child = children.item(i);
+ if(child instanceof Element) {
+ Attr style = ((Element)child).getAttributeNode("style");
+ if(style!=null) {
+ String value = style.getValue();
+ if(value.indexOf("#{")>-1) {
+ styles.add(style);
+ oldValues.add(value);
+ }
+ }
+ }
+ collectAllStyleAttributesOfNodeChildren(child, styles, oldValues);
+ }
+ }
+}
\ No newline at end of file
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/format/HTMLFormatProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/format/HTMLFormatProcessor.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/format/HTMLFormatProcessor.java 2007-08-22 12:42:07 UTC (rev 3271)
@@ -0,0 +1,36 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.format;
+
+import org.eclipse.wst.html.core.internal.format.HTMLElementFormatter;
+import org.eclipse.wst.html.core.internal.format.HTMLFormatProcessorImpl;
+import org.eclipse.wst.sse.core.internal.format.IStructuredFormatter;
+import org.w3c.dom.Node;
+
+/**
+ * This Processor formats HTML.
+ * @author Alexey Kazakov
+ */
+public class HTMLFormatProcessor extends HTMLFormatProcessorImpl {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.html.core.internal.format.HTMLFormatProcessorImpl#getFormatter(org.w3c.dom.Node)
+ */
+ protected IStructuredFormatter getFormatter(Node node) {
+ IStructuredFormatter formatter = super.getFormatter(node);
+ if(formatter instanceof HTMLElementFormatter) {
+ formatter = new HTMLExtendedElementFormatter();
+ formatter.setFormatPreferences(getFormatPreferences());
+ }
+ return formatter;
+ }
+}
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r3270 - trunk/documentation/development.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-08-22 08:17:17 -0400 (Wed, 22 Aug 2007)
New Revision: 3270
Modified:
trunk/documentation/development/
Log:
initial rough usecase docs
Property changes on: trunk/documentation/development
___________________________________________________________________
Name: svn:ignore
+ build
17 years, 5 months
JBoss Tools SVN: r3268 - trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-08-22 07:18:36 -0400 (Wed, 22 Aug 2007)
New Revision: 3268
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/PaletteDragSourceListener.java
Log:
JBIDE-792
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/PaletteDragSourceListener.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/PaletteDragSourceListener.java 2007-08-22 03:36:00 UTC (rev 3267)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.ui.palette/src/org/jboss/tools/vpe/ui/palette/PaletteDragSourceListener.java 2007-08-22 11:18:36 UTC (rev 3268)
@@ -20,6 +20,7 @@
import org.jboss.tools.common.meta.action.XActionInvoker;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
import org.jboss.tools.vpe.ui.palette.model.PaletteItem;
public class PaletteDragSourceListener extends DragSourceAdapter {
@@ -52,7 +53,29 @@
}
public void dragSetData(DragSourceEvent event) {
if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
- event.data = "data"; //$NON-NLS-1$
+ List list = ((PaletteViewer)viewer).getSelectedEditParts();
+ XModelObject object = (list.size() == 0) ? null : getObject(list.get(0));
+ if(object != null) {
+ String[] d = new String[2];
+ d[0] = object.getAttributeValue("start text");
+ if(d[0] == null) d[0] = "";
+ d[1] = object.getAttributeValue("end text");
+ if(d[1] == null) d[1] = "";
+
+ String defaultPrefix = object.getAttributeValue("default prefix");
+ String tag = object.getAttributeValue("name");
+ if(defaultPrefix == null) {
+ defaultPrefix = object.getParent().getAttributeValue("default prefix");
+ }
+ if(defaultPrefix != null && tag != null) {
+ PaletteInsertHelper.applyPrefix(d, "", tag, "xxx", defaultPrefix);
+ }
+ int i = d[0].indexOf('|');
+ if(i >= 0) d[0] = d[0].substring(0, i) + d[0].substring(i + 1);
+ event.data = d[0] + d[1];
+ } else {
+ event.data = "data"; //$NON-NLS-1$
+ }
} else {
/// event.data = new String[] {"model object"};
event.data = "model object"; //$NON-NLS-1$
17 years, 5 months
JBoss Tools SVN: r3267 - in trunk/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-08-21 23:36:00 -0400 (Tue, 21 Aug 2007)
New Revision: 3267
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
Log:
Addition of credentialing as top level element in server creation wizard.
UI enhancement still required to modify the credentials.
JBIDE-400
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.java 2007-08-22 00:21:20 UTC (rev 3266)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.java 2007-08-22 03:36:00 UTC (rev 3267)
@@ -169,10 +169,18 @@
IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS
+ JBossServerLaunchConfiguration.PRGM_ARGS_TWIDDLE_SUFFIX,
(String) null);
- String user = ArgsUtil.getValue(twiddleArgs, "-u", "--user");
- String password = ArgsUtil.getValue(twiddleArgs, "-p",
- "--password");
-
+
+ // get user from the IServer, but override with launch configuration
+ String user = ServerConverter.getJBossServer(server).getUsername();
+ String userLaunch = ArgsUtil.getValue(twiddleArgs, "-u", "--user");
+ user = userLaunch == null ? user : userLaunch;
+
+ // get password from the IServer, but override with launch configuration
+ String pass = ServerConverter.getJBossServer(server).getPassword();
+ String passwordLaunch = ArgsUtil.getValue(twiddleArgs, "-p", "--password");
+ pass = passwordLaunch == null ? pass : passwordLaunch;
+
+
// get our methods
Class simplePrincipal = Thread.currentThread()
.getContextClassLoader().loadClass(
@@ -197,7 +205,7 @@
// set the credential
Method setCredentialMethod = securityAssoc.getMethod(
"setCredential", new Class[] { Object.class });
- setCredentialMethod.invoke(null, new Object[] { password });
+ setCredentialMethod.invoke(null, new Object[] { pass });
} catch (CoreException e) {
temp = e;
} catch (ClassNotFoundException e) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java 2007-08-22 00:21:20 UTC (rev 3266)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java 2007-08-22 03:36:00 UTC (rev 3267)
@@ -230,5 +230,14 @@
try {
return new URL(url);
} catch( MalformedURLException murle) { return null; }
- }
+ }
+
+
+ public String getUsername() {
+ return getAttributeHelper().getAttribute(SERVER_USERNAME, "");
+ }
+
+ public String getPassword() {
+ return getAttributeHelper().getAttribute(SERVER_PASSWORD, "");
+ }
}
\ No newline at end of file
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerLaunchConfiguration.java 2007-08-22 00:21:20 UTC (rev 3266)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerLaunchConfiguration.java 2007-08-22 03:36:00 UTC (rev 3267)
@@ -48,6 +48,7 @@
import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.core.internal.ServerType;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
public class JBossServerLaunchConfiguration extends AbstractJavaLaunchConfigurationDelegate {
@@ -142,6 +143,9 @@
List classpath = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH + suffix, new ArrayList());
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath);
+ if( STOP.equals(action) || TWIDDLE.equals(action))
+ addCredentials(workingCopy, getJBossServer(workingCopy));
+
} catch( Exception e ) {
e.printStackTrace();
}
@@ -149,6 +153,24 @@
}
+ protected static void addCredentials(ILaunchConfigurationWorkingCopy configuration, JBossServer server) {
+ try {
+ String argsKey = IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS;
+ String args = configuration.getAttribute(argsKey, (String)null);
+ String user = ArgsUtil.getValue(args, "-u", "--user");
+ String pass = ArgsUtil.getValue(args, "-p", "--password");
+ if( user == null )
+ args = args + " -u " + server.getUsername();
+ if( pass == null )
+ args = args + " -p " + server.getPassword();
+
+ configuration.setAttribute(argsKey, args);
+ } catch( CoreException ce ) {
+ ce.printStackTrace();
+ }
+ }
+
+
// Have the defaults been set for this launch config yet? ever?
public static boolean defaultsBeenSet(ILaunchConfiguration workingCopy, IServer server) {
try {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2007-08-22 00:21:20 UTC (rev 3266)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2007-08-22 03:36:00 UTC (rev 3267)
@@ -64,6 +64,7 @@
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.attributes.IServerStartupParameters;
import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
import org.jboss.ide.eclipse.as.ui.Messages;
@@ -438,7 +439,7 @@
// No errors, clear the message and update the available
// configurations
configurations.setJBossHome(homeDirText.getText());
- configurations.setDefaultConfiguration("default");
+ configurations.setDefaultConfiguration(IServerStartupParameters.DEFAULT_SERVER_NAME);
// update config variable
int index = configurations.getTable().getSelectionIndex();
17 years, 5 months
JBoss Tools SVN: r3266 - in trunk/as/plugins: org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-08-21 20:21:20 -0400 (Tue, 21 Aug 2007)
New Revision: 3266
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
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/editor/StrippedServerDeploySection.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
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/StrippedServerWizardFragment.java
Log:
UI cleanup. Every Label uses Messages class now.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java 2007-08-21 21:05:27 UTC (rev 3265)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java 2007-08-22 00:21:20 UTC (rev 3266)
@@ -56,6 +56,8 @@
public class JBossServer extends ServerDelegate
implements IServerStartupParameters, IDeployableServer, IURLProvider {
+ public static final String SERVER_USERNAME = "org.jboss.ide.eclipse.as.core.server.userName";
+ public static final String SERVER_PASSWORD = "org.jboss.ide.eclipse.as.core.server.password";
public JBossServer() {
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2007-08-21 21:05:27 UTC (rev 3265)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2007-08-22 00:21:20 UTC (rev 3266)
@@ -24,63 +24,73 @@
import org.eclipse.osgi.util.NLS;
public class Messages {
- public static String createWizardTitle;
- public static String runtimeInformation;
- public static String createRuntimeWizardTitle;
- public static String createWizardDescription;
- public static String wizardFragmentNameLabel;
- public static String wizardFragmentHomeDirLabel;
- public static String wizardFragmentJRELabel;
- public static String installedJREs;
- public static String wizardFragmentConfigLabel;
- public static String runtimeWizardFragmentExplanation;
- public static String serverWizardFragmentExplanation;
- public static String serverWizardFragmentExplanation2;
- public static String serverNameInUse;
- public static String runtimeNameInUse;
- public static String invalidDirectory;
- public static String nameTextBlank;
- public static String homeDirBlank;
+ /* Standard and re-usable */
public static String browse;
- public static String deployDirectory;
+ public static String serverName;
+
+ /* Server and Runtime Wizard Fragments */
+ public static String wf_BaseNameVersionReplacement;
+ public static String wf_NameLabel;
+ public static String wf_HomeDirLabel;
+ public static String wf_JRELabel;
+ public static String wf_ConfigLabel;
+ public static String rwf_Title;
+ public static String rwf_Explanation;
+ public static String rwf_BaseName;
+ public static String rwf_NameInUse;
+ public static String rwf_invalidDirectory;
+ public static String rwf_nameTextBlank;
+ public static String rwf_homeDirBlank;
+ public static String swf_Title;
+ public static String swf_Description;
+ public static String swf_RuntimeInformation;
+ public static String swf_AuthorizationDescription;
+ public static String swf_Explanation;
+ public static String swf_Explanation2;
+ public static String swf_AuthenticationGroup;
+ public static String swf_Username;
+ public static String swf_Password;
+ public static String swf_BaseName;
+ public static String swf_NameInUse;
+ public static String sswf_DeployDirectory;
+ public static String sswf_Title;
+ public static String sswf_BaseName;
+
public static String ServerDialogHeading;
-
+
/* Module extension properties */
public static String ModulePropertyType;
public static String ModulePropertyProject;
public static String ModulePropertyModuleFactory;
-
+
public static String RefreshViewerAction;
public static String DisableCategoryAction;
public static String EditLaunchConfigurationAction;
public static String TwiddleServerAction;
public static String CloneServerAction;
-
+
/* Properties of view extenders (categories) */
public static String ExtensionID;
public static String ExtensionName;
public static String ExtensionDescription;
public static String ExtensionProviderClass;
-
-
+
/* Properties of JBoss Servers in the view Properties */
public static String ServerRuntimeVersion;
public static String ServerHome;
public static String ServerConfigurationName;
public static String ServerDeployDir;
-
+
public static String property;
public static String value;
-
-
+
public static String DeleteModuleText;
public static String PublishModuleText;
public static String DeleteModuleDescription;
public static String PublishModuleDescription;
-
+
public static String DeleteModuleConfirm;
-
-
+
/* Action Delegate */
public static String ActionDelegateStartServer;
@@ -89,21 +99,20 @@
public static String ActionDelegateNew;
public static String ActionDelegateNewMBeanStubs;
public static String ActionDelegateNewServer;
-
+
/* Launch Group */
public static String LaunchGroupStartArgs;
public static String LaunchGroupStopArgs;
public static String LaunchGroupTwiddleArgs;
public static String LaunchGroupConfigChanged;
-
+
/* Twiddle Dialog */
public static String TwiddleDialog;
public static String TwiddleDialogExecute;
public static String TwiddleDialogDone;
public static String TwiddleDialogArguments;
public static String TwiddleDialogTutorial;
-
-
+
/* XPath Dialog */
public static String XPathNewCategory;
public static String XPathNewCategoryNameInUse;
@@ -118,9 +127,7 @@
public static String XPathName;
public static String XPathPattern;
public static String XPathAttribute;
-
-
/* Preference Page */
public static String PreferencePageServerTimeouts;
public static String PreferencePageStartTimeouts;
@@ -128,8 +135,7 @@
public static String PreferencePageUponTimeout;
public static String PreferencePageUponTimeoutAbort;
public static String PreferencePageUponTimeoutIgnore;
-
-
+
/* View Preference Page */
public static String ViewPreferencePageName;
public static String ViewPreferencePageEnabled;
@@ -137,7 +143,7 @@
public static String ViewPreferencePageDescription;
public static String ViewExtensionEnablementDescription;
public static String ViewExtensionPreferenceDescription;
-
+
/* Upgrade Wizard to 2.0.0 */
public static String UpgradeWizardTitle;
public static String UpgradeWizardDescription;
@@ -157,12 +163,10 @@
public static String UpgradeWizardLaunchMonitorConverting;
public static String UpgradeWizardLaunchRuntimeNamesInUse;
public static String UpgradeWizardLaunchServerNamesInUse;
-
-
+
/* Inactive Categories */
public static String InactiveCategoriesReEnable;
-
-
+
public static String DescriptorXPathRemoveCategory;
public static String DescriptorXPathRemoveCategoryDesc;
public static String DescriptorXPathNewXPath;
@@ -173,14 +177,14 @@
public static String DescriptorXPathAttributeKeyValue;
public static String DescriptorXPathDescriptorValues;
public static String DescriptorXPathNameLocation;
- public static String DescriptorXPathServerName;
- public static String DescriptorXPathPortCategory;
+ public static String DescriptorXPathServerName;
+ public static String DescriptorXPathPortCategory;
public static String DescriptorXPathSimple;
public static String DescriptorXPathComplex;
public static String DescriptorXPathMatch;
-
-
+
static {
- NLS.initializeMessages(JBossServerUIPlugin.PLUGIN_ID + ".Messages", Messages.class);
+ NLS.initializeMessages(JBossServerUIPlugin.PLUGIN_ID + ".Messages",
+ Messages.class);
}
}
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-08-21 21:05:27 UTC (rev 3265)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2007-08-22 00:21:20 UTC (rev 3266)
@@ -1,23 +1,33 @@
-createWizardTitle=Create a new JBoss Server
-runtimeInformation=Runtime Information
-createRuntimeWizardTitle=Create a new JBoss Server Runtime
-createWizardDescription=Add a JBoss Server and have great fun
-wizardFragmentNameLabel=Name (unique identifier)
-wizardFragmentHomeDirLabel=Home Directory
-wizardFragmentJRELabel=JRE
-wizardFragmentConfigLabel=Configuration
-installedJREs=Installed JREs
-serverNameInUse=Server name is in use.
-runtimeNameInUse=Runtime name is in use.
-invalidDirectory=Invalid Directory
-nameTextBlank=The name field cannot be blank.
-homeDirBlank=The home directory field cannot be blank.
browse=Browse...
-deployDirectory=Deploy Directory
-runtimeWizardFragmentExplanation=A JBoss Server runtime references a JBoss installation directory.\nIt can be used to set up classpaths for projects which depend on this runtime,\nas well as by a "server" which will be able to start and stop instances of JBoss.
-serverWizardFragmentExplanation=A JBoss Server manages starting and stopping instances of JBoss. \nIt manages command line arguments and keeps track of which modules have been deployed.
-serverWizardFragmentExplanation2=If the runtime information below is incorrect, please press back, Installed Runtimes..., \nand then Add to create a new runtime from a different location.
+serverName=Server Name
+wf_BaseNameVersionReplacement=_VERSION_
+wf_NameLabel=Name
+wf_HomeDirLabel=Home Directory
+wf_JRELabel=JRE
+wf_ConfigLabel=Configuration
+rwf_Title=JBoss Runtime Wizard
+rwf_Explanation=A JBoss Server runtime references a JBoss installation directory.\nIt can be used to set up classpaths for projects which depend on this runtime,\nas well as by a "server" which will be able to start and stop instances of JBoss.
+rwf_BaseName=JBoss _VERSION_ Runtime
+rwf_NameInUse=Runtime name already in use
+rwf_invalidDirectory=Invalid Directory
+rwf_nameTextBlank=The name field must not be blank
+rwf_homeDirBlank=The directory field must not be blank
+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_Username=User Name
+swf_Password=Password
+swf_BaseName=JBoss _VERSION_ Server
+swf_NameInUse=Server name already in use
+sswf_DeployDirectory=Deploy Directory
+sswf_Title=Create a new System Copy Server
+sswf_BaseName=Local Deployer
+
#Server View (server and categories, properties)
property=Property
value=Value
@@ -101,11 +111,11 @@
ViewPreferencePageEnabled=Enabled
ViewPreferencePageWeight=Weight
ViewPreferencePageDescription=Description
+
ViewExtensionEnablementDescription=Below is a list of extensions that may be enabled for the\
+JBoss Servers View. \n The enablement box designates whether the extension should be present.\
+The weight field \ndesignates how "heavy" each extension is. (Heavier elements fall towards the bottom.)
- JBoss Servers View. \n The enablement box designates whether the extension should be present.\
-
-The weight field \ndesignates how "heavy" each extension is. (Heavier elements fall towards the bottom.)
ViewExtensionPreferenceDescription=Below, you may set or clear any preferences specific to each view extension above. \nSome extensions may have no preferences to set.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/StrippedServerDeploySection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/StrippedServerDeploySection.java 2007-08-21 21:05:27 UTC (rev 3265)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/StrippedServerDeploySection.java 2007-08-22 00:21:20 UTC (rev 3266)
@@ -45,14 +45,14 @@
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE|ExpandableComposite.EXPANDED|ExpandableComposite.TITLE_BAR);
- section.setText(Messages.deployDirectory);
+ section.setText(Messages.sswf_DeployDirectory);
section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
Composite composite = toolkit.createComposite(section);
composite.setLayout(new FormLayout());
- Label label = toolkit.createLabel(composite, Messages.deployDirectory);
+ Label label = toolkit.createLabel(composite, Messages.sswf_DeployDirectory);
final Text text = toolkit.createText(composite, getDeployDir(), SWT.BORDER);
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2007-08-21 21:05:27 UTC (rev 3265)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2007-08-22 00:21:20 UTC (rev 3266)
@@ -80,6 +80,10 @@
private final static int SEVERITY_ALL = 1;
private final static int SEVERITY_MAJOR = 2;
+ public static final String LOCATION_TEXT = Platform.getOS().equals(Platform.WS_WIN32)
+ ? "c:/program files/jboss-" : "/usr/bin/jboss-";
+
+
private IWizardHandle handle;
private Label nameLabel, homeDirLabel, installedJRELabel, configLabel,
explanationLabel;
@@ -125,7 +129,7 @@
// initTaskModel();
// make modifications to parent
- handle.setTitle(Messages.createRuntimeWizardTitle);
+ handle.setTitle(Messages.rwf_Title);
handle.setImageDescriptor(getImageDescriptor());
return main;
}
@@ -156,37 +160,29 @@
configurations.setDefaultConfiguration(configSelected);
configurations.getTable().setVisible(false);
- configLabel.setText(Messages.wizardFragmentConfigLabel + ": "
+ configLabel.setText(Messages.wf_ConfigLabel + ": "
+ configSelected);
homeDirText.setEditable(false);
homeDirButton.setEnabled(false);
- try {
- Object o = rwc.loadAdapter(IJBossServerRuntime.class,
- new NullProgressMonitor());
- if (o != null) {
- IJBossServerRuntime jbsr = (IJBossServerRuntime) o;
- IVMInstall install = jbsr.getVM();
- String vmName = install.getName();
- String[] jres = jreCombo.getItems();
- for (int i = 0; i < jres.length; i++) {
- if (vmName.equals(jres[i]))
- jreCombo.select(i);
- }
+ Object o = rwc.loadAdapter(IJBossServerRuntime.class,
+ new NullProgressMonitor());
+ if (o != null) {
+ IJBossServerRuntime jbsr = (IJBossServerRuntime) o;
+ IVMInstall install = jbsr.getVM();
+ String vmName = install.getName();
+ String[] jres = jreCombo.getItems();
+ for (int i = 0; i < jres.length; i++) {
+ if (vmName.equals(jres[i]))
+ jreCombo.select(i);
}
- } catch (Exception e) {
-
}
-
}
}
private void setWidgetDefaults() {
nameText.setText(generateNewRuntimeName());
- homeDirText
- .setText(Platform.getOS().equals(Platform.WS_WIN32) ? "c:/program files/jboss-"
- + getRuntimeVersionId() + ".x"
- : "/usr/bin/jboss-" + getRuntimeVersionId() + ".x");
+ homeDirText.setText(LOCATION_TEXT + getRuntimeVersionId() + ".x");
}
public String getVersion() {
@@ -203,7 +199,7 @@
}
private String generateNewRuntimeName() {
- String base = "JBoss " + getVersion() + " runtime";
+ String base = Messages.rwf_BaseName.replace(Messages.wf_BaseNameVersionReplacement, getVersion());
IRuntime rt = ServerCore.findRuntime(base);
if (rt == null)
return base;
@@ -266,7 +262,7 @@
data.right = new FormAttachment(100, -5);
explanationLabel.setLayoutData(data);
- explanationLabel.setText(Messages.runtimeWizardFragmentExplanation);
+ explanationLabel.setText(Messages.rwf_Explanation);
}
private void createNameComposite(Composite main) {
@@ -283,7 +279,7 @@
// create internal widgets
nameLabel = new Label(nameComposite, SWT.NONE);
- nameLabel.setText(Messages.wizardFragmentNameLabel);
+ nameLabel.setText(Messages.wf_NameLabel);
nameText = new Text(nameComposite, SWT.BORDER);
nameText.addModifyListener(new ModifyListener() {
@@ -320,7 +316,7 @@
// Create Internal Widgets
homeDirLabel = new Label(homeDirComposite, SWT.NONE);
- homeDirLabel.setText(Messages.wizardFragmentHomeDirLabel);
+ homeDirLabel.setText(Messages.wf_HomeDirLabel);
homeDirText = new Text(homeDirComposite, SWT.BORDER);
@@ -377,14 +373,14 @@
// Create Internal Widgets
installedJRELabel = new Label(jreComposite, SWT.NONE);
- installedJRELabel.setText(Messages.wizardFragmentJRELabel);
+ installedJRELabel.setText(Messages.wf_JRELabel);
jreCombo = new Combo(jreComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
jreCombo.setItems(jreNames);
jreCombo.select(defaultVMIndex);
jreButton = new Button(jreComposite, SWT.NONE);
- jreButton.setText(Messages.installedJREs);
+ jreButton.setText(Messages.wf_JRELabel);
// Add action listeners
jreButton.addSelectionListener(new SelectionAdapter() {
@@ -474,21 +470,21 @@
private String getErrorString(int severity) {
if (getRuntime(nameText.getText()) != null) {
- return Messages.runtimeNameInUse;
+ return Messages.rwf_NameInUse;
}
if (!isHomeValid())
- return Messages.invalidDirectory;
+ return Messages.rwf_invalidDirectory;
if (severity == SEVERITY_MAJOR)
return null;
// now give minor warnings
if (nameText.getText().equals(""))
- return Messages.nameTextBlank;
+ return Messages.rwf_nameTextBlank;
if (homeDirText.getText().equals(""))
- return Messages.homeDirBlank;
+ return Messages.rwf_homeDirBlank;
return null;
}
@@ -621,7 +617,7 @@
configComposite.setLayout(new FormLayout());
configLabel = new Label(configComposite, SWT.NONE);
- configLabel.setText(Messages.wizardFragmentConfigLabel);
+ configLabel.setText(Messages.wf_ConfigLabel);
configurations = new JBossConfigurationTableViewer(configComposite,
SWT.BORDER | SWT.SINGLE);
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-08-21 21:05:27 UTC (rev 3265)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2007-08-22 00:21:20 UTC (rev 3266)
@@ -1,5 +1,4 @@
/*
- * JBoss, Home of Professional Open Source
* Copyright 2006, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
@@ -49,6 +48,7 @@
import org.eclipse.wst.server.core.TaskModel;
import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
import org.eclipse.wst.server.core.internal.Server;
+import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
import org.jboss.ide.eclipse.as.core.model.descriptor.XPathModel;
@@ -60,15 +60,17 @@
public class JBossServerWizardFragment extends WizardFragment {
private IWizardHandle handle;
- private Label nameLabel, explanationLabel, explanationLabel2;
+ private Label nameLabel, serverExplanationLabel,
+ runtimeExplanationLabel, authenticationExplanationLabel;
private Label homeDirLabel, installedJRELabel, configLabel;
private Label homeValLabel, jreValLabel, configValLabel;
- private String runtimeLoc, configName;
+ private Label usernameLabel, passLabel;
+ private String runtimeLoc, configName, authUser, authPass;
private Composite nameComposite;
- private Group g;
+ private Group runtimeGroup, authenticationGroup;
private String name;
- private Text nameText;
+ private Text nameText, userText, passText;
public Composite createComposite(Composite parent, IWizardHandle handle) {
this.handle = handle;
@@ -79,10 +81,11 @@
createExplanationLabel(main);
createNameComposite(main);
createRuntimeGroup(main);
+ createAuthenticationGroup(main);
// make modifications to parent
- handle.setTitle(Messages.createWizardTitle);
- handle.setDescription(Messages.createWizardDescription);
+ handle.setTitle(Messages.swf_Title);
+ handle.setDescription(Messages.swf_Description);
handle.setImageDescriptor (getImageDescriptor());
return main;
@@ -108,13 +111,13 @@
}
private void createExplanationLabel(Composite main) {
- explanationLabel = new Label(main, SWT.NONE);
+ serverExplanationLabel = new Label(main, SWT.NONE);
FormData data = new FormData();
data.top = new FormAttachment(0,5);
data.left = new FormAttachment(0,5);
data.right = new FormAttachment(100,-5);
- explanationLabel.setLayoutData(data);
- explanationLabel.setText(Messages.serverWizardFragmentExplanation);
+ serverExplanationLabel.setLayoutData(data);
+ serverExplanationLabel.setText(Messages.swf_Explanation);
}
private void createNameComposite(Composite main) {
@@ -124,7 +127,7 @@
FormData cData = new FormData();
cData.left = new FormAttachment(0,5);
cData.right = new FormAttachment(100,-5);
- cData.top = new FormAttachment(explanationLabel, 10);
+ cData.top = new FormAttachment(serverExplanationLabel, 10);
nameComposite.setLayoutData(cData);
nameComposite.setLayout(new FormLayout());
@@ -132,7 +135,7 @@
// create internal widgets
nameLabel = new Label(nameComposite, SWT.None);
- nameLabel.setText(Messages.wizardFragmentNameLabel);
+ nameLabel.setText(Messages.wf_NameLabel);
nameText = new Text(nameComposite, SWT.BORDER);
name = getDefaultNameText();
@@ -157,7 +160,7 @@
}
private String getDefaultNameText() {
- String base = "JBoss " + getVersion() + " server";
+ String base = Messages.swf_BaseName.replace(Messages.wf_BaseNameVersionReplacement, getVersion());
if( findServer(base) == null ) return base;
int i = 1;
while( ServerCore.findServer(base + " (" + i + ")") != null )
@@ -175,47 +178,89 @@
}
private void createRuntimeGroup(Composite main) {
- // explanation 2
- explanationLabel2 = new Label(main, SWT.NONE);
- explanationLabel2.setText(Messages.serverWizardFragmentExplanation2);
- FormData labelData = new FormData();
- labelData.left = new FormAttachment(0,5);
- labelData.right = new FormAttachment(100, -5);
- labelData.top = new FormAttachment(nameComposite, 15);
- explanationLabel2.setLayoutData(labelData);
-
-
- g = new Group(main, SWT.NONE);
- g.setText(Messages.runtimeInformation);
+ runtimeGroup = new Group(main, SWT.NONE);
+ runtimeGroup.setText(Messages.swf_RuntimeInformation);
FormData groupData = new FormData();
groupData.left = new FormAttachment(0,5);
groupData.right = new FormAttachment(100, -5);
- groupData.top = new FormAttachment(explanationLabel2, 5);
- g.setLayoutData(groupData);
+ groupData.top = new FormAttachment(nameComposite, 5);
+ runtimeGroup.setLayoutData(groupData);
- g.setLayout(new GridLayout(2, false));
+ runtimeGroup.setLayout(new GridLayout(2, false));
GridData d = new GridData(SWT.BEGINNING, SWT.CENTER, true, false);
+ // explanation 2
+ runtimeExplanationLabel = new Label(runtimeGroup, SWT.NONE);
+ runtimeExplanationLabel.setText(Messages.swf_Explanation2);
+ GridData explanationData = new GridData(SWT.BEGINNING, SWT.CENTER, true, false);
+ explanationData.horizontalSpan = 2;
+ runtimeExplanationLabel.setLayoutData(explanationData);
+
// Create our composite
- homeDirLabel = new Label(g, SWT.NONE);
- homeDirLabel.setText(Messages.wizardFragmentHomeDirLabel);
- homeValLabel = new Label(g, SWT.NONE);
+ homeDirLabel = new Label(runtimeGroup, SWT.NONE);
+ homeDirLabel.setText(Messages.wf_HomeDirLabel);
+ homeValLabel = new Label(runtimeGroup, SWT.NONE);
homeValLabel.setLayoutData(d);
- installedJRELabel = new Label(g, SWT.NONE);
- installedJRELabel.setText(Messages.wizardFragmentJRELabel);
- jreValLabel = new Label(g, SWT.NONE);
+ installedJRELabel = new Label(runtimeGroup, SWT.NONE);
+ installedJRELabel.setText(Messages.wf_JRELabel);
+ jreValLabel = new Label(runtimeGroup, SWT.NONE);
d = new GridData(SWT.BEGINNING, SWT.CENTER, true, false);
jreValLabel.setLayoutData(d);
- configLabel = new Label(g, SWT.NONE);
- configLabel.setText("Configuration");
- configValLabel = new Label(g, SWT.NONE);
+ configLabel = new Label(runtimeGroup, SWT.NONE);
+ configLabel.setText(Messages.wf_ConfigLabel);
+ configValLabel = new Label(runtimeGroup, SWT.NONE);
d = new GridData(SWT.BEGINNING, SWT.CENTER, true, false);
configValLabel.setLayoutData(d);
}
+ protected void createAuthenticationGroup(Composite main) {
+ authenticationGroup = new Group(main, SWT.BORDER);
+ authenticationGroup.setText(Messages.swf_AuthenticationGroup);
+ FormData groupData = new FormData();
+ groupData.left = new FormAttachment(0,5);
+ groupData.right = new FormAttachment(100, -5);
+ groupData.top = new FormAttachment(runtimeGroup, 5);
+ authenticationGroup.setLayoutData(groupData);
+
+ authenticationGroup.setLayout(new GridLayout(2, false));
+ GridData d;
+
+ authenticationExplanationLabel = new Label(authenticationGroup, SWT.NONE);
+ authenticationExplanationLabel.setText("Authentication Explanation is long and its also very very long so there");
+ d = new GridData(SWT.BEGINNING, SWT.CENTER, true, false);
+ d.horizontalSpan = 2;
+ authenticationExplanationLabel.setLayoutData(d);
+
+ d = new GridData(SWT.BEGINNING, SWT.CENTER, true, false);
+ d.minimumWidth = 200;
+ usernameLabel = new Label(authenticationGroup, SWT.NONE);
+ usernameLabel.setText(Messages.swf_Username);
+ userText = new Text(authenticationGroup, SWT.BORDER);
+ userText.setLayoutData(d);
+
+ d = new GridData(SWT.BEGINNING, SWT.CENTER, true, false);
+ d.minimumWidth = 200;
+ passLabel = new Label(authenticationGroup, SWT.NONE);
+ passLabel.setText(Messages.swf_Password);
+ passText = new Text(authenticationGroup, SWT.BORDER);
+ passText.setLayoutData(d);
+
+ // listeners
+ passText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ authPass = passText.getText();
+ }
+ });
+ userText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ authUser = userText.getText();
+ }
+ });
+ }
+
private void updateErrorMessage() {
String error = getErrorString();
if( error == null ) {
@@ -227,7 +272,7 @@
private String getErrorString() {
if( findServer(name) != null )
- return Messages.serverNameInUse;
+ return Messages.swf_NameInUse;
return null;
}
@@ -250,7 +295,7 @@
jreValLabel.setText(install.getInstallLocation().getAbsolutePath() + " (" + install.getName() + ")");
runtimeLoc = homeValLabel.getText();
configName = configValLabel.getText();
- g.layout();
+ runtimeGroup.layout();
}
}
@@ -262,7 +307,10 @@
serverWC.setRuntime((IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME));
serverWC.setName(name);
serverWC.setServerConfiguration(null);
- //IServer s = serverWC.save(false, new NullProgressMonitor());
+ if( serverWC instanceof ServerWorkingCopy) {
+ ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_USERNAME, authUser);
+ ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_PASSWORD, authPass);
+ }
IPath configFolder = new Path(runtimeLoc).append("server").append(configName);
XPathModel.getDefault().loadDefaults((IServer)serverWC, configFolder.toOSString());
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/StrippedServerWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/StrippedServerWizardFragment.java 2007-08-21 21:05:27 UTC (rev 3265)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/StrippedServerWizardFragment.java 2007-08-22 00:21:20 UTC (rev 3266)
@@ -52,12 +52,12 @@
nameLabel = new Label(main, SWT.NONE);
nameText = new Text(main, SWT.BORDER);
- nameLabel.setText("Server Name");
+ nameLabel.setText(Messages.serverName);
deployLabel = new Label(main, SWT.NONE);
deployText = new Text(main, SWT.BORDER);
browse = new Button(main, SWT.PUSH);
- deployLabel.setText(Messages.deployDirectory);
+ deployLabel.setText(Messages.sswf_DeployDirectory);
browse.setText(Messages.browse);
FormData lData = new FormData();
@@ -136,7 +136,8 @@
}
public void enter() {
- handle.setTitle("Create a new System Copy Server");
+ //handle.setTitle("Create a new System Copy Server");
+ handle.setTitle(Messages.sswf_Title);
IServer s = (IServer) getTaskModel().getObject(TaskModel.TASK_SERVER);
IServerWorkingCopy swc;
if( s instanceof IServerWorkingCopy)
@@ -190,7 +191,7 @@
}
private String getDefaultNameText() {
- String base = "JBoss deployer";
+ String base = Messages.sswf_BaseName;
if( findServer(base) == null ) return base;
int i = 1;
while( ServerCore.findServer(base + " (" + i + ")") != null )
17 years, 5 months
JBoss Tools SVN: r3265 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-08-21 17:05:27 -0400 (Tue, 21 Aug 2007)
New Revision: 3265
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerBehavior.java
Log:
Organized imports.
Changed behavior API so forceStop(boolean) is public.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java 2007-08-21 21:04:36 UTC (rev 3264)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java 2007-08-21 21:05:27 UTC (rev 3265)
@@ -24,7 +24,6 @@
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.ArrayList;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
@@ -45,11 +44,8 @@
import org.eclipse.wst.server.core.model.IURLProvider;
import org.eclipse.wst.server.core.model.ServerDelegate;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.model.descriptor.XPathCategory;
-import org.jboss.ide.eclipse.as.core.model.descriptor.XPathFileResult;
import org.jboss.ide.eclipse.as.core.model.descriptor.XPathModel;
import org.jboss.ide.eclipse.as.core.model.descriptor.XPathQuery;
-import org.jboss.ide.eclipse.as.core.model.descriptor.XPathFileResult.XPathResultNode;
import org.jboss.ide.eclipse.as.core.runtime.IJBossServerLaunchDefaults;
import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.runtime.server.ServerLaunchDefaults;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerBehavior.java 2007-08-21 21:04:36 UTC (rev 3264)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerBehavior.java 2007-08-21 21:05:27 UTC (rev 3265)
@@ -75,10 +75,11 @@
t.start();
}
- protected void forceStop() {
+ public void forceStop() {
forceStop(true);
}
- protected void forceStop(boolean addEvent) {
+
+ public void forceStop(boolean addEvent) {
// just terminate the process.
try {
if( process != null )
17 years, 5 months
JBoss Tools SVN: r3264 - in trunk/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-08-21 17:04:36 -0400 (Tue, 21 Aug 2007)
New Revision: 3264
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/PollThread.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/events/PollingLabelProvider.java
Log:
Improved error reporting for polling.
Preparation for JBIDE-400
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.java 2007-08-21 19:52:47 UTC (rev 3263)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.java 2007-08-21 21:04:36 UTC (rev 3264)
@@ -4,7 +4,7 @@
* 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
+ * 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.
@@ -21,7 +21,9 @@
*/
package org.jboss.ide.eclipse.as.core.runtime.server.polling;
+import java.io.IOException;
import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
@@ -30,10 +32,18 @@
import java.util.Date;
import java.util.Properties;
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
+import javax.management.ReflectionException;
+import javax.naming.CommunicationException;
import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -52,21 +62,21 @@
public static final String TYPE_TERMINATED = "org.jboss.ide.eclipse.as.core.runtime.server.internal.TwiddlePoller.TYPE_TERMINATED";
public static final String TYPE_RESULT = "org.jboss.ide.eclipse.as.core.runtime.server.internal.TwiddlePoller.TYPE_RESULT";
-
+
public static final int STATE_STARTED = 1;
public static final int STATE_STOPPED = 0;
public static final int STATE_TRANSITION = -1;
-
- private boolean expectedState;
- private int started;
+
+ private int started;
private boolean canceled;
private boolean done;
private IServer server;
private PollingException pollingException = null;
-
+
private EventLogTreeItem event;
- public void beginPolling(IServer server, boolean expectedState, PollThread pt) {
- this.expectedState = expectedState;
+
+ public void beginPolling(IServer server, boolean expectedState,
+ PollThread pt) {
this.canceled = false;
this.done = false;
this.server = server;
@@ -76,101 +86,164 @@
private class PollerRunnable implements Runnable {
public void run() {
- ClassLoader currentLoader = Thread.currentThread().getContextClassLoader();
+ ClassLoader currentLoader = Thread.currentThread()
+ .getContextClassLoader();
ClassLoader twiddleLoader = getClassLoader();
- if( twiddleLoader != null ) {
+ if( pollingException != null ) {done = true; return;}
+ if (twiddleLoader != null) {
int port = ServerConverter.getJBossServer(server).getJNDIPort();
-
+
Thread.currentThread().setContextClassLoader(twiddleLoader);
Properties props = new Properties();
- props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
- props.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
- props.put("java.naming.provider.url","jnp://" + server.getHost() + ":" + port);
-
- setCredentials();
-
- while( !done && !canceled ) {
+ props.put("java.naming.factory.initial",
+ "org.jnp.interfaces.NamingContextFactory");
+ props.put("java.naming.factory.url.pkgs",
+ "org.jboss.naming:org.jnp.interfaces");
+ props.put("java.naming.provider.url", "jnp://"
+ + server.getHost() + ":" + port);
+
+ setCredentials();
+ if( pollingException != null ) {done = true; return;}
+
+ Exception failingException = null;
+ while (!done && !canceled) {
InitialContext ic;
try {
ic = new InitialContext(props);
- Object obj = ic.lookup("jmx/invoker/RMIAdaptor");
- ic.close();
- if( obj instanceof MBeanServerConnection ) {
- MBeanServerConnection connection = (MBeanServerConnection)obj;
- Object attInfo = connection.getAttribute(new ObjectName("jboss.system:type=Server"), "Started");
- boolean b = ((Boolean)attInfo).booleanValue();
- started = b ? STATE_STARTED : STATE_TRANSITION;
- if( b && expectedState )
- done = true;
- }
- } catch( SecurityException se ) {
- pollingException = new PollingSecurityException("Security Exception: " + se.getMessage());
+ Object obj = ic.lookup("jmx/invoker/RMIAdaptor");
+ ic.close();
+ if (obj instanceof MBeanServerConnection) {
+ MBeanServerConnection connection = (MBeanServerConnection) obj;
+ Object attInfo = connection.getAttribute(
+ new ObjectName("jboss.system:type=Server"),
+ "Started");
+ boolean b = ((Boolean) attInfo).booleanValue();
+ started = b ? STATE_STARTED : STATE_TRANSITION;
+ done = b;
+ }
+ } catch (SecurityException se) {
+ pollingException = new PollingSecurityException(
+ "Security Exception: " + se.getMessage());
done = true;
- } catch( Exception e ) {
+ } catch (CommunicationException ce) {
started = STATE_STOPPED;
- if( !expectedState )
- done = true;
+ } catch (NamingException nnfe) {
+ started = STATE_STOPPED;
+ } catch (AttributeNotFoundException e) {
+ failingException = e;
+ } catch (InstanceNotFoundException e) {
+ failingException = e;
+ } catch (MalformedObjectNameException e) {
+ failingException = e;
+ } catch (MBeanException e) {
+ failingException = e;
+ } catch (ReflectionException e) {
+ failingException = e;
+ } catch (NullPointerException e) {
+ failingException = e;
+ } catch (IOException e) {
+ failingException = e;
}
-
+ if( failingException != null ) {
+ pollingException = new PollingException(failingException.getMessage());
+ done = true;
+ }
+
try {
Thread.sleep(500);
} catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
}
- } // end while
+ } // end while
}
-
+
Thread.currentThread().setContextClassLoader(currentLoader);
}
-
+
protected void setCredentials() {
+ Exception temp = null;
try {
- ILaunchConfiguration lc = server.getLaunchConfiguration(true, new NullProgressMonitor());
- String twiddleArgs = lc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS
- + JBossServerLaunchConfiguration.PRGM_ARGS_TWIDDLE_SUFFIX, (String)null);
+ ILaunchConfiguration lc = server.getLaunchConfiguration(true,
+ new NullProgressMonitor());
+ String twiddleArgs = lc
+ .getAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS
+ + JBossServerLaunchConfiguration.PRGM_ARGS_TWIDDLE_SUFFIX,
+ (String) null);
String user = ArgsUtil.getValue(twiddleArgs, "-u", "--user");
- String password = ArgsUtil.getValue(twiddleArgs, "-p", "--password");
+ String password = ArgsUtil.getValue(twiddleArgs, "-p",
+ "--password");
// get our methods
- Class simplePrincipal = Thread.currentThread().getContextClassLoader().loadClass("org.jboss.security.SimplePrincipal");
- Class securityAssoc = Thread.currentThread().getContextClassLoader().loadClass("org.jboss.security.SecurityAssociation");
- securityAssoc.getMethods(); // force-init the methods since the class hasn't been initialized yet.
-
- Constructor newSimplePrincipal = simplePrincipal.getConstructor(new Class[] { String.class });
- Object newPrincipalInstance = newSimplePrincipal.newInstance(new Object[] {user});
-
+ Class simplePrincipal = Thread.currentThread()
+ .getContextClassLoader().loadClass(
+ "org.jboss.security.SimplePrincipal");
+ Class securityAssoc = Thread.currentThread()
+ .getContextClassLoader().loadClass(
+ "org.jboss.security.SecurityAssociation");
+ securityAssoc.getMethods(); // force-init the methods since the
+ // class hasn't been initialized yet.
- // set the principal
- Method setPrincipalMethod = securityAssoc.getMethod("setPrincipal", new Class[] {Principal.class});
- setPrincipalMethod.invoke(null, new Object[] {newPrincipalInstance});
-
- // set the credential
- Method setCredentialMethod = securityAssoc.getMethod("setCredential", new Class[] {Object.class});
- setCredentialMethod.invoke(null, new Object[] {password});
- } catch( Exception e ) {
- e.printStackTrace();
+ Constructor newSimplePrincipal = simplePrincipal
+ .getConstructor(new Class[] { String.class });
+ Object newPrincipalInstance = newSimplePrincipal
+ .newInstance(new Object[] { user });
+
+ // set the principal
+ Method setPrincipalMethod = securityAssoc.getMethod(
+ "setPrincipal", new Class[] { Principal.class });
+ setPrincipalMethod.invoke(null,
+ new Object[] { newPrincipalInstance });
+
+ // set the credential
+ Method setCredentialMethod = securityAssoc.getMethod(
+ "setCredential", new Class[] { Object.class });
+ setCredentialMethod.invoke(null, new Object[] { password });
+ } catch (CoreException e) {
+ temp = e;
+ } catch (ClassNotFoundException e) {
+ temp = e;
+ } catch (SecurityException e) {
+ temp = e;
+ } catch (NoSuchMethodException e) {
+ temp = e;
+ } catch (IllegalArgumentException e) {
+ temp = e;
+ } catch (InstantiationException e) {
+ temp = e;
+ } catch (IllegalAccessException e) {
+ temp = e;
+ } catch (InvocationTargetException e) {
+ temp = e;
}
+ if( temp != null ) {
+ pollingException = new PollingException(temp.getMessage());
+ }
}
+
protected ClassLoader getClassLoader() {
try {
IRuntime rt = server.getRuntime();
IPath loc = rt.getLocation();
- URL url = loc.append("client").append("jbossall-client.jar").toFile().toURI().toURL();
- URL url2 = loc.append("bin").append("twiddle.jar").toFile().toURI().toURL();
- URLClassLoader loader = new URLClassLoader(new URL[] {url, url2}, Thread.currentThread().getContextClassLoader());
+ URL url = loc.append("client").append("jbossall-client.jar")
+ .toFile().toURI().toURL();
+ URL url2 = loc.append("bin").append("twiddle.jar").toFile()
+ .toURI().toURL();
+ URLClassLoader loader = new URLClassLoader(new URL[] { url,
+ url2 }, Thread.currentThread().getContextClassLoader());
return loader;
- } catch( MalformedURLException murle) {
- murle.printStackTrace();
+ } catch (MalformedURLException murle) {
+ pollingException = new PollingException(murle.getMessage());
}
return null;
}
}
+
private void launchJMXPoller() {
PollerRunnable run = new PollerRunnable();
Thread t = new Thread(run, "JMX Poller");
t.start();
}
+
public void cancel(int type) {
canceled = true;
}
@@ -179,28 +252,34 @@
}
public class PollingSecurityException extends PollingException {
- public PollingSecurityException(String msg) {super(msg);}
+ public PollingSecurityException(String msg) {
+ super(msg);
+ }
}
-
- public boolean getState() throws PollingException {
- if( pollingException != null ) throw pollingException;
- if( started == 0 ) return SERVER_DOWN;
- if( started == 1 ) return SERVER_UP;
- if( !done && !canceled )
- return !expectedState; // Not there yet.
+ public boolean getState() throws PollingException {
+ if (pollingException != null)
+ throw pollingException;
+ if (started == 0)
+ return SERVER_DOWN;
+ if (started == 1)
+ return SERVER_UP;
- return expectedState; // done or canceled, doesnt matter
+ if (!done && !canceled)
+ return SERVER_DOWN; // Not there yet.
+
+ return SERVER_UP; // done or canceled, doesnt matter
}
public boolean isComplete() throws PollingException {
- if( pollingException != null )
+ if (pollingException != null)
throw pollingException;
return done;
}
-
+
public class JMXPollerEvent extends EventLogTreeItem {
- public JMXPollerEvent(SimpleTreeItem parent, String type, int status, boolean expectedState) {
+ public JMXPollerEvent(SimpleTreeItem parent, String type, int status,
+ boolean expectedState) {
super(parent, PollThread.SERVER_STATE_MAJOR_TYPE, type);
setProperty(PollThread.EXPECTED_STATE, new Boolean(expectedState));
setProperty(STATUS, new Integer(status));
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/PollThread.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/PollThread.java 2007-08-21 19:52:47 UTC (rev 3263)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/PollThread.java 2007-08-21 21:04:36 UTC (rev 3264)
@@ -138,9 +138,8 @@
// abort and put the message in event log
poller.cancel(IServerStatePoller.CANCEL);
poller.cleanup();
- if( expectedState == IServerStatePoller.SERVER_UP) behavior.stop(true);
- if( expectedState == IServerStatePoller.SERVER_DOWN) behavior.setServerStarted();
alertEventLogPollerException(e);
+ alertBehavior(IServerStatePoller.SERVER_DOWN, false);
return;
}
}
@@ -162,9 +161,8 @@
// abort and put the message in event log
poller.cancel(IServerStatePoller.CANCEL);
poller.cleanup();
- if( expectedState == IServerStatePoller.SERVER_UP) behavior.stop(true);
- if( expectedState == IServerStatePoller.SERVER_DOWN) behavior.setServerStarted();
alertEventLogPollerException(pe);
+ alertBehavior(IServerStatePoller.SERVER_DOWN, false);
return;
}
} else {
@@ -183,13 +181,13 @@
protected void alertBehavior(boolean currentState, boolean finalAlert) {
if( currentState != expectedState ) {
// it didnt work... cancel all processes! force stop
- behavior.stop(true);
+ behavior.forceStop(false);
if( finalAlert ) alertEventLogFailure();
} else {
if( currentState == IServerStatePoller.SERVER_UP )
behavior.setServerStarted();
else {
- behavior.stop(true);
+ behavior.forceStop(false);
}
if( finalAlert ) alertEventLogSuccess(currentState);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-08-21 19:52:47 UTC (rev 3263)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-08-21 21:04:36 UTC (rev 3264)
@@ -287,7 +287,7 @@
id="org.jboss.ide.eclipse.as.core.runtime.server.JMXPoller"
name="JMX Poller"
supportsStartup="true"
- supportsShutdown="true"/>
+ supportsShutdown="false"/>
<serverPoller
class="org.jboss.ide.eclipse.as.core.runtime.server.polling.ProcessTerminatedPoller"
id="org.jboss.ide.eclipse.as.core.runtime.server.processTerminatedPoller"
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/events/PollingLabelProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/events/PollingLabelProvider.java 2007-08-21 19:52:47 UTC (rev 3263)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/events/PollingLabelProvider.java 2007-08-21 21:04:36 UTC (rev 3264)
@@ -148,7 +148,7 @@
}
protected Image getErrorImage() {
- return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
}
public Image getStartedImage() {
return getStateImage(IServer.STATE_STARTED);
17 years, 5 months