JBoss Tools SVN: r14793 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-04-17 06:58:27 -0400 (Fri, 17 Apr 2009)
New Revision: 14793
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateUiFactory.java
Log:
JBIDE-4141
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateUiFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateUiFactory.java 2009-04-17 10:58:13 UTC (rev 14792)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateUiFactory.java 2009-04-17 10:58:27 UTC (rev 14793)
@@ -1,62 +0,0 @@
-package org.jboss.tools.hibernate.jpt.ui.internal.platform;
-
-import java.util.ArrayList;
-import java.util.ListIterator;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.ui.WidgetFactory;
-import org.eclipse.jpt.ui.details.JpaPageComposite;
-import org.eclipse.jpt.ui.internal.GenericJpaUiFactory;
-import org.eclipse.jpt.ui.internal.persistence.details.PersistenceUnitConnectionComposite;
-import org.eclipse.jpt.ui.internal.persistence.details.PersistenceUnitPropertiesComposite;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
-import org.jboss.tools.hibernate.jpt.core.internal.context.basic.BasicHibernateProperties;
-import org.jboss.tools.hibernate.jpt.ui.internal.persistence.details.HibernatePropertiesComposite;
-import org.jboss.tools.hibernate.jpt.ui.xpl.PersistenceUnitGeneralComposite;
-
-public class HibernateUiFactory extends GenericJpaUiFactory {
-
- public ListIterator createPersistenceUnitComposites(
- PropertyValueModel<PersistenceUnit> subjectHolder, Composite parent, WidgetFactory widgetFactory) {
-
- ArrayList<JpaPageComposite> pages = new ArrayList<JpaPageComposite>(1);
-
- //replaced from Dali 2.0
- pages.add(new PersistenceUnitGeneralComposite(subjectHolder, parent, widgetFactory));
- pages.add(new PersistenceUnitConnectionComposite(subjectHolder, parent, widgetFactory));
- pages.add(new PersistenceUnitPropertiesComposite(subjectHolder, parent, widgetFactory));
-
- // ************Hibernate pages***************
- PropertyValueModel<HibernatePersistenceUnit> hibernatePersistenceUnitHolder = this
- .buildHibernatePersistenceUnitHolder(subjectHolder);
-
- PropertyValueModel<BasicHibernateProperties> basicHolder = this.buildBasicHolder(hibernatePersistenceUnitHolder);
- pages.add(new HibernatePropertiesComposite(basicHolder, parent, widgetFactory));
-
- return pages.listIterator();
- }
-
- private PropertyValueModel<BasicHibernateProperties> buildBasicHolder(
- PropertyValueModel<HibernatePersistenceUnit> subjectHolder) {
- return new TransformationPropertyValueModel<HibernatePersistenceUnit, BasicHibernateProperties>(subjectHolder) {
- @Override
- protected BasicHibernateProperties transform_(HibernatePersistenceUnit value) {
- return value.getBasicProperties();
- }
- };
- }
-
- private PropertyValueModel<HibernatePersistenceUnit> buildHibernatePersistenceUnitHolder(
- PropertyValueModel<PersistenceUnit> subjectHolder) {
- return new TransformationPropertyValueModel<PersistenceUnit, HibernatePersistenceUnit>(subjectHolder) {
- @Override
- protected HibernatePersistenceUnit transform_(PersistenceUnit value) {
- return (HibernatePersistenceUnit) value;
- }
- };
- }
-
-}
\ No newline at end of file
15 years, 8 months
JBoss Tools SVN: r14792 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui: src/org/jboss/tools/hibernate/jpt/ui/internal/platform and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-04-17 06:58:13 -0400 (Fri, 17 Apr 2009)
New Revision: 14792
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUiFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaUiFactory.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
Log:
JBIDE-4141
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml 2009-04-17 10:57:56 UTC (rev 14791)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml 2009-04-17 10:58:13 UTC (rev 14792)
@@ -3,10 +3,11 @@
<plugin>
<extension
id="org.jboss.tools.hibernate.jpt"
- point="org.eclipse.jpt.ui.jpaPlatform">
- <jpaPlatform
- class="org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernatePlatformUI"
+ point="org.eclipse.jpt.ui.jpaPlatformUis">
+ <jpaPlatformUi
+ factoryClass="org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernateJpaPlatformUiFactory"
+ jpaPlatform="hibernate"
id="hibernate">
- </jpaPlatform>
+ </jpaPlatformUi>
</extension>
</plugin>
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUiFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUiFactory.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUiFactory.java 2009-04-17 10:58:13 UTC (rev 14792)
@@ -0,0 +1,29 @@
+package org.jboss.tools.hibernate.jpt.ui.internal.platform;
+
+import org.eclipse.jpt.ui.JpaPlatformUi;
+import org.eclipse.jpt.ui.JpaPlatformUiFactory;
+import org.eclipse.jpt.ui.internal.GenericJpaPlatformUiProvider;
+import org.eclipse.jpt.ui.internal.GenericJpaUiFactory;
+import org.eclipse.jpt.ui.internal.platform.generic.GenericJpaPlatformUi;
+import org.eclipse.jpt.ui.internal.platform.generic.GenericJpaPlatformUiFactory;
+import org.eclipse.jpt.ui.internal.platform.generic.GenericNavigatorProvider;
+import org.eclipse.jpt.ui.internal.structure.JavaResourceModelStructureProvider;
+import org.eclipse.jpt.ui.internal.structure.PersistenceResourceModelStructureProvider;
+
+public class HibernateJpaPlatformUiFactory implements JpaPlatformUiFactory {
+
+ public HibernateJpaPlatformUiFactory() {
+ super();
+ }
+
+ public JpaPlatformUi buildJpaPlatformUi() {
+ return new HibernateJpaPlatformUi(
+ new HibernateJpaUiFactory(),
+ new GenericNavigatorProvider(),
+ JavaResourceModelStructureProvider.instance(),
+ PersistenceResourceModelStructureProvider.instance(),
+ GenericJpaPlatformUiProvider.instance()
+ );
+ }
+
+}
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaUiFactory.java (from rev 14606, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateUiFactory.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaUiFactory.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaUiFactory.java 2009-04-17 10:58:13 UTC (rev 14792)
@@ -0,0 +1,62 @@
+package org.jboss.tools.hibernate.jpt.ui.internal.platform;
+
+import java.util.ArrayList;
+import java.util.ListIterator;
+
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.ui.WidgetFactory;
+import org.eclipse.jpt.ui.details.JpaPageComposite;
+import org.eclipse.jpt.ui.internal.GenericJpaUiFactory;
+import org.eclipse.jpt.ui.internal.persistence.details.PersistenceUnitConnectionComposite;
+import org.eclipse.jpt.ui.internal.persistence.details.PersistenceUnitPropertiesComposite;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.BasicHibernateProperties;
+import org.jboss.tools.hibernate.jpt.ui.internal.persistence.details.HibernatePropertiesComposite;
+import org.jboss.tools.hibernate.jpt.ui.xpl.PersistenceUnitGeneralComposite;
+
+public class HibernateJpaUiFactory extends GenericJpaUiFactory {
+
+ public ListIterator createPersistenceUnitComposites(
+ PropertyValueModel<PersistenceUnit> subjectHolder, Composite parent, WidgetFactory widgetFactory) {
+
+ ArrayList<JpaPageComposite> pages = new ArrayList<JpaPageComposite>(1);
+
+ //replaced from Dali 2.0
+ pages.add(new PersistenceUnitGeneralComposite(subjectHolder, parent, widgetFactory));
+ pages.add(new PersistenceUnitConnectionComposite(subjectHolder, parent, widgetFactory));
+ pages.add(new PersistenceUnitPropertiesComposite(subjectHolder, parent, widgetFactory));
+
+ // ************Hibernate pages***************
+ PropertyValueModel<HibernatePersistenceUnit> hibernatePersistenceUnitHolder = this
+ .buildHibernatePersistenceUnitHolder(subjectHolder);
+
+ PropertyValueModel<BasicHibernateProperties> basicHolder = this.buildBasicHolder(hibernatePersistenceUnitHolder);
+ pages.add(new HibernatePropertiesComposite(basicHolder, parent, widgetFactory));
+
+ return pages.listIterator();
+ }
+
+ private PropertyValueModel<BasicHibernateProperties> buildBasicHolder(
+ PropertyValueModel<HibernatePersistenceUnit> subjectHolder) {
+ return new TransformationPropertyValueModel<HibernatePersistenceUnit, BasicHibernateProperties>(subjectHolder) {
+ @Override
+ protected BasicHibernateProperties transform_(HibernatePersistenceUnit value) {
+ return value.getBasicProperties();
+ }
+ };
+ }
+
+ private PropertyValueModel<HibernatePersistenceUnit> buildHibernatePersistenceUnitHolder(
+ PropertyValueModel<PersistenceUnit> subjectHolder) {
+ return new TransformationPropertyValueModel<PersistenceUnit, HibernatePersistenceUnit>(subjectHolder) {
+ @Override
+ protected HibernatePersistenceUnit transform_(PersistenceUnit value) {
+ return (HibernatePersistenceUnit) value;
+ }
+ };
+ }
+
+}
\ No newline at end of file
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2009-04-17 10:57:56 UTC (rev 14791)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2009-04-17 10:58:13 UTC (rev 14792)
@@ -23,7 +23,7 @@
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
-import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernatePlatformUI;
+import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernateJpaPlatformUi;
/**
* @author Dmitry Geraskov
@@ -52,7 +52,7 @@
@Override
public boolean performFinish() {
String projectName = jpaProject.getName();
- ILaunchConfigurationWorkingCopy wc = HibernatePlatformUI.createDefaultLaunchConfig(projectName);
+ ILaunchConfigurationWorkingCopy wc = HibernateJpaPlatformUi.createDefaultLaunchConfig(projectName);
if (wc != null) {
String concoleConfigurationName = initPage.getConfigurationName();
wc.setAttribute(HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME, concoleConfigurationName);
@@ -63,8 +63,8 @@
prop.put("format", "true"); //$NON-NLS-1$ //$NON-NLS-2$
prop.put("scriptToConsole", "false"); //$NON-NLS-1$ //$NON-NLS-2$
- wc.setAttribute(HibernatePlatformUI.full_exporter_id + ".properties", prop); //$NON-NLS-1$
- wc.setAttribute(HibernatePlatformUI.full_exporter_id + ".extension_id", HibernateLaunchConstants.ATTR_PREFIX + "hbm2ddl"); //$NON-NLS-1$ //$NON-NLS-2$
+ wc.setAttribute(HibernateJpaPlatformUi.full_exporter_id + ".properties", prop); //$NON-NLS-1$
+ wc.setAttribute(HibernateJpaPlatformUi.full_exporter_id + ".extension_id", HibernateLaunchConstants.ATTR_PREFIX + "hbm2ddl"); //$NON-NLS-1$ //$NON-NLS-2$
try {
wc.launch(ILaunchManager.RUN_MODE, null);
} catch (CoreException e) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2009-04-17 10:57:56 UTC (rev 14791)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2009-04-17 10:58:13 UTC (rev 14792)
@@ -20,7 +20,7 @@
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
-import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernatePlatformUI;
+import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernateJpaPlatformUi;
/**
* @author Dmitry Geraskov
@@ -53,7 +53,7 @@
@Override
public boolean performFinish() {
String projectName = jpaProject.getName();
- ILaunchConfigurationWorkingCopy wc = HibernatePlatformUI.createDefaultLaunchConfig(projectName);
+ ILaunchConfigurationWorkingCopy wc = HibernateJpaPlatformUi.createDefaultLaunchConfig(projectName);
if (wc != null) {
// SHOULD PRESENT THE CONFIGURATION!!!
String concoleConfigurationName = initPage.getConfigurationName();
@@ -72,7 +72,7 @@
wc.setAttribute("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect"); //$NON-NLS-1$ //$NON-NLS-2$
wc.setAttribute("hibernate.temp.use_jdbc_metadata_defaults", true); //$NON-NLS-1$
- wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS + '.' + HibernatePlatformUI.exporter_id + ".extension_id", //$NON-NLS-1$
+ wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS + '.' + HibernateJpaPlatformUi.exporter_id + ".extension_id", //$NON-NLS-1$
HibernateLaunchConstants.ATTR_PREFIX + "hbm2java"); //$NON-NLS-1$
try {
wc.launch(ILaunchManager.RUN_MODE, null);
15 years, 8 months
JBoss Tools SVN: r14791 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-04-17 06:57:56 -0400 (Fri, 17 Apr 2009)
New Revision: 14791
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF
Log:
JBIDE-4141
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF 2009-04-17 10:57:33 UTC (rev 14790)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/META-INF/MANIFEST.MF 2009-04-17 10:57:56 UTC (rev 14791)
@@ -5,17 +5,17 @@
Bundle-Version: 1.0.0
Bundle-Activator: org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin
Require-Bundle:
- org.hibernate.eclipse.console;bundle-version="3.2.0",
- org.hibernate.eclipse;bundle-version="3.2.0",
- org.eclipse.debug.core;bundle-version="3.4.0",
- org.eclipse.jdt.core;bundle-version="3.4.0",
- org.eclipse.jdt.ui;bundle-version="3.4.0",
- org.eclipse.datatools.connectivity;bundle-version="1.1.0",
- org.eclipse.jdt.launching;bundle-version="3.4.0",
- org.eclipse.wst.common.project.facet.ui;bundle-version="1.3.0",
- org.eclipse.ui.forms;bundle-version="3.3.100",
- org.jboss.tools.hibernate.jpt.core;bundle-version="1.0.0",
- org.eclipse.ui.ide;bundle-version="3.4.0",
+ org.hibernate.eclipse.console,
+ org.hibernate.eclipse,
+ org.eclipse.debug.core,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.ui,
+ org.eclipse.datatools.connectivity,
+ org.eclipse.jdt.launching,
+ org.eclipse.wst.common.project.facet.ui,
+ org.eclipse.ui.forms,
+ org.jboss.tools.hibernate.jpt.core,
+ org.eclipse.ui.ide,
org.eclipse.jpt.core,
org.eclipse.jpt.ui,
org.eclipse.jpt.utility
15 years, 8 months
JBoss Tools SVN: r14790 - trunk/hibernatetools/tests/org.jboss.tools.hibernate.jpt.core.test/src/org/jboss/tools/hibernate/jpt/core/test.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-04-17 06:57:33 -0400 (Fri, 17 Apr 2009)
New Revision: 14790
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.jpt.core.test/src/org/jboss/tools/hibernate/jpt/core/test/HibernateJPACoreTests.java
Log:
JBIDE-4141
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.jpt.core.test/src/org/jboss/tools/hibernate/jpt/core/test/HibernateJPACoreTests.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.jpt.core.test/src/org/jboss/tools/hibernate/jpt/core/test/HibernateJPACoreTests.java 2009-04-17 10:57:20 UTC (rev 14789)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.jpt.core.test/src/org/jboss/tools/hibernate/jpt/core/test/HibernateJPACoreTests.java 2009-04-17 10:57:33 UTC (rev 14790)
@@ -13,9 +13,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -24,44 +22,36 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.JpaFactory;
import org.eclipse.jpt.core.JpaFile;
import org.eclipse.jpt.core.JpaPlatform;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.ResourceModel;
import org.eclipse.jpt.core.context.persistence.Persistence;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.core.internal.platform.GenericJpaAnnotationProvider;
import org.eclipse.jpt.core.internal.resource.java.JavaResourcePersistentAttributeImpl;
import org.eclipse.jpt.core.internal.utility.jdt.JDTFieldAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourceModel;
+import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JpaCompilationUnit;
-import org.eclipse.jpt.core.resource.orm.OrmArtifactEdit;
import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.core.resource.persistence.PersistencePackage;
+import org.eclipse.jpt.core.resource.persistence.XmlJarFileRef;
import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnitTransactionType;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
+import org.eclipse.jpt.utility.CommandExecutor;
+import org.eclipse.jpt.utility.CommandExecutor.Default;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.events.IProjectFacetActionEvent;
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent.Type;
-import org.jboss.tools.hibernate.jpt.core.internal.HibernateFactory;
-import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaAnnotationProvider;
-import org.jboss.tools.hibernate.jpt.core.internal.HibernatePlatform;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaPlatform;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaPlatformFactory;
import org.jboss.tools.hibernate.jpt.core.internal.JPAPostInstallFasetListener;
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.GenericGeneratorAnnotationImpl;
@@ -133,41 +123,6 @@
};
/**
- * mock hibernate factory, redefine some methods of base GenericJpaFactory
- * to avoid unnecessary checks, which are not a subject of testing.
- */
- static public class MockHibernateFactory extends HibernateFactory {
- /**
- * during the testing our file has relevant content,
- * so just return true without dig into the base code.
- */
- public boolean hasRelevantContent(IFile file) {
- return true;
- }
- /**
- * just build resource model from JavaCore.JAVA_SOURCE_CONTENT_TYPE
- * all base code checks are unnecessary.
- */
- public ResourceModel buildResourceModel(JpaProject jpaProject,
- IFile file) {
- return buildResourceModel(jpaProject, file,
- JavaCore.JAVA_SOURCE_CONTENT_TYPE);
- }
- }
-
- /**
- * mock hibernate platform to get MockHibernateFactory
- * instead of HibernateFactory
- */
- public class MockHibernatePlatform extends HibernatePlatform {
- protected JpaFactory buildJpaFactory() {
- JpaFactory jpaFactory = super.buildJpaFactory();
- assertTrue(jpaFactory instanceof HibernateFactory);
- return new MockHibernateFactory();
- }
- }
-
- /**
* mock input stream to simulate javaFileName file reading
*/
public static class MockJavaInputStream extends InputStream {
@@ -210,23 +165,14 @@
public void testMockJPTCore() throws CoreException, IOException {
// define/prepare mock objects for testing
- final JpaPlatform jpaPlatform = new MockHibernatePlatform();
+ final HibernateJpaPlatformFactory hibernateJpaPlatformFactory = new HibernateJpaPlatformFactory();
+ final JpaPlatform jpaPlatform = hibernateJpaPlatformFactory.buildJpaPlatform("hibernate"); //$NON-NLS-1$
final String hibernatePlatformId = jpaPlatform.getId();
- assertTrue(HibernatePlatform.ID.equals(hibernatePlatformId));
+ assertTrue(HibernateJpaPlatform.ID.equals(hibernatePlatformId));
//
final JpaProject jpaProject = context.mock(JpaProject.class);
final IProject project = context.mock(IProject.class);
final IFile file = context.mock(IFile.class);
- final JavaResourceModel javaResourceModel = context
- .mock(JavaResourceModel.class);
- final Schema schema = context.mock(Schema.class);
- final ConnectionProfile connectionProfile = context
- .mock(ConnectionProfile.class);
- final Catalog catalog = context.mock(Catalog.class);
- final ArtifactEditModel artifactEditModel = context
- .mock(ArtifactEditModel.class);
- final ModuleCoreNature moduleCoreNature = context
- .mock(ModuleCoreNature.class);
final Persistence persistence = context.mock(Persistence.class);
final XmlPersistenceUnit xmlPersistenceUnit = context
.mock(XmlPersistenceUnit.class);
@@ -254,15 +200,14 @@
final EList<XmlMappingFileRef> mappingFiles = new EObjectContainmentEList<XmlMappingFileRef>(
XmlMappingFileRef.class, xmlPersistenceUnit,
PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES);
- final List<String> annotatedClassNamesList = new ArrayList<String>();
- final Iterator<String> annotatedClassNames = annotatedClassNamesList
- .iterator();
//
+ final EList<XmlJarFileRef> jarFiles = new EObjectContainmentEList<XmlJarFileRef>(
+ XmlJarFileRef.class, xmlPersistenceUnit,
+ PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES);
+ //
final JavaResourcePersistentType javaResourcePersistentType = context
.mock(JavaResourcePersistentType.class);
//
- final List<JavaResourcePersistentAttribute> resourceAttributesList1 = new ArrayList<JavaResourcePersistentAttribute>();
- //
final List<JavaResourcePersistentAttribute> resourceAttributesList2 = new ArrayList<JavaResourcePersistentAttribute>();
final JDTFieldAttribute jdtFieldAttribute = new JDTFieldAttribute(null,
"", 1, null, null); //$NON-NLS-1$
@@ -279,6 +224,8 @@
final IPath pathProject = new Path(""); //$NON-NLS-1$
//
final IPath pathJavaFile = new Path(javaFileName);
+ //
+ final CommandExecutor commandExecutor = Default.INSTANCE;
// define/check jpaPlatform.buildJpaFile expectations
context.checking(new Expectations() {
{
@@ -286,10 +233,6 @@
allowing(jpaProject).getJpaPlatform();
will(returnValue(jpaPlatform));
- oneOf(jpaProject)
- .getModifySharedDocumentCommandExecutorProvider();
- will(returnValue(null));
-
oneOf(file).getProject();
will(returnValue(project));
@@ -317,13 +260,13 @@
allowing(project).getName();
will(returnValue("IProj")); //$NON-NLS-1$
- allowing(jpaProject).getProject();
- will(returnValue(project));
+ allowing(jpaProject).getModifySharedDocumentCommandExecutor();
+ will(returnValue(commandExecutor));
oneOf(file).getParent();
will(returnValue(project));
- oneOf(file).getName();
+ allowing(file).getName();
will(returnValue(javaFileName));
oneOf(project).getWorkingLocation("org.eclipse.jdt.core"); //$NON-NLS-1$
@@ -338,6 +281,9 @@
oneOf(file).getLocation();
will(returnValue(pathJavaFile));
+ oneOf(file).getContents();
+ will(returnValue(javaIStream));
+
oneOf(file).getContents(true);
will(returnValue(javaIStream));
@@ -355,9 +301,10 @@
final JpaFile jpaFile = jpaPlatform.buildJpaFile(jpaProject, file);
//
// define/prepare mock objects for further testing
- final JpaCompilationUnit jpaCompilationUnit = context
- .mock(JpaCompilationUnit.class);
- final JpaAnnotationProvider jpaAnnotationProvider = new HibernateJpaAnnotationProvider();
+ final JavaResourceCompilationUnit javaResourceCompilationUnit = context
+ .mock(JavaResourceCompilationUnit.class);
+ final JpaAnnotationProvider jpaAnnotationProvider = jpaPlatform.getAnnotationProvider();
+ new GenericJpaAnnotationProvider();
//
final IProjectFacetActionEvent projectFacetActionEvent = context
.mock(IProjectFacetActionEvent.class);
@@ -379,34 +326,20 @@
allowing(persistence).getJpaProject();
will(returnValue(jpaProject));
- // Dali 2.0
- allowing(jpaProject).getJavaPersistentTypeResource(
- classFullName);
+ allowing(jpaProject).getJavaResourcePersistentType(classFullName);
will(returnValue(javaResourcePersistentType));
- allowing(jpaProject).getJavaPersistentTypeResource(null);
+ allowing(jpaProject).getJavaResourcePersistentType(null);
will(returnValue(null));
- // Dali 2.1
- //allowing(jpaProject).getJavaResourcePersistentType(classFullName); //$NON-NLS-1$
- // will(returnValue(factory));
-
- // Dali 2.0
- allowing(javaResourcePersistentType).getAnnotation(
- Hibernate.GENERIC_GENERATOR);
+ allowing(javaResourcePersistentType).getSupportingAnnotation(
+ Hibernate.GENERIC_GENERATOR);
will(returnValue(genericGeneratorAnnotation));
- // Dali 2.1
- // allowing(javaResourcePersistentType).getSupportingAnnotation(
- // Hibernate.GENERIC_GENERATOR);
- // will(returnValue(genericGeneratorAnnotation));
allowing(javaResourcePersistentType)
.getSuperClassQualifiedName();
will(returnValue(null));
- allowing(persistence).getOrmPersistentType();
- will(returnValue(null));
-
allowing(javaResourcePersistentType).getAccess();
will(returnValue(org.eclipse.jpt.core.resource.java.AccessType.PROPERTY));
@@ -416,60 +349,27 @@
allowing(javaResourcePersistentType).getMappingAnnotation();
will(returnValue(null));
- allowing(javaResourcePersistentType).fields();
- will(returnValue(resourceAttributesList1.iterator()));
-
- allowing(javaResourcePersistentType).properties();
+ allowing(javaResourcePersistentType).persistableProperties();
will(returnValue(resourceAttributesList2.iterator()));
- oneOf(javaResourcePersistentType).getJpaCompilationUnit();
- will(returnValue(jpaCompilationUnit));
-
- oneOf(jpaCompilationUnit).getAnnotationProvider();
+ oneOf(javaResourcePersistentType).getRoot();
+ will(returnValue(javaResourceCompilationUnit));
+
+ oneOf(javaResourceCompilationUnit).getAnnotationProvider();
will(returnValue(jpaAnnotationProvider));
- allowing(project).isAccessible();
- will(returnValue(true));
-
allowing(xmlPersistenceUnit).getMappingFiles();
will(returnValue(mappingFiles));
- allowing(project).getNature(
- "org.eclipse.wst.common.modulecore.ModuleCoreNature"); //$NON-NLS-1$
- will(returnValue(moduleCoreNature));
-
- allowing(project).isNatureEnabled(
- "org.eclipse.wst.common.project.facet.core.nature"); //$NON-NLS-1$
- will(returnValue(true));
-
- oneOf(project)
- .getFile(
- with(".settings/org.eclipse.wst.common.project.facet.core.xml")); //$NON-NLS-1$
- will(returnValue(file));
-
- allowing(file).getModificationStamp();
- will(returnValue(-1L));
-
- allowing(moduleCoreNature).getArtifactEditModelForRead(
- with(any(URI.class)), with(any(Object.class)),
- with(any(String.class)), with(any(Map.class)));
- will(returnValue(artifactEditModel));
-
- allowing(artifactEditModel).getResource(with(any(URI.class)));
+ allowing(jpaProject).getDefaultOrmXmlResource();
will(returnValue(null));
- allowing(artifactEditModel).releaseAccess(
- with(any(OrmArtifactEdit.class)));
-
- oneOf(jpaProject).discoversAnnotatedClasses();
- will(returnValue(true));
-
- allowing(jpaProject).annotatedClassNames();
- will(returnValue(annotatedClassNames));
-
allowing(xmlPersistenceUnit).getProperties();
will(returnValue(null));
+ allowing(xmlPersistenceUnit).getJarFiles();
+ will(returnValue(jarFiles));
+
allowing(xmlPersistenceUnit).getTransactionType();
will(returnValue(XmlPersistenceUnitTransactionType.JTA));
@@ -500,32 +400,21 @@
oneOf(xmlPersistenceUnit).setNonJtaDataSource(
"nonJtaDataSource"); //$NON-NLS-1$
- oneOf(javaResourcePersistentType).getResourceModel();
- will(returnValue(javaResourceModel));
- oneOf(javaResourceModel).getFile();
- will(returnValue(null));
+ oneOf(javaResourcePersistentType).getFile();
+ will(returnValue(file));
- oneOf(jpaProject).getJpaFile(null);
+ oneOf(jpaProject).getJpaFile(file);
will(returnValue(jpaFile));
oneOf(xmlPersistenceUnit).setExcludeUnlistedClasses(true);
- oneOf(jpaProject).getDefaultSchema();
- will(returnValue(schema));
-
- allowing(jpaProject).update();
-
- oneOf(schema).getName();
+ allowing(jpaProject).getDefaultSchema();
will(returnValue("schemaName")); //$NON-NLS-1$
- oneOf(jpaProject).getConnectionProfile();
- will(returnValue(connectionProfile));
+ oneOf(jpaProject).update();
- oneOf(connectionProfile).getDefaultCatalog();
- will(returnValue(catalog));
-
- oneOf(catalog).getName();
+ allowing(jpaProject).getDefaultCatalog();
will(returnValue("catalogName")); //$NON-NLS-1$
oneOf(projectFacetActionEvent).getType();
15 years, 8 months
JBoss Tools SVN: r14789 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core: META-INF and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-04-17 06:57:20 -0400 (Fri, 17 Apr 2009)
New Revision: 14789
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaPlatform.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaPlatformFactory.java
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernatePlatform.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/plugin.xml
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/JPAPostInstallFasetListener.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateJpaProperties.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnitProperties.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/PersistenceUnitProperties.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/PersistenceUnitPropertyListListener.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/HibernateBasic.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaGenericGeneratorImpl.java
Log:
JBIDE-4141
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF 2009-04-17 10:33:53 UTC (rev 14788)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF 2009-04-17 10:57:20 UTC (rev 14789)
@@ -6,12 +6,12 @@
Require-Bundle:
org.eclipse.core.runtime,
org.eclipse.wst.validation,
- org.hibernate.eclipse.console;bundle-version="3.2.0",
- org.hibernate.eclipse;bundle-version="3.2.0",
- org.eclipse.jdt.launching;bundle-version="3.4.0",
- org.eclipse.debug.core;bundle-version="3.4.0",
- org.eclipse.emf.ecore;bundle-version="2.4.0",
- org.eclipse.jdt.core;bundle-version="3.4.0",
+ org.hibernate.eclipse.console,
+ org.hibernate.eclipse,
+ org.eclipse.jdt.launching,
+ org.eclipse.debug.core,
+ org.eclipse.emf.ecore,
+ org.eclipse.jdt.core,
org.eclipse.wst.common.project.facet.core,
org.eclipse.jpt.core,
org.eclipse.jpt.utility,
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/plugin.xml 2009-04-17 10:33:53 UTC (rev 14788)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/plugin.xml 2009-04-17 10:57:20 UTC (rev 14789)
@@ -1,15 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
- <extension
- id="org.jboss.tools.hibernate.jpt.core"
- point="org.eclipse.jpt.core.jpaPlatform">
-
- <jpaPlatform
- class="org.jboss.tools.hibernate.jpt.core.internal.HibernatePlatform"
- default="false"
- id="hibernate"
- label="Hibernate"/>
+ <extension id="org.jboss.tools.hibernate.jpt.core"
+ point="org.eclipse.jpt.core.jpaPlatforms">
+ <jpaPlatform
+ factoryClass="org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaPlatformFactory"
+ default="false"
+ id="hibernate"
+ label="Hibernate">
+ </jpaPlatform>
</extension>
<extension
point="org.eclipse.wst.common.project.facet.core.listeners">
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateFactory.java 2009-04-17 10:33:53 UTC (rev 14788)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateFactory.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.jpt.core.internal;
-
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.platform.GenericJpaFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
-
-
-/**
- * @author Dmitry Geraskov
- *
- */
-public class HibernateFactory extends GenericJpaFactory {
-
- @Override
- public PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit persistenceUnit) {
- return new HibernatePersistenceUnit(parent, persistenceUnit);
- }
-
-}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -0,0 +1,46 @@
+package org.jboss.tools.hibernate.jpt.core.internal;
+
+import java.util.List;
+
+import org.eclipse.jpt.core.JpaAnnotationDefinitionProvider;
+import org.eclipse.jpt.core.internal.platform.AbstractJpaAnnotationDefintionProvider;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.GenericGeneratorAnnotationImpl.GenericGeneratorAnnotationDefinition;
+
+public class HibernateJpaAnnotationDefinitionProvider extends AbstractJpaAnnotationDefintionProvider
+{
+ // singleton
+ private static final JpaAnnotationDefinitionProvider INSTANCE = new HibernateJpaAnnotationDefinitionProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static JpaAnnotationDefinitionProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private HibernateJpaAnnotationDefinitionProvider() {
+ super();
+ }
+
+ @Override
+ protected void addTypeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
+ }
+
+ @Override
+ protected void addTypeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
+ definitions.add(GenericGeneratorAnnotationDefinition.instance());
+ }
+
+ @Override
+ protected void addAttributeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
+ }
+
+ @Override
+ protected void addAttributeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
+ definitions.add(GenericGeneratorAnnotationDefinition.instance());
+ }
+}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationProvider.java 2009-04-17 10:33:53 UTC (rev 14788)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationProvider.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.jpt.core.internal;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.jpt.core.internal.platform.GenericJpaAnnotationProvider;
-import org.eclipse.jpt.core.internal.resource.java.AssociationOverrideImpl.AssociationOverrideAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.AssociationOverridesImpl.AssociationOverridesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.AttributeOverrideImpl.AttributeOverrideAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.AttributeOverridesImpl.AttributeOverridesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.ColumnImpl.ColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.DiscriminatorColumnImpl.DiscriminatorColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.DiscriminatorValueImpl.DiscriminatorValueAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EnumeratedImpl.EnumeratedAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.GeneratedValueImpl.GeneratedValueAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.IdClassImpl.IdClassAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.InheritanceImpl.InheritanceAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinColumnImpl.JoinColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinColumnsImpl.JoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinTableImpl.JoinTableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.LobImpl.LobAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.MapKeyImpl.MapKeyAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueriesImpl.NamedNativeQueriesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueryImpl.NamedNativeQueryAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedQueriesImpl.NamedQueriesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedQueryImpl.NamedQueryAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.OrderByImpl.OrderByAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumnImpl.PrimaryKeyJoinColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumnsImpl.PrimaryKeyJoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.SecondaryTableImpl.SecondaryTableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.SecondaryTablesImpl.SecondaryTablesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.SequenceGeneratorImpl.SequenceGeneratorAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TableGeneratorImpl.TableGeneratorAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TableImpl.TableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TemporalImpl.TemporalAnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.jboss.tools.hibernate.jpt.core.internal.context.java.GenericGeneratorAnnotationImpl.GenericGeneratorAnnotationDefinition;
-
-/**
- * @author Dmitry Geraskov
- *
- */
-public class HibernateJpaAnnotationProvider extends GenericJpaAnnotationProvider {
-
- /**
- * Method for Dali 2.1 instead of {@link #addTypeAnnotationDefinitionsTo(Collection)}
- */
- protected void addTypeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions){
- addTypeAnnotationDefinitionsTo(definitions);
- }
-
- /**
- * Method for Dali 2.0
- */
- protected void addTypeAnnotationDefinitionsTo(Collection<AnnotationDefinition> definitions) {
- definitions.add(GenericGeneratorAnnotationDefinition.instance());
- //add Dali's annotation definitions
- definitions.add(AssociationOverrideAnnotationDefinition.instance());
- definitions.add(AssociationOverridesAnnotationDefinition.instance());
- definitions.add(AttributeOverrideAnnotationDefinition.instance());
- definitions.add(AttributeOverrideAnnotationDefinition.instance());
- definitions.add(AttributeOverridesAnnotationDefinition.instance());
- definitions.add(DiscriminatorColumnAnnotationDefinition.instance());
- definitions.add(DiscriminatorValueAnnotationDefinition.instance());
- definitions.add(IdClassAnnotationDefinition.instance());
- definitions.add(InheritanceAnnotationDefinition.instance());
- definitions.add(NamedQueryAnnotationDefinition.instance());
- definitions.add(NamedQueriesAnnotationDefinition.instance());
- definitions.add(NamedNativeQueryAnnotationDefinition.instance());
- definitions.add(NamedNativeQueriesAnnotationDefinition.instance());
- definitions.add(PrimaryKeyJoinColumnAnnotationDefinition.instance());
- definitions.add(PrimaryKeyJoinColumnsAnnotationDefinition.instance());
- definitions.add(SecondaryTableAnnotationDefinition.instance());
- definitions.add(SecondaryTablesAnnotationDefinition.instance());
- definitions.add(SequenceGeneratorAnnotationDefinition.instance());
- definitions.add(TableAnnotationDefinition.instance());
- definitions.add(TableGeneratorAnnotationDefinition.instance());
- }
-
- /**
- * Method for Dali 2.1 instead of {@link #addAttributeAnnotationDefinitionsTo(Collection)}
- */
- protected void addAttributeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
- addAttributeAnnotationDefinitionsTo(definitions);
- }
-
- /**
- * Method for Dali 2.0
- */
- protected void addAttributeAnnotationDefinitionsTo(Collection<AnnotationDefinition> definitions) {
- definitions.add(GenericGeneratorAnnotationDefinition.instance());
- //add Dali's annotation definitions
- definitions.add(AssociationOverrideAnnotationDefinition.instance());
- definitions.add(AssociationOverridesAnnotationDefinition.instance());
- definitions.add(AttributeOverrideAnnotationDefinition.instance());
- definitions.add(AttributeOverridesAnnotationDefinition.instance());
- definitions.add(ColumnAnnotationDefinition.instance());
- definitions.add(EnumeratedAnnotationDefinition.instance());
- definitions.add(GeneratedValueAnnotationDefinition.instance());
- definitions.add(JoinColumnAnnotationDefinition.instance());
- definitions.add(JoinColumnsAnnotationDefinition.instance());
- definitions.add(JoinTableAnnotationDefinition.instance());
- definitions.add(LobAnnotationDefinition.instance());
- definitions.add(MapKeyAnnotationDefinition.instance());
- definitions.add(OrderByAnnotationDefinition.instance());
- definitions.add(PrimaryKeyJoinColumnAnnotationDefinition.instance());
- definitions.add(PrimaryKeyJoinColumnsAnnotationDefinition.instance());
- definitions.add(SequenceGeneratorAnnotationDefinition.instance());
- definitions.add(TableGeneratorAnnotationDefinition.instance());
- definitions.add(TemporalAnnotationDefinition.instance());
- }
-
-}
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java (from rev 14606, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateFactory.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.jpt.core.internal;
+
+import org.eclipse.jpt.core.context.persistence.Persistence;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.core.internal.platform.GenericJpaFactory;
+import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
+import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
+
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class HibernateJpaFactory extends GenericJpaFactory {
+
+ @Override
+ public PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit persistenceUnit) {
+ return new HibernatePersistenceUnit(parent, persistenceUnit);
+ }
+
+}
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaPlatform.java (from rev 14606, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernatePlatform.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaPlatform.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaPlatform.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.jpt.core.internal;
+
+import org.eclipse.jpt.core.JpaAnnotationProvider;
+import org.eclipse.jpt.core.JpaFactory;
+import org.eclipse.jpt.core.JpaPlatformProvider;
+import org.eclipse.jpt.core.JpaValidation;
+import org.eclipse.jpt.core.internal.platform.GenericJpaPlatform;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+
+public class HibernateJpaPlatform extends GenericJpaPlatform {
+
+ public static final String ID = "hibernate"; //$NON-NLS-1$
+
+ public HibernateJpaPlatform(String id, JpaFactory jpaFactory, JpaAnnotationProvider jpaAnnotationProvider, JpaValidation jpaValidation, JpaPlatformProvider... platformProviders) {
+ super(id, jpaFactory, jpaAnnotationProvider, jpaValidation, platformProviders);
+ }
+
+ @Override
+ public String getId() {
+ return ID;
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaPlatformFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaPlatformFactory.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaPlatformFactory.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -0,0 +1,51 @@
+package org.jboss.tools.hibernate.jpt.core.internal;
+
+import org.eclipse.jpt.core.JpaAnnotationProvider;
+import org.eclipse.jpt.core.JpaFactory;
+import org.eclipse.jpt.core.JpaPlatform;
+import org.eclipse.jpt.core.JpaPlatformFactory;
+import org.eclipse.jpt.core.JpaValidation;
+import org.eclipse.jpt.core.JpaValidation.Supported;
+import org.eclipse.jpt.core.internal.platform.GenericJpaAnnotationDefinitionProvider;
+import org.eclipse.jpt.core.internal.platform.GenericJpaAnnotationProvider;
+import org.eclipse.jpt.core.internal.platform.GenericJpaFactory;
+import org.eclipse.jpt.core.internal.platform.GenericJpaPlatform;
+import org.eclipse.jpt.core.internal.platform.GenericJpaPlatformProvider;
+
+public class HibernateJpaPlatformFactory implements JpaPlatformFactory {
+
+ /**
+ * zero-argument constructor
+ */
+ public HibernateJpaPlatformFactory() {
+ super();
+ }
+
+ public JpaPlatform buildJpaPlatform(String id) {
+ return new HibernateJpaPlatform(
+ id,
+ buildJpaFactory(),
+ buildJpaAnnotationProvider(),
+ buildJpaValidation(),
+ GenericJpaPlatformProvider.instance());
+ }
+
+ protected JpaFactory buildJpaFactory() {
+ return new HibernateJpaFactory();
+ }
+
+ protected JpaAnnotationProvider buildJpaAnnotationProvider() {
+ return new GenericJpaAnnotationProvider(
+ GenericJpaAnnotationDefinitionProvider.instance(),
+ HibernateJpaAnnotationDefinitionProvider.instance());
+ }
+
+ protected JpaValidation buildJpaValidation() {
+ return new JpaValidation() {
+ public Supported getTablePerConcreteClassInheritanceIsSupported() {
+ return Supported.MAYBE;
+ }
+ };
+ }
+
+}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernatePlatform.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernatePlatform.java 2009-04-17 10:33:53 UTC (rev 14788)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernatePlatform.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.jpt.core.internal;
-
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.internal.platform.GenericJpaPlatform;
-
-/**
- * @author Dmitry Geraskov
- *
- */
-
-public class HibernatePlatform extends GenericJpaPlatform {
-
- public static final String ID = "hibernate"; //$NON-NLS-1$
-
- @Override
- public String getId() {
- return ID;
- }
-
- @Override
- protected JpaFactory buildJpaFactory() {
- return new HibernateFactory();
- }
-
- @Override
- protected JpaAnnotationProvider buildAnnotationProvider() {
- return new HibernateJpaAnnotationProvider();
- }
-
-}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/JPAPostInstallFasetListener.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/JPAPostInstallFasetListener.java 2009-04-17 10:33:53 UTC (rev 14788)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/JPAPostInstallFasetListener.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -29,7 +29,7 @@
IProject project = event.getProject().getProject();
IProjectFacetActionEvent pEvent = (IProjectFacetActionEvent)event;
if (pEvent.getProjectFacet().getId().equals(JptCorePlugin.FACET_ID)
- && HibernatePlatform.ID.equals(JptCorePlugin.getJpaPlatformId(project))){
+ && HibernateJpaPlatform.ID.equals(JptCorePlugin.getJpaPlatformId(project))){
if (checkPreConditions(project)){
buildConsoleConfiguration(project);
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateJpaProperties.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateJpaProperties.java 2009-04-17 10:33:53 UTC (rev 14788)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateJpaProperties.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -14,7 +14,7 @@
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.Property;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit.Property;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter;
import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java 2009-04-17 10:33:53 UTC (rev 14788)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -11,16 +11,8 @@
package org.jboss.tools.hibernate.jpt.core.internal.context;
import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -31,19 +23,19 @@
import org.eclipse.jpt.core.context.java.JavaPersistentType;
import org.eclipse.jpt.core.context.persistence.ClassRef;
import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.Property;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit.Property;
import org.eclipse.jpt.core.internal.context.persistence.GenericPersistenceUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.core.resource.persistence.XmlProperties;
-import org.eclipse.jpt.core.resource.persistence.XmlProperty;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
import org.eclipse.wst.validation.internal.core.Message;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.jboss.tools.hibernate.jpt.core.internal.HibernateJptPlugin;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.BasicHibernateProperties;
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.GenericGeneratorAnnotation;
@@ -64,10 +56,6 @@
public HibernatePersistenceUnit(Persistence parent,
XmlPersistenceUnit persistenceUnit) {
super(parent, persistenceUnit);
- }
-
- protected void initialize(XmlPersistenceUnit xmlPersistenceUnit) {
- super.initialize(xmlPersistenceUnit);
updateGenericGenerators();
this.hibernateProperties = new HibernateJpaProperties(this);
}
@@ -78,18 +66,13 @@
}
// ********** Validation ***********************************************
- public void validate(List<IMessage> messages) {
- addToMessages(messages);
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ addFileNotExistsMessages(messages, reporter);
}
- public void addToMessages(List<IMessage> messages) {
- invokeMethod(this, "addMappingFileMessages", "validateMappingFiles", //$NON-NLS-1$ //$NON-NLS-2$
- new Class[]{List.class}, messages);
- invokeMethod(this, "addClassMessages", "validateClassRefs", new Class[]{List.class}, messages); //$NON-NLS-1$//$NON-NLS-2$
- addFileNotExistsMessages(messages);
- }
-
- protected void addFileNotExistsMessages(List<IMessage> messages) {
+ protected void addFileNotExistsMessages(List<IMessage> messages, IReporter reporter) {
String configFile = getBasicProperties().getConfigurationFile();
if (configFile != null && configFile.length() > 0){
IPath path = new Path(configFile);
@@ -116,56 +99,6 @@
}
}
-
- /**
- * If persistence.xml contains 3 properties: dialect, driver, url and we delete
- * driver-property, then parent's method changes current properties so:
- * 1. replace 1-st model's property(dialect) with 1-st property from persistence.xml (dialect)
- * 2. replace 2-nd model's property(driver) with 2-nd property from persistence.xml (url)
- * 3. remove 3-rd model's property(url)
- * Step 3 call property change event which set url=null and this is wrong.
- * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=255149
- * TODO: remove after bug fixed.
- */
- @Override
- protected void updateProperties(XmlPersistenceUnit persistenceUnit) {
- XmlProperties xmlProperties = persistenceUnit.getProperties();
-
- Iterator<Property> stream = properties();
- Iterator<XmlProperty> stream2;
-
- if (xmlProperties == null) {
- stream2 = EmptyIterator.instance();
- }
- else {
- stream2 = new CloneIterator<XmlProperty>(xmlProperties.getProperties());//avoid ConcurrentModificationException
- }
-
- Map<String, XmlProperty> map = new HashMap<String, XmlProperty>();
- while (stream2.hasNext()){
- XmlProperty xmlProp = stream2.next();
- map.put(xmlProp.getName(), xmlProp);
- }
- Set<String> performedSet = new HashSet<String>();
- while (stream.hasNext()) {
- Property property = stream.next();
- if (map.containsKey(property.getName())) {
- XmlProperty xmlProp = map.get(property.getName());
- property.update(xmlProp);
- performedSet.add(property.getName());
- } else {
- removeProperty_(property);
- }
- }
-
- for (Entry<String, XmlProperty> entry : map.entrySet()) {
- if (!performedSet.contains(entry.getKey())) {
- addProperty_(buildProperty(entry.getValue()));
- }
- }
- }
-
-
/* (non-Javadoc)
* @see org.eclipse.jpt.core.internal.context.persistence.GenericPersistenceUnit#update(org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit)
*/
@@ -173,6 +106,7 @@
public void update(XmlPersistenceUnit persistenceUnit) {
super.update(persistenceUnit);
updateGenericGenerators();
+ this.fireListChanged(GENERATORS_LIST);
}
protected void updateGenericGenerators(){
@@ -181,22 +115,26 @@
for (ClassRef classRef : CollectionTools.iterable(classRefs())) {
String annotClass = classRef.getClassName();
JavaPersistentType type = classRef.getJavaPersistentType();
- JavaResourcePersistentMember jrpt = null;
- GenericGeneratorAnnotation annotation = null;
- jrpt = (JavaResourcePersistentMember) invokeMethod(project, "getJavaPersistentTypeResource", //$NON-NLS-1$
- "getJavaResourcePersistentType", new Class[]{String.class}, annotClass); //$NON-NLS-1$
+ JavaResourcePersistentType jrpt = project.getJavaResourcePersistentType(annotClass);
if (jrpt != null){
- annotation = (GenericGeneratorAnnotation)invokeMethod(jrpt, "getAnnotation", //$NON-NLS-1$
- "getSupportingAnnotation", new Class[]{String.class}, GENERIC_GENERATOR); //$NON-NLS-1$
+ GenericGeneratorAnnotation annotation = null;
+ JavaResourceNode jrn = jrpt.getSupportingAnnotation(GENERIC_GENERATOR);
+ if (jrn instanceof GenericGeneratorAnnotation) {
+ annotation = (GenericGeneratorAnnotation)jrn;
+ }
if (annotation != null) {
addGenerator(annotation.buildJavaGenericGenerator(type));
}
ListIterator<JavaPersistentAttribute> typeAttrs = type.attributes();
for (JavaPersistentAttribute persAttr : CollectionTools.iterable(typeAttrs)) {
+ if (persAttr.getSpecifiedMapping() == null) {
+ continue;
+ }
JavaResourcePersistentAttribute jrpa = persAttr.getResourcePersistentAttribute();
- annotation = (GenericGeneratorAnnotation)invokeMethod(jrpa, "getAnnotation", //$NON-NLS-1$
- "getSupportingAnnotation", new Class[]{String.class}, GENERIC_GENERATOR); //$NON-NLS-1$
-
+ jrn = jrpa.getSupportingAnnotation(GENERIC_GENERATOR);
+ if (jrn instanceof GenericGeneratorAnnotation) {
+ annotation = (GenericGeneratorAnnotation)jrn;
+ }
if (annotation != null) {
addGenerator(annotation.buildJavaGenericGenerator(persAttr.getSpecifiedMapping()));
}
@@ -204,67 +142,6 @@
}
}
}
-
- /**
- * Hack method needed to make Hibernate Platform portable between Dali 2.0 and Dali 2.1
- * @param object - object on which method will be called
- * @param dali20Name - method name in Dali 2.0
- * @param dali21Name - same method name in Dali 2.1
- * @param paramTypes - method arguments types.
- * @param args - arguments of the method
- * @return
- */
- private Object invokeMethod(Object object, String dali20Name, String dali21Name, Class[] argsTypes,
- Object... args){
- Method method = getMethod(object.getClass(), dali20Name, dali21Name, argsTypes);
- if (method != null){
- try {
- return method.invoke(object, args);
- } catch (IllegalArgumentException e) {
- HibernateJptPlugin.logException(e);
- } catch (IllegalAccessException e) {
- HibernateJptPlugin.logException(e);
- } catch (InvocationTargetException e) {
- HibernateJptPlugin.logException(e);
- }
- } else {
- StringBuilder params = new StringBuilder();
- for (int i = 0; i < argsTypes.length; i++) {
- params.append(argsTypes[i].getName() + ", "); //$NON-NLS-1$
- }
- if (params.length() > 0) params.deleteCharAt(params.length() - 2);
- HibernateJptPlugin.logError("Nor \"" + dali20Name + "\" nor \"" + dali21Name //$NON-NLS-1$//$NON-NLS-2$
- + "\" methods were found with parameter types: (" + params + ")"); //$NON-NLS-1$//$NON-NLS-2$
- }
- return null;
- }
-
- /**
- * Hack method needed to make Hibernate Platform portable between Dali 2.0 and Dali 2.1
- * @param parent
- * @param dali20Name - method name in Dali 2.0
- * @param dali21Name - same method name in Dali 2.1
- * @param parameterTypes
- * @return
- */
- private Method getMethod(Class parent, String dali20Name, String dali21Name, Class... parameterTypes){
- Class clazz = parent;
- while (clazz != null){
- Method method = null;
- try {//try to get method from Dali 2.0
- method = clazz.getDeclaredMethod(dali20Name, parameterTypes);
- return method;
- } catch (Exception e) {
- try {//try to get method from Dali 2.1
- method = clazz.getDeclaredMethod(dali21Name, parameterTypes);
- return method;
- } catch (Exception e1) {
- clazz = clazz.getSuperclass();
- }
- }
- }
- return null;
- }
/**
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnitProperties.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnitProperties.java 2009-04-17 10:33:53 UTC (rev 14788)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnitProperties.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -15,7 +15,7 @@
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.Property;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit.Property;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.model.value.ListValueModel;
@@ -127,7 +127,7 @@
protected String getStringValue(String key, String keySuffix) {
String elKey = (keySuffix == null) ? key : key + keySuffix;
- if (this.persistenceUnit().containsProperty(elKey)) {
+ if (this.persistenceUnit().getProperty(elKey) != null) {
// TOREVIEW - handle incorrect String in persistence.xml
return this.persistenceUnit().getProperty(elKey).getValue();
}
@@ -150,7 +150,7 @@
this.persistenceUnit().removeProperty(elKey);
}
else {
- this.persistenceUnit().putProperty(elKey, newValue, allowDuplicate);
+ this.persistenceUnit().setProperty(elKey, newValue, allowDuplicate);
}
}
@@ -173,14 +173,16 @@
}
private void putProperty_(String key, Object value) {
- this.persistenceUnit().putProperty(key, value.toString(), false);
+ this.persistenceUnit().setProperty(key, value.toString(), false);
}
/**
* Removes a property with the given key.
*/
protected void removeProperty(String key) {
- this.persistenceUnit().removeProperty(key);
+ if(this.persistenceUnit().getProperty(key) != null) {
+ this.persistenceUnit().removeProperty(key);
+ }
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/PersistenceUnitProperties.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/PersistenceUnitProperties.java 2009-04-17 10:33:53 UTC (rev 14788)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/PersistenceUnitProperties.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -12,7 +12,7 @@
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.Property;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit.Property;
import org.eclipse.jpt.utility.model.Model;
import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/PersistenceUnitPropertyListListener.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/PersistenceUnitPropertyListListener.java 2009-04-17 10:33:53 UTC (rev 14788)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/PersistenceUnitPropertyListListener.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -12,7 +12,7 @@
import java.util.Iterator;
-import org.eclipse.jpt.core.context.persistence.Property;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit.Property;
import org.eclipse.jpt.utility.model.Model;
import org.eclipse.jpt.utility.model.event.ListChangeEvent;
import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/HibernateBasic.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/HibernateBasic.java 2009-04-17 10:33:53 UTC (rev 14788)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/HibernateBasic.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -13,7 +13,7 @@
import java.util.Map;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.Property;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit.Property;
import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.utility.model.value.ListValueModel;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnitProperties;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaGenericGeneratorImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaGenericGeneratorImpl.java 2009-04-17 10:33:53 UTC (rev 14788)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaGenericGeneratorImpl.java 2009-04-17 10:57:20 UTC (rev 14789)
@@ -39,7 +39,7 @@
return (GenericGeneratorAnnotation) generatorResource;
}
- public Integer getDefaultInitialValue() {
+ public int getDefaultInitialValue() {
return GenericGenerator.DEFAULT_INITIAL_VALUE;
}
15 years, 8 months
JBoss Tools SVN: r14788 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration: actions and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-04-17 06:33:53 -0400 (Fri, 17 Apr 2009)
New Revision: 14788
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/actions/
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/actions/OpenEditorEditInnerContentsAction.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/groovy/ScriptUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ImportTypeUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java
Log:
JBIDE-4192
Add a action on Section toolbar to open a editor to edit inner template contents
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/actions/OpenEditorEditInnerContentsAction.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/actions/OpenEditorEditInnerContentsAction.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/actions/OpenEditorEditInnerContentsAction.java 2009-04-17 10:33:53 UTC (rev 14788)
@@ -0,0 +1,300 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.actions;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.ecore.xml.type.AnyType;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
+
+/**
+ * @author DartPeng
+ *
+ */
+public class OpenEditorEditInnerContentsAction extends Action {
+
+ private AnyType model;
+
+ private int textType = SmooksUIUtils.VALUE_TYPE_TEXT;
+
+ private String fileExtensionName = "txt";
+
+ private String editorID = null;
+
+ private IResource resource = null;
+
+ private IEditorPart tempEditor = null;
+
+ private TempFileChangeListener tempFileListener = null;
+
+ private IPartListener tempEditorlistener = null;
+
+ private EditingDomain editingDomain;
+
+ private IFile tempFile;
+
+ public OpenEditorEditInnerContentsAction(EditingDomain domain, AnyType model, int textType, String fileExtensionName, String editorID) {
+ super();
+ this.model = model;
+ this.editingDomain = domain;
+ this.textType = textType;
+ this.fileExtensionName = fileExtensionName;
+ this.editorID = editorID;
+ tempFileListener = new TempFileChangeListener();
+ setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FILE));
+ setDescription("Open an editor to edit inner contents");
+ setText("Open Editor");
+ }
+
+ public OpenEditorEditInnerContentsAction(EditingDomain domain, AnyType model, int textType, String fileExtensionName) {
+ this(domain, model, textType, fileExtensionName, null);
+ }
+
+ private void setContent(AnyType model, String contents, int textType) {
+ String editValue = null;
+ if (textType == SmooksUIUtils.VALUE_TYPE_TEXT && model instanceof AnyType) {
+ editValue = SmooksModelUtils.getAnyTypeText((AnyType) model);
+ if (!contents.equals(editValue)) {
+ SmooksModelUtils.setTextToAnyType((AnyType) model, contents);
+ }
+ }
+ if (textType == SmooksUIUtils.VALUE_TYPE_COMMENT && model instanceof AnyType) {
+ editValue = SmooksModelUtils.getAnyTypeComment((AnyType) model);
+ if (!contents.equals(editValue)) {
+ SmooksModelUtils.setCommentToSmooksType(editingDomain, (AnyType) model, contents);
+ }
+ }
+ if (textType == SmooksUIUtils.VALUE_TYPE_CDATA && model instanceof AnyType) {
+ editValue = SmooksModelUtils.getAnyTypeCDATA((AnyType) model);
+ if (!contents.equals(editValue)) {
+ SmooksModelUtils.setCDATAToSmooksType(editingDomain, (AnyType) model, contents);
+ }
+ }
+ }
+
+ @Override
+ public void run() {
+ IWorkbenchWindow window = SmooksConfigurationActivator.getDefault().getWorkbench().getActiveWorkbenchWindow();
+ try {
+ if (tempFile != null && tempFile.exists()) {
+ if (editorID != null) {
+ FileEditorInput editorInput1 = new FileEditorInput(tempFile);
+ tempEditor = window.getActivePage().openEditor(editorInput1, editorID);
+ } else {
+ tempEditor = IDE.openEditor(window.getActivePage(), tempFile);
+ }
+ return ;
+ }
+ if (tempEditorlistener != null) {
+ SmooksConfigurationActivator.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().removePartListener(
+ tempEditorlistener);
+ }
+ if (tempFileListener != null) {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(tempFileListener);
+ }
+ String editValue = null;
+ if (textType == SmooksUIUtils.VALUE_TYPE_TEXT && model instanceof AnyType) {
+ editValue = SmooksModelUtils.getAnyTypeText((AnyType) model);
+ }
+ if (textType == SmooksUIUtils.VALUE_TYPE_COMMENT && model instanceof AnyType) {
+ editValue = SmooksModelUtils.getAnyTypeComment((AnyType) model);
+ }
+ if (textType == SmooksUIUtils.VALUE_TYPE_CDATA && model instanceof AnyType) {
+ editValue = SmooksModelUtils.getAnyTypeCDATA((AnyType) model);
+ }
+ if (editValue != null) {
+ resource = SmooksUIUtils.getResource(model);
+ if (resource != null) {
+ IProject project = resource.getProject();
+ String name = generateFileName();
+ tempFile = project.getFile(name + "." + fileExtensionName);
+ int i = 0;
+ while (tempFile.exists()) {
+ name += String.valueOf(i);
+ tempFile = project.getFile(name + "." + fileExtensionName);
+ i++;
+ }
+ tempFile.create(new ByteArrayInputStream(editValue.getBytes()), true, new NullProgressMonitor());
+ tempFile.setHidden(true);
+ FileEditorInput editorInput = new FileEditorInput(tempFile);
+ editorInput = new FileEditorInput(tempFile);
+ if (editorID != null) {
+ tempEditor = window.getActivePage().openEditor(editorInput, editorID);
+ } else {
+ tempEditor = IDE.openEditor(window.getActivePage(), tempFile);
+ }
+
+ tempEditorlistener = new IPartListener() {
+
+ public void partActivated(IWorkbenchPart part) {
+
+ }
+
+ public void partBroughtToTop(IWorkbenchPart part) {
+
+ }
+
+ public void partClosed(IWorkbenchPart part) {
+ if (tempEditor != null && part == tempEditor) {
+ SmooksConfigurationActivator.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .removePartListener(tempEditorlistener);
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(tempFileListener);
+ try {
+ tempFile.delete(true, new NullProgressMonitor());
+ tempFile.refreshLocal(0, null);
+ tempFile = null;
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void partDeactivated(IWorkbenchPart part) {
+
+ }
+
+ public void partOpened(IWorkbenchPart part) {
+
+ }
+ };
+ SmooksConfigurationActivator.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().addPartListener(
+ tempEditorlistener);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(tempFileListener);
+ }
+ }
+ } catch (Exception e) {
+
+ }
+ }
+
+ private String generateFileName() {
+ int number = (int) System.currentTimeMillis();
+ return "tempFile_" + String.valueOf(number);
+ }
+
+ private class TempFileChangeListener implements IResourceChangeListener {
+
+ public void resourceChanged(IResourceChangeEvent event) {
+ IResource res = event.getResource();
+ try {
+ switch (event.getType()) {
+ case IResourceChangeEvent.PRE_CLOSE:
+ System.out.print("Project ");
+ System.out.print(res.getFullPath());
+ System.out.println(" is about to close.");
+ break;
+ case IResourceChangeEvent.PRE_DELETE:
+ System.out.print("Project ");
+ System.out.print(res.getFullPath());
+ System.out.println(" is about to be deleted.");
+ break;
+ case IResourceChangeEvent.POST_CHANGE:
+ System.out.println("Resources have changed.");
+ event.getDelta().accept(new DeltaPrinter());
+ break;
+ case IResourceChangeEvent.PRE_BUILD:
+ System.out.println("Build about to run.");
+ event.getDelta().accept(new DeltaPrinter());
+ break;
+ case IResourceChangeEvent.POST_BUILD:
+ System.out.println("Build complete.");
+ event.getDelta().accept(new DeltaPrinter());
+ break;
+ }
+ } catch (Throwable t) {
+
+ }
+ }
+ }
+
+ class DeltaPrinter implements IResourceDeltaVisitor {
+
+ private String getContents() throws IOException {
+ File file = ((IFile) tempFile).getLocation().toFile();
+ FileReader fr = new FileReader(file);
+ BufferedReader reader = new BufferedReader(fr);
+ String line = reader.readLine();
+ String contents = "";
+ while (line != null) {
+ contents += line + "\n";
+ line = reader.readLine();
+ }
+ return contents;
+ }
+
+ public boolean visit(IResourceDelta delta) {
+ IResource res = delta.getResource();
+ switch (delta.getKind()) {
+ case IResourceDelta.ADDED:
+ System.out.print("Resource ");
+ System.out.print(res.getFullPath());
+ System.out.println(" was added.");
+ break;
+ case IResourceDelta.REMOVED:
+ System.out.print("Resource ");
+ System.out.print(res.getFullPath());
+ System.out.println(" was removed.");
+ if (res == resource) {
+ return false;
+ }
+ break;
+ case IResourceDelta.CHANGED:
+ System.out.print("Resource ");
+ System.out.print(delta.getFullPath());
+ System.out.println(" has changed.");
+ if (res instanceof IFile) {
+ if (((IFile) res).getLocation().equals(tempFile.getLocation())) {
+ try {
+ setContent(model, getContents(), textType);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ int flags = delta.getFlags();
+ if ((flags & IResourceDelta.CONTENT) != 0) {
+
+ }
+ if ((flags & IResourceDelta.REPLACED) != 0) {
+ System.out.println("--> Content Replaced");
+ }
+ if ((flags & IResourceDelta.MARKERS) != 0) {
+ System.out.println("--> Marker Change");
+ // IMarkerDelta[] markers = delta.getMarkerDeltas();
+ // if interested in markers, check these deltas
+ }
+ break;
+
+ }
+ return true; // visit the children
+ }
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/actions/OpenEditorEditInnerContentsAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java 2009-04-17 09:41:05 UTC (rev 14787)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java 2009-04-17 10:33:53 UTC (rev 14788)
@@ -42,7 +42,7 @@
}
if (feature == EdiPackage.eINSTANCE.getEDIReader_MappingModel()) {
SmooksUIUtils.createFileSelectionTextFieldEditor(null, parent, null, toolkit, propertyDescriptor, model, SmooksUIUtils.VALUE_TYPE_VALUE,
- SmooksMultiFormEditor.EDITOR_ID);
+ SmooksMultiFormEditor.EDITOR_ID,null);
return parent;
}
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java 2009-04-17 09:41:05 UTC (rev 14787)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java 2009-04-17 10:33:53 UTC (rev 14788)
@@ -11,10 +11,12 @@
package org.jboss.tools.smooks.configuration.editors.freemarker;
import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.actions.OpenEditorEditInnerContentsAction;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
@@ -47,10 +49,13 @@
@Override
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent, Object model,
SmooksMultiFormEditor formEditor) {
+ OpenEditorEditInnerContentsAction action1 = new OpenEditorEditInnerContentsAction(editingdomain,(AnyType) model, SmooksUIUtils.VALUE_TYPE_CDATA, "flt");
+ OpenEditorEditInnerContentsAction action2 = new OpenEditorEditInnerContentsAction(editingdomain,(AnyType) model, SmooksUIUtils.VALUE_TYPE_COMMENT, "flt");
+
SmooksUIUtils.createFileSelectionTextFieldEditor("Text Value", parent, editingdomain, toolkit, null, model, SmooksUIUtils.VALUE_TYPE_TEXT,
- null);
- SmooksUIUtils.createCDATAFieldEditor("Template Contents(CDATA)", editingdomain, toolkit, parent, model);
- SmooksUIUtils.createCommentFieldEditor("Template Contents(Comment)", editingdomain, toolkit, parent, model);
+ null, null);
+ SmooksUIUtils.createCDATAFieldEditor("Template Contents(CDATA)", editingdomain, toolkit, parent, model, action1);
+ SmooksUIUtils.createCommentFieldEditor("Template Contents(Comment)", editingdomain, toolkit, parent, model, action2);
}
@Override
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/groovy/ScriptUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/groovy/ScriptUICreator.java 2009-04-17 09:41:05 UTC (rev 14787)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/groovy/ScriptUICreator.java 2009-04-17 10:33:53 UTC (rev 14788)
@@ -11,19 +11,20 @@
package org.jboss.tools.smooks.configuration.editors.groovy;
import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.actions.OpenEditorEditInnerContentsAction;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
/**
- * @author Dart Peng (dpeng(a)redhat.com)
- * Date Apr 13, 2009
+ * @author Dart Peng (dpeng(a)redhat.com) Date Apr 13, 2009
*/
-public class ScriptUICreator extends PropertyUICreator {
+public class ScriptUICreator extends PropertyUICreator {
/*
* (non-Javadoc)
*
@@ -33,16 +34,16 @@
* org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object,
* org.eclipse.emf.ecore.EAttribute)
*/
- public Composite createPropertyUI(FormToolkit toolkit, Composite parent,
- IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
- SmooksMultiFormEditor formEditor) {
+ public Composite createPropertyUI(FormToolkit toolkit, Composite parent, IItemPropertyDescriptor propertyDescriptor, Object model,
+ EAttribute feature, SmooksMultiFormEditor formEditor) {
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor);
}
@Override
- public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit,
- Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createCommentFieldEditor("Script Contents",editingdomain, toolkit, parent, model);
+ public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent, Object model,
+ SmooksMultiFormEditor formEditor) {
+ OpenEditorEditInnerContentsAction action2 = new OpenEditorEditInnerContentsAction(editingdomain,(AnyType) model, SmooksUIUtils.VALUE_TYPE_COMMENT, "groovy");
+ SmooksUIUtils.createCommentFieldEditor("Script Contents", editingdomain, toolkit, parent, model, action2);
}
@Override
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ImportTypeUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ImportTypeUICreator.java 2009-04-17 09:41:05 UTC (rev 14787)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ImportTypeUICreator.java 2009-04-17 10:33:53 UTC (rev 14788)
@@ -37,7 +37,7 @@
EAttribute feature, SmooksMultiFormEditor formEditor) {
if (feature == SmooksPackage.eINSTANCE.getImportType_File()) {
SmooksUIUtils.createFileSelectionTextFieldEditor(null, parent, null, toolkit, propertyDescriptor, model, SmooksUIUtils.VALUE_TYPE_VALUE,
- SmooksMultiFormEditor.EDITOR_ID);
+ SmooksMultiFormEditor.EDITOR_ID,null);
return parent;
}
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java 2009-04-17 09:41:05 UTC (rev 14787)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java 2009-04-17 10:33:53 UTC (rev 14788)
@@ -46,7 +46,7 @@
@Override
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit,
Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain, toolkit, parent, model , false , 500,false,false,null);
- SmooksUIUtils.createCDATAFieldEditor("CDATA Value", editingdomain, toolkit, parent, model);
+ SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain, toolkit, parent, model , false , 500,false,false,null,null);
+ SmooksUIUtils.createCDATAFieldEditor("CDATA Value", editingdomain, toolkit, parent, model,null);
}
}
\ No newline at end of file
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-17 09:41:05 UTC (rev 14787)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-17 10:33:53 UTC (rev 14788)
@@ -40,16 +40,20 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -61,6 +65,7 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.IFormColors;
@@ -72,6 +77,7 @@
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.configuration.actions.OpenEditorEditInnerContentsAction;
import org.jboss.tools.smooks.configuration.editors.ClassPathFileProcessor;
import org.jboss.tools.smooks.configuration.editors.CurrentProjecViewerFilter;
import org.jboss.tools.smooks.configuration.editors.FileSelectionWizard;
@@ -113,17 +119,17 @@
public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
Object model, boolean linkLabel, IHyperlinkListener listener) {
- createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, false, 0, linkLabel, false, listener);
+ createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, false, 0, linkLabel, false, listener,null);
}
public static void createMultiMixedTextFieldEditor(String label, AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit,
- Composite parent, Object model, int height) {
- createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, true, height, false, false, null);
+ Composite parent, Object model, int height,OpenEditorEditInnerContentsAction action) {
+ createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, true, height, false, false, null,action);
}
public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
- Object model, boolean multiText, int height, boolean linkLabel, boolean openFile, IHyperlinkListener listener) {
- createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, multiText, linkLabel, openFile, height, listener, VALUE_TYPE_TEXT);
+ Object model, boolean multiText, int height, boolean linkLabel, boolean openFile, IHyperlinkListener listener,OpenEditorEditInnerContentsAction action) {
+ createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, multiText, linkLabel, openFile, height, listener, VALUE_TYPE_TEXT,action);
}
public static Control createFieldEditorLabel(Composite parent, FormToolkit formToolKit, IItemPropertyDescriptor itemPropertyDescriptor,
@@ -265,25 +271,25 @@
public static Text createStringFieldEditor(final Composite parent, FormToolkit toolkit, final IItemPropertyDescriptor itemPropertyDescriptor,
Object model, boolean linkLabel, boolean openFile, IHyperlinkListener listener) {
return createStringFieldEditor(null, parent, null, toolkit, itemPropertyDescriptor, model, false, linkLabel, openFile, 0, listener,
- VALUE_TYPE_VALUE);
+ VALUE_TYPE_VALUE,null);
}
public static Text createFileSelectionTextFieldEditor(String label, final Composite parent, EditingDomain editingdomain, FormToolkit toolkit,
- final IItemPropertyDescriptor itemPropertyDescriptor, final Object model, int valueType , String editorID) {
- OpenFileHyperLinkListener listener = new OpenFileHyperLinkListener(valueType,itemPropertyDescriptor,model,editorID);
+ final IItemPropertyDescriptor itemPropertyDescriptor, final Object model, int valueType, String editorID,OpenEditorEditInnerContentsAction action) {
+ OpenFileHyperLinkListener listener = new OpenFileHyperLinkListener(valueType, itemPropertyDescriptor, model, editorID);
return createStringFieldEditor(label, parent, editingdomain, toolkit, itemPropertyDescriptor, model, false, true, true, 0, listener,
- valueType);
+ valueType,action);
}
public static Text createStringFieldEditor(String label, final Composite parent, EditingDomain editingdomain, FormToolkit toolkit,
final IItemPropertyDescriptor itemPropertyDescriptor, Object model, boolean multiText, boolean linkLabel, boolean openFile, int height,
- IHyperlinkListener listener, int valueType) {
+ IHyperlinkListener listener, int valueType,OpenEditorEditInnerContentsAction openEditorAction) {
GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
Section section = null;
Composite textContainer = null;
final Object fm = model;
final EditingDomain fEditingDomain = editingdomain;
- if(label == null && itemPropertyDescriptor != null){
+ if (label == null && itemPropertyDescriptor != null) {
label = itemPropertyDescriptor.getDisplayName(model);
EAttribute feature = (EAttribute) itemPropertyDescriptor.getFeature(model);
if (feature.isRequired()) {
@@ -297,10 +303,29 @@
gd.heightHint = 10;
space.setLayoutData(gd);
- section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE);
+ section = toolkit.createSection(parent, Section.TITLE_BAR |Section.TWISTIE);
FillLayout layout = new FillLayout();
section.setLayout(layout);
section.setText(label);
+ if (openEditorAction != null) {
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
+
+ ToolBar toolbar = toolBarManager.createControl(section);
+ final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
+ toolbar.setCursor(handCursor);
+ // Cursor needs to be explicitly disposed
+ toolbar.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ if ((handCursor != null) && (handCursor.isDisposed() == false)) {
+ handCursor.dispose();
+ }
+ }
+ });
+ toolBarManager.add(openEditorAction);
+ toolBarManager.update(true);
+ section.setTextClient(toolbar);
+ section.layout();
+ }
Composite textComposite = toolkit.createComposite(section);
section.setClient(textComposite);
@@ -447,6 +472,7 @@
});
}
}
+ if(section != null ) section.layout();
return valueText;
}
@@ -491,13 +517,13 @@
}
public static void createCDATAFieldEditor(String label, AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
- Object model) {
- createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, true, true, false, 300, null, VALUE_TYPE_CDATA);
+ Object model,OpenEditorEditInnerContentsAction action) {
+ createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, true, true, false, 300, null, VALUE_TYPE_CDATA,action);
}
public static void createCommentFieldEditor(String label, AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
- Object model) {
- createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, true, true, false, 300, null, VALUE_TYPE_COMMENT);
+ Object model,OpenEditorEditInnerContentsAction action) {
+ createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, true, true, false, 300, null, VALUE_TYPE_COMMENT,action);
}
public static Composite createJavaTypeSearchFieldEditor(Composite parent, FormToolkit toolkit, final IItemPropertyDescriptor propertyDescriptor,
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java 2009-04-17 09:41:05 UTC (rev 14787)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java 2009-04-17 10:33:53 UTC (rev 14788)
@@ -11,10 +11,12 @@
package org.jboss.tools.smooks.configuration.editors.xsl;
import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.actions.OpenEditorEditInnerContentsAction;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
@@ -62,9 +64,12 @@
@Override
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent, Object model,
SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createFileSelectionTextFieldEditor("Text Value", parent, editingdomain, toolkit, null, model, SmooksUIUtils.VALUE_TYPE_TEXT, null);
- SmooksUIUtils.createCDATAFieldEditor("Template Contents (CDATA)", editingdomain, toolkit, parent, model);
- SmooksUIUtils.createCommentFieldEditor("Template Contents (Comment)", editingdomain, toolkit, parent, model);
+ OpenEditorEditInnerContentsAction action1 = new OpenEditorEditInnerContentsAction(editingdomain,(AnyType) model, SmooksUIUtils.VALUE_TYPE_CDATA, "xsl");
+ OpenEditorEditInnerContentsAction action2 = new OpenEditorEditInnerContentsAction(editingdomain,(AnyType) model, SmooksUIUtils.VALUE_TYPE_COMMENT, "xsl");
+ SmooksUIUtils.createFileSelectionTextFieldEditor("Text Value", parent, editingdomain, toolkit, null, model, SmooksUIUtils.VALUE_TYPE_TEXT,
+ null, null);
+ SmooksUIUtils.createCDATAFieldEditor("Template Contents (CDATA)", editingdomain, toolkit, parent, model, action1);
+ SmooksUIUtils.createCommentFieldEditor("Template Contents (Comment)", editingdomain, toolkit, parent, model, action2);
}
}
\ No newline at end of file
15 years, 8 months
JBoss Tools SVN: r14786 - trunk/hibernatetools/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-04-17 05:39:20 -0400 (Fri, 17 Apr 2009)
New Revision: 14786
Modified:
trunk/hibernatetools/docs/reference/en/modules/setup.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-684 - updating prerequisites and tools versions;
Modified: trunk/hibernatetools/docs/reference/en/modules/setup.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en/modules/setup.xml 2009-04-17 07:59:01 UTC (rev 14785)
+++ trunk/hibernatetools/docs/reference/en/modules/setup.xml 2009-04-17 09:39:20 UTC (rev 14786)
@@ -3,31 +3,35 @@
<title>Download and install Hibernate Tools</title>
<para><property>Hibernate Tools</property> can be used "standalone" via Ant
- 1.6.x or fully integrated into an Eclipse 3.3.x + WTP 2.x based IDE, such as <property>JBoss
- Tools</property> or a default Eclipse 3.3.x + WTP 2.x installation. The following describes
- the install steps in these environments.</para>
+ 1.6.x or fully integrated into an Eclipse + WTP based IDE, such as <property>JBDS/JBoss
+ Tools</property>, or a default Eclipse + WTP installation. The following sections describe the
+ install steps in these environments.</para>
+ <note>
+ <title>Note:</title>
+ <para>The <property>Hibernate Tools 3.2.4.GA</property> (the current release version) requires
+ Eclipse Ganymede 3.4.2.</para>
+ </note>
+
<section>
<title>JBoss Tools</title>
- <para><property>JBoss Tools 2.x</property> includes <property>Hibernate Tools</property> and
- thus nothing is required besides <ulink url="http://labs.jboss.com/tools/download/index.html"
- >downloading</ulink> and <ulink
- url="&gsglink;#JBossToolsInstall"
- >installing JBoss Tools</ulink>. If you need to update to a newer version of the
- <property>Hibernate Tools</property> just follow the instructions in the Eclipse IDE
- section.</para>
+ <para><property>JBoss Tools 3.0.0.GA</property> (the latest release) includes
+ <property>Hibernate Tools 3.2.4.GA</property> and thus nothing is required besides <ulink
+ url="http://jboss.org/tools/download/stable/3_0_0_GA.html">downloading</ulink> and <ulink
+ url="&gsglink;#JBossToolsInstall">installing JBoss Tools</ulink>. If you need to update
+ to a newer version of the <property>Hibernate Tools</property> just follow the instructions in
+ the Eclipse IDE section.</para>
</section>
<section>
<title>Eclipse IDE</title>
- <para>To install into any <property>Eclipse 3.3.x</property> based Eclipse IDE you can either
- download the <property>Hibernate Tools</property> distribution from the <ulink
- url="http://www.hibernate.org/6.html">Hibernate website</ulink> or use the <ulink
- url="http://download.jboss.org/jbosstools/updates/stable/">JBoss Tools Update Site</ulink>
- (see also <ulink url="http://tools.hibernate.org">http://tools.hibernate.org</ulink> for links
- to the update site).</para>
+ <para>To install the <property>Hibernate Tools</property> into any <property>Eclipse 3.4.x</property> based IDE you
+ can either download the <property>Hibernate Tools</property> distribution from the <ulink
+ url="http://jboss.org/tools/download/stable/3_0_0_GA.html">JBoss Tools download page</ulink>
+ or from the <ulink url="http://download.jboss.org/jbosstools/updates/stable/">JBoss Tools
+ Update Site</ulink>.</para>
<para>If you download the <property>Hibernate Tools</property> distribution you need to place
the <emphasis>
@@ -36,10 +40,12 @@
<property>/feature</property>
</emphasis> directory into your eclipse directory or eclipse extensions directory. Sometimes
Eclipse does not automatically detect new plugins and thus the tools will not be activated. To
- ensure eclipse sees these changes just clean up the cached plugin information by running eclipse with the <emphasis>
- <property>-clean</property></emphasis> option, e.g. <emphasis>
- <property>eclipse
- -clean</property>.</emphasis> Using the updatesite does not require any additional steps.</para>
+ ensure eclipse sees these changes just clean up the cached plugin information by running
+ eclipse with the <emphasis>
+ <property>-clean</property>
+ </emphasis> option, e.g. <emphasis>
+ <property>eclipse -clean</property>.</emphasis> Using the updatesite does not require any
+ additional steps.</para>
<note>
<title>Note:</title>
@@ -55,7 +61,7 @@
<title>Usage of Eclipse WTP</title>
<para>The <property>Hibernate Tools</property> plugins currently use <property>WTP
- 2.x</property> which at this time is the latest stable release from the Eclipse Webtools
+ 3.x</property> which at this time is the latest stable release from the Eclipse Webtools
project.</para>
<para>Because the WTP project not always have had proper versioning of their plugins there
@@ -75,8 +81,8 @@
</emphasis> and associated libraries. The libraries are included in the distribution from the
Hibernate website and the Eclipse updatesite. The libraries are located in the eclipse plugins
directory at <emphasis>
- <property>/plugins/org.hibernate.eclipse.x.x.x/lib/tools/</property></emphasis>. These libraries are 100%
- independent from the eclipse platform. How to use these via ant tasks are described in the
- <link linkend="ant">Ant Tools</link> chapter.</para>
+ <property>/plugins/org.hibernate.eclipse.x.x.x/lib/tools/</property>
+ </emphasis>. These libraries are 100% independent from the eclipse platform. How to use these
+ via ant tasks are described in the <link linkend="ant">Ant Tools</link> chapter.</para>
</section>
</chapter>
15 years, 8 months
JBoss Tools SVN: r14785 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors: edireader and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-04-17 03:59:01 -0400 (Fri, 17 Apr 2009)
New Revision: 14785
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ClassPathFileProcessor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/CurrentProjecViewerFilter.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/IFilePathProcessor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/OpenFileHyperLinkListener.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ImportTypeUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java
Log:
JBIDE-4192
Add a button to select workspace/filesystem file
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ClassPathFileProcessor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ClassPathFileProcessor.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ClassPathFileProcessor.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -0,0 +1,70 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.editors;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+
+/**
+ * @author DartPeng
+ *
+ */
+public class ClassPathFileProcessor implements IFilePathProcessor {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.IFilePathProcessor#
+ * processFileSystemPath(java.lang.String)
+ */
+ public String processFileSystemPath(String filePath) {
+ return filePath;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.IFilePathProcessor#
+ * processWorkBenchPath(org.eclipse.core.resources.IFile)
+ */
+ public String processWorkBenchPath(IFile file) {
+ IProject project = file.getProject();
+ IJavaProject javaProject = JavaCore.create(project);
+ String path = null;
+ if (javaProject != null) {
+ try {
+ IClasspathEntry[] classpathEntries = javaProject.getRawClasspath();
+ for (int i = 0; i < classpathEntries.length; i++) {
+ IClasspathEntry entry = classpathEntries[i];
+// if(entry.getEntryKind() == IClasspathEntry.CPE_SOURCE){
+ IPath sourcePath = entry.getPath();
+ if(sourcePath.isPrefixOf(file.getFullPath())){
+ IPath filePath = file.getFullPath();
+ String sp = sourcePath.toPortableString();
+ String fp = filePath.toPortableString();
+ path = fp.substring(0, sp.length());
+ break;
+ }
+// }
+ }
+ } catch (JavaModelException e) {
+// e.printStackTrace();
+ // ignore
+ }
+ }
+ if(path == null){
+ path = file.getFullPath().removeFirstSegments(1).toPortableString();
+ }
+ if(path.charAt(0) != '\\' || path.charAt(0) != '/' ){
+ path = "/" + path;
+ }
+ return path;
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ClassPathFileProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/CurrentProjecViewerFilter.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/CurrentProjecViewerFilter.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/CurrentProjecViewerFilter.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -0,0 +1,56 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.editors;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+
+/**
+ * @author DartPeng
+ *
+ */
+public class CurrentProjecViewerFilter extends ViewerFilter {
+
+ private IResource referenceResource;
+
+ public CurrentProjecViewerFilter(IResource referenceResource) {
+ this.referenceResource = referenceResource;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers
+ * .Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ IProject project = null;
+ if (referenceResource != null) {
+ project = referenceResource.getProject();
+ }
+ if (project == null) {
+ return true;
+ }
+ IResource resource = null;
+ if (element instanceof IResource) {
+ resource = (IResource)element;
+ } else {
+ if (element instanceof IAdaptable) {
+ resource = (IResource) ((IAdaptable) element).getAdapter(IResource.class);
+ }
+ }
+ if (resource != null) {
+ if(project == resource.getProject()){
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/CurrentProjecViewerFilter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizard.java 2009-04-17 06:42:42 UTC (rev 14784)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizard.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -33,6 +33,8 @@
private Object[] initSelections = null;
private boolean multiSelect = false;
+
+ private IFilePathProcessor filePathProcessor = null;
@Override
public void addPages() {
@@ -40,6 +42,7 @@
fileSelectionWizardPage.setFilters(viewerFilters);
fileSelectionWizardPage.setInitSelections(getInitSelections());
fileSelectionWizardPage.setMultiSelect(isMultiSelect());
+ fileSelectionWizardPage.setFilePathProcessor(getFilePathProcessor());
this.addPage(fileSelectionWizardPage);
}
@@ -90,7 +93,12 @@
public void setViewerFilters(List<ViewerFilter> viewerFilters) {
this.viewerFilters = viewerFilters;
}
-
-
+ public void setFilePathProcessor(IFilePathProcessor filePathProcessor) {
+ this.filePathProcessor = filePathProcessor;
+ }
+
+ public IFilePathProcessor getFilePathProcessor() {
+ return filePathProcessor;
+ }
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizardPage.java 2009-04-17 06:42:42 UTC (rev 14784)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/FileSelectionWizardPage.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -11,49 +11,68 @@
package org.jboss.tools.smooks.configuration.editors;
import org.eclipse.core.resources.IFile;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
import org.jboss.tools.smooks.configuration.editors.xml.AbstractFileSelectionWizardPage;
/**
- * @author Dart Peng (dpeng(a)redhat.com)
- * Date Apr 13, 2009
+ * @author Dart Peng (dpeng(a)redhat.com) Date Apr 13, 2009
*/
public class FileSelectionWizardPage extends AbstractFileSelectionWizardPage {
-
+
+ private ProtableFileStringProcessor processor = null;
+
public FileSelectionWizardPage(String pageName) {
super(pageName);
- // TODO Auto-generated constructor stub
+ processor = new ProtableFileStringProcessor();
+ setFilePathProcessor(processor);
}
- /* (non-Javadoc)
- * @see org.jboss.tools.smooks.configuration.editors.xml.AbstractFileSelectionWizardPage#loadedTheObject(java.lang.String)
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.xml.
+ * AbstractFileSelectionWizardPage#loadedTheObject(java.lang.String)
*/
@Override
protected Object loadedTheObject(String path) throws Exception {
// TODO Auto-generated method stub
return null;
}
-
-
+
@Override
- protected Composite createFileSelectionComposite(Composite parent) {
- Composite composite = super.createFileSelectionComposite(parent);
- GridData gd = new GridData();
- gd.widthHint = 0;
- fileSystemBrowseButton.setLayoutData(gd);
- this.fileSystemBrowseButton.setVisible(false);
- return composite;
+ protected String processFileSystemFilePath(String path) {
+ if(getFilePathProcessor() != null){
+ String s = getFilePathProcessor().processFileSystemPath(path);
+ if(s != null){
+ return s;
+ }
+ }
+ return this.processor.processFileSystemPath(path);
}
@Override
protected String processWorkSpaceFilePath(IFile file) {
- String s = file.getFullPath().toPortableString();
- return s;
+ if(getFilePathProcessor() != null){
+ String s = getFilePathProcessor().processWorkBenchPath(file);
+ if(s != null){
+ return s;
+ }
+ }
+ return this.processor.processWorkBenchPath(file);
}
-
-
+ private class ProtableFileStringProcessor implements IFilePathProcessor{
+
+ public String processWorkBenchPath(IFile file) {
+ String s = file.getFullPath().toPortableString();
+ return s;
+ }
+
+ public String processFileSystemPath(String filePath) {
+ return filePath;
+ }
+
+ }
+
}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/IFilePathProcessor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/IFilePathProcessor.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/IFilePathProcessor.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -0,0 +1,16 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.editors;
+
+import org.eclipse.core.resources.IFile;
+
+/**
+ * @author DartPeng
+ *
+ */
+public interface IFilePathProcessor {
+ String processWorkBenchPath(IFile file);
+
+ String processFileSystemPath(String filePath);
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/IFilePathProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/OpenFileHyperLinkListener.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/OpenFileHyperLinkListener.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/OpenFileHyperLinkListener.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -0,0 +1,67 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.editors;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.xml.type.AnyType;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.events.IHyperlinkListener;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
+
+/**
+ * @author DartPeng
+ *
+ */
+public class OpenFileHyperLinkListener implements IHyperlinkListener {
+
+ private int type = SmooksUIUtils.VALUE_TYPE_VALUE;
+ private IItemPropertyDescriptor itemPropertyDescriptor;
+ private String editorID = null;
+ private Object model;
+
+ public OpenFileHyperLinkListener(int type, IItemPropertyDescriptor itemPropertyDescriptor, Object model, String editorID) {
+ this.type = type;
+ this.itemPropertyDescriptor = itemPropertyDescriptor;
+ this.model = model;
+ this.editorID = editorID;
+ }
+
+ public void linkActivated(HyperlinkEvent e) {
+ String path = null;
+ if (type == SmooksUIUtils.VALUE_TYPE_VALUE) {
+ Object obj = SmooksUIUtils.getEditValue(itemPropertyDescriptor, model);
+ if (obj != null) {
+ path = obj.toString();
+ }
+ }
+ if (type == SmooksUIUtils.VALUE_TYPE_CDATA && model instanceof AnyType) {
+ path = SmooksModelUtils.getAnyTypeCDATA((AnyType) model);
+ }
+ if (type == SmooksUIUtils.VALUE_TYPE_TEXT && model instanceof AnyType) {
+ path = SmooksModelUtils.getAnyTypeText((AnyType) model);
+ }
+ if (type == SmooksUIUtils.VALUE_TYPE_COMMENT && model instanceof AnyType) {
+ path = SmooksModelUtils.getAnyTypeComment((AnyType) model);
+ }
+ try {
+ IResource resource = SmooksUIUtils.getResource((EObject) model);
+ SmooksUIUtils.openFile(path, resource.getProject(), editorID);
+ } catch (Exception e1) {
+
+ }
+ }
+
+ public void linkEntered(HyperlinkEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void linkExited(HyperlinkEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/OpenFileHyperLinkListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-04-17 06:42:42 UTC (rev 14784)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -195,7 +195,7 @@
if (model instanceof EObject) {
SmooksResourceListType smooksResourceList = getSmooksResourceList((EObject) model);
if (smooksResourceList != null) {
- SmooksUIUtils.createFiledEditorLabel(parent, toolkit, propertyDescriptor, model, false);
+ SmooksUIUtils.createFieldEditorLabel(parent, toolkit, propertyDescriptor, model, false);
final Combo combo = new Combo(parent, SWT.BORDER);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
combo.setLayoutData(gd);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java 2009-04-17 06:42:42 UTC (rev 14784)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -23,7 +23,6 @@
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
@@ -57,7 +56,6 @@
private IFormPart formPart;
private Section section;
private SmooksMultiFormEditor formEditor;
- private AdapterFactoryLabelProvider labelProvider = null;
private AdapterFactoryEditingDomain editingDomain = null;
private IItemPropertySource itemPropertySource = null;
@@ -71,7 +69,6 @@
super();
this.formEditor = formEditor;
editingDomain = (AdapterFactoryEditingDomain) formEditor.getEditingDomain();
- labelProvider = new AdapterFactoryLabelProvider(editingDomain.getAdapterFactory());
}
public void createContents(Composite parent) {
@@ -235,39 +232,12 @@
protected Text createStringFieldEditor(final Composite propertyComposite, EAttribute feature, FormToolkit formToolKit,
final IItemPropertyDescriptor itemPropertyDescriptor) {
- SmooksUIUtils.createFiledEditorLabel(propertyComposite, formToolKit, itemPropertyDescriptor, getModel(), false);
- final Text text = formToolKit.createText(propertyComposite, "", SWT.NONE);
- Object value = itemPropertyDescriptor.getPropertyValue(getModel());
- if (value != null && value instanceof PropertyValueWrapper) {
- Object editValue = ((PropertyValueWrapper) value).getEditableValue(getModel());
- if (editValue != null)
- text.setText(editValue.toString());
- }
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- Object value = itemPropertyDescriptor.getPropertyValue(getModel());
- if (value != null && value instanceof PropertyValueWrapper) {
- Object editValue = ((PropertyValueWrapper) value).getEditableValue(getModel());
- if (editValue != null) {
- if (!editValue.equals(text.getText())) {
- itemPropertyDescriptor.setPropertyValue(getModel(), text.getText());
- }
- } else {
- itemPropertyDescriptor.setPropertyValue(getModel(), text.getText());
- }
- } else {
- itemPropertyDescriptor.setPropertyValue(getModel(), text.getText());
- }
- }
- });
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- text.setLayoutData(gd);
- return text;
+ return SmooksUIUtils.createStringFieldEditor(propertyComposite, formToolKit, itemPropertyDescriptor, getModel(), false, false, null);
}
protected void createIntegerFieldEditor(final Composite propertyComposite, EAttribute feature, FormToolkit formToolKit,
final IItemPropertyDescriptor itemPropertyDescriptor) {
- SmooksUIUtils.createFiledEditorLabel(propertyComposite, formToolKit, itemPropertyDescriptor, getModel(), false);
+ SmooksUIUtils.createFieldEditorLabel(propertyComposite, formToolKit, itemPropertyDescriptor, getModel(), false);
final Spinner spinner = new Spinner(propertyComposite, SWT.BORDER);
Object value = itemPropertyDescriptor.getPropertyValue(getModel());
if (value != null && value instanceof PropertyValueWrapper) {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java 2009-04-17 06:42:42 UTC (rev 14784)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -10,14 +10,9 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.edireader;
-import org.eclipse.core.resources.IResource;
import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
@@ -32,20 +27,6 @@
public EDIReaderUICreator() {
}
- private void openFile(IItemPropertyDescriptor propertyDescriptor, Object model) {
- Object path = SmooksUIUtils.getEditValue(propertyDescriptor, model);
- String p = null;
- if (path != null && path instanceof String) {
- p = ((String) path).trim();
- }
- try {
- IResource resource = SmooksUIUtils.getResource((EObject) model);
- SmooksUIUtils.openFile(p, resource.getProject(), SmooksMultiFormEditor.EDITOR_ID);
- } catch (Exception e) {
-
- }
- }
-
/*
* (non-Javadoc)
*
@@ -60,25 +41,8 @@
if (feature == EdiPackage.eINSTANCE.getEDIReader_Encoding()) {
}
if (feature == EdiPackage.eINSTANCE.getEDIReader_MappingModel()) {
- final Object fm = model;
- final IItemPropertyDescriptor fpd = propertyDescriptor;
- IHyperlinkListener listener = new IHyperlinkListener() {
-
- public void linkActivated(HyperlinkEvent e) {
- openFile(fpd, fm);
- }
-
- public void linkEntered(HyperlinkEvent e) {
-
- }
-
- public void linkExited(HyperlinkEvent e) {
-
- }
-
- };
- SmooksUIUtils.createLinkTextValueFieldEditor("Mapping Model", (AdapterFactoryEditingDomain) formEditor.getEditingDomain(), propertyDescriptor,
- toolkit, parent, model, false, 0, true, listener);
+ SmooksUIUtils.createFileSelectionTextFieldEditor(null, parent, null, toolkit, propertyDescriptor, model, SmooksUIUtils.VALUE_TYPE_VALUE,
+ SmooksMultiFormEditor.EDITOR_ID);
return parent;
}
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor);
@@ -86,9 +50,9 @@
@Override
public boolean isFileSelectionFeature(EAttribute attribute) {
-// if (attribute == EdiPackage.eINSTANCE.getEDIReader_MappingModel()) {
-// return true;
-// }
+ // if (attribute == EdiPackage.eINSTANCE.getEDIReader_MappingModel()) {
+ // return true;
+ // }
return super.isFileSelectionFeature(attribute);
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java 2009-04-17 06:42:42 UTC (rev 14784)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -10,21 +10,15 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.freemarker;
-import org.eclipse.core.resources.IResource;
import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.model.freemarker.FreemarkerPackage;
-import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
/**
* @author Dart Peng (dpeng(a)redhat.com) Date Apr 10, 2009
@@ -53,33 +47,8 @@
@Override
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent, Object model,
SmooksMultiFormEditor formEditor) {
- final Object path = SmooksModelUtils.getAnyTypeText((AnyType)model);
- final Object fm = model;
- IHyperlinkListener listener = new IHyperlinkListener() {
-
- public void linkActivated(HyperlinkEvent e) {
- String p = null;
- if (path != null && path instanceof String) {
- p = ((String) path).trim();
- }
- try {
- IResource resource = SmooksUIUtils.getResource((EObject) fm);
- SmooksUIUtils.openFile(p, resource.getProject(),null);
- } catch (Exception e1) {
-
- }
- }
-
- public void linkEntered(HyperlinkEvent e) {
-
- }
-
- public void linkExited(HyperlinkEvent e) {
-
- }
-
- };
- SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain, toolkit, parent, model,true,listener);
+ SmooksUIUtils.createFileSelectionTextFieldEditor("Text Value", parent, editingdomain, toolkit, null, model, SmooksUIUtils.VALUE_TYPE_TEXT,
+ null);
SmooksUIUtils.createCDATAFieldEditor("Template Contents(CDATA)", editingdomain, toolkit, parent, model);
SmooksUIUtils.createCommentFieldEditor("Template Contents(Comment)", editingdomain, toolkit, parent, model);
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ImportTypeUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ImportTypeUICreator.java 2009-04-17 06:42:42 UTC (rev 14784)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ImportTypeUICreator.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -10,14 +10,9 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.smooks;
-import org.eclipse.core.resources.IResource;
import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
@@ -38,37 +33,11 @@
* org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object,
* org.eclipse.emf.ecore.EAttribute)
*/
- public Composite createPropertyUI(FormToolkit toolkit, Composite parent,
- IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,SmooksMultiFormEditor formEditor) {
+ public Composite createPropertyUI(FormToolkit toolkit, Composite parent, IItemPropertyDescriptor propertyDescriptor, Object model,
+ EAttribute feature, SmooksMultiFormEditor formEditor) {
if (feature == SmooksPackage.eINSTANCE.getImportType_File()) {
- final Object fm = model;
- final Object path = SmooksUIUtils.getEditValue(propertyDescriptor, model);
- IHyperlinkListener listener = new IHyperlinkListener() {
- public void linkActivated(HyperlinkEvent e) {
- String p = null;
- if (path != null && path instanceof String) {
- p = ((String) path).trim();
- }
- try {
- IResource resource = SmooksUIUtils.getResource((EObject) fm);
- SmooksUIUtils.openFile(p, resource.getProject(),null);
- } catch (Exception e1) {
-
- }
- }
-
- public void linkEntered(HyperlinkEvent e) {
-
- }
-
- public void linkExited(HyperlinkEvent e) {
-
- }
-
- };
- SmooksUIUtils.createLinkTextValueFieldEditor(null, (AdapterFactoryEditingDomain) formEditor.getEditingDomain(), propertyDescriptor,
- toolkit, parent, model, false, 0, true, listener);
-
+ SmooksUIUtils.createFileSelectionTextFieldEditor(null, parent, null, toolkit, propertyDescriptor, model, SmooksUIUtils.VALUE_TYPE_VALUE,
+ SmooksMultiFormEditor.EDITOR_ID);
return parent;
}
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java 2009-04-17 06:42:42 UTC (rev 14784)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -46,7 +46,7 @@
@Override
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit,
Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain, toolkit, parent, model , false , 500,false,null);
+ SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain, toolkit, parent, model , false , 500,false,false,null);
SmooksUIUtils.createCDATAFieldEditor("CDATA Value", editingdomain, toolkit, parent, model);
}
}
\ No newline at end of file
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-17 06:42:42 UTC (rev 14784)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -31,6 +31,7 @@
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper;
import org.eclipse.jdt.core.IClasspathEntry;
@@ -42,12 +43,17 @@
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -66,7 +72,11 @@
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.configuration.editors.ClassPathFileProcessor;
+import org.jboss.tools.smooks.configuration.editors.CurrentProjecViewerFilter;
+import org.jboss.tools.smooks.configuration.editors.FileSelectionWizard;
import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
+import org.jboss.tools.smooks.configuration.editors.OpenFileHyperLinkListener;
import org.jboss.tools.smooks.configuration.editors.SelectorAttributes;
import org.jboss.tools.smooks.configuration.editors.SelectoreSelectionDialog;
import org.jboss.tools.smooks.configuration.editors.javabean.JavaMethodsSelectionDialog;
@@ -93,87 +103,30 @@
public static final String XSL_NAMESPACE = " xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" ";
+ public static int VALUE_TYPE_VALUE = 1;
+
+ public static int VALUE_TYPE_TEXT = 2;
+
+ public static int VALUE_TYPE_COMMENT = 3;
+
+ public static int VALUE_TYPE_CDATA = 0;
+
public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
- Object model,boolean linkLabel, IHyperlinkListener listener) {
- createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, false, 0,linkLabel,listener);
+ Object model, boolean linkLabel, IHyperlinkListener listener) {
+ createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, false, 0, linkLabel, false, listener);
}
public static void createMultiMixedTextFieldEditor(String label, AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit,
Composite parent, Object model, int height) {
- createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, true, height,false,null);
+ createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, true, height, false, false, null);
}
public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
- Object model, boolean multiText, int height, boolean linkLabel, IHyperlinkListener listener) {
- GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- Section section = null;
- Composite textContainer = null;
- if (multiText) {
- Composite space = toolkit.createComposite(parent);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- gd.heightHint = 10;
- space.setLayoutData(gd);
-
- section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE);
- FillLayout layout = new FillLayout();
- section.setLayout(layout);
- section.setText(label);
-
- Composite textComposite = toolkit.createComposite(section);
- section.setClient(textComposite);
- textComposite.setLayout(new GridLayout());
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- section.setLayoutData(gd);
- textContainer = textComposite;
- } else {
- if (linkLabel) {
- Hyperlink link = toolkit.createHyperlink(parent, label + " :", SWT.NONE);
- if (listener != null) {
- link.addHyperlinkListener(listener);
- }
- } else {
- toolkit.createLabel(parent, label + " :").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- }
- textContainer = parent;
- }
- gd = new GridData(GridData.FILL_HORIZONTAL);
- int textType = SWT.FLAT;
- if (multiText) {
- textType = SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL;
- }
- final Text valueText = toolkit.createText(textContainer, "", textType);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- if (multiText && height > 0) {
- gd.heightHint = height;
- }
- valueText.setLayoutData(gd);
- if (model instanceof AnyType) {
- String text = SmooksModelUtils.getAnyTypeText((AnyType) model);
- if (text != null) {
- valueText.setText(text);
- if (text.length() > 0 && section != null) {
- section.setExpanded(true);
- }
- }
- }
- final Object fm = model;
- final AdapterFactoryEditingDomain fEditingDomain = editingdomain;
- valueText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (!(fm instanceof AnyType)) {
- return;
- }
- String text = SmooksModelUtils.getAnyTypeText((AnyType) fm);
- if (!valueText.getText().equals(text)) {
- SmooksModelUtils.setTextToSmooksType(fEditingDomain, (AnyType) fm, valueText.getText());
- }
- }
- });
+ Object model, boolean multiText, int height, boolean linkLabel, boolean openFile, IHyperlinkListener listener) {
+ createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, multiText, linkLabel, openFile, height, listener, VALUE_TYPE_TEXT);
}
- public static Control createFiledEditorLabel(Composite parent, FormToolkit formToolKit, IItemPropertyDescriptor itemPropertyDescriptor,
+ public static Control createFieldEditorLabel(Composite parent, FormToolkit formToolKit, IItemPropertyDescriptor itemPropertyDescriptor,
Object model, boolean isLink) {
String displayName = itemPropertyDescriptor.getDisplayName(model);
EAttribute feature = (EAttribute) itemPropertyDescriptor.getFeature(model);
@@ -249,13 +202,13 @@
public static void createLinkTextValueFieldEditor(String label, AdapterFactoryEditingDomain editingdomain,
IItemPropertyDescriptor propertyDescriptor, FormToolkit toolkit, Composite parent, Object model, boolean multiText, int height,
boolean linkLabel, IHyperlinkListener listener) {
- Control control = createFiledEditorLabel(parent, toolkit, propertyDescriptor, model, linkLabel);
+ Control control = createFieldEditorLabel(parent, toolkit, propertyDescriptor, model, linkLabel);
if (linkLabel) {
- Hyperlink link = (Hyperlink)control;
+ Hyperlink link = (Hyperlink) control;
if (listener != null) {
link.addHyperlinkListener(listener);
}
- }
+ }
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
int textType = SWT.FLAT;
if (multiText) {
@@ -309,6 +262,194 @@
return path;
}
+ public static Text createStringFieldEditor(final Composite parent, FormToolkit toolkit, final IItemPropertyDescriptor itemPropertyDescriptor,
+ Object model, boolean linkLabel, boolean openFile, IHyperlinkListener listener) {
+ return createStringFieldEditor(null, parent, null, toolkit, itemPropertyDescriptor, model, false, linkLabel, openFile, 0, listener,
+ VALUE_TYPE_VALUE);
+ }
+
+ public static Text createFileSelectionTextFieldEditor(String label, final Composite parent, EditingDomain editingdomain, FormToolkit toolkit,
+ final IItemPropertyDescriptor itemPropertyDescriptor, final Object model, int valueType , String editorID) {
+ OpenFileHyperLinkListener listener = new OpenFileHyperLinkListener(valueType,itemPropertyDescriptor,model,editorID);
+ return createStringFieldEditor(label, parent, editingdomain, toolkit, itemPropertyDescriptor, model, false, true, true, 0, listener,
+ valueType);
+ }
+
+ public static Text createStringFieldEditor(String label, final Composite parent, EditingDomain editingdomain, FormToolkit toolkit,
+ final IItemPropertyDescriptor itemPropertyDescriptor, Object model, boolean multiText, boolean linkLabel, boolean openFile, int height,
+ IHyperlinkListener listener, int valueType) {
+ GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
+ Section section = null;
+ Composite textContainer = null;
+ final Object fm = model;
+ final EditingDomain fEditingDomain = editingdomain;
+ if(label == null && itemPropertyDescriptor != null){
+ label = itemPropertyDescriptor.getDisplayName(model);
+ EAttribute feature = (EAttribute) itemPropertyDescriptor.getFeature(model);
+ if (feature.isRequired()) {
+ label = "*" + label;
+ }
+ }
+ if (multiText) {
+ Composite space = toolkit.createComposite(parent);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ gd.heightHint = 10;
+ space.setLayoutData(gd);
+
+ section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE);
+ FillLayout layout = new FillLayout();
+ section.setLayout(layout);
+ section.setText(label);
+
+ Composite textComposite = toolkit.createComposite(section);
+ section.setClient(textComposite);
+ textComposite.setLayout(new GridLayout());
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ section.setLayoutData(gd);
+ textContainer = textComposite;
+ } else {
+ if (linkLabel) {
+ Hyperlink link = toolkit.createHyperlink(parent, label + " :", SWT.NONE);
+ if (listener != null) {
+ link.addHyperlinkListener(listener);
+ }
+ } else {
+ toolkit.createLabel(parent, label + " :").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ }
+ if (openFile) {
+ Composite fileSelectionComposite = toolkit.createComposite(parent);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fileSelectionComposite.setLayoutData(gd);
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+ fileSelectionComposite.setLayout(gl);
+ textContainer = fileSelectionComposite;
+ } else {
+ textContainer = parent;
+ }
+ }
+ String editValue = null;
+ if (valueType == VALUE_TYPE_TEXT && model instanceof AnyType) {
+ editValue = SmooksModelUtils.getAnyTypeText((AnyType) model);
+ }
+ if (valueType == VALUE_TYPE_COMMENT && model instanceof AnyType) {
+ editValue = SmooksModelUtils.getAnyTypeComment((AnyType) model);
+ }
+ if (valueType == VALUE_TYPE_CDATA && model instanceof AnyType) {
+ editValue = SmooksModelUtils.getAnyTypeCDATA((AnyType) model);
+ }
+ if (valueType == VALUE_TYPE_VALUE) {
+ Object value = getEditValue(itemPropertyDescriptor, model);
+ if (value != null) {
+ editValue = value.toString();
+ }
+ }
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ int textType = SWT.FLAT;
+ if (multiText) {
+ textType = SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL;
+ }
+ final Text valueText = toolkit.createText(textContainer, "", textType);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ if (multiText && height > 0) {
+ gd.heightHint = height;
+ }
+ valueText.setLayoutData(gd);
+ toolkit.paintBordersFor(textContainer);
+ if (openFile) {
+ Button fileBrowseButton = toolkit.createButton(textContainer, "Browse", SWT.NONE);
+ fileBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ FileSelectionWizard wizard = new FileSelectionWizard();
+ IResource resource = getResource((EObject) fm);
+ Object[] initSelections = new Object[] {};
+ if (resource != null) {
+ initSelections = new Object[] { resource };
+ }
+ wizard.setFilePathProcessor(new ClassPathFileProcessor());
+ wizard.setInitSelections(initSelections);
+ List<ViewerFilter> filterList = new ArrayList<ViewerFilter>();
+ filterList.add(new CurrentProjecViewerFilter(resource));
+ wizard.setViewerFilters(filterList);
+ WizardDialog dialog = new WizardDialog(parent.getShell(), wizard);
+ if (dialog.open() == Dialog.OK) {
+ valueText.setText(wizard.getFilePath());
+ }
+ }
+
+ });
+ }
+ if (editValue != null) {
+ valueText.setText(editValue);
+ if (editValue.length() > 0 && section != null) {
+ section.setExpanded(true);
+ }
+ }
+ if (valueType == VALUE_TYPE_TEXT && model instanceof AnyType && fEditingDomain != null) {
+ valueText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if (!(fm instanceof AnyType)) {
+ return;
+ }
+ String text = SmooksModelUtils.getAnyTypeText((AnyType) fm);
+ if (!valueText.getText().equals(text)) {
+ SmooksModelUtils.setTextToSmooksType(fEditingDomain, (AnyType) fm, valueText.getText());
+ }
+ }
+ });
+ }
+ if (valueType == VALUE_TYPE_COMMENT && model instanceof AnyType && fEditingDomain != null) {
+ valueText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if (!(fm instanceof AnyType)) {
+ return;
+ }
+ String text = SmooksModelUtils.getAnyTypeComment((AnyType) fm);
+ if (!valueText.getText().equals(text)) {
+ SmooksModelUtils.setCommentToSmooksType(fEditingDomain, (AnyType) fm, valueText.getText());
+ }
+ }
+ });
+ }
+ if (valueType == VALUE_TYPE_CDATA && model instanceof AnyType && fEditingDomain != null) {
+ valueText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if (!(fm instanceof AnyType)) {
+ return;
+ }
+ String text = SmooksModelUtils.getAnyTypeCDATA((AnyType) fm);
+ if (!valueText.getText().equals(text)) {
+ SmooksModelUtils.setCDATAToSmooksType(fEditingDomain, (AnyType) fm, valueText.getText());
+ }
+ }
+ });
+ }
+ if (valueType == VALUE_TYPE_VALUE) {
+ if (itemPropertyDescriptor != null) {
+ valueText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ Object editValue = getEditValue(itemPropertyDescriptor, fm);
+ if (editValue != null) {
+ if (!editValue.equals(valueText.getText())) {
+ itemPropertyDescriptor.setPropertyValue(fm, valueText.getText());
+ }
+ } else {
+ itemPropertyDescriptor.setPropertyValue(fm, valueText.getText());
+ }
+
+ }
+ });
+ }
+ }
+ return valueText;
+ }
+
public static Composite createSelectorFieldEditor(FormToolkit toolkit, Composite parent, final IItemPropertyDescriptor propertyDescriptor,
Object model, final SmooksGraphicsExtType extType) {
return createDialogFieldEditor(parent, toolkit, propertyDescriptor, "Browse", new IFieldDialog() {
@@ -351,101 +492,12 @@
public static void createCDATAFieldEditor(String label, AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
Object model) {
- GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- Composite space = toolkit.createComposite(parent);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- gd.heightHint = 10;
- space.setLayoutData(gd);
-
- Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.DESCRIPTION);
- FillLayout layout = new FillLayout();
- section.setLayout(layout);
- section.setText(label);
-
- Composite textComposite = toolkit.createComposite(section);
- section.setClient(textComposite);
- textComposite.setLayout(new GridLayout());
- final Text cdataText = toolkit.createText(textComposite, "", SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- section.setLayoutData(gd);
- toolkit.paintBordersFor(textComposite);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = 300;
- cdataText.setLayoutData(gd);
-
- if (model instanceof AnyType) {
- String cdata = SmooksModelUtils.getAnyTypeCDATA((AnyType) model);
- if (cdata != null) {
- cdataText.setText(cdata);
- if (cdata.length() > 0) {
- section.setExpanded(true);
- }
- }
- }
-
- final Object fm = model;
- final AdapterFactoryEditingDomain fEditingDomain = editingdomain;
- cdataText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (!(fm instanceof AnyType)) {
- return;
- }
- String text = SmooksModelUtils.getAnyTypeCDATA((AnyType) fm);
- if (!cdataText.getText().equals(text)) {
- SmooksModelUtils.setCDATAToSmooksType(fEditingDomain, (AnyType) fm, cdataText.getText());
- }
- }
- });
+ createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, true, true, false, 300, null, VALUE_TYPE_CDATA);
}
public static void createCommentFieldEditor(String label, AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
Object model) {
- GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- Composite space = toolkit.createComposite(parent);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- gd.heightHint = 10;
- space.setLayoutData(gd);
-
- Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.DESCRIPTION);
- FillLayout layout = new FillLayout();
- section.setLayout(layout);
- section.setText(label);
-
- Composite textComposite = toolkit.createComposite(section);
- section.setClient(textComposite);
- textComposite.setLayout(new GridLayout());
- final Text cdataText = toolkit.createText(textComposite, "", SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- section.setLayoutData(gd);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = 300;
- cdataText.setLayoutData(gd);
-
- if (model instanceof AnyType) {
- String comment = SmooksModelUtils.getAnyTypeComment((AnyType) model);
- if (comment != null) {
- cdataText.setText(comment);
- if (comment.length() > 0)
- section.setExpanded(true);
- }
- }
- final Object fm = model;
- final AdapterFactoryEditingDomain fEditingDomain = editingdomain;
- cdataText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (!(fm instanceof AnyType)) {
- return;
- }
- String text = SmooksModelUtils.getAnyTypeCDATA((AnyType) fm);
- if (!cdataText.getText().equals(text)) {
- SmooksModelUtils.setCommentToSmooksType(fEditingDomain, (AnyType) fm, cdataText.getText());
- }
- }
- });
+ createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, true, true, false, 300, null, VALUE_TYPE_COMMENT);
}
public static Composite createJavaTypeSearchFieldEditor(Composite parent, FormToolkit toolkit, final IItemPropertyDescriptor propertyDescriptor,
@@ -458,7 +510,7 @@
String path = uri.toPlatformString(true);
workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
JavaTypeFieldDialog dialog = new JavaTypeFieldDialog(workspaceResource);
- Hyperlink link = (Hyperlink) createFiledEditorLabel(parent, toolkit, propertyDescriptor, model, true);
+ Hyperlink link = (Hyperlink) createFieldEditorLabel(parent, toolkit, propertyDescriptor, model, true);
final Composite classTextComposite = toolkit.createComposite(parent);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
classTextComposite.setLayoutData(gd);
@@ -666,7 +718,7 @@
public static Control createChoiceFieldEditor(Composite parent, FormToolkit formToolkit, IItemPropertyDescriptor itemPropertyDescriptor,
Object model, String[] items, IModelProcsser processer, boolean readOnly) {
- SmooksUIUtils.createFiledEditorLabel(parent, formToolkit, itemPropertyDescriptor, model, false);
+ SmooksUIUtils.createFieldEditorLabel(parent, formToolkit, itemPropertyDescriptor, model, false);
Object editValue = getEditValue(itemPropertyDescriptor, model);
if (processer != null) {
editValue = processer.unwrapValue(editValue);
@@ -740,7 +792,7 @@
public static Composite createDialogFieldEditor(Composite parent, FormToolkit toolkit, final IItemPropertyDescriptor propertyDescriptor,
String buttonName, IFieldDialog dialog, final EObject model, boolean labelLink, IHyperlinkListener listener) {
- Control label = createFiledEditorLabel(parent, toolkit, propertyDescriptor, model, labelLink);
+ Control label = createFieldEditorLabel(parent, toolkit, propertyDescriptor, model, labelLink);
if (label instanceof Hyperlink && listener != null) {
((Hyperlink) label).addHyperlinkListener(listener);
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java 2009-04-17 06:42:42 UTC (rev 14784)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -26,6 +26,7 @@
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.smooks.configuration.editors.IFilePathProcessor;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
/**
@@ -47,6 +48,8 @@
protected List<ViewerFilter> filters = null;
protected boolean multiSelect =false;
+ private IFilePathProcessor filePathProcessor = null;
+
public AbstractFileSelectionWizardPage(String pageName,boolean multiSelect , Object[] initSelections,List<ViewerFilter> filters) {
super(pageName);
this.initSelections = initSelections;
@@ -74,6 +77,16 @@
public String getFilePath(){
return filePath;
}
+
+
+ public IFilePathProcessor getFilePathProcessor() {
+ return filePathProcessor;
+ }
+
+ public void setFilePathProcessor(IFilePathProcessor filePathProcessor) {
+ this.filePathProcessor = filePathProcessor;
+ }
+
/*
* (non-Javadoc)
*
@@ -174,11 +187,23 @@
}
protected String processFileSystemFilePath(String path){
+ if(filePathProcessor != null){
+ String s = filePathProcessor.processFileSystemPath(path);
+ if(s != null){
+ return s;
+ }
+ }
path = SmooksUIUtils.FILE_PRIX + path;
return path;
}
protected String processWorkSpaceFilePath(IFile file){
+ if(filePathProcessor != null){
+ String s = filePathProcessor.processWorkBenchPath(file);
+ if(s != null){
+ return s;
+ }
+ }
String s = file.getFullPath().toPortableString();
s = SmooksUIUtils.WORKSPACE_PRIX + s;
return s;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java 2009-04-17 06:42:42 UTC (rev 14784)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java 2009-04-17 07:59:01 UTC (rev 14785)
@@ -10,21 +10,15 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.xsl;
-import org.eclipse.core.resources.IResource;
import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.model.xsl.XslPackage;
-import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
/**
* @author Dart Peng (dpeng(a)redhat.com) Date Apr 10, 2009
@@ -68,33 +62,7 @@
@Override
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent, Object model,
SmooksMultiFormEditor formEditor) {
- final Object path = SmooksModelUtils.getAnyTypeText((AnyType) model);
- final Object fm = model;
- IHyperlinkListener listener = new IHyperlinkListener() {
-
- public void linkActivated(HyperlinkEvent e) {
- String p = null;
- if (path != null && path instanceof String) {
- p = ((String) path).trim();
- }
- try {
- IResource resource = SmooksUIUtils.getResource((EObject) fm);
- SmooksUIUtils.openFile(p, resource.getProject(), null);
- } catch (Exception e1) {
-
- }
- }
-
- public void linkEntered(HyperlinkEvent e) {
-
- }
-
- public void linkExited(HyperlinkEvent e) {
-
- }
-
- };
- SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain, toolkit, parent, model, true, listener);
+ SmooksUIUtils.createFileSelectionTextFieldEditor("Text Value", parent, editingdomain, toolkit, null, model, SmooksUIUtils.VALUE_TYPE_TEXT, null);
SmooksUIUtils.createCDATAFieldEditor("Template Contents (CDATA)", editingdomain, toolkit, parent, model);
SmooksUIUtils.createCommentFieldEditor("Template Contents (Comment)", editingdomain, toolkit, parent, model);
}
15 years, 8 months
JBoss Tools SVN: r14784 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-04-17 02:42:42 -0400 (Fri, 17 Apr 2009)
New Revision: 14784
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerContentProvider.java
Log:
JBIDE-4182
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerContentProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerContentProvider.java 2009-04-17 06:33:38 UTC (rev 14783)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerContentProvider.java 2009-04-17 06:42:42 UTC (rev 14784)
@@ -94,18 +94,22 @@
}
return ms2;
} catch (Exception e) {
- return null;
+ return new Object[]{};
}
}
- IServer server = (IServer) element;
- IModule[] modules = server.getModules();
- int size = modules.length;
- ModuleServer[] ms = new ModuleServer[size];
- for (int i = 0; i < size; i++) {
- ms[i] = new ModuleServer(server, new IModule[] { modules[i] });
+ // TODO TELL ANGEL ABOUT THIS IF STATEMENT
+ if( element instanceof IServer) {
+ IServer server = (IServer) element;
+ IModule[] modules = server.getModules();
+ int size = modules.length;
+ ModuleServer[] ms = new ModuleServer[size];
+ for (int i = 0; i < size; i++) {
+ ms[i] = new ModuleServer(server, new IModule[] { modules[i] });
+ }
+ return ms;
}
- return ms;
+ return new Object[]{};
}
public Object getParent(Object element) {
15 years, 8 months