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