JBoss Tools SVN: r2037 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.core: META-INF and 22 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-21 15:51:45 -0400 (Mon, 21 May 2007)
New Revision: 2037
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/LICENSE-truezip.txt
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/concurrent.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-4.0.4.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jbossxb-1.0.1.TEST.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/truezip-6.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/xercesImpl.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/log4j.xml
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/archiveTypes.exsd
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCorePlugin.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/Trace.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchiveNodeFactory.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModelCore.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchive.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFolder.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModelListenerManager.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModelNode.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNode.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeDelta.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeVisitor.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveType.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/events/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/events/EventManager.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveDeltaPreNodeFactory.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFolderImpl.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveModelNode.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeDeltaImpl.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeImpl.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFileSet.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFolder.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackage.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNode.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNodeWithProperties.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackages.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackagesObjectProvider.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperties.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperty.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IArchiveBuildListener.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IArchiveModelListener.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IExtensionManager.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IPreferenceManager.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IRuntimeVariables.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/StandaloneVariables.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspacePreferenceManager.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVariables.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/AbstractArchiveType.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/JARArchiveType.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/project/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/project/ArchivesNature.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/project/ProjectUtils.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/TrueZipUtil.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/xml/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/xml/packages.xsd
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/.classpath
Log:
project rebuilt
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/.classpath
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/.classpath 2007-05-21 19:50:52 UTC (rev 2036)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/.classpath 2007-05-21 19:51:45 UTC (rev 2037)
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="src" path="src/main"/>
<classpathentry exported="true" kind="lib" path="lib/jboss-common-4.0.4.jar" sourcepath="C:/Users/Marshall/Downloads/jbossxb-1.0.1.TEST-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jbossxb-1.0.1.TEST.jar"/>
<classpathentry exported="true" kind="lib" path="lib/xercesImpl.jar"/>
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/LICENSE-truezip.txt
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/LICENSE-truezip.txt (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/LICENSE-truezip.txt 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,203 @@
+Updated for release.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,32 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JBossIDE Packages Core Plug-in
+Bundle-SymbolicName: org.jboss.ide.eclipse.archives.core;singleton:=true
+Bundle-Version: 2.0.0
+Bundle-Activator: org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin
+Bundle-Vendor: JBoss, a division of Red Hat
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.filesystem,
+ org.eclipse.core.commands,
+ org.apache.ant,
+ org.eclipse.core.resources,
+ org.eclipse.jdt.core
+Eclipse-LazyStart: true
+Bundle-ClassPath: packagescore.jar,
+ lib/concurrent.jar,
+ lib/truezip-6.jar,
+ lib/xercesImpl.jar,
+ lib/jboss-common-4.0.4.jar,
+ lib/jbossxb-1.0.1.TEST.jar
+Export-Package: org.jboss.ide.eclipse.archives.core,
+ org.jboss.ide.eclipse.archives.core.build,
+ org.jboss.ide.eclipse.archives.core.model,
+ org.jboss.ide.eclipse.archives.core.model.events;x-friends:="org.jboss.ide.eclipse.archives.test",
+ org.jboss.ide.eclipse.archives.core.model.internal;x-friends:="org.jboss.ide.eclipse.archives.test",
+ org.jboss.ide.eclipse.archives.core.model.internal.xb;x-friends:="org.jboss.ide.eclipse.archives.test",
+ org.jboss.ide.eclipse.archives.core.model.other,
+ org.jboss.ide.eclipse.archives.core.model.other.internal;x-friends:="org.jboss.ide.eclipse.archives.test",
+ org.jboss.ide.eclipse.archives.core.project;x-friends:="org.jboss.ide.eclipse.archives.test",
+ org.jboss.ide.eclipse.archives.core.util;x-friends:="org.jboss.ide.eclipse.archives.test",
+ org.jboss.ide.eclipse.archives.core.util.internal;x-friends:="org.jboss.ide.eclipse.archives.test"
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,17 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.xml,\
+ packagescore.jar,\
+ xml/,\
+ lib/,\
+ LICENSE-truezip.txt,\
+ lib/xercesImpl.jar,\
+ lib/jboss-common-4.0.4.jar,\
+ lib/jbossxb-1.0.1.TEST.jar,\
+ log4j.xml
+source.packagescore.jar = src/main/
+src.includes = LICENSE-truezip.txt,\
+ src/,\
+ xml/,\
+ plugin.xml,\
+ META-INF/
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/concurrent.jar
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/concurrent.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-4.0.4.jar
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-4.0.4.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jbossxb-1.0.1.TEST.jar
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jbossxb-1.0.1.TEST.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/truezip-6.jar
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/truezip-6.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/xercesImpl.jar
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/xercesImpl.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/log4j.xml
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/log4j.xml (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/log4j.xml 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 1903 2007-04-18 21:07:54Z rawb $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="TRACE"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <category name="org.jboss.xb">
+
+ </category>
+
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+</log4j:configuration>
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="archiveTypes" name="JBossIDE Package Type" schema="schema/archiveTypes.exsd"/>
+ <extension
+ id="archivesNature"
+ name="JBossIDE Packages Nature"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run class="org.jboss.ide.eclipse.archives.core.project.ArchivesNature"/>
+ </runtime>
+ <builder id="org.jboss.ide.eclipse.archives.core.archivesBuilder"/>
+ </extension>
+ <extension
+ id="archivesBuilder"
+ name="JBossIDE Packages Builder"
+ point="org.eclipse.core.resources.builders">
+ <builder
+ hasNature="true"
+ >
+ <run class="org.jboss.ide.eclipse.archives.core.project.ArchivesBuilder"/>
+ </builder>
+ </extension>
+ <extension
+ point="org.jboss.ide.eclipse.archives.core.archiveTypes">
+ <packageType
+ class="org.jboss.ide.eclipse.archives.core.model.types.JARArchiveType"
+ id="jar"
+ label="JAR"/>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspacePreferenceManager"/>
+ </extension>
+
+</plugin>
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/archiveTypes.exsd
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/archiveTypes.exsd (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/archiveTypes.exsd 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,119 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.ide.eclipse.archives.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.ide.eclipse.archives.core" id="packageTypes" name="JBossIDE Package Type"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="packageType"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="packageType">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.jboss.ide.eclipse.archives.core.model.types.IPackageType"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,54 @@
+package org.jboss.ide.eclipse.archives.core;
+
+import org.jboss.ide.eclipse.archives.core.model.other.IExtensionManager;
+import org.jboss.ide.eclipse.archives.core.model.other.IPreferenceManager;
+import org.jboss.ide.eclipse.archives.core.model.other.IRuntimeVariables;
+import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceExtensionManager;
+import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspacePreferenceManager;
+import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVariables;
+
+public class ArchivesCore {
+
+ private static ArchivesCore instance;
+ public static ArchivesCore getInstance() {
+ if( instance == null )
+ instance = new ArchivesCore(WORKSPACE);
+ return instance;
+ }
+ public static void create(int type) {
+ instance = new ArchivesCore(type);
+ }
+
+ public static final int STANDALONE = 0;
+ public static final int WORKSPACE = 1;
+
+ private int runType;
+ private IRuntimeVariables variables;
+ private IExtensionManager extensionManager;
+ private IPreferenceManager preferenceManager;
+
+ public ArchivesCore(int runType) {
+ this.runType = runType;
+ if( this.runType == STANDALONE) {
+ //variables = new StandaloneVariables();
+ } else {
+ variables = new WorkspaceVariables();
+ extensionManager = new WorkspaceExtensionManager();
+ preferenceManager = new WorkspacePreferenceManager();
+ }
+ }
+
+ public boolean isWorkspaceRuntype() {
+ return runType == WORKSPACE;
+ }
+
+ public IRuntimeVariables getVariables() {
+ return variables;
+ }
+ public IExtensionManager getExtensionManager() {
+ return extensionManager;
+ }
+ public IPreferenceManager getPreferenceManager() {
+ return preferenceManager;
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCorePlugin.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCorePlugin.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCorePlugin.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core;
+
+import org.eclipse.core.runtime.Plugin;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ * @author rstryker
+ *
+ */public class ArchivesCorePlugin extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.archives.core";
+
+ // The shared instance
+ private static ArchivesCorePlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public ArchivesCorePlugin() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+
+ // force JBossXB initialization
+ XMLBinding.init();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static ArchivesCorePlugin getDefault() {
+ return plugin;
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/Trace.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/Trace.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/Trace.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core;
+
+
+public class Trace {
+
+ public static final String DEBUG_OPTION_ROOT = "org.jboss.ide.eclipse.packages.core/debug/";
+ public static final String DEBUG_OPTION_STREAM_CLOSE = DEBUG_OPTION_ROOT + "streamClose";
+
+ public static boolean isDebugging(String option) {
+ return ArchivesCore.getInstance().getVariables().isDebugging(option);
+ }
+
+ public static void trace (Class caller, String message) {
+ trace(caller, message, null);
+ }
+
+ public static void trace (Class caller, String message, String option) {
+ trace(caller, message, null, option);
+ }
+
+ public static void trace (Class caller, Throwable t) {
+ trace(caller, t, null);
+ }
+
+ public static void trace (Class caller, Throwable t, String option) {
+ trace(caller, t.getMessage(), t, option);
+ }
+
+ public static void trace (Class caller, String message, Throwable t, String option) {
+ if (!isDebugging(null))
+ return;
+
+ if (option != null) {
+ if (!isDebugging(option))
+ return;
+ }
+
+ System.out.println("[" + caller.getName() + "] " + message);
+
+ if (t != null) {
+ t.printStackTrace();
+ }
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,178 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.build;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IPath;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.events.EventManager;
+import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
+import org.jboss.ide.eclipse.archives.core.util.internal.ModelTruezipBridge;
+import org.jboss.ide.eclipse.archives.core.util.internal.TrueZipUtil;
+
+/**
+ * This delegate will either build from the model completely
+ * (if the builder has been given a full build request) or
+ * incrementally update the changed files in
+ * **ANY AND ALL** filesets that they match, regardless of project.
+ *
+ * @author Rob Stryker (rob.stryker(a)redhat.com)
+ *
+ */
+public class ArchiveBuildDelegate {
+
+ public ArchiveBuildDelegate() {
+ }
+
+
+ /**
+ * A full project build has been requested.
+ * @param project The project containing the archive model
+ */
+ public void fullProjectBuild(IPath project) {
+ EventManager.cleanProjectBuild(project);
+ EventManager.startedBuild(project);
+
+ IArchiveModelNode root = ArchivesModel.instance().getRoot(project);
+ IArchiveNode[] nodes = root.getChildren(IArchiveNode.TYPE_ARCHIVE);
+ for( int i = 0; i < nodes.length; i++ ) {
+ fullArchiveBuild(((IArchive)nodes[i]));
+ }
+
+ EventManager.finishedBuild(project);
+ }
+
+ /**
+ * Builds an archive entirely, overwriting whatever was in the output destination.
+ * @param pkg The archive to build
+ */
+ public void fullArchiveBuild(IArchive pkg) {
+ EventManager.cleanArchiveBuild(pkg);
+ EventManager.startedBuildingArchive(pkg);
+
+ ModelTruezipBridge.deleteArchive(pkg);
+ ModelTruezipBridge.createFile(pkg);
+
+ // force create all folders
+ IArchiveFolder[] folders = ModelUtil.findAllDescendentFolders(pkg);
+ for( int i = 0; i < folders.length; i++ ) {
+ ModelTruezipBridge.createFile(folders[i]);
+ }
+
+ // build the filesets
+ IArchiveFileSet[] filesets = ModelUtil.findAllDescendentFilesets(pkg);
+ for( int i = 0; i < filesets.length; i++ ) {
+ fullFilesetBuild(filesets[i], pkg);
+ }
+
+ EventManager.finishedBuildingArchive(pkg);
+ }
+
+ /**
+ * Build the given fileset
+ * @param fileset The fileset to match
+ * @param topLevel The top level archive that the fileset belongs to
+ */
+ public void fullFilesetBuild(IArchiveFileSet fileset, IArchive topLevel) {
+ EventManager.startedCollectingFileSet(fileset);
+
+ // reset the scanner. It *is* a full build afterall
+ fileset.resetScanner();
+ IPath[] paths = fileset.findMatchingPaths();
+ ModelTruezipBridge.fullFilesetBuild(fileset);
+
+ EventManager.filesUpdated(topLevel, fileset, paths);
+ EventManager.finishedCollectingFileSet(fileset);
+ }
+
+
+
+
+ /**
+ * Incremental Build!!
+ * Parameters are instances of changed IPath objects.
+ * Will search the entire model for matching filesets.
+ *
+ * @param addedChanged Set of changed / added resources
+ * @param setRemoved Set of removed resources
+ */
+ public void projectIncrementalBuild(Set addedChanged, Set removed) {
+ incrementalBuild(null, addedChanged, removed);
+ }
+
+ /**
+ * Incremental build.
+ * Parameters are instance sof changed IPath objects
+ * Will search only the given node for descendent filesets
+ * @param archive An archive to limit the scope to, or null if the entire model
+ * @param addedChanged A list of added or changed resource paths
+ * @param removed A list of removed resource paths
+ */
+ public void incrementalBuild(IArchive archive, Set addedChanged, Set removed) {
+
+ // find any and all filesets that match each file
+ Iterator i = addedChanged.iterator();
+ IPath path;
+ IArchiveFileSet[] matchingFilesets;
+ ArrayList topPackagesChanged = new ArrayList();
+ while(i.hasNext()) {
+ path = ((IPath)i.next());
+ matchingFilesets = ModelUtil.getMatchingFilesets(archive, path);
+ localFireAffectedTopLevelPackages(topPackagesChanged, matchingFilesets);
+ ModelTruezipBridge.copyFiles(matchingFilesets, new IPath[] { path }, false);
+ EventManager.fileUpdated(path, matchingFilesets);
+ }
+
+ i = removed.iterator();
+ while(i.hasNext()) {
+ path = ((IPath)i.next());
+ matchingFilesets = ModelUtil.getMatchingFilesets(archive, path);
+ localFireAffectedTopLevelPackages(topPackagesChanged, matchingFilesets);
+ ModelTruezipBridge.deleteFiles(matchingFilesets, new IPath[] { path }, false);
+ EventManager.fileRemoved(path, matchingFilesets);
+ }
+
+ TrueZipUtil.sync();
+
+ i = topPackagesChanged.iterator();
+ while(i.hasNext()) {
+ EventManager.finishedBuildingArchive((IArchive)i.next());
+ }
+ }
+
+ private void localFireAffectedTopLevelPackages(ArrayList affected, IArchiveFileSet[] filesets) {
+ for( int i = 0; i < filesets.length; i++ ) {
+ if( !affected.contains(filesets[i].getRootArchive())) {
+ affected.add(filesets[i].getRootArchive());
+ EventManager.startedBuildingArchive(filesets[i].getRootArchive());
+ }
+ }
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,207 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.build;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
+import org.jboss.ide.eclipse.archives.core.model.events.EventManager;
+import org.jboss.ide.eclipse.archives.core.model.other.IArchiveModelListener;
+import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
+import org.jboss.ide.eclipse.archives.core.util.internal.ModelTruezipBridge;
+
+/**
+ * This class responds to model change events.
+ * It is given a delta as to what nodes are added, removed, or changed.
+ * It then keeps the output file for the top level archive in sync with
+ * the changes to the model.
+ *
+ * If the automatic builder is not enabled for this project, the listener
+ * does nothing.
+ *
+ * @author Rob Stryker (rob.stryker(a)redhat.com)
+ *
+ */
+public class ModelChangeListener implements IArchiveModelListener {
+
+ /**
+ * This is the entry point for model change events.
+ * It immediately passes the delta to be handled.
+ */
+ public void modelChanged(IArchiveNodeDelta delta) {
+ // if we're not building, get out
+ if( !ArchivesCore.getInstance().getPreferenceManager().isBuilderEnabled(delta.getPostNode().getProjectPath()))
+ return;
+
+ try {
+ handle(delta);
+ } catch( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * This can handle any type of node / delta, not just
+ * root elements. If the node is added or removed, it
+ * will handle those segments and return without checking
+ * the children at all. IT is the responsibility of the add
+ * and remove methods to go through the children.
+ *
+ * Otherwise, it will simply handle attribute children and then
+ * move on to the children.
+ *
+ * @param delta
+ */
+ private void handle(IArchiveNodeDelta delta) {
+ if( (delta.getKind() & IArchiveNodeDelta.REMOVED) != 0 ) {
+ nodeRemoved(delta.getPreNode());
+ return;
+ } else if( (delta.getKind() & IArchiveNodeDelta.ADDED) != 0 ) {
+ nodeAdded(delta.getPostNode());
+ return;
+ } else if( (delta.getKind() & IArchiveNodeDelta.ATTRIBUTE_CHANGED) != 0) {
+ boolean shouldHandleChildren = handleAttributeChange(delta);
+ if( shouldHandleChildren ) {
+ IArchiveNodeDelta[] children = delta.getAllAffectedChildren();
+ for( int i = 0; i < children.length; i++ ) {
+ handle(children[i]);
+ }
+ }
+ } else if( descendentChanged(delta.getKind()) ) {
+ IArchiveNodeDelta[] children = delta.getAllAffectedChildren();
+ for( int i = 0; i < children.length; i++ ) {
+ handle(children[i]);
+ }
+ }
+ }
+ protected boolean descendentChanged(int kind) {
+ return (kind & IArchiveNodeDelta.DESCENDENT_CHANGED) != 0 ||
+ (kind & IArchiveNodeDelta.CHILD_ADDED) != 0 ||
+ (kind & IArchiveNodeDelta.CHILD_REMOVED) != 0;
+ }
+
+ /**
+ * Handle changes in this node
+ * @param delta
+ * @return Whether or not the caller should also handle the children
+ */
+ private boolean handleAttributeChange(IArchiveNodeDelta delta) {
+ switch( delta.getPostNode().getNodeType()) {
+ case IArchiveNode.TYPE_ARCHIVE_FOLDER:
+ return handleFolderAttributeChanged(delta);
+ case IArchiveNode.TYPE_ARCHIVE_FILESET:
+ return handleFilesetAttributeChanged(delta);
+ case IArchiveNode.TYPE_ARCHIVE:
+ return handlePackageAttributeChanged(delta);
+ }
+ return false;
+ }
+
+ private boolean handleFolderAttributeChanged(IArchiveNodeDelta delta) {
+ nodeRemoved(delta.getPreNode());
+ nodeAdded(delta.getPostNode());
+ return false;
+ }
+
+ private boolean handleFilesetAttributeChanged(IArchiveNodeDelta delta) {
+ nodeRemoved(delta.getPreNode());
+ nodeAdded(delta.getPostNode());
+ return false;
+ }
+
+ private boolean handlePackageAttributeChanged(IArchiveNodeDelta delta) {
+ nodeRemoved(delta.getPreNode());
+ nodeAdded(delta.getPostNode());
+ return false;
+ }
+
+
+
+
+ private void nodeAdded(IArchiveNode added) {
+ if( added.getNodeType() == IArchiveNode.TYPE_ARCHIVE) {
+ // create the package
+ ModelTruezipBridge.createFile(added);
+ } else if( added.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER ) {
+ // create hte folder
+ ModelTruezipBridge.createFile(added);
+ }
+ IArchiveFileSet[] filesets = ModelUtil.findAllDescendentFilesets(added);
+ for( int i = 0; i < filesets.length; i++ ) {
+ ModelTruezipBridge.fullFilesetBuild(filesets[i]);
+ IPath[] paths = filesets[i].findMatchingPaths();
+ EventManager.filesUpdated(filesets[i].getRootArchive(), filesets[i], paths);
+ }
+ refreshLocal(added);
+ }
+
+
+ private void nodeRemoved(IArchiveNode removed) {
+ if( removed.getNodeType() == IArchiveNode.TYPE_ARCHIVE) {
+ ModelTruezipBridge.deleteArchive((IArchive)removed);
+ refreshLocal(removed);
+ return;
+ } else if( removed.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER ){
+ IArchiveFileSet[] filesets = ModelUtil.findAllDescendentFilesets(((IArchiveFolder)removed));
+ for( int i = 0; i < filesets.length; i++ ) {
+ IPath[] removedPaths = ModelTruezipBridge.fullFilesetRemove(((IArchiveFileSet)removed), false);
+ EventManager.filesRemoved(removedPaths, ((IArchiveFileSet)removed));
+ }
+ refreshLocal(removed);
+ return;
+ }
+
+ IArchiveFileSet[] filesets = ModelUtil.findAllDescendentFilesets(removed);
+ for( int i = 0; i < filesets.length; i++ ) {
+ IPath[] removedPaths = ModelTruezipBridge.fullFilesetRemove(((IArchiveFileSet)removed), false);
+ EventManager.filesRemoved(removedPaths, ((IArchiveFileSet)removed));
+ }
+ refreshLocal(removed);
+ }
+
+
+ // refresh the file tree structure
+ private void refreshLocal(IArchiveNode node) {
+ IArchive pack = node.getRootArchive();
+ if( pack != null && pack.isDestinationInWorkspace() ) {
+ // refresh the root package node
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IResource res = root.getContainerForLocation(pack.getDestinationPath());
+ if( res != null ) {
+ try {
+ res.getParent().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch( CoreException ce ) {
+ }
+ }
+ }
+
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchiveNodeFactory.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchiveNodeFactory.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchiveNodeFactory.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,45 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model;
+
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveFileSetImpl;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveFolderImpl;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveImpl;
+
+/**
+ * Just a factory for extenders to access our secret internals
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ *
+ */
+public class ArchiveNodeFactory {
+ public static IArchive createArchive() {
+ return new ArchiveImpl();
+ }
+
+ public static IArchiveFileSet createFileset() {
+ return new ArchiveFileSetImpl();
+ }
+
+ public static IArchiveFolder createFolder() {
+ return new ArchiveFolderImpl();
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,343 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.Trace;
+import org.jboss.ide.eclipse.archives.core.build.ModelChangeListener;
+import org.jboss.ide.eclipse.archives.core.model.events.EventManager;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveFileSetImpl;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveFolderImpl;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveImpl;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveModelNode;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFolder;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNode;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
+import org.jboss.ide.eclipse.archives.core.model.other.IArchiveBuildListener;
+import org.jboss.ide.eclipse.archives.core.model.other.IArchiveModelListener;
+import org.jboss.ide.eclipse.archives.core.project.ProjectUtils;
+
+/**
+ * The root model which keeps track of registered projects
+ * and what archives / model nodes they contain.
+ *
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ */
+public class ArchivesModel implements IArchiveModelListenerManager {
+
+ /**
+ * The packages file name
+ */
+ public static final String PROJECT_PACKAGES_FILE = ".packages";
+
+ /**
+ * Singleton instance
+ */
+ protected static ArchivesModel instance;
+ public static ArchivesModel instance() {
+ if( instance == null )
+ instance = new ArchivesModel();
+ return instance;
+ }
+
+ private HashMap xbPackages; // maps an IPath (of a project) to XbPackages
+ private HashMap archivesRoot; // maps an IPath (of a project) to PackageModelNode, aka root
+ private ArrayList buildListeners, modelListeners;
+ public ArchivesModel() {
+ xbPackages = new HashMap();
+ archivesRoot = new HashMap();
+ buildListeners = new ArrayList();
+ modelListeners = new ArrayList();
+ addModelListener(new ModelChangeListener());
+ }
+
+
+
+ /*
+ * Listeners
+ */
+ public void addBuildListener(IArchiveBuildListener listener) {
+ if( !buildListeners.contains(listener))
+ buildListeners.add(listener);
+ }
+ public void removeBuildListener(IArchiveBuildListener listener) {
+ if( buildListeners.contains(listener))
+ buildListeners.remove(listener);
+ }
+ public IArchiveBuildListener[] getBuildListeners() {
+ return (IArchiveBuildListener[]) buildListeners.toArray(new IArchiveBuildListener[buildListeners.size()]);
+ }
+
+ public void addModelListener(IArchiveModelListener listener) {
+ if( !modelListeners.contains(listener))
+ modelListeners.add(listener);
+ }
+ public void removeModelListener(IArchiveModelListener listener) {
+ if( modelListeners.contains(listener))
+ modelListeners.remove(listener);
+ }
+ public IArchiveModelListener[] getModelListeners() {
+ return (IArchiveModelListener[]) modelListeners.toArray(new IArchiveModelListener[modelListeners.size()]);
+ }
+
+
+
+
+
+
+ public XbPackages getXbPackages(IPath project) {
+ return (XbPackages)(xbPackages.get(project));
+ }
+
+ /**
+ * If the project hasn't been registered, register it
+ * @param project
+ * @param monitor
+ * @return
+ */
+ public XbPackages getXbPackages(IPath project, IProgressMonitor monitor) {
+ if( !xbPackages.containsKey(project))
+ registerProject(project, monitor);
+ return (XbPackages)(xbPackages.get(project));
+ }
+
+ /**
+ * Accept a visitor
+ */
+ public boolean accept(IArchiveNodeVisitor visitor) {
+ IArchiveNode children[] = getAllArchives();
+ boolean keepGoing = true;
+
+ if (keepGoing) {
+ for (int i = 0; i < children.length; i++) {
+ if (keepGoing) {
+ keepGoing = children[i].accept(visitor);
+ }
+ }
+ }
+
+ return keepGoing;
+ }
+
+ /**
+ * Gets every single *registered* model
+ * @return
+ */
+ protected ArchiveModelNode[] getAllArchives() {
+ ArchiveModelNode[] ret = new ArchiveModelNode[archivesRoot.keySet().size()];
+ Iterator i = archivesRoot.keySet().iterator();
+ int x = 0;
+ while(i.hasNext()) {
+ ret[x++] = (ArchiveModelNode)archivesRoot.get(i.next());
+ }
+ return ret;
+ }
+
+ /**
+ * Get the root node for this object
+ * @param project
+ * @return
+ */
+ public IArchiveModelNode getRoot(IPath project) {
+ return getRoot(project, false, new NullProgressMonitor());
+ }
+
+ public IArchiveModelNode getRoot(IPath project, boolean register, IProgressMonitor monitor) {
+ if( archivesRoot.get(project) == null && register ) {
+ registerProject(project, monitor);
+ }
+ return (IArchiveModelNode)(archivesRoot.get(project));
+ }
+
+ public IArchive[] getProjectArchives(IPath project) {
+ return getProjectArchives(project, false, new NullProgressMonitor());
+ }
+ public IArchive[] getProjectArchives(IPath project, boolean register, IProgressMonitor monitor) {
+ IArchiveModelNode root = getRoot(project);
+ if( root != null ) {
+ List list = Arrays.asList( getRoot(project).getAllChildren());
+ return (IArchive[]) list.toArray(new IArchive[list.size()]);
+ } else {
+ registerProject(project, monitor);
+ List list = Arrays.asList( getRoot(project).getAllChildren());
+ return (IArchive[]) list.toArray(new IArchive[list.size()]);
+ }
+ }
+
+ // to make sure the node root is actually in the model
+ public boolean containsRoot(ArchiveModelNode node) {
+ return archivesRoot.containsValue(node);
+ }
+
+ private void addNature(IPath project) {
+ try {
+ ProjectUtils.addProjectNature(project);
+ } catch(Exception e) {
+ }
+ }
+ public void registerProject(IPath project, IProgressMonitor monitor) {
+ // if the file exists, read it in
+ monitor.beginTask("Loading configuration...", XMLBinding.NUM_UNMARSHAL_MONITOR_STEPS + 2);
+
+ if( ArchivesCore.getInstance().isWorkspaceRuntype()) {
+ addNature(project);
+ }
+
+ ArchiveModelNode root;
+ IPath packagesFile = project.append(PROJECT_PACKAGES_FILE);
+ if (packagesFile.toFile().exists())
+ {
+ try {
+ FileInputStream is = new FileInputStream(packagesFile.toFile());
+ XbPackages packages = XMLBinding.unmarshal(is, monitor);
+ monitor.worked(1);
+
+ if (packages == null) {
+ // Empty / non-working XML file loaded
+ Trace.trace(getClass(), "WARNING: .packages file for project " + project.lastSegment() + " is empty or contains the wrong content");
+ return;
+ }
+ root = new ArchiveModelNode(project, packages, this);
+ xbPackages.put(project, packages);
+ archivesRoot.put(project, root);
+ createPackageNodeImpl(project, packages, null);
+ root.clearDeltas();
+ monitor.worked(1);
+ } catch (FileNotFoundException e) {
+ Trace.trace(getClass(), e);
+ }
+ } else {
+ // file not found, just create some default xbpackages and insert them
+ XbPackages packages = new XbPackages();
+ xbPackages.put(project, packages);
+ archivesRoot.put(project, new ArchiveModelNode(project, packages, this));
+ }
+ }
+
+ protected ArchiveNodeImpl createPackageNodeImpl (IPath project, XbPackageNode node, IArchiveNode parent) {
+
+ if( node instanceof XbPackages ) {
+ ArchiveModelNode impl = (ArchiveModelNode)getRoot(project);
+ for (Iterator iter = node.getAllChildren().iterator(); iter.hasNext(); ) {
+ XbPackageNode child = (XbPackageNode) iter.next();
+ ArchiveNodeImpl childImpl = createPackageNodeImpl(project, child, impl);
+ if (impl != null && childImpl != null) {
+ impl.addChild(childImpl, false);
+ }
+ }
+ return null;
+ }
+
+ ArchiveNodeImpl nodeImpl = null;
+ if (node instanceof XbPackage) {
+ nodeImpl = new ArchiveImpl((XbPackage)node);
+ } else if (node instanceof XbFolder) {
+ nodeImpl = new ArchiveFolderImpl((XbFolder)node);
+ } else if (node instanceof XbFileSet) {
+ nodeImpl = new ArchiveFileSetImpl((XbFileSet)node);
+ }
+
+ for (Iterator iter = node.getAllChildren().iterator(); iter.hasNext(); ) {
+ XbPackageNode child = (XbPackageNode) iter.next();
+ ArchiveNodeImpl childImpl = createPackageNodeImpl(project, child, nodeImpl);
+ if (nodeImpl != null && childImpl != null) {
+ nodeImpl.addChild(childImpl, false);
+ }
+ }
+
+ return nodeImpl;
+ }
+
+ public void saveModel (IPath project, IProgressMonitor monitor) {
+ // get a list of dirty nodes
+
+ try {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+ OutputStreamWriter writer = new OutputStreamWriter(bytesOut);
+ XbPackages packs = getXbPackages(project);
+ XMLBinding.marshal(packs, writer, monitor);
+ writer.close();
+
+ ByteArrayInputStream bytesIn = new ByteArrayInputStream(bytesOut.toByteArray());
+ IPath packagesFile = project.append(ArchivesModel.PROJECT_PACKAGES_FILE);
+ OutputStream out = new FileOutputStream(packagesFile.toFile());
+
+ // Transfer bytes from in to out
+ byte[] buf = new byte[1024];
+ int len;
+ while ((len = bytesIn.read(buf)) > 0) {
+ out.write(buf, 0, len);
+ }
+ out.close();
+ bytesIn.close();
+ bytesOut.close();
+
+ // get deltas
+ try {
+ ArchiveModelNode root = (ArchiveModelNode)getRoot(project);
+ IArchiveNodeDelta delta = root.getDelta();
+
+ // clear deltas
+ root.clearDeltas();
+
+ // fire delta events
+ EventManager.fireDelta(delta);
+ } catch( Exception e ) {
+ e.printStackTrace();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void attach(IArchiveNode parent, IArchiveNode child, IProgressMonitor monitor) {
+ parent.addChild(child);
+ if( parent.connectedToModel() && parent.getProjectPath() != null) {
+ // save
+ saveModel(parent.getProjectPath(), monitor);
+ }
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModelCore.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModelCore.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModelCore.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model;
+
+import org.apache.tools.ant.DirectoryScanner;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.build.ArchiveBuildDelegate;
+
+/**
+ * Utility methods and entry points for model-related APIs
+ * @author Rob Stryker (rob.stryker(a)redhat.com)
+ *
+ */
+public class ArchivesModelCore {
+
+
+ /**
+ * Builds all of a project's packages. Note that this does not call any builders before or after the package builder (i.e. the JDT builder).
+ * If you are looking to run all the builders on a project use project.build()
+ * @param project The project to build
+ * @param buildType FULL_BUILD, INCREMENTAL_BUILD, CLEAN_BUILD, etc
+ * @param monitor A progress monitor
+ */
+ public static void buildProject (IPath project, IProgressMonitor monitor) {
+ if (monitor == null) monitor = new NullProgressMonitor();
+ new ArchiveBuildDelegate().fullProjectBuild(project);
+ }
+
+ /**
+ * Build the passed-in package.
+ * @param pkg The package to build
+ */
+ public static void buildArchive (IArchive pkg, IProgressMonitor monitor) {
+ if (monitor == null) monitor = new NullProgressMonitor();
+ new ArchiveBuildDelegate().fullArchiveBuild(pkg);
+ }
+
+ public static IArchive[] getProjectPackages (IPath project, IProgressMonitor monitor, boolean forceInit) {
+ if (monitor == null) monitor = new NullProgressMonitor();
+
+ monitor.beginTask("Fetching packages for \"" + project.lastSegment() + "\"...", 2);
+ IArchive[] packages = ArchivesModel.instance().getProjectArchives(project);
+ monitor.worked(1);
+
+ if (packages == null) {
+ if (forceInit && packageFileExists(project)) {
+ ArchivesModel.instance().registerProject(project, monitor);
+ packages = ArchivesModel.instance().getProjectArchives(project);
+ }
+
+ if (packages == null) return new IArchive[0];
+ }
+
+ monitor.worked(1);
+ monitor.done();
+ return packages;
+ }
+
+ public static boolean packageFileExists (IPath project) {
+ return project.append(ArchivesModel.PROJECT_PACKAGES_FILE).toFile().exists();
+ }
+
+ public static boolean projectRegistered(IPath project) {
+ return ArchivesModel.instance().getRoot(project) == null ? false : true;
+ }
+
+
+ /**
+ * Visit all of the top-level packages in the passed in project with the passed in node visitor
+ * @param project The project whose packages to visit
+ * @param visitor The visitor
+ */
+ public static void visitProjectArchives (IPath project, IArchiveNodeVisitor visitor) {
+ if (packageFileExists(project)) {
+ IArchive packages[] = getProjectPackages(project, null, false);
+ if( packages == null ) return;
+ for (int i = 0; i < packages.length; i++) {
+ boolean keepGoing = packages[i].accept(visitor);
+ if (!keepGoing) break;
+ }
+ }
+ }
+
+
+ public static IPath[] findMatchingPaths(IPath root, String includes, String excludes) {
+ DirectoryScanner scanner =
+ DirectoryScannerFactory.createDirectoryScanner(root, includes, excludes, true);
+ String[] files = scanner.getIncludedFiles();
+ IPath[] paths = new IPath[files.length];
+ for( int i = 0; i < files.length; i++ ) {
+ paths[i] = new Path(files[i]);
+ }
+ return paths;
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,62 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model;
+
+import java.io.File;
+
+import org.apache.tools.ant.DirectoryScanner;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * Utility methods to create scanners for matching
+ * @author rob.stryker(a)jboss.com
+ */
+public class DirectoryScannerFactory {
+
+ public static DirectoryScannerExtension createDirectoryScanner (IPath filesystemFolder, String includes, String excludes, boolean scan) {
+ if (includes == null) includes = "";
+ if (excludes == null) excludes = "";
+
+ DirectoryScannerExtension scanner = new DirectoryScannerExtension();
+ String excludesList[] = excludes.split(" ?, ?");
+ String includesList[] = includes.split(" ?, ?");
+
+ File basedir = filesystemFolder.toFile();
+ scanner.setBasedir(basedir);
+ scanner.setExcludes(excludesList);
+ scanner.setIncludes(includesList);
+ if (scan)
+ scanner.scan();
+
+ return scanner;
+ }
+
+ /**
+ * Exposes the isIncluded method so that entire scans do not need to occur
+ * to find matches.
+ */
+ public static class DirectoryScannerExtension extends DirectoryScanner {
+ public boolean isIncluded(String name) {
+ return super.isIncluded(name);
+ }
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchive.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchive.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchive.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model;
+
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * <p>
+ * This interface represents an archive definition.
+ * An archive definition consists of a list of folders, filesets, and sub-packages
+ * </p>
+ *
+ * @author <a href="marshall(a)jboss.org">Marshall Culpepper</a>
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ * @version $Revision: 1939 $
+ */
+public interface IArchive extends IArchiveNode {
+ public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackage.";
+ public static final String PACKAGE_TYPE_ATTRIBUTE = ATTRIBUTE_PREFIX + "packageType";
+ public static final String EXPLODED_ATTRIBUTE = ATTRIBUTE_PREFIX + "exploded";
+ public static final String DESTINATION_ATTRIBUTE = ATTRIBUTE_PREFIX + "destination";
+ public static final String NAME_ATTRIBUTE = ATTRIBUTE_PREFIX + "name";
+ public static final String IN_WORKSPACE_ATTRIBUTE = ATTRIBUTE_PREFIX + "inWorkspace";
+
+
+ /**
+ * @return The package type of this package.
+ */
+ public IArchiveType getArchiveType();
+
+ /**
+ * return the raw string from the delegate even if the type is not found
+ * @return
+ */
+ public String getArchiveTypeId();
+
+ /**
+ * @return The name (with extension) of this package.
+ */
+ public String getName();
+
+ /**
+ * @return Whether or not this package will be build exploded, or as a directory instead of a ZIP/JAR
+ */
+ public boolean isExploded();
+
+ /**
+ * @return Whether or not this package is a "top-level" package aka, not a child of another folder or package
+ */
+ public boolean isTopLevel();
+
+ /**
+ * If this package is top-level, there are two types of destinations it can have.
+ * "Inside" the workspace, and "outside" the workspace.
+ * @return Whether or not the destination of this package is in the workspace
+ */
+ public boolean isDestinationInWorkspace();
+
+ /**
+ * @return A list of sub-archives contained in this package
+ */
+ public IArchive[] getArchives();
+
+ /**
+ * @return A list of folders contained in this package
+ */
+ public IArchiveFolder[] getFolders();
+
+ /**
+ * @return A list of filesets contained in this package
+ */
+ public IArchiveFileSet[] getFileSets();
+
+ /**
+ * Get The path to this package's output file.
+ * This path should be GLOBAL
+ * @return the path
+ */
+ public IPath getArchiveFilePath();
+
+ /**
+ * The absolute raw file system path to the
+ * destination (containing folder) of this archive
+ * @return An IPath to this package's destination folder
+ */
+ public IPath getDestinationPath();
+
+ /**
+ * Set the package type of this package
+ * @param type The package type
+ */
+ public void setArchiveType(IArchiveType type);
+
+ /**
+ * Set the package type via ID.
+ * @param type
+ */
+ public void setArchiveType(String type);
+ /**
+ * Set the name of this package
+ * @param name This package's name
+ */
+ public void setName(String name);
+
+ /**
+ * Set whether or not this package is generated as a folder
+ * @param exploded
+ */
+ public void setExploded(boolean exploded);
+
+ /**
+ * Sets the destination path for this package.
+ * In workspace paths are relative to workspace root.
+ * Out of workspace paths are file-system absolute
+ * @param path The path where this archive will be built.
+ */
+ public void setDestinationPath (IPath path);
+
+ /**
+ * Set's whether the destination is workspace relative or not
+ */
+ public void setInWorkspace(boolean inWorkspace);
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model;
+
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * <p>
+ * This interface represents a file set inside of a package definition or folder.
+ * </p>
+ *
+ * @author <a href="marshall(a)jboss.org">Marshall Culpepper</a>
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ * @version $Revision: 1930 $
+ */
+public interface IArchiveFileSet extends IArchiveNode {
+ public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackageFileSet.";
+ public static final String INCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX + "includes";
+ public static final String EXCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX + "excludes";
+ public static final String IN_WORKSPACE_ATTRIBUTE = ATTRIBUTE_PREFIX + "inWorkspace";
+ public static final String SOURCE_PATH_ATTRIBUTE = ATTRIBUTE_PREFIX + "sourcePath";
+
+
+
+ /**
+ * @return Whether or not this fileset's basedir is inside the workspace
+ */
+ public boolean isInWorkspace();
+
+ /**
+ * Returns the absolute file-system relative source path
+ * @return The path to the source folder ("basedir" in ant terminology) for this fileset.
+ */
+ public IPath getGlobalSourcePath();
+
+ /**
+ * @return the source path from the delegate (file-system or workspace-relative)
+ */
+ public IPath getSourcePath();
+
+ /**
+ * Force the scanner to check for matched files again
+ */
+ public void resetScanner();
+
+ /**
+ * @return The includes pattern for this fileset
+ */
+ public String getIncludesPattern();
+
+ /**
+ * @return The excludes pattern for this fileset
+ */
+ public String getExcludesPattern();
+
+ /**
+ * @return An array of matching IPath's in the filesystem (for external filesystem filesets)
+ */
+ public IPath[] findMatchingPaths();
+
+ /**
+ * @param path The absolute path on the filesystem to check
+ * @return Whether or not this fileset matches the passed-in path
+ */
+ public boolean matchesPath(IPath path);
+
+ /**
+ * Sets the "root" or "source" of this fileset (file-system or workspace relative)
+ * @param path The absolute path that is the source of this fileset
+ */
+ public void setSourcePath(IPath path);
+
+ /**
+ * Set the includes pattern for this fileset. This pattern uses the same syntax as Ant's include pattern.
+ * @param includes The includes pattern for this fileset
+ */
+ public void setIncludesPattern(String includes);
+
+ /**
+ * Set the excludes pattern for this fileset. This pattern uses the same syntax as Ant's exclude pattern.
+ * @param excludes The excludes pattern for this fileset
+ */
+ public void setExcludesPattern(String excludes);
+
+ /**
+ * Set whether or not this fileset's source is in the workspace. This will automatically be handled if you
+ * use setSingleFile, setSourceProject, setSourceContainer, or setSourceFolder.
+ * @param isInWorkspace Whether or not this fileset's source is in the workspace
+ */
+ public void setInWorkspace(boolean isInWorkspace);
+
+ /**
+ * Get the relative path of the input file to the root archive
+ * @param inputFile
+ * @return
+ */
+ public IPath getRootArchiveRelativePath(IPath inputFile);
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFolder.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFolder.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFolder.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model;
+
+
+/**
+ * <p>
+ * This interface represents a folder inside a package definition.
+ * A folder can contain packages, filesets, and sub-folders.
+ * </p>
+ *
+ * @author <a href="marshall(a)jboss.org">Marshall Culpepper</a>
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ * @version $Revision: 1929 $
+ */
+public interface IArchiveFolder extends IArchiveNode {
+
+ public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackageFolder.";
+ public static final String NAME_ATTRIBUTE = ATTRIBUTE_PREFIX + "name";
+
+
+ /**
+ * @return The name of this folder
+ */
+ public String getName();
+
+ /**
+ * Set the name of this folder
+ * @param name The name of this folder
+ */
+ public void setName(String name);
+
+ /**
+ * @return An array of sub-packages of this folder
+ */
+ public IArchive[] getArchives();
+
+ /**
+ * @return An array of sub-folders of this folder
+ */
+ public IArchiveFolder[] getFolders();
+
+ /**
+ * @return An array of filesets whose destination is this folder
+ */
+ public IArchiveFileSet[] getFileSets();
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModelListenerManager.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModelListenerManager.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModelListenerManager.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,21 @@
+package org.jboss.ide.eclipse.archives.core.model;
+
+import org.jboss.ide.eclipse.archives.core.model.other.IArchiveBuildListener;
+import org.jboss.ide.eclipse.archives.core.model.other.IArchiveModelListener;
+
+/**
+ * Manages Archive Model Listeners, build and model changes, for changes
+ * in the model
+ * @author rstryker
+ *
+ */
+public interface IArchiveModelListenerManager {
+
+ public void addBuildListener(IArchiveBuildListener listener);
+ public void removeBuildListener(IArchiveBuildListener listener);
+ public IArchiveBuildListener[] getBuildListeners();
+ public void addModelListener(IArchiveModelListener listener);
+ public void removeModelListener(IArchiveModelListener listener);
+ public IArchiveModelListener[] getModelListeners();
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModelNode.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModelNode.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModelNode.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model;
+
+/**
+ * An interface for methods relevent to a model's root node.
+ * Only a label interface thus far
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ *
+ */
+public interface IArchiveModelNode extends IArchiveNode {
+ public IArchiveModelListenerManager getManager();
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNode.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNode.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNode.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,178 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * The super type of all package nodes (IPackage, IPackageFileSet, IPackageFolder)
+ *
+ * Each node in a package may have arbitrary properties that can be reflected upon by other plug-ins
+ *
+ * @author <a href="marshall(a)jboss.org">Marshall Culpepper</a>
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ * @version $Revision: 1929 $
+ */
+public interface IArchiveNode extends IAdaptable {
+ /**
+ * The node type that represents the model
+ */
+ public static final int TYPE_MODEL = -1;
+
+ /**
+ * The node type that represents an IPackage
+ */
+ public static final int TYPE_ARCHIVE = 0;
+
+ /**
+ * The node type that represents an IPackageReference
+ */
+ public static final int TYPE_ARCHIVE_REFERENCE = 1;
+
+ /**
+ * The node type that represents an IPackageFileSet
+ */
+ public static final int TYPE_ARCHIVE_FILESET = 2;
+
+ /**
+ * The node type that represents an IPackageFolder
+ */
+ public static final int TYPE_ARCHIVE_FOLDER = 3;
+
+ /**
+ * @return The parent of this package node, or null if this node is top level
+ */
+ public IArchiveNode getParent();
+
+ /**
+ * Set the parent of this package node
+ * @param parent The new parent of this node
+ */
+ public void setParent(IArchiveNode parent);
+
+ /**
+ * @param type TYPE_PACKAGE, TYPE_PACKAGE_FILESET, or TYPE_PACKAGE_FOLDER
+ * @return An array of child nodes of the passed in type
+ */
+ public IArchiveNode[] getChildren(int type);
+
+ /**
+ * @return An array of all children nodes
+ */
+ public IArchiveNode[] getAllChildren();
+
+ /**
+ * @return Whether or not this node has children
+ */
+ public boolean hasChildren();
+
+ /**
+ * @param child A possible child node
+ * @return Whether or not the passed-in node is a child of this node
+ */
+ public boolean hasChild(IArchiveNode child);
+
+ /**
+ * @return The type of this package node
+ */
+ public int getNodeType();
+
+ /**
+ * @param property The name of the property to fetch
+ * @return The value of the specified property
+ */
+ public String getProperty(String property);
+
+ /**
+ * Set a property on this package node
+ * @param property The name of the property to set
+ * @param value The new value of the property
+ */
+ public void setProperty(String property, String value);
+
+ /**
+ * @return The project that this node is defined in (not necessarily the project where this is based if this is a fileset)
+ */
+ public IPath getProjectPath();
+
+ /**
+ * Recursively visit the package node tree below this node with the passed-in package node visitor.
+ * @param visitor A package node visitor
+ * @return Whether or not the entire sub-tree was visited
+ */
+ public boolean accept(IArchiveNodeVisitor visitor);
+
+ /**
+ * Recursively visit the package node tree below this node with the passed-in package node visitor, using depth-first ordering
+ * @param visitor A package node visitor
+ * @return Whether or not the entire sub-tree was visited
+ */
+ public boolean accept(IArchiveNodeVisitor visitor, boolean depthFirst);
+
+ /**
+ * Add a child node to this node
+ * @param child The child to add
+ */
+ public void addChild(IArchiveNode child);
+
+ /**
+ * Remove a child node from this node
+ * @param child The child to remove
+ */
+ public void removeChild(IArchiveNode child);
+
+ /**
+ * Get the highest parent that is not null.
+ * @return
+ */
+ public IArchiveNode getRoot();
+
+ /**
+ * Get the model this node is attached to, or null if none
+ * @return
+ */
+ public IArchiveModelNode getModel();
+
+ /**
+ * Is the root of this node a PackageModelNode and registered in PackagesModel?
+ * @return
+ */
+ public boolean connectedToModel();
+
+ /**
+ * Get the path relative to the root archive
+ * @return
+ */
+ public IPath getRootArchiveRelativePath();
+
+ /**
+ * Get the root top-level package for this node
+ * @return
+ */
+ public IArchive getRootArchive();
+ /**
+ * Get the current delta
+ * @return
+ */
+ public IArchiveNodeDelta getDelta();
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeDelta.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeDelta.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeDelta.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,164 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model;
+
+/**
+ * Node delta interface
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ *
+ */
+public interface IArchiveNodeDelta {
+
+ /**
+ * There is no change to this node or any of it's children
+ */
+ public static final int NO_CHANGE = 0;
+
+ /**
+ * I have been added
+ */
+ public static final int ADDED = 0x1;
+
+ /**
+ * I have been removed
+ */
+ public static final int REMOVED = 0x2;
+
+
+
+ /**
+ * Used to designate that a sub-property within
+ * a <property> tag has been added.
+ */
+ public static final int PROPERTY_ADDED = 0x10;
+
+ /**
+ * Used to designate that a sub-property within
+ * a <property> tag has been removed.
+ */
+ public static final int PROPERTY_REMOVED = 0x20;
+
+ /**
+ * Used to designate that a sub-property within
+ * a <property> tag has been changed.
+ */
+ public static final int PROPERTY_CHANGED = 0x40;
+
+ /**
+ * Used to designate that an primary property of the node,
+ * such as inWorkspace or exploded, has changed.
+ */
+ public static final int ATTRIBUTE_CHANGED = 0x80;
+
+ /**
+ * A child has been added directly to me
+ */
+ public static final int CHILD_ADDED = 0x100;
+
+ /**
+ * A child has been removed directly from me
+ */
+ public static final int CHILD_REMOVED = 0x200;
+
+ /**
+ * Some other change has occurred, most likely a
+ * grand-child added or a child's property changed.
+ */
+ public static final int DESCENDENT_CHANGED = 0x400;
+
+ /**
+ * Return the delta kind
+ * @return
+ */
+ public int getKind();
+
+ /**
+ * Return the affected node after changes
+ * @return
+ */
+ public IArchiveNode getPostNode();
+
+ /**
+ * Return the affected node before changes, or null if the node is an {@link IArchiveModelNode}
+ * @return
+ */
+ public IArchiveNode getPreNode();
+
+ /**
+ * Get a list of property keys for changed properties
+ * @return
+ */
+ public String[] getPropertiesWithDeltas();
+
+ /**
+ * Get the property node delta for the given property key
+ * @param key
+ * @return
+ */
+ public INodeDelta getPropertyDelta(String key);
+
+ /**
+ * Get a list of attribute keys for changed attributes
+ * @return
+ */
+ public String[] getAttributesWithDeltas();
+
+ /**
+ * Get the attribute node delta for a given attribute key
+ * @param key
+ * @return
+ */
+ public INodeDelta getAttributeDelta(String key);
+
+ /**
+ * Get the array of added children
+ * @return
+ */
+ public IArchiveNodeDelta[] getAddedChildrenDeltas();
+
+ /**
+ * Get the array of removed Children
+ * @return
+ */
+ public IArchiveNodeDelta[] getRemovedChildrenDeltas();
+
+ /**
+ * Get only deltas where descendent changed
+ * @return
+ */
+ public IArchiveNodeDelta[] getChangedDescendentDeltas();
+
+ /**
+ * Get the children that have been changed
+ * @return
+ */
+ public IArchiveNodeDelta[] getAllAffectedChildren();
+
+
+
+ public interface INodeDelta {
+ public Object getBefore();
+ public Object getAfter();
+ public int getKind();
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeVisitor.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeVisitor.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeVisitor.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model;
+
+/**
+ * The interface for visiting through nodes
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ */
+public interface IArchiveNodeVisitor {
+
+ public boolean visit (IArchiveNode node);
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveType.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveType.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveType.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,62 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * This interface represents a package type (i.e. JAR,WAR,SAR etc).
+ *
+ * A package type's main focus right now is to provide a default "template" Package for a given Project, making it easier
+ * for users and adopters to automatically adapt projects into a deployable package type.
+ *
+ * @author Marshall
+ */
+public interface IArchiveType {
+
+ /**
+ * @return The ID for this PackageType, i.e. "jar", "war" etc
+ */
+ public String getId();
+
+ /**
+ * @return The label for this PackageType (usually shown in UI)
+ */
+ public String getLabel();
+
+ /**
+ * This will create a "default" packaging configuration for this project using this package type.
+ *
+ * If the passed-in project does not support this package type, a null IPackage should be returned.
+ *
+ * @param project The project to create the packages configuration for
+ * @return The top level package that was created
+ */
+ public IArchive createDefaultConfiguration(IProject project, IProgressMonitor monitor);
+
+ /**
+ * Fill an archive type with some filesets and folders that are required
+ */
+ public IArchive fillDefaultConfiguration(IProject project, IArchive topLevel, IProgressMonitor monitor);
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/events/EventManager.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/events/EventManager.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/events/EventManager.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,196 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.events;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
+import org.jboss.ide.eclipse.archives.core.model.other.IArchiveBuildListener;
+import org.jboss.ide.eclipse.archives.core.model.other.IArchiveModelListener;
+
+/**
+ * The event manager to fire events
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ */
+public class EventManager {
+
+ public static void cleanProjectBuild(IPath project) {
+ try {
+ IArchiveBuildListener[] listeners = getBuildListeners();
+ for( int i = 0; i < listeners.length; i++ )
+ listeners[i].cleanProject(project);
+ } catch(Exception e ) {}
+ }
+
+ public static void cleanArchiveBuild(IArchive archive) {
+ try {
+ IArchiveBuildListener[] listeners = getBuildListeners(archive);
+ for( int i = 0; i < listeners.length; i++ )
+ listeners[i].cleanArchive(archive);
+ } catch(Exception e ) {}
+ }
+
+ public static void startedBuild(IPath project) {
+ try {
+ IArchiveBuildListener[] listeners = getBuildListeners();
+ for( int i = 0; i < listeners.length; i++ )
+ listeners[i].startedBuild(project);
+ } catch(Exception e ) {}
+ }
+
+ public static void finishedBuild(IPath project) {
+ try {
+ IArchiveBuildListener[] listeners = getBuildListeners();
+ for( int i = 0; i < listeners.length; i++ )
+ listeners[i].finishedBuild(project);
+ } catch(Exception e ) {}
+ }
+
+ public static void startedBuildingArchive(IArchive archive) {
+ try {
+ IArchiveBuildListener[] listeners = getBuildListeners(archive);
+ for( int i = 0; i < listeners.length; i++ )
+ listeners[i].startedBuildingArchive(archive);
+ } catch(Exception e ) {}
+ }
+
+ public static void finishedBuildingArchive(IArchive archive) {
+ try {
+ IArchiveBuildListener[] listeners = getBuildListeners(archive);
+ for( int i = 0; i < listeners.length; i++ )
+ listeners[i].finishedBuildingArchive(archive);
+ } catch(Exception e ) {}
+ }
+
+
+
+ public static void startedCollectingFileSet(IArchiveFileSet fileset) {
+ try {
+ IArchiveBuildListener[] listeners = getBuildListeners(fileset);
+ for( int i = 0; i < listeners.length; i++ )
+ listeners[i].startedCollectingFileSet(fileset);
+ } catch(Exception e ) {}
+ }
+ public static void finishedCollectingFileSet(IArchiveFileSet fileset) {
+ try {
+ IArchiveBuildListener[] listeners = getBuildListeners(fileset);
+ for( int i = 0; i < listeners.length; i++ )
+ listeners[i].finishedCollectingFileSet(fileset);
+ } catch(Exception e ) {}
+ }
+
+ // Bulk events
+ public static void filesUpdated(IArchive topLevelArchive, IArchiveFileSet fileset, IPath[] filePath) {
+ for( int i = 0; i < filePath.length; i++ ) {
+ fileUpdated(topLevelArchive, fileset, filePath[i]);
+ }
+ }
+
+ // one file updated matching multiple filesets
+ public static void fileUpdated(IPath path, IArchiveFileSet[] matchingFilesets) {
+ for( int i = 0; i < matchingFilesets.length; i++ ) {
+ fileUpdated(matchingFilesets[i].getRootArchive(), matchingFilesets[i], path);
+ }
+ }
+
+ public static void fileUpdated(IArchive topLevelArchive, IArchiveFileSet fileset, IPath filePath) {
+ try {
+ IArchiveBuildListener[] listeners = getBuildListeners(topLevelArchive);
+ for( int i = 0; i < listeners.length; i++ )
+ listeners[i].fileUpdated(topLevelArchive, fileset, filePath);
+ } catch(Exception e ) {}
+ }
+
+ public static void fileRemoved(IArchive topLevelArchive, IArchiveFileSet fileset, IPath filePath) {
+ try {
+ IArchiveBuildListener[] listeners = getBuildListeners(topLevelArchive);
+ for( int i = 0; i < listeners.length; i++ )
+ listeners[i].fileRemoved(topLevelArchive, fileset, filePath);
+ } catch(Exception e ) {}
+ }
+
+ // one file removed matching multiple filesets
+ public static void fileRemoved(IPath path, IArchiveFileSet[] matchingFilesets) {
+ for( int i = 0; i < matchingFilesets.length; i++ ) {
+ fileRemoved(matchingFilesets[i].getRootArchive(), matchingFilesets[i], path);
+ }
+ }
+
+ public static void filesRemoved(IPath[] paths, IArchiveFileSet fileset) {
+ for( int i = 0; i < paths.length; i++ ) {
+ fileRemoved(fileset.getRootArchive(), fileset, paths[i]);
+ }
+ }
+
+ public static void buildFailed(IArchive pkg, IStatus status) {
+ try {
+ IArchiveBuildListener[] listeners = getBuildListeners(pkg);
+ for( int i = 0; i < listeners.length; i++ )
+ listeners[i].buildFailed(pkg, status);
+ } catch(Exception e ) {}
+ }
+
+
+
+ /**
+ * Fire events dealing with model changes
+ * @param delta
+ */
+
+ public static void fireDelta(IArchiveNodeDelta delta) {
+ try {
+ IArchiveNode node = delta.getPostNode() == null ? delta.getPreNode() : delta.getPostNode();
+ IArchiveModelListener[] listeners = getModelListeners(node);
+ for( int i = 0; i < listeners.length; i++ )
+ listeners[i].modelChanged(delta);
+ } catch(Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+
+ private static IArchiveModelListener[] getModelListeners(IArchiveNode node) {
+ IArchiveModelNode model = node.getModel();
+ if( model != null && model.getManager() != null ) {
+ return model.getManager().getModelListeners();
+ }
+ return new IArchiveModelListener[]{};
+ }
+
+ // get workspace default ones
+ private static IArchiveBuildListener[] getBuildListeners() {
+ return ArchivesModel.instance().getBuildListeners();
+ }
+ private static IArchiveBuildListener[] getBuildListeners(IArchiveNode node) {
+ IArchiveModelNode model = node.getModel();
+ if( model != null && model.getManager() != null ) {
+ return model.getManager().getBuildListeners();
+ }
+ return new IArchiveBuildListener[]{};
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveDeltaPreNodeFactory.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveDeltaPreNodeFactory.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveDeltaPreNodeFactory.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,206 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IPath;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeDeltaImpl.NodeDelta;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFolder;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNodeWithProperties;
+
+
+/**
+ * This class generates a replica of what an archive
+ * node looked like before the changes that instigated
+ * the delta.
+ *
+ * Because these replica nodes will not be connected ot the model,
+ * they need to know their project and their parent properly
+ * @author rstryker
+ *
+ */
+public class ArchiveDeltaPreNodeFactory {
+
+ // children get added later
+ public static ArchiveNodeImpl createNode(ArchiveNodeDeltaImpl parentDelta, ArchiveNodeImpl postChange,
+ HashMap attributeChanges, HashMap propertyChanges) {
+
+ switch(postChange.getNodeType()) {
+ case IArchiveNode.TYPE_ARCHIVE_FILESET:
+ XbFileSet fs = createFileset((ArchiveFileSetImpl)postChange, attributeChanges, propertyChanges);
+ return new DeltaFileset(fs, parentDelta, postChange.getProjectPath());
+ case IArchiveNode.TYPE_ARCHIVE_FOLDER:
+ XbFolder folder = createFolder((ArchiveFolderImpl)postChange, attributeChanges, propertyChanges);
+ return new DeltaFolder(folder, parentDelta, postChange.getProjectPath());
+ case IArchiveNode.TYPE_ARCHIVE:
+ XbPackage pack = createPackage((ArchiveImpl)postChange, attributeChanges, propertyChanges);
+ return new DeltaArchive(pack, parentDelta, postChange.getProjectPath());
+ }
+
+ return null;
+ }
+
+
+ protected static XbFileSet createFileset(ArchiveFileSetImpl postChange,HashMap attributeChanges, HashMap propertyChanges ) {
+ XbFileSet fs = new XbFileSet((XbFileSet)postChange.nodeDelegate);
+// fs.setDir("FILESET TEST CHANGE");
+ if( attributeChanges.containsKey(IArchiveFileSet.INCLUDES_ATTRIBUTE))
+ fs.setIncludes(getBeforeString(attributeChanges, IArchiveFileSet.INCLUDES_ATTRIBUTE));
+ if( attributeChanges.containsKey(IArchiveFileSet.EXCLUDES_ATTRIBUTE))
+ fs.setExcludes(getBeforeString(attributeChanges, IArchiveFileSet.EXCLUDES_ATTRIBUTE));
+ if( attributeChanges.containsKey(IArchiveFileSet.SOURCE_PATH_ATTRIBUTE))
+ fs.setDir(getBeforeString(attributeChanges, IArchiveFileSet.SOURCE_PATH_ATTRIBUTE));
+ if( attributeChanges.containsKey(IArchiveFileSet.IN_WORKSPACE_ATTRIBUTE))
+ fs.setInWorkspace(getBeforeBoolean(attributeChanges, IArchiveFileSet.IN_WORKSPACE_ATTRIBUTE));
+
+ undoPropertyChanges(fs, propertyChanges);
+ return fs;
+ }
+
+ protected static XbFolder createFolder(ArchiveFolderImpl postChange,HashMap attributeChanges, HashMap propertyChanges ) {
+ XbFolder folder = new XbFolder((XbFolder)postChange.nodeDelegate);
+ if( attributeChanges.containsKey(IArchiveFolder.NAME_ATTRIBUTE))
+ folder.setName(getBeforeString(attributeChanges, IArchiveFolder.NAME_ATTRIBUTE));
+ undoPropertyChanges(folder, propertyChanges);
+ return folder;
+ }
+
+ protected static XbPackage createPackage(ArchiveImpl postChange,HashMap attributeChanges, HashMap propertyChanges ) {
+ XbPackage pack = new XbPackage((XbPackage)postChange.nodeDelegate);
+ if( attributeChanges.containsKey(IArchive.NAME_ATTRIBUTE))
+ pack.setName(getBeforeString(attributeChanges, IArchive.NAME_ATTRIBUTE));
+ if( attributeChanges.containsKey(IArchive.PACKAGE_TYPE_ATTRIBUTE))
+ pack.setPackageType(getBeforeString(attributeChanges, IArchive.PACKAGE_TYPE_ATTRIBUTE));
+ if( attributeChanges.containsKey(IArchive.DESTINATION_ATTRIBUTE))
+ pack.setToDir(getBeforeString(attributeChanges, IArchive.DESTINATION_ATTRIBUTE));
+ if( attributeChanges.containsKey(IArchive.IN_WORKSPACE_ATTRIBUTE))
+ pack.setInWorkspace(getBeforeBoolean(attributeChanges, IArchive.IN_WORKSPACE_ATTRIBUTE));
+ if( attributeChanges.containsKey(IArchive.EXPLODED_ATTRIBUTE))
+ pack.setExploded(getBeforeBoolean(attributeChanges, IArchive.EXPLODED_ATTRIBUTE));
+ undoPropertyChanges(pack, propertyChanges);
+ return pack;
+ }
+
+ protected static boolean getBeforeBoolean(HashMap map, String key) {
+ NodeDelta delta = (NodeDelta)map.get(key);
+ if( delta != null ) {
+ return ((Boolean)delta.getBefore()).booleanValue();
+ }
+ return true;
+ }
+ protected static String getBeforeString(HashMap map, String key) {
+ NodeDelta delta = (NodeDelta)map.get(key);
+ if( delta != null ) {
+ return (String)delta.getBefore();
+ }
+ return null;
+ }
+
+ // set the properties here to what they were before the delta
+ protected static void undoPropertyChanges(XbPackageNodeWithProperties node, HashMap changes) {
+ String key;
+ NodeDelta val;
+ for( Iterator i = changes.keySet().iterator(); i.hasNext(); ) {
+ key = (String) i.next();
+ val = (NodeDelta)changes.get(key);
+ if( val.getBefore() == null ) {
+ node.getProperties().getProperties().remove(key);
+ } else {
+ node.getProperties().getProperties().setProperty(key, (String)val.getBefore());
+ }
+ }
+
+ }
+
+
+ /*
+ * Delta implementations of the various nodes.
+ * Project is stored because delta nodes (or pre-nodes) are not connected to the model.
+ * Therefore the project must be kept handy.
+ */
+
+ /**
+ * Extending class representing a delta fileset
+ */
+ public static class DeltaFileset extends ArchiveFileSetImpl {
+ // everything goes through the delegate or the parent. Simple
+ private ArchiveNodeDeltaImpl parentDelta;
+ private IPath project;
+ public DeltaFileset(XbFileSet fileset, ArchiveNodeDeltaImpl parentDelta, IPath project){
+ super(fileset);
+ this.parentDelta = parentDelta;
+ this.project = project;
+ }
+ public IArchiveNode getParent() {
+ return parentDelta == null ? null : parentDelta.getPreNode();
+ }
+ public IPath getProjectPath() {
+ return project;
+ }
+ }
+
+ /**
+ * Extending class representing a delta folder
+ */
+ public static class DeltaFolder extends ArchiveFolderImpl {
+ private ArchiveNodeDeltaImpl parentDelta;
+ private IPath project;
+ public DeltaFolder(XbFolder folder, ArchiveNodeDeltaImpl parentDelta, IPath project){
+ super(folder);
+ this.parentDelta = parentDelta;
+ this.project = project;
+ }
+ public IArchiveNode getParent() {
+ return parentDelta == null ? null : parentDelta.getPreNode();
+ }
+ public IPath getProjectPath() {
+ return project;
+ }
+ }
+
+ /**
+ * Extending class representing a delta archive
+ */
+ public static class DeltaArchive extends ArchiveImpl {
+ private ArchiveNodeDeltaImpl parentDelta;
+ private IPath project;
+ public DeltaArchive(XbPackage pack, ArchiveNodeDeltaImpl parentDelta, IPath project){
+ super(pack);
+ this.parentDelta = parentDelta;
+ this.project = project;
+ }
+ public IArchiveNode getParent() {
+ return parentDelta == null ? null : parentDelta.getPreNode();
+ }
+ public IPath getProjectPath() {
+ return project;
+ }
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,218 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
+
+/**
+ * An implementation for filesets
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ *
+ */
+public class ArchiveFileSetImpl extends ArchiveNodeImpl implements
+ IArchiveFileSet {
+
+ private XbFileSet filesetDelegate;
+ private DirectoryScannerExtension scanner;
+ private boolean rescanRequired = true;
+
+ public ArchiveFileSetImpl() {
+ this(new XbFileSet());
+ }
+
+ public ArchiveFileSetImpl (XbFileSet delegate) {
+ super(delegate);
+ this.filesetDelegate = delegate;
+ }
+
+ /*
+ * @see IArchiveFileSet#findMatchingPaths()
+ */
+ public IPath[] findMatchingPaths () {
+ DirectoryScannerExtension scanner = getScanner();
+ ArrayList paths = new ArrayList();
+ IPath sp = getGlobalSourcePath();
+ String matched[] = scanner.getIncludedFiles();
+ for (int i = 0; i < matched.length; i++) {
+ IPath path = sp.append(new Path(matched[i]));
+ paths.add(path);
+ }
+
+ return (IPath[])paths.toArray(new IPath[paths.size()]);
+ }
+
+ /*
+ * @see IArchiveFileSet#getExcludesPattern()
+ */
+ public String getExcludesPattern() {
+ return filesetDelegate.getExcludes();
+ }
+
+ /*
+ * @see IArchiveFileSet#isInWorkspace()
+ */
+ public boolean isInWorkspace() {
+ return filesetDelegate.isInWorkspace();
+ }
+
+ /*
+ * @see IArchiveFileSet#getIncludesPattern()
+ */
+ public String getIncludesPattern() {
+ return filesetDelegate.getIncludes();
+ }
+
+ /*
+ * @see IArchiveFileSet#getGlobalSourcePath()
+ */
+ public IPath getGlobalSourcePath() {
+ String path = filesetDelegate.getDir();
+ if (path == null || path.equals(".") || path.equals("")) {
+ return getProjectPath() == null ? null : getProjectPath();
+ } else if( isInWorkspace()){
+ return ArchivesCore.getInstance().getVariables().getWorkspacePath().append(path);
+ } else {
+ return new Path(path);
+ }
+ }
+
+ /*
+ * @see IArchiveFileSet#getSourcePath()
+ */
+ public IPath getSourcePath() {
+ return new Path(filesetDelegate.getDir());
+ }
+
+ /*
+ * @see IArchiveFileSet#matchesPath(IPath)
+ */
+ public boolean matchesPath(IPath path) {
+ return matchesPath(getScanner(), path);
+ }
+
+ private boolean matchesPath(DirectoryScannerExtension scanner, IPath path) {
+ if( getGlobalSourcePath().isPrefixOf(path)) {
+ String s = path.toOSString().substring(getGlobalSourcePath().toOSString().length()+1);
+ return scanner.isIncluded(s);
+ }
+ return false;
+ }
+
+ /*
+ * Will re-scan if required, or use cached scanner
+ * @return
+ */
+ private synchronized DirectoryScannerExtension getScanner() {
+ if( scanner == null || rescanRequired) {
+ rescanRequired = false;
+ scanner = DirectoryScannerFactory.createDirectoryScanner(
+ getGlobalSourcePath(), getIncludesPattern(), getExcludesPattern(), true);
+ }
+ return scanner;
+ }
+
+ /*
+ * @see IArchiveNode#getNodeType()
+ */
+ public int getNodeType() {
+ return TYPE_ARCHIVE_FILESET;
+ }
+
+ /*
+ * @see IArchiveFileSet#setExcludesPattern(String)
+ */
+ public void setExcludesPattern(String excludes) {
+ attributeChanged(EXCLUDES_ATTRIBUTE, getExcludesPattern(), excludes);
+ filesetDelegate.setExcludes(excludes);
+ rescanRequired = true;
+ }
+
+ /*
+ * @see IArchiveFileSet#setIncludesPattern(String)
+ */
+ public void setIncludesPattern(String includes) {
+ attributeChanged(INCLUDES_ATTRIBUTE, getIncludesPattern(), includes);
+ filesetDelegate.setIncludes(includes);
+ rescanRequired = true;
+ }
+
+ /*
+ * @see IArchiveFileSet#setInWorkspace(boolean)
+ */
+ public void setInWorkspace(boolean isInWorkspace) {
+ attributeChanged(IN_WORKSPACE_ATTRIBUTE, new Boolean(isInWorkspace()), new Boolean(isInWorkspace));
+ filesetDelegate.setInWorkspace(isInWorkspace);
+ rescanRequired = true;
+ }
+
+ /*
+ * @see IArchiveFileSet#setSourcePath(IPath, boolean)
+ */
+ public void setSourcePath (IPath path) {
+ Assert.isNotNull(path);
+ IPath src = getGlobalSourcePath();
+ attributeChanged(SOURCE_PATH_ATTRIBUTE, src == null ? null : src.toString(), path == null ? null : path.toString());
+ filesetDelegate.setDir(path.toString());
+ rescanRequired = true;
+ }
+
+ protected XbFileSet getFileSetDelegate () {
+ return filesetDelegate;
+ }
+
+ /*
+ * filesets have no path of their own
+ * and should not be the parents of any other node
+ * so the parent is their base location
+ * @see IArchiveNode#getRootArchiveRelativePath()
+ */
+ public IPath getRootArchiveRelativePath() {
+ return getParent().getRootArchiveRelativePath();
+ }
+
+ /*
+ * @see IArchiveFileSet#getRootArchiveRelativePath(IPath)
+ */
+ public IPath getRootArchiveRelativePath(IPath inputFile) {
+ if( matchesPath(inputFile)) {
+ String s = inputFile.toOSString().substring(getGlobalSourcePath().toOSString().length()+1);
+ return getParent().getRootArchiveRelativePath().append(s);
+ }
+ return null;
+ }
+
+ /*
+ * @see IArchiveFileSet#resetScanner()
+ */
+ public void resetScanner() {
+ rescanRequired = true;
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFolderImpl.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFolderImpl.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFolderImpl.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal;
+
+import org.eclipse.core.runtime.IPath;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFolder;
+
+/**
+ * A PackageFolderImpl.
+ *
+ * @author <a href="marshall(a)jboss.org">Marshall Culpepper</a>
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ * @version $Revision: 1930 $
+ */
+public class ArchiveFolderImpl extends ArchiveNodeImpl implements
+ IArchiveFolder {
+
+ private XbFolder folderDelegate;
+
+ public ArchiveFolderImpl() {
+ this(new XbFolder());
+ }
+ public ArchiveFolderImpl(XbFolder delegate) {
+ super(delegate);
+ this.folderDelegate = delegate;
+ }
+
+ /*
+ * @see IArchiveFolder#getName()
+ */
+ public String getName() {
+ return folderDelegate.getName();
+ }
+
+ /*
+ * @see IArchiveFolder#getFileSets()
+ */
+ public IArchiveFileSet[] getFileSets() {
+ IArchiveNode nodes[] = getChildren(TYPE_ARCHIVE_FILESET);
+ IArchiveFileSet filesets[] = new IArchiveFileSet[nodes.length];
+ System.arraycopy(nodes, 0, filesets, 0, nodes.length);
+ return filesets;
+ }
+
+ /*
+ * @see IArchiveFolder#getFolders()
+ */
+ public IArchiveFolder[] getFolders() {
+ IArchiveNode nodes[] = getChildren(TYPE_ARCHIVE_FOLDER);
+ IArchiveFolder folders[] = new IArchiveFolder[nodes.length];
+ System.arraycopy(nodes, 0, folders, 0, nodes.length);
+ return folders;
+ }
+
+ /*
+ * @see IArchiveFolder#getArchives()
+ */
+ public IArchive[] getArchives() {
+ IArchiveNode nodes[] = getChildren(TYPE_ARCHIVE);
+ IArchive pkgs[] = new IArchive[nodes.length];
+ System.arraycopy(nodes, 0, pkgs, 0, nodes.length);
+ return pkgs;
+ }
+
+ /*
+ * @see IArchiveNode#getNodeType()
+ */
+ public int getNodeType() {
+ return TYPE_ARCHIVE_FOLDER;
+ }
+
+ /*
+ * @see IArchiveFolder#setName(String)
+ */
+ public void setName(String name) {
+ attributeChanged(NAME_ATTRIBUTE, getName(), name);
+ folderDelegate.setName(name);
+ }
+
+ protected XbFolder getFolderDelegate () {
+ return folderDelegate;
+ }
+
+ public String toString() {
+ return "folder[" + getName() + "]";
+ }
+
+ /*
+ * @see IArchiveNode#getRootArchiveRelativePath()
+ */
+ public IPath getRootArchiveRelativePath() {
+ return getParent().getRootArchiveRelativePath().append(getName());
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,217 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
+
+/**
+ * An archive
+ *
+ * @author Rob stryker
+ */
+public class ArchiveImpl extends ArchiveNodeImpl implements IArchive {
+
+ private XbPackage packageDelegate;
+
+ public ArchiveImpl() {
+ this(new XbPackage());
+ }
+ public ArchiveImpl(XbPackage delegate) {
+ super(delegate);
+ this.packageDelegate = delegate;
+ }
+
+ /*
+ * @see IArchiveNode#getNodeType()
+ */
+ public int getNodeType() {
+ return TYPE_ARCHIVE;
+ }
+
+ /*
+ * @see IArchive#isDestinationInWorkspace()
+ */
+ public boolean isDestinationInWorkspace() {
+ return packageDelegate.isInWorkspace();
+ }
+
+ /*
+ * @see IArchive#getDestinationPath()
+ */
+ public IPath getDestinationPath () {
+ if (packageDelegate.getToDir() == null || packageDelegate.getToDir().equals("."))
+ return getProjectPath() == null ? null : getProjectPath();
+
+ if (isDestinationInWorkspace()) {
+ return ArchivesCore.getInstance().getVariables().getWorkspacePath().append(new Path(packageDelegate.getToDir()));
+ } else
+ return new Path(packageDelegate.getToDir());
+ }
+
+ /*
+ * @see IArchive#getArchiveFilePath()
+ */
+ public IPath getArchiveFilePath() {
+ return getDestinationPath().append(getName());
+ }
+
+ /*
+ * @see IArchive#getFileSets()
+ */
+ public IArchiveFileSet[] getFileSets() {
+ IArchiveNode nodes[] = getChildren(TYPE_ARCHIVE_FILESET);
+ IArchiveFileSet filesets[] = new IArchiveFileSet[nodes.length];
+ System.arraycopy(nodes, 0, filesets, 0, nodes.length);
+ return filesets;
+ }
+
+ /*
+ * @see IArchive#getFolders()
+ */
+ public IArchiveFolder[] getFolders() {
+ IArchiveNode nodes[] = getChildren(TYPE_ARCHIVE_FOLDER);
+ IArchiveFolder folders[] = new IArchiveFolder[nodes.length];
+ System.arraycopy(nodes, 0, folders, 0, nodes.length);
+ return folders;
+ }
+
+ /*
+ * @see IArchive#getArchives()
+ */
+ public IArchive[] getArchives() {
+ IArchiveNode nodes[] = getChildren(TYPE_ARCHIVE);
+ IArchive pkgs[] = new IArchive[nodes.length];
+ System.arraycopy(nodes, 0, pkgs, 0, nodes.length);
+ return pkgs;
+ }
+
+ /*
+ * @see IArchive#getName()
+ */
+ public String getName() {
+ return packageDelegate.getName();
+ }
+
+ /*
+ * @see IArchive#getArchiveType()
+ */
+ public IArchiveType getArchiveType() {
+ return ArchivesCore.getInstance().getExtensionManager().getArchiveType(packageDelegate.getPackageType());
+ }
+
+ /*
+ * @see IArchive#isExploded()
+ */
+ public boolean isExploded() {
+ return packageDelegate.isExploded();
+ }
+
+ /*
+ * @see IArchive#isTopLevel()
+ */
+ public boolean isTopLevel() {
+ return (packageDelegate.getParent() instanceof XbPackages);
+ }
+
+ /*
+ * @see IArchive#setDestinationPath(IPath, boolean)
+ */
+ public void setDestinationPath(IPath path) {
+ IPath destPath = getDestinationPath();
+ attributeChanged(DESTINATION_ATTRIBUTE, destPath == null ? null : destPath.toString(), path == null ? null : path.toString());
+ packageDelegate.setToDir(path.toString());
+ }
+
+ /*
+ * @see IArchive#setInWorkspace(boolean)
+ */
+ public void setInWorkspace(boolean inWorkspace) {
+ attributeChanged(IN_WORKSPACE_ATTRIBUTE, new Boolean(isDestinationInWorkspace()), new Boolean(inWorkspace));
+ packageDelegate.setInWorkspace(inWorkspace);
+ }
+
+ /*
+ * @see IArchive#setExploded(boolean)
+ */
+ public void setExploded(boolean exploded) {
+ attributeChanged(EXPLODED_ATTRIBUTE, new Boolean(isExploded()), new Boolean(exploded));
+ packageDelegate.setExploded(exploded);
+ }
+
+ /*
+ * @see IArchive#setName(String)
+ */
+ public void setName(String name) {
+ attributeChanged(NAME_ATTRIBUTE, getName(), name);
+ packageDelegate.setName(name);
+ }
+
+ /*
+ * @see IArchive#setArchiveType(IArchiveType)
+ */
+ public void setArchiveType(IArchiveType type) {
+ attributeChanged(PACKAGE_TYPE_ATTRIBUTE, getArchiveTypeId(), type == null ? null : type.getId());
+ packageDelegate.setPackageType(type.getId());
+ }
+
+ protected XbPackage getPackageDelegate () {
+ return packageDelegate;
+ }
+
+ /*
+ * @see IArchive#setArchiveType(String)
+ */
+ public void setArchiveType(String type) {
+ attributeChanged(PACKAGE_TYPE_ATTRIBUTE, getArchiveTypeId(), type);
+ packageDelegate.setPackageType(type);
+ }
+
+ public String toString() {
+ return getName();
+ }
+
+ /*
+ * @see IArchive#getArchiveTypeId()
+ */
+ public String getArchiveTypeId() {
+ return packageDelegate.getPackageType();
+ }
+
+ /*
+ * @see IArchiveNode#getRootArchiveRelativePath()
+ */
+ public IPath getRootArchiveRelativePath() {
+ if( getParent() == null || getParent().getRootArchiveRelativePath() == null )
+ return new Path(getName());
+ return getParent().getRootArchiveRelativePath().append(getName());
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveModelNode.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveModelNode.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveModelNode.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal;
+
+import org.eclipse.core.runtime.IPath;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelListenerManager;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNodeWithProperties;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
+
+public class ArchiveModelNode extends ArchiveNodeImpl implements IArchiveModelNode {
+ private IPath project;
+ private IArchiveModelListenerManager manager;
+
+ public ArchiveModelNode(IPath project,
+ XbPackageNodeWithProperties node, IArchiveModelListenerManager manager) {
+ super(node);
+ this.project = project;
+ this.manager = manager;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveModelNode#getManager()
+ */
+ public IArchiveModelListenerManager getManager() {
+ return manager;
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl#getProject()
+ */
+ public IPath getProjectPath() {
+ return project;
+ }
+
+ public XbPackages getXbPackages() {
+ return (XbPackages)nodeDelegate;
+ }
+
+ /**
+ * The model root can only accept IArchive's as children
+ * @see IArchiveNode#addChild(IArchiveNode)
+ */
+ public void addChild(IArchiveNode child) {
+ if( child instanceof IArchive ) {
+ super.addChild(child);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getNodeType()
+ */
+ public int getNodeType() {
+ return IArchiveNode.TYPE_MODEL;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl#getRoot()
+ */
+ public IArchiveNode getRoot() {
+ return this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl#connectedToModel()
+ */
+ public boolean connectedToModel() {
+ return ArchivesModel.instance().containsRoot(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl#getParent()
+ */
+ public IArchiveNode getParent() {
+ return null;
+ }
+
+ /**
+ * No parent allowed for a model node
+ * @see IArchiveNode#setParent(IArchiveNode)
+ */
+ public void setParent(IArchiveNode parent) {
+ }
+
+ /**
+ * I have no relative path. I'm above the root archive
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getRootArchiveRelativePath()
+ */
+ public IPath getRootArchiveRelativePath() {
+ return null;
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeDeltaImpl.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeDeltaImpl.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeDeltaImpl.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,332 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
+
+/**
+ * This class represents changed nodes in the model
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ *
+ */
+public class ArchiveNodeDeltaImpl implements IArchiveNodeDelta {
+
+ private ArchiveNodeDeltaImpl parentDelta;
+ private ArchiveNodeImpl postNode, preNode;
+ private HashMap attributes, properties, children;
+ private int kind;
+ private IArchiveNodeDelta[] childrenDeltas;
+
+ /**
+ * Primary constructor
+ * @param parentDelta
+ * @param impl
+ * @param attributeChanges
+ * @param propertyChanges
+ * @param childChanges
+ */
+ public ArchiveNodeDeltaImpl(ArchiveNodeDeltaImpl parentDelta, ArchiveNodeImpl impl,
+ HashMap attributeChanges, HashMap propertyChanges, HashMap childChanges) {
+ this.parentDelta = parentDelta;
+ postNode = impl;
+ kind = 0;
+ properties = propertyChanges;
+ attributes = attributeChanges;
+ children = childChanges;
+
+ // These three lines adjust my "kind" to be accurate
+ ensureAccurateKind();
+
+ // create *my* pre-node
+ // this creates an accurate "old" node but without ANY children at all.
+ preNode = ArchiveDeltaPreNodeFactory.createNode(parentDelta, postNode, attributeChanges, propertyChanges);
+
+
+ // The children are expected to be added in the loadAllAffectedChildren
+ loadAllAffectedChildren();
+ }
+
+ /**
+ * Constructor that forces a child to be added or removed, as judged by the parent
+ * @param parentDelta
+ * @param impl
+ * @param forcedKind
+ * @param attributeChanges
+ * @param propertyChanges
+ * @param childChanges
+ */
+ public ArchiveNodeDeltaImpl(ArchiveNodeDeltaImpl parentDelta, ArchiveNodeImpl impl,
+ int forcedKind, HashMap attributeChanges,
+ HashMap propertyChanges, HashMap childChanges) {
+ this(parentDelta, impl, attributeChanges, propertyChanges, childChanges);
+ kind = kind | forcedKind; // pre-gaming
+
+ // but if I'm added, I have no pre-node, no changes. All NEW
+ if( (kind & IArchiveNodeDelta.ADDED) == IArchiveNodeDelta.ADDED ) {
+ preNode = null;
+ kind = IArchiveNodeDelta.ADDED;
+ attributes.clear();
+ properties.clear();
+ }
+
+ }
+
+ protected ArchiveNodeDeltaImpl getParentDelta() {
+ return parentDelta;
+ }
+
+ protected void ensureAccurateKind() {
+
+ // Properties First
+ Object key;
+ NodeDelta val;
+ for( Iterator i = properties.keySet().iterator(); i.hasNext(); ) {
+ key = i.next();
+ val = (NodeDelta)properties.get(key);
+ kind = kind | val.getKind();
+ }
+
+ // Attributes Second
+ if( attributes.keySet().size() > 0 )
+ kind = kind | ATTRIBUTE_CHANGED;
+
+ /*
+ * Children third.
+ *
+ * The changed children are saved in a hashmap
+ * Node -> Integer (where int is one of
+ * IPackagesModelDelta.CHILD_ADDED or
+ * IPackagesModelDelta.CHILD_REMOVED
+ */
+ Integer val2;
+ for( Iterator i = children.keySet().iterator(); i.hasNext(); ) {
+ key = i.next();
+ val2 = (Integer)children.get(key);
+ if( val2 != null )
+ kind = kind | val2.intValue();
+ }
+ }
+
+
+ // Forced during constructor, will set the flag for CHILD_CHANGED if a child has changed at all.
+ public IArchiveNodeDelta[] getAllAffectedChildren() {
+ if( childrenDeltas == null ) {
+ loadAllAffectedChildren();
+ }
+ return childrenDeltas;
+ }
+
+ private void loadAllAffectedChildren() {
+ ArrayList priorChildren = new ArrayList();
+
+ // first add the deltas for things that are currently our children
+ // this includes items that haven't been changed, and items that were added
+ IArchiveNode[] children = postNode.getAllChildren();
+ IArchiveNodeDelta delta;
+ ArrayList deltas = new ArrayList();
+ for( int i = 0; i < children.length; i++ ) {
+ // create our child delta before evaluating whether or not to add it
+ delta = getDelta(children[i]);
+ if( delta.getKind() != IArchiveNodeDelta.NO_CHANGE ) {
+ deltas.add(delta);
+ if( ((delta.getKind() & IArchiveNodeDelta.ADDED) == 0 ) &&
+ ((delta.getKind() & IArchiveNodeDelta.REMOVED) == 0)){
+ kind = kind | DESCENDENT_CHANGED;
+ }
+ }
+
+ // add ALL current nodes, then later remove the added ones
+ priorChildren.add(delta.getPreNode());
+ }
+
+ // now handle the removed ones
+ ArchiveNodeImpl node;
+ for(Iterator i = this.children.keySet().iterator(); i.hasNext(); ) {
+ node = (ArchiveNodeImpl)i.next();
+ int v = ((Integer)this.children.get(node)).intValue();
+
+ if( v == IArchiveNodeDelta.CHILD_REMOVED) {
+ delta = getDelta(node);
+ deltas.add(delta);
+ priorChildren.add(delta.getPreNode());
+ } else if( v == IArchiveNodeDelta.CHILD_ADDED) {
+ delta = getDelta(node);
+ priorChildren.remove(delta.getPreNode());
+ }
+ }
+
+ if( preNode != null ) {
+ // now we've got our list of current children... set them.
+ for( Iterator i = priorChildren.iterator(); i.hasNext(); ) {
+ preNode.addChild((IArchiveNode)i.next());
+ }
+ // now clear pre-node's deltas so it looks shiny
+ preNode.clearDeltas();
+ }
+
+ childrenDeltas = (IArchiveNodeDelta[]) deltas.toArray(new IArchiveNodeDelta[deltas.size()]);
+ }
+
+
+ private HashMap deltaMap = new HashMap();
+ // local cache
+ private IArchiveNodeDelta getDelta(IArchiveNode child) {
+ if( !deltaMap.containsKey(child)) {
+ deltaMap.put(child, loadDelta(child));
+ }
+ return (IArchiveNodeDelta)deltaMap.get(child);
+ }
+ private IArchiveNodeDelta loadDelta(IArchiveNode child) {
+ if( child instanceof ArchiveNodeImpl ) {
+ int addedOrRemoved = 0;
+ if( children.containsKey(child)) {
+ addedOrRemoved = ((Integer)children.get(child)).intValue() >> 8;
+ }
+ ArchiveNodeImpl impl = (ArchiveNodeImpl)child;
+
+ // Using a different delta constructor here to force
+ // whether this child is added or removed.
+ return new ArchiveNodeDeltaImpl(this, impl, addedOrRemoved,
+ (HashMap)impl.attributeChanges.clone(),
+ (HashMap)impl.propertyChanges.clone(),
+ (HashMap)impl.childChanges.clone());
+ }
+ return child.getDelta();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta#getKind()
+ */
+ public int getKind() {
+ return kind;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta#getPostNode()
+ */
+ public IArchiveNode getPostNode() {
+ return postNode;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta#getPreNode()
+ */
+ public IArchiveNode getPreNode() {
+ return preNode;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta#getAttributesWithDeltas()
+ */
+ public String[] getAttributesWithDeltas() {
+ Collection atts = attributes.keySet();
+ return (String[]) atts.toArray(new String[atts.size()]);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta#getAttributeDelta(java.lang.String)
+ */
+ public INodeDelta getAttributeDelta(String key) {
+ return (INodeDelta)attributes.get(key);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta#getPropertiesWithDeltas()
+ */
+ public String[] getPropertiesWithDeltas() {
+ Collection atts = properties.keySet();
+ return (String[]) atts.toArray(new String[atts.size()]);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta#getPropertyDelta(java.lang.String)
+ */
+ public INodeDelta getPropertyDelta(String key) {
+ return (INodeDelta)properties.get(key);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta#getAddedChildrenDeltas()
+ */
+ public IArchiveNodeDelta[] getAddedChildrenDeltas() {
+ return getChangedChildren(IArchiveNodeDelta.ADDED);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta#getRemovedChildrenDeltas()
+ */
+ public IArchiveNodeDelta[] getRemovedChildrenDeltas() {
+ return getChangedChildren(IArchiveNodeDelta.REMOVED);
+ }
+
+ public IArchiveNodeDelta[] getChangedDescendentDeltas() {
+ return getChangedChildren(IArchiveNodeDelta.DESCENDENT_CHANGED);
+ }
+
+ private IArchiveNodeDelta[] getChangedChildren(int type) {
+ ArrayList list = new ArrayList();
+ for( int i = 0; i < childrenDeltas.length; i++ ) {
+ if( (childrenDeltas[i].getKind() & type) != 0 ) {
+ list.add(childrenDeltas[i]);
+ }
+ }
+ return (IArchiveNodeDelta[]) list.toArray(new IArchiveNodeDelta[list.size()]);
+ }
+
+ /**
+ * A quick and dirty class to keep track of changing
+ * values between saves in a model.
+ * Used for property changes and attribute changes
+ * @author rstryker
+ *
+ */
+ protected static class NodeDelta implements INodeDelta {
+ private int kind;
+ private Object before, after;
+ public NodeDelta(Object before, Object after, int kind) {
+ this.before = before;
+ this.after = after;
+ this.kind = kind;
+ }
+ public Object getBefore() { return before; }
+ public Object getAfter() { return after; }
+ public int getKind() {
+ return kind;
+ }
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeImpl.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeImpl.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeImpl.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,417 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IPath;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeVisitor;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeDeltaImpl.NodeDelta;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNode;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNodeWithProperties;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
+
+public abstract class ArchiveNodeImpl implements IArchiveNode {
+
+ protected XbPackageNodeWithProperties nodeDelegate;
+ protected IArchiveNode parent;
+ protected ArrayList children;
+
+ // cached data
+ protected HashMap attributeChanges;
+ protected HashMap propertyChanges;
+ protected HashMap childChanges;
+
+
+ public ArchiveNodeImpl (XbPackageNodeWithProperties delegate) {
+ nodeDelegate = delegate;
+ children = new ArrayList();
+
+ // for deltas
+ attributeChanges = new HashMap();
+ propertyChanges = new HashMap();
+ childChanges = new HashMap();
+ }
+
+ public XbPackageNode getNodeDelegate() {
+ return nodeDelegate;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getRoot()
+ */
+ public IArchiveNode getRoot() {
+ return parent == null ? this : parent.getRoot();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getModel()
+ */
+ public IArchiveModelNode getModel() {
+ Object root = getRoot();
+ return root instanceof IArchiveModelNode ? (IArchiveModelNode)root : null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getRootArchive()
+ */
+ public IArchive getRootArchive() {
+ IArchiveNode parent = this.parent;
+ IArchive topArchives = null;
+
+ if( getNodeType() == IArchiveNode.TYPE_ARCHIVE ) topArchives = (IArchive)this;
+ while( parent != null ) {
+ if( parent.getNodeType() == IArchiveNode.TYPE_ARCHIVE )
+ topArchives = (IArchive)parent;
+ parent = parent.getParent();
+ }
+ return topArchives;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getAllChildren()
+ */
+ public IArchiveNode[] getAllChildren () {
+ return (IArchiveNode[]) children.toArray(new IArchiveNode[children.size()]);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getChildren(int)
+ */
+ public IArchiveNode[] getChildren(int type) {
+ ArrayList typedChildren = new ArrayList();
+ for (Iterator iter = children.iterator(); iter.hasNext(); ) {
+ IArchiveNode child = (IArchiveNode) iter.next();
+ if (child.getNodeType() == type) {
+ typedChildren.add(child);
+ }
+ }
+
+ return (IArchiveNode[]) typedChildren.toArray(new IArchiveNode[typedChildren.size()]);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#hasChildren()
+ */
+ public boolean hasChildren () {
+ return nodeDelegate.hasChildren();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#hasChild(org.jboss.ide.eclipse.archives.core.model.IArchiveNode)
+ */
+ public boolean hasChild (IArchiveNode child) {
+ ArchiveNodeImpl childImpl = (ArchiveNodeImpl)child;
+ return nodeDelegate.getAllChildren().contains(childImpl.nodeDelegate);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getParent()
+ */
+ public IArchiveNode getParent() {
+ return parent;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#setParent(org.jboss.ide.eclipse.archives.core.model.IArchiveNode)
+ */
+ public void setParent (IArchiveNode parent) {
+ if( getParent() != null && parent != getParent()) {
+ getParent().removeChild(this);
+ }
+
+ if (parent != null && !(parent instanceof ArchiveModelNode)) {
+ this.parent = parent;
+ nodeDelegate.setParent(((ArchiveNodeImpl)parent).getNodeDelegate());
+ } else if (getNodeType() == TYPE_ARCHIVE) {
+ this.parent = parent;
+ XbPackages packages = ArchivesModel.instance().getXbPackages(getProjectPath());
+ nodeDelegate.setParent(packages);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getProject()
+ */
+ public IPath getProjectPath() {
+ IArchiveNode root = getRoot();
+ if( root.getNodeType() != IArchiveNode.TYPE_MODEL)
+ return null;
+ return root.getProjectPath();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getProperty(java.lang.String)
+ */
+ public String getProperty(String property) {
+ return getProperties().getProperty(property);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#setProperty(java.lang.String, java.lang.String)
+ */
+ public void setProperty(String property, String value) {
+ if( property == null ) return;
+ propertyChanged(property, getProperty(property), value);
+ if( value == null ) {
+ getProperties().remove(property);
+ } else {
+ getProperties().setProperty(property, value);
+ }
+ }
+
+ /**
+ * @return Get the properties for this object
+ */
+ protected Properties getProperties() {
+ return nodeDelegate.getProperties().getProperties();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#accept(org.jboss.ide.eclipse.archives.core.model.IArchiveNodeVisitor)
+ */
+ public boolean accept(IArchiveNodeVisitor visitor) {
+ return accept(visitor, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#accept(org.jboss.ide.eclipse.archives.core.model.IArchiveNodeVisitor, boolean)
+ */
+ public boolean accept(IArchiveNodeVisitor visitor, boolean depthFirst) {
+ IArchiveNode children[] = getAllChildren();
+ boolean keepGoing = true;
+
+ if (!depthFirst)
+ keepGoing = visitor.visit(this);
+
+ if (keepGoing) {
+ for (int i = 0; i < children.length; i++) {
+ if (keepGoing) {
+ keepGoing = children[i].accept(visitor, depthFirst);
+ }
+ }
+ }
+
+ if (depthFirst && keepGoing)
+ keepGoing = visitor.visit(this);
+
+ return keepGoing;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#addChild(org.jboss.ide.eclipse.archives.core.model.IArchiveNode)
+ */
+ public void addChild(IArchiveNode node) {
+ addChild(node, true);
+ }
+
+ /**
+ * Add a child with the option to skip adding in the delegate
+ * @param child
+ * @param addInDelegate
+ */
+ public void addChild(IArchiveNode child, boolean addInDelegate) {
+ Assert.isNotNull(child);
+ ArchiveNodeImpl childImpl = (ArchiveNodeImpl) child;
+ children.add(childImpl);
+ childImpl.setParent(this);
+ if( addInDelegate )
+ nodeDelegate.addChild(childImpl.nodeDelegate);
+ childChanges(child, IArchiveNodeDelta.CHILD_ADDED);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#removeChild(org.jboss.ide.eclipse.archives.core.model.IArchiveNode)
+ */
+ public void removeChild(IArchiveNode node) {
+ Assert.isNotNull(node);
+ ArchiveNodeImpl impl = (ArchiveNodeImpl) node;
+ boolean removed = false;
+ if (nodeDelegate.getAllChildren().contains(impl.nodeDelegate)) {
+ nodeDelegate.removeChild(impl.nodeDelegate);
+ removed = true;
+ }
+
+ if (children.contains(node)) {
+ children.remove(node);
+ removed = true;
+ }
+ if( removed )
+ childChanges(node, IArchiveNodeDelta.CHILD_REMOVED);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+
+// if (adapter.equals(IProject.class)) {
+// return getProjectPath();
+// } else if (adapter.equals(IArchiveNode.class)) {
+// return this;
+// }
+// else return null;
+ return null;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#connectedToModel()
+ */
+ public boolean connectedToModel() {
+ IArchiveNode root = getRoot();
+ return root instanceof ArchiveModelNode && ArchivesModel.instance().containsRoot((ArchiveModelNode)root);
+ }
+
+
+ /**
+ * An attribute has changed. Save the change so it can be represented in a delta
+ */
+ protected void attributeChanged(String key, Object beforeValue, Object afterValue) {
+ int kind = IArchiveNodeDelta.ATTRIBUTE_CHANGED;
+ HashMap map = attributeChanges;
+
+ // short circuit if no change has REALLY occurred
+ if( beforeValue != null && beforeValue.equals(afterValue)) return;
+
+ if( map.containsKey(key)) {
+ Object original = ((NodeDelta)map.get(key)).getBefore();
+ if( original == null && afterValue == null )
+ map.remove(key);
+ else if( original == null )
+ map.put(key, new NodeDelta(original, afterValue, kind));
+ else if( original.equals(afterValue))
+ // value was changed from x to y, then back to x. Therefore, no change
+ map.remove(key);
+ else
+ // value was changed from x to y to z.
+ // Before should remain x, after should become z
+ map.put(key, new NodeDelta(original, afterValue, kind));
+ } else {
+ // added
+ map.put(key, new NodeDelta(beforeValue, afterValue, kind));
+ }
+ }
+
+ /**
+ * A property has changed. Save the change so it can be represented in a delta
+ */
+ protected void propertyChanged(String key, Object beforeValue, Object afterValue) {
+ HashMap changeMap = propertyChanges;
+ // short circuit if no change has REALLY occurred
+ if( beforeValue != null && beforeValue.equals(afterValue)) return;
+
+
+ if( changeMap.containsKey(key)) {
+ // element has already been added, removed, or changed since last save
+ Object original = ((NodeDelta)changeMap.get(key)).getBefore();
+ if( original == null && afterValue == null )
+ changeMap.remove(key);
+ else if( original == null )
+ changeMap.put(key, new NodeDelta(original, afterValue, IArchiveNodeDelta.PROPERTY_ADDED));
+ else if( original.equals(afterValue))
+ // value was changed from x to y, then back to x. Therefore, no change
+ changeMap.remove(key);
+ else if( afterValue == null ) {
+ // changed from x to y to null, so removed
+ changeMap.put(key, new NodeDelta(original, afterValue, IArchiveNodeDelta.PROPERTY_REMOVED));
+ } else {
+ // changed from x to y to z, so changed
+ changeMap.put(key, new NodeDelta(original, afterValue, IArchiveNodeDelta.PROPERTY_CHANGED));
+ }
+ } else {
+ int kind;
+ if( beforeValue == null ) kind = IArchiveNodeDelta.PROPERTY_ADDED;
+ else if( afterValue == null ) kind = IArchiveNodeDelta.PROPERTY_REMOVED;
+ else kind = IArchiveNodeDelta.PROPERTY_CHANGED;
+ changeMap.put(key, new NodeDelta(beforeValue, afterValue, kind));
+ }
+ }
+
+ /**
+ * A child has changed. Save the change
+ * @param node
+ * @param changeType
+ */
+ protected void childChanges(IArchiveNode node, int changeType) {
+ if( childChanges.containsKey(node)) {
+ int lastChange = ((Integer)childChanges.get(node)).intValue();
+ if( lastChange == IArchiveNodeDelta.CHILD_ADDED && changeType == IArchiveNodeDelta.CHILD_REMOVED) {
+ childChanges.remove(node);
+ } else if( lastChange == IArchiveNodeDelta.CHILD_REMOVED && changeType == IArchiveNodeDelta.CHILD_ADDED) {
+ childChanges.remove(node);
+ }
+ } else {
+ childChanges.put(node, new Integer(changeType));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getDelta()
+ */
+ public IArchiveNodeDelta getDelta() {
+ return new ArchiveNodeDeltaImpl(null, this, (HashMap)attributeChanges.clone(),
+ (HashMap)propertyChanges.clone(), (HashMap)childChanges.clone());
+ }
+
+ /**
+ * Forget all past state
+ */
+ public void clearDeltas() {
+ attributeChanges.clear();
+ propertyChanges.clear();
+ childChanges.clear();
+
+ // clear children
+ IArchiveNode[] children = getAllChildren();
+ for( int i = 0; i < children.length; i++ )
+ ((ArchiveNodeImpl)children[i]).clearDeltas();
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,132 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal.xb;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Writer;
+import java.net.URL;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.Trace;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.XercesXsMarshaller;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
+import org.xml.sax.SAXException;
+
+public class XMLBinding {
+
+ public static final int NUM_UNMARSHAL_MONITOR_STEPS = 3;
+ public static final int NUM_MARSHALL_MONITOR_STEPS = 2;
+
+ private static URL schema = ArchivesCore.getInstance().getVariables().getBindingSchema();
+ private static URL log4jxml = ArchivesCore.getInstance().getVariables().getBindingLog4j();
+ private static SchemaBinding binding;
+
+ static {
+ System.setProperty("log4j.configuration", log4jxml.toString());
+ }
+
+ public static void init ()
+ {
+ try {
+ InputStream stream = schema.openStream();
+ binding = XsdBinder.bind(stream, "UTF-8", null);
+
+ stream.close();
+ } catch (IOException e) {
+ Trace.trace(XMLBinding.class, e);
+ }
+ }
+
+ private static void binderSandbox (Runnable runnable)
+ {
+ ClassLoader original = Thread.currentThread().getContextClassLoader();
+ ClassLoader myCL = XMLBinding.class.getClassLoader();
+ Thread.currentThread().setContextClassLoader(myCL);
+ runnable.run();
+ Thread.currentThread().setContextClassLoader(original);
+ }
+
+ private static XbPackages element = null;
+
+ public static XbPackages unmarshal (final InputStream in, final IProgressMonitor monitor)
+ {
+ element = null;
+
+ binderSandbox(new Runnable() {
+ public void run () {
+ try {
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ monitor.worked(1);
+
+ Object xmlObject = unmarshaller.unmarshal(in, binding);
+ monitor.worked(1);
+
+ element = (XbPackages) xmlObject;
+ monitor.worked(1);
+
+ } catch (JBossXBException e) {
+ Trace.trace(XMLBinding.class, e);
+ }
+ }
+ });
+
+ return element;
+ }
+
+ public static void marshal (final XbPackages element, final Writer writer, final IProgressMonitor monitor)
+ {
+ binderSandbox(new Runnable() {
+ public void run () {
+ try {
+ InputStream stream = schema.openStream();
+ monitor.worked(1);
+
+ XercesXsMarshaller marshaller = new XercesXsMarshaller();
+ marshaller.marshal(new InputStreamReader(stream), new XbPackagesObjectProvider(), element, writer);
+ monitor.worked(1);
+ stream.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (SAXException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ParserConfigurationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFileSet.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFileSet.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFileSet.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal.xb;
+
+public class XbFileSet extends XbPackageNodeWithProperties {
+
+ private String dir, includes, excludes;
+ private boolean inWorkspace;
+
+ public XbFileSet ()
+ {
+ super();
+ inWorkspace = true;
+ }
+
+ public XbFileSet (XbFileSet fileset)
+ {
+ super(fileset);
+ copyFrom(fileset);
+ }
+
+ public void copyFrom (XbFileSet fileset)
+ {
+ this.dir = fileset.dir == null ? null : new String(fileset.dir);
+ this.includes = fileset.includes == null ? null : new String(fileset.includes);
+ this.excludes = fileset.excludes == null ? null : new String(fileset.excludes);
+ this.inWorkspace = fileset.inWorkspace;
+ }
+
+ protected Object clone() throws CloneNotSupportedException {
+ return new XbFileSet(this);
+ }
+
+ public String getDir() {
+ return dir;
+ }
+
+ public void setDir(String dir) {
+ this.dir = dir;
+ }
+
+ public String getExcludes() {
+ return excludes;
+ }
+
+ public void setExcludes(String excludes) {
+ this.excludes = excludes;
+ }
+
+ public String getIncludes() {
+ return includes;
+ }
+
+ public void setIncludes(String includes) {
+ this.includes = includes;
+ }
+
+ public boolean isInWorkspace() {
+ return inWorkspace;
+ }
+
+ public void setInWorkspace(boolean inWorkspace) {
+ this.inWorkspace = inWorkspace;
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFolder.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFolder.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFolder.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal.xb;
+
+import java.util.List;
+
+public class XbFolder extends XbPackageNodeWithProperties {
+
+ private String name;
+
+ public XbFolder ()
+ {
+ super();
+ }
+
+ public XbFolder (XbFolder folder)
+ {
+ super(folder);
+ copyFrom(folder);
+ }
+
+ public void copyFrom (XbFolder folder)
+ {
+ this.name = folder.name == null ? null : new String(folder.name);
+ }
+
+ protected Object clone() throws CloneNotSupportedException {
+ return new XbFolder(this);
+ }
+
+ public List getPackages ()
+ {
+ return getChildren(XbPackage.class);
+ }
+
+ public List getFolders ()
+ {
+ return getChildren(XbFolder.class);
+ }
+
+ public List getFileSets()
+ {
+ return getChildren(XbFileSet.class);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackage.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackage.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackage.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,128 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal.xb;
+
+import java.util.List;
+
+public class XbPackage extends XbPackageNodeWithProperties {
+
+ private String name, packageType, toDir, id;
+ private boolean exploded, inWorkspace;
+
+ public XbPackage () {
+ super();
+ exploded = false;
+ inWorkspace = true;
+ }
+
+ public XbPackage (XbPackage pkg)
+ {
+ super(pkg);
+ copyFrom (pkg);
+ }
+
+ public void copyFrom (XbPackage pkg)
+ {
+ this.name = pkg.name == null ? null: new String(pkg.name);
+ this.packageType = pkg.packageType == null ? null : new String(pkg.packageType);
+ this.toDir = pkg.toDir == null ? null : new String(pkg.toDir);
+ this.exploded = pkg.exploded;
+ this.inWorkspace = pkg.inWorkspace;
+ }
+
+ protected Object clone() throws CloneNotSupportedException {
+ return new XbPackage(this);
+ }
+
+ public List getPackages ()
+ {
+ return getChildren(XbPackage.class);
+ }
+
+ public List getFolders ()
+ {
+ return getChildren(XbFolder.class);
+ }
+
+ public List getFileSets()
+ {
+ return getChildren(XbFileSet.class);
+ }
+
+ public boolean isExploded() {
+ return exploded;
+ }
+
+ public void setExploded(boolean exploded) {
+ this.exploded = exploded;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getToDir() {
+ return toDir;
+ }
+
+ public void setToDir(String toDir) {
+ this.toDir = toDir;
+ }
+
+ public String getPackageType() {
+ return packageType;
+ }
+
+ public void setPackageType(String packageType) {
+ this.packageType = packageType;
+ }
+
+ /**
+ * Get the inWorkspace.
+ *
+ * @return the inWorkspace.
+ */
+ public boolean isInWorkspace() {
+ return inWorkspace;
+ }
+
+ /**
+ * Set the inWorkspace.
+ *
+ * @param inWorkspace The inWorkspace to set.
+ */
+ public void setInWorkspace(boolean inWorkspace) {
+ this.inWorkspace = inWorkspace;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNode.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNode.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNode.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal.xb;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+public abstract class XbPackageNode implements Cloneable {
+
+ protected XbPackageNode parent;
+
+ /**
+ * The children are a class -> arraylist[child] map hashmap
+ */
+ protected Hashtable children;
+
+ public XbPackageNode ()
+ {
+ children = new Hashtable();
+ }
+
+ public XbPackageNode(XbPackageNode node)
+ {
+ children = new Hashtable();
+ Object key;
+ for( Iterator i = node.children.keySet().iterator(); i.hasNext(); ) {
+ key = i.next();
+ children.put(key, ((ArrayList)node.children.get(key)).clone());
+ }
+ }
+
+ public void addChild (Object object)
+ {
+ addChild((XbPackageNode)object);
+ }
+
+ public void addChild (XbPackageNode child)
+ {
+ if (!children.containsKey(child.getClass()))
+ {
+ children.put(child.getClass(), new ArrayList());
+ }
+ getChildren(child.getClass()).add(child);
+ child.setParent(this);
+ }
+
+ public void removeChild (XbPackageNode child)
+ {
+ if (children.containsKey(child.getClass()))
+ {
+ getChildren(child.getClass()).remove(child);
+ }
+ }
+
+ public List getChildren(Class type)
+ {
+ return (List)children.get(type);
+ }
+
+ public boolean hasChildren ()
+ {
+ return children != null && children.size() > 0;
+ }
+
+ public List getAllChildren()
+ {
+ ArrayList allChildren = new ArrayList();
+
+ for (Iterator iter = children.keySet().iterator(); iter.hasNext();)
+ {
+ Class childType = (Class) iter.next();
+ allChildren.addAll(getChildren(childType));
+ }
+ return allChildren;
+ }
+
+ public XbPackageNode getParent()
+ {
+ return parent;
+ }
+
+ public void setParent (XbPackageNode parent)
+ {
+ this.parent = parent;
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNodeWithProperties.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNodeWithProperties.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackageNodeWithProperties.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal.xb;
+
+import java.util.Iterator;
+import java.util.Properties;
+
+public abstract class XbPackageNodeWithProperties extends XbPackageNode {
+
+ protected XbProperties properties;
+
+ public XbPackageNodeWithProperties () {
+ super();
+ properties = new XbProperties();
+ }
+
+ public XbPackageNodeWithProperties (XbPackageNodeWithProperties node) {
+ super(node);
+ properties = new XbProperties();
+ }
+
+ public void copyFrom (XbPackageNodeWithProperties node) {
+ properties.getProperties().clear();
+
+ Properties props = node.getProperties().getProperties();
+ for (Iterator iter = props.keySet().iterator(); iter.hasNext(); )
+ {
+ String key = (String) iter.next();
+
+ properties.getProperties().setProperty(key, (String) props.get(key));
+ }
+ }
+
+ public XbProperties getProperties () {
+ return properties;
+ }
+
+ public void setProperties (Object object) {
+ setProperties((XbProperties)object);
+ }
+
+ protected void setProperties (XbProperties properties) {
+ this.properties = properties;
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackages.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackages.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackages.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal.xb;
+
+import java.util.List;
+
+public class XbPackages extends XbPackageNodeWithProperties {
+
+ public XbPackages () {
+ super();
+ }
+
+ public XbPackages (XbPackages packages)
+ {
+ super(packages);
+ }
+
+ protected Object clone() throws CloneNotSupportedException {
+ return new XbPackages(this);
+ }
+
+ public List getPackages ()
+ {
+ return getChildren(XbPackage.class);
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackagesObjectProvider.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackagesObjectProvider.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbPackagesObjectProvider.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,98 @@
+package org.jboss.ide.eclipse.archives.core.model.internal.xb;
+
+import org.jboss.xb.binding.GenericObjectModelProvider;
+import org.jboss.xb.binding.MarshallingContext;
+
+public class XbPackagesObjectProvider implements GenericObjectModelProvider {
+
+ public Object getRoot(Object o, MarshallingContext context, String namespaceURI, String localName) {
+ return o;
+ }
+
+ protected Object getNodeChildren(XbPackageNode node, String name)
+ {
+ if ("package".equals(name))
+ {
+ return node.getChildren(XbPackage.class);
+ }
+ else if ("folder".equals(name))
+ {
+ return node.getChildren(XbFolder.class);
+ }
+ else if ("fileset".equals(name))
+ {
+ return node.getChildren(XbFileSet.class);
+ }
+ else if ("properties".equals(name) && node instanceof XbPackageNodeWithProperties)
+ {
+ return ((XbPackageNodeWithProperties)node).getProperties();
+ }
+ else if ("property".equals(name) && node instanceof XbProperties)
+ {
+ return ((XbProperties)node).getProperties().getPropertyElements();
+ }
+
+ return null;
+ }
+
+ public Object getChildren(Object object, MarshallingContext context, String namespaceURI, String localName)
+ {
+ if (object instanceof XbPackageNode) {
+ Object ret = getNodeChildren(((XbPackageNode)object), localName);
+ return ret;
+ }
+ return null;
+ }
+
+
+ public Object getAttributeValue(Object object, MarshallingContext context, String namespaceURI, String localName)
+ {
+ if (object instanceof XbPackage)
+ {
+ XbPackage pkg = (XbPackage)object;
+ if("id".equals(localName)) {
+ return pkg.getId();
+ } else if ("type".equals(localName))
+ return pkg.getPackageType();
+ else if ("name".equals(localName))
+ return pkg.getName();
+ else if ("exploded".equals(localName))
+ return Boolean.valueOf(pkg.isExploded());
+ else if ("todir".equals(localName))
+ return pkg.getToDir();
+ else if ("inWorkspace".equals(localName))
+ return ""+pkg.isInWorkspace();
+ }
+ else if (object instanceof XbFolder)
+ {
+ XbFolder folder = (XbFolder) object;
+ if ("name".equals(localName))
+ return folder.getName();
+ }
+ else if (object instanceof XbFileSet)
+ {
+ XbFileSet fileset = (XbFileSet)object;
+ if ("dir".equals(localName))
+ return fileset.getDir();
+ else if ("includes".equals(localName))
+ return fileset.getIncludes();
+ else if ("excludes".equals(localName))
+ return fileset.getExcludes();
+ else if ("inWorkspace".equals(localName))
+ return "" + fileset.isInWorkspace();
+ }
+ else if (object instanceof XbProperty)
+ {
+ XbProperty prop = (XbProperty) object;
+ if ("name".equals(localName))
+ return prop.getName();
+ else if ("value".equals(localName))
+ return prop.getValue();
+ }
+ return null;
+ }
+
+ public Object getElementValue(Object object, MarshallingContext context, String namespaceURI, String localName) {
+ return null;
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperties.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperties.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperties.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal.xb;
+
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Properties;
+
+
+public class XbProperties extends XbPackageNode {
+
+ private PropertiesExt properties;
+
+ public XbProperties ()
+ {
+ super();
+ this.properties = new PropertiesExt();
+ }
+
+ public XbProperties (XbProperties props)
+ {
+ super(props);
+ this.properties = new PropertiesExt();
+ for (Iterator iter = getChildren(XbProperty.class).iterator(); iter.hasNext(); )
+ {
+ XbProperty element = (XbProperty) iter.next();
+ addProperty(element);
+ }
+ }
+
+ protected Object clone() throws CloneNotSupportedException {
+ return new XbProperties(this);
+ }
+
+ public class PropertiesExt extends Properties {
+ private static final long serialVersionUID = 1L;
+ private Hashtable propertyElements;
+
+ public PropertiesExt ()
+ {
+ propertyElements = new Hashtable();
+ }
+
+ public synchronized Object put(Object key, Object value) {
+ if (!propertyElements.containsKey(key))
+ {
+ XbProperty element = new XbProperty();
+ element.setName((String)key);
+ element.setValue((String)value);
+ propertyElements.put(key, element);
+
+ }
+ else {
+ XbProperty element = (XbProperty)propertyElements.get(key);
+ element.setValue((String)value);
+ }
+
+ return super.put(key, value);
+ }
+
+ public synchronized Object remove(Object key) {
+ propertyElements.remove(key);
+
+ return super.remove(key);
+ }
+
+ public Collection getPropertyElements ()
+ {
+ return propertyElements.values();
+ }
+ }
+
+ public PropertiesExt getProperties ()
+ {
+ return properties;
+ }
+
+ public void addProperty (Object property)
+ {
+ addProperty((XbProperty)property);
+ }
+
+ public void addProperty (XbProperty property)
+ {
+ properties.setProperty(property.getName(), property.getValue());
+ addChild(property);
+ }
+
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperty.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperty.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbProperty.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal.xb;
+
+
+public class XbProperty extends XbPackageNode {
+
+ private String name, value;
+
+ public XbProperty () {
+ super();
+ }
+
+ public XbProperty(XbProperty property) {
+ this.name = property.name == null ? null : new String(property.name);
+ this.value = property.value == null ? null : new String(property.value);
+ }
+
+ protected Object clone() throws CloneNotSupportedException {
+ return new XbProperty(this);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IArchiveBuildListener.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IArchiveBuildListener.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IArchiveBuildListener.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.other;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+
+/**
+ * This interface is inteded to be implemented by classes who are
+ * interested in receiving callbacks for various IArchive build events
+ *
+ * @author Marshall
+ */
+public interface IArchiveBuildListener {
+
+
+ /**
+ * A project has started being built by the Archives builder
+ * @param project the project being built
+ */
+ public void startedBuild (IPath project);
+
+ /**
+ * A project is finished being built by the Archives builder
+ * @param project the project being built
+ */
+ public void finishedBuild (IPath project);
+
+ /**
+ * The project is going to be rebuilt from scratch and all state should be discarded
+ * @param project
+ */
+ public void cleanProject(IPath project);
+
+ /**
+ * An Archive has started being built by the Archives builder
+ * This can be called from a full build, or from the incremental build
+ * if and only if one of the affected files matches a fileset in this archive.
+ *
+ * @param pkg the Archive being built
+ */
+ public void startedBuildingArchive (IArchive pkg);
+
+ /**
+ * An Archive is finished being built by the Archives builder
+ * This can be called from a full build, or from the incremental build
+ * if and only if one of the affected files matches a fileset in this archive.
+ *
+ * @param pkg the Archive being built
+ */
+ public void finishedBuildingArchive (IArchive pkg);
+
+ /**
+ * The archive is going to be rebuilt from scratch and all state should be discarded
+ * @param pkg
+ */
+ public void cleanArchive(IArchive pkg);
+
+
+ /**
+ * A fileset has started being collected for copying into a Archive
+ * This is *only* used during a FULL BUILD or after a MODEL CHANGE
+ * @param fileset the fileset being collected
+ */
+ public void startedCollectingFileSet (IArchiveFileSet fileset);
+
+ /**
+ * A fileset has finished being collected for copying into a Archive
+ * This is *only* used during a FULL BUILD or after a MODEL CHANGE
+ * @param fileset the fileset being collected
+ */
+ public void finishedCollectingFileSet (IArchiveFileSet fileset);
+
+ /**
+ * The build for the given project has failed
+ * @param pkg The Archive that failed to build
+ * @param status The status/exception that occurred
+ */
+ public void buildFailed (IArchive pkg, IStatus status);
+
+ /**
+ * A file has been updated, with the given IArchive / IArchiveFileSet context
+ * @param topLevelArchive The top level Archive that was updated
+ * @param fileset The fileset that matched the updated file
+ * @param filePath The path to the file that was copied (filesystem/workspace path)
+ */
+ public void fileUpdated (IArchive topLevelArchive, IArchiveFileSet fileset, IPath filePath);
+
+ /**
+ * A file has been removed, with the given IArchive / IArchiveFileSet context
+ * @param topLevelArchive The top level Archive that was updated
+ * @param fileset The fileset that matched the removed file
+ * @param filePath The path to the file that was removed (filesystem/workspace path)
+ */
+ public void fileRemoved (IArchive topLevelArchive, IArchiveFileSet fileset, IPath filePath);
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IArchiveModelListener.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IArchiveModelListener.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IArchiveModelListener.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.other;
+
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
+
+/**
+ * Interface for model changes.
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ */
+public interface IArchiveModelListener {
+ public void modelChanged(IArchiveNodeDelta delta);
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IExtensionManager.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IExtensionManager.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IExtensionManager.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,9 @@
+package org.jboss.ide.eclipse.archives.core.model.other;
+
+import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
+
+
+public interface IExtensionManager {
+ public IArchiveType[] getArchiveTypes();
+ public IArchiveType getArchiveType(String id);
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IPreferenceManager.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IPreferenceManager.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IPreferenceManager.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,10 @@
+package org.jboss.ide.eclipse.archives.core.model.other;
+
+import org.eclipse.core.runtime.IPath;
+
+public interface IPreferenceManager {
+ public boolean isBuilderEnabled(IPath path);
+ public void setBuilderEnabled(IPath path, boolean val);
+ public boolean areProjectSpecificPrefsEnabled(IPath path);
+ public void setProjectSpecificPrefsEnabled(IPath path, boolean val);
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IRuntimeVariables.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IRuntimeVariables.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/IRuntimeVariables.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,18 @@
+package org.jboss.ide.eclipse.archives.core.model.other;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.IPath;
+
+public interface IRuntimeVariables {
+ /**
+ * Is the debugging option provided enabled?
+ * If the option is null, is debugging enabled at all?
+ * @param option
+ * @return
+ */
+ public boolean isDebugging(String option);
+ public IPath getWorkspacePath();
+ public URL getBindingSchema();
+ public URL getBindingLog4j();
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/StandaloneVariables.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/StandaloneVariables.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/StandaloneVariables.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,30 @@
+package org.jboss.ide.eclipse.archives.core.model.other.internal;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.IPath;
+import org.jboss.ide.eclipse.archives.core.model.other.IRuntimeVariables;
+
+public class StandaloneVariables implements IRuntimeVariables {
+
+ public URL getBindingLog4j() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public URL getBindingSchema() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IPath getWorkspacePath() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isDebugging(String option) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.other.internal;
+
+import java.util.Collection;
+import java.util.Hashtable;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.InvalidRegistryObjectException;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.ide.eclipse.archives.core.Trace;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
+import org.jboss.ide.eclipse.archives.core.model.other.IExtensionManager;
+
+/**
+ * This class will be responsible for loading extension points in the core.
+ *
+ * @author Rob Stryker (rob.stryker(a)redhat.com)
+ *
+ */
+public class WorkspaceExtensionManager implements IExtensionManager {
+ public static final String ARCHIVE_TYPES_EXTENSION_ID = "org.jboss.ide.eclipse.archives.core.archiveTypes";
+
+ private IExtension[] findExtension (String extensionId) {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = registry.getExtensionPoint(extensionId);
+ return extensionPoint.getExtensions();
+ }
+
+ private static Hashtable archiveTypes;
+ private void loadPackageTypes () {
+ archiveTypes = new Hashtable();
+ IExtension[] extensions = findExtension(ARCHIVE_TYPES_EXTENSION_ID);
+
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement elements[] = extensions[i].getConfigurationElements();
+ for (int j = 0; j < elements.length; j++) {
+ try {
+ Object executable = elements[j].createExecutableExtension("class");
+ IArchiveType type = (IArchiveType)executable;
+ archiveTypes.put(type.getId(), type);
+ } catch (InvalidRegistryObjectException e) {
+ Trace.trace(WorkspaceExtensionManager.class, e);
+ } catch( CoreException e ) {
+ Trace.trace(WorkspaceExtensionManager.class, e);
+ }
+ }
+ }
+ }
+
+ public IArchiveType getArchiveType (String packageType) {
+ if (archiveTypes == null)
+ loadPackageTypes();
+ return (IArchiveType)archiveTypes.get(packageType);
+ }
+
+ public IArchiveType[] getArchiveTypes() {
+ if( archiveTypes == null )
+ loadPackageTypes();
+ Collection c = archiveTypes.values();
+ return (IArchiveType[]) c.toArray(new IArchiveType[c.size()]);
+ }
+
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspacePreferenceManager.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspacePreferenceManager.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspacePreferenceManager.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.other.internal;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin;
+import org.jboss.ide.eclipse.archives.core.model.other.IPreferenceManager;
+import org.osgi.service.prefs.BackingStoreException;
+
+
+/**
+ * Sets default preferences for the plugin.
+ * By default, the builder is enabled for all projects with archives.
+ *
+ * @author rstryker
+ *
+ */
+public class WorkspacePreferenceManager extends AbstractPreferenceInitializer implements IPreferenceManager {
+ public static final String AUTOMATIC_BUILDER_ENABLED = "org.jboss.ide.eclipse.archives.core.automaticBuilderEnabled";
+ public static final String PROJECT_SPECIFIC_PREFS = "org.jboss.ide.eclipse.archives.core.projectSpecificPreferencesEnabled";
+
+ private static IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ private static IResource getResource(IPath path) {
+ if( path != null && workspaceRoot.getLocation().isPrefixOf(path) ) {
+ String relative = path.toOSString().substring(workspaceRoot.getLocation().toOSString().length()+1);
+ return workspaceRoot.getProject(relative);
+ }
+
+ return null;
+ }
+
+ public boolean isBuilderEnabled(IPath path) {
+ QualifiedName name = new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, AUTOMATIC_BUILDER_ENABLED);
+ IResource res = getResource(path);
+ if( res != null && areProjectSpecificPrefsEnabled(res)) {
+ try {
+ if( res.getPersistentProperty(name) != null) {
+ return Boolean.parseBoolean(res.getPersistentProperty(name));
+ }
+ } catch( CoreException ce ) {}
+ }
+ return new InstanceScope().getNode(ArchivesCorePlugin.PLUGIN_ID).getBoolean(AUTOMATIC_BUILDER_ENABLED, true);
+ }
+
+ public void setBuilderEnabled(IPath path, boolean value) {
+ QualifiedName name = new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, AUTOMATIC_BUILDER_ENABLED);
+ IResource resource = getResource(path);
+ // if the resource is null or the resource has no preference val, use global val
+ try {
+ if( resource != null && resource.getPersistentProperty(name) != null) {
+ resource.setPersistentProperty(name, new Boolean(value).toString());
+ return;
+ }
+ } catch( CoreException ce ) {}
+ IEclipsePreferences prefs = new InstanceScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
+ prefs.putBoolean(AUTOMATIC_BUILDER_ENABLED, value);
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void initializeDefaultPreferences() {
+ IEclipsePreferences prefs = new DefaultScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
+ prefs.putBoolean(AUTOMATIC_BUILDER_ENABLED, true);
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+
+ public boolean areProjectSpecificPrefsEnabled(IPath path) {
+ return areProjectSpecificPrefsEnabled(getResource(path));
+ }
+ public boolean areProjectSpecificPrefsEnabled(IResource resource) {
+ QualifiedName name = new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, PROJECT_SPECIFIC_PREFS);
+ try {
+ if( resource != null && resource.getPersistentProperty(name) != null) {
+ return Boolean.parseBoolean(resource.getPersistentProperty(name));
+ }
+ } catch( CoreException ce ) {}
+ return false;
+ }
+
+ public void setProjectSpecificPrefsEnabled(IPath path, boolean value) {
+ QualifiedName name = new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, PROJECT_SPECIFIC_PREFS);
+ IResource resource = getResource(path);
+ try {
+ if( resource != null) {
+ resource.setPersistentProperty(name, new Boolean(value).toString());
+ return;
+ }
+ } catch( CoreException ce ) {}
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVariables.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVariables.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVariables.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,29 @@
+package org.jboss.ide.eclipse.archives.core.model.other.internal;
+
+import java.net.URL;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin;
+import org.jboss.ide.eclipse.archives.core.model.other.IRuntimeVariables;
+
+public class WorkspaceVariables implements IRuntimeVariables {
+
+ public URL getBindingLog4j() {
+ return ArchivesCorePlugin.getDefault().getBundle().getEntry("log4j.xml");
+ }
+
+ public URL getBindingSchema() {
+ return ArchivesCorePlugin.getDefault().getBundle().getEntry("xml/packages.xsd");
+ }
+
+ public IPath getWorkspacePath() {
+ return ResourcesPlugin.getWorkspace().getRoot().getLocation();
+ }
+
+ public boolean isDebugging(String option) {
+ return ArchivesCorePlugin.getDefault().isDebugging()
+ && "true".equalsIgnoreCase(Platform.getDebugOption(option));
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/AbstractArchiveType.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/AbstractArchiveType.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/AbstractArchiveType.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,52 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.types;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
+
+/**
+ *
+ * @author rob.stryker(a)jboss.com
+ */
+public abstract class AbstractArchiveType implements IArchiveType, IExecutableExtension {
+
+ private IConfigurationElement element;
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ if( element == null ) element = config;
+ }
+ public String getId() {
+ return element.getAttribute("id");
+ }
+
+ public String getLabel() {
+ return element.getAttribute("label");
+ }
+
+ public abstract IArchive createDefaultConfiguration(IProject project, IProgressMonitor monitor);
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/JARArchiveType.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/JARArchiveType.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/JARArchiveType.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,74 @@
+package org.jboss.ide.eclipse.archives.core.model.types;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.ide.eclipse.archives.core.Trace;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveFileSetImpl;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveImpl;
+
+/**
+ * The default JAR package type will simply jar-up all the classes in a java project's output directory, and place it in the top-level of the project.
+ * The name of the resulting JAR will be the project's name followed by a ".jar" extension.
+ * @author Marshall
+ */
+public class JARArchiveType extends AbstractArchiveType {
+
+ public static final String TYPE_ID = "jar";
+
+ public IArchive createDefaultConfiguration(IProject project, IProgressMonitor monitor) {
+ //IPackageType t = this;
+ Assert.isNotNull(project);
+
+ IJavaProject javaProject = JavaCore.create(project);
+ Assert.isNotNull(javaProject);
+
+ if (monitor == null) monitor = new NullProgressMonitor();
+
+ monitor.beginTask("Creating default JAR configuration for java project \"" + project.getName() + "\"", 2);
+
+ IPath outputPath;
+ try {
+ outputPath = javaProject.getOutputLocation();
+ } catch (JavaModelException e) {
+ Trace.trace(JARArchiveType.class, e);
+ return null;
+ }
+
+ outputPath = outputPath.removeFirstSegments(1);
+ IContainer outputContainer = project.getFolder(outputPath);
+
+ IArchive jar = new ArchiveImpl();
+
+ jar.setDestinationPath(project.getLocation());
+ jar.setInWorkspace(true);
+ jar.setExploded(false);
+ jar.setName(project.getName() + ".jar");
+ jar.setArchiveType(this);
+
+ IArchiveFileSet classes = new ArchiveFileSetImpl();
+ classes.setIncludesPattern("**/*");
+ classes.setSourcePath(outputContainer.getFullPath());
+ classes.setInWorkspace(true);
+
+ jar.addChild(classes);
+
+ monitor.worked(1);
+ monitor.done();
+
+ return jar;
+ }
+
+ // do nothing
+ public IArchive fillDefaultConfiguration(IProject project, IArchive topLevel, IProgressMonitor monitor) {
+ return null;
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,179 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.project;
+
+import java.util.Comparator;
+import java.util.Map;
+import java.util.TreeSet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.build.ArchiveBuildDelegate;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeVisitor;
+import org.jboss.ide.eclipse.archives.core.util.internal.TrueZipUtil;
+
+/**
+ * This builder is responsible for building the archives
+ * It delegates to a delegate.
+ * @author Rob Stryker (rob.stryker(a)redhat.com)
+ *
+ */
+public class ArchivesBuilder extends IncrementalProjectBuilder {
+
+ public static final String BUILDER_ID = "org.jboss.ide.eclipse.archives.core.archivesBuilder";
+
+ /**
+ * Build.
+ * @see IncrementalProjectBuilder#build(int, Map, IProgressMonitor)
+ * @see IProject#build(int, String, Map, IProgressMonitor)
+ */
+ protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
+
+ // if we're not to build, get out of here
+ if( !ArchivesCore.getInstance().getPreferenceManager().isBuilderEnabled(getProject().getLocation()))
+ return new IProject[]{};
+
+ IProject[] interestingProjects = getInterestingProjectsInternal();
+
+ final TreeSet addedChanged = createDefaultTreeSet();
+ final TreeSet removed = createDefaultTreeSet();
+
+ ArchiveBuildDelegate delegate = new ArchiveBuildDelegate();
+ if (kind == IncrementalProjectBuilder.INCREMENTAL_BUILD || kind == IncrementalProjectBuilder.AUTO_BUILD) {
+ fillDeltas(interestingProjects, addedChanged, removed);
+ delegate.projectIncrementalBuild(addedChanged, removed);
+
+ } else if (kind == IncrementalProjectBuilder.FULL_BUILD){
+ // build each package fully
+ IProject p = getProject();
+ delegate.fullProjectBuild(p.getLocation());
+ }
+
+ return interestingProjects;
+ }
+
+ /**
+ * Delete all archives that were created or represented by this
+ * project's archive model.
+ */
+ protected void clean(IProgressMonitor monitor) throws CoreException {
+ IPath p = getProject().getLocation();
+ IArchiveModelNode root = ArchivesModel.instance().getRoot(p);
+ IArchiveNode[] nodes = root.getChildren(IArchiveNode.TYPE_ARCHIVE);
+ for( int i = 0; i < nodes.length; i++ ) {
+ IPath path = ((IArchive)nodes[i]).getDestinationPath();
+ TrueZipUtil.deleteAll(path);
+ }
+ }
+
+ /**
+ * Browse through the deltas and fill the treesets with
+ * affected resources.
+ * @param projects The interesting projects
+ * @param addedChanged A collection of resources that have been added or changed
+ * @param removed A collection of resources that have been removed.
+ */
+ protected void fillDeltas(IProject[] projects, final TreeSet addedChanged, final TreeSet removed) {
+ for( int i = 0; i < projects.length; i++ ) {
+ final IProject proj = projects[i];
+ IResourceDelta delta = getDelta(proj);
+ try {
+ delta.accept(new IResourceDeltaVisitor () {
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ if (delta.getResource().getType() == IResource.FILE) {
+ if( (delta.getKind() & IResourceDelta.ADDED) > 0
+ || (delta.getKind() & IResourceDelta.CHANGED) > 0) {
+
+ // ignore the packages project. that will it's own build call,
+ // or will handle the change in some other way
+ if( !delta.getResource().equals(proj.findMember(ArchivesModel.PROJECT_PACKAGES_FILE)))
+ addedChanged.add(delta.getResource().getLocation());
+ } else if( (delta.getKind() & IResourceDelta.REMOVED ) > 0 ) {
+ removed.add(delta.getResource().getLocation());
+ }
+ }
+ return true;
+ }
+ });
+ } catch( CoreException ce) {
+
+ }
+ }
+ }
+
+ /**
+ * Get any projects that the current project may depend on
+ * (regarding it's archive model, if any filesets match files in
+ * another project).
+ * @return The list of projects that matter
+ */
+ protected IProject[] getInterestingProjectsInternal() {
+ final TreeSet set = createDefaultTreeSet();
+ set.add(getProject());
+
+ final IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ final int count = workspaceRoot.getLocation().segmentCount();
+
+ ArchivesModel.instance().getRoot(getProject().getLocation()).accept(new IArchiveNodeVisitor () {
+ public boolean visit (IArchiveNode node) {
+ if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET) {
+ IArchiveFileSet fileset = (IArchiveFileSet)node;
+ IPath p = fileset.getGlobalSourcePath();
+ if( workspaceRoot.getLocation().isPrefixOf(p)) {
+ IProject proj = workspaceRoot.getProject(p.segment(count));
+ set.add(proj);
+ }
+ }
+ return true;
+ }
+ });
+ return (IProject[]) set.toArray(new IProject[set.size()]);
+ }
+
+ /**
+ * Default treeset with default comparator
+ * @return
+ */
+ protected TreeSet createDefaultTreeSet() {
+ return new TreeSet(new Comparator () {
+ public int compare(Object o1, Object o2) {
+ if (o1.equals(o2)) return 0;
+ else return -1;
+ }
+ });
+ }
+
+}
\ No newline at end of file
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/project/ArchivesNature.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/project/ArchivesNature.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/project/ArchivesNature.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.project;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+/**
+ * The nature associated with archives, specifically
+ * the builder is added or removed based on this nature.
+ *
+ * @author Rob Stryker (rob.stryker(a)redhat.com)
+ *
+ */
+public class ArchivesNature implements IProjectNature {
+
+ public static final String NATURE_ID = "org.jboss.ide.eclipse.archives.core.archivesNature";
+
+ private IProject project;
+
+ public void configure() throws CoreException {
+ addProjectBuilder(project, ArchivesBuilder.BUILDER_ID);
+ }
+
+ public void deconfigure() throws CoreException {
+ removeProjectBuilder(project, ArchivesBuilder.BUILDER_ID);
+ }
+
+ public IProject getProject() {
+ return project;
+ }
+
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+ public static boolean addProjectBuilder(IProject project, String builderId)
+ {
+ try
+ {
+ IProjectDescription desc = project.getDescription();
+ ICommand[] commands = desc.getBuildSpec();
+
+ //add builders to project
+ ICommand builderCommand = desc.newCommand();
+ builderCommand.setBuilderName(builderId);
+
+ ICommand[] newCommands = new ICommand[commands.length + 1];
+ System.arraycopy(commands, 0, newCommands, 0, commands.length);
+ newCommands[newCommands.length - 1] = builderCommand;
+
+ desc.setBuildSpec(newCommands);
+
+ project.setDescription(desc, new NullProgressMonitor());
+ }
+ catch (CoreException e)
+ {
+ e.printStackTrace();
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Removes a specific builder from the end of a given project's builder list.
+ * @param project
+ * @param builderId
+ * @return Whether or not the builder was successfully removed
+ */
+ public static boolean removeProjectBuilder(IProject project, String builderId) {
+ try {
+ IProjectDescription desc = project.getDescription();
+ ICommand[] commands = desc.getBuildSpec();
+ ArrayList newCommands = new ArrayList();
+
+ for (int i = 0; i < commands.length; i++) {
+ if (!commands[i].getBuilderName().equals(builderId)) {
+ newCommands.add(commands[i]);
+ }
+ }
+
+ desc.setBuildSpec((ICommand[]) newCommands.toArray(new ICommand[newCommands.size()]));
+
+ project.setDescription(desc, new NullProgressMonitor());
+ } catch (CoreException e) {
+ e.printStackTrace();
+ return false;
+ }
+
+ return true;
+ }
+
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/project/ProjectUtils.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/project/ProjectUtils.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/project/ProjectUtils.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,46 @@
+package org.jboss.ide.eclipse.archives.core.project;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+public class ProjectUtils {
+
+ public static boolean addProjectNature(IPath path) {
+ String loc = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
+ if( path.toOSString().startsWith(loc)) {
+ String proj = path.toOSString().substring(loc.length()+1);
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(proj);
+ return addProjectNature(p, ArchivesNature.NATURE_ID);
+ }
+ return false;
+ }
+
+ public static boolean addProjectNature(IProject project, String natureId) {
+ boolean added = false;
+ try {
+ if (project != null && natureId != null) {
+ IProjectDescription desc = project.getDescription();
+
+ if (!project.hasNature(natureId)) {
+ String natureIds[] = desc.getNatureIds();
+ String newNatureIds[] = new String[natureIds.length + 1];
+
+ System.arraycopy(natureIds, 0, newNatureIds, 1, natureIds.length);
+ newNatureIds[0] = natureId;
+ desc.setNatureIds(newNatureIds);
+
+ project.getProject().setDescription(desc, new NullProgressMonitor());
+ added = true;
+ }
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ return added;
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,193 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+
+import org.eclipse.core.runtime.IPath;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeVisitor;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveModelNode;
+
+/**
+ * Utility class for matching model elements and stuff
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ *
+ */
+public class ModelUtil {
+
+ /**
+ * Get any declared fileset that matches this path and are registered with the model
+ * @param path
+ * @return
+ */
+ public static IArchiveFileSet[] getMatchingFilesets(final IPath path) {
+ return getMatchingFilesets(null, path);
+ }
+
+ /**
+ * Get any declared filesets that match this path and are
+ * a child of the given node
+ * @param node
+ * @param path
+ * @return
+ */
+ public static IArchiveFileSet[] getMatchingFilesets(IArchiveNode node, final IPath path) {
+ final ArrayList rets = new ArrayList();
+ IArchiveNodeVisitor visitor = new IArchiveNodeVisitor() {
+ public boolean visit(IArchiveNode node) {
+ if( node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET &&
+ ((IArchiveFileSet)node).matchesPath(path)) {
+ rets.add((IArchiveFileSet)node);
+ }
+ return true;
+ }
+ };
+
+ if( node == null )
+ ArchivesModel.instance().accept(visitor);
+ else
+ node.accept(visitor);
+
+ return (IArchiveFileSet[]) rets.toArray(new IArchiveFileSet[rets.size()]);
+ }
+
+ /**
+ * Find all filesets that are a child to this node
+ * @param node
+ * @return
+ */
+ public static IArchiveFileSet[] findAllDescendentFilesets(IArchiveNode node) {
+ ArrayList matches = findAllDescendents(node, IArchiveNode.TYPE_ARCHIVE_FILESET);
+ return (IArchiveFileSet[]) matches.toArray(new IArchiveFileSet[matches.size()]);
+ }
+
+ /**
+ * Find all folders that are a child to this node
+ * @param node
+ * @return
+ */
+ public static IArchiveFolder[] findAllDescendentFolders(IArchiveNode node) {
+ ArrayList matches = findAllDescendents(node, IArchiveNode.TYPE_ARCHIVE_FOLDER);
+ return (IArchiveFolder[]) matches.toArray(new IArchiveFolder[matches.size()]);
+ }
+
+ /**
+ * Find all nodes of one type that are a child to this one
+ * @param node
+ * @return
+ */
+ public static ArrayList findAllDescendents(IArchiveNode node, final int type) {
+ final ArrayList matches = new ArrayList();
+ if( node.getNodeType() == type && !matches.contains(node) )
+ matches.add(node);
+
+ node.accept(new IArchiveNodeVisitor() {
+ public boolean visit(IArchiveNode node) {
+ if( node.getNodeType() == type && !matches.contains(node))
+ matches.add(node);
+ return true;
+ }
+ });
+ return matches;
+ }
+
+
+ /**
+ * Do any filesets other than the parameter match this path?
+ * @param fileset
+ * @param path
+ * @return
+ */
+ public static boolean otherFilesetMatchesPath(IArchiveFileSet fileset, IPath path) {
+ IArchiveFileSet[] filesets = ModelUtil.getMatchingFilesets(path);
+ if( filesets.length == 0 || (filesets.length == 1 && Arrays.asList(filesets).contains(fileset))) {
+ return false;
+ } else {
+ // other filesets DO match... but are they at the same location in the archive?
+ for( int i = 0; i < filesets.length; i++ ) {
+ if( fileset.equals(filesets[i])) continue;
+ if( fileset.getRootArchiveRelativePath(path).equals(filesets[i].getRootArchiveRelativePath(path))) {
+ // the two put the file in the same spot! It's a match!
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Get the raw file for this node, specifically,
+ * the file actually saved as an OS file.
+ * @param node
+ * @return
+ */
+ public static IPath getBaseFile(IArchiveNode node) {
+ return getBaseFile(node, null);
+ }
+
+ /**
+ * Get the raw file for this node, specifically,
+ * the file actually saved as an OS file.
+ * @param node
+ * @return
+ */
+ public static IPath getBaseFile(IArchiveNode node, IPath absolutePath) {
+ ArrayList list = new ArrayList();
+ while( node != null && !(node instanceof ArchiveModelNode)) {
+ list.add(node);
+ node = node.getParent();
+ }
+ Collections.reverse(list);
+ IArchiveNode[] nodes = (IArchiveNode[]) list.toArray(new IArchiveNode[list.size()]);
+
+ IPath lastConcrete = null;
+ for( int i = 0; i < nodes.length; i++ ) {
+ if( nodes[i] instanceof IArchive) {
+ if( lastConcrete == null )
+ lastConcrete = ((IArchive)nodes[i]).getArchiveFilePath();
+ else
+ lastConcrete = lastConcrete.append(((IArchive)nodes[i]).getName());
+
+ if( !((IArchive)nodes[i]).isExploded())
+ return lastConcrete;
+ } else if( nodes[i] instanceof IArchiveFolder ) {
+ lastConcrete = lastConcrete.append(((IArchiveFolder)nodes[i]).getName());
+ }
+ }
+
+ if( absolutePath != null && node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET ) {
+ IArchiveFileSet fs = ((IArchiveFileSet)node);
+ if( fs.getSourcePath().isPrefixOf(absolutePath)) {
+ lastConcrete.append(absolutePath.removeFirstSegments(fs.getSourcePath().segmentCount()));
+ }
+ }
+ return lastConcrete;
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,233 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.util.internal;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.IPath;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
+
+import de.schlichtherle.io.ArchiveDetector;
+import de.schlichtherle.io.File;
+
+/**
+ * This class is meant to bridge between the model
+ * and the raw true-zip utility class. It is a higher level
+ * API which deals with filesets and packages instead of
+ * raw Strings and paths.
+ *
+ * It will also make sure that a de.schlichtherle.io.File is
+ * created with the proper ArchiveDetector for each and every
+ * level, rather than the TrueZipUtil class, which not accurately
+ * create the proper File type for exploded archives.
+ *
+ * @author rstryker
+ *
+ */
+public class ModelTruezipBridge {
+ public static void deleteArchive(IArchive archive) {
+ final File file = getFile(archive);
+ file.deleteAll();
+ TrueZipUtil.sync();
+ }
+
+ public static void cleanFolder(IArchiveFolder folder) {
+ cleanFolder(folder, true);
+ }
+
+ public static void cleanFolder(IArchiveFolder folder, boolean sync) {
+ final File file = getFile(folder);
+ TrueZipUtil.deleteEmptyFolders(file);
+ if( sync )
+ TrueZipUtil.sync();
+ }
+
+ public static void fullFilesetBuild(IArchiveFileSet fileset) {
+ fullFilesetBuild(fileset, true);
+ }
+ public static void fullFilesetBuild(final IArchiveFileSet fileset, boolean sync) {
+ IPath[] paths = fileset.findMatchingPaths();
+ copyFiles(fileset, paths, false);
+ if( sync )
+ TrueZipUtil.sync();
+ }
+
+ public static void fullFilesetsRemove(IArchiveFileSet[] filesets, boolean sync) {
+ for( int i = 0; i < filesets.length; i++ )
+ fullFilesetRemove(filesets[i], false);
+ if( sync )
+ TrueZipUtil.sync();
+ }
+
+
+ // Let them know which files were removed, for events
+ public static IPath[] fullFilesetRemove(final IArchiveFileSet fileset, boolean sync) {
+ IPath[] paths = fileset.findMatchingPaths();
+ ArrayList list = new ArrayList();
+ list.addAll(Arrays.asList(paths));
+ for( int i = 0; i < paths.length; i++ ) {
+ if( !ModelUtil.otherFilesetMatchesPath(fileset, paths[i])) {
+ // remove
+ deleteFiles(fileset, new IPath[] {paths[i]}, false);
+ } else {
+ list.remove(paths[i]);
+ }
+ }
+
+ if( sync )
+ TrueZipUtil.sync();
+
+ return (IPath[]) list.toArray(new IPath[list.size()]);
+ }
+
+
+ public static void copyFiles(IArchiveFileSet[] filesets, IPath[] paths) {
+ copyFiles(filesets, paths, true);
+ }
+
+ public static void copyFiles(final IArchiveFileSet[] filesets, final IPath[] paths, boolean sync) {
+ for( int i = 0; i < filesets.length; i++ ) {
+ copyFiles(filesets[i], paths, false);
+ }
+ if( sync )
+ TrueZipUtil.sync();
+
+ }
+
+ public static void copyFiles(IArchiveFileSet fileset, final IPath[] paths) {
+ copyFiles(fileset, paths, true);
+ }
+ public static void copyFiles(IArchiveFileSet fileset, final IPath[] paths, boolean sync) {
+ final File[] destFiles = getFiles(paths, fileset);
+ for( int i = 0; i < paths.length; i++ ) {
+ TrueZipUtil.copyFile(paths[i].toOSString(), destFiles[i]);
+ }
+ if( sync )
+ TrueZipUtil.sync();
+ }
+
+
+ /*
+ * Deleting files
+ */
+ public static void deleteFiles(IArchiveFileSet[] filesets, IPath[] paths ) {
+ deleteFiles(filesets, paths, true);
+ }
+ public static void deleteFiles(final IArchiveFileSet[] filesets, final IPath[] paths, boolean sync ) {
+ for( int i = 0; i < filesets.length; i++ ) {
+ deleteFiles(filesets[i], paths, false);
+ }
+ if( sync )
+ TrueZipUtil.sync();
+ }
+
+ public static void deleteFiles(IArchiveFileSet fileset, final IPath[] paths ) {
+ deleteFiles(fileset, paths, true);
+ }
+ public static void deleteFiles(IArchiveFileSet fileset, final IPath[] paths, boolean sync ) {
+ final File[] destFiles = getFiles(paths, fileset);
+ for( int i = 0; i < paths.length; i++ ) {
+ TrueZipUtil.deleteAll(destFiles[i]);
+ }
+
+ if( sync )
+ TrueZipUtil.sync();
+ }
+
+
+ /**
+ * Creates the file, folder, or archive represented by the node.
+ * Does nothing for filesets
+ * @param node
+ */
+ public static void createFile(final IArchiveNode node) {
+ createFile(node, true);
+ }
+ public static void createFile(final IArchiveNode node, boolean sync) {
+ File f = getFile(node);
+ if( f != null ) {
+ f.mkdirs();
+ }
+ if( sync )
+ TrueZipUtil.sync();
+ }
+
+
+
+ /**
+ * Gets all properly-created de.sch files for a fileset
+ * @param inputFiles
+ * @param fs
+ * @return
+ */
+ private static File[] getFiles(IPath[] inputFiles, IArchiveFileSet fs ) {
+ String filesetRelative;
+ File fsFile = getFile(fs);
+ File[] returnFiles = new File[inputFiles.length];
+ int fsLength = fs.getGlobalSourcePath().toOSString().length()+1;
+ for( int i = 0; i < inputFiles.length; i++ ) {
+ filesetRelative = inputFiles[i].toOSString().substring(fsLength);
+ returnFiles[i] = new File(fsFile, filesetRelative, ArchiveDetector.NULL);
+ }
+ return returnFiles;
+ }
+
+
+ /**
+ * This should go through the tree and create a file that is
+ * correctly perceived at each step of the way.
+ *
+ * To just create a new File would let the Archive Detector have too
+ * much control, and *ALL* war's and jars, including exploded ones,
+ * would be treated as archives instead of folders.
+ * @param node
+ * @return
+ */
+ private static File getFile(IArchiveNode node) {
+ if( node == null ) return null;
+
+ if( node.getNodeType() == IArchiveNode.TYPE_MODEL ) return null;
+
+ if( node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET)
+ return getFile(node.getParent());
+
+ File parentFile = getFile(node.getParent());
+ if( node.getNodeType() == IArchiveNode.TYPE_ARCHIVE ) {
+ IArchive node2 = ((IArchive)node);
+ boolean exploded = ((IArchive)node).isExploded();
+ ArchiveDetector detector = exploded ? ArchiveDetector.NULL : ArchiveDetector.DEFAULT;
+ if( parentFile == null )
+ return new File(node2.getDestinationPath().append(node2.getName()).toOSString(), detector);
+ return new File(parentFile, node2.getName(), detector);
+ }
+ if( node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER ) {
+ return new File(parentFile, ((IArchiveFolder)node).getName(), ArchiveDetector.NULL);
+ }
+ return null;
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/TrueZipUtil.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/TrueZipUtil.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/TrueZipUtil.java 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,172 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.util.internal;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.eclipse.core.runtime.IPath;
+
+import de.schlichtherle.io.ArchiveDetector;
+import de.schlichtherle.io.ArchiveException;
+
+/**
+ * Accesses raw files with the truezip filesystem
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ *
+ */
+public class TrueZipUtil {
+
+ public static de.schlichtherle.io.File getFile(IPath path) {
+ return getFile(path, ArchiveDetector.DEFAULT);
+ }
+ public static de.schlichtherle.io.File getFile(IPath path, ArchiveDetector detector) {
+ return new de.schlichtherle.io.File(path.toOSString(), detector);
+ }
+
+ public static boolean pathExists(IPath path) {
+ return pathExists( getFile(path));
+ }
+ public static boolean pathExists( de.schlichtherle.io.File file) {
+ return file.exists();
+ }
+
+
+ public static long getTimestamp(IPath path) {
+ return getTimestamp( getFile(path));
+ }
+
+ public static long getTimestamp(de.schlichtherle.io.File file) {
+ return file.lastModified();
+ }
+
+
+ public static void copyFile(String source, IPath dest) throws IOException {
+ copyFile(source, getFile(dest));
+ }
+
+ public static void copyFile(String source, de.schlichtherle.io.File file) {
+ try {
+ // make parent folders
+ if( !file.getParentFile().exists() )
+ file.getParentFile().mkdirs();
+
+ de.schlichtherle.io.FileOutputStream fos = new de.schlichtherle.io.FileOutputStream(file);
+ java.io.FileInputStream fis = new java.io.FileInputStream(source);
+
+ byte[] buf = new byte[1024];
+ int i = 0;
+ while((i=fis.read(buf))!=-1) {
+ fos.write(buf, 0, i);
+ }
+ fis.close();
+ fos.close();
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ updateParentTimestamps(file);
+ }
+
+ public static void touchFile(IPath path) {
+ de.schlichtherle.io.File f = getFile(path);
+ f.setLastModified(System.currentTimeMillis());
+ updateParentTimestamps(path);
+ }
+
+
+ // Delete methods
+ public static void deleteAll(IPath path, String fileName) {
+ deleteAll(path.append(fileName));
+ }
+ public static void deleteAll(IPath path) {
+ deleteAll(getFile(path));
+ }
+ public static void deleteAll(de.schlichtherle.io.File file) {
+ file.deleteAll();
+ }
+
+ public static void deleteEmptyFolders(java.io.File file ) {
+ if( file.isDirectory() ) {
+ java.io.File[] children = file.listFiles();
+ for( int i = 0; i < children.length; i++ )
+ deleteEmptyFolders(children[i]);
+ if( file.listFiles().length == 0 )
+ file.delete();
+ }
+ }
+
+
+ public static void createFolder(IPath parent, String folderName) {
+ createFolder(parent.append(folderName));
+ }
+ public static void createFolder(IPath path) {
+ getFile(path, ArchiveDetector.NULL).mkdirs();
+ updateParentTimestamps(path);
+ }
+ public static void createArchive(IPath parent, String folderName) {
+ createArchive(parent.append(folderName));
+ }
+ public static void createArchive(IPath path) {
+ getFile(path).mkdirs();
+ updateParentTimestamps(path);
+ }
+ public static void umount() {
+ try {
+ de.schlichtherle.io.File.umount();
+ } catch( ArchiveException ae ) {
+ }
+ }
+
+ /**
+ * Sync's with file system after executing a runnable
+ * @param run Runnable or null
+ */
+ public static void syncExec(Runnable run) {
+ try {
+ if( run != null )
+ run.run();
+ } catch (Exception e ) {}
+ umount();
+ }
+
+ public static void sync() {
+ syncExec(null);
+ }
+
+ public static void updateParentTimestamps(IPath path) {
+ updateParentTimestamps(getFile(path));
+ }
+ public static void updateParentTimestamps(de.schlichtherle.io.File file) {
+ long time = System.currentTimeMillis();
+ de.schlichtherle.io.File parent = file.getEnclArchive();
+ while( parent != null ) {
+ parent.setLastModified(time);
+ parent = parent.getEnclArchive();
+ }
+
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/xml/packages.xsd
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/xml/packages.xsd (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/xml/packages.xsd 2007-05-21 19:51:45 UTC (rev 2037)
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<xsd:schema xmlns:jbxb="http://www.jboss.org/xml/ns/jbxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="packages" type="packages-type"/>
+
+ <xsd:complexType name="packages-type">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="package" type="package-type"/>
+ <xsd:element maxOccurs="1" minOccurs="0" name="properties" type="properties-type"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="package-type">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class
+ impl="org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage" />
+ <jbxb:addMethod name="addChild" />
+ </xsd:appinfo>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" minOccurs="0"
+ name="package" type="package-type" />
+ <xsd:element maxOccurs="unbounded" minOccurs="0"
+ name="fileset" type="fileset-type" />
+ <xsd:element maxOccurs="unbounded" minOccurs="0"
+ name="folder" type="folder-type" />
+ <xsd:element maxOccurs="1" minOccurs="0" name="properties"
+ type="properties-type" />
+ </xsd:sequence>
+
+ <xsd:attribute name="name" type="xsd:string" use="optional" />
+ <xsd:attribute name="type" type="xsd:string" use="optional">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:property name="packageType" />
+ </xsd:appinfo>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="todir" type="xsd:string" use="optional">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:property name="toDir" />
+ </xsd:appinfo>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute default="false" name="exploded"
+ type="xsd:boolean" use="optional" />
+ <xsd:attribute name="inWorkspace" type="xsd:boolean" use="optional" default="true"></xsd:attribute>
+ <xsd:attribute name="id" type="xsd:string" use="optional" />
+ </xsd:complexType>
+
+ <xsd:complexType name="properties-type">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.ide.eclipse.archives.core.model.internal.xb.XbProperties"/>
+ <jbxb:addMethod name="setProperties"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" minOccurs="1" name="property" type="property-type"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="property-type">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.ide.eclipse.archives.core.model.internal.xb.XbProperty"/>
+ <jbxb:addMethod name="addProperty"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="value" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="folder-type">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFolder"/>
+ <jbxb:addMethod name="addChild"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="package" type="package-type"/>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="fileset" type="fileset-type"/>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="folder" type="folder-type"/>
+ <xsd:element maxOccurs="1" minOccurs="0" name="properties" type="properties-type"/>
+ </xsd:sequence>
+
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="fileset-type">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet"/>
+ <jbxb:addMethod name="addChild"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element maxOccurs="1" minOccurs="0" name="properties" type="properties-type"/>
+ </xsd:sequence>
+
+ <xsd:attribute name="dir" type="xsd:string" use="required"/>
+ <xsd:attribute name="includes" type="xsd:string" use="required"/>
+ <xsd:attribute name="excludes" type="xsd:string" use="optional"/>
+ <xsd:attribute name="inWorkspace" type="xsd:boolean" use="optional" default="true"/>
+ </xsd:complexType>
+
+</xsd:schema>
17 years, 7 months
JBoss Tools SVN: r2036 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.ui: META-INF and 19 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-21 15:50:52 -0400 (Mon, 21 May 2007)
New Revision: 2036
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/MANIFEST.MF
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/build.properties
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/Thumbs.db
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/build_packages.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/collapseall.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/ear-wiz-banner.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/excludes.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/ext_file_obj.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/ext_folder_obj.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/includes.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/jar_exploded_obj.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/jar_obj.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/jar_src_obj.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/multiple_files.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/new_jar_wiz.png
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/new_package.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/new_war_wiz.png
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/prop_ps.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/single_file.gif
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/schema/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/schema/newArchiveActions.exsd
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/schema/nodePopupMenus.exsd
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesSharedImages.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ExtensionManager.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/NodeContribution.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/PackagesUIPlugin.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/PrefsInitializer.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/ActionWithDelegate.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/BuildProjectAction.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/INodeActionDelegate.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/NewArchiveAction.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/NewJARAction.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/dialogs/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/dialogs/ArchiveNodeDestinationDialog.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/preferences/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/preferences/MainPreferencePage.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProvider.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/DestinationChangeListener.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveDestinationComposite.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveNodeDestinationComposite.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/FilesetPreviewComposite.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesMenuHandler.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesView.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/AbstractArchiveWizard.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/FilesetWizard.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/NewJARWizard.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/WizardPageWithNotification.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/WizardWithNotification.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/DefaultJARConfigWizardPage.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/.classpath
Log:
project rebuilt
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/.classpath
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/.classpath 2007-05-21 19:48:12 UTC (rev 2035)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/.classpath 2007-05-21 19:50:52 UTC (rev 2036)
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="src" path="src/main"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/MANIFEST.MF 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Ui Plug-in
+Bundle-SymbolicName: org.jboss.ide.eclipse.archives.ui;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.ide.eclipse.archives.ui.PackagesUIPlugin
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.ide.eclipse.archives.core,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide
+Eclipse-LazyStart: true
+Export-Package: org.jboss.ide.eclipse.archives.ui,
+ org.jboss.ide.eclipse.archives.ui.actions,
+ org.jboss.ide.eclipse.archives.ui.dialogs,
+ org.jboss.ide.eclipse.archives.ui.preferences,
+ org.jboss.ide.eclipse.archives.ui.providers,
+ org.jboss.ide.eclipse.archives.ui.util,
+ org.jboss.ide.eclipse.archives.ui.util.composites,
+ org.jboss.ide.eclipse.archives.ui.views,
+ org.jboss.ide.eclipse.archives.ui.wizards,
+ org.jboss.ide.eclipse.archives.ui.wizards.pages
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/build.properties
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/build.properties (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/build.properties 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/Thumbs.db
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/Thumbs.db
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/build_packages.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/build_packages.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/collapseall.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/collapseall.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/ear-wiz-banner.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/ear-wiz-banner.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/excludes.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/excludes.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/ext_file_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/ext_file_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/ext_folder_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/ext_folder_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/includes.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/includes.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/jar_exploded_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/jar_exploded_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/jar_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/jar_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/jar_src_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/jar_src_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/multiple_files.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/multiple_files.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/new_jar_wiz.png
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/new_jar_wiz.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/new_package.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/new_package.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/new_war_wiz.png
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/new_war_wiz.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/prop_ps.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/prop_ps.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/single_file.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/single_file.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="nodePopupMenus" name="Popup Menus for IPackageNodes" schema="schema/nodePopupMenus.exsd"/>
+ <extension-point id="newArchiveActions" name="Actions to create new Package types" schema="schema/newArchiveActions.exsd"/>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ category="org.jboss.ide.eclipse.ui.views"
+ class="org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesView"
+ icon="icons/jar_obj.gif"
+ id="org.jboss.ide.eclipse.archives.ui.ProjectArchivesView"
+ name="Project archives"/>
+ </extension>
+
+ <extension
+ point="org.jboss.ide.eclipse.archives.ui.newArchiveActions">
+ <newPackageAction
+ class="org.jboss.ide.eclipse.archives.ui.actions.NewJARAction"
+ icon="icons/new_package.gif"
+ id="org.jboss.ide.eclipse.archives.ui.newJARAction"
+ label="JAR"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ id="org.jboss.ide.eclipse.archives.ui.actions.Archives"
+ label="Archives"
+ visible="true">
+ <action
+ class="org.jboss.ide.eclipse.archives.ui.actions.BuildProjectAction"
+ definitionId="org.jboss.ide.eclipse.packages.ui.actions.BuildArchivesAction"
+ icon="icons/build_packages.gif"
+ id="org.jboss.ide.eclipse.archives.ui.actions.BuildArchivesAction"
+ label="Build Packages"
+ menubarPath="project/additions"
+ style="push">
+ <enablement>
+ <and>
+ <objectState
+ name="projectNature"
+ value="org.jboss.ide.eclipse.archives.core.archivesNature"/>
+ </and>
+ </enablement>
+ </action>
+ </actionSet>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.jboss.ide.eclipse.ui.MainPreferencePage"
+ class="org.jboss.ide.eclipse.archives.ui.preferences.MainPreferencePage"
+ id="org.jboss.ide.eclipse.archives.ui.archivesPreferencePage"
+ name="Packaging Archives"/>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ class="org.jboss.ide.eclipse.archives.ui.preferences.MainPreferencePage"
+ id="org.jboss.ide.eclipse.archives.ui.projectProperties"
+ name="Packaging Archives"
+ objectClass="org.eclipse.core.resources.IProject"/>
+ <page
+ class="org.jboss.ide.eclipse.archives.ui.preferences.MainPreferencePage"
+ id="org.jboss.ide.eclipse.archives.ui.projectProperties2"
+ name="Packaging Archives"
+ objectClass="org.eclipse.jdt.core.IJavaProject"/>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.jboss.ide.eclipse.archives.ui.PrefsInitializer"/>
+ </extension>
+
+</plugin>
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/schema/newArchiveActions.exsd
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/schema/newArchiveActions.exsd (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/schema/newArchiveActions.exsd 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,137 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.ide.eclipse.archives.ui">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.ide.eclipse.archives.ui" id="newPackageActions" name="Actions to create new Package types"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element ref="newPackageAction"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="newPackageAction">
+ <annotation>
+ <appInfo>
+ <meta.element labelAttribute="label" icon="icon"/>
+ </appInfo>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.ui.IActionDelegate"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="icon" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/schema/nodePopupMenus.exsd
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/schema/nodePopupMenus.exsd (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/schema/nodePopupMenus.exsd 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,144 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.ide.eclipse.archives.ui">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.ide.eclipse.archives.ui" id="nodePopupMenus" name="Popup Menus for IPackageNodes"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element ref="nodeContribution"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="nodeContribution">
+ <annotation>
+ <appInfo>
+ <meta.element labelAttribute="label" icon="icon"/>
+ </appInfo>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.jboss.ide.eclipse.archives.ui.actions.INodeActionDelegate"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="icon" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="weight" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesSharedImages.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesSharedImages.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesSharedImages.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,54 @@
+package org.jboss.ide.eclipse.archives.ui;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+public class ArchivesSharedImages {
+ // image ids
+ public static final String IMG_PACKAGE = "icons/jar_obj.gif";
+ public static final String IMG_PACKAGE_EXPLODED = "icons/jar_exploded_obj.gif";
+ public static final String IMG_EXTERNAL_FILE = "icons/ext_file_obj.gif";
+ public static final String IMG_EXTERNAL_FOLDER = "icons/ext_folder_obj.gif";
+ public static final String IMG_INCLUDES = "icons/includes.gif";
+ public static final String IMG_EXCLUDES = "icons/excludes.gif";
+ public static final String IMG_NEW_PACKAGE = "icons/new_package.gif";
+ public static final String IMG_NEW_JAR_WIZARD = "icons/new_jar_wiz.png";
+ public static final String IMG_SINGLE_FILE = "icons/single_file.gif";
+ public static final String IMG_MULTIPLE_FILES = "icons/multiple_files.gif";
+ public static final String IMG_COLLAPSE_ALL = "icons/collapseall.gif";
+ public static final String IMG_PACKAGE_EDIT = "icons/jar_src_obj.gif";
+ public static final String IMG_WAR = "icons/war.gif";
+ public static final String IMG_EAR = "icons/ear.gif";
+ public static final String IMG_EJB_JAR = "icons/EJBJar.gif";
+ public static final String IMG_NEW_WAR_WIZARD="icons/new_war_wiz.png";
+ public static final String IMG_NEW_EAR_WIZARD="icons/ear-wiz-banner.gif";
+ public static final String IMG_BUILD_PACKAGES = "icons/build_packages.gif";
+
+ public static void register(ImageRegistry registry) {
+ registerImages(registry, new String[] {
+ IMG_PACKAGE, IMG_PACKAGE_EXPLODED, IMG_EXTERNAL_FILE,
+ IMG_EXTERNAL_FOLDER, IMG_INCLUDES, IMG_EXCLUDES,
+ IMG_NEW_PACKAGE, IMG_NEW_JAR_WIZARD, IMG_SINGLE_FILE,
+ IMG_MULTIPLE_FILES, IMG_COLLAPSE_ALL, IMG_PACKAGE_EDIT,
+ IMG_EAR, IMG_EJB_JAR, IMG_WAR, IMG_NEW_EAR_WIZARD,
+ IMG_NEW_WAR_WIZARD, IMG_BUILD_PACKAGES
+ });
+ }
+
+ private static void registerImages (ImageRegistry reg, String ids[]) {
+ for (int i = 0; i < ids.length; i++)
+ reg.put(ids[i], AbstractUIPlugin.imageDescriptorFromPlugin(PackagesUIPlugin.PLUGIN_ID, ids[i]));
+ }
+
+ // helper methods
+ public static Image getImage (String id) {
+ return PackagesUIPlugin.getDefault().getImageRegistry().get(id);
+ }
+
+ public static ImageDescriptor getImageDescriptor (String id) {
+ return PackagesUIPlugin.getDefault().getImageRegistry().getDescriptor(id);
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,90 @@
+package org.jboss.ide.eclipse.archives.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ArchivesUIMessages extends NLS {
+ public static final String BUNDLE_NAME = "org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages";
+
+ public static String NewJARWizard_windowTitle;
+ public static String NewJARWizard_windowTitle_editJAR;
+
+ public static String PackageInfoWizardPage_compressedButton_label;
+ public static String PackageInfoWizardPage_destination_label;
+ public static String PackageInfoWizardPage_error_noPackageName;
+ public static String PackageInfoWizardPage_error_packageAlreadyExists;
+ public static String PackageInfoWizardPage_error_noDestination;
+ public static String PackageInfoWizardPage_explodedButton_label;
+ public static String PackageInfoWizardPage_infoGroup_label;
+ public static String PackageInfoWizardPage_manifestBrowseButton_label;
+ public static String PackageInfoWizardPage_message;
+ public static String PackageInfoWizardPage_packageName_label;
+ public static String PackageInfoWizardPage_packageTypeGroup_label;
+ public static String PackageInfoWizardPage_title;
+
+ public static String PackageNodeDestinationComposite_destinationBrowseButton_label;
+
+ public static String PackageDestinationComposite_filesystemBrowseButton_label;
+ public static String PackageDestinationComposite_workspaceBrowseButton_label;
+
+ public static String PackageNodeDestinationDialog_filesetLabel;
+ public static String PackageNodeDestinationDialog_folderLabel;
+ public static String PackageNodeDestinationDialog_messagePrefix;
+ public static String PackageNodeDestinationDialog_packageLabel;
+ public static String PackageNodeDestinationDialog_title;
+
+ public static String PackagesLabelProvider_filesetProperty_destination;
+ public static String PackagesLabelProvider_filesetProperty_dir;
+ public static String PackagesLabelProvider_filesetProperty_excludes;
+ public static String PackagesLabelProvider_filesetProperty_file;
+ public static String PackagesLabelProvider_filesetProperty_includes;
+ public static String PackagesLabelProvider_filesetProperty_project;
+ public static String PackagesLabelProvider_filesetProperty_sourceFolder;
+
+ public static String ProjectPackagesView_noProjectSelectedMessage;
+ public static String ProjectPackagesView_noPackagesDefinedMessage;
+ public static String ProjectPackagesView_createPackagesMessage;
+ public static String ProjectPackagesView_newFolderAction_label;
+ public static String ProjectPackagesView_newFilesetAction_label;
+ public static String ProjectPackagesView_collapseAllAction_label;
+ public static String ProjectPackagesView_deletePackageAction_label;
+ public static String ProjectPackagesView_editPackageAction_label;
+ public static String ProjectPackagesView_newPackageMenu_label;
+ public static String ProjectPackagesView_editFolderAction_label;
+ public static String ProjectPackagesView_deleteFolderAction_label;
+ public static String ProjectPackagesView_editFilesetAction_label;
+ public static String ProjectPackagesView_deleteFilesetAction_label;
+ public static String ProjectPackagesView_buildArchiveAction_label;
+ public static String ProjectPackagesView_buildProjectAction_label;
+
+ public static String ProjectPackagesView_createFolderDialog_title;
+ public static String ProjectPackagesView_createFolderDialog_message;
+ public static String ProjectPackagesView_createFolderDialog_warnFolderExists;
+
+ public static String FilesetInfoWizardPage_new_message;
+ public static String FilesetInfoWizardPage_new_title;
+ public static String FilesetInfoWizardPage_edit_message;
+ public static String FilesetInfoWizardPage_edit_title;
+ public static String FilesetInfoWizardPage_infoGroup_title;
+ public static String FilesetInfoWizardPage_destination_label;
+ public static String FilesetInfoWizardPage_multipleFilesButton_label;
+ public static String FilesetInfoWizardPage_singleFileButton_label;
+ public static String FilesetInfoWizardPage_rootProject_label;
+ public static String FilesetInfoWizardPage_rootDirectory_label;
+ public static String FilesetInfoWizardPage_rootDirWorkspaceBrowseButton_label;
+ public static String FilesetInfoWizardPage_rootDirFilesystemBrowseButton_label;
+ public static String FilesetInfoWizardPage_includes_label;
+ public static String FilesetInfoWizardPage_excludes_label;
+ public static String FilesetInfoWizardPage_singleFileProject_label;
+ public static String FilesetInfoWizardPage_singleFile_label;
+ public static String FilesetInfoWizardPage_fileWorkspaceBrowseButton_label;
+ public static String FilesetInfoWizardPage_fileFilesystemBrowseButton_label;
+ public static String FilesetInfoWizardPage_previewGroup_label;
+ public static String FilesetInfoWizardPage_noProjectMessage;
+ public static String FilesetInfoWizardPage_rootDirWorkspaceBrowser_message;
+ public static String FilesetInfoWizardPage_fileWorkspaceBrowser_title;
+ public static String FilesetInfoWizardPage_fileWorkspaceBrowser_message;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, ArchivesUIMessages.class);
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,78 @@
+ProjectPackagesView_noProjectSelectedMessage=Please select a project or resource
+ProjectPackagesView_noPackagesDefinedMessage=No archives have been defined for the project "{0}".
+ProjectPackagesView_createPackagesMessage=Project has no defined archives. Create an Archive:
+ProjectPackagesView_newPackageMenu_label=New Archive
+ProjectPackagesView_newFolderAction_label=New Folder
+ProjectPackagesView_newFilesetAction_label=New Fileset
+ProjectPackagesView_collapseAllAction_label=Collapse All
+ProjectPackagesView_deletePackageAction_label=Delete Archive
+ProjectPackagesView_deleteFilesetAction_label=Delete Fileset
+ProjectPackagesView_deleteFolderAction_label=Delete Folder
+ProjectPackagesView_editPackageAction_label=Edit Archive
+ProjectPackagesView_editFolderAction_label=Edit Folder
+ProjectPackagesView_editFilesetAction_label=Edit Fileset
+ProjectPackagesView_buildArchiveAction_label=Build Archive
+ProjectPackagesView_buildProjectAction_label=Build Project
+ProjectPackagesView_createFolderDialog_title=Create a folder
+ProjectPackagesView_createFolderDialog_message=Name of the folder to create
+ProjectPackagesView_createFolderDialog_warnFolderExists=The folder "{0}" already exists.
+
+FilesetInfoWizardPage_new_message=Create a new fileset consisting of one or more files
+FilesetInfoWizardPage_new_title=New Fileset
+FilesetInfoWizardPage_edit_message=Edit an existing fileset
+FilesetInfoWizardPage_edit_title=Edit Fileset
+FilesetInfoWizardPage_infoGroup_title=Fileset information
+FilesetInfoWizardPage_destination_label=Destination:
+FilesetInfoWizardPage_multipleFilesButton_label=Create a fileset that has multiple files
+FilesetInfoWizardPage_singleFileButton_label=Create a fileset that has just one file
+FilesetInfoWizardPage_rootProject_label=Root project:
+FilesetInfoWizardPage_rootDirectory_label=Root directory:
+FilesetInfoWizardPage_rootDirWorkspaceBrowseButton_label=Workspace...
+FilesetInfoWizardPage_rootDirFilesystemBrowseButton_label=Filesystem...
+FilesetInfoWizardPage_includes_label=Includes:
+FilesetInfoWizardPage_excludes_label=Excludes:
+FilesetInfoWizardPage_singleFileProject_label=Project:
+FilesetInfoWizardPage_singleFile_label=File:
+FilesetInfoWizardPage_fileWorkspaceBrowseButton_label=Workspace...
+FilesetInfoWizardPage_fileFilesystemBrowseButton_label=Filesystem...
+FilesetInfoWizardPage_previewGroup_label=Preview
+FilesetInfoWizardPage_noProjectMessage=N/A
+FilesetInfoWizardPage_rootDirWorkspaceBrowser_message=Select a root directory for this fileset
+FilesetInfoWizardPage_fileWorkspaceBrowser_title=Select file
+FilesetInfoWizardPage_fileWorkspaceBrowser_message=Select a file for this fileset
+
+PackageInfoWizardPage_title=Create a new archive
+PackageInfoWizardPage_message=Create a new archive consisting of filesets in the workspace.
+PackageInfoWizardPage_infoGroup_label=Archive information
+PackageInfoWizardPage_packageName_label=Archive name:
+PackageInfoWizardPage_destination_label=Destination:
+PackageInfoWizardPage_manifestBrowseButton_label=Browse...
+PackageInfoWizardPage_packageTypeGroup_label=Archive type
+PackageInfoWizardPage_compressedButton_label=Standard archive using zip compression
+PackageInfoWizardPage_explodedButton_label=Exploded archive resulting in a folder (no compression)
+PackageInfoWizardPage_error_noPackageName=Please enter a archive name
+PackageInfoWizardPage_error_packageAlreadyExists=The archive "{0}" already exists.
+PackageInfoWizardPage_error_noDestination=There is no destination selected for this archive.
+
+PackageNodeDestinationComposite_destinationBrowseButton_label=Browse...
+
+PackageDestinationComposite_filesystemBrowseButton_label=Filesystem...
+PackageDestinationComposite_workspaceBrowseButton_label=Workspace...
+
+NewJARWizard_windowTitle=New JAR
+NewJARWizard_windowTitle_editJAR=Edit Archive
+
+PackagesLabelProvider_filesetProperty_destination=Destination :
+PackagesLabelProvider_filesetProperty_sourceFolder=Source Folder :
+PackagesLabelProvider_filesetProperty_excludes=Excludes :
+PackagesLabelProvider_filesetProperty_includes=Includes :
+PackagesLabelProvider_filesetProperty_project=Project :
+PackagesLabelProvider_filesetProperty_file=File :
+
+PackagesLabelProvider_filesetProperty_dir=Dir :
+
+PackageNodeDestinationDialog_messagePrefix=Please select a destination for this
+PackageNodeDestinationDialog_packageLabel=archive
+PackageNodeDestinationDialog_filesetLabel=fileset
+PackageNodeDestinationDialog_folderLabel=folder
+PackageNodeDestinationDialog_title=Select a destination
\ No newline at end of file
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ExtensionManager.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ExtensionManager.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ExtensionManager.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,64 @@
+package org.jboss.ide.eclipse.archives.ui;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.ide.eclipse.archives.ui.actions.NewArchiveAction;
+
+public class ExtensionManager {
+ public static final String NODE_POPUP_MENUS_EXTENSION_ID = "org.jboss.ide.eclipse.archives.ui.nodePopupMenus";
+ public static final String NEW_PACKAGE_ACTIONS_EXTENSION_ID = "org.jboss.ide.eclipse.archives.ui.newArchiveActions";
+
+ private NewArchiveAction[] newArchiveActions;
+ private NodeContribution[] nodeContributions;
+ public NewArchiveAction[] getNewArchiveActions() {
+ if( newArchiveActions == null )
+ newArchiveActions = findNewArchiveActions();
+ return newArchiveActions;
+ }
+ public NodeContribution[] getNodeContributions() {
+ if( nodeContributions == null )
+ nodeContributions = findNodePopupMenuContributions();
+ return nodeContributions;
+ }
+
+ public static IExtension[] findExtension (String extensionId) {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = registry.getExtensionPoint(extensionId);
+ return extensionPoint.getExtensions();
+ }
+
+ public static NodeContribution[] findNodePopupMenuContributions () {
+ ArrayList contributions = new ArrayList();
+ IExtension[] extensions = findExtension(NODE_POPUP_MENUS_EXTENSION_ID);
+
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement[] elements = extensions[i].getConfigurationElements();
+ for (int j = 0; j < elements.length; j++) {
+ contributions.add(new NodeContribution(elements[j]));
+ }
+ }
+
+ return (NodeContribution[]) contributions.toArray(new NodeContribution[contributions.size()]);
+ }
+
+ public static NewArchiveAction[] findNewArchiveActions () {
+ ArrayList contributions = new ArrayList();
+ IExtension[] extensions = findExtension(NEW_PACKAGE_ACTIONS_EXTENSION_ID);
+
+ for (int i = 0; i < extensions.length; i++)
+ {
+ IConfigurationElement[] elements = extensions[i].getConfigurationElements();
+ for (int j = 0; j < elements.length; j++)
+ {
+ contributions.add(new NewArchiveAction(elements[j]));
+ }
+ }
+
+ return (NewArchiveAction[]) contributions.toArray(new NewArchiveAction[contributions.size()]);
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/NodeContribution.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/NodeContribution.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/NodeContribution.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,75 @@
+package org.jboss.ide.eclipse.archives.ui;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.jboss.ide.eclipse.archives.core.Trace;
+import org.jboss.ide.eclipse.archives.ui.actions.INodeActionDelegate;
+import org.osgi.framework.Bundle;
+
+public class NodeContribution implements Comparable {
+ private String id, label;
+ private INodeActionDelegate actionDelegate;
+ private ImageDescriptor icon;
+ private int weight;
+
+ public NodeContribution (IConfigurationElement element) {
+ id = element.getAttribute("id");
+ label = element.getAttribute("label");
+
+ try {
+ actionDelegate = (INodeActionDelegate) element.createExecutableExtension("class");
+ } catch (CoreException e) {
+ Trace.trace(getClass(), e);
+ }
+
+ String iconPath = element.getAttribute("icon");
+ String pluginId = element.getDeclaringExtension().getNamespaceIdentifier();
+ Bundle bundle = Platform.getBundle(pluginId);
+ URL iconURL = FileLocator.find(bundle, new Path(iconPath), null);
+ if (iconURL == null) {
+ iconURL = bundle.getEntry(iconPath);
+ }
+ icon = ImageDescriptor.createFromURL(iconURL);
+
+ weight = Integer.parseInt(element.getAttribute("weight"));
+ }
+
+ public int compareTo(Object o) {
+ if (o instanceof NodeContribution) {
+ NodeContribution other = (NodeContribution) o;
+ if (weight < other.getWeight()) return -1;
+ else if (weight > other.getWeight()) return 1;
+ else if (weight == other.getWeight()) {
+ return label.compareTo(other.getLabel());
+ }
+ }
+ return -1;
+ }
+
+
+ public INodeActionDelegate getActionDelegate() {
+ return actionDelegate;
+ }
+
+ public ImageDescriptor getIcon() {
+ return icon;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/PackagesUIPlugin.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/PackagesUIPlugin.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/PackagesUIPlugin.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,58 @@
+package org.jboss.ide.eclipse.archives.ui;
+
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class PackagesUIPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.archives.ui";
+
+
+
+ // The shared instance
+ private static PackagesUIPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public PackagesUIPlugin() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static PackagesUIPlugin getDefault() {
+ return plugin;
+ }
+
+
+
+ protected void initializeImageRegistry(ImageRegistry registry) {
+ ArchivesSharedImages.register(registry);
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/PrefsInitializer.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/PrefsInitializer.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/PrefsInitializer.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,104 @@
+package org.jboss.ide.eclipse.archives.ui;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+
+public class PrefsInitializer extends AbstractPreferenceInitializer {
+
+
+ // preference keys
+ public static final String PREF_SHOW_PACKAGE_OUTPUT_PATH = "showPackageOutputPath";
+ public static final String PREF_SHOW_FULL_FILESET_ROOT_DIR = "showFullFilesetRootDir";
+ public static final String PREF_SHOW_PROJECT_ROOT = "showProjectRoot";
+ public static final String PREF_SHOW_ALL_PROJECTS = "showAllProjects";
+
+ public void initializeDefaultPreferences() {
+ IEclipsePreferences prefs = new DefaultScope().getNode(PackagesUIPlugin.PLUGIN_ID);
+ prefs.putBoolean(PREF_SHOW_FULL_FILESET_ROOT_DIR, true);
+ prefs.putBoolean(PREF_SHOW_PACKAGE_OUTPUT_PATH, true);
+ prefs.putBoolean(PREF_SHOW_PROJECT_ROOT, true);
+ prefs.putBoolean(PREF_SHOW_ALL_PROJECTS, false);
+ try {
+ prefs.flush();
+ } catch (org.osgi.service.prefs.BackingStoreException e) {
+ e.printStackTrace();
+ } // swallow
+ }
+
+ public static void setBoolean(String key, boolean val) {
+ setBoolean(key, val, null);
+ }
+
+ public static void setBoolean(String key, boolean val, IAdaptable adaptable) {
+ QualifiedName name = new QualifiedName(PackagesUIPlugin.PLUGIN_ID, key);
+ if( adaptable != null ) {
+ IResource project = (IResource)adaptable.getAdapter(IResource.class);
+ try {
+ if( project != null && project.getPersistentProperty(name) != null) {
+ project.setPersistentProperty(name, new Boolean(val).toString());
+ return;
+ }
+ } catch(CoreException ce) {}
+ }
+ IEclipsePreferences prefs = new InstanceScope().getNode(PackagesUIPlugin.PLUGIN_ID);
+ prefs.putBoolean(key, val);
+ try {
+ prefs.flush();
+ } catch (org.osgi.service.prefs.BackingStoreException e) { } // swallow
+
+ }
+
+ /**
+ * Get the global pref value for this key
+ * @param key
+ * @return
+ */
+ public static boolean getBoolean(String key) {
+ return getBoolean(key, null, true);
+ }
+
+ /**
+ * Get the *effective* value of this preference upon this adaptable / resource
+ * Effective values are the stored value if project-specific prefs are turned on.
+ * Effective values are the global value if project-specific prefs are *NOT* turned on.
+ *
+ * @param key
+ * @param adaptable
+ * @return
+ */
+// public static boolean getBoolean(String key, IAdaptable adaptable) {
+// return getBoolean(key, adaptable, true);
+// }
+
+ /**
+ *
+ * @param key the preference to be gotten
+ * @param adaptable the project / resource where the pref might be stored
+ * @param effective whether or not to get the raw pref value or the effective value
+ * (based on whether project specific prefs are turned on)
+ * @return
+ */
+ public static boolean getBoolean(String key, IAdaptable adaptable, boolean effective) {
+ QualifiedName name = new QualifiedName(PackagesUIPlugin.PLUGIN_ID, key);
+ if( adaptable != null ) {
+ IResource project = (IResource)adaptable.getAdapter(IResource.class);
+ boolean specific = ArchivesCore.getInstance().getPreferenceManager().areProjectSpecificPrefsEnabled(project.getLocation());
+ //if( adaptable != null && WorkspacePreferenceManager.areProjectSpecificPrefsEnabled(project.getLocation())) {
+ if( specific ) {
+ try {
+ if( project != null && project.getPersistentProperty(name) != null) {
+ return Boolean.parseBoolean(project.getPersistentProperty(name));
+ }
+ } catch(CoreException ce) {}
+ }
+ }
+ return new InstanceScope().getNode(PackagesUIPlugin.PLUGIN_ID).getBoolean(key, false);
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/ActionWithDelegate.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/ActionWithDelegate.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/ActionWithDelegate.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,47 @@
+package org.jboss.ide.eclipse.archives.ui.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IActionDelegate;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+
+public abstract class ActionWithDelegate extends Action implements IActionDelegate, ISelectionListener {
+
+/*
+ * Constructors
+ */
+ public ActionWithDelegate () {
+ }
+
+ public ActionWithDelegate(String text) {
+ super(text);
+ }
+
+ public ActionWithDelegate(String text, ImageDescriptor image) {
+ super(text, image);
+ }
+
+ public ActionWithDelegate(String text, int style) {
+ super(text, style);
+ }
+
+
+
+ public abstract void run ();
+
+ public void run(IAction action) {
+ run();
+ }
+
+ public abstract IStructuredSelection getSelection();
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ }
+
+}
\ No newline at end of file
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/BuildProjectAction.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/BuildProjectAction.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/BuildProjectAction.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,40 @@
+package org.jboss.ide.eclipse.archives.ui.actions;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.jboss.ide.eclipse.archives.core.build.ArchiveBuildDelegate;
+
+public class BuildProjectAction implements IWorkbenchWindowActionDelegate {
+ private IProject selectedProject;
+ public void dispose() {
+ }
+
+ public void init(IWorkbenchWindow window) {
+ }
+
+ public void run(IAction action) {
+ if( selectedProject != null )
+ new ArchiveBuildDelegate().fullProjectBuild(selectedProject.getLocation());
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ if( !selection.isEmpty() && selection instanceof IStructuredSelection ) {
+ Object o = ((IStructuredSelection)selection).getFirstElement();
+ if( o instanceof IAdaptable ) {
+ IResource res = (IResource) ((IAdaptable)o).getAdapter(IResource.class);
+ if( res != null ) {
+ selectedProject = res.getProject();
+ return;
+ }
+ }
+ }
+ selectedProject = null;
+ }
+
+}
\ No newline at end of file
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/INodeActionDelegate.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/INodeActionDelegate.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/INodeActionDelegate.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,24 @@
+package org.jboss.ide.eclipse.archives.ui.actions;
+
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+
+/**
+ * All extensions of org.jboss.ide.eclipse.archives.ui.nodePopupMenus should implement this interface
+ * (also see AbstractNodeActionDelegate)
+ * @author Marshall
+ *
+ */
+public interface INodeActionDelegate {
+
+ /**
+ * @param node
+ * @return Whether or not this action delegate will be enabled (viewable) for a specific package node.
+ */
+ public boolean isEnabledFor (IArchiveNode node);
+
+ /**
+ * Run this action delegate on the passed-in node
+ * @param node A package node
+ */
+ public void run (IArchiveNode node);
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/NewArchiveAction.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/NewArchiveAction.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/NewArchiveAction.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,73 @@
+package org.jboss.ide.eclipse.archives.ui.actions;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IActionDelegate;
+import org.jboss.ide.eclipse.archives.core.Trace;
+import org.osgi.framework.Bundle;
+
+/**
+ * This is an action wrapper. It wraps the extension point
+ */
+public class NewArchiveAction {
+
+ private String id, label;
+ private ImageDescriptor icon;
+ private Image iconImage;
+ private IActionDelegate action;
+
+ public NewArchiveAction(IConfigurationElement element) {
+ id = element.getAttribute("id");
+ label = element.getAttribute("label");
+
+ try {
+ action = (IActionDelegate) element.createExecutableExtension("class");
+ } catch (CoreException e) {
+ Trace.trace(getClass(), e);
+ }
+
+ String iconPath = element.getAttribute("icon");
+ String pluginId = element.getDeclaringExtension().getNamespaceIdentifier();
+ Bundle bundle = Platform.getBundle(pluginId);
+ URL iconURL = FileLocator.find(bundle, new Path(iconPath), null);
+ if (iconURL == null)
+ {
+ iconURL = bundle.getEntry(iconPath);
+ }
+ icon = ImageDescriptor.createFromURL(iconURL);
+ iconImage = icon.createImage();
+ }
+
+ public IActionDelegate getAction() {
+ return action;
+ }
+
+ public ImageDescriptor getIconDescriptor() {
+ return icon;
+ }
+
+ public Image getIcon()
+ {
+ return iconImage;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ protected void finalize() throws Throwable {
+ iconImage.dispose();
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/NewJARAction.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/NewJARAction.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/NewJARAction.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,42 @@
+package org.jboss.ide.eclipse.archives.ui.actions;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
+import org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesView;
+import org.jboss.ide.eclipse.archives.ui.wizards.NewJARWizard;
+
+public class NewJARAction extends ActionWithDelegate {
+ public void run() {
+ try {
+ NewJARWizard wizard = new NewJARWizard();
+
+ wizard.init(PlatformUI.getWorkbench(), getSelection());
+
+ WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
+ int response = dialog.open();
+ if (response == Dialog.OK) {
+ }
+ } catch( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ public IStructuredSelection getSelection() {
+ return ProjectArchivesView.getInstance().getSelection();
+ }
+ public ImageDescriptor getImageDescriptor() {
+ return ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_NEW_PACKAGE);
+ }
+
+ public String getText() {
+ return "JAR";
+ }
+
+ public String getToolTipText() {
+ return "Create a new JAR package";
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/dialogs/ArchiveNodeDestinationDialog.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/dialogs/ArchiveNodeDestinationDialog.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/dialogs/ArchiveNodeDestinationDialog.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,166 @@
+package org.jboss.ide.eclipse.archives.ui.dialogs;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.ide.IDE;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+import org.jboss.ide.eclipse.archives.ui.providers.ArchivesLabelProvider;
+
+public class ArchiveNodeDestinationDialog extends ElementTreeSelectionDialog {
+
+ private boolean showWorkspace, showNodes;
+
+ public ArchiveNodeDestinationDialog(Shell parent, Object destination, boolean showWorkspace, boolean showNodes) {
+ super(parent, new DestinationLabelProvider(), new DestinationContentProvider());
+ setAllowMultiple(false);
+ setTitle(ArchivesUIMessages.PackageNodeDestinationDialog_title);
+
+ this.showWorkspace = showWorkspace;
+ this.showNodes = showNodes;
+ setupDestinationList();
+ }
+
+ private void setupDestinationList () {
+ ArrayList destinations = new ArrayList();
+
+ if (showWorkspace) {
+ destinations.addAll(Arrays.asList(ResourcesPlugin.getWorkspace().getRoot().getProjects()));
+ }
+
+ IProgressMonitor monitor = new NullProgressMonitor();
+
+ if( showNodes ) {
+ // add ALL packages from ALL projects
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for( int i = 0; i < projects.length; i++ ) {
+ if( projects[i].isAccessible()) {
+ destinations.addAll(Arrays.asList(
+ ArchivesModel.instance().getProjectArchives(projects[i].getLocation(), true, monitor)));
+ }
+ }
+ }
+
+ setInput(destinations);
+ }
+
+ private static class DestinationContentProvider implements ITreeContentProvider {
+ private static final Object[] NO_CHILDREN = new Object[0];
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IArchiveNode) {
+ IArchiveNode node = (IArchiveNode) parentElement;
+ List children = new ArrayList(Arrays.asList(node.getAllChildren()));
+ for (Iterator iter = children.iterator(); iter.hasNext(); ) {
+ IArchiveNode child = (IArchiveNode) iter.next();
+ if (child.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET)
+ iter.remove();
+ }
+ return children.toArray();
+ } else if (parentElement instanceof IContainer) {
+ IContainer container = (IContainer) parentElement;
+ try {
+ IResource members[] = container.members();
+ List folders = new ArrayList();
+ for (int i = 0; i < members.length; i++) {
+ if (members[i].getType() == IResource.FOLDER) folders.add(members[i]);
+ }
+
+ return folders.toArray();
+ } catch (CoreException e) {
+ // swallow
+ }
+ }
+ return NO_CHILDREN;
+ }
+
+ public Object getParent(Object element) {
+ if (element instanceof IArchiveNode) {
+ IArchiveNode node = (IArchiveNode) element;
+ return node.getParent();
+ } else if (element instanceof IContainer) {
+ IContainer container = (IContainer) element;
+ return container.getParent();
+ }
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof Collection)
+ return ((Collection)inputElement).toArray();
+
+ return NO_CHILDREN;
+ }
+
+ public void dispose() {}
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+ }
+
+ private static class DestinationLabelProvider implements ILabelProvider {
+ private ArchivesLabelProvider delegate;
+
+ public DestinationLabelProvider () {
+ delegate = new ArchivesLabelProvider();
+ }
+
+ public Image getImage(Object element) {
+ if (element instanceof IArchiveNode) {
+ return delegate.getImage(element);
+ } else if (element instanceof IProject) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT);
+ } else if (element instanceof IFolder) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
+ }
+ return null;
+ }
+
+ public String getText(Object element) {
+ if (element instanceof IArchiveNode) {
+ return delegate.getText(element);
+ } else if (element instanceof IContainer) {
+ return ((IContainer)element).getName();
+ }
+ return "";
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return true;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/preferences/MainPreferencePage.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/preferences/MainPreferencePage.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/preferences/MainPreferencePage.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,175 @@
+package org.jboss.ide.eclipse.archives.ui.preferences;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.other.IPreferenceManager;
+import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
+import org.jboss.ide.eclipse.archives.ui.PrefsInitializer;
+import org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesView;
+
+public class MainPreferencePage extends PropertyPage implements
+ IWorkbenchPreferencePage {
+
+ private Button showPackageOutputPath, showFullFilesetRootDir;
+ private Button showProjectRoot, showAllProjects;
+ private Button automaticBuilder, overrideButton;
+ private Group corePrefGroup, viewPrefGroup;
+ private Composite overrideComp;
+
+
+ public MainPreferencePage() {
+ super();
+ setTitle("Packaging Archives");
+ setImageDescriptor(ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_PACKAGE));
+ }
+
+ protected Control createContents(Composite parent) {
+ Composite main = new Composite(parent, SWT.NONE);
+ main.setLayout(new GridLayout(1, false));
+
+ createOverridePrefs(main);
+ createCorePrefs(main);
+ createViewPrefs(main);
+ fillValues();
+ return main;
+ }
+
+ public IPath getElementTwo() {
+ IAdaptable el = getElement();
+ return el == null ? null :
+ ((IResource)el.getAdapter(IResource.class)).getLocation();
+ }
+
+ public IPreferenceManager getPrefManager() {
+ return ArchivesCore.getInstance().getPreferenceManager();
+ }
+ protected void fillValues() {
+ if( getElementTwo() != null ) {
+ overrideButton.setSelection(getPrefManager().areProjectSpecificPrefsEnabled(getElementTwo()));
+ }
+ automaticBuilder.setSelection(getPrefManager().isBuilderEnabled(getElementTwo()));
+ showAllProjects.setSelection(
+ PrefsInitializer.getBoolean(PrefsInitializer.PREF_SHOW_ALL_PROJECTS, getElement(), false));
+ showPackageOutputPath.setSelection(
+ PrefsInitializer.getBoolean(PrefsInitializer.PREF_SHOW_PACKAGE_OUTPUT_PATH, getElement(), false));
+ showFullFilesetRootDir.setSelection(
+ PrefsInitializer.getBoolean(PrefsInitializer.PREF_SHOW_FULL_FILESET_ROOT_DIR, getElement(), false));
+ showProjectRoot.setSelection(
+ PrefsInitializer.getBoolean(PrefsInitializer.PREF_SHOW_PROJECT_ROOT, getElement(), false));
+
+ showAllProjects.setEnabled(showProjectRoot.getSelection());
+ if (!showProjectRoot.getSelection())
+ showAllProjects.setSelection(false);
+
+ if( getElement() != null ) {
+ setWidgetsEnabled(overrideButton.getSelection());
+ }
+ }
+
+ protected void createOverridePrefs(Composite main) {
+ if( getElementTwo() != null ) {
+ overrideComp = new Composite(main, SWT.NONE);
+ overrideComp.setLayout(new FillLayout());
+ overrideButton = new Button(overrideComp, SWT.CHECK);
+ overrideButton.setText("Enable Project Specific Settings");
+
+ overrideButton.addSelectionListener(new SelectionListener(){
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ public void widgetSelected(SelectionEvent e) {
+ setWidgetsEnabled(overrideButton.getSelection());
+ }
+ });
+ }
+ }
+
+ protected void setWidgetsEnabled(boolean val) {
+ showPackageOutputPath.setEnabled(val);
+ showProjectRoot.setEnabled(val);
+ showFullFilesetRootDir.setEnabled(val);
+ if( showProjectRoot.getSelection())
+ showAllProjects.setEnabled(val);
+ automaticBuilder.setEnabled(val);
+ }
+
+ protected void createCorePrefs(Composite main) {
+ corePrefGroup = new Group(main, SWT.NONE);
+ corePrefGroup.setText("Core Preferences");
+ corePrefGroup.setLayout(new GridLayout(1, false));
+ corePrefGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ automaticBuilder = new Button(corePrefGroup, SWT.CHECK);
+ automaticBuilder.setText("Enable incremental builder");
+ }
+
+ protected void createViewPrefs(Composite main) {
+
+ viewPrefGroup = new Group(main, SWT.NONE);
+ viewPrefGroup.setText("Project Packages View");
+ viewPrefGroup.setLayout(new GridLayout(1, false));
+ viewPrefGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ showPackageOutputPath = new Button(viewPrefGroup, SWT.CHECK);
+ showPackageOutputPath.setText("Show full output path next to packages.");
+
+ showFullFilesetRootDir = new Button(viewPrefGroup, SWT.CHECK);
+ showFullFilesetRootDir.setText("Show the full root directory of filesets.");
+
+ showProjectRoot = new Button(viewPrefGroup, SWT.CHECK);
+ showProjectRoot.setText("Show project at the root");
+
+ showProjectRoot.addSelectionListener(new SelectionListener () {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ public void widgetSelected(SelectionEvent e) {
+ showAllProjects.setEnabled(showProjectRoot.getSelection());
+
+ if (!showProjectRoot.getSelection())
+ {
+ showAllProjects.setSelection(false);
+ }
+ }
+ });
+
+ showAllProjects = new Button(viewPrefGroup, SWT.CHECK);
+ showAllProjects.setText("Show all projects that contain packages");
+ showAllProjects.setEnabled(showProjectRoot.getSelection());
+ if( !showProjectRoot.getSelection() )
+ showAllProjects.setSelection(false);
+
+ }
+
+ public void init(IWorkbench workbench) {
+ }
+
+ public boolean performOk() {
+ if( getElementTwo() != null ) {
+ getPrefManager().setProjectSpecificPrefsEnabled(getElementTwo(), overrideButton.getSelection());
+ }
+ getPrefManager().setBuilderEnabled(getElementTwo(), automaticBuilder.getSelection());
+ PrefsInitializer.setBoolean(PrefsInitializer.PREF_SHOW_PACKAGE_OUTPUT_PATH, showPackageOutputPath.getSelection(), getElement());
+ PrefsInitializer.setBoolean(PrefsInitializer.PREF_SHOW_FULL_FILESET_ROOT_DIR, showFullFilesetRootDir.getSelection(), getElement());
+ PrefsInitializer.setBoolean(PrefsInitializer.PREF_SHOW_PROJECT_ROOT, showProjectRoot.getSelection(), getElement());
+ PrefsInitializer.setBoolean(PrefsInitializer.PREF_SHOW_ALL_PROJECTS, showAllProjects.getSelection(), getElement());
+ ProjectArchivesView.getInstance().refreshViewer(null);
+
+ return true;
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProvider.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProvider.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProvider.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,86 @@
+package org.jboss.ide.eclipse.archives.ui.providers;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.ui.PrefsInitializer;
+import org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesView;
+
+public class ArchivesContentProvider implements ITreeContentProvider {
+
+ public ArchivesContentProvider () {
+ }
+
+ public static class WrappedProject {
+ private IProject project;
+ public WrappedProject (IProject proj) { project = proj; }
+ public IProject getProject() { return project; }
+ }
+
+ private boolean showProjectRoot () {
+ return PrefsInitializer.getBoolean(PrefsInitializer.PREF_SHOW_PROJECT_ROOT);
+ }
+
+ private Object[] wrapProjects(IProject[] project) {
+ Object[] ret = new Object[project.length];
+ for( int i = 0; i < project.length; i++ )
+ ret[i] = new WrappedProject(project[i]);
+ return ret;
+ }
+ public Object[] getChildren(Object parentElement) {
+
+ if( parentElement instanceof Object[] ) return (Object[])parentElement;
+
+
+ if( parentElement instanceof IArchiveModelNode && showProjectRoot()) {
+ IProject[] projects;
+ if( PrefsInitializer.getBoolean(PrefsInitializer.PREF_SHOW_ALL_PROJECTS)) {
+ projects = ProjectArchivesView.getInstance().getAllProjectsWithPackages();
+ } else {
+ String projName = ((IArchiveModelNode)parentElement).getProjectPath().lastSegment();
+ projects = new IProject[] { ResourcesPlugin.getWorkspace().getRoot().getProject(projName) };
+ }
+ return wrapProjects(projects);
+ }
+
+ if( parentElement instanceof IArchiveModelNode)
+ return ((IArchiveModelNode)parentElement).getAllChildren();
+
+ if( parentElement instanceof ArchivesModel ) {
+ // return all that's there
+ }
+ if( parentElement instanceof WrappedProject ) {
+ return ArchivesModel.instance().getProjectArchives(((WrappedProject)parentElement).getProject().getLocation());
+ }
+ if( parentElement instanceof IArchiveNode ) {
+ return ((IArchiveNode)parentElement).getAllChildren();
+ }
+ return new Object[] {};
+ }
+
+ public Object getParent(Object element) {
+ if( element instanceof IArchiveNode )
+ return ((IArchiveNode)element).getParent();
+ if( element instanceof WrappedProject )
+ return ArchivesModel.instance().getRoot(((WrappedProject)element).getProject().getLocation());
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ public void dispose() {}
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,130 @@
+package org.jboss.ide.eclipse.archives.ui.providers;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
+import org.jboss.ide.eclipse.archives.ui.PrefsInitializer;
+import org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProvider.WrappedProject;
+
+public class ArchivesLabelProvider implements ILabelProvider {
+
+
+ /*
+ * Important snippets to save
+ * image = PlatformUI.getWorkbench().getDecoratorManager().decorateImage(image, element);
+ * text = PlatformUI.getWorkbench().getDecoratorManager().decorateText(text, element);
+ */
+
+ public Image getImage(Object element) {
+ Image image = internalGetImage(element);
+
+ if (image != null) {
+ image = PlatformUI.getWorkbench().getDecoratorManager().decorateImage(image, element);
+ }
+
+ return image;
+ }
+
+ public String getText(Object element) {
+ String text = internalGetText(element);
+
+ if (text != null) {
+ text = PlatformUI.getWorkbench().getDecoratorManager().decorateText(text, element);
+ }
+ return text;
+ }
+
+ private Image internalGetImage(Object element) {
+ element = unwrapElement(element);
+ if( element instanceof WrappedProject )
+ return PlatformUI.getWorkbench().getSharedImages().getImage(org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT);
+ if( element instanceof IArchiveNode ) {
+ IArchiveNode node = (IArchiveNode) element;
+ if (node != null) {
+ switch (node.getNodeType()) {
+ case IArchiveNode.TYPE_ARCHIVE: {
+ IArchive pkg = (IArchive) node;
+ if (!pkg.isExploded())
+ return ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_PACKAGE);
+ else
+ return ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_PACKAGE_EXPLODED);
+ }
+ case IArchiveNode.TYPE_ARCHIVE_FOLDER: return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
+ case IArchiveNode.TYPE_ARCHIVE_FILESET: {
+ return ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_MULTIPLE_FILES);
+ }
+ }
+ }
+
+ }
+ return null;
+ }
+
+ private String internalGetText(Object element) {
+ element = unwrapElement(element);
+ if( element instanceof WrappedProject)
+ return ((WrappedProject)element).getProject().getName();
+ if( element instanceof IArchiveNode ) {
+ switch (((IArchiveNode)element).getNodeType()) {
+ case IArchiveNode.TYPE_ARCHIVE: return getPackageText((IArchive)element);
+ case IArchiveNode.TYPE_ARCHIVE_FOLDER: return getPackageFolderText((IArchiveFolder)element);
+ case IArchiveNode.TYPE_ARCHIVE_FILESET: return getPackageFileSetText((IArchiveFileSet)element);
+ }
+
+ }
+ return element.toString();
+ }
+
+
+ private String getPackageFolderText (IArchiveFolder folder) {
+ return folder.getName();
+ }
+ private String getPackageText (IArchive pkg) {
+ String text = pkg.getName();
+ if (PrefsInitializer.getBoolean( PrefsInitializer.PREF_SHOW_PACKAGE_OUTPUT_PATH)) {
+ text += " [" + pkg.getDestinationPath() + "]";
+ }
+ return text;
+ }
+
+ private String getPackageFileSetText (IArchiveFileSet fileset) {
+ boolean showFullPath = PrefsInitializer.getBoolean(
+ PrefsInitializer.PREF_SHOW_FULL_FILESET_ROOT_DIR);
+ String text = "";
+ if (fileset.getIncludesPattern() != null)
+ text += fileset.getIncludesPattern() + ": ";
+
+ if (showFullPath) {
+ text += fileset.getGlobalSourcePath().toString();
+ } else {
+ text += fileset.getGlobalSourcePath().lastSegment();
+ }
+
+ return text;
+ }
+
+
+
+ protected Object unwrapElement(Object element) {
+ return element; // to be used if we wrap everything for preferences
+ }
+
+
+ public void addListener(ILabelProviderListener listener) {}
+
+ public void dispose() { }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return true;
+ }
+
+ public void removeListener(ILabelProviderListener listener) { }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/DestinationChangeListener.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/DestinationChangeListener.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/DestinationChangeListener.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,7 @@
+package org.jboss.ide.eclipse.archives.ui.util;
+
+public interface DestinationChangeListener {
+
+ public void destinationChanged (Object newDestination);
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveDestinationComposite.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveDestinationComposite.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveDestinationComposite.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,92 @@
+package org.jboss.ide.eclipse.archives.ui.util.composites;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
+import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+
+public class ArchiveDestinationComposite extends ArchiveNodeDestinationComposite {
+
+ protected boolean inWorkspace;
+ protected Button filesystemBrowseButton, workspaceBrowseButton;
+
+ public ArchiveDestinationComposite (Composite parent, int style, Object destination) {
+ super(parent, style, destination);
+ }
+
+// public PackageDestinationComposite (Composite parent, int style, GridData textLayoutData, GridData buttonLayoutData, Object destination)
+// {
+// super (parent, style, textLayoutData, buttonLayoutData, destination);
+// }
+//
+ protected void fillBrowseComposite(Composite parent) {
+ Composite browseComposite = new Composite(parent, SWT.NONE);
+ browseComposite.setLayout(new GridLayout(2, false));
+
+ workspaceBrowseButton = new Button(browseComposite, SWT.PUSH);
+ workspaceBrowseButton.setText(ArchivesUIMessages.PackageDestinationComposite_workspaceBrowseButton_label);
+ workspaceBrowseButton.addSelectionListener(new SelectionAdapter () {
+ public void widgetSelected(SelectionEvent e) {
+ openDestinationDialog();
+ }
+ });
+
+ filesystemBrowseButton = new Button(browseComposite, SWT.PUSH);
+ filesystemBrowseButton.setText(ArchivesUIMessages.PackageDestinationComposite_filesystemBrowseButton_label);
+ filesystemBrowseButton.addSelectionListener(new SelectionAdapter () {
+ public void widgetSelected(SelectionEvent e) {
+ browseFilesystem();
+ }
+ });
+ }
+
+ protected void browseFilesystem ()
+ {
+ DirectoryDialog dialog = new DirectoryDialog(getShell());
+ String currentPath = destinationText.getText();
+ if (currentPath != null && currentPath.length() > 0 && !inWorkspace)
+ {
+ dialog.setFilterPath(destinationText.getText());
+ }
+
+ String path = dialog.open();
+ if (path != null)
+ {
+ nodeDestination = new Path(path);
+ updateDestinationViewer();
+ }
+ }
+
+ protected void updateDestinationViewer()
+ {
+ super.updateDestinationViewer();
+
+ if (nodeDestination instanceof IPath)
+ {
+ inWorkspace = false;
+ IPath path = (IPath) nodeDestination;
+ setDestinationText(path.toString());
+ setDestinationImage(ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_EXTERNAL_FILE));
+ }
+ else if (nodeDestination instanceof IContainer || nodeDestination instanceof IArchiveNode)
+ {
+ inWorkspace = true;
+ }
+ }
+
+ public void setEditable(boolean editable) {
+ super.setEditable(editable);
+
+ workspaceBrowseButton.setEnabled(editable);
+ filesystemBrowseButton.setEnabled(editable);
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveNodeDestinationComposite.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveNodeDestinationComposite.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveNodeDestinationComposite.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,219 @@
+package org.jboss.ide.eclipse.archives.ui.util.composites;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
+import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+import org.jboss.ide.eclipse.archives.ui.dialogs.ArchiveNodeDestinationDialog;
+import org.jboss.ide.eclipse.archives.ui.util.DestinationChangeListener;
+
+public class ArchiveNodeDestinationComposite extends Composite {
+
+ protected Composite parent;
+ protected Label destinationImage;
+ protected Text destinationText;
+ protected Button destinationBrowseButton;
+ protected Object nodeDestination;
+ protected boolean editable;
+ protected ArrayList listeners;
+
+ public ArchiveNodeDestinationComposite(Composite parent, int style, Object destination) {
+ super(parent, style);
+ this.parent = parent;
+ this.nodeDestination = destination;
+ this.editable = true;
+ this.listeners = new ArrayList();
+
+ createComposite();
+ }
+
+ protected void createComposite() {
+ setLayout(new FormLayout());
+
+ // create widgets
+ destinationImage = new Label(this, SWT.NONE);
+ destinationText = new Text(this, SWT.BORDER);
+ Composite browseComposite = new Composite(this, SWT.NONE);
+
+ // set up their layout positioning
+ destinationImage.setLayoutData(createFormData(0,5,null, 0, 0, 5, null, 0));
+ destinationText.setLayoutData(createFormData(0, 5, null, 0, destinationImage, 5, browseComposite, -5));
+
+
+ // set text, add listeners, etc
+ destinationText.setEditable(false);
+
+ browseComposite.setLayout(new FillLayout());
+ browseComposite.setLayoutData(createFormData(0,0,null,0,null,0,100,-5));
+ fillBrowseComposite(browseComposite);
+
+ // call other functions required for startup
+ updateDestinationViewer();
+ }
+
+ protected void fillBrowseComposite(Composite browseComposite) {
+ destinationBrowseButton = new Button(browseComposite, SWT.PUSH);
+ destinationBrowseButton.setText(ArchivesUIMessages.PackageNodeDestinationComposite_destinationBrowseButton_label);
+ destinationBrowseButton.addSelectionListener(new SelectionAdapter () {
+ public void widgetSelected(SelectionEvent e) {
+ openDestinationDialog();
+ }
+ });
+ destinationBrowseButton.setEnabled(editable);
+ }
+
+ private FormData createFormData(Object topStart, int topOffset, Object bottomStart, int bottomOffset,
+ Object leftStart, int leftOffset, Object rightStart, int rightOffset) {
+ FormData data = new FormData();
+
+ if( topStart != null ) {
+ data.top = topStart instanceof Control ? new FormAttachment((Control)topStart, topOffset) :
+ new FormAttachment(((Integer)topStart).intValue(), topOffset);
+ }
+
+ if( bottomStart != null ) {
+ data.bottom = bottomStart instanceof Control ? new FormAttachment((Control)bottomStart, bottomOffset) :
+ new FormAttachment(((Integer)bottomStart).intValue(), bottomOffset);
+ }
+
+ if( leftStart != null ) {
+ data.left = leftStart instanceof Control ? new FormAttachment((Control)leftStart, leftOffset) :
+ new FormAttachment(((Integer)leftStart).intValue(), leftOffset);
+ }
+
+ if( rightStart != null ) {
+ data.right = rightStart instanceof Control ? new FormAttachment((Control)rightStart, rightOffset) :
+ new FormAttachment(((Integer)rightStart).intValue(), rightOffset);
+ }
+
+ return data;
+ }
+
+ protected void openDestinationDialog ()
+ {
+ ArchiveNodeDestinationDialog dialog = new ArchiveNodeDestinationDialog(getShell(), nodeDestination, false, true);
+ if (nodeDestination != null)
+ dialog.setInitialSelection(nodeDestination);
+
+ int response = dialog.open();
+ if (response == Dialog.OK)
+ {
+ Object object = dialog.getResult()[0];
+ nodeDestination = object;
+
+ updateDestinationViewer();
+ fireDestinationChanged();
+ }
+ }
+
+ public void setPackageNodeDestination (Object destination)
+ {
+ nodeDestination = destination;
+ updateDestinationViewer();
+ }
+
+ protected void setDestinationImage (Image image)
+ {
+ destinationImage.setImage(image);
+ }
+
+ protected void setDestinationText (String text)
+ {
+ destinationText.setText(text);
+ }
+
+ protected void updateDestinationViewer ()
+ {
+ if (nodeDestination == null) return;
+ destinationText.setText("");
+
+ if (nodeDestination instanceof IArchive)
+ {
+ IArchive pkg = (IArchive) nodeDestination;
+
+ if (pkg.isTopLevel())
+ {
+ setDestinationText(pkg.getName());
+ } else {
+ setDestinationText(pkg.getRootArchiveRelativePath().toOSString());
+ }
+ if (pkg.isExploded()) {
+ setDestinationImage(ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_PACKAGE_EXPLODED));
+ } else {
+ setDestinationImage(ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_PACKAGE));
+ }
+ }
+ else if (nodeDestination instanceof IArchiveFolder)
+ {
+ IArchiveFolder folder = (IArchiveFolder) nodeDestination;
+ setDestinationText(folder.getRootArchiveRelativePath().toString());
+ setDestinationImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
+ }
+ else if (nodeDestination instanceof IProject)
+ {
+ IProject project = (IProject) nodeDestination;
+ setDestinationText(project.getName());
+ setDestinationImage(PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT));
+ }
+ else if (nodeDestination instanceof IFolder)
+ {
+ IFolder folder = (IFolder) nodeDestination;
+ setDestinationText("/" + folder.getProject().getName() + "/" + folder.getProjectRelativePath().toString());
+ setDestinationImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
+ }
+ }
+
+ public Object getPackageNodeDestination ()
+ {
+ return nodeDestination;
+ }
+
+ public void setEditable(boolean editable) {
+ this.editable = editable;
+ if (destinationBrowseButton != null)
+ {
+ destinationBrowseButton.setEnabled(editable);
+ }
+ }
+
+ public void addDestinationChangeListener (DestinationChangeListener listener)
+ {
+ listeners.add(listener);
+ }
+
+ public void removeDestinationChangeListener (DestinationChangeListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ private void fireDestinationChanged ()
+ {
+ for (Iterator iter = listeners.iterator(); iter.hasNext(); )
+ {
+ DestinationChangeListener listener = (DestinationChangeListener) iter.next();
+ listener.destinationChanged(nodeDestination);
+ }
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/FilesetPreviewComposite.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/FilesetPreviewComposite.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/FilesetPreviewComposite.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,116 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.ui.util.composites;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+/**
+ *
+ * @author rob.stryker(a)jboss.com
+ */
+public class FilesetPreviewComposite extends Composite {
+ private TableViewer previewTable;
+ public FilesetPreviewComposite (Composite parent, int style) {
+ super(parent, style);
+ previewTable = new TableViewer(this, SWT.BORDER);
+ previewTable.setContentProvider(new ArrayContentProvider());
+ previewTable.setLabelProvider(new ResourceLabelProvider());
+
+ setLayout(new FormLayout());
+ FormData data = new FormData();
+ data.left = new FormAttachment(0,5);
+ data.right = new FormAttachment(100,-5);
+ data.top = new FormAttachment(0,5);
+ data.bottom = new FormAttachment(100,-5);
+ previewTable.getTable().setLayoutData(data);
+ }
+
+ public FilesetPreviewComposite (Composite parent)
+ {
+ this(parent, SWT.NONE);
+ }
+
+ public void setInput(Object[] o) {
+ previewTable.setInput(o);
+ }
+ public void setEnabled(boolean bool) {
+ previewTable.getTable().setEnabled(bool);
+ }
+ public void clearAll() {
+ previewTable.getTable().clearAll();
+ }
+
+ private class ResourceLabelProvider implements ILabelProvider
+ {
+
+ public Image getImage(Object element) {
+ if (element instanceof IResource)
+ {
+ IResource resource = (IResource) element;
+ if (resource.getType() == IResource.PROJECT)
+ {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT);
+ }
+ else if (resource.getType() == IResource.FOLDER)
+ {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
+ }
+ else if (resource.getType() == IResource.FILE)
+ {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
+ }
+ } else if (element instanceof IPath) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
+ }
+ return null;
+ }
+
+ public String getText(Object element) {
+ return element.toString();
+ }
+
+ public void addListener(ILabelProviderListener listener) {}
+
+ public void dispose() {}
+
+ public boolean isLabelProperty(Object element, String property) {
+ return true;
+ }
+
+ public void removeListener(ILabelProviderListener listener) { }
+
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesMenuHandler.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesMenuHandler.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesMenuHandler.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,390 @@
+package org.jboss.ide.eclipse.archives.ui.views;
+
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.ide.eclipse.archives.core.build.ArchiveBuildDelegate;
+import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
+import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+import org.jboss.ide.eclipse.archives.ui.ExtensionManager;
+import org.jboss.ide.eclipse.archives.ui.NodeContribution;
+import org.jboss.ide.eclipse.archives.ui.actions.ActionWithDelegate;
+import org.jboss.ide.eclipse.archives.ui.actions.NewArchiveAction;
+import org.jboss.ide.eclipse.archives.ui.actions.NewJARAction;
+import org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProvider.WrappedProject;
+import org.jboss.ide.eclipse.archives.ui.wizards.FilesetWizard;
+import org.jboss.ide.eclipse.archives.ui.wizards.NewJARWizard;
+
+/**
+ * Manages the actions associated with the view
+ * @author rstryker
+ *
+ */
+public class ArchivesMenuHandler {
+ public static final String NEW_PACKAGE_MENU_ID = "org.jboss.ide.eclipse.archives.ui.newPackageMenu";
+ public static final String NODE_CONTEXT_MENU_ID = "org.jboss.ide.eclipse.archives.ui.nodeContextMenu";
+ public static final String NEW_PACKAGE_ADDITIONS = "newPackageAdditions";
+
+ private MenuManager newPackageManager, contextMenuManager;
+ private NodeContribution[] nodePopupMenuContributions;
+ private NewArchiveAction[] newPackageActions;
+ private Menu treeContextMenu;
+ private TreeViewer packageTree;
+
+ private Action editAction, deleteAction, newFolderAction, newFilesetAction;
+ private NewJARAction newJARAction;
+ private Action buildAction;
+
+ public ArchivesMenuHandler(TreeViewer viewer) {
+ this.packageTree = viewer;
+
+ // load from extensions
+ newPackageActions = ExtensionManager.findNewArchiveActions();
+ nodePopupMenuContributions = ExtensionManager.findNodePopupMenuContributions();
+ Arrays.sort(nodePopupMenuContributions);
+
+
+ createActions();
+ createMenu();
+ createContextMenu();
+ addToActionBars();
+ }
+
+ private void addToActionBars() {
+ IActionBars bars = getSite().getActionBars();
+ bars.getToolBarManager().add(buildAction);
+ }
+
+ /**
+ * Creates the primary menu as well as adds the package actions to it
+ *
+ */
+ private void createMenu () {
+ newPackageManager = new MenuManager(ArchivesUIMessages.ProjectPackagesView_newPackageMenu_label, NEW_PACKAGE_MENU_ID);
+ addNewPackageActions(newPackageManager);
+ }
+
+ private void createContextMenu () {
+ contextMenuManager = new MenuManager(NODE_CONTEXT_MENU_ID); //$NON-NLS-1$
+ contextMenuManager.setRemoveAllWhenShown(true);
+ contextMenuManager.addMenuListener(new IMenuListener () {
+ public void menuAboutToShow(IMenuManager manager) {
+ IStructuredSelection selection = (IStructuredSelection) packageTree.getSelection();
+ if (selection != null && !selection.isEmpty()) {
+ Object element = selection.getFirstElement();
+
+ if (element instanceof WrappedProject) {
+ newJARAction.setEnabled(true);
+ manager.add(newPackageManager);
+ manager.add(buildAction);
+ buildAction.setText(ArchivesUIMessages.ProjectPackagesView_buildProjectAction_label);
+ } else if( element instanceof IArchiveNode ){
+ IArchiveNode node = (IArchiveNode)element;
+
+ if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE
+ || node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER)
+ {
+ newJARAction.setEnabled(true);
+ manager.add(newPackageManager);
+
+ manager.add(newFolderAction);
+ manager.add(newFilesetAction);
+ manager.add(new Separator());
+ }
+
+ if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE) {
+ editAction.setText(ArchivesUIMessages.ProjectPackagesView_editPackageAction_label); //$NON-NLS-1$
+ deleteAction.setText(ArchivesUIMessages.ProjectPackagesView_deletePackageAction_label); //$NON-NLS-1$
+ editAction.setImageDescriptor(ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_PACKAGE_EDIT));
+ buildAction.setText(ArchivesUIMessages.ProjectPackagesView_buildArchiveAction_label);
+ manager.add(buildAction);
+ } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER) {
+ editAction.setText(ArchivesUIMessages.ProjectPackagesView_editFolderAction_label); //$NON-NLS-1$
+ deleteAction.setText(ArchivesUIMessages.ProjectPackagesView_deleteFolderAction_label); //$NON-NLS-1$
+ editAction.setImageDescriptor(platformDescriptor(ISharedImages.IMG_OBJ_FOLDER));
+ } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET) {
+ editAction.setText(ArchivesUIMessages.ProjectPackagesView_editFilesetAction_label); //$NON-NLS-1$
+ deleteAction.setText(ArchivesUIMessages.ProjectPackagesView_deleteFilesetAction_label); //$NON-NLS-1$
+ editAction.setImageDescriptor(ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_MULTIPLE_FILES));
+ }
+ manager.add(editAction);
+ manager.add(deleteAction);
+ addContextMenuContributions(node);
+ }
+ } else {
+ manager.add(newPackageManager);
+ }
+ }
+ });
+
+ treeContextMenu = contextMenuManager.createContextMenu(packageTree.getTree());
+ packageTree.getTree().setMenu(treeContextMenu);
+
+ getSite().registerContextMenu(NEW_PACKAGE_MENU_ID, newPackageManager, packageTree);
+ }
+
+ protected void createActions() {
+ newJARAction = new NewJARAction();
+ newJARAction.setEnabled(false);
+
+ newFolderAction = new Action(ArchivesUIMessages.ProjectPackagesView_newFolderAction_label, platformDescriptor(ISharedImages.IMG_OBJ_FOLDER)) { //$NON-NLS-1$
+ public void run () {
+ createFolder();
+ }
+ };
+
+ newFilesetAction = new Action(ArchivesUIMessages.ProjectPackagesView_newFilesetAction_label, ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_MULTIPLE_FILES)) { //$NON-NLS-1$
+ public void run () {
+ createFileset();
+ }
+ };
+
+ deleteAction = new Action (ArchivesUIMessages.ProjectPackagesView_deletePackageAction_label, platformDescriptor(ISharedImages.IMG_TOOL_DELETE)) { //$NON-NLS-1$
+ public void run () {
+ deleteSelectedNode();
+ }
+ };
+
+ editAction = new Action (ArchivesUIMessages.ProjectPackagesView_editPackageAction_label, ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_PACKAGE_EDIT)) { //$NON-NLS-1$
+ public void run () {
+ editSelectedNode();
+ }
+ };
+
+ buildAction = new ActionWithDelegate("", ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_BUILD_PACKAGES)) {
+ public void run() {
+ buildSelectedNode();
+ }
+
+ public IStructuredSelection getSelection() {
+ return ProjectArchivesView.getInstance().getSelection();
+ }
+ };
+ }
+
+ private void addContextMenuContributions (final IArchiveNode context) {
+
+ for( int i = 0; i < nodePopupMenuContributions.length; i++ ) {
+ try {
+
+ final NodeContribution contribution = nodePopupMenuContributions[i];
+ if ( contribution.getActionDelegate().isEnabledFor(context)) {
+ Action action = new Action () {
+ public String getId() {
+ return contribution.getId();
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return contribution.getIcon();
+ }
+
+ public String getText() {
+ return contribution.getLabel();
+ }
+
+ public void run() {
+ contribution.getActionDelegate().run(context);
+ }
+ };
+ contextMenuManager.add(action);
+ }
+ } catch( Exception e) { System.out.println(e.getMessage()); }
+ }
+
+ }
+
+
+ /**
+ * Adds the new package type actions (which come from an extension point)
+ * to the menu.
+ * @param manager
+ */
+ private void addNewPackageActions (IMenuManager manager) {
+ for( int i = 0; i < newPackageActions.length; i++ ) {
+ final NewArchiveAction action = newPackageActions[i];
+
+ Action actionWrapper = new Action () {
+ public String getId() {
+ return action.getId();
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return action.getIconDescriptor();
+ }
+
+ public String getText() {
+ return action.getLabel();
+ }
+
+ public void run() {
+ action.getAction().run(this);
+ }
+ };
+
+ manager.add(actionWrapper);
+ }
+ }
+
+
+
+
+ /*
+ * Methods below are called from the standard actions,
+ * the implementations of the action, where the action does its work etc
+ */
+
+ private void createFolder ()
+ {
+ IInputValidator validator = new IInputValidator () {
+ public String isValid(String newText) {
+ IArchiveNode selected = getSelectedNode();
+
+ boolean folderExists = false;
+ IArchiveNode[] folders = selected.getChildren(IArchiveNode.TYPE_ARCHIVE_FOLDER);
+ for (int i = 0; i < folders.length; i++) {
+ IArchiveFolder folder = (IArchiveFolder) folders[i];
+ if (folder.getName().equals(newText)) {
+ folderExists = true; break;
+ }
+ }
+
+ if (folderExists) {
+ return ArchivesUIMessages.bind(
+ ArchivesUIMessages.ProjectPackagesView_createFolderDialog_warnFolderExists, newText);
+
+ }
+ return null;
+ }
+ };
+
+ InputDialog dialog = new InputDialog(getSite().getShell(),
+ ArchivesUIMessages.ProjectPackagesView_createFolderDialog_title,
+ ArchivesUIMessages.ProjectPackagesView_createFolderDialog_message, "", validator);
+
+ int response = dialog.open();
+ if (response == Dialog.OK) {
+ String folderName = dialog.getValue();
+ IArchiveNode selected = getSelectedNode();
+
+ IArchiveFolder folder = ArchiveNodeFactory.createFolder();
+ folder.setName(folderName);
+ ArchivesModel.instance().attach(selected, folder, new NullProgressMonitor());
+ }
+ }
+
+ private void createFileset () {
+ try {
+ IArchiveNode selected = getSelectedNode();
+ WizardDialog dialog = new WizardDialog(getSite().getShell(), new FilesetWizard(null, selected));
+
+ dialog.open();
+ } catch( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ private void editSelectedNode () {
+ IArchiveNode node = getSelectedNode();
+ if (node != null) {
+ if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET) {
+ IArchiveFileSet fileset = (IArchiveFileSet) node;
+ WizardDialog dialog = new WizardDialog(getSite().getShell(), new FilesetWizard(fileset, node.getParent()));
+ try {
+ dialog.open();
+ } catch( Exception e ) { e.printStackTrace(); }
+ } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE) {
+ IArchive pkg = (IArchive) node;
+ WizardDialog dialog = new WizardDialog(getSite().getShell(), new NewJARWizard(pkg));
+ dialog.open();
+ } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER) {
+ // folder can do the model save here.
+ IArchiveFolder folder = (IArchiveFolder) node;
+ InputDialog dialog = new InputDialog(getSite().getShell(),
+ ArchivesUIMessages.ProjectPackagesView_createFolderDialog_title,
+ ArchivesUIMessages.ProjectPackagesView_createFolderDialog_message, folder.getName(), null);
+
+ int response = dialog.open();
+ if (response == Dialog.OK) {
+ folder.setName(dialog.getValue());
+ ArchivesModel.instance().saveModel(folder.getProjectPath(), new NullProgressMonitor());
+ }
+ }
+ }
+ }
+
+ private void buildSelectedNode() {
+ Object selected = getSelectedObject();
+ if( selected == null ) return;
+ if (selected instanceof IArchiveNode &&
+ ((IArchiveNode)selected).getNodeType() == IArchiveNode.TYPE_ARCHIVE) {
+ new ArchiveBuildDelegate().fullArchiveBuild((IArchive)selected);
+ } else if( selected != null && selected instanceof WrappedProject ){
+ new ArchiveBuildDelegate().fullProjectBuild(((WrappedProject)selected).getProject().getLocation());
+ } else {
+ new ArchiveBuildDelegate().fullArchiveBuild(((IArchiveNode)selected).getRootArchive());
+ }
+
+ }
+
+ private void deleteSelectedNode () {
+ IArchiveNode node = getSelectedNode();
+ if (node != null) {
+ IArchiveNode parent = (IArchiveNode) node.getParent();
+ parent.removeChild(node);
+ if( parent.getProjectPath() != null ) {
+ ArchivesModel.instance().saveModel(parent.getProjectPath(), new NullProgressMonitor());
+ }
+ }
+ }
+
+
+
+ /*
+ * Utility methods below
+ */
+
+ private IViewSite getSite() {
+ return (IViewSite) ProjectArchivesView.getInstance().getSite();
+ }
+
+ private IArchiveNode getSelectedNode () {
+ Object selected = getSelectedObject();
+ if( selected instanceof IArchiveNode )
+ return ((IArchiveNode)selected);
+ return null;
+ }
+ private Object getSelectedObject() {
+ IStructuredSelection selection = (IStructuredSelection) ProjectArchivesView.getInstance().getSelection();
+ if (selection != null && !selection.isEmpty())
+ return selection.getFirstElement();
+ return null;
+ }
+
+ private ImageDescriptor platformDescriptor(String desc) {
+ return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(desc);
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesView.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesView.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesView.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,334 @@
+package org.jboss.ide.eclipse.archives.ui.views;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.wizard.ProgressMonitorPart;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.ui.INullSelectionListener;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.PageBook;
+import org.eclipse.ui.part.ViewPart;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModelCore;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
+import org.jboss.ide.eclipse.archives.core.model.other.IArchiveModelListener;
+import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+import org.jboss.ide.eclipse.archives.ui.ExtensionManager;
+import org.jboss.ide.eclipse.archives.ui.PrefsInitializer;
+import org.jboss.ide.eclipse.archives.ui.actions.NewArchiveAction;
+import org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProvider;
+import org.jboss.ide.eclipse.archives.ui.providers.ArchivesLabelProvider;
+
+public class ProjectArchivesView extends ViewPart implements IArchiveModelListener {
+
+ protected static ProjectArchivesView instance;
+ public static ProjectArchivesView getInstance() {
+ return instance;
+ }
+
+
+ protected ISelectionListener selectionListener;
+ public ProjectArchivesView() {
+ instance = this;
+ selectionListener = createSelectionListener();
+ }
+
+ public void init(IViewSite site) throws PartInitException {
+ super.init(site);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().addPostSelectionListener(selectionListener);
+ ArchivesModel.instance().addModelListener(this);
+ }
+
+ public void dispose() {
+ super.dispose();
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().removePostSelectionListener(selectionListener);
+ ArchivesModel.instance().removeModelListener(this);
+ }
+
+
+ protected ISelectionListener createSelectionListener() {
+ return new INullSelectionListener() {
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ if (!(selection instanceof IStructuredSelection))
+ return;
+
+ Object element = ((IStructuredSelection)selection).getFirstElement();
+ IProject project = getProject(element);
+ if( project != null )
+ viewSelectionChanged(project);
+ }
+
+ public IProject getProject (Object element) {
+ if( element instanceof IStructuredSelection)
+ element = ((IStructuredSelection)element).getFirstElement();
+
+ if (element instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable)element;
+ IResource resource = (IResource) adaptable.getAdapter(IResource.class);
+ if( resource != null )
+ return resource.getProject();
+ }
+ return null;
+ }
+
+ };
+ }
+
+
+ // parts
+ private PageBook book;
+ private IProject project;
+ private ArchivesContentProvider contentProvider = new ArchivesContentProvider();
+ private ArchivesLabelProvider labelProvider = new ArchivesLabelProvider();
+ private Composite emptyComposite, viewerComposite, loadingPackagesComposite, noSelectionComposite;
+ private IProgressMonitor loadingProgress;
+ private TreeViewer packageViewer;
+ private ArchivesMenuHandler menuHandler;
+ public void createPartControl(Composite parent) {
+ book = new PageBook(parent, SWT.NONE);
+ addEmptyComposite(book);
+ addLoadingComposite(book);
+ addViewerComposite(book);
+ addNoSelectionComposite(book);
+ book.showPage(noSelectionComposite);
+ menuHandler = new ArchivesMenuHandler(packageViewer);
+ }
+
+ protected void addNoSelectionComposite(PageBook book) {
+ noSelectionComposite = new Composite(book, SWT.NONE);
+ noSelectionComposite.setLayout(new FillLayout());
+ Label label = new Label(noSelectionComposite, SWT.NONE);
+ label.setText(ArchivesUIMessages.ProjectPackagesView_noProjectSelectedMessage);
+ }
+ protected void addEmptyComposite(PageBook book) {
+ emptyComposite = new Composite(book, SWT.NONE);
+ emptyComposite.setLayout(new FormLayout());
+ Label l = new Label(emptyComposite, SWT.NONE);
+ l.setText(ArchivesUIMessages.ProjectPackagesView_createPackagesMessage);
+
+ Composite actionsComposite = new Composite(emptyComposite, SWT.NONE);
+
+
+ FormData lData = new FormData();
+ lData.left = new FormAttachment(0,5);
+ lData.top = new FormAttachment(0,5);
+ l.setLayoutData(lData);
+
+ FormData actionsData = new FormData();
+ actionsData.left = new FormAttachment(0,5);
+ actionsData.top = new FormAttachment(l,5);
+ actionsData.bottom = new FormAttachment(100,-5);
+
+ actionsComposite.setLayoutData(actionsData);
+
+ actionsComposite.setLayout(new GridLayout(1, false));
+ addNewPackageActions(actionsComposite);
+
+ }
+
+
+ private void addNewPackageActions (Composite composite) {
+ NewArchiveAction[] actions = ExtensionManager.findNewArchiveActions();
+ for (int i = 0; i < actions.length; i++) {
+ final NewArchiveAction action = actions[i];
+
+ Composite linkComposite = new Composite(composite, SWT.NONE);
+ linkComposite.setLayout(createGridLayoutWithNoMargins(2));
+ linkComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ new Label(linkComposite, SWT.NONE).setImage(action.getIcon());
+
+ Link actionLink = new Link(linkComposite, SWT.NONE);
+ actionLink.setText("<a href=\"create\">" + action.getLabel() + "</a>");
+ actionLink.addSelectionListener(new SelectionListener () {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ action.getAction().run(null);
+ }
+ });
+ }
+ }
+
+ private GridLayout createGridLayoutWithNoMargins (int columns) {
+ GridLayout layout = new GridLayout(columns, false);
+ layout.marginBottom = layout.marginHeight = layout.marginLeft = 0;
+ layout.marginRight = layout.marginTop = layout.marginWidth = 0;
+
+ return layout;
+ }
+
+ protected void addLoadingComposite(PageBook book) {
+ loadingPackagesComposite = new Composite(book, SWT.NONE);
+ loadingPackagesComposite.setLayout(new RowLayout(SWT.HORIZONTAL));
+ loadingProgress = new ProgressMonitorPart(loadingPackagesComposite, null);
+
+ }
+ protected void addViewerComposite(PageBook book) {
+ viewerComposite = new Composite(book, SWT.NONE);
+ viewerComposite.setLayout(new FillLayout());
+ packageViewer = new TreeViewer(viewerComposite, SWT.NONE);
+ packageViewer.setContentProvider(contentProvider);
+ packageViewer.setLabelProvider(labelProvider);
+ }
+
+
+ public void setFocus() {
+ }
+ public void viewSelectionChanged(IProject project) {
+ if( project == null ) {
+ this.project = null;
+ packageViewer.setInput(null);
+ return;
+ }
+
+ if( project.equals(packageViewer.getInput()))
+ return;
+
+ if( ArchivesModelCore.packageFileExists(project.getLocation()) ) {
+ if( ArchivesModelCore.projectRegistered(project.getLocation()))
+ book.showPage(viewerComposite);
+ else {
+ this.project = project;
+ book.showPage(loadingPackagesComposite);
+ if( PrefsInitializer.getBoolean(PrefsInitializer.PREF_SHOW_ALL_PROJECTS, project, true)) {
+ registerProjects(getAllProjectsWithPackages(), this.project);
+ } else {
+ registerProjects(new IProject[] {this.project}, this.project);
+ }
+ return;
+ }
+ } else {
+ book.showPage(emptyComposite);
+ }
+
+ this.project = project;
+ packageViewer.setInput(ArchivesModel.instance().getRoot(project.getLocation()));
+ }
+
+ public IProject getCurrentProject() {
+ return project;
+ }
+
+ /**
+ * Registers the projects if and only if a file exists already
+ * @param projects
+ * @param projectToShow
+ */
+ protected void registerProjects(final IProject[] projects, final IProject projectToShow) {
+ getSite().getShell().getDisplay().asyncExec(new Runnable () {
+ public void run () {
+ for( int i = 0; i < projects.length; i++ ) {
+ ArchivesModel.instance().registerProject(projects[i].getLocation(), loadingProgress);
+ }
+ book.showPage(viewerComposite);
+ packageViewer.setInput(ArchivesModel.instance().getRoot(projectToShow.getLocation()));
+ }
+ });
+ }
+
+ public IProject[] getAllProjectsWithPackages() {
+ IProject[] projects2 = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ ArrayList list = new ArrayList();
+ for( int i = 0; i < projects2.length; i++ ) {
+ if( ArchivesModelCore.packageFileExists(projects2[i].getLocation())) {
+ list.add(projects2[i]);
+ }
+ }
+ return (IProject[]) list.toArray(new IProject[list.size()]);
+ }
+ public IStructuredSelection getSelection() {
+ return (IStructuredSelection)packageViewer.getSelection();
+ }
+
+
+ public void modelChanged(IArchiveNodeDelta delta) {
+ boolean update = true;
+ try {
+ if( project == null ) return;
+ if( delta.getPostNode() == null && delta.getPreNode() == null ) return;
+ if( delta.getPreNode() == null ) update = delta.getPostNode().getProjectPath().equals(project.getLocation());
+ else if( delta.getPostNode() == null ) update = delta.getPreNode().getProjectPath().equals(project.getLocation());
+ else update = delta.getPreNode().getProjectPath().equals(project.getLocation()) || delta.getPostNode().getProjectPath().equals(project);
+ } catch( Exception e ) {}
+
+ if( !update ) return;
+
+ final IArchiveNode[] topChanges;
+ if( delta.getKind() == IArchiveNodeDelta.DESCENDENT_CHANGED)
+ topChanges = getChanges(delta);
+ else if( delta.getKind() == IArchiveNodeDelta.NO_CHANGE)
+ topChanges = new IArchiveNode[]{};
+ else
+ topChanges = new IArchiveNode[]{delta.getPostNode()};
+
+ // now go through and refresh them
+ getSite().getShell().getDisplay().asyncExec(new Runnable () {
+ public void run () {
+ for( int i = 0; i < topChanges.length; i++ ) {
+ if( topChanges.length == 1 && topChanges[0] instanceof IArchiveModelNode) {
+ packageViewer.setInput(ArchivesModel.instance().getRoot(project.getLocation()));
+ book.showPage(viewerComposite);
+ } else
+ packageViewer.refresh(topChanges[i]);
+ }
+ }
+ });
+
+ }
+ protected IArchiveNode[] getChanges(IArchiveNodeDelta delta) {
+
+ IArchiveNodeDelta[] children = delta.getAllAffectedChildren();
+ ArrayList list = new ArrayList();
+ for( int i = 0; i < children.length; i++ ) {
+ if( children[i].getKind() == IArchiveNodeDelta.DESCENDENT_CHANGED)
+ list.addAll(Arrays.asList(getChanges(children[i])));
+ else
+ list.add(children[i].getPostNode());
+ }
+ return (IArchiveNode[]) list.toArray(new IArchiveNode[list.size()]);
+ }
+
+ public void refreshViewer(final Object node) {
+ getSite().getShell().getDisplay().asyncExec(new Runnable () {
+ public void run () {
+ if( node == null ) {
+ Object[] els = packageViewer.getExpandedElements();
+ packageViewer.refresh();
+ packageViewer.setExpandedElements(els);
+ } else {
+ packageViewer.refresh(node);
+ }
+ }
+ });
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/AbstractArchiveWizard.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/AbstractArchiveWizard.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/AbstractArchiveWizard.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,161 @@
+package org.jboss.ide.eclipse.archives.ui.wizards;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.jboss.ide.eclipse.archives.core.Trace;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesView;
+import org.jboss.ide.eclipse.archives.ui.wizards.pages.ArchiveInfoWizardPage;
+
+public abstract class AbstractArchiveWizard extends WizardWithNotification implements INewWizard {
+ private ArchiveInfoWizardPage firstPage;
+ private WizardPage pages[];
+ protected IPath project;
+ protected Object selectedDestination;
+ protected IArchive existingPackage;
+
+ public AbstractArchiveWizard () {
+ this.project = ProjectArchivesView.getInstance().getCurrentProject().getLocation();
+ }
+
+ public AbstractArchiveWizard (IArchive existingPackage) {
+ this.existingPackage = existingPackage;
+ this.project = existingPackage.getProjectPath();
+ }
+
+ public void addPages() {
+ firstPage = new ArchiveInfoWizardPage(this, existingPackage);
+ addPage(firstPage);
+
+ pages = createWizardPages();
+ for (int i = 0; i < pages.length; i++) {
+ addPage(pages[i]);
+ }
+ }
+
+ public boolean canFinish() {
+ if (firstPage.isPageComplete()) {
+ for (int i = 0; i < pages.length; i++) {
+ if (!pages[i].isPageComplete()) return false;
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean performFinish() {
+ IWizardPage currentPage = getContainer().getCurrentPage();
+
+ if (currentPage instanceof WizardPageWithNotification) {
+ ((WizardPageWithNotification)currentPage).pageExited(WizardWithNotification.FINISH);
+ }
+
+ final boolean create = this.existingPackage == null;
+ final IArchive pkg = firstPage.getArchive();
+ final Object destination = firstPage.getPackageDestination();
+
+ boolean performed = performFinish(pkg);
+
+ if (performed) {
+ try {
+ getContainer().run(false, false, new IRunnableWithProgress () {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ IArchiveNode parent = null;
+
+ if (destination instanceof IArchiveNode) {
+ // if we're modifying an existing package, remove old parentage
+ if (!create && !destination.equals(pkg.getParent())) {
+ if (pkg.getParent() != null) {
+ pkg.getParent().removeChild(pkg);
+ }
+ }
+ parent = (IArchiveNode)destination;
+ } else {
+ parent = ArchivesModel.instance().getRoot(project, true, monitor);
+ }
+
+ if( create )
+ ArchivesModel.instance().attach(parent, pkg, monitor);
+ else
+ ArchivesModel.instance().saveModel(project, monitor);
+ }
+ });
+ } catch (InvocationTargetException e) {
+ Trace.trace(getClass(), e);
+ } catch (InterruptedException e) {
+ Trace.trace(getClass(), e);
+ }
+ }
+ return performed;
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ if (selection == null) return;
+ project = ProjectArchivesView.getInstance().getCurrentProject().getLocation();
+ Object selected;
+
+ if( selection.isEmpty() ) {
+ selected = project;
+ } else {
+ selected = selection.getFirstElement();
+ }
+
+ if (selected instanceof IArchiveNode)
+ {
+ IArchiveNode node = (IArchiveNode) selected;
+ if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE || node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER)
+ {
+ selectedDestination = selected;
+ }
+ project = node.getProjectPath();
+ }
+ else if (selected instanceof IContainer)
+ {
+ selectedDestination = selected;
+ }
+ else {
+ // find project
+ String proj = project.toOSString().substring(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString().length()+1);
+ selectedDestination = ResourcesPlugin.getWorkspace().getRoot().getProject(proj);
+ }
+
+ setNeedsProgressMonitor(true);
+ }
+
+ public Object getSelectedDestination ()
+ {
+ return selectedDestination;
+ }
+
+ public abstract boolean performFinish(IArchive pkg);
+ public abstract WizardPage[] createWizardPages();
+ public abstract ImageDescriptor getImageDescriptor();
+ public abstract String getArchiveExtension();
+
+ public IPath getProject() {
+ return project;
+ }
+
+ /**
+ * Returns the package created by this wizard.
+ * Note: This should only be called after the first page has been completed
+ * @return The package
+ */
+ public IArchive getArchive () {
+ return firstPage.getArchive();
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/FilesetWizard.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/FilesetWizard.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/FilesetWizard.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,73 @@
+package org.jboss.ide.eclipse.archives.ui.wizards;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.Wizard;
+import org.jboss.ide.eclipse.archives.core.Trace;
+import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.ui.wizards.pages.FilesetInfoWizardPage;
+
+public class FilesetWizard extends Wizard {
+
+ private FilesetInfoWizardPage page1;
+ private IArchiveFileSet fileset;
+ private IArchiveNode parentNode;
+
+ public FilesetWizard(IArchiveFileSet fileset, IArchiveNode parentNode)
+ {
+ this.fileset = fileset;
+ this.parentNode = parentNode;
+ }
+
+ public boolean performFinish() {
+ try {
+ final boolean createFileset = this.fileset == null;
+
+ if (createFileset)
+ this.fileset = ArchiveNodeFactory.createFileset();
+
+ fillFilesetFromPage(fileset);
+ try {
+ getContainer().run(false, false, new IRunnableWithProgress () {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ if (createFileset) {
+ ArchivesModel.instance().attach(parentNode, fileset, monitor);
+ } else {
+ ArchivesModel.instance().saveModel(fileset.getProjectPath(), monitor);
+ }
+ }
+ });
+ } catch (InvocationTargetException e) {
+ Trace.trace(getClass(), e);
+ } catch (InterruptedException e) {
+ Trace.trace(getClass(), e);
+ }
+
+ } catch(Exception e) {e.printStackTrace();}
+ return true;
+ }
+
+ private void fillFilesetFromPage (IArchiveFileSet fileset) {
+ fileset.setExcludesPattern(page1.getExcludes());
+ fileset.setIncludesPattern(page1.getIncludes());
+ if( page1.isRootDirWorkspaceRelative()) {
+ int workspaceLength = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString().length();
+ fileset.setSourcePath(new Path(page1.getRootDir().substring(workspaceLength)));
+ } else {
+ fileset.setSourcePath(new Path(page1.getRootDir()));
+ fileset.setInWorkspace(false);
+ }
+ }
+
+ public void addPages() {
+ page1 = new FilesetInfoWizardPage(getShell(), fileset, parentNode);
+ addPage(page1);
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/NewJARWizard.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/NewJARWizard.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/NewJARWizard.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,39 @@
+package org.jboss.ide.eclipse.archives.ui.wizards;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
+import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+
+public class NewJARWizard extends AbstractArchiveWizard
+{
+ public WizardPage[] createWizardPages() {
+ return new WizardPage[0];
+ }
+
+ public NewJARWizard () {
+ setWindowTitle(ArchivesUIMessages.NewJARWizard_windowTitle);
+ }
+
+ public NewJARWizard (IArchive existingPackage) {
+ super(existingPackage);
+
+ setWindowTitle(ArchivesUIMessages.NewJARWizard_windowTitle_editJAR);
+ }
+
+ public boolean performFinish(IArchive pkg) {
+
+ pkg.setArchiveType(ArchivesCore.getInstance().getExtensionManager().getArchiveType("jar"));
+ return true;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_NEW_JAR_WIZARD);
+ }
+
+ public String getArchiveExtension() {
+ return "jar";
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/WizardPageWithNotification.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/WizardPageWithNotification.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/WizardPageWithNotification.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,48 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.ui.wizards;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardPage;
+
+/**
+ *
+ * @author rob.stryker(a)jboss.com
+ */
+public abstract class WizardPageWithNotification extends WizardPage implements IWizardPage {
+ /**
+ * @param pageName
+ */
+ protected WizardPageWithNotification(String pageName) {
+ super(pageName);
+ }
+
+ protected WizardPageWithNotification(String pageName, String title,
+ ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
+
+ public void pageEntered(int button) {}
+ public void pageExited(int button) {}
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/WizardWithNotification.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/WizardWithNotification.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/WizardWithNotification.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,95 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.ui.wizards;
+
+import org.eclipse.jface.dialogs.IPageChangedListener;
+import org.eclipse.jface.dialogs.PageChangedEvent;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+
+/**
+ *
+ * @author rob.stryker(a)jboss.com
+ */
+public abstract class WizardWithNotification extends Wizard implements IPageChangedListener {
+ public static final int NEXT = 1;
+ public static final int PREVIOUS = 2;
+ public static final int FINISH = 3;
+ public static final int UNKNOWN = 4;
+
+
+ private IWizardPage currentPage;
+ public WizardWithNotification() {
+ super();
+ currentPage = null;
+ }
+ public void setContainer(IWizardContainer wizardContainer) {
+ IWizardContainer previous = getContainer();
+ super.setContainer(wizardContainer);
+
+ // listeners
+ if( previous instanceof WizardDialog ) {
+ ((WizardDialog)previous).removePageChangedListener(this);
+ }
+
+ if( wizardContainer instanceof WizardDialog ) {
+ ((WizardDialog)wizardContainer).addPageChangedListener(this);
+ }
+ }
+ public void pageChanged(PageChangedEvent event) {
+ if( currentPage == null ) {
+ currentPage = (IWizardPage)event.getSelectedPage();
+ if( currentPage instanceof WizardPageWithNotification) {
+ ((WizardPageWithNotification)currentPage).pageEntered(UNKNOWN);
+ }
+ return;
+ }
+
+ Object selectedPage = event.getSelectedPage();
+ IWizardPage previous = currentPage.getPreviousPage();
+ IWizardPage next = currentPage.getNextPage();
+
+ if( previous != null && previous.equals(selectedPage)) {
+ if( currentPage instanceof WizardPageWithNotification )
+ ((WizardPageWithNotification)currentPage).pageExited(PREVIOUS);
+ if( selectedPage instanceof WizardPageWithNotification )
+ ((WizardPageWithNotification)selectedPage).pageEntered(PREVIOUS);
+ } else if( next != null && next.equals(selectedPage)) {
+ if( currentPage instanceof WizardPageWithNotification )
+ ((WizardPageWithNotification)currentPage).pageExited(NEXT);
+ if( selectedPage instanceof WizardPageWithNotification )
+ ((WizardPageWithNotification)selectedPage).pageEntered(NEXT);
+ } else {
+ if( currentPage instanceof WizardPageWithNotification ) {
+ ((WizardPageWithNotification)currentPage).pageExited(UNKNOWN);
+ }
+ if( selectedPage instanceof WizardPageWithNotification) {
+ ((WizardPageWithNotification)selectedPage).pageEntered(UNKNOWN);
+ }
+ }
+ currentPage = selectedPage instanceof IWizardPage ? ((IWizardPage)selectedPage) : null;
+ }
+
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,289 @@
+package org.jboss.ide.eclipse.archives.ui.wizards.pages;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
+import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+import org.jboss.ide.eclipse.archives.ui.util.DestinationChangeListener;
+import org.jboss.ide.eclipse.archives.ui.util.composites.ArchiveDestinationComposite;
+import org.jboss.ide.eclipse.archives.ui.wizards.AbstractArchiveWizard;
+import org.jboss.ide.eclipse.archives.ui.wizards.WizardPageWithNotification;
+import org.jboss.ide.eclipse.archives.ui.wizards.WizardWithNotification;
+
+public class ArchiveInfoWizardPage extends WizardPageWithNotification {
+
+ private AbstractArchiveWizard wizard;
+ private Text packageNameText;
+ private Button compressedButton;
+ private Button explodedButton;
+ private String packageName;
+ private boolean packageExploded;
+ private ArchiveDestinationComposite destinationComposite;
+ private IArchive archive;
+
+ public ArchiveInfoWizardPage (AbstractArchiveWizard wizard, IArchive existingPackage) {
+ super (ArchivesUIMessages.PackageInfoWizardPage_title, ArchivesUIMessages.PackageInfoWizardPage_title, wizard.getImageDescriptor());
+ setWizard(wizard);
+ this.archive = existingPackage;
+ }
+
+ public void createControl(Composite parent) {
+ setMessage(ArchivesUIMessages.PackageInfoWizardPage_message);
+
+ Composite main = new Composite(parent, SWT.NONE);
+ main.setLayout(new GridLayout(1, false));
+
+ Group infoGroup = new Group(main, SWT.NONE);
+ infoGroup.setLayout(new GridLayout(3, false));
+ infoGroup.setText(ArchivesUIMessages.PackageInfoWizardPage_infoGroup_label);
+ expand(infoGroup);
+
+ new Label(infoGroup, SWT.NONE).setText(ArchivesUIMessages.PackageInfoWizardPage_packageName_label);
+ Composite pkgNameComposite = new Composite(infoGroup, SWT.NONE);
+ GridLayout pkgNameLayout = new GridLayout(2, false);
+ pkgNameLayout.marginHeight = 0;
+ pkgNameLayout.marginWidth = 0;
+ pkgNameComposite.setLayout(pkgNameLayout);
+ pkgNameComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ new Label(pkgNameComposite, SWT.NONE).setImage(ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_PACKAGE));
+
+ packageNameText = new Text(pkgNameComposite, SWT.BORDER);
+ packageName = wizard.getProject().lastSegment() + "." + wizard.getArchiveExtension();
+ packageNameText.setText(packageName);
+ packageNameText.setSelection(0, wizard.getProject().lastSegment().length());
+ expand(packageNameText);
+
+ GridData pkgNameData = new GridData(GridData.FILL_HORIZONTAL);
+ pkgNameData.horizontalSpan = 2;
+ pkgNameComposite.setLayoutData(pkgNameData);
+
+ packageNameText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if (validate())
+ {
+ packageName = packageNameText.getText();
+ }
+ }
+ });
+
+ new Label(infoGroup, SWT.NONE).setText(ArchivesUIMessages.PackageInfoWizardPage_destination_label);
+
+ GridData destinationTextData = new GridData(GridData.FILL_BOTH);
+ destinationTextData.horizontalSpan = 2;
+ GridData buttonData = new GridData(GridData.FILL_HORIZONTAL);
+ buttonData.horizontalSpan = 3;
+ buttonData.horizontalAlignment = SWT.END;
+
+ Object destination = wizard.getSelectedDestination();
+ destinationComposite = new ArchiveDestinationComposite(
+ infoGroup, SWT.NONE, destination);
+ destinationComposite.addDestinationChangeListener(new DestinationChangeListener () {
+ public void destinationChanged(Object newDestination) {
+ validate();
+ }
+ });
+ destinationComposite.setLayoutData(destinationTextData);
+
+ Group packageTypeGroup = new Group(main, SWT.NONE);
+ packageTypeGroup.setLayout(new GridLayout(1, false));
+ packageTypeGroup.setText(ArchivesUIMessages.PackageInfoWizardPage_packageTypeGroup_label);
+ expand(packageTypeGroup);
+
+ packageExploded = false;
+ compressedButton = new Button(packageTypeGroup, SWT.RADIO);
+ compressedButton.setText(ArchivesUIMessages.PackageInfoWizardPage_compressedButton_label);
+ compressedButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ packageExploded = false;
+ }
+ });
+ compressedButton.setSelection(true);
+ explodedButton = new Button(packageTypeGroup, SWT.RADIO);
+ explodedButton.addSelectionListener(new SelectionAdapter () {
+ public void widgetSelected(SelectionEvent e) {
+ packageExploded = true;
+ }
+ });
+ explodedButton.setText(ArchivesUIMessages.PackageInfoWizardPage_explodedButton_label);
+ setControl(main);
+
+ fillDefaults();
+ validate();
+ }
+
+ private void fillDefaults ()
+ {
+ if (archive != null)
+ {
+ compressedButton.setSelection(!archive.isExploded());
+ explodedButton.setSelection(archive.isExploded());
+ packageNameText.setText(archive.getName());
+ packageName = archive.getName();
+
+ if (archive.isTopLevel()) {
+
+ // TODO: FIX THIS
+ destinationComposite.setPackageNodeDestination(archive.getDestinationPath());
+ } else {
+ destinationComposite.setPackageNodeDestination(archive.getParent());
+ }
+
+ if (archive.isExploded())
+ {
+ explodedButton.setEnabled(true);
+ } else {
+ compressedButton.setEnabled(true);
+ }
+ }
+ }
+
+ private boolean validate ()
+ {
+ if (packageNameText.getText() == null || packageNameText.getText().length() == 0)
+ {
+ setErrorMessage(ArchivesUIMessages.PackageInfoWizardPage_error_noPackageName);
+ setPageComplete(false);
+ return false;
+ }
+ else {
+ setErrorMessage(null);
+ }
+
+ Object destination = getPackageDestination();
+ if (destination instanceof IArchiveNode)
+ {
+ IArchiveNode parentNode = (IArchiveNode) destination;
+
+ // verify no child has the same name
+ IArchiveNode subPackages[] = parentNode.getChildren(IArchiveNode.TYPE_ARCHIVE);
+ for (int i = 0; i < subPackages.length; i++)
+ {
+ IArchive subPackage = (IArchive) subPackages[i];
+ if (subPackage.getName().equals(packageNameText.getText())
+ && (!archive.equals(this.archive)))
+ {
+ setErrorMessage(
+ ArchivesUIMessages.bind(
+ ArchivesUIMessages.PackageInfoWizardPage_error_packageAlreadyExists, packageNameText.getText()));
+ setPageComplete(false);
+ return false;
+ }
+ }
+ } else if (destination instanceof IContainer) {
+ IContainer container = (IContainer) destination;
+ IArchive[] packages = ArchivesModel.instance().getProjectArchives(wizard.getProject());
+ if (packages != null) {
+ for( int i = 0; i < packages.length; i++ ) {
+ IArchive pkg = (IArchive) packages[i];
+ if (pkg.getName().equals(packageNameText.getText())
+ && (pkg.getDestinationPath() != null && pkg.getDestinationPath().equals(container.getFullPath()))
+ && (!pkg.equals(this.archive)))
+ {
+ setErrorMessage(
+ ArchivesUIMessages.bind(
+ ArchivesUIMessages.PackageInfoWizardPage_error_packageAlreadyExists, packageNameText.getText()));
+ setPageComplete(false);
+ return false;
+ }
+ }
+ }
+ } else if (destination instanceof IPath) {
+ IPath path = (IPath) destination;
+ IArchive[] packages = ArchivesModel.instance().getProjectArchives(wizard.getProject());
+ if (packages != null) {
+ for( int i = 0; i < packages.length; i++ ) {
+ IArchive pkg = (IArchive) packages[i];
+ if (pkg.getName().equals(packageNameText.getText())
+ && (pkg.getDestinationPath() != null && pkg.getDestinationPath().equals(path))
+ && (!pkg.equals(this.archive)))
+ {
+ setErrorMessage(
+ ArchivesUIMessages.bind(
+ ArchivesUIMessages.PackageInfoWizardPage_error_packageAlreadyExists, packageNameText.getText()));
+ setPageComplete(false);
+ return false;
+ }
+ }
+ } else if (destination == null) {
+ setErrorMessage(ArchivesUIMessages.PackageInfoWizardPage_error_noDestination);
+ setPageComplete(false);
+ return false;
+ }
+ }
+
+ setPageComplete(true);
+ return true;
+ }
+
+
+ public void pageExited(int button) {
+ if (button == WizardWithNotification.NEXT || button == WizardWithNotification.FINISH) {
+ createPackage();
+ }
+ }
+
+ private void createPackage () {
+ Object destContainer = getPackageDestination();
+
+
+ if (archive == null) {
+ archive = ArchiveNodeFactory.createArchive();
+ }
+
+ archive.setName(getPackageName());
+ archive.setExploded(isPackageExploded());
+
+ if (destContainer instanceof IContainer) {
+ archive.setDestinationPath(((IContainer)destContainer).getFullPath());
+ archive.setInWorkspace(true);
+ } else if (destContainer instanceof IPath) {
+ archive.setDestinationPath((IPath) destContainer);
+ archive.setInWorkspace(false);
+ }
+ }
+
+ private void expand(Control control)
+ {
+ control.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+
+ public String getPackageName() {
+ return packageName;
+ }
+
+ public boolean isPackageExploded() {
+ return packageExploded;
+ }
+
+ public Object getPackageDestination() {
+ return destinationComposite.getPackageNodeDestination();
+ }
+
+ private void setWizard(AbstractArchiveWizard wizard)
+ {
+ this.wizard = wizard;
+ }
+
+ public IArchive getArchive ()
+ {
+ return archive;
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/DefaultJARConfigWizardPage.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/DefaultJARConfigWizardPage.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/DefaultJARConfigWizardPage.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,44 @@
+package org.jboss.ide.eclipse.archives.ui.wizards.pages;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
+import org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProvider;
+import org.jboss.ide.eclipse.archives.ui.providers.ArchivesLabelProvider;
+import org.jboss.ide.eclipse.archives.ui.wizards.AbstractArchiveWizard;
+import org.jboss.ide.eclipse.archives.ui.wizards.WizardPageWithNotification;
+
+public class DefaultJARConfigWizardPage extends WizardPageWithNotification {
+
+ private AbstractArchiveWizard wizard;
+
+ public DefaultJARConfigWizardPage (AbstractArchiveWizard wizard) {
+ super ("Default JAR Configuration", "Default JAR Configuration",
+ ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_NEW_JAR_WIZARD));
+
+ this.wizard = wizard;
+ }
+
+ public void createControl(Composite parent) {
+
+ Composite main = new Composite(parent, SWT.NONE);
+ main.setLayout(new GridLayout(1, false));
+
+ Button createDefaultConfig = new Button(main, SWT.CHECK);
+ createDefaultConfig.setText("Use default JAR configuration");
+
+ new Label(main, SWT.NONE).setText("Preview");
+
+ TreeViewer previewTree = new TreeViewer(main);
+ previewTree.setContentProvider(new ArchivesContentProvider());
+ previewTree.setLabelProvider(new ArchivesLabelProvider());
+ previewTree.setInput(wizard.getArchive());
+
+ setControl(main);
+ }
+
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java 2007-05-21 19:50:52 UTC (rev 2036)
@@ -0,0 +1,351 @@
+package org.jboss.ide.eclipse.archives.ui.wizards.pages;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+import org.eclipse.ui.ide.IDE;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModelCore;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
+import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+import org.jboss.ide.eclipse.archives.ui.util.composites.ArchiveNodeDestinationComposite;
+import org.jboss.ide.eclipse.archives.ui.util.composites.FilesetPreviewComposite;
+
+public class FilesetInfoWizardPage extends WizardPage {
+
+ private IArchiveFileSet fileset;
+ private IArchiveNode parentNode;
+ private Text includesText;
+ private Text excludesText;
+ private ArchiveNodeDestinationComposite destinationComposite;
+
+ private String includes, excludes;
+
+ /**
+ * This variable must at all times be global. ALWAYS
+ */
+ private IPath rootDir;
+ private boolean rootDirIsWorkspaceRelative;
+ private FilesetPreviewComposite previewComposite;
+
+ private Composite mainComposite;
+ private Text rootDirText;
+ private Label rootProjectLabel;
+ private Button rootDirWorkspaceBrowseButton;
+ private Button rootDirFilesystemBrowseButton;
+
+ public FilesetInfoWizardPage (Shell parent, IArchiveFileSet fileset, IArchiveNode parentNode) {
+ super(ArchivesUIMessages.FilesetInfoWizardPage_new_title, ArchivesUIMessages.FilesetInfoWizardPage_new_title, null);
+
+ if (fileset == null) {
+ setTitle(ArchivesUIMessages.FilesetInfoWizardPage_new_title);
+ setMessage(ArchivesUIMessages.FilesetInfoWizardPage_new_message);
+ } else {
+ setTitle(ArchivesUIMessages.FilesetInfoWizardPage_edit_title);
+ setMessage(ArchivesUIMessages.FilesetInfoWizardPage_edit_message);
+ }
+
+ this.fileset = fileset;
+ this.parentNode = parentNode;
+ }
+
+ public void createControl (Composite parent) {
+ mainComposite = new Composite(parent, SWT.NONE);
+ mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ mainComposite.setLayout(new FormLayout());
+ Group info = createInfoGroup(mainComposite);
+ createPreviewGroup(mainComposite, info);
+
+ fillDefaults();
+ addListeners();
+ changePreview();
+
+ includesText.setFocus();
+
+ setControl(mainComposite);
+ }
+
+ private FormData createFormData(Object topStart, int topOffset, Object bottomStart, int bottomOffset,
+ Object leftStart, int leftOffset, Object rightStart, int rightOffset) {
+ FormData data = new FormData();
+
+ if( topStart != null ) {
+ data.top = topStart instanceof Control ? new FormAttachment((Control)topStart, topOffset) :
+ new FormAttachment(((Integer)topStart).intValue(), topOffset);
+ }
+
+ if( bottomStart != null ) {
+ data.bottom = bottomStart instanceof Control ? new FormAttachment((Control)bottomStart, bottomOffset) :
+ new FormAttachment(((Integer)bottomStart).intValue(), bottomOffset);
+ }
+
+ if( leftStart != null ) {
+ data.left = leftStart instanceof Control ? new FormAttachment((Control)leftStart, leftOffset) :
+ new FormAttachment(((Integer)leftStart).intValue(), leftOffset);
+ }
+
+ if( rightStart != null ) {
+ data.right = rightStart instanceof Control ? new FormAttachment((Control)rightStart, rightOffset) :
+ new FormAttachment(((Integer)rightStart).intValue(), rightOffset);
+ }
+
+ return data;
+ }
+
+
+ private Group createPreviewGroup(Composite mainComposite, Group info) {
+ Group previewGroup = new Group(mainComposite, SWT.NONE);
+ previewGroup.setLayoutData(createFormData(info,5,100,-5,0,5,100,-5));
+ previewGroup.setLayout(new FormLayout());
+ previewComposite = new FilesetPreviewComposite(previewGroup, SWT.NONE);
+ previewComposite.setLayoutData(createFormData(0,0,100,0,0,0,100,0));
+ previewGroup.setText(ArchivesUIMessages.FilesetInfoWizardPage_previewGroup_label);
+ return previewGroup;
+ }
+ private Group createInfoGroup(Composite mainComposite) {
+ Group infoGroup = new Group(mainComposite, SWT.NONE);
+ infoGroup.setText(ArchivesUIMessages.FilesetInfoWizardPage_infoGroup_title);
+
+ // positioning in parent
+ infoGroup.setLayoutData(createFormData(0,5,null,0,0,5,100,-5));
+
+ // my layout
+ infoGroup.setLayout(new FormLayout());
+
+
+ int max = 100;
+
+ // destination row
+ Label destinationKey = new Label(infoGroup, SWT.NONE);
+ destinationComposite = new ArchiveNodeDestinationComposite(infoGroup, SWT.NONE, parentNode);
+
+ destinationKey.setLayoutData(createFormData(0,10,null,0,null,5, 0, max));
+ destinationComposite.setLayoutData(createFormData(0,5,null,0,destinationKey,5, 100, -5));
+
+
+ // root project row
+ Label rootProjectKey = new Label(infoGroup, SWT.NONE);
+ Composite rootProjectVal = new Composite(infoGroup, SWT.NONE);
+ rootProjectVal.setLayout(new FormLayout());
+ Label projectImageLabel = new Label(rootProjectVal, SWT.NONE);
+ rootProjectLabel = new Label(rootProjectVal, SWT.NONE);
+
+ projectImageLabel.setLayoutData(createFormData(0,0,null,0,0,5, null,0));
+ rootProjectLabel.setLayoutData(createFormData(0,0,null,0,projectImageLabel, 5, 100,-5));
+ rootProjectKey.setLayoutData(createFormData(destinationComposite,5,null,0,null,5,0,max));
+ rootProjectVal.setLayoutData(createFormData(destinationComposite,5, null, 0, destinationKey, 5, 100, -5));
+
+
+ // root dir
+ Label rootDirectoryLabel = new Label(infoGroup, SWT.NONE);
+ Composite rootDirValue = new Composite(infoGroup, SWT.NONE);
+ rootDirValue.setLayout(new FormLayout());
+
+ rootDirText = new Text(rootDirValue, SWT.BORDER);
+ rootDirWorkspaceBrowseButton = new Button(rootDirValue, SWT.PUSH);
+ rootDirFilesystemBrowseButton = new Button(rootDirValue, SWT.PUSH);
+
+ rootDirText.setLayoutData(createFormData(0,5,null,0,0,5,100,-5));
+ rootDirFilesystemBrowseButton.setLayoutData(createFormData(rootDirText,5,null,0,null,0,100,-5));
+ rootDirWorkspaceBrowseButton.setLayoutData(createFormData(rootDirText,5,null,0,null,0,rootDirFilesystemBrowseButton, -5));
+
+ rootDirectoryLabel.setLayoutData(createFormData(rootProjectVal,10,null,0,null,5,0,max));
+ rootDirValue.setLayoutData(createFormData(rootProjectVal,5,null,0,rootDirectoryLabel,5,100,-5));
+
+
+ // includes composite and it's internals
+ Composite includesKey = new Composite(infoGroup, SWT.NONE);
+ includesKey.setLayout(new FormLayout());
+ Label includesImage = new Label(includesKey, SWT.NONE);
+ Label includesTextLabel = new Label(includesKey, SWT.NONE);
+ includesText = new Text(infoGroup, SWT.BORDER);
+ includesImage.setLayoutData(createFormData(0,0,null,0,0,0,null,0));
+ includesTextLabel.setLayoutData(createFormData(0,0,null,0,includesImage,5,null,0));
+
+ includesKey.setLayoutData(createFormData(rootDirValue,5,null,0,null,5,0,max));
+ includesText.setLayoutData(createFormData(rootDirValue,5,null,0,includesKey,10,100,-5));
+
+
+ // excludes composite and it's internals
+ Composite excludesKey = new Composite(infoGroup, SWT.NONE);
+ excludesKey.setLayout(new FormLayout());
+ Label excludesImage = new Label(excludesKey, SWT.NONE);
+ Label excludesTextLabel = new Label(excludesKey, SWT.NONE);
+ excludesText = new Text(infoGroup, SWT.BORDER);
+ excludesImage.setLayoutData(createFormData(0,0,null,0,0,0,null,0));
+ excludesTextLabel.setLayoutData(createFormData(0,0,null,0,excludesImage,5,null,0));
+
+ excludesKey.setLayoutData(createFormData(includesText,5,null,0,null,5,0,max));
+ excludesText.setLayoutData(createFormData(includesText,5,null,0,excludesKey,10,100,-5));
+
+
+
+
+
+
+ // customize widgets
+ destinationKey.setText(ArchivesUIMessages.FilesetInfoWizardPage_destination_label);
+ rootProjectKey.setText(ArchivesUIMessages.FilesetInfoWizardPage_rootProject_label);
+ projectImageLabel.setImage(
+ PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT));
+ rootDirectoryLabel.setText(ArchivesUIMessages.FilesetInfoWizardPage_rootDirectory_label);
+ rootDirWorkspaceBrowseButton.setText(ArchivesUIMessages.FilesetInfoWizardPage_rootDirWorkspaceBrowseButton_label);
+ rootDirFilesystemBrowseButton.setText(ArchivesUIMessages.FilesetInfoWizardPage_rootDirFilesystemBrowseButton_label);
+ includesImage.setImage(ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_INCLUDES));
+ includesTextLabel.setText(ArchivesUIMessages.FilesetInfoWizardPage_includes_label);
+ excludesImage.setImage(ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_EXCLUDES));
+ excludesTextLabel.setText(ArchivesUIMessages.FilesetInfoWizardPage_excludes_label);
+ rootDirText.setEnabled(false);
+
+ return infoGroup;
+ }
+
+
+ private void addListeners ()
+ {
+ includesText.addModifyListener(new ModifyListener () {
+ public void modifyText(ModifyEvent e) {
+ includes = includesText.getText();
+ changePreview();
+ }
+ });
+
+ excludesText.addModifyListener(new ModifyListener () {
+ public void modifyText(ModifyEvent e) {
+ excludes = excludesText.getText();
+ changePreview();
+ }
+ });
+
+
+ rootDirWorkspaceBrowseButton.addSelectionListener(new SelectionAdapter () {
+ public void widgetSelected(SelectionEvent e) {
+ browseWorkspaceForRootDir();
+ }
+ });
+
+ rootDirFilesystemBrowseButton.addSelectionListener(new SelectionAdapter () {
+ public void widgetSelected(SelectionEvent e) {
+ browseFilesystemForRootDir();
+ }
+ });
+
+ }
+
+ public IArchiveNode getRootNode () {
+ return (IArchiveNode) destinationComposite.getPackageNodeDestination();
+ }
+
+ public String getIncludes () {
+ return includes;
+ }
+
+ public String getExcludes () {
+ return excludes;
+ }
+
+ public String getRootDir () {
+ return rootDir.toOSString();
+ }
+
+ public boolean isRootDirWorkspaceRelative () {
+ return rootDirIsWorkspaceRelative;
+ }
+
+ private void fillDefaults () {
+ if (fileset != null) {
+ if (fileset.getIncludesPattern() != null)
+ includesText.setText(fileset.getIncludesPattern());
+ if (fileset.getExcludesPattern() != null)
+ excludesText.setText(fileset.getExcludesPattern());
+
+ if (fileset.getGlobalSourcePath() != null) {
+ rootDir = fileset.getGlobalSourcePath();
+ rootDirText.setText(rootDir.toString());
+ rootDirIsWorkspaceRelative = fileset.isInWorkspace();
+ }
+ } else {
+ rootProjectLabel.setText(parentNode.getProjectPath().lastSegment());
+ rootDirIsWorkspaceRelative = true;
+ rootDir = ResourcesPlugin.getWorkspace().getRoot().getProject(parentNode.getProjectPath().lastSegment()).getLocation();
+ }
+ }
+
+ private void changePreview() {
+ IPath root = rootDir; //isRootDirWorkspaceRelative() ? ResourcesPlugin.getWorkspace().getRoot().getLocation().append(rootDir) : rootDir;
+ IPath paths[] = ArchivesModelCore.findMatchingPaths(root, includesText.getText(), excludesText.getText());
+ previewComposite.setInput(paths);
+ }
+
+
+ private void browseWorkspaceForRootDir () {
+ IContainer workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), workspaceRoot, true,
+ ArchivesUIMessages.FilesetInfoWizardPage_rootDirWorkspaceBrowser_message);
+
+ int response = dialog.open();
+ if (response == Dialog.OK) {
+ Object results[] = dialog.getResult();
+ IPath path = (IPath) results[0];
+ String projectName = path.segment(0);
+
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (project != null) {
+ IPath relativePath = path.removeFirstSegments(1);
+ rootProjectLabel.setText(project.getName());
+
+ rootDir = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(path);
+ if (!relativePath.isEmpty()) {
+ rootDirText.setText(relativePath.toString());
+ } else {
+ rootDirText.setText("");
+ }
+
+ rootDirIsWorkspaceRelative = true;
+ changePreview();
+ }
+ }
+ }
+
+ private void browseFilesystemForRootDir () {
+ DirectoryDialog dialog = new DirectoryDialog(getShell());
+ if (rootDirText.getText() != null && rootDirText.getText().length() > 0 && !isRootDirWorkspaceRelative()) {
+ dialog.setFilterPath(rootDirText.getText());
+ }
+
+ String path = dialog.open();
+ if (path != null && path.length() > 0) {
+ rootDirText.setText(path);
+ rootDir = new Path(path);
+ rootDirIsWorkspaceRelative = false;
+ rootProjectLabel.setText(ArchivesUIMessages.FilesetInfoWizardPage_noProjectMessage);
+ changePreview();
+ }
+ }
+
+}
17 years, 7 months
JBoss Tools SVN: r2035 - trunk/core/plugins/org.jboss.ide.eclipse.archives.ui.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-21 15:48:12 -0400 (Mon, 21 May 2007)
New Revision: 2035
Removed:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/build.properties
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/icons/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/schema/
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/.classpath
Log:
project destroyed
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/.classpath
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/.classpath 2007-05-21 19:42:18 UTC (rev 2034)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/.classpath 2007-05-21 19:48:12 UTC (rev 2035)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/build.properties
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/build.properties 2007-05-21 19:42:18 UTC (rev 2034)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/build.properties 2007-05-21 19:48:12 UTC (rev 2035)
@@ -1,5 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml
Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2007-05-21 19:42:18 UTC (rev 2034)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2007-05-21 19:48:12 UTC (rev 2035)
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension-point id="nodePopupMenus" name="Popup Menus for IPackageNodes" schema="schema/nodePopupMenus.exsd"/>
- <extension-point id="newArchiveActions" name="Actions to create new Package types" schema="schema/newArchiveActions.exsd"/>
-
- <extension
- point="org.eclipse.ui.views">
- <view
- category="org.jboss.ide.eclipse.ui.views"
- class="org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesView"
- icon="icons/jar_obj.gif"
- id="org.jboss.ide.eclipse.archives.ui.ProjectArchivesView"
- name="Project archives"/>
- </extension>
-
- <extension
- point="org.jboss.ide.eclipse.archives.ui.newArchiveActions">
- <newPackageAction
- class="org.jboss.ide.eclipse.archives.ui.actions.NewJARAction"
- icon="icons/new_package.gif"
- id="org.jboss.ide.eclipse.archives.ui.newJARAction"
- label="JAR"/>
- </extension>
-
- <extension
- point="org.eclipse.ui.actionSets">
- <actionSet
- id="org.jboss.ide.eclipse.archives.ui.actions.Archives"
- label="Archives"
- visible="true">
- <action
- class="org.jboss.ide.eclipse.archives.ui.actions.BuildProjectAction"
- definitionId="org.jboss.ide.eclipse.packages.ui.actions.BuildArchivesAction"
- icon="icons/build_packages.gif"
- id="org.jboss.ide.eclipse.archives.ui.actions.BuildArchivesAction"
- label="Build Packages"
- menubarPath="project/additions"
- style="push">
- <enablement>
- <and>
- <objectState
- name="projectNature"
- value="org.jboss.ide.eclipse.archives.core.archivesNature"/>
- </and>
- </enablement>
- </action>
- </actionSet>
- </extension>
-
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.jboss.ide.eclipse.ui.MainPreferencePage"
- class="org.jboss.ide.eclipse.archives.ui.preferences.MainPreferencePage"
- id="org.jboss.ide.eclipse.archives.ui.archivesPreferencePage"
- name="Packaging Archives"/>
- </extension>
-
-
- <extension
- point="org.eclipse.ui.propertyPages">
- <page
- class="org.jboss.ide.eclipse.archives.ui.preferences.MainPreferencePage"
- id="org.jboss.ide.eclipse.archives.ui.projectProperties"
- name="Packaging Archives"
- objectClass="org.eclipse.core.resources.IProject"/>
- <page
- class="org.jboss.ide.eclipse.archives.ui.preferences.MainPreferencePage"
- id="org.jboss.ide.eclipse.archives.ui.projectProperties2"
- name="Packaging Archives"
- objectClass="org.eclipse.jdt.core.IJavaProject"/>
- </extension>
- <extension
- point="org.eclipse.core.runtime.preferences">
- <initializer class="org.jboss.ide.eclipse.archives.ui.PrefsInitializer"/>
- </extension>
-
-</plugin>
17 years, 7 months
JBoss Tools SVN: r2034 - trunk/core/plugins/org.jboss.ide.eclipse.archives.core.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-21 15:42:18 -0400 (Mon, 21 May 2007)
New Revision: 2034
Removed:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/LICENSE-truezip.txt
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/log4j.xml
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/xml/
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/.classpath
Log:
project destroyed
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/.classpath
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/.classpath 2007-05-16 19:44:34 UTC (rev 2033)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/.classpath 2007-05-21 19:42:18 UTC (rev 2034)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main"/>
<classpathentry exported="true" kind="lib" path="lib/jboss-common-4.0.4.jar" sourcepath="C:/Users/Marshall/Downloads/jbossxb-1.0.1.TEST-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jbossxb-1.0.1.TEST.jar"/>
<classpathentry exported="true" kind="lib" path="lib/xercesImpl.jar"/>
Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/LICENSE-truezip.txt
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/LICENSE-truezip.txt 2007-05-16 19:44:34 UTC (rev 2033)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/LICENSE-truezip.txt 2007-05-21 19:42:18 UTC (rev 2034)
@@ -1,203 +0,0 @@
-Updated for release.
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties 2007-05-16 19:44:34 UTC (rev 2033)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties 2007-05-21 19:42:18 UTC (rev 2034)
@@ -1,17 +0,0 @@
-output.. = bin/
-bin.includes = META-INF/,\
- plugin.xml,\
- packagescore.jar,\
- xml/,\
- lib/,\
- LICENSE-truezip.txt,\
- lib/xercesImpl.jar,\
- lib/jboss-common-4.0.4.jar,\
- lib/jbossxb-1.0.1.TEST.jar,\
- log4j.xml
-source.packagescore.jar = src/main/
-src.includes = LICENSE-truezip.txt,\
- src/,\
- xml/,\
- plugin.xml,\
- META-INF/
Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/log4j.xml
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/log4j.xml 2007-05-16 19:44:34 UTC (rev 2033)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/log4j.xml 2007-05-21 19:42:18 UTC (rev 2034)
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!-- ===================================================================== -->
-<!-- -->
-<!-- Log4j Configuration -->
-<!-- -->
-<!-- ===================================================================== -->
-
-<!-- $Id$ -->
-
-<!--
- | For more configuration infromation and examples see the Jakarta Log4j
- | owebsite: http://jakarta.apache.org/log4j
- -->
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
-
-
- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out"/>
- <param name="Threshold" value="TRACE"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
- </layout>
- </appender>
-
- <category name="org.jboss.xb">
-
- </category>
-
-
- <!-- ======================= -->
- <!-- Setup the Root category -->
- <!-- ======================= -->
-
- <root>
- <appender-ref ref="CONSOLE"/>
- </root>
-</log4j:configuration>
Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml 2007-05-16 19:44:34 UTC (rev 2033)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml 2007-05-21 19:42:18 UTC (rev 2034)
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension-point id="archiveTypes" name="JBossIDE Package Type" schema="schema/archiveTypes.exsd"/>
- <extension
- id="archivesNature"
- name="JBossIDE Packages Nature"
- point="org.eclipse.core.resources.natures">
- <runtime>
- <run class="org.jboss.ide.eclipse.archives.core.build.ArchivesNature"/>
- </runtime>
- <builder id="org.jboss.ide.eclipse.archives.core.archivesBuilder"/>
- </extension>
- <extension
- id="archivesBuilder"
- name="JBossIDE Packages Builder"
- point="org.eclipse.core.resources.builders">
- <builder
- hasNature="true"
- >
- <run class="org.jboss.ide.eclipse.archives.core.build.ArchivesBuilder"/>
- </builder>
- </extension>
- <extension
- point="org.jboss.ide.eclipse.archives.core.archiveTypes">
- <packageType
- class="org.jboss.ide.eclipse.archives.core.model.types.JARArchiveType"
- id="jar"
- label="JAR"/>
- </extension>
- <extension
- point="org.eclipse.core.runtime.preferences">
- <initializer class="org.jboss.ide.eclipse.archives.core.CorePreferenceManager"/>
- </extension>
-
-</plugin>
17 years, 7 months
JBoss Tools SVN: r2033 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core: jbosscore/org/jboss/ide/eclipse/as/core/client and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-16 15:44:34 -0400 (Wed, 16 May 2007)
New Revision: 2033
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/JBossLaunchAdapter.java
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/server/JBossServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
EXIN-151 / JBIDE-472
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/JBossLaunchAdapter.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/JBossLaunchAdapter.java 2007-05-15 16:19:58 UTC (rev 2032)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/JBossLaunchAdapter.java 2007-05-16 19:44:34 UTC (rev 2033)
@@ -21,72 +21,99 @@
*/
package org.jboss.ide.eclipse.as.core.client;
-import org.eclipse.core.runtime.CoreException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
import org.eclipse.jst.server.core.EJBBean;
+import org.eclipse.jst.server.core.JndiLaunchable;
import org.eclipse.jst.server.core.JndiObject;
import org.eclipse.jst.server.core.Servlet;
import org.eclipse.wst.server.core.IModuleArtifact;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.IURLProvider;
import org.eclipse.wst.server.core.model.LaunchableAdapterDelegate;
import org.eclipse.wst.server.core.model.ServerDelegate;
+import org.eclipse.wst.server.core.util.HttpLaunchable;
import org.eclipse.wst.server.core.util.WebResource;
-import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.core.server.JBossServer;
public class JBossLaunchAdapter extends LaunchableAdapterDelegate {
public JBossLaunchAdapter() {
super();
}
+ private static final String JAVA_NAMING_PROVIDER_URL_PROPKEY = "java.naming.provider.url"; //$NON-NLS-1$
+ private static final String JAVA_NAMING_FACTORY_INITIAL_PROPKEY = "java.naming.factory.initial"; //$NON-NLS-1$
- // Can I launch onto this server? Let's find out
- public Object getLaunchable(IServer server, IModuleArtifact moduleArtifact)
- throws CoreException {
-
- // Only play to jboss servers
- IDeployableServer dserver = ServerConverter.getDeployableServer(server);
- if( dserver == null )
+ /*
+ * @see ILaunchableAdapterDelegate#getLaunchable(IServer, IModuleObject)
+ */
+ public Object getLaunchable(IServer server, IModuleArtifact moduleObject) {
+ ServerDelegate delegate = (ServerDelegate)server.loadAdapter(ServerDelegate.class,null);
+ if (!(delegate instanceof JBossServer))
return null;
-
-// if( isJstArtifact(moduleArtifact))
-// return prepareJstArtifact(moduleArtifact, dserver);
-
- return new NullLaunchable();
- }
-
- private boolean isJstArtifact(IModuleArtifact moduleArtifact ) {
- // If we have JST projects being launched......
- if ((moduleArtifact instanceof Servlet)) return true;
- if ((moduleArtifact instanceof WebResource)) return true;
- if ((moduleArtifact instanceof EJBBean)) return true;
- if ((moduleArtifact instanceof JndiObject)) return true;
-
- return false;
- }
-
- private Object prepareJstArtifact(IModuleArtifact moduleObject, ServerDelegate delegate) {
if ((moduleObject instanceof Servlet) ||(moduleObject instanceof WebResource))
- return prepareHttpLaunchable(moduleObject, delegate);
+ return prepareHttpLaunchable(moduleObject, (JBossServer) delegate);
if((moduleObject instanceof EJBBean) || (moduleObject instanceof JndiObject))
- return prepareJndiLaunchable(moduleObject,delegate);
+ return prepareJndiLaunchable(moduleObject, (JBossServer)delegate);
+ return null;
+ }
- return null;
- }
-
- private Object prepareHttpLaunchable(IModuleArtifact moduleObject, ServerDelegate delegate) {
-// try {
-// return new HttpLaunchable(new URL("http://www.google.com"));
-// } catch( Exception e ) {
-// }
-// return null;
- return new NullLaunchable();
- }
- private Object prepareJndiLaunchable(IModuleArtifact moduleObject, ServerDelegate delegate) {
-// Properties props = new Properties();
-// props.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
-// props.put("java.naming.provider.url","");
-// props.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
-// return new JndiLaunchable(props, "Hello");
- return new NullLaunchable();
- }
+ private Object prepareJndiLaunchable(IModuleArtifact moduleObject, JBossServer delegate) {
+ JndiLaunchable launchable = null;
+ Properties props = new Properties();
+// props.put(JAVA_NAMING_FACTORY_INITIAL_PROPKEY,definition.getJndiConnection().getInitialContextFactory());
+// props.put(JAVA_NAMING_PROVIDER_URL_PROPKEY,definition.getJndiConnection().getProviderUrl());
+// List jps = definition.getJndiConnection().getJndiProperty();
+// Iterator propsIt =jps.iterator();
+// while(propsIt.hasNext()){
+// ArgumentPair prop = (ArgumentPair)propsIt.next();
+// props.put(prop.getName(),prop.getValue());
+// }
+
+ if(moduleObject instanceof EJBBean)
+ {
+ EJBBean bean = (EJBBean)moduleObject;
+ launchable = new JndiLaunchable(props,bean.getJndiName());
+ }
+ if(moduleObject instanceof JndiObject)
+ {
+ JndiObject jndi = (JndiObject)moduleObject;
+ launchable = new JndiLaunchable(props,jndi.getJndiName());
+ }
+ return launchable;
+ }
+
+ /**
+ * @param moduleObject
+ * @param delegate
+ * @return object
+ */
+ private Object prepareHttpLaunchable(IModuleArtifact moduleObject, JBossServer delegate) {
+ try {
+ URL url = ((IURLProvider) delegate).getModuleRootURL(moduleObject.getModule());
+ if (moduleObject instanceof Servlet) {
+ Servlet servlet = (Servlet) moduleObject;
+ if (servlet.getAlias() != null) {
+ String path = servlet.getAlias();
+ if (path.startsWith("/")) //$NON-NLS-1$
+ path = path.substring(1);
+ url = new URL(url, path);
+ } else
+ url = new URL(url, "servlet/" + servlet.getServletClassName()); //$NON-NLS-1$
+ } else if (moduleObject instanceof WebResource) {
+ WebResource resource = (WebResource) moduleObject;
+ String path = resource.getPath().toString();
+ if (path != null && path.startsWith("/") && path.length() > 0) //$NON-NLS-1$
+ path = path.substring(1);
+ if (path != null && path.length() > 0)
+ url = new URL(url, path);
+ }
+ return new HttpLaunchable(url);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
Modified: 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-05-15 16:19:58 UTC (rev 2032)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/DescriptorModel.java 2007-05-16 19:44:34 UTC (rev 2033)
@@ -22,6 +22,7 @@
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;
@@ -121,23 +122,6 @@
}
- /*
- * Do preference stuff here to see if the directory is ignored.
- */
- private boolean isIgnoredDirectory(File f) {
- boolean found = false;
- List ignored = Arrays.asList(getIgnoredDirectories());
- while( f != null && !found ) {
- if( ignored.contains(f.getAbsoluteFile()))
- return true;
- f = f.getParentFile();
- }
- return false;
- }
-
- public String[] getIgnoredDirectories() {
- return new String[0];
- }
private Document getDocument(String path) {
// First get last time loaded.
@@ -206,14 +190,14 @@
}
public XPathTreeItem[] getXPath(String xpath, String attributeName) {
- return getXPath(xpath, attributeName, true);
+ return getXPath(xpath, attributeName, null);
}
- public XPathTreeItem[] getXPath(String xpath, String attributeName, boolean filter ) {
+ public XPathTreeItem[] getXPath(String xpath, String attributeName, FileFilter filter ) {
return getXPath(xpath, attributeName, filter, true);
}
- public XPathTreeItem[] getXPath(String xpath, String attributeName, boolean filter, boolean refresh ) {
+ public XPathTreeItem[] getXPath(String xpath, String attributeName, FileFilter filter, boolean refresh ) {
if( refresh )
refreshDescriptors(new NullProgressMonitor());
@@ -226,7 +210,7 @@
while(i.hasNext()) {
p = (String)i.next();
- if( !filter || !isIgnoredDirectory(new File(p))) {
+ if( filter == null || filter.accept(new File(p))) {
tmp = getXPathFromFile(p, xpath);
if( tmp.size() > 0 ) {
if( attributeName == null || attributeName.equals("")) {
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-05-15 16:19:58 UTC (rev 2032)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java 2007-05-16 19:44:34 UTC (rev 2033)
@@ -22,6 +22,8 @@
package org.jboss.ide.eclipse.as.core.server;
import java.io.File;
+import java.io.FileFilter;
+import java.net.URL;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
@@ -32,14 +34,18 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jst.server.core.IWebModule;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.internal.Server;
+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.runtime.IJBossServerLaunchDefaults;
import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.runtime.server.ServerLaunchDefaults;
@@ -48,7 +54,7 @@
import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
public class JBossServer extends ServerDelegate
- implements IServerStartupParameters, IDeployableServer {
+ implements IServerStartupParameters, IDeployableServer, IURLProvider {
public JBossServer() {
@@ -185,4 +191,49 @@
return new Path(p).toOSString();
}
+
+
+
+ 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$
+
+ url += "/"+webModule.getContextRoot(); //$NON-NLS-1$
+
+ if (!url.endsWith("/")) //$NON-NLS-1$
+ url += "/"; //$NON-NLS-1$
+
+ return new URL(url);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+
}
\ No newline at end of file
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-05-15 16:19:58 UTC (rev 2032)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-05-16 19:44:34 UTC (rev 2033)
@@ -262,7 +262,6 @@
</moduleArtifactAdapter>
</extension>
- <!--
<extension
point="org.eclipse.wst.server.core.launchableAdapters">
<launchableAdapter
@@ -270,6 +269,7 @@
id="org.jboss.ide.eclipse.as.core.launchableAdapter1"/>
</extension>
+ <!--
<extension
point="org.eclipse.wst.server.core.clients">
17 years, 7 months
JBoss Tools SVN: r2032 - trunk/as/plugins/org.jboss.ide.eclipse.as.core.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-15 12:19:58 -0400 (Tue, 15 May 2007)
New Revision: 2032
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
EXIN-151 / JBIDE-472
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-05-14 13:53:21 UTC (rev 2031)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-05-15 16:19:58 UTC (rev 2032)
@@ -262,6 +262,7 @@
</moduleArtifactAdapter>
</extension>
+ <!--
<extension
point="org.eclipse.wst.server.core.launchableAdapters">
<launchableAdapter
@@ -279,10 +280,10 @@
name="Take No Action"
priority="20"/>
</extension>
+-->
-
<!-- How to determine whether the server is up or down -->
<extension
point="org.jboss.ide.eclipse.as.core.pollers">
17 years, 7 months
JBoss Tools SVN: r2031 - trunk/documentation/GettingStartedGuide/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: afedosik
Date: 2007-05-14 09:53:21 -0400 (Mon, 14 May 2007)
New Revision: 2031
Modified:
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedStrutsValidationExamples.xml
Log:
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedStrutsValidationExamples.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedStrutsValidationExamples.xml 2007-05-14 13:16:50 UTC (rev 2030)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedStrutsValidationExamples.xml 2007-05-14 13:53:21 UTC (rev 2031)
@@ -49,6 +49,7 @@
<listitem><para>Drag up the sample.applResources icon until you can drop it on the resources folder under struts-config.xml.</para></listitem>
<listitem><para>Select File/Save All from the menu bar.</para></listitem>
+<listitem><para>Select validation.xml under the StrutsHello/Validation node and double-click it to open it with the Red Hat Developer Studio Validation Editor.</para></listitem>
<listitem><para>Select validation.xml under the StrutsHello/Validation node and double-click it to open it with the Red Hat Studio Validation Editor.</para></listitem>
<listitem><para>Expand the form-beans node under the StrutsHello/Configuration/default/ struts-config.xml node. Then, drag the form bean GetNameForm and drop it onto formset (default) in the Validation Editor.</para></listitem>
<listitem><para>In the Validation Editor, expand the formset node, right-click GetNameForm, and select Add Field... from the context menu.</para></listitem>
@@ -76,10 +77,9 @@
<listitem><para>Double-click inputname.jsp under StrutsHello/WEB-ROOT (WebContent)/ pages to open it for editing.</para></listitem>
<listitem><para>Find the tag near the top and hit Return to make a new line under it.</para></listitem>
<listitem><para>In the Red Hat Palette view to the right, open the HTML folder and click on the javascript tag.</para></listitem>
-
-<listitem><para>Back in the editor, just in front of the closing slash for this inserted tag, hit Ctrlspace and select formName from the prompting menu.</para></listitem>
+<listitem><para>Back in the editor, just in front of the closing slash for this inserted tag, hit Ctrl+Space and select formName from the prompting menu.</para></listitem>
<listitem><para>Over in the Web Projects view, select GetNameForm under the StrutsHello/Configuration/ default/struts-config.xml/form-beans node, drag it, and drop it between the quotes in the editor.</para></listitem>
-<listitem><para>Modify the >html:form< tag by inserting this attribute:</para></listitem>
+<listitem><para>Modify the <html:form> tag by inserting this attribute:</para></listitem>
</orderedlist>
<para>onsubmit="return validateGetNameForm(this)"</para>
<para>The file should now look like this:</para>
@@ -87,29 +87,31 @@
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html>
<head>
-<title>Input name</title>
-<html:javascript formName="GetNameForm"/>
+ <title>Input name</title>
+ <html:javascript formName="GetNameForm"/>
</head>
<body>
-<html:form action="/greeting.do" onsubmit="return
-<para>validateGetNameForm(this)"></para>
-<table border="0" cellspacing="0" cellpadding="0">
-<tr>
-<td><b>Input name:</b></td>
-</tr>
-<tr>
-<td>
-<html:text property="name" />
-<html:submit value=" Say Hello! " />
-</td>
-</tr>
-</table>
-</html:form>
+ <html:form action="/greeting.do" onsubmit="return
+ <para>validateGetNameForm(this)"></para>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td><b>Input name:</b></td>
+ </tr>
+ <tr>
+ <td>
+ <html:text property="name" />
+ <html:submit value=" Say Hello! " />
+ </td>
+ </tr>
+ </table>
+ </html:form>
</body>
</html:html>
]]></programlisting>
<orderedlist continuation="continues">
<listitem><para>Select File/Save from the menu bar.</para></listitem>
+<listitem><para>28. Start JBoss Application Server by clicking on its icon (a right-pointing arrow) in the toolbar.</para></listitem>
+<listitem><para>29. Click on the Run icon in the toolbar.</para></listitem>
<listitem><para>Start Tomcat by clicking on its icon (a right-pointing arrow) in the toolbar.</para></listitem>
<listitem><para>Click on the Run icon in the toolbar.</para></listitem>
</orderedlist>
@@ -139,9 +141,9 @@
<title>Editing the JSP File</title>
<orderedlist continuation="continues">
<listitem><para>Reopen inputname.jsp for editing.</para></listitem>
-<listitem><para>Delete the onsubmit attribute in the >html:form< element that you put in for client-side validation.</para></listitem>
+<listitem><para>Delete the onsubmit attribute in the <html:form> element that you put in for client-side validation.</para></listitem>
-<listitem><para>Add an >html:errors/> tag after the >/html:form> tag.</para></listitem>
+<listitem><para>Add an <html:errors/> tag after the </html:form> tag.</para></listitem>
</orderedlist>
<para>The JSP file should now look like this:</para>
@@ -149,24 +151,24 @@
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html>
<head>
-<title>Input name</title>
-<html:javascript formName="GetNameForm"/>
+ <title>Input name</title>
+ <html:javascript formName="GetNameForm"/>
</head>
<body>
-<html:form action="/greeting.do">
-<table border="0" cellspacing="0" cellpadding="0">
-<tr>
-<td><b>Input name:</b></td>
-</tr>
-<tr>
-<td>
-<html:text property="name" />
-<html:submit value=" Say Hello! " />
-</td>
-</tr>
-</table>
-</html:form>
-<html:errors />
+ <html:form action="/greeting.do">
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td><b>Input name:</b></td>
+ </tr>
+ <tr>
+ <td>
+ <html:text property="name" />
+ <html:submit value=" Say Hello! " />
+ </td>
+ </tr>
+ </table>
+ </html:form>
+ <html:errors />
</body>
</html:html>
]]></programlisting>
@@ -181,7 +183,7 @@
<listitem><para>In the Edit Properties window, insert the cursor into the value column for the input property and click on the ... button.</para></listitem>
-<listitem><para>In the dialog box, make sure the Pages tab is selected, select StrutsHello/WEBROOT( WebContent)/pages/ inputname.jsp, click the Ok button, and then click on the Close button.</para></listitem>
+<listitem><para>In the dialog box, make sure the Pages tab is selected, select StrutsHello/WEB-ROOT(WebContent)/pages/inputname.jsp, click the Ok button, and then click on the Close button.</para></listitem>
</orderedlist>
</section>
<section id="EditingTheFormBean">
@@ -196,42 +198,50 @@
<para>The file should now look like this:</para>
<programlisting role="JAVA"><![CDATA[
package sample;
+
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
public class GetNameForm extends
+
org.apache.struts.validator.ValidatorForm {
-private String name = "";
-/**
-* @return Returns the name.
-*/
-public String getName() {
-return name;
+
+ private String name = "";
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public GetNameForm () {
+ }
+
+ public void reset(ActionMapping actionMapping,
+ HttpServletRequest request) {
+ this.name = "";
+ }
+
+ // public ActionErrors validate(ActionMapping actionMapping,
+ HttpServletRequest request) {
+ // ActionErrors errors = new ActionErrors();
+ // return errors;
+ // }
}
-/**
-* @param name The name to set.
-*/
-public void setName(String name) {
-this.name = name;
-}
-public GetNameForm () {
-}
-public void reset(ActionMapping actionMapping, HttpServletRequest
-request) {
-this.name = "";
-}
-// public ActionErrors validate(ActionMapping actionMapping,
-HttpServletRequest request) {
-// ActionErrors errors = new ActionErrors();
-// return errors;
-// }
-}
]]></programlisting>
<para>Select File/Save All from the menu bar.</para>
<orderedlist continuation="continues">
-<listitem><para>Reload the application into Tomcat by clicking on the Change Time Stamp icon (a finger pointing with a little star) in the toolbar.</para></listitem>
+<listitem><para>Reload the application into JBoss AS by clicking on the Change Time Stamp icon (a finger pointing with a little star) in the toolbar.</para></listitem>
<listitem><para>Run the application.</para></listitem>
<listitem><para>In the browser window, click on the Say Hello! button without having entered any name in the form.</para></listitem>
</orderedlist>
17 years, 8 months
JBoss Tools SVN: r2030 - trunk/documentation/GettingStartedGuide/docs/userguide/en/images.
by jbosstools-commits@lists.jboss.org
Author: afedosik
Date: 2007-05-14 09:16:50 -0400 (Mon, 14 May 2007)
New Revision: 2030
Added:
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/strgreeting.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/strinputname.png
Log:
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/strgreeting.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/strgreeting.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/strinputname.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/strinputname.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 8 months
JBoss Tools SVN: r2029 - trunk/documentation/GettingStartedGuide/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: afedosik
Date: 2007-05-14 09:16:25 -0400 (Mon, 14 May 2007)
New Revision: 2029
Modified:
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforCreatingaStrutsApplication.xml
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedStrutsValidationExamples.xml
Log:
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforCreatingaStrutsApplication.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforCreatingaStrutsApplication.xml 2007-05-11 17:16:36 UTC (rev 2028)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforCreatingaStrutsApplication.xml 2007-05-14 13:16:25 UTC (rev 2029)
@@ -41,7 +41,7 @@
first. (We dont have to complete all of the details inside the components until afterwards.)</para>
<section id="CreatingJSPPagePlaceholders">
<title>Creating JSP Page Placeholders</title>
-<para>Next, lets create and place two JSP pages. We will not write any code for the files, but only
+ <para>Next, let's create and place two JSP pages. We will not write any code for the files, but only
create them as placeholders so that we can create links to them in the diagram. We will write
the code a little bit later.</para>
<section id="CreatingthePagePlaceholders">
@@ -81,10 +81,11 @@
</orderedlist>
<table>
<tgroup cols="2">
+ <tbody>
<row>
- <entry>path</entry>
- <entry>/greeting</entry>
- </row>
+ <entry>path</entry>
+ <entry>/greeting</entry>
+ </row>
<row>
<entry>name</entry>
<entry>GetNameForm</entry>
@@ -101,6 +102,7 @@
<entry>validate</entry>
<entry><leave blank></entry>
</row>
+ </tbody>
</tgroup>
</table>
<para>(GetNameForm is the name for a form bean that we will create later.)</para>
@@ -113,9 +115,19 @@
</section>
<section id="CreatingaLink">
<title>Creating a Link</title>
-<para>Lets now create a link from the inputname.jsp page to the action.</para>
+<para>Let's now create a link from the inputname.jsp page to the action.</para>
<orderedlist continuation="continues">
<listitem><para>On the left-hand side of the diagram in the column of icons, click on this icon:</para></listitem>
+ </orderedlist>
+ <figure>
+ <title>Create New Connection Icon</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/arrow.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <orderedlist continuation="continues">
<listitem><para>In the connect-the-components mode you are in now, click on the /pages/inputname.jsp icon in the diagram and then click on the /greeting action.</para></listitem>
</orderedlist>
<para>A link will be created from the page to the action.</para>
@@ -125,6 +137,16 @@
<para>Next, we are going to create a forward for the action.</para>
<orderedlist continuation="continues">
<listitem><para>On the left-hand side of the diagram in the column of icons, click on this icon, again:</para></listitem>
+ </orderedlist>
+ <figure>
+ <title>Create New Connection Icon</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/arrow.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <orderedlist continuation="continues">>
<listitem><para>Click on the /greeting action icon in the diagram and then click on the /pages/greeting.jsp icon.</para></listitem>
<listitem><para>Thats it. A link will be drawn from the actions new greeting forward to the greeting.jsp JSP page. Note that the forwards name will be set based on the name of the target JSP file
@@ -151,7 +173,15 @@
<para>A forward object now appears on the diagram and also in the global-forwards folder in the Outline view.</para>
<orderedlist continuation="continues">
<listitem><para>Tidy up the diagram, by clicking and dragging around each icon, so that the diagram looks something like this:</para></listitem>
- </orderedlist>
+ </orderedlist>
+ <figure>
+ <title>Diagram View</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/Diagram.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
</section>
<section id="CreatingaFormBean">
<title>Creating a Form Bean</title>
@@ -334,12 +364,30 @@
<listitem><para>Select the Visual pane of the editor.</para></listitem>
<listitem><para>Then, in the Red Hat Palette, expand the Struts Form library, select text, and drag it onto the box.</para></listitem>
-<listitem><para>In the Insert Tag dialog box, type in name for property and select Finish.</para></listitem>
+ </orderedlist>
+ <figure>
+ <title>Red Hat Palette</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/RH_Palette.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <orderedlist continuation="continues">
+ <listitem><para>In the Insert Tag dialog box, type in name for property and select Finish.</para></listitem>
<listitem><para>In the Struts Form library in the Red Hat Palette, select submit, and drag it to right after the the text box in the Visual pane of the editor.</para></listitem>
<listitem><para>Right-click the submit button and select <html:submit> Attributes from the context menu.</para></listitem>
<listitem><para>In the Attributes dialog box, select the value field and type in Say Hello! for its value.</para></listitem>
</orderedlist>
<para>After tidying the page source, the Editor window for the file should look something like this:</para>
+ <figure>
+ <title>Editor window</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/strinputname.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
</section>
<section id="greeting.jsp">
<title>greeting.jsp</title>
@@ -376,6 +424,14 @@
<listitem><para>Type in GetNameForm for the name attribute and add a property attribute with greetName as its value.</para></listitem>
</orderedlist>
<para>The editor should should now look like this:</para>
+ <figure>
+ <title>Editor window</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/strgreeting.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
</section>
<section id="index.jsp">
<title>index.jsp</title>
@@ -415,6 +471,14 @@
<para>Everything is now ready for running our applicationwithout having to leave Red Hat Developer Studio
by using the JBoss Application Server engine that comes with the Red Hat Developer Studio plug-in. For controlling
JBoss AS within Red Hat Developer Studio, the toolbar contains a panel.</para>
+ <figure>
+ <title>JBoss Server Panel</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/running.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
<orderedlist continuation="continues">
<listitem>Start up JBoss AS by clicking on the first icon from left in this panel. (If JBoss AS is
already running, stop it by clicking on the third icon from the left and then start it
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedStrutsValidationExamples.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedStrutsValidationExamples.xml 2007-05-11 17:16:36 UTC (rev 2028)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedStrutsValidationExamples.xml 2007-05-14 13:16:25 UTC (rev 2029)
@@ -49,7 +49,7 @@
<listitem><para>Drag up the sample.applResources icon until you can drop it on the resources folder under struts-config.xml.</para></listitem>
<listitem><para>Select File/Save All from the menu bar.</para></listitem>
-<listitem><para>Select validation.xml under the StrutsHello/Validation node and double-click it to open it with the Exadel Studio Validation Editor.</para></listitem>
+<listitem><para>Select validation.xml under the StrutsHello/Validation node and double-click it to open it with the Red Hat Studio Validation Editor.</para></listitem>
<listitem><para>Expand the form-beans node under the StrutsHello/Configuration/default/ struts-config.xml node. Then, drag the form bean GetNameForm and drop it onto formset (default) in the Validation Editor.</para></listitem>
<listitem><para>In the Validation Editor, expand the formset node, right-click GetNameForm, and select Add Field... from the context menu.</para></listitem>
<listitem><para>Enter name for Property in the dialog box.</para></listitem>
@@ -110,14 +110,14 @@
]]></programlisting>
<orderedlist continuation="continues">
<listitem><para>Select File/Save from the menu bar.</para></listitem>
-<listitem><para>28. Start Tomcat by clicking on its icon (a right-pointing arrow) in the toolbar.</para></listitem>
-<listitem><para>29. Click on the Run icon in the toolbar.</para></listitem>
+<listitem><para>Start Tomcat by clicking on its icon (a right-pointing arrow) in the toolbar.</para></listitem>
+<listitem><para>Click on the Run icon in the toolbar.</para></listitem>
</orderedlist>
<figure>
<title></title>
<mediaobject>
<imageobject>
- <imagedata fileref="img/"/>
+ <imagedata fileref="images/run.png"/>
</imageobject>
</mediaobject>
</figure>
17 years, 8 months
JBoss Tools SVN: r2028 - in trunk/as/docs/reference/en: images and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-11 13:16:36 -0400 (Fri, 11 May 2007)
New Revision: 2028
Added:
trunk/as/docs/reference/en/images/archives/publish.jpg
trunk/as/docs/reference/en/images/projects/
trunk/as/docs/reference/en/images/projects/wizard1.jpg
trunk/as/docs/reference/en/images/projects/wizard2.jpg
trunk/as/docs/reference/en/modules/deploy.xml
trunk/as/docs/reference/en/modules/projects.xml
Modified:
trunk/as/docs/reference/en/master.xml
trunk/as/docs/reference/en/modules/archives.xml
Log:
First draft done
Added: trunk/as/docs/reference/en/images/archives/publish.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/as/docs/reference/en/images/archives/publish.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/docs/reference/en/images/projects/wizard1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/as/docs/reference/en/images/projects/wizard1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/docs/reference/en/images/projects/wizard2.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/as/docs/reference/en/images/projects/wizard2.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/as/docs/reference/en/master.xml
===================================================================
--- trunk/as/docs/reference/en/master.xml 2007-05-11 16:37:20 UTC (rev 2027)
+++ trunk/as/docs/reference/en/master.xml 2007-05-11 17:16:36 UTC (rev 2028)
@@ -6,6 +6,8 @@
<!ENTITY runtimesAndServers SYSTEM "modules/runtimesAndServers.xml">
<!ENTITY asPerspective SYSTEM "modules/thePerspective.xml">
<!ENTITY archives SYSTEM "modules/archives.xml">
+<!ENTITY facetedProjects SYSTEM "modules/projects.xml">
+<!ENTITY deploying SYSTEM "modules/deploy.xml">
]>
@@ -23,5 +25,6 @@
&runtimesAndServers;
&asPerspective;
&archives;
-
+&facetedProjects;
+&deploying;
</book>
Modified: trunk/as/docs/reference/en/modules/archives.xml
===================================================================
--- trunk/as/docs/reference/en/modules/archives.xml 2007-05-11 16:37:20 UTC (rev 2027)
+++ trunk/as/docs/reference/en/modules/archives.xml 2007-05-11 17:16:36 UTC (rev 2028)
@@ -129,7 +129,8 @@
an excludes pattern. As you type in either of these fields,
the preview viewer should update itself with which files are matched.</para>
</section>
- <section><title>View Actions</title>
+ </section>
+ <section><title>View Actions</title>
<para>
The context menu on the items in the view is extendable, but there are
several that come standard. The first is the <emphasis>Build Archive</emphasis>
@@ -138,13 +139,33 @@
not needing an explanation. The edit action brings up the wizard associated
with that particular node type and allows the details to be changed. The final
action contribution here is the ability to publish to a declared server.</para>
- <section><title>Publishing to a server</title>
+ </section>
+ <section><title>The Publish to Server Action</title>
+ <figure id="publishAction"> <title>Publish to Server</title>
+ <mediaobject>
+ <alt>Publish to Server</alt>
+ <imageobject>
+ <imagedata
+ fileref="..\..\..\..\reference\en\images\archives\publish.jpg"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The dialog above appears after selecting <emphasis>Publish to Server</emphasis>.
+ To simply publish once, you just select the server(s) that you want, and
+ finish. If you want the <emphasis>Publish to Server</emphasis> action
+ on that particular Archive to <emphasis>always</emphasis> publish to
+ that set of servers, then check the appropriate checkbox. And finally, to
+ enable automatic publishing upon build events, check the last checkbox.</para>
+ <para>
+ The automatic publishing feature is nice if, for example, your
+ package's destination (where it is built) is a temporary folder and
+ you want the archive published to several servers. If you only really want your
+ archive published to one server, it might be easier to have the archive's
+ destination folder be the deploy folder of the server.</para>
- </section>
+
</section>
- </section>
-
-
</section>
Added: trunk/as/docs/reference/en/modules/deploy.xml
===================================================================
--- trunk/as/docs/reference/en/modules/deploy.xml (rev 0)
+++ trunk/as/docs/reference/en/modules/deploy.xml 2007-05-11 17:16:36 UTC (rev 2028)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<chapter id="deploy">
+ <title>Deploying Modules</title>
+
+ <para>
+ Deploying to a server is mostly painless.
+ There are several ways to do it provided by Webtools,
+ and some additional methods provided by RHDS. </para>
+ <section><title>WTP Projects</title>
+ <section><title>Run On Server</title>
+ <para>
+ The first WTP method is to right-click on a webtools project,
+ such as a dynamic web project, ejb project, or ear project.
+ and then selecting <emphasis>run on server...</emphasis>.
+ The resulting dialog allows you to select which supporting
+ server the project can be published to. </para>
+ <para>
+ For the JBoss AS Server Adapters, publishing using this method
+ will force a default, best-guess, packaging configuration
+ for your project. This best-guess does <emphasis>not</emphasis>
+ publish incrementally, but instead repackages your entire
+ project into a .war, .jar, or .ear as appropriate, and
+ then coppies that file into the proper deploy directory.
+ For quicker smarter deployment, you will need to create
+ archives using the <emphasis>Project Archives</emphasis>
+ view and customize packaging yourself.</para>
+ </section>
+ <section><title>Add / Remove Projects</title>
+ <para>
+ Another method is in either the Servers View, or the JBoss
+ Servers View, to right click on a server and select
+ the <emphasis>Add or Remove Projects</emphasis> menu item.
+ This will bring up a dialog allowing you to either publish
+ projects / modules to a server, or remove them from the server.</para>
+
+ <para>
+ If the selected module is a webtools project,
+ it will be published as in the <emphasis>Run on Server</emphasis>
+ option, with a best-guess full package. If, however, the selected
+ element is an archive from the <emphasis>Project Archives View</emphasis>,
+ it will be published according to the rules of that module type, which
+ are explained below.</para>
+ </section>
+ <section><title>JBoss Servers View, Publish</title>
+ <para>
+ In the JBoss Server's View, in the bottom section, is a
+ category called <emphasis>Modules</emphasis> which should
+ display all currently-published modules on the server.
+ By right-clicking on the desired module and selecting
+ <emphasis>Publish</emphasis>, it will force a full
+ rebuild of the entire module. </para>
+ </section>
+ <section><title>Project Archives View</title>
+ <para>In the Project Archives View, you can
+ right-click on any declared archive and select the
+ <emphasis>Publish To Server</emphasis> element, as described in
+ the last chapter. </para>
+ <para>
+ The ONLY WAY to ensure an <emphasis>Incremental Build</emphasis>,
+ such as changes to one jsp, html, or .class file, is to
+ enable the builder for that project. This is done by either changing
+ the global preferences for the Archives View, or in enabling
+ project-specific preferences and ensuring the builder is on.</para>
+ </section>
+ <!--
+ <figure id="viewMain"> <title>JBoss Servers View: Main Section</title>
+ <mediaobject>
+ <alt>JBoss Servers View Main Section</alt>
+ <imageobject>
+ <imagedata
+ fileref="..\..\..\..\reference\en\images\asPerspective\viewMain.jpg"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ -->
+ </section>
+ </chapter>
Added: trunk/as/docs/reference/en/modules/projects.xml
===================================================================
--- trunk/as/docs/reference/en/modules/projects.xml (rev 0)
+++ trunk/as/docs/reference/en/modules/projects.xml 2007-05-11 17:16:36 UTC (rev 2028)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<chapter id="webtoolsProjects">
+ <title>Webtools Projects</title>
+ <section><title>Description</title>
+ <para>
+ Webtools provides what are called "faceted" projects,
+ Their most popular such projects are their J2EE projects,
+ such as their Dynamic Web Project, their EJB Project,
+ or their EAR project. </para>
+ <para>
+ The idea behind faceted projects is that each project
+ can accept units of functionality, or facets, which can be
+ added or removed by the user. Some examples of these facets
+ are adding a webdoclet facet to a web project, or an
+ ejbdoclet to an EJB Project. </para>
+ <para>
+ Most often, these "facets" either add to the project's classpath,
+ enable a builder, or watch the project in some other fashion. </para>
+ <para>
+ WTP projects have undergone some criticism as being
+ <emphasis>over-engineered</emphasis> or too restrictive in their
+ design. WTP projects are set up in a tree-relationship to each other,
+ where one project can be a child of another. For example, an EAR
+ project may have a Web Project child, an EJB project child,
+ or other types. </para>
+ <para>
+ The benefit of this is that the structure of your projects is
+ then known, and packaging it up *should* be trivial. However,
+ if your project is non-standard, or you feel too confined by
+ such rigid structural requirements, you can still choose to
+ package your project using the Archives plugin as described
+ in the last chapter</para>
+
+ </section>
+ <section><title>Faceted Project Wizards</title>
+ <figure id="faceted1"> <title>Faceted Project Wizard: First Page</title>
+ <mediaobject>
+ <alt>Faceted Project Wizard: First Page</alt>
+ <imageobject>
+ <imagedata width="5in" scalefit="0"
+ fileref="..\..\..\..\reference\en\images\projects\wizard1.jpg"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The first page of most WTP projects allows you to target a specific runtime,
+ representing a server's library location. It will also provide you the ability to
+ add this project to an EAR project, and select a pre-selected default set of facets,
+ called a configuration, rather than manually select each facet you might want.</para>
+ <para>
+ Selecting the runtime, again, allows the project to install the proper
+ classpaths to the project so it knows what code to compile against.</para>
+ <figure id="faceted2"> <title>Faceted Project Wizard: Second Page</title>
+ <mediaobject>
+ <alt>Faceted Project Wizard: Second Page</alt>
+ <imageobject>
+ <imagedata width="5in" scalefit="0"
+ fileref="..\..\..\..\reference\en\images\projects\wizard2.jpg"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The second page of the wizard allows you to enable or disable specific facets, as
+ described above. Some facets may require others, and some may conflict with others,
+ but on the whole this page allows you to add any number of facets that don't conflict
+ with each other. </para>
+ <para>
+ Further pages are specific to either hte project type, or the facets selected.</para>
+ </section>
+</chapter>
17 years, 8 months