JBoss Tools SVN: r14632 - in trunk/hibernatetools/tests: org.jboss.tools.hibernate.ui.veditor.test and 12 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-04-09 09:22:12 -0400 (Thu, 09 Apr 2009)
New Revision: 14632
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.classpath
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.cvsignore
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.project
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/META-INF/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/META-INF/MANIFEST.MF
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/build.properties
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/plugin.properties
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/model/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/model/test/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/model/test/OrmDiagramTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/test/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/test/VisualEditorTestPlugin.java
Log:
JBIDE-4148 & JBIDE-4138 - unit test for OrmDiagram save & load
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.classpath
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.classpath (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.classpath 2009-04-09 13:22:12 UTC (rev 14632)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+ <accessrules>
+ <accessrule kind="accessible" pattern="**/internal/**"/>
+ </accessrules>
+ </classpathentry>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.cvsignore
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.cvsignore (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.cvsignore 2009-04-09 13:22:12 UTC (rev 14632)
@@ -0,0 +1,2 @@
+bin
+.settings
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.project
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.project (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.project 2009-04-09 13:22:12 UTC (rev 14632)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.hibernate.ui.veditor.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/META-INF/MANIFEST.MF 2009-04-09 13:22:12 UTC (rev 14632)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.jboss.tools.hibernate.ui.veditor.test
+Bundle-Version: 1.0.0
+Require-Bundle: org.junit;bundle-version="3.8.2",
+ org.eclipse.wst.common.project.facet.ui;bundle-version="1.3.0",
+ org.eclipse.jdt.core,
+ org.hibernate.eclipse.console.test,
+ org.jboss.tools.hibernate.ui.veditor,
+ org.hibernate.eclipse
+Bundle-ActivationPolicy: lazy
+Export-Package: org.jboss.tools.hibernate.ui.veditor.test
+Bundle-Activator: org.jboss.tools.hibernate.ui.veditor.test.VisualEditorTestPlugin
+Bundle-ClassPath: org.jboss.tools.hibernate.ui.veditor.test.jar
+Bundle-Vendor: %Bundle-Vendor.0
+Bundle-Localization: plugin
+Import-Package: org.eclipse.core.resources
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/build.properties
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/build.properties (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/build.properties 2009-04-09 13:22:12 UTC (rev 14632)
@@ -0,0 +1,11 @@
+bin.includes = META-INF/,\
+ org.jboss.tools.hibernate.ui.veditor.test.jar,\
+ plugin.properties
+jars.compile.order = org.jboss.tools.hibernate.ui.veditor.test.jar
+source.org.jboss.tools.hibernate.ui.veditor.test.jar = src/
+output.org.jboss.tools.hibernate.ui.veditor.test.jar = bin/
+src.includes = src/,\
+ build.properties,\
+ META-INF/,\
+ .project,\
+ .classpath
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/plugin.properties
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/plugin.properties (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/plugin.properties 2009-04-09 13:22:12 UTC (rev 14632)
@@ -0,0 +1,3 @@
+#Properties file for org.jboss.tools.hibernate.ui.veditor.test
+Bundle-Vendor.0 = JBoss, a division of Red Hat
+Bundle-Name.0 = Visual Editor Test Plug-in
\ No newline at end of file
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/model/test/OrmDiagramTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/model/test/OrmDiagramTest.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/model/test/OrmDiagramTest.java 2009-04-09 13:22:12 UTC (rev 14632)
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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.ui.veditor.editors.model.test;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaProject;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.mapping.RootClass;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.lib.legacy.ClassImposteriser;
+
+import junit.framework.TestCase;
+
+/**
+ * for OrmDiagram class functionality test
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class OrmDiagramTest extends TestCase {
+
+ public Mockery context = new Mockery() {
+ {
+ setImposteriser(ClassImposteriser.INSTANCE);
+ }
+ };
+
+ public void testLoadAndSave() {
+
+ final ConsoleConfiguration consoleConfiguration = context.mock(ConsoleConfiguration.class);
+ final Configuration configuration = context.mock(Configuration.class);
+ final RootClass ioe = context.mock(RootClass.class);
+ final IJavaProject javaProject = context.mock(IJavaProject.class);
+ final List<Object> emptyList = new ArrayList<Object>();
+ final Iterator<Object> emptyListIterator = emptyList.iterator();
+ final IProject project = context.mock(IProject.class);
+
+ context.checking(new Expectations() {
+ {
+ oneOf(consoleConfiguration).getConfiguration();
+ will(returnValue(configuration));
+
+ oneOf(ioe).getEntityName();
+ will(returnValue("testEntityName")); //$NON-NLS-1$
+
+ oneOf(ioe).getEntityName();
+ will(returnValue("")); //$NON-NLS-1$
+
+ oneOf(ioe).getEntityName();
+ will(returnValue("")); //$NON-NLS-1$
+
+ oneOf(ioe).getIdentifierProperty();
+ will(returnValue(null));
+
+ oneOf(ioe).getIdentifier();
+ will(returnValue(null));
+
+ oneOf(ioe).getPropertyIterator();
+ will(returnValue(emptyListIterator));
+
+ oneOf(ioe).getTable();
+ will(returnValue(null));
+
+ oneOf(ioe).getSubclassIterator();
+ will(returnValue(emptyListIterator));
+
+ oneOf(ioe).getIdentifier();
+ will(returnValue(null));
+
+ oneOf(ioe).getJoinIterator();
+ will(returnValue(emptyListIterator));
+
+ allowing(javaProject).getProject();
+ will(returnValue(project));
+
+ allowing(project).getLocation();
+ will(returnValue(Path.fromOSString(""))); //$NON-NLS-1$
+
+ allowing(ioe).getClassName();
+ will(returnValue("ClassName")); //$NON-NLS-1$
+
+ allowing(consoleConfiguration).getName();
+ will(returnValue("CCName")); //$NON-NLS-1$
+
+ allowing(ioe).getEntityName();
+ will(returnValue("")); //$NON-NLS-1$
+ }
+ });
+ final OrmDiagram ormDiagram = new OrmDiagram(consoleConfiguration, ioe, javaProject);
+ ormDiagram.save();
+ // GENERAL TEST:
+ // check for all expectations
+ context.assertIsSatisfied();
+ }
+
+}
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/test/VisualEditorTestPlugin.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/test/VisualEditorTestPlugin.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/test/VisualEditorTestPlugin.java 2009-04-09 13:22:12 UTC (rev 14632)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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.ui.veditor.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class VisualEditorTestPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.hibernate.ui.veditor.test"; //$NON-NLS-1$
+
+ // The shared instance
+ private static VisualEditorTestPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public VisualEditorTestPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ setPlugin(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+ * )
+ */
+ public void stop(BundleContext context) throws Exception {
+ setPlugin(null);
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static VisualEditorTestPlugin getDefault() {
+ return plugin;
+ }
+
+ private static void setPlugin(VisualEditorTestPlugin plugin) {
+ VisualEditorTestPlugin.plugin = plugin;
+ }
+
+ public File getFileInPlugin(IPath path) throws CoreException {
+ try {
+ URL installURL = new URL(getBundle().getEntry("/"), path.toString()); //$NON-NLS-1$
+ URL localURL = FileLocator.toFileURL(installURL);
+ return new File(localURL.getFile());
+ } catch (IOException e) {
+ throw new CoreException(new Status(IStatus.ERROR, getBundle()
+ .getSymbolicName(), IStatus.ERROR, e.getMessage(), e));
+ }
+ }
+
+}
15 years, 8 months
JBoss Tools SVN: r14631 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-04-09 08:32:58 -0400 (Thu, 09 Apr 2009)
New Revision: 14631
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1077
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-04-09 12:22:34 UTC (rev 14630)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-04-09 12:32:58 UTC (rev 14631)
@@ -322,21 +322,7 @@
}
private void scanProperties(IFile file, String content){
- //System.out.println("ScanProperties "+file.getName());
-// try{
-// FileInputStream fis = new FileInputStream(new File(file.getLocationURI()));
-// PropertyResourceBundle rb = new PropertyResourceBundle(fis);
-// for(String key : rb.keySet()){
-// //System.out.println("Key - "+key+" Val - "+rb.getString(key));
-// String value = rb.getString(key);
-// if(value.indexOf('{')>-1)
-// scanString(file, value, 0);
-// }
-// }catch(FileNotFoundException ex){
-// SeamCorePlugin.getDefault().logError(ex);
-// }catch(IOException ex){
-// SeamCorePlugin.getDefault().logError(ex);
-// }
+ scanString(file, content, 0);
}
/*
15 years, 8 months
JBoss Tools SVN: r14630 - in trunk/jst/plugins/org.jboss.tools.jst.web: src/org/jboss/tools/jst/web/tld/model/handlers and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-04-09 08:22:34 -0400 (Thu, 09 Apr 2009)
New Revision: 14630
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/tld/model/handlers/ImportTLDToPaletteSupport.java
Log:
JBIDE-4153
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/META-INF/MANIFEST.MF 2009-04-09 12:12:22 UTC (rev 14629)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/META-INF/MANIFEST.MF 2009-04-09 12:22:34 UTC (rev 14630)
@@ -1,9 +1,11 @@
Manifest-Version: 1.0
+Eclipse-LazyStart: true
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-ClassPath: web.jar
Bundle-Activator: org.jboss.tools.jst.web.WebModelPlugin
Bundle-Vendor: %providerName
+Plugin-Class: org.jboss.tools.jst.web.WebModelPlugin
Bundle-SymbolicName: org.jboss.tools.jst.web;singleton:=true
Bundle-Localization: plugin
Require-Bundle: org.jboss.tools.common.model;visibility:=reexport,
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/tld/model/handlers/ImportTLDToPaletteSupport.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/tld/model/handlers/ImportTLDToPaletteSupport.java 2009-04-09 12:12:22 UTC (rev 14629)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/tld/model/handlers/ImportTLDToPaletteSupport.java 2009-04-09 12:22:34 UTC (rev 14630)
@@ -14,6 +14,9 @@
import java.util.Properties;
import java.util.TreeMap;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.osgi.util.NLS;
import org.jboss.tools.common.meta.action.impl.DefaultWizardDataValidator;
@@ -139,7 +142,13 @@
class ImportTLDValidator extends DefaultWizardDataValidator {
public void validate(Properties data) {
message = null;
- XModelObject s = getSelectedResource(data.getProperty("tld")); //$NON-NLS-1$
+ String tld = data.getProperty("tld");
+ IStatus status = ResourcesPlugin.getWorkspace().validatePath(tld, IResource.FILE);
+ if(status != null && !status.isOK()) {
+ message = status.getMessage();
+ return;
+ }
+ XModelObject s = getSelectedResource(tld); //$NON-NLS-1$
super.validate(data);
if(message != null) return;
String name = data.getProperty("name"); //$NON-NLS-1$
15 years, 8 months
JBoss Tools SVN: r14629 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-04-09 08:12:22 -0400 (Thu, 09 Apr 2009)
New Revision: 14629
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1077
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java 2009-04-09 11:48:47 UTC (rev 14628)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java 2009-04-09 12:12:22 UTC (rev 14629)
@@ -125,13 +125,25 @@
/**
- * @return all child projects for web seam project.
+ * @return all child projects of main web seam project.
*/
public IProject[] getChildProjects() {
return childProjects;
}
/**
+ * @return all Seam projects of one application
+ */
+ public IProject[] getAllProjects() {
+ IProject[] projects = new IProject[childProjects.length + 1];
+ for (int i = 0; i < childProjects.length; i++) {
+ projects[i] = childProjects[i];
+ }
+ projects[childProjects.length] = war;
+ return projects;
+ }
+
+ /**
* @return default deploy type for Seam project set
*/
public String getDefaultDeployType() {
15 years, 8 months
JBoss Tools SVN: r14628 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-04-09 07:48:47 -0400 (Thu, 09 Apr 2009)
New Revision: 14628
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1077
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-04-09 11:39:19 UTC (rev 14627)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-04-09 11:48:47 UTC (rev 14628)
@@ -152,21 +152,17 @@
}
return null;
}
-
+
// we need to find references in .java .xml .xhtml .jsp .properties files
private void findReferences(){
SeamProjectsSet projectsSet = new SeamProjectsSet(file.getProject());
-
- IProject warProject = projectsSet.getWarProject();
- if(warProject != null)
- scan(warProject);
-
- for(IProject project : projectsSet.getChildProjects()){
- if(project != null)
- scan(project);
+
+ IProject[] projects = projectsSet.getAllProjects();
+ for (int i = 0; i < projects.length; i++) {
+ scan(projects[i]);
}
}
-
+
private void scan(IProject project){
try{
for(IResource resource : project.members()){
15 years, 8 months
JBoss Tools SVN: r14627 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-04-09 07:39:19 -0400 (Thu, 09 Apr 2009)
New Revision: 14627
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1077
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-04-09 10:40:55 UTC (rev 14626)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-04-09 11:39:19 UTC (rev 14627)
@@ -10,13 +10,8 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.refactoring;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.List;
-import java.util.PropertyResourceBundle;
import java.util.Set;
import org.eclipse.core.resources.IFile;
@@ -66,16 +61,12 @@
import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
import org.jboss.tools.common.el.core.parser.ELParser;
import org.jboss.tools.common.el.core.parser.ELParserUtil;
-import org.jboss.tools.common.el.core.parser.SyntaxError;
-import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
-import org.jboss.tools.common.el.core.resolver.Var;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.core.SeamPreferences;
import org.jboss.tools.seam.core.SeamProjectsSet;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -170,15 +161,10 @@
if(warProject != null)
scan(warProject);
- IProject earProject = projectsSet.getEarProject();
- if(earProject != null)
- scan(earProject);
-
- // TODO Here can be several ejb projects
- IProject ejbProject = projectsSet.getEjbProject();
- if(ejbProject != null)
- scan(ejbProject);
-
+ for(IProject project : projectsSet.getChildProjects()){
+ if(project != null)
+ scan(project);
+ }
}
private void scan(IProject project){
@@ -218,10 +204,8 @@
}
if(ext.equalsIgnoreCase(JAVA_EXT))
scanJava(file, content);
- else if(ext.equalsIgnoreCase(XML_EXT) || ext.equalsIgnoreCase(XHTML_EXT))
+ else if(ext.equalsIgnoreCase(XML_EXT) || ext.equalsIgnoreCase(XHTML_EXT) || ext.equalsIgnoreCase(JSP_EXT))
scanDOM(file, content);
- else if(ext.equalsIgnoreCase(JSP_EXT))
- scanJsp(file, content);
else if(ext.equalsIgnoreCase(PROPERTIES_EXT))
scanProperties(file, content);
@@ -341,10 +325,6 @@
return null;
}
- private void scanJsp(IFile file, String content){
-
- }
-
private void scanProperties(IFile file, String content){
//System.out.println("ScanProperties "+file.getName());
// try{
15 years, 8 months
JBoss Tools SVN: r14626 - trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-04-09 06:40:55 -0400 (Thu, 09 Apr 2009)
New Revision: 14626
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java
Log:
disable the buttons
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-04-09 09:45:28 UTC (rev 14625)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-04-09 10:40:55 UTC (rev 14626)
@@ -200,22 +200,22 @@
hookButtons();
}
- protected List<Object> getViewerSelections() {
+ protected List<?> getViewerSelections() {
IStructuredSelection selections = (IStructuredSelection) smooksTreeViewer.getSelection();
- List l = selections.toList();
- List<Object> nl = new ArrayList<Object>();
- for (Iterator<?> iterator = l.iterator(); iterator.hasNext();) {
- Object object = (Object) iterator.next();
- // object = AdapterFactoryEditingDomain.unwrap(object);
- nl.add(object);
- }
- return l;
+ return selections.toList();
+// List<Object> nl = new ArrayList<Object>();
+// for (Iterator<?> iterator = l.iterator(); iterator.hasNext();) {
+// Object object = (Object) iterator.next();
+// // object = AdapterFactoryEditingDomain.unwrap(object);
+// nl.add(object);
+// }
+// return l;
}
private void hookButtons() {
removeButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- List<Object> list = getViewerSelections();
+ List<?> list = getViewerSelections();
CompoundCommand ccommand = new CompoundCommand();
for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
Object object = (Object) iterator.next();
@@ -231,7 +231,7 @@
downButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- List<Object> list = getViewerSelections();
+ List<?> list = getViewerSelections();
if(list.size() == 1){
Object obj = list.get(0);
EObject v = (EObject) AdapterFactoryEditingDomain.unwrap(obj);
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-09 09:45:28 UTC (rev 14625)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java 2009-04-09 10:40:55 UTC (rev 14626)
@@ -256,7 +256,7 @@
final IItemPropertyDescriptor itemPropertyDescriptor) {
String displayName = itemPropertyDescriptor.getDisplayName(getModel());
formToolKit.createLabel(propertyComposite, displayName + " :");
- final Spinner spinner = new Spinner(propertyComposite, SWT.NONE);
+ final Spinner spinner = new Spinner(propertyComposite, SWT.BORDER);
Object value = itemPropertyDescriptor.getPropertyValue(getModel());
if (value != null && value instanceof PropertyValueWrapper) {
Object editValue = ((PropertyValueWrapper) value).getEditableValue(getModel());
15 years, 8 months
JBoss Tools SVN: r14625 - in trunk/smooks/plugins: org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-04-09 05:45:28 -0400 (Thu, 09 Apr 2009)
New Revision: 14625
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaMethodsSelectionDialog.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanValueUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanWiringUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/PropertiesAndSetterMethodSearchFieldEditorCreator.java
Removed:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/ValuePropertiesUICreator.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/edit/common/provider/AbstractAnyTypeItemProvider.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/PropertyUICreatorManager.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaPropertiesSelectionDialog.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JavaPropertyUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
Log:
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/edit/common/provider/AbstractAnyTypeItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/edit/common/provider/AbstractAnyTypeItemProvider.java 2009-04-09 09:05:36 UTC (rev 14624)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/edit/common/provider/AbstractAnyTypeItemProvider.java 2009-04-09 09:45:28 UTC (rev 14625)
@@ -53,7 +53,6 @@
}
protected boolean isWrappingNeeded(Object object){
- wrappingNeeded = null;
return super.isWrappingNeeded(object);
}
/**
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-09 09:05:36 UTC (rev 14624)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-04-09 09:45:28 UTC (rev 14625)
@@ -10,19 +10,14 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
/**
* @author Dart (dpeng(a)redhat.com)
@@ -47,23 +42,11 @@
}
public IResource getResource(EObject model) {
- final Resource resource = ((EObject) model).eResource();
- URI uri = resource.getURI();
- IResource workspaceResource = null;
- if (uri.isPlatformResource()) {
- String path = uri.toPlatformString(true);
- workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
- }
- return workspaceResource;
+ return SmooksUIUtils.getResource(model);
}
public IJavaProject getJavaProject(EObject model) {
- IResource r = getResource(model);
- if (r != null) {
- IProject p = r.getProject();
- return JavaCore.create(p);
- }
- return null;
+ return SmooksUIUtils.getJavaProject(model);
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java 2009-04-09 09:05:36 UTC (rev 14624)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java 2009-04-09 09:45:28 UTC (rev 14625)
@@ -14,9 +14,11 @@
import java.util.Map;
import org.jboss.tools.smooks.configuration.editors.javabean.BindingsPropertyUICreator;
-import org.jboss.tools.smooks.configuration.editors.javabean.ValuePropertiesUICreator;
+import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanValueUICreator;
+import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanWiringUICreator;
import org.jboss.tools.smooks.model.javabean.impl.BindingsTypeImpl;
import org.jboss.tools.smooks.model.javabean.impl.ValueTypeImpl;
+import org.jboss.tools.smooks.model.javabean.impl.WiringTypeImpl;
/**
* @author Dart (dpeng(a)redhat.com)<p>
@@ -34,7 +36,8 @@
private void init() {
map.put(BindingsTypeImpl.class, new BindingsPropertyUICreator());
- map.put(ValueTypeImpl.class, new ValuePropertiesUICreator());
+ map.put(ValueTypeImpl.class, new JavabeanValueUICreator());
+ map.put(WiringTypeImpl.class, new JavabeanWiringUICreator());
}
public void registePropertyUICreator(Class<?> key,IPropertyUICreator creator){
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-04-09 09:05:36 UTC (rev 14624)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-04-09 09:45:28 UTC (rev 14625)
@@ -11,12 +11,17 @@
package org.jboss.tools.smooks.configuration.editors;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.BasicFeatureMapEntry;
import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
+import org.eclipse.emf.edit.command.DeleteCommand;
+import org.eclipse.emf.edit.command.MoveCommand;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IWrapperItemProvider;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
@@ -34,6 +39,8 @@
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
+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;
@@ -47,6 +54,7 @@
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
+import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
/**
* @author Dart Peng (dpeng(a)redhat.com)
@@ -54,7 +62,7 @@
* Date Apr 1, 2009
*/
public class SmooksMasterDetailBlock extends MasterDetailsBlock implements IMenuListener,
- ISelectionChangedListener {
+ ISelectionChangedListener {
private Section configurationSection;
private SectionPart sectionPart;
@@ -112,14 +120,15 @@
// provider.registePage(ResourceType.class, new
// SmooksStuffPropertyDetailPage());
detailsPart.registerPage(EObject.class, new SmooksStuffPropertyDetailPage(
- (SmooksMultiFormEditor) this.formEditor));
+ (SmooksMultiFormEditor) this.formEditor));
}
protected void createSmooksTreeViewer(FormToolkit tool, final IManagedForm managedForm,
- Composite rootMainControl) {
- configurationSection = tool.createSection(rootMainControl, Section.TITLE_BAR | Section.DESCRIPTION);
+ Composite rootMainControl) {
+ configurationSection = tool.createSection(rootMainControl, Section.TITLE_BAR
+ | Section.DESCRIPTION);
configurationSection
- .setDescription("Define Smooks stuffes for configuration file in the following section.");
+ .setDescription("Define Smooks stuffes for configuration file in the following section.");
configurationSection.setText("All Smooks Stuffes");
sectionPart = new SectionPart(configurationSection);
managedForm.addPart(sectionPart);
@@ -140,8 +149,9 @@
smooksTreeViewer = new TreeViewer(tableComposite, SWT.NONE);
smooksTreeViewer.addSelectionChangedListener(this);
smooksTreeViewer.setContentProvider(new AdapterFactoryContentProvider(editingDomain
- .getAdapterFactory()));
- smooksTreeViewer.setLabelProvider(new AdapterFactoryLabelProvider(editingDomain.getAdapterFactory()));
+ .getAdapterFactory()));
+ smooksTreeViewer.setLabelProvider(new AdapterFactoryLabelProvider(editingDomain
+ .getAdapterFactory()));
smooksTreeViewer.setFilters(new ViewerFilter[] { new TextEObjectModelFilter() });
Object smooksModel = ((SmooksMultiFormEditor) this.formEditor).getSmooksModel();
if (smooksModel != null) {
@@ -152,7 +162,7 @@
if (formEditor.getEditorSite().getActionBarContributor() instanceof ISelectionChangedListener) {
smooksTreeViewer.addSelectionChangedListener((ISelectionChangedListener) formEditor
- .getEditorSite().getActionBarContributor());
+ .getEditorSite().getActionBarContributor());
}
smooksTreeViewer.addSelectionChangedListener(this);
@@ -181,8 +191,65 @@
downButton = tool.createButton(buttonComposite, "Down", SWT.NONE);
downButton.setLayoutData(gd);
+ // don't display button area
+ gd = new GridData(GridData.FILL_VERTICAL);
+ gd.widthHint = 0;
+ buttonComposite.setLayoutData(gd);
+ buttonComposite.setVisible(false);
+
+ hookButtons();
}
+ protected List<Object> getViewerSelections() {
+ IStructuredSelection selections = (IStructuredSelection) smooksTreeViewer.getSelection();
+ List l = selections.toList();
+ List<Object> nl = new ArrayList<Object>();
+ for (Iterator<?> iterator = l.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ // object = AdapterFactoryEditingDomain.unwrap(object);
+ nl.add(object);
+ }
+ return l;
+ }
+
+ private void hookButtons() {
+ removeButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ List<Object> list = getViewerSelections();
+ CompoundCommand ccommand = new CompoundCommand();
+ for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ Command command = DeleteCommand.create(editingDomain, object);
+ if (command.canExecute()) {
+ ccommand.append(command);
+ }
+ }
+
+ editingDomain.getCommandStack().execute(ccommand);
+ }
+ });
+
+ downButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ List<Object> list = getViewerSelections();
+ if(list.size() == 1){
+ Object obj = list.get(0);
+ EObject v = (EObject) AdapterFactoryEditingDomain.unwrap(obj);
+ EObject parent = v.eContainer();
+ int index = parent.eContents().indexOf(v);
+ Command command = MoveCommand.create(editingDomain, parent, null, obj, index + 1);
+ System.out.println(command.canExecute());
+ editingDomain.getCommandStack().execute(command);
+ }
+ }
+ });
+
+ upButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ }
+ });
+ }
+
private void createMenuForViewer(TreeViewer smooksTreeViewer2) {
MenuManager contextMenu = new MenuManager("#PopUp");
contextMenu.add(new Separator("additions"));
@@ -192,7 +259,7 @@
Menu menu = contextMenu.createContextMenu(smooksTreeViewer2.getControl());
smooksTreeViewer2.getControl().setMenu(menu);
formEditor.getSite().registerContextMenu(contextMenu,
- new UnwrappingSelectionProvider(smooksTreeViewer2));
+ new UnwrappingSelectionProvider(smooksTreeViewer2));
}
public TreeViewer getSmooksTreeViewer() {
@@ -204,7 +271,8 @@
}
public void menuAboutToShow(IMenuManager menuManager) {
- ((IMenuListener) formEditor.getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);
+ ((IMenuListener) formEditor.getEditorSite().getActionBarContributor())
+ .menuAboutToShow(menuManager);
}
private class TextEObjectModelFilter extends ViewerFilter {
@@ -217,7 +285,7 @@
if (obj instanceof BasicFeatureMapEntry) {
EStructuralFeature sf = ((BasicFeatureMapEntry) obj).getEStructuralFeature();
if (sf.equals(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT)
- || sf.equals(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA)) {
+ || sf.equals(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA)) {
return false;
}
}
@@ -233,6 +301,46 @@
}
}
+ /**
+ *
+ * @param selections
+ */
+ protected void updateButtons(List<?> selections) {
+ removeButton.setEnabled(true);
+ upButton.setEnabled(true);
+ downButton.setEnabled(true);
+ if (selections.size() >= 1) {
+ for (Iterator<?> iterator = selections.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ object = AdapterFactoryEditingDomain.unwrap(object);
+ if (object instanceof SmooksResourceListType
+ || object instanceof org.jboss.tools.smooks10.model.smooks.SmooksResourceListType) {
+ removeButton.setEnabled(false);
+ break;
+ }
+ }
+ }
+ if (selections.size() == 1) {
+ Object selection = selections.get(0);
+ if (selection instanceof SmooksResourceListType
+ || selection instanceof org.jboss.tools.smooks10.model.smooks.SmooksResourceListType) {
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
+ } else {
+ if (selection instanceof EObject) {
+ EObject parent = ((EObject) selection).eContainer();
+ int index = parent.eContents().indexOf(selection);
+ if (index <= 0) {
+ upButton.setEnabled(false);
+ }
+ if (index >= parent.eContents().size() - 1) {
+ downButton.setEnabled(false);
+ }
+ }
+ }
+ }
+ }
+
/*
* (non-Javadoc)
*
@@ -250,11 +358,13 @@
objList.add(obj);
}
if (objList.isEmpty()) {
- sectionPart.getManagedForm().fireSelectionChanged(sectionPart, event.getSelection());
+ sectionPart.getManagedForm()
+ .fireSelectionChanged(sectionPart, event.getSelection());
} else {
sectionPart.getManagedForm().fireSelectionChanged(sectionPart,
- new StructuredSelection(objList.toArray()));
+ new StructuredSelection(objList.toArray()));
}
+ updateButtons(objList);
}
}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaMethodsSelectionDialog.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaMethodsSelectionDialog.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaMethodsSelectionDialog.java 2009-04-09 09:45:28 UTC (rev 14625)
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.javabean;
+
+import java.lang.reflect.Method;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
+import org.jboss.tools.smooks.configuration.editors.uitls.IFieldDialog;
+import org.jboss.tools.smooks.configuration.editors.uitls.JavaPropertyUtils;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ * <p>
+ * Apr 9, 2009
+ */
+public class JavaMethodsSelectionDialog implements IFieldDialog {
+
+ private IJavaProject resource;
+
+ private Class<?> clazz;
+
+ public JavaMethodsSelectionDialog(IJavaProject resource, Class<?> clazz) {
+ super();
+ this.resource = resource;
+ this.clazz = clazz;
+ }
+
+ public Object open(Shell shell) {
+ if (resource != null && clazz != null) {
+ MethodSelectionDialog dialog = new MethodSelectionDialog(shell, resource, clazz);
+ if (dialog.open() == Dialog.OK) {
+ Method pd = (Method) dialog.getCurrentSelection();
+ return pd.getName();
+ }else{
+ return null;
+ }
+ }
+ MessageDialog.openInformation(shell, "Can't open dialog",
+ "Can't open java methods selection dialog.");
+ return null;
+ }
+
+ private class MethodSelectionDialog extends Dialog {
+
+ private TableViewer viewer;
+
+ private Class<?> clazz;
+
+ private Object currentSelection;
+
+
+
+ public MethodSelectionDialog(IShellProvider parentShell) {
+ super(parentShell);
+ }
+
+ public MethodSelectionDialog(Shell parentShell, IJavaProject project, Class<?> clazz) {
+ super(parentShell);
+ this.clazz = clazz;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 400;
+ gd.widthHint = 400;
+ composite.setLayoutData(gd);
+ composite.setLayout(new FillLayout());
+ viewer = new TableViewer(composite, SWT.BORDER);
+ Table table = viewer.getTable();
+ TableColumn nameColumn = new TableColumn(table, SWT.NONE);
+ nameColumn.setWidth(100);
+ nameColumn.setText("Method Name");
+ TableColumn typeColumn = new TableColumn(table, SWT.NONE);
+ typeColumn.setWidth(200);
+ typeColumn.setText("Paramters Type");
+ table.setHeaderVisible(true);
+ viewer.setContentProvider(new MethodContentProvider());
+ viewer.setLabelProvider(new MethodLabelProvider());
+ Method[] settMethods = JavaPropertyUtils.getSetterMethods(clazz);
+ viewer.setInput(settMethods);
+ viewer.addDoubleClickListener(new IDoubleClickListener(){
+
+ public void doubleClick(DoubleClickEvent event) {
+ okPressed();
+ }
+
+ });
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ currentSelection = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ }
+
+ });
+ getShell().setText(clazz.getSimpleName() + "'s Setter Methods");
+ return composite;
+ }
+
+ public Object getCurrentSelection() {
+ return currentSelection;
+ }
+
+ public void setCurrentSelection(Object currentSelection) {
+ this.currentSelection = currentSelection;
+ }
+ }
+
+ private class MethodContentProvider implements IStructuredContentProvider {
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement.getClass().isArray()) {
+ return (Object[]) inputElement;
+ }
+ return new Object[] {};
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+ }
+
+ private class MethodLabelProvider extends LabelProvider implements ITableLabelProvider {
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.JAVA_PROPERTY_ICON);
+ }
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof Method) {
+ Method p = (Method) element;
+ switch (columnIndex) {
+ case 0:
+ return p.getName();
+ case 1:
+ Class<?>[] pts = p.getParameterTypes();
+ String paramtersName = "";
+ for (int i = 0; i < pts.length; i++,paramtersName+=",") {
+ String name = pts[i].getName();
+ if(pts[i].isArray()){
+ name = pts[i].getComponentType().getName() + "[]";
+ }
+ paramtersName += name;
+ }
+ if(paramtersName.endsWith(",")){
+ paramtersName = paramtersName.substring(0,paramtersName.length() - 1);
+ }
+ return paramtersName;
+ }
+ }
+ return getText(element);
+ }
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaMethodsSelectionDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaPropertiesSelectionDialog.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaPropertiesSelectionDialog.java 2009-04-09 09:05:36 UTC (rev 14624)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaPropertiesSelectionDialog.java 2009-04-09 09:45:28 UTC (rev 14625)
@@ -15,6 +15,8 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -74,8 +76,6 @@
private TableViewer viewer;
- private IJavaProject project;
-
private Class<?> clazz;
private Object currentSelection;
@@ -88,7 +88,6 @@
public PropertySelectionDialog(Shell parentShell, IJavaProject project, Class<?> clazz) {
super(parentShell);
- this.project = project;
this.clazz = clazz;
}
@@ -113,13 +112,17 @@
viewer.setLabelProvider(new PropertyDescriptorLabelProvider());
PropertyDescriptor[] pds = JavaPropertyUtils.getPropertyDescriptor(clazz);
viewer.setInput(pds);
+ viewer.addDoubleClickListener(new IDoubleClickListener(){
+ public void doubleClick(DoubleClickEvent event) {
+ okPressed();
+ }
+ });
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
public void selectionChanged(SelectionChangedEvent event) {
currentSelection = ((IStructuredSelection) event.getSelection()).getFirstElement();
}
-
});
+ getShell().setText(clazz.getSimpleName() + "'s Properties");
return composite;
}
@@ -146,7 +149,6 @@
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // TODO Auto-generated method stub
}
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanValueUICreator.java (from rev 14616, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/ValuePropertiesUICreator.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanValueUICreator.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanValueUICreator.java 2009-04-09 09:45:28 UTC (rev 14625)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.javabean;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.jboss.tools.smooks.model.javabean.JavabeanPackage;
+
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ * <p>
+ * Apr 9, 2009
+ */
+public class JavabeanValueUICreator extends PropertiesAndSetterMethodSearchFieldEditorCreator {
+
+ @Override
+ protected boolean canCreatePropertiesSearchFieldEditor(EAttribute feature) {
+ if(feature == JavabeanPackage.eINSTANCE.getValueType_Property()){
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected boolean canCreateMethodsSearchFieldEditor(EAttribute feature) {
+ if(feature == JavabeanPackage.eINSTANCE.getValueType_SetterMethod()){
+ return true;
+ }
+ return super.canCreateMethodsSearchFieldEditor(feature);
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanValueUICreator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanWiringUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanWiringUICreator.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanWiringUICreator.java 2009-04-09 09:45:28 UTC (rev 14625)
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.javabean;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.model.javabean.BindingsType;
+import org.jboss.tools.smooks.model.javabean.JavabeanPackage;
+import org.jboss.tools.smooks.model.smooks.AbstractResourceConfig;
+import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
+
+/**
+ * @author Dart Peng (dpeng(a)redhat.com) Date Apr 9, 2009
+ */
+public class JavabeanWiringUICreator extends PropertiesAndSetterMethodSearchFieldEditorCreator {
+
+ @Override
+ protected boolean canCreatePropertiesSearchFieldEditor(EAttribute feature) {
+ if (feature == JavabeanPackage.eINSTANCE.getWiringType_Property()) {
+ return true;
+ }
+ return false;
+ }
+
+
+
+ @Override
+ protected boolean canCreateMethodsSearchFieldEditor(EAttribute feature) {
+ if(feature == JavabeanPackage.eINSTANCE.getWiringType_SetterMethod()){
+ return true;
+ }
+ return super.canCreateMethodsSearchFieldEditor(feature);
+ }
+
+
+
+ @Override
+ public Composite createPropertyUI(FormToolkit toolkit, Composite parent,
+ IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature) {
+ if (feature == JavabeanPackage.eINSTANCE.getWiringType_BeanIdRef()) {
+ if(model instanceof EObject){
+ SmooksResourceListType smooksResourceList = getSmooksResourceList((EObject)model);
+ if(smooksResourceList != null){
+ String displayName = propertyDescriptor.getDisplayName(model);
+ toolkit.createLabel(parent, displayName + " :");
+ final CCombo combo = new CCombo(parent,SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ combo.setLayoutData(gd);
+ Object editValue = SmooksUIUtils.getEditValue(propertyDescriptor, model);
+ if (editValue != null) {
+ combo.setText(editValue.toString());
+ }
+ List<String> list = getBeanIdList(smooksResourceList);
+ for (Iterator<String> iterator = list.iterator(); iterator.hasNext();) {
+ String beanId = (String) iterator.next();
+ combo.add(beanId);
+ }
+ int selectIndex = list.indexOf(editValue);
+ if(selectIndex != -1){
+ combo.select(selectIndex);
+ }
+ final IItemPropertyDescriptor ip = propertyDescriptor;
+ final Object cmodel = model;
+ combo.addModifyListener(new ModifyListener(){
+ public void modifyText(ModifyEvent e) {
+ Object editValue = SmooksUIUtils.getEditValue(ip, cmodel);
+ if(combo.getText().equals(editValue)){
+ return;
+ }
+ ip.setPropertyValue(cmodel, combo.getText());
+ }
+ });
+ return combo;
+ }
+ }
+ }
+ return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature);
+ }
+
+ protected List<String> getBeanIdList(SmooksResourceListType resourceList){
+ List<AbstractResourceConfig> rlist = resourceList.getAbstractResourceConfig();
+ List<String> beanIdList = new ArrayList<String>();
+ for (Iterator<?> iterator = rlist.iterator(); iterator.hasNext();) {
+ AbstractResourceConfig abstractResourceConfig = (AbstractResourceConfig) iterator
+ .next();
+ if(abstractResourceConfig instanceof BindingsType){
+ String beanId = ((BindingsType)abstractResourceConfig).getBeanId();
+ if(beanId == null) continue;
+ beanIdList.add(beanId);
+ }
+ }
+ return beanIdList;
+ }
+
+ private SmooksResourceListType getSmooksResourceList(EObject model) {
+ EObject parent = model.eContainer();
+ while (parent != null && !(parent instanceof SmooksResourceListType)) {
+ parent = parent.eContainer();
+ }
+ if (parent instanceof SmooksResourceListType) {
+ return (SmooksResourceListType) parent;
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanWiringUICreator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/PropertiesAndSetterMethodSearchFieldEditorCreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/PropertiesAndSetterMethodSearchFieldEditorCreator.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/PropertiesAndSetterMethodSearchFieldEditorCreator.java 2009-04-09 09:45:28 UTC (rev 14625)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.javabean;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+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.editors.PropertyUICreator;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.model.javabean.BindingsType;
+
+/**
+ * @author Dart Peng (dpeng(a)redhat.com) Date Apr 9, 2009
+ */
+public class PropertiesAndSetterMethodSearchFieldEditorCreator extends PropertyUICreator {
+
+ @Override
+ public Composite createPropertyUI(FormToolkit toolkit, Composite parent,
+ IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature) {
+ if(canCreatePropertiesSearchFieldEditor(feature)){
+ return createPropertiesSearchFieldEditor(toolkit, parent, propertyDescriptor, model);
+ }
+ if(canCreateMethodsSearchFieldEditor(feature)){
+ return createMethodsSearchFieldEditor(toolkit, parent, propertyDescriptor, model);
+ }
+ return null;
+ }
+
+ protected boolean canCreatePropertiesSearchFieldEditor(EAttribute feature) {
+ return false;
+ }
+
+ protected boolean canCreateMethodsSearchFieldEditor(EAttribute feature) {
+ return false;
+ }
+
+ protected String getPropertiesSearchButtonName(){
+ return "Search property";
+ }
+
+ protected String getMethodsSearchButtonName(){
+ return "Search setter method";
+ }
+
+ protected Composite createPropertiesSearchFieldEditor(FormToolkit toolkit, Composite parent,
+ IItemPropertyDescriptor propertyDescriptor, Object model) {
+ if (model instanceof EObject) {
+ EObject container = ((EObject) model).eContainer();
+ if (container instanceof BindingsType) {
+ return SmooksUIUtils.createJavaPropertySearchFieldEditor((BindingsType) container,
+ parent, toolkit, propertyDescriptor, getPropertiesSearchButtonName(), (EObject) model);
+ }
+ }
+ return null;
+ }
+
+ protected Composite createMethodsSearchFieldEditor(FormToolkit toolkit, Composite parent,
+ IItemPropertyDescriptor propertyDescriptor, Object model) {
+ if (model instanceof EObject) {
+ EObject container = ((EObject) model).eContainer();
+ if (container instanceof BindingsType) {
+ return SmooksUIUtils.createJavaMethodSearchFieldEditor((BindingsType) container,
+ parent, toolkit, propertyDescriptor, getMethodsSearchButtonName(), (EObject) model);
+ }
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/PropertiesAndSetterMethodSearchFieldEditorCreator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/ValuePropertiesUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/ValuePropertiesUICreator.java 2009-04-09 09:05:36 UTC (rev 14624)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/ValuePropertiesUICreator.java 2009-04-09 09:45:28 UTC (rev 14625)
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.smooks.configuration.editors.javabean;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.jboss.tools.smooks.configuration.editors.IPropertyUICreator;
-import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
-import org.jboss.tools.smooks.configuration.editors.uitls.ProjectClassLoader;
-import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
-import org.jboss.tools.smooks.model.javabean.BindingsType;
-import org.jboss.tools.smooks.model.javabean.JavabeanPackage;
-
-/**
- * @author Dart (dpeng(a)redhat.com)
- * <p>
- * Apr 9, 2009
- */
-public class ValuePropertiesUICreator extends PropertyUICreator implements IPropertyUICreator {
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.jboss.tools.smooks.configuration.editors.IPropertyUICreator#
- * createPropertyUI(org.eclipse.ui.forms.widgets.FormToolkit,
- * org.eclipse.swt.widgets.Composite,
- * 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) {
- if (feature == JavabeanPackage.eINSTANCE.getValueType_Property()) {
- if (model instanceof EObject) {
- EObject container = ((EObject) model).eContainer();
- if (container instanceof BindingsType) {
- String classString = ((BindingsType) container).getClass_();
- IJavaProject project = getJavaProject(container);
- try {
- ProjectClassLoader classLoader = new ProjectClassLoader(project);
- Class<?> clazz = classLoader.loadClass(classString);
- JavaPropertiesSelectionDialog dialog = new JavaPropertiesSelectionDialog(project,
- clazz);
- return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
- "Select property", dialog, (EObject)model);
- } catch (JavaModelException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- }
- }
- }
- return null;
- }
-
-}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JavaPropertyUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JavaPropertyUtils.java 2009-04-09 09:05:36 UTC (rev 14624)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JavaPropertyUtils.java 2009-04-09 09:45:28 UTC (rev 14625)
@@ -3,6 +3,9 @@
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
/**
*
@@ -21,6 +24,19 @@
return new PropertyDescriptor[]{};
}
}
+
+ public static Method[] getSetterMethods(Class<?> clazz){
+ Method[] methods = clazz.getMethods();
+ List<Method> mlist = new ArrayList<Method>();
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ String methodName = method.getName();
+ if(methodName.startsWith("set")){
+ mlist.add(method);
+ }
+ }
+ return mlist.toArray(new Method[]{});
+ }
/**
*
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-09 09:05:36 UTC (rev 14624)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-09 09:45:28 UTC (rev 14625)
@@ -1,5 +1,6 @@
package org.jboss.tools.smooks.configuration.editors.uitls;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
@@ -8,6 +9,9 @@
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -15,29 +19,100 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.editors.javabean.JavaMethodsSelectionDialog;
+import org.jboss.tools.smooks.configuration.editors.javabean.JavaPropertiesSelectionDialog;
+import org.jboss.tools.smooks.model.javabean.BindingsType;
public class SmooksUIUtils {
public static Composite createJavaTypeSearchFieldEditor(Composite parent, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, final EObject model) {
+ final IItemPropertyDescriptor propertyDescriptor, final EObject model) {
if (model instanceof EObject) {
final Resource resource = ((EObject) model).eResource();
URI uri = resource.getURI();
IResource workspaceResource = null;
if (uri.isPlatformResource()) {
String path = uri.toPlatformString(true);
- workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
+ workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(
+ new Path(path));
JavaTypeFieldDialog dialog = new JavaTypeFieldDialog(workspaceResource);
return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
- "Search Class", dialog, (EObject) model);
+ "Search Class", dialog, (EObject) model);
}
}
return null;
}
+ public static IResource getResource(EObject model) {
+ final Resource resource = ((EObject) model).eResource();
+ URI uri = resource.getURI();
+ IResource workspaceResource = null;
+ if (uri.isPlatformResource()) {
+ String path = uri.toPlatformString(true);
+ workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
+ }
+ return workspaceResource;
+ }
+
+ public static IJavaProject getJavaProject(EObject model) {
+ IResource r = getResource(model);
+ if (r != null) {
+ IProject p = r.getProject();
+ return JavaCore.create(p);
+ }
+ return null;
+ }
+
+ public static Composite createJavaMethodSearchFieldEditor(BindingsType container,
+ Composite parent, FormToolkit toolkit, final IItemPropertyDescriptor propertyDescriptor,
+ String buttonName, final EObject model) {
+ String classString = ((BindingsType) container).getClass_();
+ IJavaProject project = getJavaProject(container);
+ try {
+ ProjectClassLoader classLoader = new ProjectClassLoader(project);
+ Class<?> clazz = classLoader.loadClass(classString);
+ JavaMethodsSelectionDialog dialog = new JavaMethodsSelectionDialog(project, clazz);
+ return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
+ "Select method", dialog, (EObject) model);
+ } catch (JavaModelException e) {
+ // ignore
+ } catch (ClassNotFoundException e) {
+ // ignore
+ }
+ return null;
+ }
+
+ public static Composite createJavaPropertySearchFieldEditor(BindingsType container,
+ Composite parent, FormToolkit toolkit, final IItemPropertyDescriptor propertyDescriptor,
+ String buttonName, final EObject model) {
+ String classString = ((BindingsType) container).getClass_();
+ IJavaProject project = getJavaProject(container);
+ try {
+ ProjectClassLoader classLoader = new ProjectClassLoader(project);
+ Class<?> clazz = classLoader.loadClass(classString);
+ JavaPropertiesSelectionDialog dialog = new JavaPropertiesSelectionDialog(project, clazz);
+ return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
+ "Select property", dialog, (EObject) model);
+ } catch (JavaModelException e) {
+ // ignore
+ } catch (ClassNotFoundException e) {
+ // ignore
+ }
+ return null;
+ }
+
+ public static Object getEditValue(IItemPropertyDescriptor propertyDescriptor, Object model) {
+ Object value = propertyDescriptor.getPropertyValue(model);
+ if (value != null && value instanceof PropertyValueWrapper) {
+ Object editValue = ((PropertyValueWrapper) value).getEditableValue(model);
+ return editValue;
+ }
+ return null;
+ }
+
public static Composite createDialogFieldEditor(Composite parent, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, String buttonName, IFieldDialog dialog,
- final EObject model) {
+ final IItemPropertyDescriptor propertyDescriptor, String buttonName, IFieldDialog dialog,
+ final EObject model) {
String displayName = propertyDescriptor.getDisplayName(model);
toolkit.createLabel(parent, displayName + " :");
final Composite classTextComposite = toolkit.createComposite(parent);
@@ -47,14 +122,11 @@
fillLayout.marginHeight = 0;
fillLayout.marginWidth = 0;
classTextComposite.setLayout(fillLayout);
- final SearchComposite searchComposite = new SearchComposite(classTextComposite, toolkit, buttonName,
- dialog, SWT.NONE);
- Object value = propertyDescriptor.getPropertyValue(model);
- if (value != null && value instanceof PropertyValueWrapper) {
- Object editValue = ((PropertyValueWrapper) value).getEditableValue(model);
- if (editValue != null) {
- searchComposite.getText().setText(editValue.toString());
- }
+ final SearchComposite searchComposite = new SearchComposite(classTextComposite, toolkit,
+ buttonName, dialog, SWT.NONE);
+ Object editValue = getEditValue(propertyDescriptor, model);
+ if (editValue != null) {
+ searchComposite.getText().setText(editValue.toString());
}
searchComposite.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
@@ -63,10 +135,12 @@
Object editValue = ((PropertyValueWrapper) value).getEditableValue(model);
if (editValue != null) {
if (!editValue.equals(searchComposite.getText().getText())) {
- propertyDescriptor.setPropertyValue(model, searchComposite.getText().getText());
+ propertyDescriptor.setPropertyValue(model, searchComposite.getText()
+ .getText());
}
} else {
- propertyDescriptor.setPropertyValue(model, searchComposite.getText().getText());
+ propertyDescriptor.setPropertyValue(model, searchComposite.getText()
+ .getText());
}
} else {
propertyDescriptor.setPropertyValue(model, searchComposite.getText().getText());
15 years, 8 months
JBoss Tools SVN: r14624 - in trunk/esb/plugins: org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2009-04-09 05:05:36 -0400 (Thu, 09 Apr 2009)
New Revision: 14624
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/IJBossESBFacetDataModelProperties.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetDataModelProvider.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java
Log:
JBIDE-3847: JBoss Tools should provide features for full 4.5 ESB to support different jboss-esb.xsd version(Apply Viacheslav's patch)
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/IJBossESBFacetDataModelProperties.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/IJBossESBFacetDataModelProperties.java 2009-04-09 08:44:06 UTC (rev 14623)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/IJBossESBFacetDataModelProperties.java 2009-04-09 09:05:36 UTC (rev 14624)
@@ -23,6 +23,8 @@
public static final String ESB_CONTENT_FOLDER = "JBoss.Project.Content_Folder";
public static final String ESB_SOURCE_FOLDER = "JBoss.Project.Src_Folder";
+ public static final String ESB_CONFIG_VERSION = "JBoss.Project.Config_Version";
+
public static final QualifiedName QNAME_ESB_CONTENT_FOLDER = new QualifiedName("jboss", ESB_CONTENT_FOLDER);
public static final QualifiedName QNAME_ESB_SRC_FOLDER = new QualifiedName("jboss", ESB_SOURCE_FOLDER);
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetDataModelProvider.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetDataModelProvider.java 2009-04-09 08:44:06 UTC (rev 14623)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetDataModelProvider.java 2009-04-09 09:05:36 UTC (rev 14624)
@@ -31,6 +31,7 @@
names.add(RUNTIME_ID);
names.add(RUNTIME_HOME);
names.add(RUNTIME_IS_SERVER_SUPPLIED);
+ names.add(IJBossESBFacetDataModelProperties.ESB_CONFIG_VERSION);
return names;
}
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java 2009-04-09 08:44:06 UTC (rev 14623)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java 2009-04-09 09:05:36 UTC (rev 14624)
@@ -111,20 +111,18 @@
private IFile createJBossESBXML(IFolder folder) throws CoreException{
StringBuffer emptyESB = new StringBuffer();
+ String configVersion = model.getStringProperty(IJBossESBFacetDataModelProperties.ESB_CONFIG_VERSION);
emptyESB.append("<?xml version = \"1.0\" encoding = \"UTF-8\"?>");
emptyESB.append("\n");
- emptyESB.append("<jbossesb xmlns=\"http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml..." parameterReloadSecs=\"5\">");
+ emptyESB.append("<jbossesb xmlns=\"http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml..." + configVersion + ".xsd\" parameterReloadSecs=\"5\">");
emptyESB.append("\n");
emptyESB.append("</jbossesb>");
IFile esbfile = folder.getFile("jboss-esb.xml");
esbfile.create(new ByteArrayInputStream(emptyESB.toString().getBytes()), true, null);
return esbfile;
- }
-
+ }
-
-
private void createProjectStructure(IProject project) throws CoreException{
String strContentFolder = model.getStringProperty(IJBossESBFacetDataModelProperties.ESB_CONTENT_FOLDER);
project.setPersistentProperty(IJBossESBFacetDataModelProperties.QNAME_ESB_CONTENT_FOLDER, strContentFolder);
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java 2009-04-09 08:44:06 UTC (rev 14623)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java 2009-04-09 09:05:36 UTC (rev 14624)
@@ -78,7 +78,9 @@
private Button btnUserSupplied;
private Button btnServerSupplied;
private Button btnNew;
-
+
+ private Combo cmbConfigVersions;
+
private IFacetedProjectListener fpListerner;
private IFacetedProjectWorkingCopy fpwc;
@@ -103,6 +105,7 @@
createProjectGroup(composite);
createRuntimeGroup(composite);
+ createConfigVersionGroup(composite);
setPageComplete(false);
setDefaultOutputFolder();
@@ -122,9 +125,11 @@
public void run() {
if(version != null){
initializeRuntimesCombo(cmbRuntimes, null, version.getVersionString());
+ initializeConfigVersionCombo(cmbConfigVersions, null, version.getVersionString());
}else{
initializeRuntimesCombo(cmbRuntimes, null);
+ initializeConfigVersionCombo(cmbConfigVersions, null);
}
changePageStatus();
}
@@ -600,8 +605,52 @@
}
super.dispose();
}
-
-
+ private void createConfigVersionGroup(Composite parent) {
+ Group configGroup = new Group(parent, SWT.NONE);
+ configGroup.setText("ESB Config Version"); //TODO move to messages
+ configGroup.setLayout(new GridLayout(3, false));
+ configGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ GridData gd = new GridData();
+
+ cmbConfigVersions = new Combo(configGroup, SWT.READ_ONLY);
+ cmbConfigVersions.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ cmbConfigVersions.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ String convigVersionName = cmbConfigVersions.getText();
+ saveESBConfigVersionToModel(convigVersionName);
+ changePageStatus();
+ }
+ });
+ initializeConfigVersionCombo(cmbConfigVersions, null);
+ }
+
+ protected void saveESBConfigVersionToModel(String convigVersionName) {
+ model.setStringProperty(
+ IJBossESBFacetDataModelProperties.ESB_CONFIG_VERSION, convigVersionName);
+ }
+
+ protected void initializeConfigVersionCombo(Combo cmVersions, String runtimeName) {
+ IProjectFacetVersion version = getSelectedESBVersion();
+ if(version != null) {
+ initializeConfigVersionCombo(cmbConfigVersions, null, version.getVersionString());
+
+ } else {
+ initializeConfigVersionCombo(cmbConfigVersions, null, ""); //$NON-NLS-1$
+ }
+ }
+
+ protected void initializeConfigVersionCombo(Combo cmVersions, String currentName, String version) {
+ cmVersions.removeAll();
+ cmVersions.add("1.0.1"); //$NON-NLS-1$
+ if(version != null && version.equals("4.5")) { //$NON-NLS-1$
+ cmVersions.add("1.1.0"); //$NON-NLS-1$
+ }
+ int index = cmVersions.getItemCount() - 1;
+ String convigVersionName = cmVersions.getItem(index);
+ cmVersions.select(index);
+ saveESBConfigVersionToModel(convigVersionName);
+ }
}
\ No newline at end of file
15 years, 8 months
JBoss Tools SVN: r14623 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2009-04-09 04:44:06 -0400 (Thu, 09 Apr 2009)
New Revision: 14623
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4110, Update any template automatically on attribute adding/removing.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2009-04-09 07:03:18 UTC (rev 14622)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2009-04-09 08:44:06 UTC (rev 14623)
@@ -1117,50 +1117,12 @@
public void setAttribute(Element sourceElement, String name, String value) {
VpeElementMapping elementMapping = (VpeElementMapping) domMapping
.getNodeMapping(sourceElement);
+ /*
+ * https://jira.jboss.org/jira/browse/JBIDE-4110
+ * Update any template automatically on attribute adding.
+ */
if (elementMapping != null) {
- if (elementMapping.isIfDependencyFromAttribute(name)) {
- updateElement(sourceElement);
- } else {
- VpeTemplate template = elementMapping.getTemplate();
- if (elementMapping.getBorder() != null) {
- updateElement(sourceElement);
- } else if (template.recreateAtAttrChange(pageContext,
- sourceElement, getVisualDocument(),
- (nsIDOMElement) elementMapping.getVisualNode(),
- elementMapping.getData(), name, value)) {
- updateElement(sourceElement);
- } else {
- nsIDOMElement visualElement = (nsIDOMElement) elementMapping
- .getVisualNode();
- if (visualElement != null) {
- String visualElementName = visualElement.getNodeName();
- if (HTML.TAG_SELECT.equalsIgnoreCase(visualElementName)) {
- updateElement(sourceElement);
- return;
- } else if (HTML.TAG_OPTION
- .equalsIgnoreCase(visualElementName)) {
- updateElement(sourceElement.getParentNode());
- return;
- } else if (HTML.TAG_INPUT
- .equalsIgnoreCase(visualElementName)) {
- updateElement(sourceElement);
- // Fixes JBIDE-1744 author dmaliarevich
- // unified h:dataTable border lookup
- // after attribute change and
- // after visual editor refresh
- } else if (HTML.TAG_TABLE
- .equalsIgnoreCase(visualElementName)) {
- updateElement(sourceElement);
- }
- // End of fix
- }
- // setXmlnsAttribute(elementMapping, name, value);
- template.setAttribute(pageContext, sourceElement,
- getVisualDocument(), visualElement, elementMapping
- .getData(), name, value);
- resetTooltip(sourceElement, visualElement);
- }
- }
+ updateElement(sourceElement);
}
}
@@ -1291,27 +1253,12 @@
public void removeAttribute(Element sourceElement, String name) {
VpeElementMapping elementMapping = (VpeElementMapping) domMapping
.getNodeMapping(sourceElement);
+ /*
+ * https://jira.jboss.org/jira/browse/JBIDE-4110
+ * Update any template automatically on attribute deleting.
+ */
if (elementMapping != null) {
- if (elementMapping.isIfDependencyFromAttribute(name)) {
- updateElement(sourceElement);
- } else {
- VpeTemplate template = elementMapping.getTemplate();
- if (template.recreateAtAttrChange(pageContext, sourceElement,
- getVisualDocument(), (nsIDOMElement) elementMapping
- .getVisualNode(), elementMapping.getData(),
- name, null)) {
- updateElement(sourceElement);
- }
- // else {
- // removeXmlnsAttribute(elementMapping, name);
- // template.removeAttribute(pageContext, sourceElement,
- // visualDocument, (nsIDOMElement) elementMapping
- // .getVisualNode(), elementMapping.getData(),
- // name);
- // resetTooltip(sourceElement, (nsIDOMElement) elementMapping
- // .getVisualNode());
- // }
- }
+ updateElement(sourceElement);
}
}
15 years, 8 months