JBoss Tools SVN: r5694 - trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-01-15 09:38:24 -0500 (Tue, 15 Jan 2008)
New Revision: 5694
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Customization.java
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1622
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Customization.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Customization.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Customization.java 2008-01-15 14:38:24 UTC (rev 5694)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.hibernate.eclipse.console.test.mappingproject;
+
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class Customization {
+
+ /**
+ * is use TEST_PACKS_PATTERN to packages
+ */
+ public static final boolean U_TEST_PACKS_PATTERN = false;
+
+ /**
+ * packages name pattern
+ */
+ public static final String TEST_PACKS_PATTERN = ".*\\.optlock.*";
+
+ /**
+ * is stop after missing package or run further
+ */
+ public static final boolean STOP_AFTER_MISSING_PACK = false;
+
+ /**
+ * Shows each test run as individual
+ */
+ public static final boolean SHOW_EACH_TEST = true;
+
+ /**
+ * Delay in milliseconds after each package
+ */
+ public static final int EACTH_PACK_TEST_DELAY = 0;
+
+ /**
+ * Delay in milliseconds before closing workspace
+ */
+ public static final long AFTER_ALL_PACKS_DELAY = 20000;
+
+ /**
+ * Use time profiler
+ */
+ public static final boolean USE_CONSOLE_OUTPUT = true;
+
+
+}
Property changes on: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Customization.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java 2008-01-15 14:36:00 UTC (rev 5693)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java 2008-01-15 14:38:24 UTC (rev 5694)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.hibernate.eclipse.console.test.mappingproject;
+import java.util.regex.Pattern;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestResult;
@@ -72,10 +74,6 @@
for (int i = 0; i < suite.testCount(); i++) {
Test test = suite.testAt(i);
test.run(result);
- /*if (result.failureCount() > 0 || result.errorCount() > 0){
- // we have failed tests after setup
- fail(((Throwable)result.failures().nextElement()).getMessage());
- }*/
}
}
@@ -88,12 +86,13 @@
super.run(result);
}
- public void tearDown() throws Exception {
+ public void tearDown() throws Exception {
waitForJobs();
- runTestsBeforeTearDown();
+ runTestsBeforeTearDown();
waitForJobs();
- this.project.deleteIProject();
- waitForJobs();
+ delay(1000);
+ //this.project.deleteIProject();
+ //waitForJobs();
super.tearDown();
}
@@ -112,6 +111,7 @@
* the number of milliseconds
*/
protected void delay(long waitTimeMillis) {
+ if (waitTimeMillis <= 0) return;
Display display = Display.getCurrent();
// If this is the UI thread,
@@ -148,11 +148,9 @@
}
public void testEachPackWithTestSet() throws JavaModelException {
- /*
- * (1) All test runs show as one
- * Comment this and uncomment (2) if you want to see each test run independent
- */
+ long start_time = System.currentTimeMillis();
TestSuite suite = TestSet.getTests();
+ int pack_count = 0;
IPackageFragmentRoot[] roots = project.getIJavaProject().getAllPackageFragmentRoots();
for (int i = 0; i < roots.length; i++) {
if (roots[i].getClass() != PackageFragmentRoot.class) continue;
@@ -164,13 +162,17 @@
IPackageFragment pack = (IPackageFragment) javaElement;
// use packages only with compilation units
if (pack.getCompilationUnits().length == 0) continue;
+ if (Customization.U_TEST_PACKS_PATTERN &&
+ !Pattern.matches(Customization.TEST_PACKS_PATTERN, javaElement.getElementName())){
+ continue;
+ }
- /*
- * (2) Each test run shows independent
- * Comment this and uncomment (1) if you want to see all test runs as one
- * TestSuite suite = TestSet.getTests();
- */
-
+ long st_pack_time = System.currentTimeMillis();
+ int prev_failCount = result.failureCount();
+ int prev_errCount = result.errorCount();
+
+ if (Customization.SHOW_EACH_TEST) suite = TestSet.getTests();
+
activePackage = pack;
//==============================
//run all tests for package
@@ -180,14 +182,35 @@
waitForJobs();
}
//==============================
- }
- waitForJobs();
- //delay(15000);
- }
-
+ pack_count++;
+ if (Customization.USE_CONSOLE_OUTPUT){
+ System.out.print( result.errorCount() - prev_errCount + " errors. \t");
+ System.out.print( result.failureCount() - prev_failCount + " fails.\t");
+ long period = System.currentTimeMillis() - st_pack_time;
+ String time = period / 1000 + "." + (period % 1000) / 100;
+ System.out.println( time +" sec. " + javaElement.getElementName());
+ }
+ waitForJobs();
+ delay(Customization.EACTH_PACK_TEST_DELAY);
+
+ if (Customization.STOP_AFTER_MISSING_PACK){
+ if (result.failureCount() > prev_failCount) break;
+ }
+ prev_failCount = result.failureCount();
+ prev_errCount = result.errorCount();
+ }
+ }
}
- waitForJobs();
- //delay(10000);
+ if (Customization.USE_CONSOLE_OUTPUT){
+ System.out.println( "=====================================================");
+ System.out.print( result.errorCount() + " errors. \t");
+ System.out.print( result.failureCount() + " fails.\t");
+ System.out.print(( System.currentTimeMillis() - start_time ) / 1000 + " seconds.\t" );
+ System.out.println( pack_count + " packages tested." );
+ }
+ waitForJobs();
+
+ delay(Customization.AFTER_ALL_PACKS_DELAY);
}
/**
16 years, 5 months
JBoss Tools SVN: r5693 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-01-15 09:36:00 -0500 (Tue, 15 Jan 2008)
New Revision: 5693
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1596
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java 2008-01-15 14:35:56 UTC (rev 5692)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java 2008-01-15 14:36:00 UTC (rev 5693)
@@ -15,11 +15,13 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.internal.ObjectPluginAction;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.eclipse.console.utils.ProjectUtils;
+import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Subclass;
import org.jboss.tools.hibernate.ui.view.ViewPlugin;
@@ -29,26 +31,31 @@
public void run(IAction action) {
ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
- Object persClass = ((TreeSelection)objectPluginAction.getSelection()).getFirstElement();
- Object rootClass = null;
- if (persClass instanceof RootClass) {
- rootClass = (RootClass) persClass;
- } else if (persClass instanceof Subclass) {
- rootClass = ((Subclass) persClass).getRootClass();
- }
- ObjectEditorInput input = (ObjectEditorInput)hashMap.get(rootClass);
- ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)(((TreeSelection)objectPluginAction.getSelection()).getPaths()[0]).getSegment(0);
+ Object first_el = ((TreeSelection)objectPluginAction.getSelection()).getFirstElement();
+ if (first_el instanceof PersistentClass) {
+ PersistentClass persClass = (PersistentClass) first_el;
+ ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)(((TreeSelection)objectPluginAction.getSelection()).getPaths()[0]).getSegment(0);
+
+ try {
+ openEditor(persClass, consoleConfiguration);
+ } catch (PartInitException e) {
+ ViewPlugin.getDefault().logError("Can't open mapping view.", e);
+ }
+ }
+ }
+
+ public IEditorPart openEditor(PersistentClass persClass,
+ ConsoleConfiguration consoleConfiguration) throws PartInitException {
+ ObjectEditorInput input = (ObjectEditorInput)hashMap.get(persClass.getRootClass());
+
IJavaProject proj = ProjectUtils.findJavaProject(consoleConfiguration);
if(input == null) {
- input = new ObjectEditorInput(consoleConfiguration, rootClass, proj);
- hashMap.put(rootClass, input);
+ input = new ObjectEditorInput(consoleConfiguration, persClass.getRootClass(), proj);
+ hashMap.put(persClass.getRootClass(), input);
}
- try {
- IDE.openEditor(ViewPlugin.getPage(),input ,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor");
- } catch (PartInitException e) {
- ViewPlugin.getDefault().logError("Can't open mapping view.", e);
- }
+
+ return IDE.openEditor(ViewPlugin.getPage(),input ,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor");
}
}
\ No newline at end of file
16 years, 5 months
JBoss Tools SVN: r5692 - in trunk/hibernatetools/tests/org.hibernate.eclipse.console.test: src/org/hibernate/eclipse/console/test/mappingproject and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-01-15 09:35:56 -0500 (Tue, 15 Jan 2008)
New Revision: 5692
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagrammTest.java
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateNatureAddTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateNatureRemoveTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestProject.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/ProjectUtil.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1596
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF 2008-01-15 14:34:36 UTC (rev 5691)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF 2008-01-15 14:35:56 UTC (rev 5692)
@@ -28,7 +28,8 @@
org.eclipse.wst.xml.core,
org.eclipse.wst.xml.ui,
org.apache.ant,
- org.eclipse.ui.views
+ org.eclipse.ui.views,
+ org.jboss.tools.hibernate.ui.view
Eclipse-LazyStart: true
Bundle-Activator: org.hibernate.eclipse.console.test.HibernateConsoleTestPlugin
Eclipse-RegisterBuddy: org.hibernate.eclipse
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateNatureAddTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateNatureAddTest.java 2008-01-15 14:34:36 UTC (rev 5691)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateNatureAddTest.java 2008-01-15 14:35:56 UTC (rev 5692)
@@ -26,7 +26,7 @@
*
*/
public class HibernateNatureAddTest extends TestCase {
- public void testEnableHibernateNature() throws BackingStoreException, CoreException {
+ public void testHibernateNatureAdd() throws BackingStoreException, CoreException {
MappingTestProject project = MappingTestProject.getTestProject();
IJavaProject prj = project.getIJavaProject();
IScopeContext scope = new ProjectScope(prj.getProject() );
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateNatureRemoveTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateNatureRemoveTest.java 2008-01-15 14:34:36 UTC (rev 5691)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateNatureRemoveTest.java 2008-01-15 14:35:56 UTC (rev 5692)
@@ -23,7 +23,7 @@
*
*/
public class HibernateNatureRemoveTest extends TestCase {
- public void testEnableHibernateNature() throws BackingStoreException, CoreException {
+ public void testHibernateNatureRemove() throws BackingStoreException, CoreException {
MappingTestProject project = MappingTestProject.getTestProject();
IJavaProject prj = project.getIJavaProject();
ProjectUtils.removeProjectNature(prj.getProject(), "org.hibernate.eclipse.console.hibernateNature", new NullProgressMonitor() );
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestProject.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestProject.java 2008-01-15 14:34:36 UTC (rev 5691)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestProject.java 2008-01-15 14:35:56 UTC (rev 5692)
@@ -15,6 +15,7 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -46,6 +47,8 @@
public class MappingTestProject{
public static final String SRC_FOLDER = "src";
+
+ public static final String LIB_FOLDER = "lib";
private static MappingTestProject singleton= null;
@@ -53,6 +56,7 @@
public static String PROJECT_NAME = "MappingTestProject";
public static String RESOURCE_PATH = "res/project/";
+ public static String RES_LIB_FNAME = ".lib";
private static FileFilter fileFilter = new FileFilter(){
public boolean accept(File pathname) {
@@ -65,6 +69,11 @@
if (pathname.getName().charAt(0) == '.') return false;
return pathname.isDirectory();
}};
+
+ private static FileFilter jarFilter = new FileFilter(){
+ public boolean accept(File pathname) {
+ return !pathname.isDirectory() || pathname.getName().endsWith(".jar");
+ }};
private IProject project;
private IJavaProject javaProject;
@@ -108,13 +117,15 @@
IPath resourcePath = new Path(RESOURCE_PATH);
File resourceFolder = resourcePath.toFile();
if (!resourceFolder.exists())
- throw new RuntimeException("Folder " + RESOURCE_PATH + " does not found!");
+ throw new RuntimeException("Folder " + RESOURCE_PATH + " not found!");
- IPackageFragmentRoot sourceFolder = buildSourceFolder(project, javaProject);
- recursiveCopyFiles(resourceFolder, (IFolder) sourceFolder.getResource());
+ IPackageFragmentRoot sourceFolder = createSourceFolder(project, javaProject);
+ recursiveCopyFiles(resourceFolder, (IFolder) sourceFolder.getResource());
+ List<IPath> libs = copyLibs(resourceFolder);
+ generateClassPath(libs, sourceFolder);
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
- }
-
+ }
+
private void recursiveCopyFiles(File src, IFolder dst){
File[] files = src.listFiles(fileFilter);
for (int i = 0; i < files.length; i++) {
@@ -147,6 +158,47 @@
}
}
+ private List<IPath> copyLibs(File res) throws CoreException {
+ IFolder dst = project.getFolder(LIB_FOLDER);
+ if (!dst.exists()){
+ dst.create(false, true, null);
+ javaProject.getPackageFragmentRoot(dst);
+ }
+
+ File libFolder = new File(res.getAbsolutePath()+"/" + RES_LIB_FNAME);
+ if ( !libFolder.exists() )
+ throw new RuntimeException("Folder " + RESOURCE_PATH + RES_LIB_FNAME + " not found!");
+
+
+ List<IPath> libs = new ArrayList<IPath>();
+
+ File[] files = libFolder.listFiles(jarFilter);
+ for (int i = 0; i < files.length; i++) {
+ File file = files[i];
+ if (!file.exists()) continue;
+ IFile iFile = dst.getFile(file.getName());
+ try {
+ iFile.create(new FileInputStream(file), true, null);
+ libs.add(iFile.getFullPath());
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ continue;
+ }
+ }
+ return libs;
+ }
+
+ private void generateClassPath(List<IPath> libs, IPackageFragmentRoot sourceFolder) throws JavaModelException{
+ List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
+ //entries.addAll(Arrays.asList(javaProject.getRawClasspath()));
+ for (IPath lib_path : libs) {
+ entries.add(JavaCore.newLibraryEntry(lib_path, null, null));
+ }
+ entries.add(JavaCore.newSourceEntry(sourceFolder.getPath()));
+ entries.add(JavaCore.newContainerEntry(JRE_CONTAINER));
+ javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[0]), null);
+ }
+
private IProject buildNewProject(String projectName) {
// get a project handle
@@ -195,16 +247,16 @@
}
- private IPackageFragmentRoot buildSourceFolder(IProject project,
+ private IPackageFragmentRoot createSourceFolder(IProject project,
IJavaProject javaProject) throws CoreException {
IFolder folder = project.getFolder(SRC_FOLDER);
if (!folder.exists()){
folder.create(false, true, null);
IPackageFragmentRoot root = javaProject.getPackageFragmentRoot(folder);
- IClasspathEntry[] newEntries = { JavaCore
+ /*IClasspathEntry[] newEntries = { JavaCore
.newSourceEntry(root.getPath()) , JavaCore
.newContainerEntry(JRE_CONTAINER)};
- javaProject.setRawClasspath(newEntries, null);
+ javaProject.setRawClasspath(newEntries, null);*/
return root;
}
return javaProject.getPackageFragmentRoot(folder);
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagrammTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagrammTest.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagrammTest.java 2008-01-15 14:35:56 UTC (rev 5692)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.hibernate.eclipse.console.test.mappingproject;
+
+import java.lang.reflect.Field;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.internal.ErrorEditorPart;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import org.hibernate.eclipse.console.workbench.ConfigurationWorkbenchAdapter;
+import org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter;
+import org.hibernate.mapping.PersistentClass;
+import org.jboss.tools.hibernate.ui.view.views.OpenDiagramActionDelegate;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class OpenMappingDiagrammTest extends TestCase {
+ public void testOpenMappingDiagramm() throws Throwable{
+ KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
+ final ConsoleConfiguration consCFG = knownConfigurations.find(ProjectUtil.ConsoleCFGName);
+ assertNotNull(consCFG);
+ consCFG.reset();
+ Object[] configs = new ConsoleConfigurationWorkbenchAdapter().getChildren(consCFG);
+ assertTrue(configs[0] instanceof Configuration);
+ Object[] persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
+ if (persClasses.length > 0){
+ for (int i = 0; i < persClasses.length; i++) {
+ assertTrue(persClasses[0] instanceof PersistentClass);
+ PersistentClass persClass = (PersistentClass) persClasses[i];
+ try {
+ IEditorPart editor = new OpenDiagramActionDelegate().openEditor(persClass, consCFG);
+ ProjectUtil.throwExceptionIfItOccured(editor);
+ } catch (PartInitException e) {
+ fail("Error opening Mapping Diagramm for class " + persClass.getNodeName()
+ + ".\n"+ e.getMessage());
+ }
+ }
+ }
+ //close all editors
+ }
+
+
+}
Property changes on: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagrammTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/ProjectUtil.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/ProjectUtil.java 2008-01-15 14:34:36 UTC (rev 5691)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/ProjectUtil.java 2008-01-15 14:35:56 UTC (rev 5692)
@@ -10,14 +10,20 @@
******************************************************************************/
package org.hibernate.eclipse.console.test.mappingproject;
+import java.lang.reflect.Field;
+
import org.apache.tools.ant.filters.StringInputStream;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.internal.ErrorEditorPart;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.wizards.ConsoleConfigurationCreationWizard;
import org.hibernate.mapping.PersistentClass;
@@ -34,7 +40,9 @@
.append("\"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd\">\n");
private static final StringBuilder XML_CFG_START = new StringBuilder("<hibernate-configuration>\n")
- .append("<session-factory>\n");
+ .append("<session-factory>\n")
+ .append("<property name=\"hibernate.dialect\">")
+ .append("org.hibernate.dialect.PostgreSQLDialect</property>");
private static final StringBuilder XML_CFG_END = new StringBuilder("</session-factory>\n")
.append("</hibernate-configuration>\n");
@@ -104,5 +112,42 @@
}
}
+ /**
+ * Sometimes we have exceptions while opening editors.
+ * IDE catches this exceptions and opens ErrorEditorPart instead of
+ * our editor. To be sure that editor opened without exception use this method.
+ * It gets occurred exception from the editor if it was and passes it up.
+ *
+ * @param editor
+ * @throws Throwable
+ */
+ public static void throwExceptionIfItOccured(IEditorPart editor) throws Throwable {
+ if (editor instanceof ErrorEditorPart){
+ Class<ErrorEditorPart> clazz = ErrorEditorPart.class;
+ Field field;
+ try {
+ field = clazz.getDeclaredField("error");
+
+ field.setAccessible(true);
+
+ Object error = field.get(editor);
+ if (error instanceof IStatus) {
+ IStatus err_status = (IStatus) error;
+ if (err_status.getSeverity() == Status.ERROR){
+ throw err_status.getException();
+ }
+ }
+ // catch close means that exception occurred but we can't get it
+ } catch (SecurityException e) {
+ throw new RuntimeException("Can't get exception from ErrorEditorPart. " + e.getMessage());
+ } catch (NoSuchFieldException e) {
+ throw new RuntimeException("Can't get error field from ErrorEditorPart. " + e.getMessage());
+ } catch (IllegalArgumentException e) {
+ throw new RuntimeException("Can't get error field from ErrorEditorPart. " + e.getMessage());
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException("Can't get error field from ErrorEditorPart. " + e.getMessage());
+ }
+ }
+ }
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java 2008-01-15 14:34:36 UTC (rev 5691)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java 2008-01-15 14:35:56 UTC (rev 5692)
@@ -33,13 +33,14 @@
}
- private static void addTestsPackSetUp(TestSuite suite){
+ private static void addTestsPackSetUp(TestSuite suite){
suite.addTestSuite( UpdateConfigurationTest.class );
}
private static void addPackTests(TestSuite suite){
suite.addTestSuite( OpenSourceFileTest.class );
suite.addTestSuite( OpenMappingFileTest.class );
+ suite.addTestSuite( OpenMappingDiagrammTest.class );
}
private static void addTestsPackTearDown(TestSuite suite){
16 years, 5 months
JBoss Tools SVN: r5691 - trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-01-15 09:34:36 -0500 (Tue, 15 Jan 2008)
New Revision: 5691
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1412
http://jira.jboss.com/jira/browse/JBIDE-1594
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2008-01-15 14:32:21 UTC (rev 5690)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2008-01-15 14:34:36 UTC (rev 5691)
@@ -12,6 +12,9 @@
import junit.framework.TestCase;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
@@ -26,7 +29,8 @@
*
*/
public class OpenMappingFileTest extends TestCase {
- public void testOpenMappingFileTest(){
+
+ public void testOpenMappingFileTest() throws Throwable{
KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
final ConsoleConfiguration consCFG = knownConfigurations.find(ProjectUtil.ConsoleCFGName);
assertNotNull(consCFG);
@@ -38,8 +42,10 @@
for (int i = 0; i < persClasses.length; i++) {
assertTrue(persClasses[0] instanceof PersistentClass);
PersistentClass persClass = (PersistentClass) persClasses[i];
- OpenMappingAction.run(persClass, consCFG);
- }
+ IEditorPart editor = OpenMappingAction.run(persClass, consCFG);
+ if (editor == null) fail("Editor not opened.");
+ ProjectUtil.throwExceptionIfItOccured(editor);
+ }
}
//close all editors
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java 2008-01-15 14:32:21 UTC (rev 5690)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java 2008-01-15 14:34:36 UTC (rev 5691)
@@ -10,6 +10,9 @@
******************************************************************************/
package org.hibernate.eclipse.console.test.mappingproject;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
@@ -28,7 +31,7 @@
*/
public class OpenSourceFileTest extends TestCase {
- public void testOpenSourceFileTest(){
+ public void testOpenSourceFileTest() throws Throwable{
//fail("test fail");
KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
final ConsoleConfiguration consCFG = knownConfigurations.find(ProjectUtil.ConsoleCFGName);
@@ -41,8 +44,10 @@
for (int i = 0; i < persClasses.length; i++) {
assertTrue(persClasses[0] instanceof PersistentClass);
PersistentClass persClass = (PersistentClass) persClasses[i];
- new OpenSourceAction().run(persClass, MappingTestProject.getTestProject().getIJavaProject(),
- ProjectUtil.getPersistentClassName(persClass));
+ IEditorPart editor = new OpenSourceAction().run(persClass, MappingTestProject.getTestProject().getIJavaProject(),
+ persClass.getClassName());
+ if (editor == null) fail("Editor not opened.");
+ ProjectUtil.throwExceptionIfItOccured(editor);
}
}
//close all editors
16 years, 5 months
JBoss Tools SVN: r5690 - in trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console: views and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-01-15 09:32:21 -0500 (Tue, 15 Jan 2008)
New Revision: 5690
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenSourceAction.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsView.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1412
Didn't work when entityName specified.
Conceal exceptions - impossible to test.
Add return editor to the open methods.
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java 2008-01-15 14:32:15 UTC (rev 5689)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java 2008-01-15 14:32:21 UTC (rev 5690)
@@ -1,9 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.hibernate.eclipse.console.actions;
+import java.io.FileNotFoundException;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.FindReplaceDocumentAdapter;
import org.eclipse.jface.text.IDocument;
@@ -47,11 +61,19 @@
if (sel instanceof TreeSelection){
TreePath path = ((TreeSelection)sel).getPaths()[0];
ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)(path.getSegment(0));
- run(path, consoleConfiguration);
+ try {
+ run(path, consoleConfiguration);
+ } catch (JavaModelException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't find mapping file.", e);
+ } catch (PartInitException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't open mapping file.", e);
+ } catch (FileNotFoundException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't find mapping file.", e);
+ }
}
}
- public static void run(TreePath path, ConsoleConfiguration consoleConfiguration) {
+ public static void run(TreePath path, ConsoleConfiguration consoleConfiguration) throws PartInitException, JavaModelException, FileNotFoundException {
boolean isPropertySel = (path.getLastSegment() instanceof Property);
if (isPropertySel){
Property propertySel = (Property)path.getLastSegment();
@@ -70,15 +92,19 @@
/**
* @param selection
* @param consoleConfiguration
+ * @throws JavaModelException
+ * @throws PartInitException
+ * @throws PresistanceClassNotFoundException
+ * @throws FileNotFoundException
*/
- public static void run(Object selection, ConsoleConfiguration consoleConfiguration) {
+ public static IEditorPart run(Object selection, ConsoleConfiguration consoleConfiguration) throws PartInitException, JavaModelException, FileNotFoundException {
IEditorPart editorPart = null;
IJavaProject proj = ProjectUtils.findJavaProject(consoleConfiguration);
java.io.File configXMLFile = consoleConfiguration.getPreferences().getConfigXMLFile();
IResource resource = null;
if (selection instanceof Property){
Property p = (Property)selection;
- if (p.getPersistentClass() == null) return;
+ if (p.getPersistentClass() == null) return null;
//use PersistentClass to open editor
resource = OpenFileActionUtils.getResource(consoleConfiguration, proj, configXMLFile, p.getPersistentClass());
//editorPart = openMapping(p.getPersistentClass(), consoleConfiguration);
@@ -91,7 +117,7 @@
if (editorPart != null){
applySelectionToEditor(selection, editorPart);
}
- return;
+ return editorPart;
}
//try to find hibernate-annotations
@@ -100,23 +126,31 @@
rootClass = (PersistentClass)selection;
} else if (selection instanceof Property) {
Property p = (Property)selection;
- if (p.getPersistentClass() == null) return;
+ if (p.getPersistentClass() == null) return null;
rootClass = (PersistentClass)p.getPersistentClass();
}
if (rootClass != null){
if (OpenFileActionUtils.rootClassHasAnnotations(consoleConfiguration, configXMLFile, rootClass)) {
- String fullyQualifiedName = OpenFileActionUtils.getPersistentClassName(rootClass);
- new OpenSourceAction().run(selection, proj, fullyQualifiedName);
+ String fullyQualifiedName = rootClass.getClassName();
+ editorPart = new OpenSourceAction().run(selection, proj, fullyQualifiedName);
+ return editorPart;
}
+ } else {
+ throw new FileNotFoundException("Mapping for " + selection + " not found.");
}
+ return null;
}
/**
* @param compositeProperty
* @param parentProperty
* @param consoleConfiguration
+ * @throws JavaModelException
+ * @throws PartInitException
+ * @throws FileNotFoundException
+ * @throws BadLocationException
*/
- public static void run(Property compositeProperty, Property parentProperty, ConsoleConfiguration consoleConfiguration) {
+ public static void run(Property compositeProperty, Property parentProperty, ConsoleConfiguration consoleConfiguration) throws PartInitException, JavaModelException, FileNotFoundException{
if (parentProperty.getPersistentClass() == null) return;
IJavaProject proj = ProjectUtils.findJavaProject(consoleConfiguration);
java.io.File configXMLFile = consoleConfiguration.getPreferences().getConfigXMLFile();
@@ -132,13 +166,16 @@
FindReplaceDocumentAdapter findAdapter = getFindDocAdapter(textEditor);
IRegion parentRegion = findSelection(parentProperty, findAdapter);
if (parentRegion == null) return;
+
+ IRegion propRegion = null;
try {
- IRegion propRegion = findAdapter.find(parentRegion.getOffset()+parentRegion.getLength(), generatePattern(compositeProperty), true, true, false, true);
- if (propRegion != null){
- textEditor.selectAndReveal(propRegion.getOffset(), propRegion.getLength());
- }
+ propRegion = findAdapter.find(parentRegion.getOffset()+parentRegion.getLength(), generatePattern(compositeProperty), true, true, false, true);
} catch (BadLocationException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Selection not found.", e);
}
+ if (propRegion != null){
+ textEditor.selectAndReveal(propRegion.getOffset(), propRegion.getLength());
+ }
}
return;
}
@@ -191,7 +228,7 @@
try {
return OpenFileActionUtils.openEditor(HibernateConsolePlugin.getDefault().getActiveWorkbenchWindow().getActivePage(), (IFile) resource);
} catch (PartInitException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Can't open mapping or source file.", e);
+
}
} else {
HibernateConsolePlugin.getDefault().log("Can't open mapping file " + resource);
@@ -224,7 +261,8 @@
if (classRegion == null) return null;
IRegion finalRegion = findAdapter.find(classRegion.getOffset()+classRegion.getLength(), "</class", true, true, false, false);
IRegion propRegion = findAdapter.find(classRegion.getOffset()+classRegion.getLength(), generatePattern(property), true, true, false, true);
- if (propRegion != null && finalRegion != null
+ if (propRegion == null) return null;
+ if (finalRegion != null
&& propRegion.getOffset() > finalRegion.getOffset()){
return null;
} else {
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenSourceAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenSourceAction.java 2008-01-15 14:32:15 UTC (rev 5689)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenSourceAction.java 2008-01-15 14:32:21 UTC (rev 5690)
@@ -1,5 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.hibernate.eclipse.console.actions;
+import java.io.FileNotFoundException;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.IJavaElement;
@@ -7,7 +19,6 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
@@ -20,8 +31,6 @@
import org.hibernate.mapping.Component;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
-import org.hibernate.mapping.RootClass;
-import org.hibernate.mapping.Subclass;
/**
* @author Dmitry Geraskov
@@ -44,7 +53,7 @@
ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)(path.getSegment(0));
IJavaProject proj = ProjectUtils.findJavaProject(consoleConfiguration);
- String fullyQualifiedName = OpenFileActionUtils.getPersistentClassName(persClass);
+ String fullyQualifiedName = persClass.getClassName();
if (fullyQualifiedName.length() == 0
&& lastSegment instanceof Property){
Object prevSegment = path.getParentPath().getLastSegment();
@@ -53,8 +62,15 @@
fullyQualifiedName =((Component)((Property) prevSegment).getValue()).getComponentClassName();
}
}
-
- run(lastSegment, proj, fullyQualifiedName);
+ try {
+ run(lastSegment, proj, fullyQualifiedName);
+ } catch (JavaModelException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't find source file.", e);
+ } catch (PartInitException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't open source file.", e);
+ } catch (FileNotFoundException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't find source file.", e);
+ }
}
}
@@ -62,22 +78,19 @@
* @param selection
* @param proj
* @param fullyQualifiedName
+ * @throws JavaModelException
+ * @throws PartInitException
+ * @throws FileNotFoundException
*/
- public void run(Object selection, IJavaProject proj,
- String fullyQualifiedName) {
+ public IEditorPart run(Object selection, IJavaProject proj,
+ String fullyQualifiedName) throws JavaModelException, PartInitException, FileNotFoundException {
IResource resource = null;
- IType type = null;
- try {
- type = proj.findType(fullyQualifiedName);
- if (type != null) resource = type.getResource();
+ IType type = proj.findType(fullyQualifiedName);
+ if (type != null) resource = type.getResource();
- } catch (JavaModelException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Can't find source file.", e);
- }
-
+ IEditorPart editorPart = null;
if (resource instanceof IFile){
- try {
- IEditorPart editorPart = OpenFileActionUtils.openEditor(HibernateConsolePlugin.getDefault().getActiveWorkbenchWindow().getActivePage(), (IFile) resource);
+ editorPart = OpenFileActionUtils.openEditor(HibernateConsolePlugin.getDefault().getActiveWorkbenchWindow().getActivePage(), (IFile) resource);
if (editorPart instanceof JavaEditor) {
IJavaElement jElement = null;
if (selection instanceof Property){
@@ -88,14 +101,13 @@
JavaEditor jEditor = (JavaEditor) editorPart;
selectionToEditor(jElement, jEditor);
}
- } catch (PartInitException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Can't open source file.", e);
}
+
+ if (editorPart == null) {
+ throw new FileNotFoundException("Source file for class '" + fullyQualifiedName + "' not found.");
}
+ return editorPart;
- if (resource == null) {
- MessageDialog.openInformation(HibernateConsolePlugin.getDefault().getShell(), "Open Source File", "Source file for class '" + fullyQualifiedName + "' not found.");
- }
}
private PersistentClass getPersistentClass(Object selection){
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsView.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsView.java 2008-01-15 14:32:15 UTC (rev 5689)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsView.java 2008-01-15 14:32:21 UTC (rev 5690)
@@ -47,13 +47,11 @@
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.node.BaseNode;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.actions.EditConsoleConfiguration;
import org.hibernate.eclipse.console.actions.OpenMappingAction;
import org.hibernate.eclipse.console.viewers.xpl.MTreeViewer;
import org.hibernate.eclipse.console.workbench.xpl.AnyAdaptableLabelProvider;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.RootClass;
-import org.hibernate.mapping.Subclass;
import org.hibernate.util.StringHelper;
@@ -163,7 +161,11 @@
} else if (selection instanceof TreeSelection){
TreePath path = ((TreeSelection)selection).getPaths()[0];
ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)(path.getSegment(0));
- OpenMappingAction.run(path, consoleConfiguration);
+ try {
+ OpenMappingAction.run(path, consoleConfiguration);
+ } catch (Exception e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't find mapping file.", e);
+ }
}
}
};
16 years, 5 months
JBoss Tools SVN: r5689 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-01-15 09:32:15 -0500 (Tue, 15 Jan 2008)
New Revision: 5689
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenMappingAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenSourceAction.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1412
Didn't work when entityName specified.
Conceal exceptions - impossible to test.
Add return editor to the open methods.
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenMappingAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenMappingAction.java 2008-01-15 14:19:02 UTC (rev 5688)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenMappingAction.java 2008-01-15 14:32:15 UTC (rev 5689)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.actions;
import java.util.Iterator;
@@ -4,10 +14,12 @@
import java.util.Set;
import org.eclipse.gef.ui.actions.SelectionAction;
-import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.mapping.PersistentClass;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.Property;
import org.jboss.tools.hibernate.ui.veditor.editors.VisualEditor;
import org.jboss.tools.hibernate.ui.veditor.editors.model.SpecialRootClass;
@@ -42,14 +54,21 @@
&& ((Property)selection).getPersistentClass() instanceof SpecialRootClass){
Property compositSel = ((Property)selection);
Property parentProperty = ((SpecialRootClass)((Property)selection).getPersistentClass()).getProperty();
- org.hibernate.eclipse.console.actions.OpenMappingAction.run(compositSel, parentProperty, consoleConfiguration);
+ try {
+ org.hibernate.eclipse.console.actions.OpenMappingAction.run(compositSel, parentProperty, consoleConfiguration);
+ } catch (Exception e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't find or open mapping file.", e);
+ }
continue;
}
if (selection instanceof SpecialRootClass) {
selection = ((SpecialRootClass)selection).getProperty();
}
- org.hibernate.eclipse.console.actions.OpenMappingAction.run(selection, consoleConfiguration);
-
+ try {
+ org.hibernate.eclipse.console.actions.OpenMappingAction.run(selection, consoleConfiguration);
+ } catch (Exception e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't find or open mapping file.", e);
+ }
/*IResource resource = null;
Object selectedElement = selection;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenSourceAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenSourceAction.java 2008-01-15 14:19:02 UTC (rev 5688)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenSourceAction.java 2008-01-15 14:32:15 UTC (rev 5689)
@@ -1,13 +1,17 @@
package org.jboss.tools.hibernate.ui.veditor.editors.actions;
+import java.io.FileNotFoundException;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.resources.IResource;
import org.eclipse.gef.ui.actions.SelectionAction;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.jboss.tools.hibernate.ui.veditor.editors.VisualEditor;
@@ -47,11 +51,19 @@
} else continue;
IResource resource = null;
- String fullyQualifiedName = HibernateUtils.getPersistentClassName(rootClass);
- if (fullyQualifiedName.indexOf("$") > 0) {
+ String fullyQualifiedName = rootClass.getClassName();//HibernateUtils.getPersistentClassName(rootClass);
+ /*if (fullyQualifiedName.indexOf("$") > 0) {
fullyQualifiedName = fullyQualifiedName.substring(0, fullyQualifiedName.indexOf("$"));
+ }*/
+ try {
+ new org.hibernate.eclipse.console.actions.OpenSourceAction().run(selection, proj, fullyQualifiedName);
+ } catch (PartInitException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't open source file.", e);
+ } catch (JavaModelException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't find source file.", e);
+ } catch (FileNotFoundException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't find source file.", e);
}
- new org.hibernate.eclipse.console.actions.OpenSourceAction().run(selection, proj, fullyQualifiedName);
}
}
16 years, 5 months
JBoss Tools SVN: r5688 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-01-15 09:19:02 -0500 (Tue, 15 Jan 2008)
New Revision: 5688
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/orderingList.xhtml
Log:
JUnit test for the rich faces orderingList template
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/orderingList.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/orderingList.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
16 years, 5 months
JBoss Tools SVN: r5687 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test: jbide and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-01-15 09:18:49 -0500 (Tue, 15 Jan 2008)
New Revision: 5687
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java
Log:
JUnit test for the rich faces orderingList template
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java 2008-01-15 14:18:09 UTC (rev 5686)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java 2008-01-15 14:18:49 UTC (rev 5687)
@@ -15,6 +15,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.jboss.tools.jsf.vpe.richfaces.test.jbide.JBIDE1579Test;
import org.jboss.tools.vpe.ui.test.VpeTestSetup;
import org.jboss.tools.vpe.ui.test.beans.ImportBean;
@@ -33,6 +34,7 @@
// $JUnit-BEGIN$
suite.addTestSuite(RichFacesComponentTest.class);
+ suite.addTestSuite(JBIDE1579Test.class);
// $JUnit-END$
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java 2008-01-15 14:18:09 UTC (rev 5686)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java 2008-01-15 14:18:49 UTC (rev 5687)
@@ -138,6 +138,11 @@
"components/modalPanel.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$
}
+ public void testOrderingList() throws PartInitException, Throwable {
+ performTestForVpeComponent((IFile) TestUtil.getComponentPath(
+ "components/orderingList.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$
+ }
+
public void testPaint2D() throws PartInitException, Throwable {
performTestForVpeComponent((IFile) TestUtil.getComponentPath(
"components/paint2D.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java 2008-01-15 14:18:49 UTC (rev 5687)
@@ -0,0 +1,104 @@
+package org.jboss.tools.jsf.vpe.richfaces.test.jbide;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+
+public class JBIDE1579Test extends VpeTest {
+
+ public static final String IMPORT_PROJECT_NAME = "richFacesTest";
+
+ private static final String TEST_PAGE_NAME_2BUTTONS = "JBIDE/1579/JBIDE-1579-2buttons.xhtml";
+ private static final String TEST_PAGE_NAME_4BUTTONS = "JBIDE/1579/JBIDE-1579-4buttons.xhtml";
+
+ public JBIDE1579Test(String name) {
+ super(name);
+ }
+
+ public void testJBIDE_1579_2buttons() throws Throwable{
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(
+ TEST_PAGE_NAME_2BUTTONS, IMPORT_PROJECT_NAME);
+
+ assertNotNull("Could not open specified file " + file.getFullPath(),
+ file);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ assertNotNull("Editor input is null", input);
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ // get dom document
+ nsIDOMDocument document = getVpeVisualDocument(part);
+ nsIDOMElement element = document.getDocumentElement();
+
+ //check that element is not null
+ assertNotNull(element);
+
+ // get root node
+ nsIDOMNode node = (nsIDOMNode) element
+ .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+
+ List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
+
+ // find "img" elements
+ TestUtil.findElementsByName(node, elements, HTML.TAG_IMG);
+ assertEquals(2, elements.size());
+
+ }
+
+ public void testJBIDE_1579_4buttons() throws Throwable{
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(
+ TEST_PAGE_NAME_4BUTTONS, IMPORT_PROJECT_NAME);
+
+ assertNotNull("Could not open specified file " + file.getFullPath(),
+ file);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ assertNotNull("Editor input is null", input);
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ // get dom document
+ nsIDOMDocument document = getVpeVisualDocument(part);
+ nsIDOMElement element = document.getDocumentElement();
+
+ //check that element is not null
+ assertNotNull(element);
+
+ // get root node
+ nsIDOMNode node = (nsIDOMNode) element
+ .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+
+ List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
+
+ // find "img" elements
+ TestUtil.findElementsByName(node, elements, HTML.TAG_IMG);
+ assertEquals(4, elements.size());
+
+ }
+
+}
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
16 years, 5 months
JBoss Tools SVN: r5686 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages: JBIDE and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-01-15 09:18:09 -0500 (Tue, 15 Jan 2008)
New Revision: 5686
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-2buttons.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-4buttons.xhtml
Log:
JUnit test for the rich faces orderingList template
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-2buttons.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-2buttons.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-4buttons.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-4buttons.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
16 years, 5 months
JBoss Tools SVN: r5685 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: src/org/jboss/tools/jsf/vpe/richfaces/template and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-01-15 09:02:23 -0500 (Tue, 15 Jan 2008)
New Revision: 5685
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/contextMenu/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesContextMenuTemplate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1581
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesContextMenuTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesContextMenuTemplate.java 2008-01-15 14:00:34 UTC (rev 5684)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesContextMenuTemplate.java 2008-01-15 14:02:23 UTC (rev 5685)
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.vpe.richfaces.template;
-
-import java.util.List;
-
-import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.RichFacesTemplatesActivator;
-import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
-import org.jboss.tools.vpe.editor.template.VpeCreationData;
-import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMText;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * Template for Rich Faces contextMenu
- *
- * @author dsakovich(a)exadel.com
- */
-public class RichFacesContextMenuTemplate extends VpeAbstractTemplate {
-
- private final static String STYLE_PATH = "contextMenu/contextMenu.css";
- private final static String IMAGE_PATH = "contextMenu/spacer.gif";
- private final static String BACKGROUND_PATH = "contextMenu/background.gif";
- private final static String MENU_ITEM_NODE_NAME = "menuItem";
- private final static String VALUE = "value";
- private final static String DIV_STYLE = "border : 1px solid #C4C0B9; ";
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
-
- ComponentUtil.setCSSLink(pageContext, STYLE_PATH,
- "richFacesContextMenu");
- Element sourceElement = (Element) sourceNode;
-
- nsIDOMElement table = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
-
- table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- "dr-menu-list-bg rich-menu-list-bg dr-menu-list-border");
-
- String path = RichFacesTemplatesActivator.getPluginResourcePath()
- + BACKGROUND_PATH;
-
- table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
- "background-image: url(file://" + path + "); " + DIV_STYLE);
-
- List<Node> listItems = ComponentUtil.getChildren(sourceElement, false);
-
- for (Node node : listItems) {
- nsIDOMElement element = createMenuItem(visualDocument, node);
- if (element != null)
- table.appendChild(element);
- }
-
- VpeCreationData creationData = new VpeCreationData(table);
-
- return creationData;
-
- }
-
- /**
- * Create menu item
- *
- * @param document
- * @param sourceNode
- * @return
- */
- private nsIDOMElement createMenuItem(nsIDOMDocument document,
- Node sourceNode) {
-
- Element sourceElement = (Element) sourceNode;
-
- String nodeName = sourceElement.getPrefix() + ":" + MENU_ITEM_NODE_NAME;
- if (!sourceElement.getNodeName().equalsIgnoreCase(nodeName)) {
- return null;
- }
- String value = sourceElement.getAttribute(VALUE);
- nsIDOMElement div = document
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
- div
- .setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- "dr-menu-item rich-menu-item dr-menu-item-enabled rich-menu-item-enabled");
-
- nsIDOMElement span = document
- .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
- span.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- "dr-menu-icon rich-menu-item-icon");
-
- nsIDOMElement img = document
- .createElement(HtmlComponentUtil.HTML_TAG_IMG);
- img.setAttribute(HtmlComponentUtil.HTML_ATR_WIDTH, "16");
- img.setAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT, "16");
- ComponentUtil.setImg(img, IMAGE_PATH);
-
- nsIDOMElement textSpan = document
- .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
- textSpan.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- "rich-menu-item-label");
-
- nsIDOMText text = document.createTextNode((value == null) ? "" : value);
-
- textSpan.appendChild(text);
- span.appendChild(img);
- div.appendChild(span);
- div.appendChild(textSpan);
-
- return div;
- }
-}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-01-15 14:00:34 UTC (rev 5684)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-01-15 14:02:23 UTC (rev 5685)
@@ -565,8 +565,8 @@
</vpe:tag>
<vpe:tag name="rich:contextMenu" case-sensitive="yes">
- <vpe:template children="no" modify="no"
- class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesContextMenuTemplate">
+ <vpe:template children="no" modify="no">
+ <span style="display:none"></span>
</vpe:template>
</vpe:tag>
16 years, 5 months