JBoss Tools SVN: r2522 - in trunk/documentation/GettingStartedGuide/docs/resources: support/docbook-xsl/html and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: afedosik
Date: 2007-07-19 07:36:51 -0400 (Thu, 19 Jul 2007)
New Revision: 2522
Added:
trunk/documentation/GettingStartedGuide/docs/resources/support/lib/highlight.jar
trunk/documentation/GettingStartedGuide/docs/resources/support/lib/java2html.jar
trunk/documentation/GettingStartedGuide/docs/resources/support/lib/jhighlight-1.0.jar
Modified:
trunk/documentation/GettingStartedGuide/docs/resources/styles/en/html.css
trunk/documentation/GettingStartedGuide/docs/resources/support/docbook-xsl/html/verbatim.xsl
Log:
Automatic code highlighting is added.
Modified: trunk/documentation/GettingStartedGuide/docs/resources/styles/en/html.css
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/resources/styles/en/html.css 2007-07-19 11:04:47 UTC (rev 2521)
+++ trunk/documentation/GettingStartedGuide/docs/resources/styles/en/html.css 2007-07-19 11:36:51 UTC (rev 2522)
@@ -1,122 +1,390 @@
- * {
- font-family: "Verdana", "Arial", "Helvetica";
- font-size: 14px;
- }
-
- A {
- color: #0000CC;
- }
-
- A:active {
- color: #0000CC;
- }
-
- A:visited {
- color: #0000CC;
- }
-
- P, OL, UL, LI, DL, DT, DD, BLOCKQUOTE {
- color: #000000;
- }
-
- TD, TH, SPAN {
- color: #000000;
- }
-
- BLOCKQUOTE {
- margin-right: 0px;
- }
-
-
- H1, H2, H3, H4, H5, H6 {
- color: #003399;
- font-weight: 500;
- margin-top: 10px;
- padding-top: 5px;
- }
-
- H1 { font-size: 150%; }
- H2 { font-size: 140%; }
- H3 { font-size: 110%; font-weight: bold; }
- H4 { font-size: 110%; font-weight: bold;}
- H5 { font-size: 100%; font-style: italic; }
- H6 { font-size: 100%; font-style: italic; }
-
- TABLE {
- border-collapse: collapse;
- border-spacing: 0;
- border: 1px dashed #CCCCCC;
- empty-cells: hide;
- width: 100%
- }
-
- TD {
- padding: 4pt;
- }
-
-
- TT {
- font-size: 90%;
- font-style: monospace;
- color: #111111;
- }
-
- PRE {
- font-size: 100%;
- padding: 5px;
- border-style: solid;
- border-width: 1px;
- border-color: #CCCCCC;
- background-color: #F4F4F4;
- }
-
- HR {
- width: 100%;
- height: 1px;
- background-color: #CCCCCC;
- border-width: 0px;
- padding: 0px;
- color: #CCCCCC;
- }
-
- .variablelist {
- padding-top: 10;
- padding-bottom: 10;
- margin: 0;
- }
-
- .itemizedlist {
- padding-top: 0;
- padding-bottom: 0;
- margin: 0;
- list-style-type: disc;
-
- }
-
- .orderedlist{
- padding-top: 0;
- padding-bottom: 0;
- margin: 0;
- }
-
- .term {
- font-weight: bold;
- }
-
- .note
- {
- padding-bottom: 5px;
- padding-left: 5px;
- padding-right: 5px;
- background-color: #FFFFCC;
- }
-
- .warning
- {
- padding-bottom: 5px;
- padding-left: 5px;
- padding-right: 5px;
- background-color: #FBDADA;
- }
-
-
+* {
+font-family:verdana, helvetica, sans-serif;
+line-height:20px;
+}
+
+div.navheader table {
+margin:0px;
+border:0px;
+}
+
+div.navfooter table {
+margin:0px;
+border:0px;
+}
+
+
+A {
+ FONT-SIZE: 12px;
+ COLOR: #2A7BD4;
+ FONT-FAMILY: verdana, helvetica, sans-serif;
+}
+
+A:hover {
+ FONT-SIZE: 12px;
+ COLOR: #003399;
+ FONT-FAMILY: verdana, helvetica, sans-serif
+}
+
+A:visited {
+ font-family:verdana, helvetica, sans-serif;
+ color: #888888;
+ font-size:12px;
+}
+
+P, OL, UL, LI, DL, DT, DD, BLOCKQUOTE {
+ color: #000000;
+ font-size:12px;
+}
+
+TD, TH, SPAN {
+ color: #000000;
+}
+
+SPAN.property {
+ font-family: Verdana, Helvetica, sans-serif;
+ color: #008CCA;
+}
+
+SPAN.italic {
+ font-family: Verdana, Helvetica, sans-serif;
+ font-style:italic;
+
+}
+
+SPAN.bold {
+ font-family: Verdana, Helvetica, sans-serif;
+ font-style:bold;
+}
+
+BLOCKQUOTE {
+ margin-right: 0px;
+}
+
+div.titlepage div.mediaobject{
+text-align:center;
+}
+
+div.mediaobject, div.mediaobject img{
+text-align:left;
+
+}
+
+H1 {
+ color: #FF6600;
+ padding-top:30px;
+ MARGIN-TOP: 0px;
+ FONT-SIZE: 22px;
+ PADDING-TOP: 15px;
+}
+
+H2 {
+ MARGIN-TOP: 10px;
+ FONT-SIZE: 18px;
+ COLOR: #2A7BD4;
+ PADDING-TOP: 20px
+}
+
+H3 {
+ MARGIN-TOP: 15px;
+ FONT-SIZE: 16px;
+ COLOR: #000000;
+ PADDING-TOP: 5px
+}
+
+H4 {
+ MARGIN-TOP: 10px;
+ FONT-SIZE: 12px;
+ COLOR: #000000;
+ PADDING-TOP: 15px
+}
+H5 {
+ MARGIN-TOP: 10px;
+ FONT-SIZE: 12px;
+ COLOR: #000000;
+ PADDING-TOP: 15px
+}
+
+H6 {
+ MARGIN-TOP: 10px;
+ FONT-SIZE: 12px;
+ COLOR: #000000;
+ PADDING-TOP:15px;
+}
+
+div.note {
+ FONT-SIZE: 12px;
+ Color:#000000;
+ width:500px;
+ text-align:justify;
+ font-family:Verdana, Arial, Helvetica, sans-serif;
+ border-style:solid;
+ border-width:1px;
+ border-left-color:#CCCCCC;
+ border-top-color:#CCCCCC;
+ border-right-color: #CCCCCC;
+ border-bottom-color: #CCCCCC;
+ background-color: #F4F4F4;
+ PADDING-LEFT:1em;
+ PADDING-RIGHT:1em;
+ PADDING-TOP:0px;
+ PADDING-BOTTOM:0px;
+ MARGIN-BOTTOM:0px;
+ MARGIN-TOP:0px;
+}
+
+.note .title, .important .title {
+MARGIN-BOTTOM:0px;
+MARGIN-TOP:0px;
+MARGIN-BOTTOM:0px;
+MARGIN-TOP:0px;
+PADDING-LEFT:0px;
+PADDING-RIGHT:0px;
+PADDING-TOP:1em;
+PADDING-BOTTOM:5px;
+}
+
+.note p, .important p {
+ PADDING-TOP:0px;
+ PADDING-BOTTOM:0px;
+ MARGIN-BOTTOM:1em;
+ MARGIN-TOP:0px;
+}
+
+div.important {
+ FONT-SIZE: 12px;
+ Color:#000000;
+ width:500px;
+ text-align:justify;
+ font-family:Verdana, Arial, Helvetica, sans-serif;
+ border-style:solid;
+ border-width:1px;
+ border-left-color:#2A7BD4;
+ border-top-color:#2A7BD4;
+ border-right-color:#2A7BD4;
+ border-bottom-color:#2A7BD4;
+ PADDING-LEFT:1em;
+ PADDING-RIGHT:1em;
+ PADDING-TOP:0px;
+ PADDING-BOTTOM:0px;
+ MARGIN-BOTTOM:0px;
+ MARGIN-TOP:0px;
+}
+
+
+TABLE {
+ font-family:Verdana, Arial, Helvetica, sans-serif;
+ font-size:12px;
+ text-align:justify;
+ border-collapse: collapse;
+ border-spacing:0;
+ border-bottom-width:1px;
+ border-top-width:1px;
+ border-left-width:1px;
+ border-right-width:1px;
+ border-left-color:#d8e7f8;
+ border-right-color:#d8e7f8;
+ border-top-color:#CCCCCC;
+ border-bottom-color:#CCCCCC;
+ empty-cells: hide;
+ border-style: solid;
+}
+
+.table TH {
+ background-color:#d8e7f8;
+ text-align:center;
+ white-space:nowrap;
+}
+
+ul, li {
+list-style-type: disc;
+
+list-style-position:inside;
+}
+
+div.table {
+ width:800px;
+}
+
+
+TD {
+ padding: 4pt;
+}
+
+
+H1 { font-size: 140%; }
+H2 { font-size: 120%; }
+H3 { font-size: 100%; }
+H4 { font-size: 100%; }
+H5 { font-size: 100%; }
+H6 { font-size: 100%; }
+
+p.copyright {
+ text-align:center
+}
+
+
+TT {
+font-size: 90%;
+ font-family: "Courier New", Courier, monospace;
+ color: #000000;
+}
+
+dl, dt, dd{margin-left : 8; margin-bottom : 6;}
+
+PRE {
+
+ font-family:Verdana, Arial, Helvetica, sans-serif;
+ font-size: 11px;
+ padding: 5px;
+ border-style: solid;
+ border-width: 1px;
+ border-left-color:#2A7BD4;
+ border-top-color:#2A7BD4;
+ border-right-color: #CCCCCC;
+ border-bottom-color: #CCCCCC;
+ background-color: #F4F4F4;
+ width:800px;
+}
+
+UL LI {
+ PADDING-LEFT: 20px; LIST-STYLE-TYPE: disc
+}
+
+OL LI {
+ PADDING-LEFT: 20px; LIST-STYLE-TYPE: decimal
+}
+
+HR {
+ BORDER-TOP-WIDTH: 0px;
+ PADDING-RIGHT: 0px;
+ PADDING-LEFT: 0px;
+ BORDER-LEFT-WIDTH: 0px;
+ BORDER-BOTTOM-WIDTH: 0px;
+ PADDING-BOTTOM: 0px;
+ WIDTH: 100%;
+ COLOR: #cccccc;
+ PADDING-TOP: 0px;
+ HEIGHT: 1px;
+ BACKGROUND-COLOR: #cccccc;
+ BORDER-RIGHT-WIDTH: 0px
+}
+
+.variablelist {
+ padding-top: 10px;
+ padding-bottom:10px;
+ margin:0;
+}
+
+.itemizedlist, UL {
+ font-family:Verdana, Arial, Helvetica, sans-serif;
+ font-size:12px;
+ padding-top: 0;
+ padding-bottom:0;
+ margin:0;
+ text-align:justify;
+}
+
+.itemizedlist, li {
+list-style-position:outside;
+}
+
+.term {
+ font-weight:bold;
+}
+
+pre.JAVA, pre.XML, pre.JSP, pre.XHTML {
+ line-height:0px;
+}
+
+.java_type {
+color:#008CCA;
+}
+.java_keyword {
+color: rgb(0,0,0); font-weight: bold;
+}
+.java_javadoc_comment {
+color: rgb(147,147,147); background-color: rgb(247,247,247); font-style: italic;
+}
+.java_comment {
+color: rgb(147,147,147); background-color: rgb(247,247,247);
+}
+.java_operator {
+color: #003399;
+}
+.java_plain {
+color: rgb(0,0,0);
+}
+.java_literal {
+color:#FF6600;
+}
+pre code {
+ color: rgb(0,0,0); font-family: monospace; font-size: 12px; white-space: nowrap;
+}
+.java_javadoc_tag {
+color: rgb(147,147,147); background-color: rgb(247,247,247); font-style: italic; font-weight: bold;
+}
+.java_separator {
+color:#008CCA;
+}
+.xml_plain {
+color: rgb(0,0,0);
+}
+.xml_tag_name {
+color: #008CCA;
+}
+.xml_comment {
+color: rgb(147,147,147); background-color: rgb(247,247,247);
+}
+.xml_tag_symbols {
+color:#008CCA;
+}
+.xml_rife_tag {
+color: rgb(0,0,0); background-color: rgb(228,230,160);
+}
+.xml_attribute_value {
+color:#FF6600
+}
+
+.xml_attribute_name {
+color: rgb(0,0,0); font-weight: bold;
+}
+.xml_char_data {
+color: rgb(0,0,0);
+}
+.xml_rife_name {
+color:#008CCA; background-color: rgb(228,230,160);
+}
+.xml_processing_instruction {
+color: rgb(0,0,0); font-weight: bold; font-style: italic;
+}
+
+.book .titlepage .title {
+ text-align:center;
+}
+
+.book .chapter .title {
+ text-align:left;
+}
+
+td.java, td.java-ln {vertical-align:top; line-height:10px;}
+tt.java, tt.java-ln, pre.java, pre.java-ln {line-height:1em; margin-bottom:0em;line-height:10px;}
+td.java-ln { text-align:right; line-height:10px;}
+tt.java-ln, pre.java-ln { color:#888888; line-height:10px;}
+/* Background */ span.java0 { font-size: 8pt; color:#ffffff; line-height:10px;}
+/* Line numbers */ span.java1 { font-size: 8pt; color:#808080; }
+/* Multi-line comments */ span.java2 { font-size: 8pt; color:#3f7f5f; line-height:10px;}
+/* Single-line comments */ span.java3 { font-size: 8pt; color:#3f7f5f; line-height:10px;}
+/* Keywords */ span.java4 { font-size: 8pt; color:#FF6600; font-weight:bold; line-height:10px;}
+/* Strings */ span.java5 { font-size:8pt; color:#2a00ff; line-height:10px;}
+/* Character constants */ span.java6 { font-size: 8pt; color:#990000; line-height:10px;}
+/* Numeric constants */ span.java7 { font-size: 8pt; color:#990000; line-height:10px;}
+/* Parenthesis */ span.java8 { font-size: 8pt; color:#000000; line-height:10px;}
+/* Primitive Types */ span.java9 { font-size: 8pt; color:#FF6600; font-weight:bold; line-height:10px;}
+/* Others */ span.java10 { font-size: 8pt; color:#000000; line-height:10px;}
+/* Javadoc keywords */ span.java11 { font-size: 8pt; color:#7f9fbf; line-height:10px;}
+/* Javadoc HTML tags */ span.java12 { font-size: 8pt; color:#7f7f9f; line-height:10px;}
+/* Javadoc links */ span.java13 { font-size: 8pt; color:#3f3fbf; line-height:10px;}
+/* Javadoc others */ span.java14 { font-size: 8pt; color:#3f5fbf; line-height:10px;}
+/* Undefined */ span.java15 { font-size: 8pt; color:#ff6100; line-height:10px;}
+/* Annotation */ span.java16 { font-size: 8pt; color:#646464; line-height:10px;}
\ No newline at end of file
Modified: trunk/documentation/GettingStartedGuide/docs/resources/support/docbook-xsl/html/verbatim.xsl
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/resources/support/docbook-xsl/html/verbatim.xsl 2007-07-19 11:04:47 UTC (rev 2521)
+++ trunk/documentation/GettingStartedGuide/docs/resources/support/docbook-xsl/html/verbatim.xsl 2007-07-19 11:36:51 UTC (rev 2522)
@@ -66,6 +66,18 @@
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+
+ <xsl:template match="programlisting[@role='XML']|programlisting[@role='JAVA']|programlisting[@role='XHTML']|programlisting[@role='JSP']">
+ <xsl:variable name="kidz">
+ <xsl:apply-templates></xsl:apply-templates>
+ </xsl:variable>
+ <pre class="{@role}">
+ <xsl:value-of
+ select="javahl:highlight(string($kidz), attribute::role)"
+ xmlns:javahl="java:com.exadel.docbook.colorer.HighLighter"
+ disable-output-escaping="yes"/>
+ </pre>
+ </xsl:template>
<xsl:template match="literallayout">
<xsl:param name="suppress-numbers" select="'0'"/>
Added: trunk/documentation/GettingStartedGuide/docs/resources/support/lib/highlight.jar
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/resources/support/lib/highlight.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/resources/support/lib/java2html.jar
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/resources/support/lib/java2html.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/resources/support/lib/jhighlight-1.0.jar
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/resources/support/lib/jhighlight-1.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 5 months
JBoss Tools SVN: r2521 - trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editors.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-19 07:04:47 -0400 (Thu, 19 Jul 2007)
New Revision: 2521
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editors/TLDCompoundEditor.java
Log:
JBIDE-541
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editors/TLDCompoundEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editors/TLDCompoundEditor.java 2007-07-19 10:51:23 UTC (rev 2520)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editors/TLDCompoundEditor.java 2007-07-19 11:04:47 UTC (rev 2521)
@@ -39,4 +39,9 @@
return super.getAdapter(adapter);
}
+
+ protected String[] getSupportedNatures() {
+ return new String[0];
+ }
+
}
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2520 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-19 06:51:23 -0400 (Thu, 19 Jul 2007)
New Revision: 2520
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/PropertiesCompoundEditor.java
Log:
JBIDE-541
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/PropertiesCompoundEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/PropertiesCompoundEditor.java 2007-07-19 10:50:53 UTC (rev 2519)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/PropertiesCompoundEditor.java 2007-07-19 10:51:23 UTC (rev 2520)
@@ -101,4 +101,8 @@
}
}
+ protected String[] getSupportedNatures() {
+ return new String[0];
+ }
+
}
17 years, 5 months
JBoss Tools SVN: r2519 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-19 06:50:53 -0400 (Thu, 19 Jul 2007)
New Revision: 2519
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/FacesConfigEditor.java
Log:
JBIDE-541
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/FacesConfigEditor.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/FacesConfigEditor.java 2007-07-19 10:39:13 UTC (rev 2518)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/FacesConfigEditor.java 2007-07-19 10:50:53 UTC (rev 2519)
@@ -40,7 +40,7 @@
return !entity.startsWith(JSFConstants.ENT_FACESCONFIG);
}
protected void doCreatePages() {
- if (isAppropriateNature()) {
+ if (isAppropriateNature() || true /* JBIDE-541 */) {
createGuiPage();
treeFormPage = createTreeFormPage();
treeFormPage.setTitle(JSFUIMessages.FACES_CONFIG_EDITOR);
17 years, 5 months
JBoss Tools SVN: r2518 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-19 06:39:13 -0400 (Thu, 19 Jul 2007)
New Revision: 2518
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java
Log:
JBIDE-567
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java 2007-07-19 10:25:19 UTC (rev 2517)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java 2007-07-19 10:39:13 UTC (rev 2518)
@@ -169,11 +169,11 @@
if (border!=null) {
BorderedControl borderedControl = new BorderedControl(parent, SWT.NONE, border);
comboField = new CCombo(borderedControl, style);
+ comboField.setBackground(bg);
} else {
comboField = new CCombo(parent, style);
}
comboField.setFont(font);
-/// comboField.setBackground(bg);
comboField.setForeground(fg);
String[] tags = getTags();
@@ -416,7 +416,7 @@
Color bg;
if (enabled) {
bg = getSettings().getColor("Combo.Background");
- if (bg==null) bg = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
+ if (bg==null) bg = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
} else {
bg = getSettings().getColor("Combo.Background.Disabled");
if (bg==null) bg = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
17 years, 5 months
JBoss Tools SVN: r2517 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors: model and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-19 06:25:19 -0400 (Thu, 19 Jul 2007)
New Revision: 2517
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Groups.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
Log:
http://jira.jboss.com/jira/browse/EXIN-365
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Groups.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Groups.java 2007-07-19 10:09:03 UTC (rev 2516)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Groups.java 2007-07-19 10:25:19 UTC (rev 2517)
@@ -175,6 +175,10 @@
if(c >= yDeltas.length) continue;
int sz = items[i].outputs.length - 1;
if(sz > yDeltas[c]) yDeltas[c] = sz;
+ int[] shape = items[i].getObject().getShape();
+ if(shape == null || shape.length < 4) continue;
+ int wi = (shape[3] - (constants.deltaY / 2)) / constants.incY;
+ if(wi > yDeltas[c]) yDeltas[c] = wi;
}
for (int i = 1; i < yDeltas.length; i++) yDeltas[i] += yDeltas[i - 1];
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-19 10:09:03 UTC (rev 2516)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-19 10:25:19 UTC (rev 2517)
@@ -373,6 +373,10 @@
}
}
+ public void update(){
+ firePropertyChange(REFRESH, null, null);
+ }
+
protected Configuration getConfiguration() {
return configuration;
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2007-07-19 10:09:03 UTC (rev 2516)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2007-07-19 10:25:19 UTC (rev 2517)
@@ -121,8 +121,8 @@
if (getCastedModel().getOrmElement() instanceof RootClass) {
RootClass persistentClass = (RootClass) getCastedModel()
.getOrmElement();
- ormShape = (OrmShape) hashMap
- .remove(persistentClass.getEntityName());
+ ormShape = (OrmShape) hashMap.remove(persistentClass
+ .getEntityName());
if (ormShape != null) {
ormShape.setLocation(new Point(20, 20));
tempPoint = 40 + getChildrenFigurePreferredHeight(ormShape);
@@ -272,38 +272,43 @@
}
}
+ class DiagramInfo implements IDiagramInfo {
-class DiagramInfo implements IDiagramInfo {
+ ArrayList items = new ArrayList();
+ OrmDiagram diagram;
- ArrayList items = new ArrayList();
- OrmDiagram diagram;
+ public DiagramInfo(OrmDiagram diagram) {
+ IItemInfo item;
+ this.diagram = diagram;
+ OrmShapeEditPart part;
- public DiagramInfo(OrmDiagram diagram) {
- IItemInfo item;
- this.diagram = diagram;
+ for (int i = 0; i < diagram.getChildren().size(); i++) {
+ part = (OrmShapeEditPart) getViewer().getEditPartRegistry()
+ .get(diagram.getChildren().get(i));
+ if (part != null && part.getFigure().isVisible()) {
+ item = new DiagramElementInfo((OrmShape) diagram
+ .getChildren().get(i));
+ addItem(item);
+ }
+ }
+ }
- for (int i = 0; i < diagram.getChildren().size(); i++) {
- item = new DiagramElementInfo((OrmShape) diagram.getChildren().get(
- i));
- addItem(item);
+ /**
+ *
+ */
+ public IItemInfo[] getItems() {
+ return (IItemInfo[]) items.toArray(new IItemInfo[0]);
}
- }
- /**
- *
- */
- public IItemInfo[] getItems() {
- return (IItemInfo[]) items.toArray(new IItemInfo[0]);
+ /**
+ *
+ * @param item
+ */
+ public void addItem(IItemInfo item) {
+ items.add(item);
+ }
}
- /**
- *
- * @param item
- */
- public void addItem(IItemInfo item) {
- items.add(item);
- }
-
class DiagramElementInfo implements IItemInfo {
OrmShape element;
@@ -357,14 +362,15 @@
int[] shape = new int[4];
shape[0] = element.getLocation().x;
shape[1] = element.getLocation().y;
- OrmShapeEditPart part = (OrmShapeEditPart)getViewer().getEditPartRegistry().get(element);
- if(part != null){
+ OrmShapeEditPart part = (OrmShapeEditPart) getViewer()
+ .getEditPartRegistry().get(element);
+ if (part != null) {
IFigure fig = part.getFigure();
shape[2] = fig.getPreferredSize().width;
shape[3] = fig.getPreferredSize().height;
- }else{
- shape[2] = 600;
- shape[3] = 100;
+ } else {
+ shape[2] = 6000;
+ shape[3] = 1000;
}
return shape;
}
@@ -432,4 +438,4 @@
public void setLinkShape(int[] vs) {
}
}
-}}
+}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java 2007-07-19 10:09:03 UTC (rev 2516)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java 2007-07-19 10:25:19 UTC (rev 2517)
@@ -109,6 +109,7 @@
}
}
referenceList.remove(refShape);
+ shape.getOrmDiagram().update();
}
private boolean isReferencesCorrect(OrmShape shape){
17 years, 5 months
JBoss Tools SVN: r2516 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-19 06:09:03 -0400 (Thu, 19 Jul 2007)
New Revision: 2516
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/BeanType.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/Util.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ValueInfo.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java
Log:
JBIDE-579
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/BeanType.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/BeanType.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/BeanType.java 2007-07-19 10:09:03 UTC (rev 2516)
@@ -0,0 +1,32 @@
+package org.jboss.tools.seam.core;
+
+import org.jboss.tools.seam.internal.core.scanner.java.SeamAnnotations;
+
+public enum BeanType implements SeamAnnotations {
+ ENTITY(ENTITY_ANNOTATION_TYPE, ScopeType.CONVERSATION, "entity"),
+ STATEFUL(STATEFUL_ANNOTATION_TYPE, ScopeType.CONVERSATION, "stateful"),
+ STATELESS(STATELESS_ANNOTATION_TYPE, ScopeType.STATELESS, "stateless"),
+ MESSAGE_DRIVEN(MESSAGE_DRIVEN_ANNOTATION_TYPE, ScopeType.STATELESS, "message-driven");
+
+ String annotationType;
+ ScopeType defaultScope;
+ String path;
+ BeanType(String annotationType,ScopeType defaultScope, String path) {
+ this.annotationType = annotationType;
+ this.defaultScope = defaultScope;
+ this.path = path;
+ }
+
+ public String getAnnotationType() {
+ return annotationType;
+ }
+
+ ScopeType getDefaultScope() {
+ return defaultScope;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java 2007-07-19 07:52:31 UTC (rev 2515)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java 2007-07-19 10:09:03 UTC (rev 2516)
@@ -61,6 +61,12 @@
public void removeBijectedAttribute(IBijectedAttribute attribute);
/**
+ * @param type
+ * @return true if class is marked with annotation referenced in type
+ */
+ public boolean isOfType(BeanType type);
+
+ /**
* @return true if class marked as Stateful
*/
public boolean isStateful();
@@ -71,11 +77,6 @@
public boolean isEntity();
/**
- * Set true if class marked as Entity
- */
- public void setEntity(boolean entity);
-
- /**
* @return roles of component which defined in this component class
*/
public Set<IRole> getRoles();
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-07-19 07:52:31 UTC (rev 2515)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-07-19 10:09:03 UTC (rev 2516)
@@ -55,7 +55,7 @@
if(f instanceof BijectedAttribute) {
BijectedAttribute sf = (BijectedAttribute)f;
if(!typesAreEqual(types, sf.types)) {
- changes = Change.addChange(changes, new Change(this, ISeamXmlComponentDeclaration.NAME, name, f.name));
+ changes = Change.addChange(changes, new Change(this, "types", types, sf.types));
this.types = sf.types;
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-19 07:52:31 UTC (rev 2515)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-19 10:09:03 UTC (rev 2516)
@@ -9,6 +9,7 @@
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.ui.JavaUI;
+import org.jboss.tools.seam.core.BeanType;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.IRole;
@@ -31,8 +32,7 @@
protected String className = null;
protected ScopeType scopeType = ScopeType.UNSPECIFIED;
- protected boolean stateful = false;
- protected boolean entity = false;
+ Map<BeanType, IValueInfo> types = null;
protected int precedence = SeamComponentPrecedenceType.DEFAULT;
protected IType type;
@@ -46,7 +46,16 @@
}
public ScopeType getScope() {
- return scopeType;
+ if(scopeType != null && scopeType != ScopeType.UNSPECIFIED) {
+ return scopeType;
+ }
+ if(isEntity() || isStateful()) {
+ return ScopeType.CONVERSATION;
+ }
+ if(isOfType(BeanType.STATELESS) || isOfType(BeanType.MESSAGE_DRIVEN)) {
+ return ScopeType.STATELESS;
+ }
+ return ScopeType.EVENT;
}
public void setScope(String scope) {
@@ -131,18 +140,18 @@
return roles;
}
+ public boolean isOfType(BeanType type) {
+ return types != null && types.containsKey(type);
+ }
+
public boolean isEntity() {
- return entity;
+ return isOfType(BeanType.ENTITY);
}
public boolean isStateful() {
- return stateful;
+ return isOfType(BeanType.STATEFUL);
}
- public void setStateful(boolean b) {
- stateful = b;
- }
-
public void removeBijectedAttribute(IBijectedAttribute attribute) {
bijectedAttributes.remove(attribute);
}
@@ -155,10 +164,6 @@
roles.remove(role);
}
- public void setEntity(boolean entity) {
- this.entity = entity;
- }
-
public IMember getSourceMember() {
return type;
}
@@ -186,14 +191,11 @@
}
if(type != jd.type) type = jd.type;
- if(stateful != jd.stateful) {
- changes = Change.addChange(changes, new Change(this, "stateful", stateful, jd.stateful));
- stateful = jd.stateful;
+ if(!typesAreEqual(types, jd.types)) {
+ changes = Change.addChange(changes, new Change(this, "types", types, jd.types));
}
- if(entity != jd.entity) {
- changes = Change.addChange(changes, new Change(this, "entity", entity, jd.entity));
- entity = jd.entity;
- }
+ this.types = jd.types;
+
Change children = new Change(this, null, null, null);
mergeComponentMethods(jd, children);
@@ -305,6 +307,16 @@
}
+ boolean typesAreEqual(Map<BeanType, IValueInfo> types1, Map<BeanType, IValueInfo> types2) {
+ if(types1 == null || types2 == null) return types2 == types1;
+ if(types1.size() != types2.size()) return false;
+ for (BeanType t : types1.keySet()) {
+ if(!types2.containsKey(t)) return false;
+ }
+ return true;
+
+ }
+
/**
* @see org.jboss.tools.seam.core.ISeamJavaComponentDeclaration#getPrecedence()
*/
@@ -333,17 +345,11 @@
//ignore - exact value is stored in ValueInfo
}
}
-
- public void setEntity(IValueInfo value) {
- attributes.put("entity", value);
- setEntity(value != null && "true".equals(value.getValue()));
+
+ public void setTypes(Map<BeanType, IValueInfo> types) {
+ this.types = types;
}
- public void setStateful(IValueInfo value) {
- attributes.put("stateful", value);
- setStateful(value != null && "true".equals(value.getValue()));
- }
-
public Set<ISeamContextVariable> getDeclaredVariables() {
Set<ISeamContextVariable> set = new HashSet<ISeamContextVariable>();
set.addAll(roles);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/Util.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/Util.java 2007-07-19 07:52:31 UTC (rev 2515)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/Util.java 2007-07-19 10:09:03 UTC (rev 2516)
@@ -26,6 +26,8 @@
EJB_ANNOTATION_TYPES.add(STATEFUL_ANNOTATION_TYPE);
EJB_ANNOTATION_TYPES.add(ENTITY_ANNOTATION_TYPE);
EJB_ANNOTATION_TYPES.add(REMOVE_ANNOTATION_TYPE);
+ EJB_ANNOTATION_TYPES.add(STATELESS_ANNOTATION_TYPE);
+ EJB_ANNOTATION_TYPES.add(MESSAGE_DRIVEN_ANNOTATION_TYPE);
}
/**
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-19 07:52:31 UTC (rev 2515)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-19 10:09:03 UTC (rev 2516)
@@ -28,8 +28,10 @@
import org.eclipse.jdt.core.dom.NormalAnnotation;
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
import org.eclipse.jdt.core.dom.VariableDeclaration;
+import org.jboss.tools.seam.core.BeanType;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.SeamComponentMethodType;
import org.jboss.tools.seam.internal.core.BijectedAttribute;
import org.jboss.tools.seam.internal.core.Role;
@@ -85,21 +87,26 @@
component.setScope(scope);
} else if(INSTALL_ANNOTATION_TYPE.equals(type)) {
component.setPrecedence(ValueInfo.getValueInfo(as[i].getAnnotation(), "precedence"));
- } else if(STATEFUL_ANNOTATION_TYPE.equals(type)) {
- ValueInfo stateful = new ValueInfo();
- stateful.value = "true";
- stateful.valueStartPosition = as[i].getAnnotation().getStartPosition();
- stateful.valueLength = as[i].getAnnotation().getLength();
- component.setStateful(stateful);
- } else if(ENTITY_ANNOTATION_TYPE.equals(type)) {
- ValueInfo entity = new ValueInfo();
- entity.value = "true";
- entity.valueStartPosition = as[i].getAnnotation().getStartPosition();
- entity.valueLength = as[i].getAnnotation().getLength();
- component.setEntity(entity);
}
}
+ if(as != null) {
+ Map<BeanType, IValueInfo> types = new HashMap<BeanType, IValueInfo>();
+ for (int i = 0; i < BeanType.values().length; i++) {
+ Annotation a = findAnnotation(annotatedType, BeanType.values()[i].getAnnotationType());
+ if(a != null) {
+ ValueInfo v = new ValueInfo();
+ v.value = "true";
+ v.valueStartPosition = a.getStartPosition();
+ v.valueLength = a.getLength();
+ types.put(BeanType.values()[i], v);
+ }
+ }
+ if(types.size() > 0) {
+ component.setTypes(types);
+ }
+ }
+
processFactories();
processBijections();
processComponentMethods();
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java 2007-07-19 07:52:31 UTC (rev 2515)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java 2007-07-19 10:09:03 UTC (rev 2516)
@@ -41,5 +41,7 @@
public static String ENTITY_ANNOTATION_TYPE = "javax.persistence.Entity";
public static String STATEFUL_ANNOTATION_TYPE = "javax.ejb.Stateful";
+ public static String STATELESS_ANNOTATION_TYPE = "javax.ejb.Stateless";
+ public static String MESSAGE_DRIVEN_ANNOTATION_TYPE = "javax.ejb.MessageDriven";
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ValueInfo.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ValueInfo.java 2007-07-19 07:52:31 UTC (rev 2515)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ValueInfo.java 2007-07-19 10:09:03 UTC (rev 2516)
@@ -78,5 +78,9 @@
}
return exp.toString();
}
+
+ public void setValue(String value) {
+ this.value = value;
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-19 07:52:31 UTC (rev 2515)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-19 10:09:03 UTC (rev 2516)
@@ -22,7 +22,9 @@
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
+import org.jboss.tools.seam.core.BeanType;
import org.jboss.tools.seam.core.BijectedAttributeType;
+import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.AbstractContextVariable;
import org.jboss.tools.seam.internal.core.BijectedAttribute;
@@ -31,6 +33,7 @@
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
import org.jboss.tools.seam.internal.core.scanner.Util;
import org.jboss.tools.seam.internal.core.scanner.java.SeamAnnotations;
+import org.jboss.tools.seam.internal.core.scanner.java.ValueInfo;
/**
* Loads seam components from Class object.
@@ -124,15 +127,22 @@
Object precedence = getValue(a, "precedence");
if(precedence instanceof Integer) component.setPrecedence((Integer)precedence);
}
- a = map.get(STATEFUL_ANNOTATION_TYPE);
+ }
+
+ Map<BeanType, IValueInfo> types = new HashMap<BeanType, IValueInfo>();
+ for (int i = 0; i < BeanType.values().length; i++) {
+ BeanType t = BeanType.values()[i];
+ Annotation a = map.get(t.getAnnotationType());
if(a != null) {
- component.setStateful(true);
+ ValueInfo v = new ValueInfo();
+ v.setValue("true");
+ types.put(t, v);
}
- a = map.get(ENTITY_ANNOTATION_TYPE);
- if(a != null) {
- component.setEntity(true);
- }
}
+ if(types.size() > 0) {
+ component.setTypes(types);
+ }
+
Method[] ms = null;
try {
ms = cls.getMethods();
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java 2007-07-19 07:52:31 UTC (rev 2515)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java 2007-07-19 10:09:03 UTC (rev 2516)
@@ -22,7 +22,9 @@
import org.eclipse.jdt.internal.compiler.impl.Constant;
import org.eclipse.jdt.internal.compiler.impl.IntConstant;
import org.eclipse.jdt.internal.compiler.impl.StringConstant;
+import org.jboss.tools.seam.core.BeanType;
import org.jboss.tools.seam.core.BijectedAttributeType;
+import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.AbstractContextVariable;
import org.jboss.tools.seam.internal.core.BijectedAttribute;
@@ -31,6 +33,7 @@
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
import org.jboss.tools.seam.internal.core.scanner.Util;
import org.jboss.tools.seam.internal.core.scanner.java.SeamAnnotations;
+import org.jboss.tools.seam.internal.core.scanner.java.ValueInfo;
public class TypeScanner implements SeamAnnotations {
@@ -135,15 +138,23 @@
//ignore
}
}
- a = map.get(STATEFUL_ANNOTATION_TYPE);
+ }
+
+ Map<BeanType, IValueInfo> types = new HashMap<BeanType, IValueInfo>();
+ for (int i = 0; i < BeanType.values().length; i++) {
+ BeanType t = BeanType.values()[i];
+ IBinaryAnnotation a = map.get(t.getAnnotationType());
if(a != null) {
- component.setStateful(true);
+ ValueInfo v = new ValueInfo();
+ v.setValue("true");
+ types.put(t, v);
}
- a = map.get(ENTITY_ANNOTATION_TYPE);
- if(a != null) {
- component.setEntity(true);
- }
}
+ if(types.size() > 0) {
+ component.setTypes(types);
+ }
+
+
IBinaryMethod[] ms = null;
try {
ms = cls.getMethods();
17 years, 5 months
JBoss Tools SVN: r2515 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-19 03:52:31 -0400 (Thu, 19 Jul 2007)
New Revision: 2515
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ListEntries.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/LocaleConfigForm.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ManagedBeanPropertyForm.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/MapEntries.java
Log:
JBIDE-549
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ListEntries.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ListEntries.java 2007-07-19 01:19:02 UTC (rev 2514)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ListEntries.java 2007-07-19 07:52:31 UTC (rev 2515)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.jsf.ui.editor.form;
-import org.eclipse.core.runtime.Status;
import org.jboss.tools.common.model.ui.attribute.XAttributeSupport;
import org.jboss.tools.common.model.ui.attribute.adapter.XChildrenTableStructuredAdapter;
import org.jboss.tools.common.model.ui.attribute.editor.IFieldEditor;
@@ -164,6 +163,13 @@
this.tableEditor.setInput(this.tableAdapter);
}
+ public void update() {
+ if (support != null) {
+ support.load();
+ support.updateEnablementByModelObject();
+ }
+ }
+
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (support != null) {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/LocaleConfigForm.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/LocaleConfigForm.java 2007-07-19 01:19:02 UTC (rev 2514)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/LocaleConfigForm.java 2007-07-19 07:52:31 UTC (rev 2515)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.jsf.ui.editor.form;
-import org.eclipse.core.runtime.Status;
import org.jboss.tools.common.model.ui.attribute.XAttributeSupport;
import org.jboss.tools.common.model.ui.attribute.adapter.XChildrenTableStructuredAdapter;
import org.jboss.tools.common.model.ui.attribute.editor.IFieldEditor;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ManagedBeanPropertyForm.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ManagedBeanPropertyForm.java 2007-07-19 01:19:02 UTC (rev 2514)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ManagedBeanPropertyForm.java 2007-07-19 07:52:31 UTC (rev 2515)
@@ -16,7 +16,6 @@
import java.util.List;
import java.util.Properties;
-import org.eclipse.core.runtime.Status;
import org.jboss.tools.common.model.ui.attribute.XAttributeSupport;
import org.jboss.tools.common.model.ui.attribute.editor.ExtendedFieldEditor;
import org.jboss.tools.common.model.ui.attribute.editor.IPropertyFieldEditor;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/MapEntries.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/MapEntries.java 2007-07-19 01:19:02 UTC (rev 2514)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/MapEntries.java 2007-07-19 07:52:31 UTC (rev 2515)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.jsf.ui.editor.form;
-import org.eclipse.core.runtime.Status;
import org.jboss.tools.common.editor.form.RightFormContainer;
import org.jboss.tools.common.model.ui.attribute.XAttributeSupport;
import org.jboss.tools.common.model.ui.attribute.adapter.XChildrenTableStructuredAdapter;
17 years, 5 months
JBoss Tools SVN: r2514 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-07-18 21:19:02 -0400 (Wed, 18 Jul 2007)
New Revision: 2514
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java
Log:
Fixed a UI issue where the properties view wasn't updating and showing itself properly.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java 2007-07-19 00:48:10 UTC (rev 2513)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java 2007-07-19 01:19:02 UTC (rev 2514)
@@ -39,8 +39,10 @@
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
@@ -63,7 +65,6 @@
import org.jboss.ide.eclipse.as.ui.views.server.extensions.ServerViewProvider;
import org.jboss.ide.eclipse.as.ui.views.server.providers.descriptors.DescriptorXPathPropertySheetPage;
-// TODO FIX ME
public class DescriptorXPathViewProvider extends JBossServerViewExtension {
private XPathTreeContentProvider contentProvider;
@@ -90,24 +91,39 @@
JBossServerView.getDefault().getExtensionFrame().getViewer().
addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
- Object o = JBossServerView.getDefault().getExtensionFrame().getViewer().getSelectedElement();
- if( o instanceof XPathCategory ) {
- // show properties view
- String propsId = "org.eclipse.ui.views.PropertySheet";
- try {
- IWorkbench work = PlatformUI.getWorkbench();
- IWorkbenchWindow window = work.getActiveWorkbenchWindow();
- window.getActivePage().showView(propsId);
- if( propertyPage != null ) {
- propertyPage.selectionChanged(JBossServerView.getDefault().getViewSite().getPart(), JBossServerView.getDefault().getExtensionFrame().getViewer().getSelection());
- }
- } catch( PartInitException pie ) {
- }
- }
+ activatePropertiesView();
}
- });
+ });
}
+ protected void activatePropertiesView() {
+ Object o = JBossServerView.getDefault().getExtensionFrame().getViewer().getSelectedElement();
+ if( o instanceof XPathCategory ) {
+ // show properties view
+ String propsId = "org.eclipse.ui.views.PropertySheet";
+ try {
+ IWorkbench work = PlatformUI.getWorkbench();
+ IWorkbenchWindow window = work.getActiveWorkbenchWindow();
+ if( !isPropertiesOnTop()) {
+ window.getActivePage().showView(propsId);
+ if( propertyPage != null ) {
+ propertyPage.selectionChanged(JBossServerView.getDefault().getViewSite().getPart(), JBossServerView.getDefault().getExtensionFrame().getViewer().getSelection());
+ }
+ }
+ } catch( PartInitException pie ) {
+ }
+ }
+ }
+
+ protected boolean isPropertiesOnTop() {
+ String propsId = "org.eclipse.ui.views.PropertySheet";
+ IWorkbench work = PlatformUI.getWorkbench();
+ IWorkbenchWindow window = work.getActiveWorkbenchWindow();
+ IWorkbenchPage page = window.getActivePage();
+ IViewReference ref = window.getActivePage().findViewReference(propsId);
+ IWorkbenchPart part = ref.getPart(false);
+ return ( part != null && page.isPartVisible(part));
+ }
public void setActiveCategory(XPathCategory o) {
if( o != null && o != activeCategory) {
activeCategory = o;
17 years, 5 months
JBoss Tools SVN: r2513 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core: META-INF and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-07-18 20:48:10 -0400 (Wed, 18 Jul 2007)
New Revision: 2513
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/AntFileFilter.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XMLDocumentRepository.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathCategory.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathFileResult.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathModel.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathQuery.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/legacy/
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/legacy/DescriptorModel.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/
trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.40.default.ports.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.42.default.ports.properties
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/DescriptorModel.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/AbstractJBossServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/ServerLaunchDefaults.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TwiddlePoller.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/JBossServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/ServerAttributeHelper.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/attributes/IDeployableServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableServer.java
Log:
A significant update to the descriptor model.
First, caches many less objects.
Second, the API is cleaner IMO.
Still needs some work but nothing major I believe. Wanted to get it into svn to test and make sure no build errors.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2007-07-19 00:47:40 UTC (rev 2512)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2007-07-19 00:48:10 UTC (rev 2513)
@@ -23,6 +23,7 @@
Eclipse-LazyStart: true
Export-Package: org.jboss.ide.eclipse.as.core,
org.jboss.ide.eclipse.as.core.model,
+ org.jboss.ide.eclipse.as.core.model.descriptor,
org.jboss.ide.eclipse.as.core.packages,
org.jboss.ide.eclipse.as.core.packages.types,
org.jboss.ide.eclipse.as.core.publishers,
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/DescriptorModel.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/DescriptorModel.java 2007-07-19 00:47:40 UTC (rev 2512)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/DescriptorModel.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -1,460 +0,0 @@
-/*
- * 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.
- *
- * 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.core.model;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileOutputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.dom4j.Attribute;
-import org.dom4j.Document;
-import org.dom4j.Node;
-import org.dom4j.io.OutputFormat;
-import org.dom4j.io.SAXReader;
-import org.dom4j.io.XMLWriter;
-import org.dom4j.tree.DefaultAttribute;
-import org.dom4j.tree.DefaultElement;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.jboss.ide.eclipse.as.core.util.SimpleTreeItem;
-
-public class DescriptorModel {
- /* Static Portion */
- private static DescriptorModel model = null;
-
- public static DescriptorModel getDefault() {
- if( model == null ) {
- model = new DescriptorModel();
- }
- return model;
- }
-
-
- /* Member variables / methods */
- private HashMap map;
-
- public DescriptorModel() {
- map = new HashMap();
- }
-
- public ServerDescriptorModel getServerModel(IPath configPath) {
- String key = configPath.toOSString();
- Object o = map.get(key);
- if( o == null ) {
- o = createEntity(configPath);
- }
- return (ServerDescriptorModel)o;
- }
-
- private ServerDescriptorModel createEntity(IPath configPath) {
- ServerDescriptorModel val = new ServerDescriptorModel(configPath.toOSString());
- map.put(configPath.toOSString(), val);
- return val;
- }
-
- public static class ServerDescriptorModel {
- private String configPath;
-
- private HashMap pathToDocument;
- private HashMap pathToLastRead;
-
- public ServerDescriptorModel(String configPath) {
- this.configPath = configPath;
- pathToDocument = new HashMap();
- pathToLastRead = new HashMap();
- }
-
- /**
- * Discover all descriptors in the configuration
- * @return
- */
-
- private File[] getAllDescriptors() {
- ArrayList list = new ArrayList();
- File config = new File(configPath);
- getAllDescriptorsRecurse(config, list);
- File[] ret = new File[list.size()];
- list.toArray(ret);
- return ret;
- }
-
- private void getAllDescriptorsRecurse(File parent, ArrayList collector) {
- if( parent.isDirectory() ) {
- File[] children = parent.listFiles();
- for( int i = 0; i < children.length; i++ ) {
- if( children[i].isDirectory()) {
- getAllDescriptorsRecurse(children[i], collector);
- } else if( children[i].getAbsolutePath().endsWith(".xml")) {
- collector.add(children[i]);
- }
- }
- }
- }
-
-
-
- private Document getDocument(String path) {
- // First get last time loaded.
- if( !isCurrent(path)) {
- loadDocument(path);
- }
- return (Document)pathToDocument.get(path);
- }
-
- private boolean isCurrent( String path ) {
- if( pathToLastRead.get(path) == null ) return false;
- if( !(pathToLastRead.get(path) instanceof Long)) return false;
- if( pathToDocument.get(path) == null ) return false;
- long lastModified = ((Long)pathToLastRead.get(path)).longValue();
- File f = new File(path);
- if( f.lastModified() > lastModified ) return false;
-
- return true;
- }
-
- private void loadDocument(String path) {
- try {
- File file = new File(path);
- long lastModified = file.lastModified();
- URL url = new File(path).toURL();
-
- SAXParserFactory spf = SAXParserFactory.newInstance();
- SAXParser sp = spf.newSAXParser();
- sp.getXMLReader().setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
-
- SAXReader reader = new SAXReader(false);
- reader.setXMLReader(sp.getXMLReader());
- Document document = reader.read(url);
-
- // add to maps
- pathToDocument.put(path, document);
- pathToLastRead.put(path, new Long(lastModified));
- } catch( Exception e ) {
- e.printStackTrace();
- }
- }
-
- /**
- * Searches in the given file for the given xpath
- * @param path
- * @param xpath
- * @return A list of DefaultElements
- */
- public List getXPathFromFile(String path, String xpath) {
- try {
- Document d = getDocument(path);
- if( d == null ) return new ArrayList();
- return d.selectNodes(xpath);
- } catch( Exception e ) {
- return new ArrayList();
- }
- }
-
- /**
- * Searches all descriptors for the provided xpath
- * @param xpath
- * @return A list of file / DefaultElement pairs
- */
- public XPathTreeItem[] getXPath(String xpath) {
- return getXPath(xpath, null);
- }
-
- public XPathTreeItem[] getXPath(String xpath, String attributeName) {
- return getXPath(xpath, attributeName, null);
- }
-
- public XPathTreeItem[] getXPath(String xpath, String attributeName, FileFilter filter ) {
- return getXPath(xpath, attributeName, filter, true);
- }
-
- public XPathTreeItem[] getXPath(String xpath, String attributeName, FileFilter filter, boolean refresh ) {
- if( refresh )
- refreshDescriptors(new NullProgressMonitor());
-
- ArrayList list = new ArrayList();
- Set documentPathSet = pathToDocument.keySet();
- Iterator i = documentPathSet.iterator();
- String p;
- List tmp;
- XPathTreeItem newItem;
- while(i.hasNext()) {
- p = (String)i.next();
-
- if( filter == null || filter.accept(new File(p))) {
- tmp = getXPathFromFile(p, xpath);
- if( tmp.size() > 0 ) {
- if( attributeName == null || attributeName.equals("")) {
- newItem = new XPathTreeItem(null, new File(p), tmp);
- list.add(newItem);
- } else {
- // Remove any that match the path but not the attribute
- Iterator j = tmp.iterator();
- while( j.hasNext()) {
- DefaultElement el = (DefaultElement)j.next();
- if( el.attribute(attributeName) == null ) {
- j.remove();
- }
- }
- if( tmp.size() > 0 ) {
- newItem = new XPathTreeItem(null, new File(p), tmp, attributeName);
- list.add(newItem);
- }
- }
- }
- }
- }
- return (XPathTreeItem[]) list.toArray(new XPathTreeItem[list.size()]);
- }
-
-
-
- public class XPathTreeItem extends SimpleTreeItem {
- public XPathTreeItem(SimpleTreeItem parent, File data, List nodes) {
- super(parent, data);
- addXPathsAsChildren(nodes);
- }
-
- public XPathTreeItem(SimpleTreeItem parent, File data, List nodes, String attribute) {
- super(parent, data);
- addXPathsAsChildren(nodes, attribute);
- }
-
- public File getFile() {
- return ((File)getData());
- }
-
-// just add the list of nodes as children
- private void addXPathsAsChildren(List nodes) {
- Iterator i = nodes.iterator();
- int z = 0;
- while(i.hasNext()) {
- Node o = (Node)i.next();
- addChild(new XPathTreeItem2(this, o, z++));
- }
- }
-
-// just add the list of nodes as children with an attribute
- private void addXPathsAsChildren(List nodes, String attribute) {
- Iterator i = nodes.iterator();
- int z = 0;
- while(i.hasNext()) {
- Node o = (Node)i.next();
- addChild(new XPathTreeItem2(this, o, attribute, z++));
- }
- }
-
-
- }
-
- public class XPathTreeItem2 extends SimpleTreeItem {
- // which match inside the file am i?
- private int index;
- private String attribute;
- private boolean hasAttribute, isDirty;
-
- public XPathTreeItem2(XPathTreeItem parent, Node data, int index) {
- super(parent, data);
- this.index = index;
- hasAttribute = false;
- isDirty = false;
- }
- public XPathTreeItem2(XPathTreeItem parent, Node data, String attribute, int index) {
- super(parent, data);
- this.index = index;
- this.attribute = attribute;
- hasAttribute = true;
- isDirty = false;
- }
-
- public int getIndex() {
- return index;
- }
-
- public boolean hasAttribute() {
- return hasAttribute;
- }
- public boolean isDirty() {
- return isDirty;
- }
-
- public String getAttribute() {
- return attribute;
- }
-
- public String getAttributeValue() {
- if( getData() instanceof DefaultElement ) {
- return ((DefaultElement)getData()).attributeValue(attribute);
- }
- return "";
- }
-
- public Document getDocument() {
- if( getData() instanceof DefaultElement ) {
- return ((DefaultElement)getData()).getDocument();
- }
- return null;
- }
-
- public String getText() {
- try {
- if( getData() instanceof DefaultElement ) {
- if( !hasAttribute()) {
- return ((DefaultElement)getData()).getText();
- } else {
- Attribute att = ((DefaultElement)getData()).attribute(attribute);
- return att.getValue();
- }
- }
- } catch( NullPointerException npe ) {
- npe.printStackTrace();
- }
- return "";
- }
-
- public void setText(String newValue) {
- if( getData() instanceof DefaultElement ) {
- if( !hasAttribute()) {
- ((DefaultElement)getData()).setText(newValue);
- } else {
- ((DefaultElement)getData()).attribute(attribute).setValue(newValue);
- }
- isDirty = true;
- }
- }
-
- public String elementAsXML() {
- return ((DefaultElement)getData()).asXML();
- }
-
- public String getElementName() {
- return ((DefaultElement)getData()).getName();
- }
-
- public String[] getElementChildrenNames() {
- DefaultElement element = ((DefaultElement)getData());
- List l = element.elements();
- DefaultElement child;
- ArrayList names = new ArrayList();
- for( Iterator i = l.iterator();i.hasNext();) {
- child = (DefaultElement)i.next();
- if( !names.contains(child.getName()))
- names.add(child.getName());
- }
- return (String[]) names.toArray(new String[names.size()]);
- }
- public String[] getElementAttributeNames() {
- DefaultElement element = ((DefaultElement)getData());
- List l = element.attributes();
- DefaultAttribute child;
- ArrayList names = new ArrayList();
- for( Iterator i = l.iterator();i.hasNext();) {
- child = (DefaultAttribute)i.next();
- if( !names.contains(child.getName()))
- names.add(child.getName());
- }
- return (String[]) names.toArray(new String[names.size()]);
- }
- public String[] getElementAttributeValues(String attName) {
- DefaultElement element = ((DefaultElement)getData());
- Attribute at = element.attribute(attName);
- return at == null ? new String[0] : new String[] {at.getValue()};
- }
-
- public void saveDescriptor() {
- if( getParent() instanceof XPathTreeItem ) {
- try {
- File outFile = ((XPathTreeItem)getParent()).getFile();
- FileOutputStream os = new FileOutputStream(outFile);
-
- Document doc = ((DefaultElement)getData()).getDocument();
-
- OutputFormat outformat = OutputFormat.createPrettyPrint();
- XMLWriter writer = new XMLWriter(os, outformat);
- writer.write(doc);
- writer.flush();
- } catch( Exception e ) {
- e.printStackTrace();
- }
- }
- }
-
- public void reloadDescriptorFromDisk() {
- if( getParent() instanceof XPathTreeItem ) {
- try {
- loadDocument(((XPathTreeItem)getParent()).getFile().getAbsolutePath());
- } catch( Exception e ) {
- e.printStackTrace();
- }
- }
- }
- }
-
- public void refreshDescriptors(IProgressMonitor monitor) {
- File[] files = getAllDescriptors();
- monitor.beginTask("Refresh", files.length);
- for( int i = 0; i < files.length; i++ ) {
- getDocument(files[i].getAbsolutePath());
- monitor.worked(1);
- }
- monitor.done();
- }
-
- public void refreshDescriptorsClean(IProgressMonitor monitor) {
- pathToDocument.clear();
- pathToLastRead.clear();
- refreshDescriptors(monitor);
- }
-
- /**
- * JNDI specific
- * @return
- */
- public int getJNDIPort() {
- try {
- String jbossServicePath = configPath + File.separator + "conf" +
- File.separator + "jboss-service.xml";
- String xpath = "/server/mbean[@name='jboss:service=Naming']/attribute[@name='Port']";
- List l = getXPathFromFile(jbossServicePath, xpath);
- if( l.size() > 0 ) {
- DefaultElement el = (DefaultElement)l.get(0);
- int jndi = Integer.parseInt(el.getText());
-
- return jndi;
- }
- } catch( Exception e ) {
- }
- return 1099;
- }
-
- }
-}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/AntFileFilter.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/AntFileFilter.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/AntFileFilter.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -0,0 +1,29 @@
+package org.jboss.ide.eclipse.as.core.model.descriptor;
+
+import org.apache.tools.ant.DirectoryScanner;
+
+public class AntFileFilter {
+ private String includes;
+ private String baseDir;
+ private boolean hasScanned;
+ private transient DirectoryScanner scanner;
+ public AntFileFilter(String baseDir, String includes) {
+ this.includes = includes == null ? "**/*.xml" : includes;
+ this.baseDir = baseDir;
+ this.scanner = new DirectoryScanner();
+ String includesList[] = this.includes.split(" ?, ?");
+ scanner.setBasedir(baseDir);
+ scanner.setIncludes(includesList);
+ }
+ public String getBaseDir() { return baseDir; }
+ public String getIncludes() { return includes; }
+ public void setIncludes(String includes) { this.includes = includes; }
+ public void setBaseDir(String baseDir) { this.baseDir = baseDir; }
+ public String[] getIncludedFiles() {
+ if( !hasScanned ) {
+ hasScanned = true;
+ scanner.scan();
+ }
+ return scanner.getIncludedFiles();
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XMLDocumentRepository.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XMLDocumentRepository.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XMLDocumentRepository.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -0,0 +1,106 @@
+package org.jboss.ide.eclipse.as.core.model.descriptor;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.net.URL;
+import java.util.HashMap;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.dom4j.Document;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.SAXReader;
+import org.dom4j.io.XMLWriter;
+
+/**
+ * Parses and potentially stores descriptor files.
+ *
+ * @author rstryker
+ *
+ */
+public class XMLDocumentRepository {
+ private static XMLDocumentRepository instance = null;
+ public static XMLDocumentRepository getDefault() {
+ if( instance == null )
+ instance = new XMLDocumentRepository();
+ return instance;
+ }
+
+ private HashMap pathToDocument;
+ private HashMap pathToTimestamp;
+ private XMLDocumentRepository parent;
+
+ XMLDocumentRepository() {
+ pathToDocument = new HashMap();
+ pathToTimestamp = new HashMap();
+ }
+
+ public XMLDocumentRepository(XMLDocumentRepository parent) {
+ pathToDocument = new HashMap();
+ pathToTimestamp = new HashMap();
+ this.parent = parent;
+ }
+
+ public Document getDocument(String fullPath) {
+ return getDocument(fullPath, true);
+ }
+
+ public Document getDocument(String fullPath, boolean load) {
+ return getDocument(fullPath, load, true);
+ }
+
+ public Document getDocument(String fullPath, boolean load, boolean save) {
+ Document d = (Document)pathToDocument.get(fullPath);
+ if( d == null && load ) {
+ d = loadDocument(fullPath);
+ if( save ) {
+ pathToDocument.put(fullPath, d);
+ pathToTimestamp.put(fullPath, new Long(new File(fullPath).lastModified()));
+ }
+ }
+ return d;
+ }
+
+ public boolean refresh(String fullPath) {
+ if( new File(fullPath).lastModified() != ((Long)pathToTimestamp.get(fullPath)).longValue()) {
+ pathToDocument.put(fullPath, loadDocument(fullPath));
+ pathToTimestamp.put(fullPath, new Long(new File(fullPath).lastModified()));
+ return true;
+ }
+ return false;
+ }
+
+ private Document loadDocument(String fullpath) {
+ try {
+ URL url = new File(fullpath).toURI().toURL();
+
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ SAXParser sp = spf.newSAXParser();
+ sp.getXMLReader().setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+
+ SAXReader reader = new SAXReader(false);
+ reader.setXMLReader(sp.getXMLReader());
+ Document document = reader.read(url);
+
+ return document;
+ } catch( Exception e ) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static void saveDocument(Document doc, String fullPath) {
+ try {
+ File outFile = new File(fullPath);
+ FileOutputStream os = new FileOutputStream(outFile);
+ OutputFormat outformat = OutputFormat.createPrettyPrint();
+ XMLWriter writer = new XMLWriter(os, outformat);
+ writer.write(doc);
+ writer.flush();
+ } catch( Exception e ) {
+ e.printStackTrace();
+ }
+
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathCategory.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathCategory.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathCategory.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -0,0 +1,54 @@
+package org.jboss.ide.eclipse.as.core.model.descriptor;
+
+import java.util.HashMap;
+
+import org.jboss.ide.eclipse.as.core.server.JBossServer;
+import org.jboss.ide.eclipse.as.core.server.ServerAttributeHelper;
+
+public class XPathCategory {
+ protected String name; // cannot include delimiter from the model, comma
+ protected JBossServer server;
+ protected HashMap children;
+
+ public XPathCategory(String name, JBossServer server) {
+ this.name = name;
+ this.server = server;
+ }
+
+ public String getName() { return this.name; }
+
+ public boolean queriesLoaded() {
+ return children != null;
+ }
+
+ public XPathQuery[] getQueries() {
+ if( children == null ) {
+ children = new HashMap();
+ XPathQuery[] queries = XPathModel.getDefault().loadQueries(this, server);
+ for( int i = 0; i < queries.length; i++ ) {
+ children.put(queries[i].getName(), queries[i]);
+ }
+ }
+ return (XPathQuery[]) children.values().toArray(new XPathQuery[children.size()]);
+ }
+
+ public XPathQuery getQuery(String name) {
+ return (XPathQuery)children.get(name);
+ }
+ public void addQuery(XPathQuery query) {
+ getQueries();
+ children.put(query.getName(), query);
+ query.setCategory(this);
+ }
+
+ public void removeQuery(XPathQuery query) {
+ getQueries();
+ children.remove(query.getName());
+ }
+
+ public void save() {
+ ServerAttributeHelper helper = server.getAttributeHelper();
+ XPathModel.getDefault().saveCategory(this, server, helper);
+ helper.save();
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathFileResult.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathFileResult.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathFileResult.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -0,0 +1,162 @@
+package org.jboss.ide.eclipse.as.core.model.descriptor;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.Node;
+import org.dom4j.tree.DefaultAttribute;
+import org.dom4j.tree.DefaultElement;
+
+
+public class XPathFileResult {
+ protected XPathQuery query;
+ protected List nodeList;
+ protected String fileLoc;
+
+ protected XPathResultNode[] children;
+ public XPathFileResult(XPathQuery query, String fileLoc, List nodeList) {
+ this.query = query;
+ this.fileLoc = fileLoc;
+ this.nodeList = nodeList;
+ }
+
+ public String getFileLocation() {
+ return fileLoc;
+ }
+
+ public XPathQuery getQuery() {
+ return query;
+ }
+
+ public XPathResultNode[] getChildren() {
+ if( children == null ) {
+ ArrayList childList = new ArrayList();
+ Iterator i = nodeList.iterator();
+ int z = 0;
+ while(i.hasNext()) {
+ Node o = (Node)i.next();
+ childList.add(new XPathResultNode(o, query.getAttribute(), z++));
+ }
+ children = (XPathResultNode[]) childList.toArray(new XPathResultNode[childList.size()]);
+ }
+ return children;
+ }
+
+ public class XPathResultNode {
+ protected Node node;
+ protected String attribute;
+ protected boolean hasAttribute;
+ protected int index;
+ protected Object val;
+ protected boolean dirty;
+ public XPathResultNode(Node node, String attribute, int index) {
+ this.node = node;
+ this.attribute = attribute;
+ this.index = index;
+ this.hasAttribute = attribute == null ? false : true;
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public boolean hasAttribute() {
+ return hasAttribute;
+ }
+
+ public String getAttribute() {
+ return attribute;
+ }
+
+ public String getAttributeValue() {
+ if( node instanceof DefaultElement ) {
+ return ((DefaultElement)node).attributeValue(attribute);
+ }
+ return "";
+ }
+
+ public Document getDocument() {
+ if( node instanceof DefaultElement ) {
+ return ((DefaultElement)node).getDocument();
+ }
+ return null;
+ }
+
+ public String getText() {
+ try {
+ if( node instanceof DefaultElement ) {
+ if( !hasAttribute()) {
+ return ((DefaultElement)node).getText();
+ } else {
+ Attribute att = ((DefaultElement)node).attribute(attribute);
+ return att.getValue();
+ }
+ }
+ } catch( NullPointerException npe ) {
+ }
+ return "";
+ }
+
+ public void setText(String newValue) {
+ if( node instanceof DefaultElement ) {
+ if( !hasAttribute()) {
+ ((DefaultElement)node).setText(newValue);
+ } else {
+ ((DefaultElement)node).attribute(attribute).setValue(newValue);
+ }
+ dirty = true;
+ }
+ }
+
+ public String elementAsXML() {
+ return ((DefaultElement)node).asXML();
+ }
+
+ public String getElementName() {
+ return ((DefaultElement)node).getName();
+ }
+
+ public String[] getElementChildrenNames() {
+ DefaultElement element = ((DefaultElement)node);
+ List l = element.elements();
+ DefaultElement child;
+ ArrayList names = new ArrayList();
+ for( Iterator i = l.iterator();i.hasNext();) {
+ child = (DefaultElement)i.next();
+ if( !names.contains(child.getName()))
+ names.add(child.getName());
+ }
+ return (String[]) names.toArray(new String[names.size()]);
+ }
+ public String[] getElementAttributeNames() {
+ DefaultElement element = ((DefaultElement)node);
+ List l = element.attributes();
+ DefaultAttribute child;
+ ArrayList names = new ArrayList();
+ for( Iterator i = l.iterator();i.hasNext();) {
+ child = (DefaultAttribute)i.next();
+ if( !names.contains(child.getName()))
+ names.add(child.getName());
+ }
+ return (String[]) names.toArray(new String[names.size()]);
+ }
+ public String[] getElementAttributeValues(String attName) {
+ DefaultElement element = ((DefaultElement)node);
+ Attribute at = element.attribute(attName);
+ return at == null ? new String[0] : new String[] {at.getValue()};
+ }
+ public boolean isDirty() {
+ return dirty;
+ }
+ public String getFileLocation() {
+ return fileLoc;
+ }
+ public void saveDescriptor() {
+ XMLDocumentRepository.saveDocument(node.getDocument(), fileLoc);
+ dirty = false;
+ }
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathModel.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathModel.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathModel.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -0,0 +1,241 @@
+package org.jboss.ide.eclipse.as.core.model.descriptor;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.runtime.server.AbstractJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.JBossServer;
+import org.jboss.ide.eclipse.as.core.server.ServerAttributeHelper;
+
+public class XPathModel {
+ public static final String EMPTY_STRING = "org.jboss.ide.eclipse.as.core.model.descriptor.EmptyString";
+ private static final String DELIMITER = ",";
+ private static final String CATEGORY_LIST =
+ "org.jboss.ide.eclipse.as.core.model.descriptor.Categories";
+ private static final String QUERY_LIST =
+ "org.jboss.ide.eclipse.as.core.model.descriptor.QueryList";
+ private static final String QUERY =
+ "org.jboss.ide.eclipse.as.core.model.descriptor.Query";
+
+ public static XPathModel instance;
+ public static XPathModel getDefault() {
+ if( instance == null )
+ instance = new XPathModel();
+ return instance;
+ }
+
+ protected HashMap serverToCategories;
+ public XPathModel() {
+ serverToCategories = new HashMap();
+ }
+
+ public XPathQuery getQuery(JBossServer jbs, IPath path) {
+ XPathCategory cat = getCategory(jbs, path.segment(0));
+ if( cat != null )
+ return cat.getQuery(path.segment(1));
+ return null;
+ }
+
+ public ArrayList getCategoryCollection(JBossServer jbs) {
+ if( serverToCategories.get(jbs.getServer().getId()) == null ) {
+ ArrayList val = new ArrayList(Arrays.asList(load(jbs)));
+ if( val.size() == 0 ) {
+ val = loadDefaults(jbs);
+ serverToCategories.put(jbs.getServer().getId(), val);
+ save(jbs);
+ } else {
+ serverToCategories.put(jbs.getServer().getId(), val);
+ }
+ }
+ return (ArrayList)serverToCategories.get(jbs.getServer().getId());
+ }
+
+ public XPathCategory[] getCategories(JBossServer jbs) {
+ ArrayList val = getCategoryCollection(jbs);
+ return (XPathCategory[]) val.toArray(new XPathCategory[val.size()]);
+ }
+
+ public boolean containsCategory(JBossServer jbs, String name) {
+ return getCategory(jbs, name) == null ? false : true;
+ }
+
+ public XPathCategory getCategory(JBossServer jbs, String name) {
+ ArrayList list = getCategoryCollection(jbs);
+ Iterator i = list.iterator();
+ XPathCategory c;
+ while(i.hasNext()) {
+ c = (XPathCategory)i.next();
+ if( c.getName().equals(name))
+ return c;
+ }
+ return null;
+ }
+
+ public XPathCategory addCategory(JBossServer jbs, String name) {
+ if( !containsCategory(jbs, name)) {
+ XPathCategory c = new XPathCategory(name, jbs);
+ getCategoryCollection(jbs).add(c);
+ return c;
+ }
+ return getCategory(jbs, name);
+ }
+
+ public void addCategory(JBossServer jbs, XPathCategory category) {
+ if( !containsCategory(jbs, category.getName())) {
+ getCategoryCollection(jbs).add(category);
+ }
+ }
+
+ public void removeCategory(JBossServer jbs, String name) {
+ ArrayList list = getCategoryCollection(jbs);
+ Iterator i = list.iterator();
+ while(i.hasNext()) {
+ XPathCategory cat = (XPathCategory)i.next();
+ if( cat.getName().equals(name)) {
+ i.remove();
+ return;
+ }
+ }
+ }
+
+ /*
+ * Loading and saving is below
+ */
+ private XPathCategory[] load(JBossServer jbs) {
+ ServerAttributeHelper helper = jbs.getAttributeHelper();
+ String list = helper.getAttribute(CATEGORY_LIST, (String)null);
+ System.out.println("load " + CATEGORY_LIST + ", got " + list);
+ if( list == null )
+ return new XPathCategory[] {};
+ String[] byName = list.split(DELIMITER);
+ XPathCategory[] cats = new XPathCategory[byName.length];
+ for( int i = 0; i < byName.length; i++ ) {
+ cats[i] = new XPathCategory(byName[i], jbs);
+ }
+ return cats;
+ }
+
+ public void save(JBossServer jbs) {
+ if( !serverToCategories.containsKey(jbs.getServer().getId()))
+ return;
+
+ ServerAttributeHelper helper = jbs.getAttributeHelper();
+ XPathCategory[] categories = getCategories(jbs);
+ String list = "";
+ for( int i = 0; i < categories.length; i++ ) {
+ if( i != 0 )
+ list += DELIMITER;
+ list += categories[i].getName();
+ saveCategory(categories[i], jbs, helper);
+ }
+ helper.setAttribute(CATEGORY_LIST, list);
+ helper.save();
+ }
+
+ public void saveCategory(XPathCategory category, JBossServer jbs, ServerAttributeHelper helper) {
+ if( category.queriesLoaded()) {
+ XPathQuery[] queries = category.getQueries();
+ String val = "";
+ for( int i = 0; i < queries.length; i++ ) {
+ if( i != 0 )
+ val += DELIMITER;
+ val += category.getName() + Path.SEPARATOR + queries[i].getName();
+ saveQuery(queries[i], category, jbs, helper);
+ }
+ helper.setAttribute(QUERY_LIST + "." + category.getName().replace(' ', '_'), val);
+ System.out.println("save " + QUERY_LIST + "." + category.getName() + " with " + val);
+ }
+ }
+
+ private void saveQuery(XPathQuery query, XPathCategory category, JBossServer jbs, ServerAttributeHelper helper) {
+ ArrayList list = new ArrayList();
+ list.add(query.getBaseDir());
+ list.add(query.getFilePattern() == null ? EMPTY_STRING : query.getFilePattern());
+ list.add(query.getXpathPattern() == null ? EMPTY_STRING : query.getXpathPattern());
+ list.add(query.getAttribute() == null ? EMPTY_STRING : query.getAttribute());
+ helper.setAttribute(QUERY + "." + category.getName().replace(' ', '_') + Path.SEPARATOR + query.getName().replace(' ', '_'), list);
+ System.out.println("saved " + QUERY + "." + category.getName() + Path.SEPARATOR + query.getName() + " with " + list);
+ }
+
+ public XPathQuery[] loadQueries(XPathCategory category, JBossServer jbs) {
+ ServerAttributeHelper helper = jbs.getAttributeHelper();
+ String list = helper.getAttribute(QUERY_LIST + "." + category.getName().replace(' ', '_'), (String)null);
+ System.out.println("load " + QUERY_LIST + "." + category.getName() + " gets " + list);
+ if( list == null )
+ return new XPathQuery[] {};
+ String[] queriesByName = list.split(DELIMITER);
+ List queryAsStringValues;
+ ArrayList returnList = new ArrayList();
+ for( int i = 0; i < queriesByName.length; i++ ) {
+ queryAsStringValues = helper.getAttribute(QUERY + "." + queriesByName[i].replace(' ', '_'), (List)null);
+ System.out.println("load " + QUERY + "." + queriesByName[i]);
+ if( queryAsStringValues != null ) {
+ try {
+ XPathQuery q =new XPathQuery(queriesByName[i].substring(queriesByName[i].indexOf(Path.SEPARATOR)+1), queryAsStringValues);
+ q.setCategory(category);
+ returnList.add(q);
+ } catch( Exception e ) {e.printStackTrace(); }
+ }
+ }
+ return (XPathQuery[]) returnList.toArray(new XPathQuery[returnList.size()]);
+ }
+
+
+
+ /*
+ * Loading the defaults for the server
+ * returns the category created
+ */
+ private static HashMap rtToPortsFile;
+ private static final String ATTRIBUTE_SUFFIX = "_ATTRIBUTE";
+ private static final String FILE_SUFFIX = "_FILE";
+ static {
+ rtToPortsFile = new HashMap();
+ rtToPortsFile.put("3.2", new Path("properties").append("jboss.32.default.ports.properties"));
+ rtToPortsFile.put("4.0", new Path("properties").append("jboss.40.default.ports.properties"));
+ rtToPortsFile.put("4.2", new Path("properties").append("jboss.42.default.ports.properties"));
+ rtToPortsFile.put("5.0", new Path("properties").append("jboss.50.default.ports.properties"));
+ }
+
+ protected ArrayList loadDefaults(JBossServer jbs) {
+ ArrayList retVal = new ArrayList();
+ String configFolder;
+ configFolder = jbs.getConfigDirectory(false); // do not check the launch config
+ AbstractJBossServerRuntime ajbsr = (AbstractJBossServerRuntime)
+ jbs.getServer().getRuntime().loadAdapter(AbstractJBossServerRuntime.class, new NullProgressMonitor());
+ Path p = (Path)rtToPortsFile.get(ajbsr.getId());
+ URL url = FileLocator.find(JBossServerCorePlugin.getDefault().getBundle(), p, null);
+ Properties pr = new Properties();
+ try {
+ pr.load(url.openStream());
+ XPathCategory ports = new XPathCategory("Ports", jbs);
+ Iterator i = pr.keySet().iterator();
+ String name, xpath, attributeName, file;
+ XPathQuery query;
+ while(i.hasNext()) {
+ name = (String)i.next();
+ if( !name.endsWith(ATTRIBUTE_SUFFIX) && !name.endsWith(FILE_SUFFIX)) {
+ xpath = pr.getProperty(name);
+ attributeName = pr.getProperty(name+ATTRIBUTE_SUFFIX);
+ file = pr.getProperty(name + FILE_SUFFIX);
+ query = new XPathQuery(name.replace('_', ' '), configFolder, file, xpath, attributeName);
+ ports.addQuery(query);
+ }
+ }
+ retVal.add(ports);
+ } catch( Exception e ) {
+ e.printStackTrace();
+ }
+ return retVal;
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathQuery.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathQuery.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathQuery.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -0,0 +1,150 @@
+package org.jboss.ide.eclipse.as.core.model.descriptor;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.as.core.model.descriptor.XPathFileResult.XPathResultNode;
+
+/**
+ * A simple value object to hold the XPath query data
+ * @author rstryker(a)redhat.com
+ *
+ */
+public class XPathQuery implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * XPath-important fields
+ */
+ protected String name;
+ protected String baseDir;
+ protected String filePattern;
+ protected String xpathPattern;
+ protected String attribute;
+
+ /*
+ * The filter, need not be saved on serialize
+ */
+ protected transient AntFileFilter filter;
+
+ /*
+ * The file results, need not be saved on serialize
+ */
+ protected transient XPathFileResult[] results;
+ protected transient XPathCategory category;
+ protected transient XMLDocumentRepository repository = null;
+
+ public XPathQuery(String name, List list) {
+ this.name = name;
+ this.baseDir = list.get(0).equals(XPathModel.EMPTY_STRING) ? null : (String)list.get(0);
+ this.filePattern = list.get(1).equals(XPathModel.EMPTY_STRING) ? null : (String)list.get(1);
+ this.xpathPattern = list.get(2).equals(XPathModel.EMPTY_STRING) ? null : (String)list.get(2);
+ this.attribute = list.size() < 3 || list.get(3).equals(XPathModel.EMPTY_STRING) ? null : (String)list.get(3);
+ }
+ public XPathQuery(String name, String baseDir, String filePattern, String xpathPattern, String attribute) {
+ this.name = name;
+ this.baseDir = baseDir;
+ this.filePattern = filePattern;
+ this.xpathPattern = xpathPattern;
+ this.attribute = attribute;
+ this.results = null;
+ }
+ protected AntFileFilter getFilter() {
+ if( filter == null )
+ filter = new AntFileFilter(baseDir, filePattern);
+ return filter;
+ }
+ public void refresh() {
+ String[] files = getFilter().getIncludedFiles();
+ boolean changed = false;
+ for( int i = 0; i < files.length; i++ ) {
+ changed = changed || getRepository().refresh(new Path(baseDir).append(files[i]).toOSString());
+ }
+ if( changed ) {
+ results = null;
+ }
+ }
+
+ public XPathFileResult[] getResults() {
+ if( results == null )
+ loadResults();
+ return results;
+ }
+
+ public boolean resultsLoaded() {
+ return results == null ? false : true;
+ }
+
+ protected void loadResults() {
+ String[] files = getFilter().getIncludedFiles();
+ String fileLoc;
+ ArrayList resultList = new ArrayList();
+ List nodeList;
+ for( int i = 0; i < files.length; i++ ) {
+ fileLoc = new Path(baseDir).append(files[i]).toOSString();
+ nodeList = getRepository().getDocument(fileLoc).selectNodes(xpathPattern);
+ if( nodeList.size() > 0 )
+ resultList.add(new XPathFileResult(this, fileLoc, nodeList));
+ }
+ results = (XPathFileResult[]) resultList.toArray(new XPathFileResult[resultList.size()]);
+ }
+
+ public String getFirstResult() {
+ XPathFileResult[] fileResults = getResults();
+ if( fileResults.length > 0 ) {
+ XPathResultNode[] nodes = fileResults[0].getChildren();
+ if( nodes.length > 0 ) {
+ return nodes[0].getText();
+ }
+ }
+ return null;
+ }
+ /*
+ * Field Getters and setters
+ */
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getFilePattern() {
+ return filePattern;
+ }
+ public void setFilePattern(String filePattern) {
+ this.filePattern = filePattern;
+ }
+ public String getXpathPattern() {
+ return xpathPattern;
+ }
+ public void setXpathPattern(String xpathPattern) {
+ this.xpathPattern = xpathPattern;
+ }
+ public String getAttribute() {
+ return attribute;
+ }
+ public void setAttribute(String attribute) {
+ this.attribute = attribute;
+ }
+ public String getBaseDir() {
+ return baseDir;
+ }
+ public void setBaseDir(String baseDir) {
+ this.baseDir = baseDir;
+ }
+ public XPathCategory getCategory() {
+ return category;
+ }
+ public void setCategory(XPathCategory category) {
+ this.category = category;
+ }
+ public void setRepository(XMLDocumentRepository repo) {
+ this.repository = repo;
+ }
+ protected XMLDocumentRepository getRepository() {
+ return repository == null ? XMLDocumentRepository.getDefault() : repository;
+ }
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/legacy/DescriptorModel.java (from rev 2202, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/DescriptorModel.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/legacy/DescriptorModel.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/legacy/DescriptorModel.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -0,0 +1,459 @@
+/*
+ * 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.
+ *
+ * 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.core.model.legacy;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileOutputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.Node;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.SAXReader;
+import org.dom4j.io.XMLWriter;
+import org.dom4j.tree.DefaultAttribute;
+import org.dom4j.tree.DefaultElement;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.ide.eclipse.as.core.util.SimpleTreeItem;
+
+public class DescriptorModel {
+ /* Static Portion */
+ private static DescriptorModel model = null;
+
+ public static DescriptorModel getDefault() {
+ if( model == null ) {
+ model = new DescriptorModel();
+ }
+ return model;
+ }
+
+
+ /* Member variables / methods */
+ private HashMap map;
+
+ public DescriptorModel() {
+ map = new HashMap();
+ }
+//
+// public ServerDescriptorModel getServerModel(IPath configPath) {
+// String key = configPath.toOSString();
+// Object o = map.get(key);
+// if( o == null ) {
+// o = createEntity(configPath);
+// }
+// return (ServerDescriptorModel)o;
+// }
+//
+// private ServerDescriptorModel createEntity(IPath configPath) {
+// ServerDescriptorModel val = new ServerDescriptorModel(configPath.toOSString());
+// map.put(configPath.toOSString(), val);
+// return val;
+// }
+//
+// public static class ServerDescriptorModel {
+// private String configPath;
+//
+// private HashMap pathToDocument;
+// private HashMap pathToLastRead;
+//
+// public ServerDescriptorModel(String configPath) {
+// this.configPath = configPath;
+// pathToDocument = new HashMap();
+// pathToLastRead = new HashMap();
+// }
+//
+// /**
+// * Discover all descriptors in the configuration
+// * @return
+// */
+//
+// private File[] getAllDescriptors() {
+// ArrayList list = new ArrayList();
+// File config = new File(configPath);
+// getAllDescriptorsRecurse(config, list);
+// File[] ret = new File[list.size()];
+// list.toArray(ret);
+// return ret;
+// }
+//
+// private void getAllDescriptorsRecurse(File parent, ArrayList collector) {
+// if( parent.isDirectory() ) {
+// File[] children = parent.listFiles();
+// for( int i = 0; i < children.length; i++ ) {
+// if( children[i].isDirectory()) {
+// getAllDescriptorsRecurse(children[i], collector);
+// } else if( children[i].getAbsolutePath().endsWith(".xml")) {
+// collector.add(children[i]);
+// }
+// }
+// }
+// }
+//
+//
+//
+// private Document getDocument(String path) {
+// // First get last time loaded.
+// if( !isCurrent(path)) {
+// loadDocument(path);
+// }
+// return (Document)pathToDocument.get(path);
+// }
+//
+// private boolean isCurrent( String path ) {
+// if( pathToLastRead.get(path) == null ) return false;
+// if( !(pathToLastRead.get(path) instanceof Long)) return false;
+// if( pathToDocument.get(path) == null ) return false;
+// long lastModified = ((Long)pathToLastRead.get(path)).longValue();
+// File f = new File(path);
+// if( f.lastModified() > lastModified ) return false;
+//
+// return true;
+// }
+//
+// private void loadDocument(String path) {
+// try {
+// File file = new File(path);
+// long lastModified = file.lastModified();
+// URL url = new File(path).toURL();
+//
+// SAXParserFactory spf = SAXParserFactory.newInstance();
+// SAXParser sp = spf.newSAXParser();
+// sp.getXMLReader().setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+//
+// SAXReader reader = new SAXReader(false);
+// reader.setXMLReader(sp.getXMLReader());
+// Document document = reader.read(url);
+//
+// // add to maps
+// pathToDocument.put(path, document);
+// pathToLastRead.put(path, new Long(lastModified));
+// } catch( Exception e ) {
+// e.printStackTrace();
+// }
+// }
+//
+// /**
+// * Searches in the given file for the given xpath
+// * @param path
+// * @param xpath
+// * @return A list of DefaultElements
+// */
+// public List getXPathFromFile(String path, String xpath) {
+// try {
+// Document d = getDocument(path);
+// if( d == null ) return new ArrayList();
+// return d.selectNodes(xpath);
+// } catch( Exception e ) {
+// return new ArrayList();
+// }
+// }
+//
+// /**
+// * Searches all descriptors for the provided xpath
+// * @param xpath
+// * @return A list of file / DefaultElement pairs
+// */
+// public XPathTreeItem[] getXPath(String xpath) {
+// return getXPath(xpath, null);
+// }
+//
+// public XPathTreeItem[] getXPath(String xpath, String attributeName) {
+// return getXPath(xpath, attributeName, null);
+// }
+//
+// public XPathTreeItem[] getXPath(String xpath, String attributeName, FileFilter filter ) {
+// return getXPath(xpath, attributeName, filter, true);
+// }
+//
+// public XPathTreeItem[] getXPath(String xpath, String attributeName, FileFilter filter, boolean refresh ) {
+// if( refresh )
+// refreshDescriptors(new NullProgressMonitor());
+//
+// ArrayList list = new ArrayList();
+// Set documentPathSet = pathToDocument.keySet();
+// Iterator i = documentPathSet.iterator();
+// String p;
+// List tmp;
+// XPathTreeItem newItem;
+// while(i.hasNext()) {
+// p = (String)i.next();
+//
+// if( filter == null || filter.accept(new File(p))) {
+// tmp = getXPathFromFile(p, xpath);
+// if( tmp.size() > 0 ) {
+// if( attributeName == null || attributeName.equals("")) {
+// newItem = new XPathTreeItem(null, new File(p), tmp);
+// list.add(newItem);
+// } else {
+// // Remove any that match the path but not the attribute
+// Iterator j = tmp.iterator();
+// while( j.hasNext()) {
+// DefaultElement el = (DefaultElement)j.next();
+// if( el.attribute(attributeName) == null ) {
+// j.remove();
+// }
+// }
+// if( tmp.size() > 0 ) {
+// newItem = new XPathTreeItem(null, new File(p), tmp, attributeName);
+// list.add(newItem);
+// }
+// }
+// }
+// }
+// }
+// return (XPathTreeItem[]) list.toArray(new XPathTreeItem[list.size()]);
+// }
+//
+//
+//
+// public class XPathTreeItem extends SimpleTreeItem {
+// public XPathTreeItem(SimpleTreeItem parent, File data, List nodes) {
+// super(parent, data);
+// addXPathsAsChildren(nodes);
+// }
+//
+// public XPathTreeItem(SimpleTreeItem parent, File data, List nodes, String attribute) {
+// super(parent, data);
+// addXPathsAsChildren(nodes, attribute);
+// }
+//
+// public File getFile() {
+// return ((File)getData());
+// }
+//
+//// just add the list of nodes as children
+// private void addXPathsAsChildren(List nodes) {
+// Iterator i = nodes.iterator();
+// int z = 0;
+// while(i.hasNext()) {
+// Node o = (Node)i.next();
+// addChild(new XPathTreeItem2(this, o, z++));
+// }
+// }
+//
+//// just add the list of nodes as children with an attribute
+// private void addXPathsAsChildren(List nodes, String attribute) {
+// Iterator i = nodes.iterator();
+// int z = 0;
+// while(i.hasNext()) {
+// Node o = (Node)i.next();
+// addChild(new XPathTreeItem2(this, o, attribute, z++));
+// }
+// }
+//
+//
+// }
+//
+// public class XPathTreeItem2 extends SimpleTreeItem {
+// // which match inside the file am i?
+// private int index;
+// private String attribute;
+// private boolean hasAttribute, isDirty;
+//
+// public XPathTreeItem2(XPathTreeItem parent, Node data, int index) {
+// super(parent, data);
+// this.index = index;
+// hasAttribute = false;
+// isDirty = false;
+// }
+// public XPathTreeItem2(XPathTreeItem parent, Node data, String attribute, int index) {
+// super(parent, data);
+// this.index = index;
+// this.attribute = attribute;
+// hasAttribute = true;
+// isDirty = false;
+// }
+//
+// public int getIndex() {
+// return index;
+// }
+//
+// public boolean hasAttribute() {
+// return hasAttribute;
+// }
+// public boolean isDirty() {
+// return isDirty;
+// }
+//
+// public String getAttribute() {
+// return attribute;
+// }
+//
+// public String getAttributeValue() {
+// if( getData() instanceof DefaultElement ) {
+// return ((DefaultElement)getData()).attributeValue(attribute);
+// }
+// return "";
+// }
+//
+// public Document getDocument() {
+// if( getData() instanceof DefaultElement ) {
+// return ((DefaultElement)getData()).getDocument();
+// }
+// return null;
+// }
+//
+// public String getText() {
+// try {
+// if( getData() instanceof DefaultElement ) {
+// if( !hasAttribute()) {
+// return ((DefaultElement)getData()).getText();
+// } else {
+// Attribute att = ((DefaultElement)getData()).attribute(attribute);
+// return att.getValue();
+// }
+// }
+// } catch( NullPointerException npe ) {
+// npe.printStackTrace();
+// }
+// return "";
+// }
+//
+// public void setText(String newValue) {
+// if( getData() instanceof DefaultElement ) {
+// if( !hasAttribute()) {
+// ((DefaultElement)getData()).setText(newValue);
+// } else {
+// ((DefaultElement)getData()).attribute(attribute).setValue(newValue);
+// }
+// isDirty = true;
+// }
+// }
+//
+// public String elementAsXML() {
+// return ((DefaultElement)getData()).asXML();
+// }
+//
+// public String getElementName() {
+// return ((DefaultElement)getData()).getName();
+// }
+//
+// public String[] getElementChildrenNames() {
+// DefaultElement element = ((DefaultElement)getData());
+// List l = element.elements();
+// DefaultElement child;
+// ArrayList names = new ArrayList();
+// for( Iterator i = l.iterator();i.hasNext();) {
+// child = (DefaultElement)i.next();
+// if( !names.contains(child.getName()))
+// names.add(child.getName());
+// }
+// return (String[]) names.toArray(new String[names.size()]);
+// }
+// public String[] getElementAttributeNames() {
+// DefaultElement element = ((DefaultElement)getData());
+// List l = element.attributes();
+// DefaultAttribute child;
+// ArrayList names = new ArrayList();
+// for( Iterator i = l.iterator();i.hasNext();) {
+// child = (DefaultAttribute)i.next();
+// if( !names.contains(child.getName()))
+// names.add(child.getName());
+// }
+// return (String[]) names.toArray(new String[names.size()]);
+// }
+// public String[] getElementAttributeValues(String attName) {
+// DefaultElement element = ((DefaultElement)getData());
+// Attribute at = element.attribute(attName);
+// return at == null ? new String[0] : new String[] {at.getValue()};
+// }
+//
+// public void saveDescriptor() {
+// if( getParent() instanceof XPathTreeItem ) {
+// try {
+// File outFile = ((XPathTreeItem)getParent()).getFile();
+// FileOutputStream os = new FileOutputStream(outFile);
+//
+// Document doc = ((DefaultElement)getData()).getDocument();
+//
+// OutputFormat outformat = OutputFormat.createPrettyPrint();
+// XMLWriter writer = new XMLWriter(os, outformat);
+// writer.write(doc);
+// writer.flush();
+// } catch( Exception e ) {
+// e.printStackTrace();
+// }
+// }
+// }
+//
+// public void reloadDescriptorFromDisk() {
+// if( getParent() instanceof XPathTreeItem ) {
+// try {
+// loadDocument(((XPathTreeItem)getParent()).getFile().getAbsolutePath());
+// } catch( Exception e ) {
+// e.printStackTrace();
+// }
+// }
+// }
+// }
+//
+// public void refreshDescriptors(IProgressMonitor monitor) {
+// File[] files = getAllDescriptors();
+// monitor.beginTask("Refresh", files.length);
+// for( int i = 0; i < files.length; i++ ) {
+// getDocument(files[i].getAbsolutePath());
+// monitor.worked(1);
+// }
+// monitor.done();
+// }
+//
+// public void refreshDescriptorsClean(IProgressMonitor monitor) {
+// pathToDocument.clear();
+// pathToLastRead.clear();
+// refreshDescriptors(monitor);
+// }
+//
+// /**
+// * JNDI specific
+// * @return
+// */
+// public int getJNDIPort() {
+// try {
+// String jbossServicePath = configPath + File.separator + "conf" +
+// File.separator + "jboss-service.xml";
+// String xpath = "/server/mbean[@name='jboss:service=Naming']/attribute[@name='Port']";
+// List l = getXPathFromFile(jbossServicePath, xpath);
+// if( l.size() > 0 ) {
+// DefaultElement el = (DefaultElement)l.get(0);
+// int jndi = Integer.parseInt(el.getText());
+//
+// return jndi;
+// }
+// } catch( Exception e ) {
+// }
+// return 1099;
+// }
+//
+// }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/AbstractJBossServerRuntime.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/AbstractJBossServerRuntime.java 2007-07-19 00:47:40 UTC (rev 2512)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/AbstractJBossServerRuntime.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -28,7 +28,6 @@
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMInstallType;
import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.wst.server.core.IRuntimeType;
import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
import org.eclipse.wst.server.core.model.RuntimeDelegate;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/ServerLaunchDefaults.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/ServerLaunchDefaults.java 2007-07-19 00:47:40 UTC (rev 2512)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/ServerLaunchDefaults.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -37,8 +37,6 @@
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.core.model.DescriptorModel;
-import org.jboss.ide.eclipse.as.core.model.DescriptorModel.ServerDescriptorModel;
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.server.JBossServer;
@@ -116,14 +114,7 @@
workingCopy.setAttribute(vmArgsKey + STOP_SUFFIX, getVMArgs());
- int jndiPort;
- try {
- String serverConfDir = getJBServer().getConfigDirectory(false);
- ServerDescriptorModel descriptorModel = DescriptorModel.getDefault().getServerModel(new Path(serverConfDir));
- jndiPort = descriptorModel.getJNDIPort();
- } catch( Exception e ) {
- jndiPort = 1099;
- }
+ int jndiPort = getJBServer().getJNDIPort();
String host = server.getHost();
String twiddleArgs = "-s " + host + ":" + jndiPort + " -a jmx/rmi/RMIAdaptor ";
@@ -156,7 +147,6 @@
IJBossServerRuntime rt = getRuntime();
if( rt != null ) {
return "--configuration=" + rt.getJBossConfiguration();
- //+ " --host=" + server.getHost();
}
return "";
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TwiddlePoller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TwiddlePoller.java 2007-07-19 00:47:40 UTC (rev 2512)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TwiddlePoller.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -41,10 +41,9 @@
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.core.model.DescriptorModel;
import org.jboss.ide.eclipse.as.core.model.EventLogModel;
-import org.jboss.ide.eclipse.as.core.model.DescriptorModel.ServerDescriptorModel;
import org.jboss.ide.eclipse.as.core.model.EventLogModel.EventLogTreeItem;
+import org.jboss.ide.eclipse.as.core.model.legacy.DescriptorModel;
import org.jboss.ide.eclipse.as.core.runtime.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.JBossServerLaunchConfiguration;
import org.jboss.ide.eclipse.as.core.server.TwiddleLauncher;
@@ -86,10 +85,12 @@
ClassLoader currentLoader = Thread.currentThread().getContextClassLoader();
ClassLoader twiddleLoader = getClassLoader();
if( twiddleLoader != null ) {
- String serverConfDir = ServerConverter.getJBossServer(server).getConfigDirectory(false);
- ServerDescriptorModel descriptorModel = DescriptorModel.getDefault().getServerModel(new Path(serverConfDir));
- int port = descriptorModel.getJNDIPort();
-
+ // TODO: FIX ME
+// String serverConfDir = ServerConverter.getJBossServer(server).getConfigDirectory(false);
+// ServerDescriptorModel descriptorModel = DescriptorModel.getDefault().getServerModel(new Path(serverConfDir));
+// int port = descriptorModel.getJNDIPort();
+ int port = 1099;
+
Thread.currentThread().setContextClassLoader(twiddleLoader);
Properties props = new Properties();
props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
@@ -207,11 +208,7 @@
public class PollingSecurityException extends PollingException {
public PollingSecurityException(String msg) {super(msg);}
}
- public class PollingNamingException extends PollingException {
- public PollingNamingException(String msg) {super(msg);}
- }
-
public boolean getState() throws PollingException {
if( pollingException != null ) throw pollingException;
if( started == 0 ) return SERVER_DOWN;
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-07-19 00:47:40 UTC (rev 2512)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -22,11 +22,12 @@
package org.jboss.ide.eclipse.as.core.server;
import java.io.File;
-import java.io.FileFilter;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -42,10 +43,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.DescriptorModel;
-import org.jboss.ide.eclipse.as.core.model.DescriptorModel.ServerDescriptorModel;
-import org.jboss.ide.eclipse.as.core.model.DescriptorModel.ServerDescriptorModel.XPathTreeItem;
-import org.jboss.ide.eclipse.as.core.model.DescriptorModel.ServerDescriptorModel.XPathTreeItem2;
+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.runtime.IJBossServerLaunchDefaults;
import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.runtime.server.ServerLaunchDefaults;
@@ -122,21 +121,13 @@
}
return new ServerAttributeHelper(getServer(), copy);
}
-
-
-
public String getConfigDirectory() {
return getConfigDirectory(true);
}
public String getDeployDirectory() {
return getDeployDirectory(true);
}
-
- public ServerDescriptorModel getDescriptorModel() {
- String configPath = getConfigDirectory();
- return DescriptorModel.getDefault().getServerModel(new Path(configPath));
- }
public String getConfigDirectory(boolean checkLaunchConfig) {
if( !checkLaunchConfig )
@@ -191,49 +182,52 @@
return new Path(p).toOSString();
}
+ private static final IPath JNDI_KEY = new Path("Ports").append("JNDI");
+ private static final int JNDI_DEFAULT_PORT = 1099;
+ public int getJNDIPort() {
+ int port = findPort(JNDI_KEY);
+ return port == -1 ? JNDI_DEFAULT_PORT : port;
+ }
+ private static final IPath JBOSS_WEB_KEY = new Path("Ports").append("JBoss Web");
+ public static final int JBOSS_WEB_DEFAULT_PORT = 8080;
+ public int getJBossWebPort() {
+ int port = findPort(JBOSS_WEB_KEY);
+ return port == -1 ? JBOSS_WEB_DEFAULT_PORT : port;
+ }
+
+ protected int findPort(IPath path) {
+ XPathQuery query = XPathModel.getDefault().getQuery(this, path);
+ String result = query.getFirstResult();
+ if( result != null ) {
+ try {
+ return Integer.parseInt(result);
+ } catch( Exception e ) {}
+ }
+ return -1;
+ }
+
public URL getModuleRootURL(IModule module) {
- try {
- if (module == null || module.loadAdapter(IWebModule.class,null)==null )
- return null;
-
- IWebModule webModule =(IWebModule)module.loadAdapter(IWebModule.class,null);
- String host = getServer().getHost();
- String url = "http://"+host; //$NON-NLS-1$
- int port = -1;
-
- ServerDescriptorModel sdm = DescriptorModel.getDefault().getServerModel(new Path(getConfigDirectory()));
- FileFilter filter = new FileFilter() {
- public boolean accept(File pathname) {
- return pathname.getAbsolutePath().endsWith("server.xml");
- }
- };
- XPathTreeItem[] items = sdm.getXPath(
- "//Server/Service[@name='jboss.web']/Connector[count(@sslProtocol) = 0 and (count(@protocol) = 0 or @protocol = 'HTTP/1.1')]",
- "port", filter, false);
- if( items.length > 0 ) {
- try {
- port = Integer.parseInt(((XPathTreeItem2)items[0].getChildren()[0]).getAttributeValue());
- } catch(Exception e) {}
- }
- if( port == -1 ) port = 8080;
- //port =ServerUtil.getMonitoredPort(getServer(), port, "web"); //$NON-NLS-1$
- if (port != 80)
- url += ":" + port; //$NON-NLS-1$
+ if (module == null || module.loadAdapter(IWebModule.class,null)==null )
+ return null;
+
+ IWebModule webModule =(IWebModule)module.loadAdapter(IWebModule.class,null);
+ String host = getServer().getHost();
+ String url = "http://"+host; //$NON-NLS-1$
+ int port = getJBossWebPort();
+ if (port != 80)
+ url += ":" + port; //$NON-NLS-1$
- url += "/"+webModule.getContextRoot(); //$NON-NLS-1$
+ url += "/"+webModule.getContextRoot(); //$NON-NLS-1$
- if (!url.endsWith("/")) //$NON-NLS-1$
- url += "/"; //$NON-NLS-1$
+ if (!url.endsWith("/")) //$NON-NLS-1$
+ url += "/"; //$NON-NLS-1$
+ try {
return new URL(url);
- } catch (Exception e) {
- return null;
- }
- }
-
-
+ } catch( MalformedURLException murle) { return null; }
+ }
}
\ No newline at end of file
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-07-19 00:47:40 UTC (rev 2512)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerBehavior.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -48,7 +48,7 @@
public void stop(boolean force) {
int state = getServer().getServerState();
- if( force || process.isTerminated() || state == IServer.STATE_STOPPED) {
+ if( force || process == null || process.isTerminated() || state == IServer.STATE_STOPPED) {
forceStop();
return;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/ServerAttributeHelper.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/ServerAttributeHelper.java 2007-07-19 00:47:40 UTC (rev 2512)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/ServerAttributeHelper.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -21,9 +21,6 @@
*/
package org.jboss.ide.eclipse.as.core.server;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -33,10 +30,13 @@
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
-import org.jboss.ide.eclipse.as.core.model.DescriptorModel.ServerDescriptorModel.XPathTreeItem;
-import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.util.SimpleTreeItem;
+/**
+ * This class just opens up the get and set attributes for a server,
+ * and provides saving mechanisms.
+ * @author rstryker(a)redhat.com
+ *
+ */
public class ServerAttributeHelper {
private ServerWorkingCopy wch;
@@ -71,10 +71,6 @@
wch.setAttribute(attributeName, value);
}
-
-
-
-
public String getAttribute(String attributeName, String defaultValue) {
return wch.getAttribute(attributeName, defaultValue);
}
@@ -95,8 +91,6 @@
return wch.getAttribute(attributeName, defaultValue);
}
-
-
public boolean isDirty() {
return wch.isDirty();
}
@@ -110,207 +104,5 @@
return save(false, new NullProgressMonitor());
} catch( Exception e ) {}
return null;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public static final String PORTS_DEFAULT_CATEGORY = "Ports";
- public static final String XPATH_CATEGORIES = "_XPATH_CATEGORIES_";
- public static final String XPATH_CATEGORY2_PREFIX = "_XPATH_CATEGORY2_PREFIX_";
- public static final String XPATH_PROPERTY_PREFIX = "_XPATH_PROPERTY_PREFIX_";
- public static final String PORT_CATEGORY_PREF_KEY = "_PORT_CATEGORY_NAME_";
-
- public String getDefaultPortCategoryName() {
- return wch.getAttribute(PORT_CATEGORY_PREF_KEY, PORTS_DEFAULT_CATEGORY);
- }
- public void setDefaultPortCategoryName(String s) {
- wch.setAttribute(PORT_CATEGORY_PREF_KEY, s);
- }
-
- public SimpleXPathPreferenceTreeItem getXPathPreferenceTree() {
- List categories = wch.getAttribute(XPATH_CATEGORIES, (List)null);
- if( categories == null ) {
- return getDefaultXPathPreferenceTree();
- }
- SimpleXPathPreferenceTreeItem model = new SimpleXPathPreferenceTreeItem(null, XPATH_CATEGORIES);
- Iterator i = categories.iterator();
- while(i.hasNext()) {
- String categoryName = (String)i.next();
- SimpleXPathPreferenceTreeItem categoryItem = new SimpleXPathPreferenceTreeItem(model, categoryName);
- String categoryListKey = XPATH_CATEGORY2_PREFIX + categoryName;
- List categoryElementsAsList = wch.getAttribute(categoryListKey, new ArrayList());
- Iterator j = categoryElementsAsList.iterator();
- while(j.hasNext()) {
- String xpathName = (String)j.next();
- String finalKey = XPATH_PROPERTY_PREFIX + categoryName + xpathName;
- List xpathItem = wch.getAttribute(finalKey, new ArrayList());
- if( xpathItem.size() == 2 ) {
- XPathPreferenceTreeItem xpi = new XPathPreferenceTreeItem(categoryItem,
- (String)xpathItem.get(0), (String)xpathItem.get(1));
- } else if( xpathItem.size() == 3 ) {
- XPathPreferenceTreeItem xpi = new XPathPreferenceTreeItem(categoryItem,
- (String)xpathItem.get(0), (String)xpathItem.get(1), (String)xpathItem.get(2));
- }
- }
- }
-
- return model;
- }
-
- private SimpleXPathPreferenceTreeItem getDefaultXPathPreferenceTree() {
- SimpleXPathPreferenceTreeItem model = new SimpleXPathPreferenceTreeItem(null, XPATH_CATEGORIES);
-
- SimpleXPathPreferenceTreeItem ports = new SimpleXPathPreferenceTreeItem(model, PORTS_DEFAULT_CATEGORY);
-
-
-
- XPathPreferenceTreeItem jndi = new XPathPreferenceTreeItem(ports,
- "JNDI", "/server/mbean[@name='jboss:service=Naming']/attribute[@name='Port']");
- XPathPreferenceTreeItem jndiRMI = new XPathPreferenceTreeItem(ports,
- "JNDI RMI", "/server/mbean[@name='jboss:service=Naming']/attribute[@name='RmiPort']");
-
- XPathPreferenceTreeItem haJndiStub = new XPathPreferenceTreeItem(ports,
- "HA JNDI Stub", "//server/mbean[@name='jboss:service=HAJNDI']/attribute[@name='Port']");
-
- XPathPreferenceTreeItem haJndiRMI = new XPathPreferenceTreeItem(ports,
- "HA JNDI RMI", "//server/mbean[@name='jboss:service=HAJNDI']/attribute[@name='RmiPort']");
-
- XPathPreferenceTreeItem jrmpa = new XPathPreferenceTreeItem(ports,
- "JRMPA RMI Object", "//server/mbean[@name='jboss:service=invoker,type=jrmpha']/attribute[@name='RMIObjectPort']");
-
- XPathPreferenceTreeItem clusterUDPMcast = new XPathPreferenceTreeItem(ports,
- "Cluster UDP MCast", "//server/mbean[@name='jboss:service=${jboss.partition.name:DefaultPartition}']/attribute[@name='PartitionConfig']/Config/UDP", "mcast_port");
-
- XPathPreferenceTreeItem webservices = new XPathPreferenceTreeItem(ports,
- "Web Services", "//server/mbean[@name='jboss:service=WebService']/attribute[@name='Port']");
-
-// XPathPreferenceTreeItem hypersonic = new XPathPreferenceTreeItem(ports,
-// "HyperSonic", "//server/mbean[@name='jboss:service=Hypersonic']/attribute[@name='Port']");
-
- XPathPreferenceTreeItem jrmpInvoker = new XPathPreferenceTreeItem(ports,
- "JRMP Invoker", "//server/mbean[@name='jboss:service=invoker,type=jrmp']/attribute[@name='RMIObjectPort']");
-
- XPathPreferenceTreeItem pooledInvoker = new XPathPreferenceTreeItem(ports,
- "Pooled Invoker", "//server/mbean[@name='jboss:service=invoker,type=pooled']/attribute[@name='ServerBindPort']");
-
-
-
-
- return model;
- }
-
- public void saveXPathPreferenceTree(SimpleTreeItem tree) {
-
- SimpleTreeItem[] children = tree.getChildren();
- SimpleTreeItem[] grandChildren;
- ArrayList categoryList = new ArrayList();
- ArrayList xpathNameList, itemAsList;
- XPathPreferenceTreeItem xpathPrefItem;
- HashMap map = new HashMap();
- for( int i = 0; i < children.length; i++ ) {
- xpathNameList = new ArrayList();
- String categoryName = (String)children[i].getData();
- categoryList.add(categoryName); // add "Ports"
-
- grandChildren = children[i].getChildren(); // list of xpaths under "Ports"
- for( int j = 0; j < grandChildren.length; j++ ) {
- xpathPrefItem = ((XPathPreferenceTreeItem)grandChildren[j]); // JNDI
- itemAsList = new ArrayList();
- itemAsList.add(xpathPrefItem.getName());
- itemAsList.add(xpathPrefItem.getXPath());
- itemAsList.add(xpathPrefItem.getAttributeName());
- xpathNameList.add(xpathPrefItem.getName());
- map.put(XPATH_PROPERTY_PREFIX + categoryName + xpathPrefItem.getName(), itemAsList);
- }
- map.put(XPATH_CATEGORY2_PREFIX + categoryName, xpathNameList);
- }
- map.put(XPATH_CATEGORIES, categoryList);
-
- Iterator i = map.keySet().iterator();
- while( i.hasNext()) {
- String key = (String)i.next();
- wch.setAttribute(key, (List)map.get(key));
- }
-
- }
-
- /* Just a label class */
- public static class SimpleXPathPreferenceTreeItem extends SimpleTreeItem {
- public SimpleXPathPreferenceTreeItem(SimpleTreeItem parent, Object data) {
- super(parent, data);
- }
- }
- public static class XPathPreferenceTreeItem extends SimpleXPathPreferenceTreeItem {
- private String name;
- private String elementXPath;
- private String attributeName = null;
-
- public XPathPreferenceTreeItem(SimpleTreeItem parent, String key, String value) {
- super(parent, null);
- this.name = key;
- this.elementXPath = value;
- }
-
- public XPathPreferenceTreeItem(SimpleTreeItem parent, String key,
- String value, String attributeName ) {
- this(parent, key, value);
- this.attributeName = attributeName;
- }
- public String getName() {
- return name;
- }
- public String getXPath() {
- return elementXPath;
- }
- public void setXPath(String value) {
- this.elementXPath = value;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getAttributeName() {
- return attributeName;
- }
- public void setAttributeName(String attName) {
- this.attributeName = attName;
- }
-
- // actually a forced refresh
- public void ensureLoaded(IDeployableServer jbServer) {
- String XPATH_PROPERTY_LOADED = "_XPATH_PROPERTY_LOADED_";
-
- String xpath = getXPath();
- String attribute = getAttributeName();
- XPathTreeItem[] items = new XPathTreeItem[0];
- if( attribute == null || attribute.equals("")) {
- items = jbServer.getDescriptorModel().getXPath(xpath);
- } else {
- items = jbServer.getDescriptorModel().getXPath(xpath, attribute);
- }
-
- if( getProperty(XPATH_PROPERTY_LOADED) != null ) {
- //deleteChildren();
- return;
- }
- for( int i = 0; i < items.length; i++ ) {
- addChild(items[i]);
- }
- setProperty(XPATH_PROPERTY_LOADED, new Boolean(true));
- }
-
- }
-
-
-
+ }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/attributes/IDeployableServer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/attributes/IDeployableServer.java 2007-07-19 00:47:40 UTC (rev 2512)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/attributes/IDeployableServer.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -22,7 +22,6 @@
package org.jboss.ide.eclipse.as.core.server.attributes;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.core.model.DescriptorModel.ServerDescriptorModel;
import org.jboss.ide.eclipse.as.core.server.ServerAttributeHelper;
/**
@@ -34,5 +33,4 @@
public String getConfigDirectory();
public ServerAttributeHelper getAttributeHelper();
public IServer getServer();
- public ServerDescriptorModel getDescriptorModel();
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableServer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableServer.java 2007-07-19 00:47:40 UTC (rev 2512)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableServer.java 2007-07-19 00:48:10 UTC (rev 2513)
@@ -3,14 +3,11 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.model.ServerDelegate;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.model.DescriptorModel;
-import org.jboss.ide.eclipse.as.core.model.DescriptorModel.ServerDescriptorModel;
import org.jboss.ide.eclipse.as.core.server.ServerAttributeHelper;
import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
@@ -19,22 +16,37 @@
public static final String DEPLOY_DIRECTORY = "org.jboss.ide.eclipse.as.core.server.stripped.deploy_directory";
public DeployableServer() {
- // TODO Auto-generated constructor stub
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.server.core.model.ServerDelegate#canModifyModules(org.eclipse.wst.server.core.IModule[], org.eclipse.wst.server.core.IModule[])
+ */
public IStatus canModifyModules(IModule[] add, IModule[] remove) {
return new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID,0, "OK", null);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.server.core.model.ServerDelegate#getChildModules(org.eclipse.wst.server.core.IModule[])
+ */
public IModule[] getChildModules(IModule[] module) {
// TODO Auto-generated method stub
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.server.core.model.ServerDelegate#getRootModules(org.eclipse.wst.server.core.IModule)
+ */
public IModule[] getRootModules(IModule module) throws CoreException {
return new IModule[] { module };
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.server.core.model.ServerDelegate#modifyModules(org.eclipse.wst.server.core.IModule[], org.eclipse.wst.server.core.IModule[], org.eclipse.core.runtime.IProgressMonitor)
+ */
public void modifyModules(IModule[] add, IModule[] remove,
IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
@@ -47,6 +59,10 @@
return getAttribute(DEPLOY_DIRECTORY, "");
}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer#getAttributeHelper()
+ */
public ServerAttributeHelper getAttributeHelper() {
IServerWorkingCopy copy = getServerWorkingCopy();
if( copy == null ) {
@@ -59,10 +75,4 @@
public String getConfigDirectory() {
return getDeployDirectory();
}
-
- public ServerDescriptorModel getDescriptorModel() {
- return DescriptorModel.getDefault().getServerModel(new Path(getDeployDirectory()));
- }
-
-
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.40.default.ports.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.40.default.ports.properties (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.40.default.ports.properties 2007-07-19 00:48:10 UTC (rev 2513)
@@ -0,0 +1,15 @@
+JNDI=//server/mbean[@name='jboss:service=Naming']/attribute[@name='Port']
+JNDI_FILE=**/jboss-service.xml
+JBoss_Web=//Server/Service[@name='jboss.web']/Connector[count(@sslProtocol) = 0 and (count(@protocol) = 0 or @protocol = 'HTTP/1.1')]
+JBoss_Web_ATTRIBUTE=port
+JBoss_Web_FILE=**/*server.xml
+JNDI_RMI=//server/mbean[@name='jboss:service=Naming']/attribute[@name='RmiPort']
+HA_JNDI_STUB=//server/mbean[@name='jboss:service=HAJNDI']/attribute[@name='Port']
+HA_JNDI_RMI=//server/mbean[@name='jboss:service=HAJNDI']/attribute[@name='RmiPort']
+JRMPA_RMI_OBJECT=//server/mbean[@name='jboss:service=invoker,type=jrmpha']/attribute[@name='RMIObjectPort']
+CLUSTER_UDP_MCAST=//server/mbean[@name='jboss:service=${jboss.partition.name:DefaultPartition}']/attribute[@name='PartitionConfig']/Config/UDP
+CLUSTER_UDP_MCAST_ATTRIBUTE=mcast_port
+Web_Services=//server/mbean[@name='jboss:service=WebService']/attribute[@name='Port']
+Hypersonic=//server/mbean[@name='jboss:service=Hypersonic']/attribute[@name='Port']
+JRMP_Invoker=//server/mbean[@name='jboss:service=invoker,type=jrmp']/attribute[@name='RMIObjectPort']
+Pooled_Invoker=//server/mbean[@name='jboss:service=invoker,type=pooled']/attribute[@name='ServerBindPort']
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.42.default.ports.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.42.default.ports.properties (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.42.default.ports.properties 2007-07-19 00:48:10 UTC (rev 2513)
@@ -0,0 +1,20 @@
+# As much as possible, try to create file patterns that match
+# as few files as possible. Each matching file *WILL* be scanned
+# and cached, regardless of if there's a match.
+
+JNDI=//server/mbean[@name='jboss:service=Naming']/attribute[@name='Port']
+JNDI_FILE=**/jboss-service.xml
+JBoss_Web=//Server/Service[@name='jboss.web']/Connector[count(@sslProtocol) = 0 and (count(@protocol) = 0 or @protocol = 'HTTP/1.1')]
+JBoss_Web_ATTRIBUTE=port
+JBoss_Web_FILE=**/*server.xml
+JNDI_RMI=//server/mbean[@name='jboss:service=Naming']/attribute[@name='RmiPort']
+JNDI_RMI_FILE=**/jboss-service.xml
+Web_Services=//server/mbean[@name='jboss:service=WebService']/attribute[@name='Port']
+JRMP_Invoker=//server/mbean[@name='jboss:service=invoker,type=jrmp']/attribute[@name='RMIObjectPort']
+Pooled_Invoker=//server/mbean[@name='jboss:service=invoker,type=pooled']/attribute[@name='ServerBindPort']
+#HA_JNDI_STUB=//server/mbean[@name='jboss:service=HAJNDI']/attribute[@name='Port']
+#HA_JNDI_RMI=//server/mbean[@name='jboss:service=HAJNDI']/attribute[@name='RmiPort']
+#JRMPA_RMI_OBJECT=//server/mbean[@name='jboss:service=invoker,type=jrmpha']/attribute[@name='RMIObjectPort']
+#CLUSTER_UDP_MCAST=//server/mbean[@name='jboss:service=${jboss.partition.name:DefaultPartition}']/attribute[@name='PartitionConfig']/Config/UDP
+#CLUSTER_UDP_MCAST_ATTRIBUTE=mcast_port
+#Hypersonic=//server/mbean[@name='jboss:service=Hypersonic']/attribute[@name='Port']
17 years, 5 months