JBoss Tools SVN: r4762 - trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-11-07 18:40:32 -0500 (Wed, 07 Nov 2007)
New Revision: 4762
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java
Log:
JBIDE-975
separate filesets for each applicable folder.
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java 2007-11-07 23:40:27 UTC (rev 4761)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java 2007-11-07 23:40:32 UTC (rev 4762)
@@ -97,12 +97,16 @@
private String getPackageFileSetText (IArchiveFileSet fileset) {
boolean showFullPath = PrefsInitializer.getBoolean(
PrefsInitializer.PREF_SHOW_FULL_FILESET_ROOT_DIR);
+ boolean inWorkspace = fileset.isInWorkspace();
+
String text = "";
if (fileset.getIncludesPattern() != null)
text += fileset.getIncludesPattern() + ": ";
if (showFullPath) {
text += fileset.getGlobalSourcePath().toString();
+ } else if( inWorkspace ){
+ text += fileset.getSourcePath().toString();
} else {
text += fileset.getGlobalSourcePath().lastSegment();
}
18 years, 5 months
JBoss Tools SVN: r4761 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/archives.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-11-07 18:40:27 -0500 (Wed, 07 Nov 2007)
New Revision: 4761
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/archives/WarArchiveType.java
Log:
JBIDE-975
separate filesets for each applicable folder.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/archives/WarArchiveType.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/archives/WarArchiveType.java 2007-11-07 18:10:45 UTC (rev 4760)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/archives/WarArchiveType.java 2007-11-07 23:40:27 UTC (rev 4761)
@@ -21,6 +21,8 @@
*/
package org.jboss.ide.eclipse.as.core.extensions.archives;
+import java.util.ArrayList;
+
import org.apache.tools.ant.DirectoryScanner;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -158,13 +160,23 @@
IPath path = new Path(files[0]);
path = path.removeLastSegments(1).append("lib");
sourcePath = project.getFullPath().append(path).toString();
- }
-
- if(sourcePath == null) {
+ addFileset(project, folder, sourcePath, "*.jar"); // add default jars
+ } else {
//having failed to find 'lib' directory, let us make source of the project itself
sourcePath = project.getName();
+ DirectoryScanner scanner2 =
+ DirectoryScannerFactory.createDirectoryScanner(projectPath, "**/*.jar", null, true);
+ String[] files2 = scanner2.getIncludedFiles();
+ IPath p;
+ ArrayList list = new ArrayList();
+ for( int i = 0; i < files2.length; i++ ) {
+ p = project.getFullPath().append(files2[i]).removeLastSegments(1);
+ if( !list.contains(p)) {
+ list.add(p);
+ addFileset(project, folder, p.toString(), "*.jar"); // add default jars
+ }
+ }
}
- addFileset(project, folder, sourcePath, "**/*.jar"); // add default jars
}
protected void addReferencedProjectsAsLibs(IProject project, IArchiveFolder folder) {
IJavaProject jp = JavaCore.create(project);
18 years, 5 months
JBoss Tools SVN: r4760 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-11-07 13:10:45 -0500 (Wed, 07 Nov 2007)
New Revision: 4760
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
Log:
JBIDE-1264 NPE when creating server runtime
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2007-11-07 17:12:45 UTC (rev 4759)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2007-11-07 18:10:45 UTC (rev 4760)
@@ -345,6 +345,10 @@
// WST API methods
public void enter() {
+ if(homeValLabel==null) {
+ return;
+ }
+
IRuntime r = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
IRuntimeWorkingCopy wc;
if( r instanceof IRuntimeWorkingCopy )
18 years, 5 months
JBoss Tools SVN: r4759 - in trunk/hibernatetools/plugins: org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-11-07 12:12:45 -0500 (Wed, 07 Nov 2007)
New Revision: 4759
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/HTConstants.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenActionDelegate.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenFileActionUtils.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingActionDelegate.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenSourceActionDelegate.java
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HTConstants.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenFileActionUtils.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenMappingActionDelegate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenSourceActionDelegate.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsView.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/META-INF/MANIFEST.MF
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
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml
Log:
JBIDE-1275 Double click on entity in conosle tree should open mapping
+ moved the open src/mapping into hibernate console since they are not dependent on the diagram.
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml 2007-11-07 15:17:26 UTC (rev 4758)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml 2007-11-07 17:12:45 UTC (rev 4759)
@@ -133,6 +133,26 @@
</page>
</extension>
+
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution id="mappingEditorAction" objectClass="org.hibernate.mapping.RootClass">
+ <menu id="org.hibernate.eclipse.console.actions.openMappingMenu" label="Open Mapping File" path="mappingEditorAction"/>
+ <action
+ id="org.hibernate.eclipse.console.actions.openMappingAction"
+ label="Open Mapping File"
+ class="org.hibernate.eclipse.console.actions.OpenMappingActionDelegate">
+ </action>
+ </objectContribution>
+ <objectContribution id="sourceEditorAction" objectClass="org.hibernate.mapping.RootClass">
+ <menu id="org.hibernate.eclipse.console.actions.openSourceMenu" label="Open Source File" path="sourceEditorAction"/>
+ <action
+ id="org.hibernate.eclipse.console.actions.openSourceAction"
+ label="Open Source File"
+ class="org.hibernate.eclipse.console.actions.OpenSourceActionDelegate">
+ </action>
+ </objectContribution>
+ </extension>
+
<extension
id="hibernateNature"
name="Hibernate Nature"
Copied: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/HTConstants.java (from rev 4752, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HTConstants.java)
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/HTConstants.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/HTConstants.java 2007-11-07 17:12:45 UTC (rev 4759)
@@ -0,0 +1,5 @@
+package org.hibernate.eclipse.console.actions;
+
+public interface HTConstants {
+
+}
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenActionDelegate.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenActionDelegate.java 2007-11-07 17:12:45 UTC (rev 4759)
@@ -0,0 +1,21 @@
+package org.hibernate.eclipse.console.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+public abstract class OpenActionDelegate implements IObjectActionDelegate {
+ private IWorkbenchPart part;
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ this.part = targetPart;
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ public IWorkbenchPart getPart() {
+ return part;
+ }
+}
\ No newline at end of file
Copied: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenFileActionUtils.java (from rev 4752, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenFileActionUtils.java)
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenFileActionUtils.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenFileActionUtils.java 2007-11-07 17:12:45 UTC (rev 4759)
@@ -0,0 +1,282 @@
+package org.hibernate.eclipse.console.actions;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.VisitorSupport;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.ide.IDE;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.RootClass;
+import org.hibernate.mapping.Subclass;
+import org.hibernate.mapping.Table;
+import org.hibernate.util.StringHelper;
+import org.hibernate.util.XMLHelper;
+import org.xml.sax.InputSource;
+
+public class OpenFileActionUtils {
+ private static XMLHelper helper = new XMLHelper();
+
+ private static final String HIBERNATE_TAG_CLASS = "class";
+ private static final String HIBERNATE_TAG_TABLE = "table";
+ private static final String HIBERNATE_TAG_SUBCLASS = "subclass";
+ private static final String HIBERNATE_TAG_JOINED_SUBCLASS = "joined-subclass";
+ private static final String HIBERNATE_TAG_UNION_SUBCLASS = "union-subclass";
+ private static final String HIBERNATE_TAG_NAME = "name";
+ private static final String HIBERNATE_TAG_ENTITY_NAME = "entity-name";
+ private static final String HIBERNATE_TAG_SESSION_FACTORY = "session-factory";
+ private static final String HIBERNATE_TAG_MAPPING = "mapping";
+ private static final String HIBERNATE_TAG_RESOURCE = "resource";
+ private static final String HIBERNATE_TAG_CATALOG = "catalog";
+ private static final String HIBERNATE_TAG_SCHEMA = "schema";
+
+ public static void openEditor(IWorkbenchPage page, IResource resource) throws PartInitException {
+ IDE.openEditor(page, (IFile) resource);
+ }
+
+
+ public static boolean rootClassHasAnnotations(ConsoleConfiguration consoleConfiguration, java.io.File configXMLFile, RootClass rootClass) {
+ if (configXMLFile == null) return true;
+ Document doc = getDocument(consoleConfiguration, configXMLFile);
+ return getElements(doc, HIBERNATE_TAG_MAPPING, HIBERNATE_TAG_CLASS, getPersistentClassName(rootClass)).hasNext();
+ }
+
+ static String getPersistentClassName(PersistentClass rootClass) {
+ if (rootClass == null) {
+ return "";
+ } else {
+ return rootClass.getEntityName() != null ? rootClass.getEntityName() : rootClass.getClassName();
+ }
+ }
+
+ private static String getTableName(String catalog, String schema, String name) {
+ return (catalog != null ? catalog + "." : "") + (schema != null ? schema + "." : "") + name;
+ }
+
+ private static String getTableName(Table table) {
+ return getTableName(table.getCatalog(), table.getSchema(), table.getName());
+ }
+
+
+ private static boolean elementInResource(ConsoleConfiguration consoleConfiguration, IResource resource, Object element) {
+ if (element instanceof RootClass) {
+ return rootClassInResource(consoleConfiguration, resource, (RootClass)element);
+ } else if (element instanceof Subclass) {
+ return subclassInResource(consoleConfiguration, resource, (Subclass)element);
+ } else if (element instanceof Table) {
+ return tableInResource(consoleConfiguration, resource, (Table)element);
+ } else {
+ return false;
+ }
+ }
+
+ private static boolean rootClassInResource(ConsoleConfiguration consoleConfiguration, IResource resource, RootClass persistentClass) {
+ Document doc = getDocument(consoleConfiguration, resource.getLocation().toFile());
+ return getElements(doc, OpenFileActionUtils.HIBERNATE_TAG_CLASS, HIBERNATE_TAG_NAME, StringHelper.unqualify(getPersistentClassName(persistentClass))).hasNext() ||
+ getElements(doc, OpenFileActionUtils.HIBERNATE_TAG_CLASS, HIBERNATE_TAG_NAME, getPersistentClassName(persistentClass)).hasNext() ||
+ getElements(doc, OpenFileActionUtils.HIBERNATE_TAG_CLASS, StringHelper.unqualify(getPersistentClassName(persistentClass))).hasNext() ||
+ getElements(doc, OpenFileActionUtils.HIBERNATE_TAG_CLASS, getPersistentClassName(persistentClass)).hasNext() ||
+ getElements(doc, OpenFileActionUtils.HIBERNATE_TAG_CLASS, HIBERNATE_TAG_ENTITY_NAME, StringHelper.unqualify(getPersistentClassName(persistentClass))).hasNext() ||
+ getElements(doc, OpenFileActionUtils.HIBERNATE_TAG_CLASS, HIBERNATE_TAG_ENTITY_NAME, getPersistentClassName(persistentClass)).hasNext();
+ }
+
+ private static boolean subclassInResource(ConsoleConfiguration consoleConfiguration, IResource resource, Subclass persistentClass) {
+ Document doc = getDocument(consoleConfiguration, resource.getLocation().toFile());
+ return getElements(doc, HIBERNATE_TAG_SUBCLASS, HIBERNATE_TAG_NAME, StringHelper.unqualify(getPersistentClassName(persistentClass))).hasNext() ||
+ getElements(doc, HIBERNATE_TAG_SUBCLASS, HIBERNATE_TAG_NAME, getPersistentClassName(persistentClass)).hasNext() ||
+ getElements(doc, HIBERNATE_TAG_SUBCLASS, HIBERNATE_TAG_ENTITY_NAME, StringHelper.unqualify(getPersistentClassName(persistentClass))).hasNext() ||
+ getElements(doc, HIBERNATE_TAG_SUBCLASS, HIBERNATE_TAG_ENTITY_NAME, getPersistentClassName(persistentClass)).hasNext() ||
+
+ getElements(doc, HIBERNATE_TAG_JOINED_SUBCLASS, HIBERNATE_TAG_NAME, StringHelper.unqualify(getPersistentClassName(persistentClass))).hasNext() ||
+ getElements(doc, HIBERNATE_TAG_JOINED_SUBCLASS, HIBERNATE_TAG_NAME, getPersistentClassName(persistentClass)).hasNext() ||
+ getElements(doc, HIBERNATE_TAG_JOINED_SUBCLASS, HIBERNATE_TAG_ENTITY_NAME, StringHelper.unqualify(getPersistentClassName(persistentClass))).hasNext() ||
+ getElements(doc, HIBERNATE_TAG_JOINED_SUBCLASS, HIBERNATE_TAG_ENTITY_NAME, getPersistentClassName(persistentClass)).hasNext() ||
+
+ getElements(doc, HIBERNATE_TAG_UNION_SUBCLASS, HIBERNATE_TAG_NAME, StringHelper.unqualify(getPersistentClassName(persistentClass))).hasNext() ||
+ getElements(doc, HIBERNATE_TAG_UNION_SUBCLASS, HIBERNATE_TAG_NAME, getPersistentClassName(persistentClass)).hasNext() ||
+ getElements(doc, HIBERNATE_TAG_UNION_SUBCLASS, HIBERNATE_TAG_ENTITY_NAME, StringHelper.unqualify(getPersistentClassName(persistentClass))).hasNext() ||
+ getElements(doc, HIBERNATE_TAG_UNION_SUBCLASS, HIBERNATE_TAG_ENTITY_NAME, getPersistentClassName(persistentClass)).hasNext();
+ }
+
+ private static boolean tableInResource(ConsoleConfiguration consoleConfiguration, IResource resource, Table table) {
+ Document doc = getDocument(consoleConfiguration, resource.getLocation().toFile());
+
+ Iterator classes = getElements(doc, OpenFileActionUtils.HIBERNATE_TAG_CLASS);
+ while (classes.hasNext()) {
+ Element element = (Element) classes.next();
+
+ Attribute tableAttr = element.attribute( HIBERNATE_TAG_TABLE );
+ if (tableAttr != null) {
+ Attribute catalogAttr = element.attribute( HIBERNATE_TAG_CATALOG );
+ if (catalogAttr == null) catalogAttr = doc.getRootElement().attribute(HIBERNATE_TAG_CATALOG);
+ Attribute schemaAttr = element.attribute( HIBERNATE_TAG_SCHEMA );
+ if (schemaAttr == null) schemaAttr = doc.getRootElement().attribute(HIBERNATE_TAG_SCHEMA);
+ if (
+ getTableName(
+ (catalogAttr != null ? catalogAttr.getValue() : null),
+ (schemaAttr != null ? schemaAttr.getValue() : null),
+ tableAttr.getValue()
+ ).equals(getTableName(table))
+ ) {
+ return true;
+ }
+
+
+ }
+
+ Attribute classNameAttr = element.attribute( HIBERNATE_TAG_NAME );
+ if (classNameAttr == null) classNameAttr = element.attribute( HIBERNATE_TAG_ENTITY_NAME);
+ if (classNameAttr != null) {
+ String physicalTableName = consoleConfiguration.getConfiguration().getNamingStrategy().classToTableName(classNameAttr.getValue());
+ if (table.getName().equals(physicalTableName)) {
+ return true;
+ }
+ }
+ }
+
+ if (getElements(doc, HIBERNATE_TAG_TABLE, table.getName()).hasNext()) {
+ return true;
+ }
+
+ return false;
+ }
+
+ private static Iterator getElements(Document doc, String elementName) {
+ return getElements(doc, elementName, null, null);
+ }
+
+ private static Iterator getElements(Document doc, String attrName, String attrValue) {
+ return getElements(doc, null, attrName, attrValue);
+ }
+
+ private static Iterator getElements(Document doc, String elementName, String attrName, String attrValue) {
+ LVS visitor = new LVS(elementName, attrName, attrValue);
+ doc.accept( visitor );
+ return visitor.iterator();
+ }
+
+ static class LVS extends VisitorSupport {
+ private String nodeName;
+ private String attrName;
+ private String attrValue;
+ private List ret = new ArrayList();
+
+ public LVS(String nodeName, String attrName, String attrValue) {
+ super();
+ this.nodeName = nodeName;
+ this.attrName = attrName;
+ this.attrValue = attrValue;
+ }
+
+ public void visit(Element element) {
+ if (nodeName == null) {
+ if (attrName != null && attrValue != null) {
+ if (attrIsCorrect(element, attrName, attrValue)) {
+ ret.add(element);
+ }
+ }
+ } else {
+ if (nodeName.equals(element.getName())) {
+ if (attrName != null) {
+ if (attrIsCorrect(element, attrName, attrValue)) {
+ ret.add(element);
+ }
+ } else {
+ ret.add(element);
+ }
+ }
+ }
+
+ }
+
+ public Iterator iterator() {
+ return ret.iterator();
+ }
+ }
+
+ private static boolean attrIsCorrect(Element element, String attrName, String attrValue) {
+ Attribute attr = element.attribute(attrName);
+ if (attr != null && attrValue.equals(attr.getValue())) {
+ return attrValue.equals(attr.getValue());
+ }
+ return false;
+ }
+
+ public static Document getDocument(ConsoleConfiguration consoleConfiguration, java.io.File configXMLFile) {
+ Document doc = null;
+ if (consoleConfiguration != null && configXMLFile != null) {
+ InputStream stream = null;
+ try {
+ stream = new FileInputStream( configXMLFile );
+ } catch (FileNotFoundException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Configuration file not found", e);
+ }
+ try {
+ List errors = new ArrayList();
+ doc = helper.createSAXReader( configXMLFile.getPath(), errors, consoleConfiguration.getConfiguration().getEntityResolver() )
+ .read( new InputSource( stream ) );
+ if ( errors.size() != 0 ) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("invalid configuration", (Throwable)null);
+ }
+ }
+ catch (DocumentException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Could not parse configuration", e);
+ }
+ finally {
+ try {
+ stream.close();
+ }
+ catch (IOException ioe) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("could not close input stream for", ioe);
+ }
+ }
+ }
+ return doc;
+ }
+
+ public static IResource getResource(ConsoleConfiguration consoleConfiguration, IJavaProject proj, java.io.File configXMLFile, Object element) {
+ Document doc = getDocument(consoleConfiguration, configXMLFile);
+ IResource resource = null;
+ if (consoleConfiguration != null && proj != null && doc != null) {
+ Element sfNode = doc.getRootElement().element( HIBERNATE_TAG_SESSION_FACTORY );
+ Iterator elements = sfNode.elements(HIBERNATE_TAG_MAPPING).iterator();
+ while ( elements.hasNext() ) {
+ Element subelement = (Element) elements.next();
+ Attribute file = subelement.attribute( HIBERNATE_TAG_RESOURCE );
+ if (file != null) {
+ resource = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(configXMLFile.getParent()).append(file.getValue()));
+ if (elementInResource(consoleConfiguration, resource, element)) return resource;
+ }
+ }
+
+ java.io.File[] files = consoleConfiguration.getPreferences().getMappingFiles();
+ for (int i = 0; i < files.length; i++) {
+ java.io.File file = files[i];
+ if (file != null) {
+ resource = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(file.getPath()));
+ if (OpenFileActionUtils.elementInResource(consoleConfiguration, resource, element)) return resource;
+ }
+ }
+ }
+ return null;
+ }
+
+
+}
Copied: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingActionDelegate.java (from rev 4752, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenMappingActionDelegate.java)
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingActionDelegate.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingActionDelegate.java 2007-11-07 17:12:45 UTC (rev 4759)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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 org.dom4j.Document;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.internal.ObjectPluginAction;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.eclipse.console.utils.ProjectUtils;
+import org.hibernate.mapping.RootClass;
+import org.hibernate.util.XMLHelper;
+
+public class OpenMappingActionDelegate extends OpenActionDelegate {
+ private static XMLHelper helper = new XMLHelper();
+
+ public void run(IAction action) {
+ ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
+ TreeSelection selection = (TreeSelection)objectPluginAction.getSelection();
+ RootClass rootClass = (RootClass)(selection).getFirstElement();
+ ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)((selection).getPaths()[0]).getSegment(0);
+ openMapping(rootClass, consoleConfiguration);
+ }
+
+ static public void openMapping(RootClass rootClass,
+ ConsoleConfiguration consoleConfiguration) {
+ IJavaProject proj = ProjectUtils.findJavaProject(consoleConfiguration);
+ java.io.File configXMLFile = consoleConfiguration.getPreferences().getConfigXMLFile();
+ Document doc = OpenFileActionUtils.getDocument(consoleConfiguration, configXMLFile);
+// IResource resource = OpenFileActionUtils.getResource(consoleConfiguration, proj, doc, configXMLFile, rootClass);
+ IResource resource = OpenFileActionUtils.getResource(consoleConfiguration, proj, configXMLFile, rootClass);
+
+ if (resource == null) {
+ String fullyQualifiedName = OpenFileActionUtils.getPersistentClassName(rootClass);
+ try {
+ resource = proj.findType(fullyQualifiedName).getResource();
+ } catch (JavaModelException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't find mapping file.", e);
+ }
+ }
+
+ if (resource != null && resource instanceof IFile){
+ try {
+ OpenFileActionUtils.openEditor(HibernateConsolePlugin.getDefault().getActiveWorkbenchWindow().getActivePage(), (IFile) resource);
+ } catch (PartInitException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't open mapping or source file.", e);
+ }
+ }
+ }
+}
\ No newline at end of file
Copied: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenSourceActionDelegate.java (from rev 4752, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenSourceActionDelegate.java)
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenSourceActionDelegate.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenSourceActionDelegate.java 2007-11-07 17:12:45 UTC (rev 4759)
@@ -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.actions;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.internal.ObjectPluginAction;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.eclipse.console.utils.ProjectUtils;
+import org.hibernate.mapping.RootClass;
+
+public class OpenSourceActionDelegate extends OpenActionDelegate {
+
+ public void run(IAction action) {
+ ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
+ RootClass rootClass = (RootClass)((TreeSelection)objectPluginAction.getSelection()).getFirstElement();
+ ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)(((TreeSelection)objectPluginAction.getSelection()).getPaths()[0]).getSegment(0);
+ IJavaProject proj = ProjectUtils.findJavaProject(consoleConfiguration);
+
+ IResource resource = null;
+ String fullyQualifiedName = OpenFileActionUtils.getPersistentClassName(rootClass);
+ try {
+ IType type = proj.findType(fullyQualifiedName);
+ if (type != null) resource = type.getResource();
+ } catch (JavaModelException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't find source file.", e);
+ }
+
+ if (resource instanceof IFile){
+ try {
+ OpenFileActionUtils.openEditor(HibernateConsolePlugin.getDefault().getActiveWorkbenchWindow().getActivePage(), (IFile) resource);
+ } catch (PartInitException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't open source file.", e);
+ }
+ }
+ if (resource == null) {
+ MessageDialog.openInformation(HibernateConsolePlugin.getDefault().getShell(), "Open Source File", "Source file for class '" + fullyQualifiedName + "' not found.");
+ }
+ }
+}
\ No newline at end of file
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 2007-11-07 15:17:26 UTC (rev 4758)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsView.java 2007-11-07 17:12:45 UTC (rev 4759)
@@ -31,6 +31,7 @@
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
@@ -39,6 +40,7 @@
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.actions.ActionGroup;
+import org.eclipse.ui.internal.ObjectPluginAction;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.PropertySheetPage;
@@ -46,7 +48,10 @@
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.node.BaseNode;
import org.hibernate.eclipse.console.actions.EditConsoleConfiguration;
+import org.hibernate.eclipse.console.actions.OpenMappingActionDelegate;
import org.hibernate.eclipse.console.workbench.xpl.AnyAdaptableLabelProvider;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.RootClass;
import org.hibernate.util.StringHelper;
@@ -152,6 +157,9 @@
consoleConfiguration.executeHQLQuery( hql );
}
}
+ } else if (firstElement instanceof RootClass) {
+ ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)((TreeSelection)selection).getPaths()[0].getSegment(0);
+ OpenMappingActionDelegate.openMapping((RootClass) firstElement, consoleConfiguration);
}
}
};
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/META-INF/MANIFEST.MF 2007-11-07 15:17:26 UTC (rev 4758)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/META-INF/MANIFEST.MF 2007-11-07 17:12:45 UTC (rev 4759)
@@ -15,7 +15,8 @@
org.eclipse.core.resources,
org.hibernate.eclipse,
org.eclipse.jdt.core,
- org.jboss.tools.hibernate.ui.view
+ org.jboss.tools.hibernate.ui.view,
+ org.hibernate.eclipse.console
Bundle-Version: 2.0.0
Export-Package: org.jboss.tools.hibernate.ui.veditor,
org.jboss.tools.hibernate.ui.veditor.editors,
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 2007-11-07 15:17:26 UTC (rev 4758)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenMappingAction.java 2007-11-07 17:12:45 UTC (rev 4759)
@@ -3,7 +3,6 @@
import java.util.Iterator;
import java.util.Set;
-import org.dom4j.Document;
import org.eclipse.core.resources.IResource;
import org.eclipse.gef.ui.actions.SelectionAction;
import org.eclipse.jdt.core.IJavaProject;
@@ -11,19 +10,17 @@
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.eclipse.console.actions.OpenFileActionUtils;
import org.hibernate.mapping.Collection;
-import org.hibernate.mapping.Map;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Subclass;
import org.hibernate.mapping.Table;
import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
import org.jboss.tools.hibernate.ui.veditor.editors.VisualEditor;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
import org.jboss.tools.hibernate.ui.veditor.editors.model.SpecialRootClass;
import org.jboss.tools.hibernate.ui.view.views.HibernateUtils;
import org.jboss.tools.hibernate.ui.view.views.ObjectEditorInput;
-import org.jboss.tools.hibernate.ui.view.views.OpenFileActionUtils;
public class OpenMappingAction extends SelectionAction {
public static String ACTION_ID = "org.jboss.tools.hibernate.ui.veditor.editors.actions.open.mapping";
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 2007-11-07 15:17:26 UTC (rev 4758)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/OpenSourceAction.java 2007-11-07 17:12:45 UTC (rev 4759)
@@ -13,6 +13,7 @@
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.eclipse.console.actions.OpenFileActionUtils;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass;
import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
@@ -21,7 +22,7 @@
import org.jboss.tools.hibernate.ui.view.ViewPlugin;
import org.jboss.tools.hibernate.ui.view.views.HibernateUtils;
import org.jboss.tools.hibernate.ui.view.views.ObjectEditorInput;
-import org.jboss.tools.hibernate.ui.view.views.OpenFileActionUtils;
+import org.hibernate.eclipse.console.actions.OpenFileActionUtils;
public class OpenSourceAction extends SelectionAction {
public static String ACTION_ID = "org.jboss.tools.hibernate.ui.veditor.editors.actions.open.source";
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java 2007-11-07 15:17:26 UTC (rev 4758)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java 2007-11-07 17:12:45 UTC (rev 4759)
@@ -19,6 +19,7 @@
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
+// TODO: What is this ? And why is it extending mapping classes ?!
public class SpecialRootClass extends RootClass {
private Property property;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml 2007-11-07 15:17:26 UTC (rev 4758)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml 2007-11-07 17:12:45 UTC (rev 4759)
@@ -11,23 +11,5 @@
class="org.jboss.tools.hibernate.ui.view.views.OpenDiagramActionDelegate">
</action>
</objectContribution>
- <objectContribution id="mappingEditorAction" objectClass="org.hibernate.mapping.RootClass">
- <menu id="org.jboss.tools.hibernate.ui.view.openMapping" label="Open Mapping File" path="mappingEditorAction"/>
- <action
- id="org.jboss.tools.hibernate.ui.view.openMappingAction"
- label="Open Mapping File"
- icon="icons/runOpenMapping.gif"
- class="org.jboss.tools.hibernate.ui.view.views.OpenMappingActionDelegate">
- </action>
- </objectContribution>
- <objectContribution id="sourceEditorAction" objectClass="org.hibernate.mapping.RootClass">
- <menu id="org.jboss.tools.hibernate.ui.view.openSource" label="Open Source File" path="sourceEditorAction"/>
- <action
- id="org.jboss.tools.hibernate.ui.view.openSourceAction"
- label="Open Source File"
- icon="icons/runOpenSource.gif"
- class="org.jboss.tools.hibernate.ui.view.views.OpenSourceActionDelegate">
- </action>
- </objectContribution>
</extension>
</plugin>
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HTConstants.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HTConstants.java 2007-11-07 15:17:26 UTC (rev 4758)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HTConstants.java 2007-11-07 17:12:45 UTC (rev 4759)
@@ -1,16 +0,0 @@
-package org.jboss.tools.hibernate.ui.view.views;
-
-public class HTConstants {
- public static String HIBERNATE_TAG_CLASS = "class";
- public static String HIBERNATE_TAG_TABLE = "table";
- public static String HIBERNATE_TAG_SUBCLASS = "subclass";
- public static String HIBERNATE_TAG_JOINED_SUBCLASS = "joined-subclass";
- public static String HIBERNATE_TAG_UNION_SUBCLASS = "union-subclass";
- public static String HIBERNATE_TAG_NAME = "name";
- public static String HIBERNATE_TAG_ENTITY_NAME = "entity-name";
- public static String HIBERNATE_TAG_SESSION_FACTORY = "session-factory";
- public static String HIBERNATE_TAG_MAPPING = "mapping";
- public static String HIBERNATE_TAG_RESOURCE = "resource";
- public static String HIBERNATE_TAG_CATALOG = "catalog";
- public static String HIBERNATE_TAG_SCHEMA = "schema";
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenFileActionUtils.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenFileActionUtils.java 2007-11-07 15:17:26 UTC (rev 4758)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenFileActionUtils.java 2007-11-07 17:12:45 UTC (rev 4759)
@@ -1,248 +0,0 @@
-package org.jboss.tools.hibernate.ui.view.views;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.dom4j.Attribute;
-import org.dom4j.Document;
-import org.dom4j.DocumentException;
-import org.dom4j.Element;
-import org.dom4j.VisitorSupport;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.ide.IDE;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.mapping.RootClass;
-import org.hibernate.mapping.Subclass;
-import org.hibernate.mapping.Table;
-import org.hibernate.util.StringHelper;
-import org.hibernate.util.XMLHelper;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-import org.xml.sax.InputSource;
-
-public class OpenFileActionUtils {
- private static XMLHelper helper = new XMLHelper();
-
- public static void openEditor(IWorkbenchPage page, IResource resource) throws PartInitException {
- IDE.openEditor(page, (IFile) resource);
- }
-
- public static boolean rootClassHasAnnotations(ConsoleConfiguration consoleConfiguration, java.io.File configXMLFile, RootClass rootClass) {
- if (configXMLFile == null) return true;
- Document doc = getDocument(consoleConfiguration, configXMLFile);
- return getElements(doc, HTConstants.HIBERNATE_TAG_MAPPING, HTConstants.HIBERNATE_TAG_CLASS, HibernateUtils.getPersistentClassName(rootClass)).hasNext();
- }
-
- private static boolean elementInResource(ConsoleConfiguration consoleConfiguration, IResource resource, Object element) {
- if (element instanceof RootClass) {
- return rootClassInResource(consoleConfiguration, resource, (RootClass)element);
- } else if (element instanceof Subclass) {
- return subclassInResource(consoleConfiguration, resource, (Subclass)element);
- } else if (element instanceof Table) {
- return tableInResource(consoleConfiguration, resource, (Table)element);
- } else {
- return false;
- }
- }
-
- public static boolean rootClassInResource(ConsoleConfiguration consoleConfiguration, IResource resource, RootClass persistentClass) {
- Document doc = getDocument(consoleConfiguration, resource.getLocation().toFile());
- return getElements(doc, HTConstants.HIBERNATE_TAG_CLASS, HTConstants.HIBERNATE_TAG_NAME, StringHelper.unqualify(HibernateUtils.getPersistentClassName(persistentClass))).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_CLASS, HTConstants.HIBERNATE_TAG_NAME, HibernateUtils.getPersistentClassName(persistentClass)).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_CLASS, StringHelper.unqualify(HibernateUtils.getPersistentClassName(persistentClass))).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_CLASS, HibernateUtils.getPersistentClassName(persistentClass)).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_CLASS, HTConstants.HIBERNATE_TAG_ENTITY_NAME, StringHelper.unqualify(HibernateUtils.getPersistentClassName(persistentClass))).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_CLASS, HTConstants.HIBERNATE_TAG_ENTITY_NAME, HibernateUtils.getPersistentClassName(persistentClass)).hasNext();
- }
-
- public static boolean subclassInResource(ConsoleConfiguration consoleConfiguration, IResource resource, Subclass persistentClass) {
- Document doc = getDocument(consoleConfiguration, resource.getLocation().toFile());
- return getElements(doc, HTConstants.HIBERNATE_TAG_SUBCLASS, HTConstants.HIBERNATE_TAG_NAME, StringHelper.unqualify(HibernateUtils.getPersistentClassName(persistentClass))).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_SUBCLASS, HTConstants.HIBERNATE_TAG_NAME, HibernateUtils.getPersistentClassName(persistentClass)).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_SUBCLASS, HTConstants.HIBERNATE_TAG_ENTITY_NAME, StringHelper.unqualify(HibernateUtils.getPersistentClassName(persistentClass))).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_SUBCLASS, HTConstants.HIBERNATE_TAG_ENTITY_NAME, HibernateUtils.getPersistentClassName(persistentClass)).hasNext() ||
-
- getElements(doc, HTConstants.HIBERNATE_TAG_JOINED_SUBCLASS, HTConstants.HIBERNATE_TAG_NAME, StringHelper.unqualify(HibernateUtils.getPersistentClassName(persistentClass))).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_JOINED_SUBCLASS, HTConstants.HIBERNATE_TAG_NAME, HibernateUtils.getPersistentClassName(persistentClass)).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_JOINED_SUBCLASS, HTConstants.HIBERNATE_TAG_ENTITY_NAME, StringHelper.unqualify(HibernateUtils.getPersistentClassName(persistentClass))).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_JOINED_SUBCLASS, HTConstants.HIBERNATE_TAG_ENTITY_NAME, HibernateUtils.getPersistentClassName(persistentClass)).hasNext() ||
-
- getElements(doc, HTConstants.HIBERNATE_TAG_UNION_SUBCLASS, HTConstants.HIBERNATE_TAG_NAME, StringHelper.unqualify(HibernateUtils.getPersistentClassName(persistentClass))).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_UNION_SUBCLASS, HTConstants.HIBERNATE_TAG_NAME, HibernateUtils.getPersistentClassName(persistentClass)).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_UNION_SUBCLASS, HTConstants.HIBERNATE_TAG_ENTITY_NAME, StringHelper.unqualify(HibernateUtils.getPersistentClassName(persistentClass))).hasNext() ||
- getElements(doc, HTConstants.HIBERNATE_TAG_UNION_SUBCLASS, HTConstants.HIBERNATE_TAG_ENTITY_NAME, HibernateUtils.getPersistentClassName(persistentClass)).hasNext();
- }
-
- public static boolean tableInResource(ConsoleConfiguration consoleConfiguration, IResource resource, Table table) {
- Document doc = getDocument(consoleConfiguration, resource.getLocation().toFile());
-
- Iterator classes = getElements(doc, HTConstants.HIBERNATE_TAG_CLASS);
- while (classes.hasNext()) {
- Element element = (Element) classes.next();
-
- Attribute tableAttr = element.attribute( HTConstants.HIBERNATE_TAG_TABLE );
- if (tableAttr != null) {
- Attribute catalogAttr = element.attribute( HTConstants.HIBERNATE_TAG_CATALOG );
- if (catalogAttr == null) catalogAttr = doc.getRootElement().attribute(HTConstants.HIBERNATE_TAG_CATALOG);
- Attribute schemaAttr = element.attribute( HTConstants.HIBERNATE_TAG_SCHEMA );
- if (schemaAttr == null) schemaAttr = doc.getRootElement().attribute(HTConstants.HIBERNATE_TAG_SCHEMA);
- if (HibernateUtils.
- getTableName(
- (catalogAttr != null ? catalogAttr.getValue() : null),
- (schemaAttr != null ? schemaAttr.getValue() : null),
- tableAttr.getValue()
- ).equals(HibernateUtils.getTableName(table))
- ) {
- return true;
- }
-
-
- }
-
- Attribute classNameAttr = element.attribute( HTConstants.HIBERNATE_TAG_NAME );
- if (classNameAttr == null) classNameAttr = element.attribute( HTConstants.HIBERNATE_TAG_ENTITY_NAME);
- if (classNameAttr != null) {
- String physicalTableName = consoleConfiguration.getConfiguration().getNamingStrategy().classToTableName(classNameAttr.getValue());
- if (table.getName().equals(physicalTableName)) {
- return true;
- }
- }
- }
-
- if (getElements(doc, HTConstants.HIBERNATE_TAG_TABLE, table.getName()).hasNext()) {
- return true;
- }
-
- return false;
- }
-
- private static Iterator getElements(Document doc, String elementName) {
- return getElements(doc, elementName, null, null);
- }
-
- private static Iterator getElements(Document doc, String attrName, String attrValue) {
- return getElements(doc, null, attrName, attrValue);
- }
-
- private static Iterator getElements(Document doc, String elementName, String attrName, String attrValue) {
- LVS visitor = new LVS(elementName, attrName, attrValue);
- doc.accept( visitor );
- return visitor.iterator();
- }
-
- static class LVS extends VisitorSupport {
- private String nodeName;
- private String attrName;
- private String attrValue;
- private List ret = new ArrayList();
-
- public LVS(String nodeName, String attrName, String attrValue) {
- super();
- this.nodeName = nodeName;
- this.attrName = attrName;
- this.attrValue = attrValue;
- }
-
- public void visit(Element element) {
- if (nodeName == null) {
- if (attrName != null && attrValue != null) {
- if (attrIsCorrect(element, attrName, attrValue)) {
- ret.add(element);
- }
- }
- } else {
- if (nodeName.equals(element.getName())) {
- if (attrName != null) {
- if (attrIsCorrect(element, attrName, attrValue)) {
- ret.add(element);
- }
- } else {
- ret.add(element);
- }
- }
- }
-
- }
-
- public Iterator iterator() {
- return ret.iterator();
- }
- }
-
- private static boolean attrIsCorrect(Element element, String attrName, String attrValue) {
- Attribute attr = element.attribute(attrName);
- if (attr != null && attrValue.equals(attr.getValue())) {
- return attrValue.equals(attr.getValue());
- }
- return false;
- }
-
- public static Document getDocument(ConsoleConfiguration consoleConfiguration, java.io.File configXMLFile) {
- Document doc = null;
- if (consoleConfiguration != null && configXMLFile != null) {
- InputStream stream = null;
- try {
- stream = new FileInputStream( configXMLFile );
- } catch (FileNotFoundException e) {
- ViewPlugin.getDefault().logError("Configuration file not found", e);
- }
- try {
- List errors = new ArrayList();
- doc = helper.createSAXReader( configXMLFile.getPath(), errors, consoleConfiguration.getConfiguration().getEntityResolver() )
- .read( new InputSource( stream ) );
- if ( errors.size() != 0 ) {
- ViewPlugin.getDefault().logError("invalid configuration");
- }
- }
- catch (DocumentException e) {
- ViewPlugin.getDefault().logError("Could not parse configuration", e);
- }
- finally {
- try {
- stream.close();
- }
- catch (IOException ioe) {
- ViewPlugin.getDefault().logError("could not close input stream for", ioe);
- }
- }
- }
- return doc;
- }
-
- public static IResource getResource(ConsoleConfiguration consoleConfiguration, IJavaProject proj, java.io.File configXMLFile, Object element) {
- Document doc = getDocument(consoleConfiguration, configXMLFile);
- IResource resource = null;
- if (consoleConfiguration != null && proj != null && doc != null) {
- Element sfNode = doc.getRootElement().element( HTConstants.HIBERNATE_TAG_SESSION_FACTORY );
- Iterator elements = sfNode.elements(HTConstants.HIBERNATE_TAG_MAPPING).iterator();
- while ( elements.hasNext() ) {
- Element subelement = (Element) elements.next();
- Attribute file = subelement.attribute( HTConstants.HIBERNATE_TAG_RESOURCE );
- if (file != null) {
- resource = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(configXMLFile.getParent()).append(file.getValue()));
- if (elementInResource(consoleConfiguration, resource, element)) return resource;
- }
- }
-
- java.io.File[] files = consoleConfiguration.getPreferences().getMappingFiles();
- for (int i = 0; i < files.length; i++) {
- java.io.File file = files[i];
- if (file != null) {
- resource = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(file.getPath()));
- if (OpenFileActionUtils.elementInResource(consoleConfiguration, resource, element)) return resource;
- }
- }
- }
- return null;
- }
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenMappingActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenMappingActionDelegate.java 2007-11-07 15:17:26 UTC (rev 4758)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenMappingActionDelegate.java 2007-11-07 17:12:45 UTC (rev 4759)
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * 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.view.views;
-
-import org.dom4j.Document;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.ObjectPluginAction;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.eclipse.console.utils.ProjectUtils;
-import org.hibernate.mapping.RootClass;
-import org.hibernate.util.XMLHelper;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-
-public class OpenMappingActionDelegate extends OpenActionDelegate {
- private static XMLHelper helper = new XMLHelper();
-
- public void run(IAction action) {
- ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
- RootClass rootClass = (RootClass)((TreeSelection)objectPluginAction.getSelection()).getFirstElement();
- ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)(((TreeSelection)objectPluginAction.getSelection()).getPaths()[0]).getSegment(0);
- IJavaProject proj = ProjectUtils.findJavaProject(consoleConfiguration);
- java.io.File configXMLFile = consoleConfiguration.getPreferences().getConfigXMLFile();
- Document doc = OpenFileActionUtils.getDocument(consoleConfiguration, configXMLFile);
-// IResource resource = OpenFileActionUtils.getResource(consoleConfiguration, proj, doc, configXMLFile, rootClass);
- IResource resource = OpenFileActionUtils.getResource(consoleConfiguration, proj, configXMLFile, rootClass);
-
- if (resource == null) {
- String fullyQualifiedName = HibernateUtils.getPersistentClassName(rootClass);
- try {
- resource = proj.findType(fullyQualifiedName).getResource();
- } catch (JavaModelException e) {
- ViewPlugin.getDefault().logError("Can't find mapping file.", e);
- }
- }
-
- if (resource != null && resource instanceof IFile){
- try {
- OpenFileActionUtils.openEditor(ViewPlugin.getPage(), (IFile) resource);
- } catch (PartInitException e) {
- ViewPlugin.getDefault().logError("Can't open mapping or source file.", e);
- }
- }
- }
-}
\ No newline at end of file
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenSourceActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenSourceActionDelegate.java 2007-11-07 15:17:26 UTC (rev 4758)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenSourceActionDelegate.java 2007-11-07 17:12:45 UTC (rev 4759)
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * 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.view.views;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.ObjectPluginAction;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.eclipse.console.utils.ProjectUtils;
-import org.hibernate.mapping.RootClass;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-
-public class OpenSourceActionDelegate extends OpenActionDelegate {
-
- public void run(IAction action) {
- ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
- RootClass rootClass = (RootClass)((TreeSelection)objectPluginAction.getSelection()).getFirstElement();
- ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)(((TreeSelection)objectPluginAction.getSelection()).getPaths()[0]).getSegment(0);
- IJavaProject proj = ProjectUtils.findJavaProject(consoleConfiguration);
-
- IResource resource = null;
- String fullyQualifiedName = HibernateUtils.getPersistentClassName(rootClass);
- try {
- IType type = proj.findType(fullyQualifiedName);
- if (type != null) resource = type.getResource();
- } catch (JavaModelException e) {
- ViewPlugin.getDefault().logError("Can't find source file.", e);
- }
-
- if (resource instanceof IFile){
- try {
- OpenFileActionUtils.openEditor(ViewPlugin.getPage(), (IFile) resource);
- } catch (PartInitException e) {
- ViewPlugin.getDefault().logError("Can't open source file.", e);
- }
- }
- if (resource == null) {
- MessageDialog.openInformation(ViewPlugin.getActiveWorkbenchShell(), "Open Source File", "Source file for class '" + fullyQualifiedName + "' not found.");
- }
- }
-}
\ No newline at end of file
18 years, 5 months
JBoss Tools SVN: r4758 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-11-07 10:17:26 -0500 (Wed, 07 Nov 2007)
New Revision: 4758
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java
Log:
JBIDE-1259
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java 2007-11-07 15:02:11 UTC (rev 4757)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java 2007-11-07 15:17:26 UTC (rev 4758)
@@ -244,7 +244,6 @@
String s = "src-" + i;
if(object.getChildByPath(s) == null) return s;
i++;
- return s;
}
}
18 years, 5 months
JBoss Tools SVN: r4757 - in trunk/hibernatetools/plugins: org.hibernate.eclipse.console/icons/images and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-11-07 10:02:11 -0500 (Wed, 07 Nov 2007)
New Revision: 4757
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/reload.gif
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ReloadConfigurationAction.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseLaunchConsoleConfigurationPreferences.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConfigurationsViewActionGroup.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageConstants.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageMap.java
Log:
JBIDE-1122 UI reload hibernate console configuration
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageConstants.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageConstants.java 2007-11-07 13:17:57 UTC (rev 4756)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageConstants.java 2007-11-07 15:02:11 UTC (rev 4757)
@@ -114,5 +114,6 @@
public static final String CHECKBOX_FULL = "images/xpl/complete_tsk.gif";
public static final String CHECKBOX_EMPTY = "images/xpl/incomplete_tsk.gif";
+ public static final String RELOAD = "images/reload.gif";
}
\ No newline at end of file
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageMap.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageMap.java 2007-11-07 13:17:57 UTC (rev 4756)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageMap.java 2007-11-07 15:02:11 UTC (rev 4757)
@@ -71,6 +71,7 @@
declareRegistryImage(FUNCTION, "images/function.gif");
declareRegistryImage(CHECKBOX_EMPTY, "images/xpl/incomplete_tsk.gif");
declareRegistryImage(CHECKBOX_FULL, "images/xpl/complete_tsk.gif");
+ declareRegistryImage(RELOAD, "images/reload.gif");
}
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/reload.gif
===================================================================
(Binary files differ)
Property changes on: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/reload.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseLaunchConsoleConfigurationPreferences.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseLaunchConsoleConfigurationPreferences.java 2007-11-07 13:17:57 UTC (rev 4756)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseLaunchConsoleConfigurationPreferences.java 2007-11-07 15:02:11 UTC (rev 4757)
@@ -16,9 +16,13 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.HibernateConsoleRuntimeException;
+import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.utils.ClassLoaderHelper;
+import org.hibernate.eclipse.launch.ICodeGenerationLaunchConstants;
import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
import org.w3c.dom.Element;
@@ -30,6 +34,7 @@
this.launchConfiguration = configuration;
}
+
private File strToFile(String epath) {
if(epath==null) return null;
IPath path = new Path(epath);
@@ -154,7 +159,10 @@
public void writeStateTo(Element node) {
throw new IllegalStateException("Cannot write to xml");
}
+
+
+
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConfigurationsViewActionGroup.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConfigurationsViewActionGroup.java 2007-11-07 13:17:57 UTC (rev 4756)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConfigurationsViewActionGroup.java 2007-11-07 15:02:11 UTC (rev 4757)
@@ -31,7 +31,6 @@
import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.actions.SelectionListenerAction;
import org.hibernate.eclipse.console.actions.AddConfigurationAction;
-import org.hibernate.eclipse.console.actions.BuildSessionFactoryAction;
import org.hibernate.eclipse.console.actions.CriteriaEditorAction;
import org.hibernate.eclipse.console.actions.DeleteConfigurationAction;
import org.hibernate.eclipse.console.actions.EditConsoleConfiguration;
@@ -47,11 +46,12 @@
private Action addConfigurationAction;
private SelectionListenerAction deleteConfigurationAction;
private SelectionListenerAction refreshAction;
- private SelectionListenerAction connectAction;
+ //private SelectionListenerAction connectAction;
+ private SelectionListenerAction reloadConfigurationAction;
private SelectionListenerAction schemaExportAction;
private EditConsoleConfiguration editConfigurationAction;
private final StructuredViewer selectionProvider;
- private SelectionListenerAction scratchpadAction;
+ private SelectionListenerAction hqlEditorAction;
private CriteriaEditorAction criteriaEditorAction;
public ConfigurationsViewActionGroup(IViewPart part, StructuredViewer selectionProvider) {
@@ -68,9 +68,12 @@
refreshAction = new RefreshAction(selectionProvider);
selectionProvider.addSelectionChangedListener(refreshAction);
-
- connectAction = new BuildSessionFactoryAction(selectionProvider);
- selectionProvider.addSelectionChangedListener(connectAction);
+
+ reloadConfigurationAction = new ReloadConfigurationAction(selectionProvider);
+ selectionProvider.addSelectionChangedListener(reloadConfigurationAction);
+
+ //connectAction = new BuildSessionFactoryAction(selectionProvider);
+ //selectionProvider.addSelectionChangedListener(connectAction);
/*IMenuManager manager = part.getViewSite().getActionBars().getMenuManager();
manager.add(addConfigurationAction);*/
@@ -80,8 +83,8 @@
editConfigurationAction = new EditConsoleConfiguration();
selectionProvider.addSelectionChangedListener(editConfigurationAction);
- scratchpadAction = new HQLScratchpadAction();
- selectionProvider.addSelectionChangedListener(scratchpadAction);
+ hqlEditorAction = new HQLScratchpadAction();
+ selectionProvider.addSelectionChangedListener(hqlEditorAction);
criteriaEditorAction = new CriteriaEditorAction();
selectionProvider.addSelectionChangedListener(criteriaEditorAction);
@@ -91,20 +94,20 @@
super.dispose();
selectionProvider.removeSelectionChangedListener(deleteConfigurationAction);
selectionProvider.removeSelectionChangedListener(refreshAction);
- selectionProvider.removeSelectionChangedListener(connectAction);
+ selectionProvider.removeSelectionChangedListener(reloadConfigurationAction);
selectionProvider.removeSelectionChangedListener(schemaExportAction);
selectionProvider.removeSelectionChangedListener(editConfigurationAction);
- selectionProvider.removeSelectionChangedListener(scratchpadAction);
+ selectionProvider.removeSelectionChangedListener(hqlEditorAction);
selectionProvider.removeSelectionChangedListener(criteriaEditorAction);
}
public void fillContextMenu(IMenuManager menu) {
- menu.add(connectAction);
- menu.add(scratchpadAction);
+ menu.add(hqlEditorAction);
menu.add(criteriaEditorAction);
menu.add(new Separator() );
menu.add(addConfigurationAction);
+ menu.add(reloadConfigurationAction);
menu.add(editConfigurationAction);
menu.add(deleteConfigurationAction);
menu.add(new Separator() );
@@ -115,8 +118,9 @@
public void fillActionBars(IActionBars actionBars) {
+ actionBars.getToolBarManager().add(reloadConfigurationAction);
actionBars.getToolBarManager().add(addConfigurationAction);
- actionBars.getToolBarManager().add(scratchpadAction);
+ actionBars.getToolBarManager().add(hqlEditorAction);
actionBars.getToolBarManager().add(criteriaEditorAction);
}
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ReloadConfigurationAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ReloadConfigurationAction.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ReloadConfigurationAction.java 2007-11-07 15:02:11 UTC (rev 4757)
@@ -0,0 +1,49 @@
+package org.hibernate.eclipse.console.views;
+
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.HibernateConsoleRuntimeException;
+import org.hibernate.console.ImageConstants;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction;
+import org.hibernate.eclipse.console.utils.EclipseImages;
+
+public class ReloadConfigurationAction extends ConsoleConfigurationBasedAction {
+
+ private StructuredViewer viewer;
+
+ protected ReloadConfigurationAction(StructuredViewer sv) {
+ super("Rebuild configuration");
+ setEnabledWhenNoSessionFactory(true);
+ viewer = sv;
+ setImageDescriptor(EclipseImages.getImageDescriptor(ImageConstants.RELOAD) );
+ }
+
+ protected void doRun() {
+ for (Iterator i = getSelectedNonResources().iterator(); i.hasNext();) {
+ try {
+ Object node = i.next();
+ if (node instanceof ConsoleConfiguration) {
+ ConsoleConfiguration config = (ConsoleConfiguration) node;
+ config.reset();
+ updateState(config);
+ viewer.refresh(node);
+ }
+ } catch (HibernateConsoleRuntimeException he) {
+ HibernateConsolePlugin.getDefault().showError(
+ viewer.getControl().getShell(),
+ "Exception while connecting/starting Hibernate", he);
+ } catch (UnsupportedClassVersionError ucve) {
+ HibernateConsolePlugin
+ .getDefault()
+ .showError(
+ viewer.getControl().getShell(),
+ "Starting Hibernate resulted in a UnsupportedClassVersionError.\nThis can occur if you are running eclipse with JDK 1.4 and your domain classes require JDK 1.5. \n\nResolution: Run eclipse with JDK 1.5.",
+ ucve);
+ }
+ }
+ }
+
+}
18 years, 5 months
JBoss Tools SVN: r4756 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-11-07 08:17:57 -0500 (Wed, 07 Nov 2007)
New Revision: 4756
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/messages.properties
Log:
fxied spelling errors
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/messages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/messages.properties 2007-11-07 13:17:34 UTC (rev 4755)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/messages.properties 2007-11-07 13:17:57 UTC (rev 4756)
@@ -141,7 +141,7 @@
RUN=Run
START=Start
REFRESH_SERVER=Refresh {0} Server
-CHANGE_TIME_STAMP=Change Time Stamp of
+CHANGE_TIME_STAMP=Change Timestamp of
STOP_SERVER=Stop {0} Server
START_SERVER_IN_DEBUG_MODE=Start {0} Server in Debug Mode: {1}
REDHAT_TAG_LIBRARY_EDITOR=JBoss Tools Tag Library Editor
18 years, 5 months
JBoss Tools SVN: r4755 - trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-11-07 08:17:34 -0500 (Wed, 07 Nov 2007)
New Revision: 4755
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/strutswebapp.meta
trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/webapp24.meta
Log:
fxied spelling errors
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/strutswebapp.meta
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/strutswebapp.meta 2007-11-07 13:07:20 UTC (rev 4754)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/strutswebapp.meta 2007-11-07 13:17:34 UTC (rev 4755)
@@ -358,7 +358,7 @@
ICON="action.save" displayName="Save" kind="action" name="Save"/>
<XActionItem
HandlerClassName="org.jboss.tools.jst.web.tomcat.ResetFileDateHandler"
- ICON="action.save" displayName="Change Time Stamp" kind="action" name="ChangeTimeStamp"/>
+ ICON="action.save" displayName="Change Timestamp" kind="action" name="ChangeTimeStamp"/>
</XActionItem>
<XActionItem HIDE="always"
HandlerClassName="org.jboss.tools.jst.web.tld.model.handlers.ExpandTLDHandler"
@@ -514,7 +514,7 @@
ICON="action.save" displayName="Save" kind="action" name="Save"/>
<XActionItem
HandlerClassName="org.jboss.tools.jst.web.tomcat.ResetFileDateHandler"
- ICON="action.save" displayName="Change Time Stamp" kind="action" name="ChangeTimeStamp"/>
+ ICON="action.save" displayName="Change Timestamp" kind="action" name="ChangeTimeStamp"/>
</XActionItem>
<XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
<XActionItem BaseActionName="Paste" HandlerClassName="%Paste%"
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/webapp24.meta
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/webapp24.meta 2007-11-07 13:07:20 UTC (rev 4754)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/webapp24.meta 2007-11-07 13:17:34 UTC (rev 4755)
@@ -379,7 +379,7 @@
ICON="action.save" displayName="Save" kind="action" name="Save"/>
<XActionItem
HandlerClassName="org.jboss.tools.jst.web.tomcat.ResetFileDateHandler"
- ICON="action.save" displayName="Change Time Stamp" kind="action" name="ChangeTimeStamp"/>
+ ICON="action.save" displayName="Change Timestamp" kind="action" name="ChangeTimeStamp"/>
</XActionItem>
<XActionItem HIDE="always"
HandlerClassName="org.jboss.tools.jst.web.tld.model.handlers.ExpandTLDHandler"
@@ -553,7 +553,7 @@
ICON="action.save" displayName="Save" kind="action" name="Save"/>
<XActionItem
HandlerClassName="org.jboss.tools.jst.web.tomcat.ResetFileDateHandler"
- ICON="action.save" displayName="Change Time Stamp" kind="action" name="ChangeTimeStamp"/>
+ ICON="action.save" displayName="Change Timestamp" kind="action" name="ChangeTimeStamp"/>
</XActionItem>
<XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
<XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
@@ -881,7 +881,7 @@
ICON="action.save" displayName="Save" kind="action" name="Save"/>
<XActionItem
HandlerClassName="org.jboss.tools.jst.web.tomcat.ResetFileDateHandler"
- ICON="action.save" displayName="Change Time Stamp" kind="action" name="ChangeTimeStamp"/>
+ ICON="action.save" displayName="Change Timestamp" kind="action" name="ChangeTimeStamp"/>
</XActionItem>
<XActionItem HIDE="always"
HandlerClassName="org.jboss.tools.jst.web.tld.model.handlers.ExpandTLDHandler"
@@ -1055,7 +1055,7 @@
ICON="action.save" displayName="Save" kind="action" name="Save"/>
<XActionItem
HandlerClassName="org.jboss.tools.jst.web.tomcat.ResetFileDateHandler"
- ICON="action.save" displayName="Change Time Stamp" kind="action" name="ChangeTimeStamp"/>
+ ICON="action.save" displayName="Change Timestamp" kind="action" name="ChangeTimeStamp"/>
</XActionItem>
<XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
<XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
18 years, 5 months
JBoss Tools SVN: r4754 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/ui.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-11-07 08:07:20 -0500 (Wed, 07 Nov 2007)
New Revision: 4754
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/ui/AttributeValueLabelProvider.java
Log:
JBIDE-1030
Icon of folder 'Resource Bundles' in 'Edit Attributes' dialog for jsp tag attributes
is replaced with the standard folder icon.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/ui/AttributeValueLabelProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/ui/AttributeValueLabelProvider.java 2007-11-07 09:05:56 UTC (rev 4753)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/ui/AttributeValueLabelProvider.java 2007-11-07 13:07:20 UTC (rev 4754)
@@ -55,7 +55,7 @@
imagesPathes.put(BundlesNameResourceElement.class, "images/jdo/db_fields_folder.gif");
imagesPathes.put(BundleNameElement.class, "images/navigationtree/properties.gif");
- imagesPathes.put(BundlesPropertiesResourceElement.class, "images/jdo/db_fields_folder.gif");
+ imagesPathes.put(BundlesPropertiesResourceElement.class, "images/file/closed_folder.gif");
imagesPathes.put(BundleAliasElement.class, "images/navigationtree/properties.gif");
imagesPathes.put(BundlePropertyElement.class, "images/navigationtree/property.gif");
18 years, 5 months
JBoss Tools SVN: r4753 - in trunk/documentation/whatsnew: template and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-11-07 04:05:56 -0500 (Wed, 07 Nov 2007)
New Revision: 4753
Added:
trunk/documentation/whatsnew/template/
trunk/documentation/whatsnew/template/componentname-version.html
trunk/documentation/whatsnew/template/images/
trunk/documentation/whatsnew/template/images/sample-snapshot.png
Log:
what's new template
Added: trunk/documentation/whatsnew/template/componentname-version.html
===================================================================
--- trunk/documentation/whatsnew/template/componentname-version.html (rev 0)
+++ trunk/documentation/whatsnew/template/componentname-version.html 2007-11-07 09:05:56 UTC (rev 4753)
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Language" content="en-us" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<link rel="stylesheet" href="../whatsnew.css"/>
+<title>JBoss Tools What's New Template</title>
+</head>
+<body>
+<h1>JBoss Tools What's New Template</h1>
+<p>Last revised November 7, 2007</p>
+<p>This is the template for the "What's new" document that
+ accompanies each JBoss Tools release. (roughly based on the template from Eclipse News and Noteworthy)</p>
+
+<table border="0" cellpadding="10" cellspacing="0" width="80%">
+ <tr>
+ <td colspan="2">
+ <hr/>
+ <h3>JBoss Tools element</h3>
+ <hr/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="left">
+ <p align="right"><b>Item
+ title, in bold, no trailing punctuation, with named anchor </b></p></td>
+ <td valign="top"><p>A quick paragraph about changes since the last release of JBoss Tools/RHDS.
+ Tell end users about changes they'll see at the UI. Tell component writers
+ about changes they'll see at the client- and server-side APIs. Try to
+ generate some excitement; save the boring details for the manual. The
+ description should be complete sentences, with trailing punctuation.
+ Stick to the default font and size.</p>
+ <p>If a small image sheds light, place it below the description, in a separate
+ paragraph. Regular screen snapshots should be done on Windows or Linux. Crop
+ out any extraneous stuff to focus the reader's attention on your new
+ feature. <span style="background-color: #FFFF00">The image should be
+ no more than 466 pixels wide and in PNG-24 format</span> (as opposed
+ to GIF, TIF, BMP, or JPG).</p>
+ <p><img src="images/sample-snapshot.png"/></p>
+ <p>Name the file is a way that is appropriate and specific to the item
+ (e.g., key-bindings.png, rather than something generic like image.png).
+ Use all lowercase letters in the image file name, including the ".png"
+ file extension. As a separator, use hyphen "-" rather than
+ underscore
+ "_". </p>
+ <p>Put all the images in a sibling directory named "images".
+ This gives HTML like <img src="images/foo.png" alt="The
+ Foo View" />. Include a suitable alt property (which is mandatory
+ in XHTML 1.0). Do not embed the width and height of the image.</p>
+ <p>The images should be left justified (as opposed to centered). </p>
+ <p>Use the W3C <a href="http://validator.w3.org/#validate_by_input">XHTML
+ Markup Validation Service</a> to check your document's markup before
+ submitting.</p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2"><hr />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="left"><a name="itemnam2e" id="itemname2"></a><b>Another
+ item</b></td>
+ <td width="70%" valign="top">Another blurb</td>
+ </tr>
+ <tr>
+ <td colspan="2"><hr />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="left"><a name="itemname3" id="itemname3"></a><b>Another
+ item</b></td>
+ <td valign="top">Another blurb</td>
+ </tr>
+ <tr>
+ <td colspan="2"><hr />
+ </td>
+ </tr>
+
+</table>
+
+</body>
+
+</html>
+
+
Added: trunk/documentation/whatsnew/template/images/sample-snapshot.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/template/images/sample-snapshot.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
18 years, 5 months