JBoss Tools SVN: r2716 - trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-07-30 09:41:57 -0400 (Mon, 30 Jul 2007)
New Revision: 2716
Modified:
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java
Log:
don't make string constants public if not a public constant..
Modified: trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java
===================================================================
--- trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java 2007-07-30 13:07:15 UTC (rev 2715)
+++ trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java 2007-07-30 13:41:57 UTC (rev 2716)
@@ -67,7 +67,7 @@
}
}
- public static final String JBOSS_AS_HOME = "../../../../jboss-eap/jboss-as";
+ private static final String JBOSS_AS_HOME = "../../../../jboss-eap/jboss-as";
static public String assumeJBossASHome() {
String pluginLocation=null;
17 years, 4 months
JBoss Tools SVN: r2715 - trunk/documentation/GettingStartedGuide/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: afedosik
Date: 2007-07-30 09:07:15 -0400 (Mon, 30 Jul 2007)
New Revision: 2715
Modified:
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedWithRHDS.xml
Log:
minor update
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedWithRHDS.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedWithRHDS.xml 2007-07-30 09:34:05 UTC (rev 2714)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedWithRHDS.xml 2007-07-30 13:07:15 UTC (rev 2715)
@@ -38,6 +38,12 @@
<programlisting><![CDATA[#In this example /usr/java/jdk1.5.0_11 is the JDK installation directory.
export JAVA_HOME=/usr/java/jdk1.5.0_11
export PATH=$PATH:$JAVA_HOME/bin]]></programlisting>
+ <note>
+ <title>Note:</title>
+ <para>When you add $JAVA_HOME/bin to $PATH, you should add it <emphasis role="bold">before</emphasis> the old $PATH not after it. This way, the machine will pick up the new JVM first.
+ You only need to run "alternative" as a safe guard for the right JVM.</para>
+ </note>
+
<para>Set this variable for the user account doing the installation and also for the user account that will run the server.</para>
<itemizedlist>
<listitem><para>If you have more than one version of JVM installed in your machine, make sure you are using the JDK1.5 installation as the default java and javac.
17 years, 4 months
JBoss Tools SVN: r2714 - in trunk/seam/plugins: org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-07-30 05:34:05 -0400 (Mon, 30 Jul 2007)
New Revision: 2714
Modified:
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenProperty.java
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions/SetupDeluxeAction.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java
Log:
http://jira.jboss.org/jira/browse/EXIN-287
http://jira.jboss.org/jira/browse/EXIN-302
Seam gen now have three parameters initialized if installed with RHDS:
1. JBoss AS Home
2. Path to current Eclipse Workspace
3. Seam-gen build.xml
Modified: trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java
===================================================================
--- trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java 2007-07-28 01:46:15 UTC (rev 2713)
+++ trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java 2007-07-30 09:34:05 UTC (rev 2714)
@@ -3,9 +3,11 @@
import java.io.File;
import java.io.IOException;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -13,6 +15,7 @@
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.jboss.ide.seam.gen.actions.SeamGenAction;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamFacetPreference;
import org.osgi.framework.BundleContext;
@@ -50,12 +53,13 @@
} catch (CoreException e1) {
logError("Exception occured during search in Launch Configuration list.", e1);
}
- String buildXmlPath = null;
+ File buildXmlPath = null;
if(config==null) {
try {
String seamHome = SeamFacetPreference.getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER);
- buildXmlPath = seamHome+File.separator+"seam-gen"+File.separator+"build.xml";
- SeamGenAction.createSeamgenLaunchConfig(buildXmlPath);
+ buildXmlPath = new File(seamHome+File.separator+"seam-gen"+File.separator+"build.xml");
+ if(buildXmlPath.exists())
+ SeamGenAction.createSeamgenLaunchConfig(buildXmlPath.getAbsolutePath());
} catch (CoreException e) {
logError("Cannot create configuration for Seam-Gen tool. Seamgen build.xml file: " + buildXmlPath, e);
return;
@@ -63,6 +67,29 @@
}
}
+ public static final String JBOSS_AS_HOME = "../../../../jboss-eap/jboss-as";
+
+ static public String assumeJBossASHome() {
+ String pluginLocation=null;
+ try {
+ pluginLocation = FileLocator.resolve(SeamGenPlugin.getDefault().getBundle().getEntry("/")).getFile();
+ } catch (IOException e) {
+ SeamGenPlugin.log(new Status(IStatus.ERROR,SeamGenPlugin.PLUGIN_ID,e.getMessage(),e));
+ };
+ File seamGenDir = new File(pluginLocation, JBOSS_AS_HOME);
+ Path p = new Path(seamGenDir.getPath());
+ p.makeAbsolute();
+ if(p.toFile().exists()) {
+ return p.toOSString();
+ } else {
+ return "";
+ }
+ }
+
+ public static String assumeWorkspacePath() {
+ return ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
+ }
+
static public ILaunchConfiguration findLaunchConfig(String name) throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType( "org.eclipse.ant.AntLaunchConfigurationType" );
Modified: trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenProperty.java
===================================================================
--- trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenProperty.java 2007-07-28 01:46:15 UTC (rev 2713)
+++ trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenProperty.java 2007-07-30 09:34:05 UTC (rev 2714)
@@ -66,7 +66,12 @@
public void applyValue(Properties existing, Control control) {
if(getDefaultPropertyName()==null) return;
- String property = existing==null?null:existing.getProperty( getDefaultPropertyName() );
+ String property = "";
+ if(existing == null || existing.get(getDefaultPropertyName())==null) {
+ property = getDefaultValue(existing)==null?"":getDefaultValue(existing);
+ } else {
+ property = existing.getProperty( getDefaultPropertyName() );
+ }
if(property!=null) {
if(control instanceof Text) {
((Text)control).setText( property );
Modified: trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions/SetupDeluxeAction.java
===================================================================
--- trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions/SetupDeluxeAction.java 2007-07-28 01:46:15 UTC (rev 2713)
+++ trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions/SetupDeluxeAction.java 2007-07-30 09:34:05 UTC (rev 2714)
@@ -8,6 +8,7 @@
import java.util.Set;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.jboss.ide.seam.gen.SeamGenPlugin;
import org.jboss.ide.seam.gen.SeamGenProperty;
public class SetupDeluxeAction extends SeamGenAction implements
@@ -51,7 +52,7 @@
"Seam project workspace", "workspace.home" ) {
public String getDefaultValue(Properties others) {
String property = others.getProperty( "workspace.home",
- "c:/projects" );
+ SeamGenPlugin.assumeWorkspacePath() );
return property;
}
@@ -77,7 +78,7 @@
"JBoss AS home directory", "jboss.home" ) {
public String getDefaultValue(Properties others) {
String property = others.getProperty( "jboss.home.new",
- "C:/Program Files/jboss-4.0.5.GA" );
+ SeamGenPlugin.assumeJBossASHome() );
return property;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java 2007-07-28 01:46:15 UTC (rev 2713)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java 2007-07-30 09:34:05 UTC (rev 2714)
@@ -55,7 +55,7 @@
Path p = new Path(seamGenDir.getPath());
p.makeAbsolute();
if(p.toFile().exists()) {
- return p.toFile().getAbsolutePath();
+ return p.toOSString();
} else {
return "";
}
17 years, 5 months
JBoss Tools SVN: r2713 - in trunk/seam/plugins/org.jboss.ide.seam.gen: src/org/jboss/ide/seam/gen and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-07-27 21:46:15 -0400 (Fri, 27 Jul 2007)
New Revision: 2713
Modified:
trunk/seam/plugins/org.jboss.ide.seam.gen/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java
Log:
http://jira.jboss.com/jira/browse/EXIN-287
seam-gen/build.xml path initialization is added
Modified: trunk/seam/plugins/org.jboss.ide.seam.gen/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.ide.seam.gen/META-INF/MANIFEST.MF 2007-07-28 01:42:37 UTC (rev 2712)
+++ trunk/seam/plugins/org.jboss.ide.seam.gen/META-INF/MANIFEST.MF 2007-07-28 01:46:15 UTC (rev 2713)
@@ -16,7 +16,8 @@
org.eclipse.ant.ui,
org.eclipse.core.filesystem,
org.eclipse.datatools.connectivity,
- org.eclipse.datatools.connectivity.db.generic
+ org.eclipse.datatools.connectivity.db.generic,
+ org.jboss.tools.seam.core
Bundle-ClassPath: org.jboss.ide.seam.gen.jar
Export-Package: org.jboss.ide.seam.gen,
org.jboss.ide.seam.gen.actions
Modified: trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java
===================================================================
--- trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java 2007-07-28 01:42:37 UTC (rev 2712)
+++ trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java 2007-07-28 01:46:15 UTC (rev 2713)
@@ -1,9 +1,19 @@
package org.jboss.ide.seam.gen;
+import java.io.File;
+import java.io.IOException;
+
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.ide.seam.gen.actions.SeamGenAction;
+import org.jboss.tools.seam.core.project.facet.SeamFacetPreference;
import org.osgi.framework.BundleContext;
/**
@@ -30,8 +40,43 @@
*/
public void start(BundleContext context) throws Exception {
super.start(context);
+ initSeamGen();
}
+ private void initSeamGen() {
+ ILaunchConfiguration config=null;
+ try {
+ config = findLaunchConfig("seamgen");
+ } catch (CoreException e1) {
+ logError("Exception occured during search in Launch Configuration list.", e1);
+ }
+ String buildXmlPath = null;
+ if(config==null) {
+ try {
+ String seamHome = SeamFacetPreference.getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER);
+ buildXmlPath = seamHome+File.separator+"seam-gen"+File.separator+"build.xml";
+ SeamGenAction.createSeamgenLaunchConfig(buildXmlPath);
+ } catch (CoreException e) {
+ logError("Cannot create configuration for Seam-Gen tool. Seamgen build.xml file: " + buildXmlPath, e);
+ return;
+ }
+ }
+ }
+
+ static public ILaunchConfiguration findLaunchConfig(String name) throws CoreException {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType( "org.eclipse.ant.AntLaunchConfigurationType" );
+ ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations( launchConfigurationType );
+
+ for (int i = 0; i < launchConfigurations.length; i++) { // can't believe there is no look up by name API
+ ILaunchConfiguration launchConfiguration = launchConfigurations[i];
+ if(launchConfiguration.getName().equals(name)) {
+ return launchConfiguration;
+ }
+ }
+ return null;
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
@@ -67,4 +112,6 @@
log(new Status(IStatus.ERROR, PLUGIN_ID, 12345, message, e));
}
+
+
}
17 years, 5 months
JBoss Tools SVN: r2712 - in trunk/seam: plugins/org.jboss.tools.seam.core and 14 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-07-27 21:42:37 -0400 (Fri, 27 Jul 2007)
New Revision: 2712
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamFacetPreference.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencePage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/WtpUtilsTest.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/preferences/SeamPreferenceInitializer.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java
Modified:
trunk/seam/features/org.jboss.tools.seam.feature/feature.xml
trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelValidatorDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
Log:
http://jira.jboss.org/jira/browse/EXIN-221
Seam preference page has been added.
Now there is RedHat->Seam category in prederences dialog with Subcategory Validator.
Default value for seam is calculated as related path to plugin location.
Modified: trunk/seam/features/org.jboss.tools.seam.feature/feature.xml
===================================================================
--- trunk/seam/features/org.jboss.tools.seam.feature/feature.xml 2007-07-27 21:02:09 UTC (rev 2711)
+++ trunk/seam/features/org.jboss.tools.seam.feature/feature.xml 2007-07-28 01:42:37 UTC (rev 2712)
@@ -21,8 +21,7 @@
id="org.jboss.tools.seam.core"
download-size="0"
install-size="0"
- version="0.0.0"
- unpack="false"/>
+ version="0.0.0"/>
<plugin
id="org.jboss.tools.seam.ui"
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2007-07-27 21:02:09 UTC (rev 2711)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2007-07-28 01:42:37 UTC (rev 2712)
@@ -35,9 +35,9 @@
Bundle-Version: 2.0.0
Export-Package: org.jboss.tools.seam.core,
org.jboss.tools.seam.core.event,
+ org.jboss.tools.seam.core.project.facet,
org.jboss.tools.seam.internal.core,
org.jboss.tools.seam.internal.core.el,
- org.jboss.tools.seam.internal.core.preferences,
org.jboss.tools.seam.internal.core.project.facet,
org.jboss.tools.seam.internal.core.scanner,
org.jboss.tools.seam.internal.core.scanner.java,
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-27 21:02:09 UTC (rev 2711)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-28 01:42:37 UTC (rev 2712)
@@ -28,7 +28,10 @@
</extension>
<extension point="org.eclipse.core.runtime.preferences">
- <initializer class="org.jboss.tools.seam.internal.core.preferences.SeamPreferenceInitializer"/>
+ <initializer class="org.jboss.tools.seam.internal.core.SeamPreferenceInitializer"/>
+ <initializer
+ class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetPreferenceInitializer">
+ </initializer>
</extension>
<extension
@@ -119,8 +122,8 @@
id="preset.jst.seam.v1_2">
<label>Seam 1.2 project</label>
<facet id="jst.java" version="5.0" />
- <facet id="jst.web" version="2.4"/>
- <facet id="jst.jsf" version="1.1" />
+ <facet id="jst.web" version="2.5"/>
+ <facet id="jst.jsf" version="1.2" />
<facet id="jst.seam" version="1.2"/>
<description>
Seam 1.2 project
@@ -190,4 +193,4 @@
</persistent>
</extension>
-</plugin>
\ No newline at end of file
+</plugin>
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamFacetPreference.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamFacetPreference.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamFacetPreference.java 2007-07-28 01:42:37 UTC (rev 2712)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.core.project.facet;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamFacetPreference {
+ public static final String SEAM_HOME_FOLDER = SeamCorePlugin.PLUGIN_ID + ".project.facet.seamhome";
+
+ public static String getStringPreference(String name) {
+ return SeamCorePlugin.getDefault().getPreferenceStore().getString(SeamFacetPreference.SEAM_HOME_FOLDER);
+ }
+}
Copied: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java (from rev 2608, trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/preferences/SeamPreferenceInitializer.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java 2007-07-28 01:42:37 UTC (rev 2712)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core;
+
+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.IScopeContext;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.SeamPreferences;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ public SeamPreferenceInitializer() {}
+
+ @Override
+ public void initializeDefaultPreferences() {
+
+ IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(SeamCorePlugin.PLUGIN_ID);
+ for (String name : SeamPreferences.severityOptionNames) {
+ defaultPreferences.put(name, SeamPreferences.ERROR);
+ }
+ defaultPreferences.put(SeamPreferences.INVALID_EXPRESSION, SeamPreferences.WARNING);
+ defaultPreferences.put(SeamPreferences.UNKNOWN_VARIABLE_NAME, SeamPreferences.WARNING);
+ defaultPreferences.put(SeamPreferences.UNPAIRED_GETTER_OR_SETTER, SeamPreferences.WARNING);
+ }
+}
\ No newline at end of file
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/preferences/SeamPreferenceInitializer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/preferences/SeamPreferenceInitializer.java 2007-07-27 21:02:09 UTC (rev 2711)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/preferences/SeamPreferenceInitializer.java 2007-07-28 01:42:37 UTC (rev 2712)
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.internal.core.preferences;
-
-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.IScopeContext;
-import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.core.SeamPreferences;
-
-/**
- * @author Viacheslav Kabanovich
- */
-public class SeamPreferenceInitializer extends AbstractPreferenceInitializer {
-
- public SeamPreferenceInitializer() {}
-
- @Override
- public void initializeDefaultPreferences() {
-
- IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(SeamCorePlugin.PLUGIN_ID);
- for (String name : SeamPreferences.severityOptionNames) {
- defaultPreferences.put(name, SeamPreferences.ERROR);
- }
- defaultPreferences.put(SeamPreferences.INVALID_EXPRESSION, SeamPreferences.WARNING);
- defaultPreferences.put(SeamPreferences.UNKNOWN_VARIABLE_NAME, SeamPreferences.WARNING);
- defaultPreferences.put(SeamPreferences.UNPAIRED_GETTER_OR_SETTER, SeamPreferences.WARNING);
- }
-}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java 2007-07-28 01:42:37 UTC (rev 2712)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.internal.core.project.facet;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+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.IScopeContext;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.project.facet.SeamFacetPreference;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamFacetPreferenceInitializer extends
+ AbstractPreferenceInitializer {
+
+ /**
+ *
+ */
+ public SeamFacetPreferenceInitializer() {}
+
+ @Override
+ public void initializeDefaultPreferences() {
+ IScopeContext context = new DefaultScope();
+ IEclipsePreferences node = context.getNode(SeamCorePlugin.PLUGIN_ID);
+ node.put(SeamFacetPreference.SEAM_HOME_FOLDER, getSeamGenBuildPath());
+ }
+
+ public static final String SEAM_GEN_HOME = "../../../../jboss-eap/seam";
+
+ public String getSeamGenBuildPath() {
+ String pluginLocation=null;
+ try {
+ pluginLocation = FileLocator.resolve(SeamCorePlugin.getDefault().getBundle().getEntry("/")).getFile();
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ };
+ File seamGenDir = new File(pluginLocation, SEAM_GEN_HOME);
+ Path p = new Path(seamGenDir.getPath());
+ p.makeAbsolute();
+ if(p.toFile().exists()) {
+ return p.toFile().getAbsolutePath();
+ } else {
+ return "";
+ }
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2007-07-27 21:02:09 UTC (rev 2711)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2007-07-28 01:42:37 UTC (rev 2712)
@@ -44,13 +44,17 @@
org.jboss.ide.eclipse.jdt.core
Eclipse-LazyStart: true
Export-Package: org.jboss.tools.seam.ui,
- org.jboss.tools.seam.ui.views,
+ org.jboss.tools.seam.ui.builder,
org.jboss.tools.seam.ui.internal.project.facet;x-internal:=true,
- org.jboss.tools.seam.ui.widget.editor,
- org.jboss.tools.seam.ui.widget.field,
- org.jboss.tools.seam.ui.wizard,
+ org.jboss.tools.seam.ui.preferences,
org.jboss.tools.seam.ui.text.java;
uses:="org.eclipse.jface.text,
org.eclipse.jdt.ui.text.java,
org.eclipse.core.runtime,
- org.eclipse.jface.text.contentassist"
+ org.eclipse.jface.text.contentassist",
+ org.jboss.tools.seam.ui.views,
+ org.jboss.tools.seam.ui.views.actions,
+ org.jboss.tools.seam.ui.views.properties,
+ org.jboss.tools.seam.ui.widget.editor,
+ org.jboss.tools.seam.ui.widget.field,
+ org.jboss.tools.seam.ui.wizard
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-27 21:02:09 UTC (rev 2711)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-28 01:42:37 UTC (rev 2712)
@@ -266,11 +266,17 @@
<extension point="org.eclipse.ui.preferencePages">
<page
- category="org.jboss.tools.common.model.ui"
+ category="org.jboss.tools.common.model.ui.seam"
class="org.jboss.tools.seam.ui.preferences.SeamValidatorPreferencePage"
id="org.jboss.tools.seam.ui.preferences.SeamValidatorPreferencePage"
- name="Seam Validator">
+ name="Validator">
</page>
+ <page
+ category="org.jboss.tools.common.model.ui"
+ class="org.jboss.tools.seam.ui.preferences.SeamPreferencePage"
+ id="org.jboss.tools.common.model.ui.seam"
+ name="Seam">
+ </page>
</extension>
<extension
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelValidatorDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelValidatorDelegate.java 2007-07-27 21:02:09 UTC (rev 2711)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelValidatorDelegate.java 2007-07-28 01:42:37 UTC (rev 2712)
@@ -66,8 +66,6 @@
*
*/
public void propertyChanged(DataModelEvent event) {
- //When SeamFacetInstallDelegete sets model property,
- //it can result in Invalid thread access.
Display.getDefault().asyncExec(new Runnable() {
public void run() {
validateUntillError();
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-07-27 21:02:09 UTC (rev 2711)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-07-28 01:42:37 UTC (rev 2712)
@@ -34,6 +34,7 @@
import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
import org.hibernate.eclipse.console.utils.DriverClassHelpers;
+import org.jboss.tools.seam.core.project.facet.SeamFacetPreference;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
@@ -67,7 +68,7 @@
// "JBoss AS Home Folder:","C:\\java\\jboss-4.0.5.GA");
IFieldEditor jBossSeamHomeEditor = IFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
- "JBoss Seam Home Folder:","C:\\java\\jboss-seam-1.2.1.GA");
+ "JBoss Seam Home Folder:",SeamFacetPreference.getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER));
IFieldEditor jBossAsDeployAsEditor = IFieldEditorFactory.INSTANCE.createComboEditor(
ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
"Deploy as:",Arrays.asList(new String[]{"war","ear"}),"war",false);
Deleted: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java 2007-07-27 21:02:09 UTC (rev 2711)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java 2007-07-28 01:42:37 UTC (rev 2712)
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.ui.internal.project.facet;
-
-import java.util.List;
-
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.FileDialog;
-import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor;
-import org.jboss.tools.seam.ui.widget.editor.CheckBoxFieldEditor;
-import org.jboss.tools.seam.ui.widget.editor.ComboFieldEditor;
-import org.jboss.tools.seam.ui.widget.editor.CompositeEditor;
-import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
-import org.jboss.tools.seam.ui.widget.editor.IFieldEditorFactory;
-import org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor;
-import org.jboss.tools.seam.ui.widget.editor.LabelFieldEditor;
-import org.jboss.tools.seam.ui.widget.editor.TaggedComboFieldEditor;
-import org.jboss.tools.seam.ui.widget.editor.TextFieldEditor;
-
-/**
- *
- * @author eskimo
- *
- */
-public class SwtFieldEditorFactory implements IFieldEditorFactory {
-
- /**
- *
- */
- public IFieldEditor createCheckboxEditor(String name, String label,
- boolean defaultValue) {
- CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
- editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
- new CheckBoxFieldEditor(name,label,Boolean.valueOf(defaultValue))});
- return editor;
- }
-
- /**
- *
- */
- public ITaggedFieldEditor createComboEditor(String name, String label,
- List values, Object defaultValue) {
- TaggedComboFieldEditor editor = new TaggedComboFieldEditor(name,label,values, defaultValue,true);
- return editor;
- }
-
- /**
- *
- */
- public ITaggedFieldEditor createComboEditor(String name, String label,
- List values, Object defaultValue, boolean flat) {
- TaggedComboFieldEditor editor = new TaggedComboFieldEditor(name,label,values, defaultValue,flat);
- return editor;
- }
-
- /**
- *
- */
- public IFieldEditor createTextEditor(String name, String label, String defaultValue) {
- CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
- editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
- new TextFieldEditor(name,label, defaultValue)});
- return editor;
- }
-
- /**
- *
- */
- public IFieldEditor createUneditableTextEditor(String name, String label, String defaultValue) {
- CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
- editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
- new TextFieldEditor(name,label, defaultValue,false)});
- return editor;
- }
-
- /**
- *
- */
- public IFieldEditor createBrowseFolderEditor(String name, String label, String defaultValue) {
- CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
- editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
- new TextFieldEditor(name,label, defaultValue),
- new ButtonFieldEditor(name,createSelectFolderAction("Browse"),defaultValue)});
- return editor;
- }
-
-
- /**
- *
- */
- public IFieldEditor createBrowseFileEditor(String name, String label, String defaultValue) {
- CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
- editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
- new TextFieldEditor(name,label, defaultValue),
- new ButtonFieldEditor(name,createSelectFileAction("Browse"),defaultValue)});
- return editor;
- }
-
-
- public IFieldEditor createButtonFieldEditor(String name, String label, String defaultValue, ButtonFieldEditor.ButtonPressedAction action, IValidator validator ) {
- CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
- editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
- new TextFieldEditor(name,label, defaultValue),
- new ButtonFieldEditor(name,action,defaultValue)});
- return editor;
- }
- /**
- *
- * @param buttonName
- * @return
- */
- public ButtonFieldEditor.ButtonPressedAction createSelectFolderAction(String buttonName) {
- return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
- @Override
- public void run() {
- DirectoryDialog dialog = new DirectoryDialog(Display.getCurrent().getActiveShell());
- dialog.setFilterPath(getFieldEditor().getValueAsString());
- dialog.setMessage("Select Seam Home Folder");
- dialog.setFilterPath(getFieldEditor().getValueAsString());
- String directory = dialog.open();
- if(directory!=null) {
- getFieldEditor().setValue(directory);
- }
- }
- };
- }
-
- /**
- *
- * @param buttonName
- * @return
- */
- public ButtonFieldEditor.ButtonPressedAction createSelectFileAction(String buttonName) {
- return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
- @Override
- public void run() {
- FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell());
- dialog.setFilterPath(getFieldEditor().getValueAsString());
- dialog.setText("Select Seam Home Folder");
- dialog.setFilterPath(getFieldEditor().getValueAsString());
- String directory = dialog.open();
- if(directory!=null) {
- getFieldEditor().setValue(directory);
- }
- }
- };
- }
-}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencePage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencePage.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencePage.java 2007-07-28 01:42:37 UTC (rev 2712)
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.preferences;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Map;
+
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+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.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.project.facet.SeamFacetPreference;
+import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
+import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
+import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.seam.ui.widget.editor.SwtFieldEditorFactory;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamPreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage, PropertyChangeListener {
+
+ /**
+ *
+ */
+ IFieldEditor editor
+ = SwtFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
+ "seam.home.folder", "Seam Home Folder:",
+ SeamFacetPreference.getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER));
+
+ /**
+ *
+ */
+ public SeamPreferencePage() {
+ }
+
+ /**
+ * @param title
+ */
+ public SeamPreferencePage(String title) {
+ super(title);
+ }
+
+ /**
+ * @param title
+ * @param image
+ */
+ public SeamPreferencePage(String title, ImageDescriptor image) {
+ super(title, image);
+ }
+
+ /**
+ *
+ */
+ protected Control createContents(Composite parent) {
+ Composite root = new Composite(parent, SWT.NONE);
+ GridLayout gl = new GridLayout(3,false);
+ root.setLayout(gl);
+ editor.doFillIntoGrid(root);
+ editor.addPropertyChangeListener(this);
+ return root;
+ }
+
+ /**
+ *
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+ /**
+ *
+ */
+ public void propertyChange(PropertyChangeEvent arg0) {
+ Map errors
+ = ValidatorFactory.JBOSS_SEAM_HOME_FOLDER_VALIDATOR.validate(editor.getValue(), null);
+ if(errors.size()>0) {
+ setValid(false);
+ setMessage(errors.get(errors.keySet().iterator().next()).toString(), IMessageProvider.ERROR);
+ } else {
+ setMessage(null);
+ setValid(true);
+ }
+ }
+
+ /**
+ *
+ */
+ @Override
+ protected void performApply() {
+ SeamCorePlugin.getDefault().getPluginPreferences().setValue(
+ SeamFacetPreference.SEAM_HOME_FOLDER, editor.getValueAsString());
+ }
+
+ /**
+ *
+ */
+ @Override
+ protected void performDefaults() {
+ editor.removePropertyChangeListener(this);
+ editor.setValue(
+ SeamCorePlugin.getDefault().getPluginPreferences().getDefaultString(
+ SeamFacetPreference.SEAM_HOME_FOLDER));
+ editor.addPropertyChangeListener(this);
+ setValid(true);
+ setMessage(null);
+ performApply();
+ }
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java 2007-07-27 21:02:09 UTC (rev 2711)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java 2007-07-28 01:42:37 UTC (rev 2712)
@@ -9,6 +9,8 @@
import java.util.Arrays;
import java.util.List;
+import javax.rmi.CORBA.ValueHandler;
+
import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -92,6 +94,7 @@
editor.setValue(newValue);
editor.addPropertyChangeListener(this);
}
+ super.setValue(newValue);
}
public void propertyChange(PropertyChangeEvent event) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java 2007-07-27 21:02:09 UTC (rev 2711)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java 2007-07-28 01:42:37 UTC (rev 2712)
@@ -13,7 +13,6 @@
import java.util.List;
import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
-import org.jboss.tools.seam.ui.internal.project.facet.SwtFieldEditorFactory;
public interface IFieldEditorFactory {
Copied: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java (from rev 2662, trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java 2007-07-28 01:42:37 UTC (rev 2712)
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.widget.editor;
+
+import java.util.List;
+
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
+
+/**
+ *
+ * @author eskimo
+ *
+ */
+public class SwtFieldEditorFactory implements IFieldEditorFactory {
+
+ /**
+ *
+ */
+ public IFieldEditor createCheckboxEditor(String name, String label,
+ boolean defaultValue) {
+ CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
+ new CheckBoxFieldEditor(name,label,Boolean.valueOf(defaultValue))});
+ return editor;
+ }
+
+ /**
+ *
+ */
+ public ITaggedFieldEditor createComboEditor(String name, String label,
+ List values, Object defaultValue) {
+ TaggedComboFieldEditor editor = new TaggedComboFieldEditor(name,label,values, defaultValue,true);
+ return editor;
+ }
+
+ /**
+ *
+ */
+ public ITaggedFieldEditor createComboEditor(String name, String label,
+ List values, Object defaultValue, boolean flat) {
+ TaggedComboFieldEditor editor = new TaggedComboFieldEditor(name,label,values, defaultValue,flat);
+ return editor;
+ }
+
+ /**
+ *
+ */
+ public IFieldEditor createTextEditor(String name, String label, String defaultValue) {
+ CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
+ new TextFieldEditor(name,label, defaultValue)});
+ return editor;
+ }
+
+ /**
+ *
+ */
+ public IFieldEditor createUneditableTextEditor(String name, String label, String defaultValue) {
+ CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
+ new TextFieldEditor(name,label, defaultValue,false)});
+ return editor;
+ }
+
+ /**
+ *
+ */
+ public IFieldEditor createBrowseFolderEditor(String name, String label, String defaultValue) {
+ CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
+ new TextFieldEditor(name,label, defaultValue),
+ new ButtonFieldEditor(name,createSelectFolderAction("Browse"),defaultValue)});
+ return editor;
+ }
+
+
+ /**
+ *
+ */
+ public IFieldEditor createBrowseFileEditor(String name, String label, String defaultValue) {
+ CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
+ new TextFieldEditor(name,label, defaultValue),
+ new ButtonFieldEditor(name,createSelectFileAction("Browse"),defaultValue)});
+ return editor;
+ }
+
+
+ public IFieldEditor createButtonFieldEditor(String name, String label, String defaultValue, ButtonFieldEditor.ButtonPressedAction action, IValidator validator ) {
+ CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
+ new TextFieldEditor(name,label, defaultValue),
+ new ButtonFieldEditor(name,action,defaultValue)});
+ return editor;
+ }
+ /**
+ *
+ * @param buttonName
+ * @return
+ */
+ public ButtonFieldEditor.ButtonPressedAction createSelectFolderAction(String buttonName) {
+ return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
+ @Override
+ public void run() {
+ DirectoryDialog dialog = new DirectoryDialog(Display.getCurrent().getActiveShell());
+ dialog.setFilterPath(getFieldEditor().getValueAsString());
+ dialog.setMessage("Select Seam Home Folder");
+ dialog.setFilterPath(getFieldEditor().getValueAsString());
+ String directory = dialog.open();
+ if(directory!=null) {
+ getFieldEditor().setValue(directory);
+ }
+ }
+ };
+ }
+
+ /**
+ *
+ * @param buttonName
+ * @return
+ */
+ public ButtonFieldEditor.ButtonPressedAction createSelectFileAction(String buttonName) {
+ return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
+ @Override
+ public void run() {
+ FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell());
+ dialog.setFilterPath(getFieldEditor().getValueAsString());
+ dialog.setText("Select Seam Home Folder");
+ dialog.setFilterPath(getFieldEditor().getValueAsString());
+ String directory = dialog.open();
+ if(directory!=null) {
+ getFieldEditor().setValue(directory);
+ }
+ }
+ };
+ }
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-07-27 21:02:09 UTC (rev 2711)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-07-28 01:42:37 UTC (rev 2712)
@@ -11,9 +11,9 @@
package org.jboss.tools.seam.ui.wizard;
-import org.jboss.tools.seam.ui.internal.project.facet.SwtFieldEditorFactory;
import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.seam.ui.widget.editor.SwtFieldEditorFactory;
/**
* @author eskimo
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/WtpUtilsTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/WtpUtilsTest.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/WtpUtilsTest.java 2007-07-28 01:42:37 UTC (rev 2712)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.core.test.project.facet;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.tools.seam.internal.core.project.facet.WtpUtils;
+
+import junit.framework.TestCase;
+
+/**
+ * @author eskimo
+ *
+ */
+public class WtpUtilsTest extends TestCase {
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test method for {@link org.jboss.tools.seam.internal.core.project.facet.WtpUtils#createEclipseProject(java.lang.String)}.
+ */
+ public void testCreateEclipseProject() {
+ WtpUtils.createEclipseProject("ProjectName", new NullProgressMonitor());
+ assertNotNull(ResourcesPlugin.getWorkspace().getRoot().findMember("ProjectName"));
+ }
+
+ /**
+ * Test method for {@link org.jboss.tools.seam.internal.core.project.facet.WtpUtils#createEjbProject(java.lang.String, java.lang.String[])}.
+ */
+ public void testCreateEjbProject() {
+ WtpUtils.createDefaultEjbProject("ejbProject", new NullProgressMonitor());
+ assertNotNull(ResourcesPlugin.getWorkspace().getRoot().findMember("ejbProject"));
+ }
+
+ /**
+ * Test method for {@link org.jboss.tools.seam.internal.core.project.facet.WtpUtils#createEarProject()}.
+ */
+ public void testCreateEarProject() {
+ fail("Not yet implemented");
+ }
+
+}
17 years, 5 months
JBoss Tools SVN: r2711 - in trunk: seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-07-27 17:02:09 -0400 (Fri, 27 Jul 2007)
New Revision: 2711
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/EditProjectTemplateView.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/ImportWebProjectWizardPage.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/NewWebProjectWizard.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/ResourceContentProvider.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/SeamComponentsEntityRecognizer.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
Log:
Cleanup catch(Exception e) stuff
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/EditProjectTemplateView.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/EditProjectTemplateView.java 2007-07-27 20:21:34 UTC (rev 2710)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/EditProjectTemplateView.java 2007-07-27 21:02:09 UTC (rev 2711)
@@ -74,14 +74,10 @@
public void dispose() {
super.dispose();
- try {
if(control != null && !control.isDisposed()) {
control.dispose();
control = null;
}
- } catch (Exception e) {
- WebUiPlugin.getPluginLog().logError(e);
- }
}
public void validate() {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/ImportWebProjectWizardPage.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/ImportWebProjectWizardPage.java 2007-07-27 20:21:34 UTC (rev 2710)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/ImportWebProjectWizardPage.java 2007-07-27 21:02:09 UTC (rev 2711)
@@ -18,6 +18,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
@@ -312,7 +313,7 @@
project.refreshLocal(IProject.DEPTH_INFINITE, null);
hasJavaNature = project.exists() && project.hasNature(JavaCore.NATURE_ID);
hasNature = project.exists() && project.hasNature(context.getNatureID());
- } catch (Exception e) {
+ } catch (CoreException e) {
hasNature = project.exists();
}
if(project.exists() && (!hasNature) && hasJavaNature) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/NewWebProjectWizard.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/NewWebProjectWizard.java 2007-07-27 20:21:34 UTC (rev 2710)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/NewWebProjectWizard.java 2007-07-27 21:02:09 UTC (rev 2711)
@@ -73,7 +73,7 @@
Status status = new Status(IStatus.ERROR, "org.jboss.tools.jst.web.ui", 0, message, e);
ProblemReportingHelper.reportProblem(status);
result = false;
- } catch (Exception e) {
+ } catch (InterruptedException e) {
String message = WizardKeys.getString(CANNOT_CREATE_LOCATION+".ErrorMessage")+": "+context.getLocationPath();
Status status = new Status(IStatus.ERROR, "org.jboss.tools.jst.web.ui", 0, message, e);
ProblemReportingHelper.reportProblem(status);
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/ResourceContentProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/ResourceContentProvider.java 2007-07-27 20:21:34 UTC (rev 2710)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/ResourceContentProvider.java 2007-07-27 21:02:09 UTC (rev 2711)
@@ -68,11 +68,7 @@
if(root != null && !root.equals(newRoot)) {
root = newRoot;
if(viewer.getControl() != null && !viewer.getControl().isDisposed()) {
- try {
- viewer.refresh();
- } catch(Exception e) {
- //ignore
- }
+ viewer.refresh();
}
} else {
root = newRoot;
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-27 20:21:34 UTC (rev 2710)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-27 21:02:09 UTC (rev 2711)
@@ -291,7 +291,7 @@
IMethod[] ms = null;
try {
ms = type.getMethods();
- } catch (Exception e) {
+ } catch (JavaModelException e) {
//ignore
}
String name = m.getName().getIdentifier();
@@ -313,11 +313,13 @@
if(f == null || getFieldName(f) == null) return null;
IType type = (IType)component.getSourceMember();
IField[] fs = null;
+
try {
fs = type.getFields();
- } catch (Exception e) {
- //ignore
+ } catch (JavaModelException e1) {
+ // ignore
}
+
String name = getFieldName(f);
if(fs != null) for (int i = 0; i < fs.length; i++) {
if(!name.equals(fs[i].getElementName())) continue;
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java 2007-07-27 20:21:34 UTC (rev 2710)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java 2007-07-27 21:02:09 UTC (rev 2711)
@@ -19,6 +19,7 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.ASTRequestor;
@@ -119,7 +120,7 @@
if(ts != null && ts.length > 0) {
visitor.type = ts[0];
}
- } catch (Exception e) {
+ } catch (JavaModelException e) {
//ignore
}
ast.accept(visitor);
@@ -136,14 +137,17 @@
}
static String getResolvedType(IType type, String n) {
+
+ String[][] rs;
try {
- String[][] rs = type.resolveType(n);
+ rs = type.resolveType(n);
if(rs != null && rs.length > 0) {
return (rs[0][0].length() == 0) ? rs[0][1] : rs[0][0] + "." + rs[0][1];
}
- } catch (Exception e) {
- //ignore
+ } catch (JavaModelException e) {
+ // ignore
}
+
return n;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/SeamComponentsEntityRecognizer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/SeamComponentsEntityRecognizer.java 2007-07-27 20:21:34 UTC (rev 2710)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/SeamComponentsEntityRecognizer.java 2007-07-27 21:02:09 UTC (rev 2711)
@@ -10,7 +10,9 @@
******************************************************************************/
package org.jboss.tools.seam.xml.components.model;
-import org.jboss.tools.common.model.loaders.*;
+import java.io.IOException;
+
+import org.jboss.tools.common.model.loaders.EntityRecognizer;
import org.jboss.tools.common.xml.XMLEntityResolver;
import org.jboss.tools.seam.xml.SeamXMLPlugin;
@@ -20,7 +22,7 @@
try {
Class<?> c = SeamComponentsEntityRecognizer.class;
XMLEntityResolver.registerPublicEntity(PUBLIC_ID_11, c, "/meta/components-1.1.dtd");
- } catch (Exception e) {
+ } catch (IOException e) {
SeamXMLPlugin.log(e);
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2007-07-27 20:21:34 UTC (rev 2710)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2007-07-27 21:02:09 UTC (rev 2711)
@@ -13,6 +13,7 @@
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.compare.Splitter;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -163,7 +164,7 @@
Rectangle rect = null;
try {
rect = composite.getBounds();
- } catch (Exception e) {
+ } catch (SWTException e) {
VpePlugin.getPluginLog().logError(e);
}
17 years, 5 months
JBoss Tools SVN: r2710 - in trunk/core/tests/org.jboss.ide.eclipse.archives.test: META-INF and 14 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-07-27 16:21:34 -0400 (Fri, 27 Jul 2007)
New Revision: 2710
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/.classpath
trunk/core/tests/org.jboss.ide.eclipse.archives.test/.project
trunk/core/tests/org.jboss.ide.eclipse.archives.test/META-INF/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF
trunk/core/tests/org.jboss.ide.eclipse.archives.test/bin/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/build.properties
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/archiveDescriptors/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/archiveDescriptors/descriptor1.xml
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/flatTextFiles/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/flatTextFiles/one.txt
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/flatTextFiles/three.txt
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/flatTextFiles/two.txt
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/multiple_files.gif
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/new_package.gif
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/prop_ps.gif
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/rug.xml
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/secretImages/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/secretImages/new_jar_wiz.png
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/secretImages/new_war_wiz.png
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/single_file.gif
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/someHtml.html
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/output/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTest.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/FileIOTest.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/MarshallUnmarshallTest.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ModelUtilTest.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/FileIOUtil.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/tmp/
Log:
Initial import.
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/.classpath
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/.classpath (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/.classpath 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/.project
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/.project (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/.project 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.ide.eclipse.archives.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.ide.eclipse.archives.core.archivesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.jboss.ide.eclipse.archives.core.archivesNature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Archives Test Plug-in
+Bundle-SymbolicName: org.jboss.ide.eclipse.archives.test
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.ide.eclipse.archives.test.ArchivesTest
+Require-Bundle: org.eclipse.core.runtime,
+ org.junit,
+ org.jboss.ide.eclipse.archives.core,
+ org.eclipse.core.resources
+Eclipse-LazyStart: true
+Bundle-ClassPath: archivestest.jar
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/build.properties
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/build.properties (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/build.properties 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1,5 @@
+source.. = src/
+output.archivestest.jar = bin/
+bin.includes = META-INF/,\
+ archivestest.jar
+source.archivestest.jar = src/
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/archiveDescriptors/descriptor1.xml
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/archiveDescriptors/descriptor1.xml (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/archiveDescriptors/descriptor1.xml 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<packages>
+ <package name="TestProject.jar" type="jar" todir="/some/external/path" exploded="false" inWorkspace="false">
+ <folder name="folder">
+ <properties></properties>
+ </folder>
+ <folder name="folder2">
+ <folder name="inner1">
+ <fileset dir="/some/global/path" includes="**/*.xml" inWorkspace="false">
+ <properties></properties>
+ </fileset>
+ <properties></properties>
+ </folder>
+ <properties></properties>
+ </folder>
+ </package>
+ <package name="TestProject2.jar" type="jar" todir="/SomeProject" exploded="true" inWorkspace="true">
+ </package>
+ <properties></properties>
+</packages>
\ No newline at end of file
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/flatTextFiles/one.txt
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/flatTextFiles/one.txt (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/flatTextFiles/one.txt 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1 @@
+File One
\ No newline at end of file
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/flatTextFiles/three.txt
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/flatTextFiles/three.txt (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/flatTextFiles/three.txt 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1 @@
+Third File
\ No newline at end of file
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/flatTextFiles/two.txt
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/flatTextFiles/two.txt (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/flatTextFiles/two.txt 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1 @@
+Lorum Ipsum
\ No newline at end of file
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/multiple_files.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/multiple_files.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/new_package.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/new_package.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/prop_ps.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/prop_ps.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/rug.xml
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/rug.xml (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/rug.xml 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1,7 @@
+<rug>
+ <color>Red</color>
+ <shape>Circle</shape>
+ <size><w unit="inches">60</w>
+ <l unit="cm">300</l>
+ </size>
+</rug>
\ No newline at end of file
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/secretImages/new_jar_wiz.png
===================================================================
(Binary files differ)
Property changes on: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/secretImages/new_jar_wiz.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/secretImages/new_war_wiz.png
===================================================================
(Binary files differ)
Property changes on: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/secretImages/new_war_wiz.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/single_file.gif
===================================================================
(Binary files differ)
Property changes on: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/single_file.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/someHtml.html
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/someHtml.html (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/fileTrees/misc/someHtml.html 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1,4 @@
+<html>I'm an html file! I swear!
+
+No seriously. <i>there... </i> do you believe me now?
+</html>
\ No newline at end of file
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTest.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTest.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTest.java 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1,50 @@
+package org.jboss.ide.eclipse.archives.test;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ArchivesTest extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.archives.test";
+
+ // The shared instance
+ private static ArchivesTest plugin;
+
+ /**
+ * The constructor
+ */
+ public ArchivesTest() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static ArchivesTest getDefault() {
+ return plugin;
+ }
+
+}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1,17 @@
+package org.jboss.ide.eclipse.archives.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class ArchivesTestSuite extends TestSuite {
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Archives Tests");
+
+ suite.addTestSuite(FileIOTest.class);
+ suite.addTestSuite(MarshallUnmarshallTest.class);
+ suite.addTestSuite(ModelUtilTest.class);
+
+ return suite;
+ }
+
+}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/FileIOTest.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/FileIOTest.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/FileIOTest.java 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1,163 @@
+package org.jboss.ide.eclipse.archives.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.util.internal.TrueZipUtil;
+import org.jboss.ide.eclipse.archives.test.util.FileIOUtil;
+import org.osgi.framework.Bundle;
+
+public class FileIOTest extends TestCase {
+ private Bundle bundle;
+ private IPath bundlePath;
+ protected void setUp() {
+ if( bundlePath == null ) {
+ try {
+ bundle = ArchivesTest.getDefault().getBundle();
+ URL bundleURL = FileLocator.toFileURL(bundle.getEntry(""));
+ bundlePath = new Path(bundleURL.getFile());
+ } catch( IOException ioe) {}
+ }
+ }
+
+ protected void tearDown() {
+ try {
+ de.schlichtherle.io.File.umount();
+ } catch( Exception e ) {}
+ FileIOUtil.clearFolder(bundlePath.append("tmp").toFile().listFiles());
+ }
+
+
+ public void testPathExists() {
+ IPath inputs = bundlePath.append("inputs");
+ assertTrue(TrueZipUtil.pathExists(bundlePath));
+ assertTrue(TrueZipUtil.pathExists(inputs));
+ assertTrue(TrueZipUtil.pathExists(inputs.append("fileTrees")));
+ assertTrue(TrueZipUtil.pathExists(inputs.append("fileTrees").append("flatTextFiles").append("one.txt")));
+
+ assertFalse(TrueZipUtil.pathExists(bundlePath.append("doesNotExist")));
+ assertFalse(TrueZipUtil.pathExists(inputs.append("doesNotExist")));
+ assertFalse(TrueZipUtil.pathExists(inputs.append("fileTrees").append("flatTextFiles").append("doesNotExist.txt")));
+ }
+
+ public void testCreationAndDeletion() {
+ IPath tmpDir = bundlePath.append("tmp");
+
+ // create archives via both APIs,
+ IPath creationArchive1 = tmpDir.append("creationArchive1.jar");
+ IPath creationArchive2 = tmpDir.append("creationArchive2.zip");
+ IPath creationArchive3 = tmpDir.append("creationArchive3");
+
+ assertFalse(TrueZipUtil.pathExists(creationArchive1));
+ TrueZipUtil.createArchive(creationArchive1);
+ assertTrue(TrueZipUtil.pathExists(creationArchive1));
+ assertFalse(creationArchive1.toFile().isDirectory());
+
+ assertFalse(TrueZipUtil.pathExists(creationArchive2));
+ TrueZipUtil.createArchive(creationArchive2);
+ assertTrue(TrueZipUtil.pathExists(creationArchive2));
+ assertFalse(creationArchive2.toFile().isDirectory());
+
+ // and also create an archive with no suffix
+ assertFalse(TrueZipUtil.pathExists(creationArchive3));
+ TrueZipUtil.createArchive(creationArchive3);
+ assertTrue(TrueZipUtil.pathExists(creationArchive3));
+ assertFalse(creationArchive3.toFile().isDirectory());
+
+
+ // create folders with various names
+ IPath creationFolder1 = tmpDir.append("creationFolder1.jar");
+ IPath creationFolder2 = tmpDir.append("creationFolder2.zip");
+ IPath creationFolder3 = tmpDir.append("creationFolder3");
+
+ assertFalse(TrueZipUtil.pathExists(creationFolder1));
+ TrueZipUtil.createFolder(creationFolder1);
+ assertTrue(TrueZipUtil.pathExists(creationFolder1));
+ assertTrue(creationFolder1.toFile().isDirectory());
+
+ assertFalse(TrueZipUtil.pathExists(creationFolder2));
+ TrueZipUtil.createFolder(creationFolder2);
+ assertTrue(TrueZipUtil.pathExists(creationFolder2));
+ assertTrue(creationFolder2.toFile().isDirectory());
+
+ assertFalse(TrueZipUtil.pathExists(creationFolder3));
+ TrueZipUtil.createFolder(creationFolder3);
+ assertTrue(TrueZipUtil.pathExists(creationFolder3));
+ assertTrue(creationFolder3.toFile().isDirectory());
+
+
+ // folders and archives of all extensions work.
+ // keep one folder and one archive and add to each
+ // another folder, archive, and file
+
+ IPath archiveFolder = creationArchive1.append("folderName");
+ IPath archiveArchive = creationArchive1.append("archiveName.war");
+
+ IPath folderFolder = creationFolder1.append("folderName");
+ IPath folderArchive = creationFolder1.append("archiveName.war");
+
+
+ assertFalse(TrueZipUtil.pathExists(archiveFolder));
+ assertFalse(TrueZipUtil.pathExists(archiveArchive));
+ TrueZipUtil.createFolder(archiveFolder);
+ TrueZipUtil.createArchive(archiveArchive);
+ try {de.schlichtherle.io.File.umount();} catch( Exception e ) {}
+ assertTrue(TrueZipUtil.pathExists(archiveFolder));
+ assertTrue(TrueZipUtil.pathExists(archiveArchive));
+ assertFalse(archiveFolder.toFile().exists());
+ assertFalse(archiveArchive.toFile().exists());
+
+
+ assertFalse(TrueZipUtil.pathExists(folderFolder));
+ assertFalse(TrueZipUtil.pathExists(folderArchive));
+ TrueZipUtil.createFolder(folderFolder);
+ TrueZipUtil.createArchive(folderArchive);
+ try {de.schlichtherle.io.File.umount();} catch( Exception e ) {}
+ assertTrue(TrueZipUtil.pathExists(archiveFolder));
+ assertTrue(TrueZipUtil.pathExists(archiveArchive));
+ assertTrue(folderFolder.toFile().exists());
+ assertTrue(folderArchive.toFile().exists());
+
+ // copy a file into them
+ IPath archiveFile = creationArchive1.append("file.txt");
+ IPath folderFile = creationArchive1.append("file.txt");
+
+ String srcPath = bundlePath.append("inputs").append("fileTrees")
+ .append("flatTextFiles").append("two.txt").toOSString();
+ try {
+ assertFalse(TrueZipUtil.pathExists(archiveFile));
+ assertFalse(TrueZipUtil.pathExists(folderFile));
+ TrueZipUtil.copyFile(srcPath, archiveFile);
+ TrueZipUtil.copyFile(srcPath, folderFile);
+ assertTrue(TrueZipUtil.pathExists(archiveFile));
+ assertTrue(TrueZipUtil.pathExists(folderFile));
+ } catch( Exception e ) {
+ fail("IOException: " + e.getMessage());
+ }
+
+ de.schlichtherle.io.File f = TrueZipUtil.getFile(creationFolder1);
+ int numChildren = f.list().length;
+ assertEquals(2, numChildren);
+ TrueZipUtil.deleteEmptyChildren(f);
+ int numChildren2 = f.list().length;
+ assertEquals(0, numChildren2);
+
+ de.schlichtherle.io.File f2 = TrueZipUtil.getFile(creationArchive1);
+ TrueZipUtil.deleteAll(creationArchive1);
+ assertFalse(TrueZipUtil.pathExists(f2));
+ }
+
+ protected IPath bundleEntryToGlobalPath(String entry) {
+ try {
+ return new Path(FileLocator.toFileURL(bundle.getEntry(entry)).getFile());
+ } catch( IOException e ) {
+ return null;
+ }
+ }
+}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/MarshallUnmarshallTest.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/MarshallUnmarshallTest.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/MarshallUnmarshallTest.java 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1,175 @@
+package org.jboss.ide.eclipse.archives.test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFolder;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
+import org.jboss.ide.eclipse.archives.test.util.FileIOUtil;
+import org.osgi.framework.Bundle;
+
+public class MarshallUnmarshallTest extends TestCase {
+ private Bundle bundle;
+ private IPath bundlePath;
+ private IPath archiveDescriptors;
+ protected void setUp() {
+ if( bundlePath == null ) {
+ try {
+ bundle = ArchivesTest.getDefault().getBundle();
+ URL bundleURL = FileLocator.toFileURL(bundle.getEntry(""));
+ bundlePath = new Path(bundleURL.getFile());
+ archiveDescriptors = bundlePath.append("inputs").append("archiveDescriptors");
+ } catch( IOException ioe) {}
+ }
+ }
+
+
+ public void tearDown() {
+ FileIOUtil.clearFolder(bundlePath.append("tmp").toFile().listFiles());
+ }
+
+ public void testUnmarshall() {
+ // unmarshall from file
+ FileInputStream fis = null;
+ try {
+ fis = new FileInputStream(archiveDescriptors.append("descriptor1.xml").toFile());
+ } catch( Exception e ) {
+ fail(e.getMessage());
+ }
+ XbPackages packs = XMLBinding.unmarshal(fis, new NullProgressMonitor());
+ assertDescriptor1Accurate(packs);
+
+ // unmarshall from string
+ try {
+ String content = fileAsString(archiveDescriptors.append("descriptor1.xml").toFile());
+ packs = XMLBinding.unmarshal(content, new NullProgressMonitor());
+ assertDescriptor1Accurate(packs);
+ } catch( Exception e ) {
+ fail(e.getMessage());
+ }
+
+ }
+
+ public String fileAsString(File f) throws Exception {
+ FileInputStream fis = new FileInputStream(f);
+ int x= fis.available();
+ byte b[]= new byte[x];
+ fis.read(b);
+ return new String(b);
+ }
+
+ public void testMarshall() {
+ IPath tmpFolder = bundlePath.append("tmp");
+
+ XbPackages packs = new XbPackages();
+ XbPackage pack1 = new XbPackage();
+ pack1.setName("TestProject.jar");
+ pack1.setPackageType("jar");
+ pack1.setToDir("/some/external/path");
+ pack1.setExploded(false);
+ pack1.setInWorkspace(false);
+ packs.addChild(pack1);
+
+ XbPackage pack2 = new XbPackage();
+ pack2.setName("TestProject2.jar");
+ pack2.setPackageType("jar");
+ pack2.setToDir("/SomeProject");
+ pack2.setExploded(true);
+ pack2.setInWorkspace(true);
+ packs.addChild(pack2);
+
+ XbFolder folder1 = new XbFolder();
+ folder1.setName("folder");
+ pack1.addChild(folder1);
+
+ XbFolder folder2 = new XbFolder();
+ folder2.setName("folder2");
+ pack1.addChild(folder2);
+
+ XbFolder inner1 = new XbFolder();
+ inner1.setName("inner1");
+ folder2.addChild(inner1);
+
+ XbFileSet fs = new XbFileSet();
+ fs.setDir("/some/global/path");
+ fs.setIncludes("**/*.xml");
+ fs.setInWorkspace(false);
+ inner1.addChild(fs);
+
+ assertDescriptor1Accurate(packs);
+
+ String packsAsString = XMLBinding.serializePackages(packs, new NullProgressMonitor());
+ XbPackages packsFromString = XMLBinding.unmarshal(packsAsString, new NullProgressMonitor());
+ assertDescriptor1Accurate(packsFromString);
+
+ try {
+ OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(tmpFolder.append("marshallTest.xml").toFile()));
+ XMLBinding.marshall(packs, writer, new NullProgressMonitor());
+ writer.close();
+
+ XbPackages packsFromFile = XMLBinding.unmarshal(new FileInputStream(tmpFolder.append("marshallTest.xml").toFile()), new NullProgressMonitor());
+ assertDescriptor1Accurate(packsFromFile);
+ } catch(Exception e) {
+ fail(e.getMessage());
+ }
+
+ }
+
+ void assertDescriptor1Accurate(XbPackages packs) {
+ assertEquals(2, packs.getAllChildren().size());
+ assertEquals(2, packs.getChildren(XbPackage.class).size());
+
+ XbPackage pack1 = (XbPackage)packs.getAllChildren().get(0);
+ XbPackage pack2 = (XbPackage)packs.getAllChildren().get(1);
+
+ // pack 1
+ assertEquals("TestProject.jar", pack1.getName());
+ assertEquals("/some/external/path", pack1.getToDir());
+ assertEquals("jar", pack1.getPackageType());
+ assertFalse(pack1.isExploded());
+ assertFalse(pack1.isInWorkspace());
+ assertEquals(2, pack1.getAllChildren().size());
+ assertEquals(2, pack1.getChildren(XbFolder.class).size());
+
+ XbFolder folder1 = (XbFolder)pack1.getAllChildren().get(0);
+ XbFolder folder2 = (XbFolder)pack1.getAllChildren().get(1);
+
+ assertEquals(0, folder1.getAllChildren().size());
+ assertEquals("folder", folder1.getName());
+
+ assertEquals(1, folder2.getAllChildren().size());
+ assertEquals(1, folder2.getChildren(XbFolder.class).size());
+ assertEquals("folder2", folder2.getName());
+
+ XbFolder innerFolder = (XbFolder)folder2.getAllChildren().get(0);
+ assertEquals("inner1", innerFolder.getName());
+ assertEquals(1, innerFolder.getAllChildren().size());
+ assertEquals(1, innerFolder.getChildren(XbFileSet.class).size());
+
+ XbFileSet fs = (XbFileSet)innerFolder.getAllChildren().get(0);
+ assertEquals(fs.getIncludes(), "**/*.xml");
+ assertEquals(fs.getDir(), "/some/global/path");
+ assertFalse(fs.isInWorkspace());
+
+ // pack 2
+ assertEquals(0, pack2.getAllChildren().size());
+ assertEquals("TestProject2.jar", pack2.getName());
+ assertEquals("/SomeProject", pack2.getToDir());
+ assertEquals("jar", pack2.getPackageType());
+ assertTrue(pack2.isExploded());
+ assertTrue(pack2.isInWorkspace());
+ }
+}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ModelUtilTest.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ModelUtilTest.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ModelUtilTest.java 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1,141 @@
+package org.jboss.ide.eclipse.archives.test;
+
+import java.io.IOException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl;
+import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
+import org.osgi.framework.Bundle;
+
+public class ModelUtilTest extends TestCase {
+ private Bundle bundle;
+ private IPath bundlePath;
+ private IPath outputs;
+ private IPath inputs;
+ private IArchive rootArchive;
+ protected void setUp() {
+ if( bundlePath == null ) {
+ try {
+ bundle = ArchivesTest.getDefault().getBundle();
+ URL bundleURL = FileLocator.toFileURL(bundle.getEntry(""));
+ bundlePath = new Path(bundleURL.getFile());
+ outputs = bundlePath.append("output");
+ inputs = bundlePath.append("inputs");
+ } catch( IOException ioe) {}
+ }
+ rootArchive = createArchive();
+ }
+
+ public void tearDown() {
+ rootArchive = null;
+ }
+
+
+
+ protected IArchive createArchive() {
+ IPath fileTrees = inputs.append("fileTrees");
+
+ IArchive root = ArchiveNodeFactory.createArchive();
+ root.setArchiveType("jar");
+ root.setDestinationPath(outputs);
+ root.setName("output.jar");
+ root.setExploded(false);
+ root.setInWorkspace(false);
+
+ IArchiveFolder topFolder = ArchiveNodeFactory.createFolder();
+ topFolder.setName("topFolder");
+ root.addChild(topFolder);
+
+ IArchiveFolder inner1 = ArchiveNodeFactory.createFolder();
+ inner1.setName("inner1");
+ topFolder.addChild(inner1);
+
+ IArchiveFolder images = ArchiveNodeFactory.createFolder();
+ images.setName("images");
+ topFolder.addChild(images);
+
+ IArchiveFileSet outerFileset = ArchiveNodeFactory.createFileset();
+ outerFileset.setInWorkspace(false);
+ outerFileset.setSourcePath(fileTrees.append("misc"));
+ outerFileset.setExcludesPattern("**/*.gif,**/*.png");
+ outerFileset.setIncludesPattern("**/*");
+ topFolder.addChild(outerFileset);
+
+ IArchiveFileSet imageFileset = ArchiveNodeFactory.createFileset();
+ imageFileset.setInWorkspace(false);
+ imageFileset.setSourcePath(fileTrees.append("misc"));
+ imageFileset.setIncludesPattern("**/*.gif,**/*.png,**/*.xml");
+ images.addChild(imageFileset);
+
+ ((ArchiveNodeImpl)root).clearDeltas();
+ return root;
+ }
+
+ public void testFindAllDescendentFilesets() {
+ IArchiveFileSet[] fsets = ModelUtil.findAllDescendentFilesets(rootArchive);
+ assertTrue(fsets.length == 2);
+ assertTrue(fsets[0].getParent().getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER);
+ assertTrue(fsets[1].getParent().getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER);
+ assertTrue(ModelUtil.findAllDescendentFilesets(ArchiveNodeFactory.createFileset()).length == 1);
+ }
+
+ public void testFindAllDescendentFolders() {
+ IArchiveFolder[] folders = ModelUtil.findAllDescendentFolders(rootArchive);
+ assertTrue(folders.length == 3);
+ }
+
+ public void testFindAllDescendentsGeneric() {
+ assertTrue(ModelUtil.findAllDescendents(rootArchive, IArchiveNode.TYPE_ARCHIVE, false).size() == 0);
+ assertTrue(ModelUtil.findAllDescendents(rootArchive, IArchiveNode.TYPE_ARCHIVE, true).size() == 1);
+ assertTrue(ModelUtil.findAllDescendents(rootArchive, IArchiveNode.TYPE_ARCHIVE_FOLDER, false).size() == 3);
+ assertTrue(ModelUtil.findAllDescendents(rootArchive, IArchiveNode.TYPE_ARCHIVE_FILESET, false).size() == 2);
+ }
+
+ public void testGetMatchingFileSets() {
+ IPath misc = inputs.append("fileTrees").append("misc");
+ IPath gif = misc.append("multiple_files.gif");
+ IPath xml = misc.append("rug.xml");
+ IPath html = misc.append("someHtml.html");
+
+ IArchiveFileSet[] gifFS = ModelUtil.getMatchingFilesets(rootArchive, gif);
+ IArchiveFileSet[] xmlFS = ModelUtil.getMatchingFilesets(rootArchive, xml);
+ IArchiveFileSet[] htmlFS = ModelUtil.getMatchingFilesets(rootArchive, html);
+
+ assertEquals(1, gifFS.length);
+ assertEquals(2, xmlFS.length);
+ assertEquals(1, htmlFS.length);
+
+ }
+
+ public void testOtherFilesetMatchesPath() {
+ IPath xml = inputs.append("fileTrees").append("misc").append("rug.xml");
+ IArchiveFileSet[] xmlFS = ModelUtil.getMatchingFilesets(rootArchive, xml);
+ assertTrue(xmlFS.length == 2);
+ assertFalse(ModelUtil.otherFilesetMatchesPathAndOutputLocation(xmlFS[0], xml, rootArchive));
+ assertFalse(ModelUtil.otherFilesetMatchesPathAndOutputLocation(xmlFS[1], xml, rootArchive));
+
+ IPath html = inputs.append("fileTrees").append("misc").append("someHtml.html");
+ IArchiveFileSet[] htmlFS = ModelUtil.getMatchingFilesets(rootArchive, html);
+ assertTrue(htmlFS.length == 1);
+ assertFalse(ModelUtil.otherFilesetMatchesPathAndOutputLocation(htmlFS[0], html, rootArchive));
+
+ // add a temporary fileset that will match exactly
+ IArchiveFileSet otherFS = ArchiveNodeFactory.createFileset();
+ otherFS.setIncludesPattern(xmlFS[0].getIncludesPattern());
+ otherFS.setInWorkspace(xmlFS[0].isInWorkspace());
+ otherFS.setSourcePath(xmlFS[0].getSourcePath());
+ xmlFS[0].getParent().addChild(otherFS);
+
+ assertTrue(ModelUtil.otherFilesetMatchesPathAndOutputLocation(xmlFS[0], xml, rootArchive));
+ }
+}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/FileIOUtil.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/FileIOUtil.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/FileIOUtil.java 2007-07-27 20:21:34 UTC (rev 2710)
@@ -0,0 +1,16 @@
+package org.jboss.ide.eclipse.archives.test.util;
+
+import java.io.File;
+
+public class FileIOUtil {
+
+ public static void clearFolder(File[] children) {
+ for( int i = 0; i < children.length; i++ ) {
+ File[] second = children[i].listFiles();
+ if( second != null && second.length > 0 )
+ clearFolder(second);
+ children[i].delete();
+ }
+ }
+
+}
17 years, 5 months
JBoss Tools SVN: r2709 - trunk/core/tests.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-07-27 16:21:10 -0400 (Fri, 27 Jul 2007)
New Revision: 2709
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/
Log:
Initial import.
17 years, 5 months
JBoss Tools SVN: r2708 - trunk/core/tests.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-07-27 16:18:00 -0400 (Fri, 27 Jul 2007)
New Revision: 2708
Removed:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/
trunk/core/tests/org.jboss.ide.eclipse.packages.test/
Log:
removing obsolete plugins
17 years, 5 months
JBoss Tools SVN: r2707 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util: internal and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-07-27 15:29:32 -0400 (Fri, 27 Jul 2007)
New Revision: 2707
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java
Log:
API changed to have more accurate name
allows node to be passed in to limit search for matching filesets.
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2007-07-27 19:04:55 UTC (rev 2706)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2007-07-27 19:29:32 UTC (rev 2707)
@@ -116,23 +116,33 @@
return matches;
}
+
+ public static boolean otherFilesetMatchesPathAndOutputLocation(IArchiveFileSet fileset, IPath path) {
+ return otherFilesetMatchesPathAndOutputLocation(fileset, path, null);
+ }
+
/**
* Do any filesets other than the parameter match this path?
* @param fileset
* @param path
+ * @param root a node to start with, or null if the entire model
* @return
*/
- public static boolean otherFilesetMatchesPath(IArchiveFileSet fileset, IPath path) {
- IArchiveFileSet[] filesets = ModelUtil.getMatchingFilesets(path);
+ public static boolean otherFilesetMatchesPathAndOutputLocation(IArchiveFileSet fileset, IPath path, IArchiveNode root) {
+ IArchiveFileSet[] filesets = ModelUtil.getMatchingFilesets(root, path);
if( filesets.length == 0 || (filesets.length == 1 && Arrays.asList(filesets).contains(fileset))) {
return false;
} else {
// other filesets DO match... but are they at the same location in the archive?
+ boolean relativePathsMatch;
+ boolean destinationsMatch;
for( int i = 0; i < filesets.length; i++ ) {
if( fileset.equals(filesets[i])) continue;
- if( fileset.getRootArchiveRelativePath(path).equals(filesets[i].getRootArchiveRelativePath(path))) {
- // the two put the file in the same spot! It's a match!
+ relativePathsMatch = fileset.getRootArchiveRelativePath(path).equals(filesets[i].getRootArchiveRelativePath(path));
+ destinationsMatch = fileset.getRootArchive().getArchiveFilePath().equals(filesets[i].getRootArchive().getArchiveFilePath());
+ if( relativePathsMatch && destinationsMatch ) {
+ // the two put the file in the same spot, within the same archive! It's a match!
return true;
}
}
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java 2007-07-27 19:04:55 UTC (rev 2706)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java 2007-07-27 19:29:32 UTC (rev 2707)
@@ -90,7 +90,7 @@
final ArrayList list = new ArrayList();
list.addAll(Arrays.asList(paths));
for( int i = 0; i < paths.length; i++ ) {
- if( !ModelUtil.otherFilesetMatchesPath(fileset, paths[i])) {
+ if( !ModelUtil.otherFilesetMatchesPathAndOutputLocation(fileset, paths[i])) {
// remove
deleteFiles(fileset, new IPath[] {paths[i]}, false);
} else {
17 years, 5 months