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();
+ }
+ }
+
+}