JBoss Tools SVN: r2332 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-05 13:43:10 -0400 (Thu, 05 Jul 2007)
New Revision: 2332
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java
Log:
EXIN-217
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java 2007-07-05 17:41:12 UTC (rev 2331)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java 2007-07-05 17:43:10 UTC (rev 2332)
@@ -38,9 +38,9 @@
* @author Viacheslav Kabanovich
*/
public class ASTVisitorImpl extends ASTVisitor {
- static String SEAM_ANNOTATION_TYPE_PREFIX = "org.jboss.seam.annotations.";
- static String NAME_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "Name";
- static String SCOPE_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "Scope";
+ public static String SEAM_ANNOTATION_TYPE_PREFIX = "org.jboss.seam.annotations.";
+ public static String NAME_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "Name";
+ public static String SCOPE_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "Scope";
static int UNDEFINED_CONTEXT = -1;
static int TYPE_CONTEXT = 0;
17 years, 5 months
JBoss Tools SVN: r2331 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner: lib and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-05 13:41:12 -0400 (Thu, 05 Jul 2007)
New Revision: 2331
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/IFileScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/LoadedDeclarations.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
Log:
EXIN-217
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/IFileScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/IFileScanner.java 2007-07-05 17:12:54 UTC (rev 2330)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/IFileScanner.java 2007-07-05 17:41:12 UTC (rev 2331)
@@ -11,8 +11,6 @@
package org.jboss.tools.seam.internal.core.scanner;
import org.eclipse.core.resources.IFile;
-import org.jboss.tools.seam.internal.core.SeamComponent;
-import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
public interface IFileScanner {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/LoadedDeclarations.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/LoadedDeclarations.java 2007-07-05 17:12:54 UTC (rev 2330)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/LoadedDeclarations.java 2007-07-05 17:41:12 UTC (rev 2331)
@@ -32,5 +32,11 @@
public List<SeamFactory> getFactories() {
return factories;
}
+
+ public void add(LoadedDeclarations ds) {
+ if(ds == null) return;
+ components.addAll(ds.components);
+ factories.addAll(ds.factories);
+ }
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-05 17:41:12 UTC (rev 2331)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.scanner.lib;
+
+import java.lang.annotation.Annotation;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
+import org.jboss.tools.seam.internal.core.scanner.java.ASTVisitorImpl;
+
+/**
+ * Loads seam components from Class object.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public class ClassScanner {
+
+ /**
+ * Checks if class may be a source of seam components.
+ * @param f
+ * @return
+ */
+ public boolean isLikelyComponentSource(Class<?> cls) {
+ return cls != null && isSeamAnnotatedClass(cls);
+ }
+
+ /**
+ * Loads seam components from class.
+ * Returns object that contains loaded components or null;
+ * @param type
+ * @param cls
+ * @param path
+ * @return
+ */
+ public LoadedDeclarations parse(IType type, Class<?> cls, IPath path) {
+ if(!isLikelyComponentSource(cls)) return null;
+ LoadedDeclarations ds = new LoadedDeclarations();
+
+ return ds;
+ }
+
+ /**
+ * Check if class has at least one seam annotation.
+ * @param cls
+ * @return
+ */
+ boolean isSeamAnnotatedClass(Class<?> cls) {
+ if(cls == null || cls.isInterface()) return false;
+ Annotation[] as = cls.getAnnotations();
+ for (int i = 0; i < as.length; i++) {
+ Class<?> acls = as[i].annotationType();
+ if(acls.getName().startsWith(ASTVisitorImpl.SEAM_ANNOTATION_TYPE_PREFIX)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-05 17:12:54 UTC (rev 2330)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-05 17:41:12 UTC (rev 2331)
@@ -32,6 +32,7 @@
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.model.util.XModelObjectUtil;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.SeamPropertiesDeclaration;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
@@ -41,6 +42,7 @@
* @author Viacheslav Kabanovich
*/
public class LibraryScanner implements IFileScanner {
+ static ClassScanner CLASS_SCANNER = new ClassScanner();
ClassPath classPath = null;
//Now it is absolute file on disk
@@ -167,10 +169,22 @@
} catch (ClassNotFoundException e) {
//ignore
}
- String result = cls == null ? "not found " + className : className;
- System.out.println(result);
+ if(cls == null) continue;
+ if(!CLASS_SCANNER.isLikelyComponentSource(cls)) continue;
+ LoadedDeclarations ds1 = null;
+ try {
+ ds1 = CLASS_SCANNER.parse(type, cls, sourcePath);
+ } catch (Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ if(ds1 != null) {
+ ds.add(ds1);
+ }
+ System.out.println(className);
}
}
}
+
+
}
17 years, 5 months
JBoss Tools SVN: r2330 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-05 13:12:54 -0400 (Thu, 05 Jul 2007)
New Revision: 2330
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
Log:
http://jira.jboss.com/jira/browse/EXIN-327 Validation nonunique name of component
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-07-05 17:11:58 UTC (rev 2329)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-07-05 17:12:54 UTC (rev 2330)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.validation;
+import java.util.HashMap;
import java.util.Set;
import org.eclipse.core.resources.IFile;
@@ -21,44 +22,86 @@
import org.eclipse.wst.validation.internal.core.ValidationException;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
-import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.ISeamTextSourceReference;
+import org.jboss.tools.seam.core.SeamComponentPrecedenceType;
+import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
-public class SeamJavaValidator implements IValidatorJob {
+public class SeamJavaValidator extends SeamValidator {
+ // TODO
+ public static final String NONUNIQUE_COMPONENT_NAME_MESSAGE_ID="";
+
public ISchedulingRule getSchedulingRule(IValidationContext helper) {
// TODO
return null;
}
public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
+ super.validateInJob(helper, reporter);
+ System.out.println("Seam validation in job.");
SeamJavaHelper seamJavaHelper = (SeamJavaHelper)helper;
+ String[] uris = seamJavaHelper.getURIs();
ISeamProject project = seamJavaHelper.getSeamProject();
- Set<ISeamComponent> components = project.getComponents();
- for (ISeamComponent seamComponent : components) {
-// seamComponent.
- }
- String[] uris = seamJavaHelper.getURIs();
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
if (uris.length > 0) {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IFile currentFile = null;
for (int i = 0; i < uris.length && !reporter.isCancelled(); i++) {
currentFile = root.getFile(new Path(uris[i]));
if (currentFile != null && currentFile.exists()) {
System.out.println(currentFile);
+ // TODO
}
}
+ } else {
+ return validateAll(project, helper, reporter);
}
return OK_STATUS;
}
public void cleanup(IReporter reporter) {
- // TODO
}
- public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
- validateInJob(helper, reporter);
+ private IStatus validateAll(ISeamProject project, IValidationContext helper, IReporter reporter) {
+ Set<ISeamComponent> components = project.getComponents();
+ for (ISeamComponent component : components) {
+ // TODO
+ }
+ return OK_STATUS;
}
+
+ /*
+ * Validates that component has unique name
+ */
+ private void validateUniqueComponentName(ISeamProject project, ISeamComponent component, IValidationContext helper, IReporter reporter) {
+ ISeamJavaComponentDeclaration firstJavaDeclaration = component.getJavaDeclaration();
+ if(firstJavaDeclaration!=null) {
+ HashMap<SeamComponentPrecedenceType, ISeamJavaComponentDeclaration> usedPrecedences = new HashMap<SeamComponentPrecedenceType, ISeamJavaComponentDeclaration>();
+ SeamComponentPrecedenceType firstJavaDeclarationPrecedence = firstJavaDeclaration.getPrecedence();
+ if(firstJavaDeclarationPrecedence==null) {
+ firstJavaDeclarationPrecedence = ISeamJavaComponentDeclaration.DEFAULT_PRECEDENCE;
+ }
+ usedPrecedences.put(firstJavaDeclarationPrecedence, firstJavaDeclaration);
+ Set<ISeamComponentDeclaration> declarations = component.getAllDeclarations();
+ for (ISeamComponentDeclaration declaration : declarations) {
+ if(declaration instanceof ISeamJavaComponentDeclaration && declaration!=firstJavaDeclaration) {
+ // Component class with the same component name. Check precedence.
+ ISeamJavaComponentDeclaration javaDeclaration = (ISeamJavaComponentDeclaration)declaration;
+ SeamComponentPrecedenceType javaDeclarationPrecedence = javaDeclaration.getPrecedence();
+ ISeamJavaComponentDeclaration usedDeclaration = usedPrecedences.get(javaDeclarationPrecedence);
+ if(usedDeclaration==null) {
+ usedPrecedences.put(javaDeclarationPrecedence, javaDeclaration);
+ } else {
+ // Mark nonunique name.
+ ISeamTextSourceReference target = ((SeamComponentDeclaration)javaDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
+ addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, target);
+ }
+ }
+ }
+ }
+ }
}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-05 17:12:54 UTC (rev 2330)
@@ -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.jboss.tools.seam.internal.core.validation;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.validation.internal.core.Message;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
+import org.jboss.tools.seam.core.ISeamTextSourceReference;
+
+/**
+ * @author Alexey Kazakov
+ *
+ */
+public abstract class SeamValidator implements IValidatorJob {
+
+ private IValidationContext helper;
+ private IReporter reporter;
+
+ public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
+ this.helper = helper;
+ this.reporter = reporter;
+ return OK_STATUS;
+ }
+
+ public void cleanup(IReporter reporter) {
+ reporter = null;
+ }
+
+ public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
+ validateInJob(helper, reporter);
+ }
+
+ protected String getBundleName() {
+ // TODO
+ return "seamvalitation";
+ }
+
+ protected void addError(String messageId, String[] messageArguments, ISeamTextSourceReference target) {
+ IMessage message = new Message(getBundleName(), IMessage.HIGH_SEVERITY, messageId, messageArguments, target.getResource());
+ message.setLength(target.getLength());
+ message.setOffset(target.getStartPosition());
+ reporter.addMessage(this, message);
+ }
+
+ protected void addError(String messageId, ISeamTextSourceReference target) {
+ addError(messageId, new String[0], target);
+ }
+}
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2329 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-05 13:11:58 -0400 (Thu, 05 Jul 2007)
New Revision: 2329
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentPrecedenceType.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
Log:
http://jira.jboss.com/jira/browse/EXIN-216 Added 'precidence' into Java Component Declaration
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java 2007-07-05 15:10:20 UTC (rev 2328)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java 2007-07-05 17:11:58 UTC (rev 2329)
@@ -18,6 +18,8 @@
*/
public interface ISeamJavaComponentDeclaration extends ISeamComponentDeclaration, ISeamJavaSourceReference {
+ public static final SeamComponentPrecedenceType DEFAULT_PRECEDENCE = SeamComponentPrecedenceType.APPLICATION;
+
/**
* @return qualified class name
*/
@@ -107,4 +109,15 @@
* @param method
*/
public void removeMethod(ISeamComponentMethod method);
+
+ /**
+ * @return precedence of component.
+ */
+ public SeamComponentPrecedenceType getPrecedence();
+
+ /**
+ * Sets precedence of component.
+ * @param precedence
+ */
+ public void setPrecedence(SeamComponentPrecedenceType precedence);
}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentPrecedenceType.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentPrecedenceType.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentPrecedenceType.java 2007-07-05 17:11:58 UTC (rev 2329)
@@ -0,0 +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.jboss.tools.seam.core;
+
+/**
+ * List of component precedence types
+ * @author Alexey Kazakov
+ */
+public enum SeamComponentPrecedenceType {
+ BUILT_IN,
+ FRAMEWORK,
+ APPLICATION,
+ DEPLOYMENT,
+ MOCK
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-05 15:10:20 UTC (rev 2328)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-05 17:11:58 UTC (rev 2329)
@@ -10,18 +10,21 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
-import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.event.Change;
/**
* @author Viacheslav Kabanovich
*/
public abstract class SeamComponentDeclaration implements ISeamComponentDeclaration {
+
+ public static final String PATH_OF_NAME = "name";
+
/**
* Path of resource where this component is declared.
*/
@@ -99,5 +102,28 @@
boolean stringsEqual(String s1, String s2) {
return s1 == null ? s2 == null : s1.equals(s2);
}
-
-}
+
+ /**
+ * @param path
+ * @return source reference for some member of declaration.
+ * e.g. if you need source reference for @Name you have to
+ * invore getLocationFor("name");
+ */
+ public ISeamTextSourceReference getLocationFor(String path) {
+ // TODO
+ ISeamTextSourceReference reference = new ISeamTextSourceReference() {
+ public int getLength() {
+ return 0;
+ }
+
+ public IResource getResource() {
+ return SeamComponentDeclaration.this.getResource();
+ }
+
+ public int getStartPosition() {
+ return 0;
+ }
+ };
+ return reference;
+ }
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-05 15:10:20 UTC (rev 2328)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-05 17:11:58 UTC (rev 2329)
@@ -13,6 +13,7 @@
import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.SeamComponentMethodType;
+import org.jboss.tools.seam.core.SeamComponentPrecedenceType;
import org.jboss.tools.seam.core.event.Change;
public class SeamJavaComponentDeclaration extends SeamComponentDeclaration
@@ -22,6 +23,7 @@
protected ScopeType scopeType = ScopeType.UNSPECIFIED;
protected boolean stateful = false;
protected boolean entity = false;
+ protected SeamComponentPrecedenceType precedence;
protected IType type;
@@ -157,6 +159,11 @@
changes = Change.addChange(changes, new Change(this, "scope", scopeType, jd.scopeType));
scopeType = jd.scopeType;
}
+ if(precedence != jd.precedence) {
+ changes = Change.addChange(changes, new Change(this, "precedence", precedence, jd.precedence));
+ precedence = jd.precedence;
+ }
+
if(type != jd.type) type = jd.type;
if(stateful != jd.stateful) {
changes = Change.addChange(changes, new Change(this, "stateful", stateful, jd.stateful));
@@ -178,4 +185,17 @@
return changes;
}
-}
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamJavaComponentDeclaration#getPrecedence()
+ */
+ public SeamComponentPrecedenceType getPrecedence() {
+ return precedence;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamJavaComponentDeclaration#setPrecedence(org.jboss.tools.seam.core.SeamComponentPrecedenceType)
+ */
+ public void setPrecedence(SeamComponentPrecedenceType precedence) {
+ this.precedence = precedence;
+ }
+}
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2328 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-05 11:10:20 -0400 (Thu, 05 Jul 2007)
New Revision: 2328
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
Log:
EXIN-217 Added class path monitoring; added class loader for classes defined in jars.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-07-05 15:06:43 UTC (rev 2327)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-07-05 15:10:20 UTC (rev 2328)
@@ -42,7 +42,7 @@
static IFileScanner[] FILE_SCANNERS = {
new JavaScanner(),
new XMLScanner(),
- new LibraryScanner()
+// new LibraryScanner()
};
SampleResourceVisitor RESOURCE_VISITOR = new SampleResourceVisitor();
@@ -161,7 +161,12 @@
* java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
*/
protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
- throws CoreException {
+ throws CoreException {
+ if(getSeamProject().getClassPath().update()) {
+ System.out.println("update from class path");
+ getSeamProject().getClassPath().process();
+ }
+
if (kind == FULL_BUILD) {
fullBuild(monitor);
} else {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-05 15:06:43 UTC (rev 2327)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-05 15:10:20 UTC (rev 2328)
@@ -33,12 +33,14 @@
import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
import org.jboss.tools.seam.core.event.SeamProjectChangeEvent;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
+import org.jboss.tools.seam.internal.core.scanner.lib.ClassPath;
/**
* @author Viacheslav Kabanovich
*/
public class SeamProject implements ISeamProject {
IProject project;
+ ClassPath classPath = new ClassPath(this);
Map<String, SeamComponent> allComponents = new HashMap<String, SeamComponent>();
protected Set<ISeamFactory> allFactories = new HashSet<ISeamFactory>();
Set<ISeamContextVariable> allVariables = new HashSet<ISeamContextVariable>();
@@ -60,8 +62,13 @@
public void setProject(IProject project) {
this.project = project;
+ classPath.init();
load();
}
+
+ public ClassPath getClassPath() {
+ return classPath;
+ }
/**
* Loads results of last build, which are considered
@@ -104,6 +111,7 @@
Map<Object,ISeamComponentDeclaration> currentComponents = findComponentDeclarations(source);
+ List<Change> addedComponents = null;
for (int i = 0; i < components.length; i++) {
SeamComponentDeclaration loaded = (SeamComponentDeclaration)components[i];
SeamComponentDeclaration current = (SeamComponentDeclaration)currentComponents.remove(loaded.getId());
@@ -129,10 +137,9 @@
c = newComponent(name);
allComponents.put(name, c);
allVariables.add(c);
+ addedComponents = Change.addChange(addedComponents, new Change(this, null, null, c));
}
c.addDeclaration(components[i]);
- List<Change> changes = Change.addChange(null, new Change(this, null, null, c));
- fireChanges(changes);
if(loaded instanceof ISeamJavaComponentDeclaration) {
javaDeclarations.put(c.getClassName(), (SeamJavaComponentDeclaration)components[i]);
@@ -141,7 +148,7 @@
if(ci == c) continue;
SeamComponent cii = (SeamComponent)ci;
cii.addDeclaration(loaded);
- changes = Change.addChange(null, new Change(ci, null, null, loaded));
+ List<Change> changes = Change.addChange(null, new Change(ci, null, null, loaded));
fireChanges(changes);
}
} else if(loaded instanceof ISeamXmlComponentDeclaration) {
@@ -150,15 +157,17 @@
SeamJavaComponentDeclaration j = javaDeclarations.get(className);
if(j != null) {
c.addDeclaration(j);
- changes = Change.addChange(null, new Change(c, null, null, j));
+ List<Change> changes = Change.addChange(null, new Change(c, null, null, j));
fireChanges(changes);
}
}
}
+ fireChanges(addedComponents);
componentDeclarationsRemoved(currentComponents);
Map<Object, ISeamFactory> currentFactories = findFactoryDeclarations(source);
+ List<Change> addedFactories = null;
for (int i = 0; i < factories.length; i++) {
SeamFactory loaded = factories[i];
SeamFactory current = (SeamFactory)currentFactories.remove(loaded.getId());
@@ -166,26 +175,19 @@
List<Change> changes = current.merge(loaded);
fireChanges(changes);
continue;
-
}
+ allFactories.add(loaded);
+ allVariables.add(loaded);
+ addedFactories = Change.addChange(addedFactories, new Change(this, null, null, loaded));
}
+ fireChanges(addedFactories);
factoryDeclarationsRemoved(currentFactories);
-
}
/**
* Package local method called by builder.
- * @param component
* @param source
- */
- public void registerFactories(ISeamFactory[] list, IPath source) {
-
- }
-
- /**
- * Package local method called by builder.
- * @param source
*/
public void pathRemoved(IPath source) {
Iterator<SeamComponent> iterator = allComponents.values().iterator();
@@ -283,14 +285,6 @@
fireChanges(changes);
}
- //deprecated
- public Set<ISeamComponent> getComponentsByName(String name) {
- Set<ISeamComponent> result = new HashSet<ISeamComponent>();
- ISeamComponent c = getComponentByName(name);
- if(c != null) result.add(c);
- return result;
- }
-
/**
* @see org.jboss.tools.seam.core.ISeamProject#getComponentsByClass(java.lang.String)
*/
@@ -401,7 +395,7 @@
allVariables.remove(factory);
}
- SeamComponent getComponent(String name) {
+ public SeamComponent getComponent(String name) {
return allComponents.get(name);
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java 2007-07-05 15:10:20 UTC (rev 2328)
@@ -0,0 +1,250 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.scanner.lib;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.filesystems.impl.FileSystemsLoader;
+import org.jboss.tools.common.model.filesystems.impl.JarSystemImpl;
+import org.jboss.tools.common.model.project.IModelNature;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.model.util.XModelObjectUtil;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.SeamProject;
+import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
+
+/**
+ * Monitors class path of project and loads seam components of it.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public class ClassPath {
+ SeamProject project;
+ XModel model = null;
+ ClassLoader classLoader = null;
+
+ List<String> paths = null;
+
+ Set<String> processedPaths = new HashSet<String>();
+
+ /**
+ * Creates instance of class path for seam project
+ * @param project
+ */
+ public ClassPath(SeamProject project) {
+ this.project = project;
+ }
+
+ /**
+ * Returns seam project
+ * @return
+ */
+ public SeamProject getProject() {
+ return project;
+ }
+
+ /**
+ * Initialization of inner model.
+ */
+ public void init() {
+ IModelNature n = EclipseResourceUtil.getModelNature(project.getProject());
+ model = n == null ? EclipseResourceUtil.createObjectForResource(project.getProject()).getModel() : n.getModel();
+ }
+
+ static String[] SYSTEM_JARS = {"rt.jar", "jsse.jar", "jce.jar", "charsets.jar"};
+ static Set<String> SYSTEM_JAR_SET = new HashSet<String>();
+
+ static {
+ for (int i = 0; i < SYSTEM_JARS.length; i++) SYSTEM_JAR_SET.add(SYSTEM_JARS[i]);
+ }
+
+ /**
+ * Returns true if class path was up-to-date.
+ * Otherwise, updates inner model and disables class loader.
+ * @return
+ */
+ public boolean update() {
+ List<String> newPaths = null;
+ try {
+ newPaths = EclipseResourceUtil.getClassPath(project.getProject());
+ List<String> jre = getJREClassPath(project.getProject());
+ if(jre != null) newPaths.removeAll(jre);
+ } catch (Exception e) {
+ //TODO
+ }
+ if(paths == null && newPaths == null) return false;
+ if((newPaths == null || paths == null) || (paths.size() != newPaths.size())) {
+ paths = newPaths;
+ } else {
+ boolean b = false;
+ for (int i = 0; i < paths.size() && !b; i++) {
+ if(!paths.get(i).equals(newPaths.get(i))) b = true;
+ }
+ if(!b) return false;
+ paths = newPaths;
+ }
+ XModelObject object = model.getByPath("FileSystems");
+ XModelObject[] fs = object.getChildren("FileSystemJar");
+ Set<XModelObject> fss = new HashSet<XModelObject>();
+ for (int i = 0; i < fs.length; i++) fss.add(fs[i]);
+
+ for (int i = 0; i < paths.size(); i++) {
+ String path = paths.get(i);
+ if(!path.endsWith(".jar")) continue;
+ String fileName = new File(path).getName();
+ if(SYSTEM_JAR_SET.contains(fileName)) continue;
+ String jsname = "lib-" + fileName;
+ XModelObject o = model.getByPath("FileSystems").getChildByPath(jsname);
+ if(o != null) {
+ fss.remove(o);
+ } else {
+ o = object.getModel().createModelObject("FileSystemJar", null);
+ o.setAttributeValue("name", jsname);
+ o.setAttributeValue("location", path);
+ o.set(FileSystemsLoader.IS_ADDED_TO_CLASSPATH, "true");
+ object.addChild(o);
+// object.setModified(true);
+ }
+ }
+
+ for (XModelObject o: fss) {
+ String path = XModelObjectUtil.expand(o.getAttributeValue("location"), o.getModel(), null);
+ if("true".equals(o.get(FileSystemsLoader.IS_ADDED_TO_CLASSPATH))) {
+ o.removeFromParent();
+ } else if(!new File(path).exists()) {
+ o.removeFromParent();
+ }
+ }
+
+ classLoader = null;
+
+ return true;
+ }
+
+ /**
+ * Loads seam components from items recently added to class path.
+ */
+ public void process() {
+ Iterator<String> it = processedPaths.iterator();
+ while(it.hasNext()) {
+ String p = it.next();
+ if(paths.contains(p)) continue;
+ project.pathRemoved(new Path(p));
+ it.remove();
+ }
+ for (int i = 0; i < paths.size(); i++) {
+ String p = paths.get(i);
+ if(processedPaths.contains(p)) continue;
+ processedPaths.add(p);
+
+ LibraryScanner scanner = new LibraryScanner();
+ scanner.setClassPath(this);
+
+ String fileName = new File(p).getName();
+ if(SYSTEM_JAR_SET.contains(fileName)) continue;
+ String jsname = "lib-" + fileName;
+ XModelObject o = model.getByPath("FileSystems").getChildByPath(jsname);
+ if(!scanner.isLikelyComponentSource(o)) continue;
+
+ LoadedDeclarations c = null;
+ try {
+ c = scanner.parse(o, new Path(p));
+ } catch (Exception e) {
+ SeamCorePlugin.getDefault().logError(e);
+ }
+ if(c != null) componentsLoaded(c, new Path(p));
+ }
+ }
+
+ void componentsLoaded(LoadedDeclarations c, IPath path) {
+ if(c == null || c.getComponents().size() + c.getFactories().size() == 0) return;
+ project.registerComponents(c, path);
+ }
+
+ public ClassLoader getClassLoader() {
+ if(classLoader != null) return classLoader;
+
+ XModelObject object = model.getByPath("FileSystems");
+ XModelObject[] fs = object.getChildren("FileSystemJar");
+
+ List<URL> urls = new ArrayList<URL>();
+ for (int i = 0; i < fs.length; i++) {
+ JarSystemImpl jar = (JarSystemImpl)fs[i];
+ String tempLocation = jar.getTempLocation();
+ File f = new File(tempLocation);
+ if(f.isFile()) {
+ try {
+ URL u = new File(tempLocation).toURL();
+ if(u != null) urls.add(u);
+ } catch (MalformedURLException e) {
+ //ignore
+ }
+ }
+ }
+
+ classLoader = new URLClassLoader(urls.toArray(new URL[0]), Class.class.getClassLoader());
+
+ return classLoader;
+ }
+
+ public static List<String> getJREClassPath(IProject project) throws Exception {
+ if(!project.hasNature(JavaCore.NATURE_ID)) return null;
+ ArrayList<String> l = new ArrayList<String>();
+ IJavaProject javaProject = JavaCore.create(project);
+ IClasspathEntry[] es0 = javaProject.getRawClasspath();
+ IClasspathEntry[] es = null;
+ for (int i = 0; i < es0.length && es == null; i++) {
+ if(es0[i].getEntryKind() == IClasspathEntry.CPE_CONTAINER &&
+ es0[i].getPath().toString().equals("org.eclipse.jdt.launching.JRE_CONTAINER")) {
+ IClasspathContainer container = JavaCore.getClasspathContainer(es0[i].getPath(), javaProject);
+ if(container == null) continue;
+ es = container.getClasspathEntries();
+ }
+ }
+ if(es == null) return l;
+ for (int i = 0; i < es.length; i++) {
+ try {
+ String s = null;
+ String path = es[i].getPath().toString();
+ if(path.startsWith("/" + project.getName() + "/")) {
+ s = project.findMember(es[i].getPath().removeFirstSegments(1)).getLocation().toString();
+ } else if(new java.io.File(path).isFile()) {
+ s = path;
+ }
+ if(s != null) {
+ l.add(new java.io.File(s).getCanonicalPath());
+ }
+ } catch (IOException e) {
+ //ignore - we do not care about malformed URLs in class path here.
+ }
+ }
+ return l;
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-05 15:06:43 UTC (rev 2327)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-05 15:10:20 UTC (rev 2328)
@@ -14,9 +14,24 @@
import java.util.Map;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClassFile;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IParent;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.FileSystemsImpl;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.model.util.XModelObjectUtil;
import org.jboss.tools.seam.internal.core.SeamPropertiesDeclaration;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
@@ -26,6 +41,16 @@
* @author Viacheslav Kabanovich
*/
public class LibraryScanner implements IFileScanner {
+ ClassPath classPath = null;
+
+ //Now it is absolute file on disk
+ IPath sourcePath = null;
+
+ public LibraryScanner() {}
+
+ public void setClassPath(ClassPath classPath) {
+ this.classPath = classPath;
+ }
public boolean isRelevant(IFile f) {
if(f.getName().endsWith(".jar")) return true;
@@ -40,9 +65,7 @@
o = EclipseResourceUtil.getObjectByResource(f);
if(o == null || !o.getModelEntity().getName().equals("FileSystemJar")) return false;
}
- if(o.getChildByPath("META-INF/seam.properties") != null) return true;
- if(o.getChildByPath("META-INF/components.xml") != null) return true;
- return false;
+ return isLikelyComponentSource(o);
}
public LoadedDeclarations parse(IFile f) throws Exception {
@@ -53,6 +76,19 @@
o = EclipseResourceUtil.getObjectByResource(f);
if(o == null || !o.getModelEntity().getName().equals("FileSystemJar")) return null;
}
+ return parse(o, f.getFullPath());
+ }
+
+ public boolean isLikelyComponentSource(XModelObject o) {
+ if(o == null) return false;
+ if(o.getChildByPath("META-INF/seam.properties") != null) return true;
+ if(o.getChildByPath("META-INF/components.xml") != null) return true;
+ return false;
+ }
+
+ public LoadedDeclarations parse(XModelObject o, IPath path) throws Exception {
+ if(o == null) return null;
+ sourcePath = path;
XModelObject seamProperties = o.getChildByPath("META-INF/seam.properties");
XModelObject componentsXML = o.getChildByPath("META-INF/components.xml");
if(componentsXML == null && seamProperties == null) return null;
@@ -62,7 +98,7 @@
processJavaClasses(o, ds);
if(componentsXML != null) {
- LoadedDeclarations ds1 = new XMLScanner().parse(componentsXML, f.getFullPath());
+ LoadedDeclarations ds1 = new XMLScanner().parse(componentsXML, path);
if(ds1 != null) {
ds.getComponents().addAll(ds1.getComponents());
ds.getFactories().addAll(ds1.getFactories());
@@ -82,7 +118,7 @@
if(d == null) {
d = new SeamPropertiesDeclaration();
d.setId(properties[i]);
- d.setSourcePath(f.getFullPath());
+ d.setSourcePath(path);
d.setName(componentName);
ds1.put(componentName, d);
}
@@ -94,8 +130,47 @@
return ds;
}
- protected void processJavaClasses(XModelObject o, LoadedDeclarations ds) {
- //TODO
+ protected void processJavaClasses(XModelObject o, LoadedDeclarations ds) throws JavaModelException {
+ IJavaProject javaProject = JavaCore.create(classPath.getProject().getProject());
+ String location = o.getAttributeValue("location");
+ location = XModelObjectUtil.expand(location, o.getModel(), null);
+
+ IFile[] fs = ModelPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(location));
+ IPackageFragmentRoot root = null;
+ if(fs != null) for (int i = 0; i < fs.length && root == null; i++) {
+ root = javaProject.findPackageFragmentRoot(fs[i].getFullPath());
+ }
+ if(root == null) {
+ root = javaProject.findPackageFragmentRoot(new Path(location));
+ }
+ if(root == null) return;
+ process(root, ds);
+
}
+
+ protected void process(IParent element, LoadedDeclarations ds) throws JavaModelException {
+ if(element == null) return;
+ IJavaElement[] es = element.getChildren();
+ for (int i = 0; i < es.length; i++) {
+ if(es[i] instanceof IPackageFragment) {
+ process((IPackageFragment)es[i], ds);
+ } else if(es[i] instanceof IClassFile) {
+ IClassFile typeRoot = (IClassFile)es[i];
+ IType type = typeRoot.getType();
+ String className = type.getFullyQualifiedName();
+
+ Class<?> cls = null;
+ try {
+ cls = classPath.getClassLoader().loadClass(className);
+ } catch (NoClassDefFoundError e) {
+ //ignore
+ } catch (ClassNotFoundException e) {
+ //ignore
+ }
+ String result = cls == null ? "not found " + className : className;
+ System.out.println(result);
+ }
+ }
+ }
}
17 years, 5 months
JBoss Tools SVN: r2327 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-05 11:06:43 -0400 (Thu, 05 Jul 2007)
New Revision: 2327
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
Log:
http://jira.jboss.com/jira/browse/EXIN-365
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-05 14:56:04 UTC (rev 2326)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-05 15:06:43 UTC (rev 2327)
@@ -176,7 +176,8 @@
shape = elements.get(componentClassDatabaseTable.getSchema() + "." + componentClassDatabaseTable.getName());
if (shape == null) shape = getOrCreateDatabaseTable(componentClassDatabaseTable);
createConnections(classShape, shape);
- new Connection(classShape, shape);
+ if(!isConnectionExist(classShape, shape))
+ new Connection(classShape, shape);
}
RootClass rc = (RootClass)persistentClass;
Iterator iter = rc.getSubclassIterator();
@@ -184,7 +185,8 @@
SingleTableSubclass singleTableSubclass = (SingleTableSubclass)iter.next();
OrmShape singleTableSubclassShape = elements.get(singleTableSubclass.getEntityPersisterClass().getCanonicalName());
if (singleTableSubclassShape == null) singleTableSubclassShape = createShape(singleTableSubclass);
- new Connection(singleTableSubclassShape, shape);
+ if(!isConnectionExist(singleTableSubclassShape, shape))
+ new Connection(singleTableSubclassShape, shape);
}
// if (persistentClass.getPersistentClassMapping() != null) {
// Iterator iter =((IHibernateClassMapping)(persistentClass).getPersistentClassMapping()).getJoinIterator();
@@ -314,11 +316,12 @@
iterator = id.getColumnIterator();
while (iterator.hasNext()) {
Column column = (Column)iterator.next();
- if (targets.get(column.getName()) != null) {
+ if (targets.get(column.getName()) != null && !isConnectionExist(s, (Shape)targets.get(column.getName()))) {
new Connection(s, (Shape)targets.get(column.getName()));
}
}
- new Connection(shape, s);
+ if(!isConnectionExist(shape, s))
+ new Connection(shape, s);
firePropertyChange(REFRESH, null, null);
}
}
@@ -337,27 +340,31 @@
if (component instanceof Component) {//valueType.isComponentType()
OrmShape childShape = (OrmShape)elements.get(((Component)component).getComponentClassName());
if(childShape == null) childShape = getOrCreateComponentClass(property);
- new Connection((Shape)(componentShape.getChildren().get(1)), childShape);
+ if(!isConnectionExist((Shape)(componentShape.getChildren().get(1)), childShape))
+ new Connection((Shape)(componentShape.getChildren().get(1)), childShape);
} else if (collection.isOneToMany()) {
OrmShape childShape = getOrCreateAssociationClass(property);
- new Connection((Shape)(componentShape.getChildren().get(1)), childShape);
+ if(!isConnectionExist((Shape)(componentShape.getChildren().get(1)), childShape))
+ new Connection((Shape)(componentShape.getChildren().get(1)), childShape);
OrmShape keyTableShape = getOrCreateDatabaseTable(collection.getKey().getTable());
Iterator iter = collection.getKey().getColumnIterator();
while (iter.hasNext()) {
Column col = (Column)iter.next();
Shape keyColumnShape = keyTableShape.getChild(col);
- if (keyColumnShape != null) new Connection((Shape)(componentShape.getChildren().get(0)), keyColumnShape);
+ if (keyColumnShape != null && !isConnectionExist((Shape)(componentShape.getChildren().get(0)), keyColumnShape)) new Connection((Shape)(componentShape.getChildren().get(0)), keyColumnShape);
}
} else if (collection.isMap() || collection.isSet()) {
OrmShape childShape = getOrCreateDatabaseTable(collection.getCollectionTable());
Shape keyShape = childShape.getChild((Column)((DependantValue)((Shape)componentShape.getChildren().get(0)).getOrmElement()).getColumnIterator().next());
- new Connection((Shape)componentShape.getChildren().get(0), keyShape);
+ if(!isConnectionExist((Shape)componentShape.getChildren().get(0), keyShape))
+ new Connection((Shape)componentShape.getChildren().get(0), keyShape);
Iterator iter = ((SimpleValue)((Shape)componentShape.getChildren().get(1)).getOrmElement()).getColumnIterator();
while (iter.hasNext()) {
Column col = (Column)iter.next();
Shape elementShape = childShape.getChild(col);
- new Connection((Shape)componentShape.getChildren().get(1), elementShape);
+ if(!isConnectionExist((Shape)componentShape.getChildren().get(1), elementShape))
+ new Connection((Shape)componentShape.getChildren().get(1), elementShape);
}
}
setDirty(true);
@@ -373,10 +380,12 @@
OrmShape tableShape = (OrmShape)elements.get(component.getTable().getSchema() + "." + component.getTable().getName());
if (tableShape == null) tableShape = getOrCreateDatabaseTable(component.getTable());
createConnections(classShape, tableShape);
- new Connection(classShape, tableShape);
+ if(!isConnectionExist(classShape, tableShape))
+ new Connection(classShape, tableShape);
Shape parentShape = ((SpecialOrmShape)classShape).getParentShape();
OrmShape parentClassShape = (OrmShape)elements.get(((Property)parentShape.getOrmElement()).getPersistentClass().getClassName());
- new Connection(parentShape, parentClassShape);
+ if(!isConnectionExist(parentShape, parentClassShape))
+ new Connection(parentShape, parentClassShape);
}
return classShape;
}
@@ -390,7 +399,8 @@
OrmShape tableShape = (OrmShape)elements.get(component.getAssociatedClass().getTable().getSchema() + "." + component.getAssociatedClass().getTable().getName());
if (tableShape == null) tableShape = getOrCreateDatabaseTable(component.getAssociatedClass().getTable());
createConnections(classShape, tableShape);
- new Connection(classShape, tableShape);
+ if(!isConnectionExist(classShape, tableShape))
+ new Connection(classShape, tableShape);
}
return classShape;
}
17 years, 5 months
JBoss Tools SVN: r2326 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors: parts and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-05 10:56:04 -0400 (Thu, 05 Jul 2007)
New Revision: 2326
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
Log:
http://jira.jboss.com/jira/browse/EXIN-365
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-05 14:00:00 UTC (rev 2325)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-05 14:56:04 UTC (rev 2326)
@@ -254,7 +254,8 @@
for (int j = 0; j < databaseColumns.size(); j++) {
if (databaseColumn.getName().equals(((Column)((Shape)databaseColumns.get(j)).getOrmElement()).getName())) {
Shape databaseShape = (Shape)databaseColumns.remove(j);
- new Connection(shape, databaseShape);
+ if(!isConnectionExist(shape, databaseShape))
+ new Connection(shape, databaseShape);
databaseColumns2.add(i++, databaseShape);
}
}
@@ -264,7 +265,16 @@
}
databaseColumns.addAll(databaseColumns2);
}
-
+
+ private boolean isConnectionExist(Shape source, Shape target){
+ Connection conn;
+ for(int i=0;i<source.getSourceConnections().size();i++){
+ conn = (Connection)source.getSourceConnections().get(i);
+ if(conn.getTarget().equals(target)) return true;
+ }
+ return false;
+ }
+
public String[] getChildrenLocations() {
return childrenLocations;
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2007-07-05 14:00:00 UTC (rev 2325)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2007-07-05 14:56:04 UTC (rev 2326)
@@ -231,8 +231,9 @@
return ResourceManager.getInstance().getColor(new RGB(112,161,99));
else if (getCastedModel().getOrmElement() instanceof Table || getCastedModel().getOrmElement() instanceof Column)
return ResourceManager.getInstance().getColor(new RGB(66,173,247));
- else
- throw new IllegalArgumentException();
+ //else
+ //throw new IllegalArgumentException();
+ return ResourceManager.getInstance().getColor(new RGB(190,190,190));
}
private class ShapesSelectionEditPolicy extends SelectionEditPolicy {
17 years, 5 months
JBoss Tools SVN: r2325 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-05 10:00:00 -0400 (Thu, 05 Jul 2007)
New Revision: 2325
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
Log:
http://jira.jboss.com/jira/browse/EXIN-216 Removed Set getComponentBuName(). Added ISeamComponent getComponent(). Project can have only one ISeamComponent with unique name. If project has a few seam components with the same name,
then corresponding ISeamComponent will have all declarations of components with this name.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-07-05 12:46:35 UTC (rev 2324)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-07-05 14:00:00 UTC (rev 2325)
@@ -20,10 +20,14 @@
public static String NATURE_ID = "org.jboss.tools.seam.core.seam";
/**
+ * Returns seam component. Project can have only one ISeamComponent with
+ * unique name. If project has a few seam components with the same name,
+ * then corresponding ISeamComponent will have all declarations
+ * of components with this name.
* @param name of component.
- * @return Set of ISeamComponents by name.
+ * @return ISeamComponent.
*/
- public Set<ISeamComponent> getComponentsByName(String name);
+ public ISeamComponent getComponent(String name);
/**
* @param scope type.
17 years, 5 months
JBoss Tools SVN: r2324 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-05 08:46:35 -0400 (Thu, 05 Jul 2007)
New Revision: 2324
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties
Log:
JBIDE-559: Hibernate diagram editor cleanup
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java 2007-07-05 12:46:35 UTC (rev 2324)
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * 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.hibernate.ui.view;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.MissingResourceException;
+import java.util.Properties;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class ViewPlugin extends AbstractUIPlugin {
+ //The shared instance.
+ private static ViewPlugin plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ public static final ResourceBundle BUNDLE_IMAGE = ResourceBundle.getBundle(ViewPlugin.class.getPackage().getName() + ".image");
+
+ // add Tau 28.04.2005 for trace
+ public static boolean TRACE = false;
+ public static boolean TRACE_VIEW = false;
+ public static boolean TRACE_WIZARD = false;
+
+ public static final String PLUGIN_ID = "org.jboss.tools.hibernate.view";
+ public static final String autoMappingSettingPrefPage = "autoMappingSettingPrefPage";
+
+ /**
+ * The constructor.
+ */
+ public ViewPlugin() {
+ super();
+ plugin = this;
+
+ try {
+ resourceBundle = ResourceBundle.getBundle(PLUGIN_ID + ".EditPluginResources");
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+
+// if (TRACE || TRACE_VIEW )
+// ExceptionHandler.logObjectPlugin("ViewPlugin()",PLUGIN_ID, null);
+
+ }
+
+ public static ImageDescriptor getImageDescriptor(String name) {
+ String iconPath = "images/";
+ try {
+ URL installURL = getDefault().getBundle().getEntry("/");;
+ URL url = new URL(installURL, iconPath + name);
+ return ImageDescriptor.createFromURL(url);
+ } catch (MalformedURLException e) {
+ // should not happen
+ return ImageDescriptor.getMissingImageDescriptor();
+ }
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static ViewPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle,
+ * or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = ViewPlugin.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString(key) : key;
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+
+ // add tau 05.04.2005
+ public static Shell getActiveWorkbenchShell() {
+ IWorkbenchWindow window = getActiveWorkbenchWindow();
+ if (window != null) {
+ return window.getShell();
+ }
+ return null;
+ }
+
+ // add tau 05.04.2005
+ public static IWorkbenchWindow getActiveWorkbenchWindow() {
+ return getDefault().getWorkbench().getActiveWorkbenchWindow();
+ }
+
+ // add tau 19.04.2005
+ public static IWorkbenchPage getPage(){
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ return window.getActivePage();
+ }
+
+ // add Tau 28.04.2005 for trace
+ static {
+
+ String value = Platform.getDebugOption(PLUGIN_ID + "/debug");
+ if (value != null && value.equalsIgnoreCase("true")) TRACE = true;
+
+ value = Platform.getDebugOption(PLUGIN_ID + "/debug/view");
+ if (value != null && value.equalsIgnoreCase("true")) TRACE_VIEW = true;
+
+ value = Platform.getDebugOption(PLUGIN_ID + "/debug/view/wizard");
+ if (value != null && value.equalsIgnoreCase("true")) TRACE_WIZARD = true;
+
+ }
+
+ // add tau 22.12.2005
+ public static void loadPreferenceStoreProperties(Properties properties, String key){
+ IPreferenceStore preferenceStore = ViewPlugin.getDefault().getPreferenceStore();
+ String value = preferenceStore.getString(key);
+ if (value.length() != 0){
+ ByteArrayInputStream bain = new ByteArrayInputStream(value.getBytes());
+ try {
+ properties.load(bain);
+ } catch (IOException e) {
+// ExceptionHandler.logThrowableError(e, null);
+ }
+ }
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties 2007-07-05 12:46:35 UTC (rev 2324)
@@ -0,0 +1,96 @@
+#OrmModelImageVisitor
+OrmModelImageVisitor.OrmModel=exdOrmModel.gif
+OrmModelImageVisitor.DatabaseSchema=exdDatabaseSchema.gif
+OrmModelImageVisitor.DatabaseTable=exdDatabaseTable.gif
+OrmModelImageVisitor.DatabaseView=exdDatabaseView.gif
+OrmModelImageVisitor.DatabaseConstraint=exdDatabaseConstraint1.gif
+OrmModelImageVisitor.Package=exdPackage.gif
+OrmModelImageVisitor.Mapping=exdMapping.gif
+OrmModelImageVisitor.MappingStorage=exdMappingStorage.gif
+OrmModelImageVisitor.PersistentClass=exdPersistentClass.gif
+OrmModelImageVisitor.PersistentField=exdPersistentField.gif
+
+OrmModelImageVisitor.PersistentClassMapping=exdPersistentClassMapping.gif
+#OrmModelImageVisitor.PersistentRootClassMapping=exdPersistentRootClassMapping.gif
+OrmModelImageVisitor.PersistentRootClassMapping=exdPersistentRootClassMappingC.gif
+OrmModelImageVisitor.PersistentSubclassMapping=exdPersistentSubclassMapping.gif
+OrmModelImageVisitor.PersistentUnionSubclassMapping=exdPersistentUnionSubclassMapping.gif
+OrmModelImageVisitor.PersistentJoinedSubclassMapping=exdPersistentJoinedSubclassMapping.gif
+
+
+OrmModelImageVisitor.PersistentFieldMapping=exdPersistentFieldMapping1.gif
+OrmModelImageVisitor.PersistentValueMapping=exdPersistentValueMapping1.gif
+
+##OrmModelImageVisitor for PersistentField
+OrmModelImageVisitor.PersistentFieldAny=any.gif
+OrmModelImageVisitor.PersistentFieldComponent=component.gif
+OrmModelImageVisitor.PersistentFieldComponent_id=component_id.gif
+OrmModelImageVisitor.PersistentFieldMany-to-any=many-to-any.gif
+OrmModelImageVisitor.PersistentFieldMany-to-many=many-to-many.gif
+OrmModelImageVisitor.PersistentFieldMany-to-one=many-to-one.gif
+OrmModelImageVisitor.PersistentFieldMany-to-one_id=many-to-one_id.gif
+OrmModelImageVisitor.PersistentFieldOne-to-many=one-to-many.gif
+OrmModelImageVisitor.PersistentFieldOne-to-one=one-to-one.gif
+OrmModelImageVisitor.PersistentFieldOne-to-one_id=one-to-one_id.gif
+OrmModelImageVisitor.PersistentFieldSimple=simple.gif
+OrmModelImageVisitor.PersistentFieldSimple_id=simple_id.gif
+OrmModelImageVisitor.PersistentFieldSimple_version=simple_version.gif
+OrmModelImageVisitor.PersistentFieldNot_mapped=not_mapped.gif
+OrmModelImageVisitor.PersistentFieldParent=parent.gif
+
+##OrmModelImageVisitor for Collection
+OrmModelImageVisitor.PersistentFieldCollection=collection.gif
+OrmModelImageVisitor.Collection_array=collection_array.gif
+OrmModelImageVisitor.Collection_primitive_array=collection_primitive_array.gif
+OrmModelImageVisitor.Collection_set=collection_set.gif
+OrmModelImageVisitor.Collection_bag=collection_bag.gif
+OrmModelImageVisitor.Collection_idbag=collection_idbag.gif
+OrmModelImageVisitor.Collection_list=collection_list.gif
+OrmModelImageVisitor.Collection_map=collection_map.gif
+OrmModelImageVisitor.NamedQueryMapping=hql.gif
+
+
+##OrmModelImageVisitor for IDatabaseColumn
+OrmModelImageVisitor.DatabaseColumn=exdDatabaseColumn.gif
+OrmModelImageVisitor.DatabasePrimaryKeyColumn=exdDatabasePrimaryKeyColumn.gif
+OrmModelImageVisitor.DatabaseForeignKeyColumn=exdDatabaseForeignKeyColumn.gif
+OrmModelImageVisitor.DatabaseDiscriminatorColumn=exdDatabaseDiscriminatorColumn.gif
+OrmModelImageVisitor.DatabaseVersionColumn=exdDatabaseVersionColumn.gif
+OrmModelImageVisitor.DatabasePrimaryForeignKeysColumn=exdDatabasePrimaryForeignKeysColumn.gif
+OrmModelImageVisitor.DatabaseUniqueKeyColumn=unique_key.gif
+
+#Explorer
+Explorer.RootPackageClassField=exdPackage.gif
+Explorer.RootClassField=exdPersistentClassMapping.gif
+Explorer.RootStorageClassField=exdPersistentField.gif
+Explorer.WizardAction=exdWizardAction1.gif
+Explorer.DialogAction=exdDialogAction1.gif
+Explorer.Delete=delete_edit.gif
+Explorer.hibernateAddMappingWizard=exdMapping_new.gif
+Explorer.refreshOrmGef=refresh_orm_gef.gif
+
+ExplorerBase.RootSchemaTableColumn=exdDatabaseSchema.gif
+ExplorerBase.RootTableColumn=exdDatabaseColumn.gif
+
+#Wizard
+Wizard.Title=wiz_icon.gif
+
+#Decorator
+Decorator.Error=error_view.gif
+Decorator.Warning=warning_vew.gif
+Decorator.Unknown=unknown.gif
+
+#NamedQueriesWizard
+NamedQueriesWizard.object=object.gif
+NamedQueriesWizard.object_none=object_none.gif
+NamedQueriesWizard.property=property.gif
+NamedQueriesWizard.error=error_st_obj.gif
+
+#TreeModel
+TreeModelLabel.jar_obj=jar_obj.gif
+TreeModelLabel.file_obj=file_obj.gif
+TreeModelLabel.fldr_obj=fldr_obj.gif
+
+#VisualMapping
+VisualMapping.shevronUp=shevron_up.gif
+VisualMapping.shevronDown=shevron_down.gif
17 years, 5 months
JBoss Tools SVN: r2323 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui: view and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-05 08:46:15 -0400 (Thu, 05 Jul 2007)
New Revision: 2323
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ActionOrmTree.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ContentProviderVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java
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/OrmContentProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelImageVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ViewsAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/views.properties
Log:
JBIDE-559: Hibernate diagram editor cleanup
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ActionOrmTree.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ActionOrmTree.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ActionOrmTree.java 2007-07-05 12:46:15 UTC (rev 2323)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.jface.action.Action;
+import org.eclipse.jface.viewers.TreeViewer;
+
+// tau 22.11.2005
+// edit tau 27.01.2006
+
+public abstract class ActionOrmTree extends Action {
+
+ private TreeViewer viewer;
+
+ public ActionOrmTree() {
+ super();
+ }
+
+ public void run(TreeViewer viewer) {
+ this.viewer = viewer;
+ run();
+ }
+
+ public void run() {
+ try {
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("!TRY ActionOrmTree.run() lock(=" + OrmCore.lock + ").acquire(), Depth=" + OrmCore.lock.getDepth());
+// ((OrmContentProvider)viewer.getContentProvider()).lockMenu = true; // add tau 06.12.2005
+// OrmCore.lock.acquire(); // add tau 05.12.2005
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("!RUN ActionOrmTree.run() lock(=" + OrmCore.lock + ").acquire(), Depth=" + OrmCore.lock.getDepth());
+//
+// OrmCore.getDefault().setLockResourceChangeListener(true);
+
+ this.rush();
+
+ } finally {
+// OrmCore.lock.release();
+// ((OrmContentProvider)viewer.getContentProvider()).lockMenu = false; // add tau 06.12.2005
+//
+// // add tau 27.01.2006
+// OrmCore.getDefault().setLockResourceChangeListener(false);
+
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("!Finally ActionOrmTree.run() lock(=" + OrmCore.lock + ").acquire(), Depth=" + OrmCore.lock.getDepth());
+ }
+
+ }
+
+ protected abstract void rush();
+
+ public TreeViewer getViewer() {
+ return viewer;
+ }
+
+ public ActionOrmTree setViewer(TreeViewer viewer) {
+ this.viewer = viewer;
+ return this;
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ContentProviderVisitor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ContentProviderVisitor.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ContentProviderVisitor.java 2007-07-05 12:46:15 UTC (rev 2323)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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 java.util.ResourceBundle;
+
+import org.hibernate.mapping.Column;
+
+
+public class ContentProviderVisitor {
+
+ private static final Object[] nullChildren = new Object[0];
+
+ private ResourceBundle BUNDLE = ResourceBundle.getBundle(ContentProviderVisitor.class.getPackage().getName() + ".views");
+
+ public Object visitDatabaseColumn(Column column, Object argument) {
+ return null;
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java 2007-07-05 12:46:15 UTC (rev 2323)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * 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.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+import org.hibernate.cfg.Configuration;
+
+
+public class ObjectEditorInput implements IEditorInput{
+
+ protected Object fObject;
+ protected Configuration configuration;
+
+ public ObjectEditorInput(Object object) {
+ fObject = object;
+ }
+
+ public ObjectEditorInput(Configuration configuration, Object object) {
+ fObject = object;
+ this.configuration = configuration;
+ }
+
+ public Object getObject() {
+ return fObject;
+ }
+
+
+ public boolean exists() {
+ return false;
+ }
+
+
+ public ImageDescriptor getImageDescriptor() {
+ return ImageDescriptor.getMissingImageDescriptor();
+ }
+
+
+ public String getName() {
+ return "";
+ }
+
+
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+
+ public String getToolTipText() {
+ return "";
+ }
+
+
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+}
Added: 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 (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java 2007-07-05 12:46:15 UTC (rev 2323)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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 java.util.HashMap;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.internal.ObjectPluginAction;
+import org.hibernate.cfg.Configuration;
+import org.jboss.tools.hibernate.ui.view.ViewPlugin;
+
+public class OpenDiagramActionDelegate implements IObjectActionDelegate {
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
+
+ public void run(IAction action) {
+ HashMap hashMap = new HashMap();
+ ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
+ Object rootClass = ((TreeSelection)objectPluginAction.getSelection()).getFirstElement();
+ ObjectEditorInput input = (ObjectEditorInput)hashMap.get(rootClass);
+ Configuration configuration = (Configuration)(((TreeSelection)objectPluginAction.getSelection()).getPaths()[0]).getSegment(1);
+ if(input == null) {
+ input = new ObjectEditorInput(configuration, rootClass);
+ hashMap.put(rootClass, input);
+ }
+ try {
+ IDE.openEditor(ViewPlugin.getPage(),input ,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor");
+ } catch (PartInitException e) {
+// ExceptionHandler.logThrowableError(e,"OpenEditor");
+ }
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmContentProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmContentProvider.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmContentProvider.java 2007-07-05 12:46:15 UTC (rev 2323)
@@ -0,0 +1,460 @@
+/*******************************************************************************
+ * 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.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.TreeItem;
+
+
+public class OrmContentProvider implements ITreeContentProvider/*, IOrmModelListener, IOrmProjectChangedListener*/ {
+
+ protected static final int PACKAGE_CLASS_FIELD_CONTENT_PROVIDER = 1;
+ protected static final int CLASS_FIELD_CONTENT_PROVIDER = 2;
+ protected static final int STORAGE_CLASS_FIELD_CONTENT_PROVIDER = 3;
+
+ protected static final int SCHEMA_TABLE_COLUMN_CONTENT_PROVIDER = 4;
+ protected static final int TABLE_COLUMN_CONTENT_PROVIDER = 5;
+
+ protected TreeViewer viewer;
+
+ private static final ContentProviderVisitor contentProviderVisitor = new ContentProviderVisitor();
+ private static final Object[] nullChildren = new Object[0];
+ private static Object[] children = new Object[0];
+ private int tip;
+ private boolean sorting;
+
+ private Object[] expandedElements = null;
+ private ISelection selectionElements = null;
+
+ private String[] beforeChangeElements = null;
+ private String beforeChangeSelectionElementQualifiedName = null;
+
+ public boolean lockMenu = false;
+
+
+ public OrmContentProvider(int tip){
+ this.tip = tip;
+ sorting = true; // default - sort
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if (children == null)
+ children = nullChildren;
+
+ if (!sorting){
+ sorting = true; // default - sort
+ } else {
+// Arrays.sort(children, comparator);
+ }
+ return children;
+ }
+
+ public Object getParent(Object element) {
+
+ //if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("!!! OrmContentProvider.getParent(Object element):" + element + ", tip="+tip);
+
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ //TODO EXP 3d
+ //return getChildren(element).length > 0;
+// if (element instanceof IDatabaseColumn ||
+// element instanceof IDatabaseConstraint ||
+// element instanceof INamedQueryMapping ||
+// element instanceof String) {
+// return false;
+// } else
+ return true;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.inputChanged():"+", tip="+tip+", this= " + this);
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.inputChanged(): OLD_INPUT= " + oldInput + ", tip="+tip);
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.inputChanged(): NEW_INPUT= " + newInput + ", tip="+tip);
+//
+// this.viewer = (TreeViewer) viewer;
+//
+// if (oldInput != null) {
+// removeListenerFrom((IOrmModel) oldInput);
+// }
+//
+// if (newInput != null) {
+// addListenerTo((IOrmModel) newInput);
+// }
+ }
+
+// protected void removeListenerFrom(IOrmModel model) {
+// model.removeListener(this);
+// IOrmProject[] projects = model.getOrmProjects();
+// for (int i = 0; i < projects.length; i++) {
+// IOrmProject project = projects[i];
+// project.removeChangedListener(this);
+// // add tau 12.09.2005
+// //project.removeBeforeChangeListener(this);
+// }
+// }
+
+// protected void addListenerTo(IOrmModel model) {
+// model.addListener(this);
+// IOrmProject[] projects = model.getOrmProjects();
+// for (int i = 0; i < projects.length; i++) {
+// IOrmProject project = projects[i];
+// project.addChangedListener(this);
+// // add tau 12.09.2005
+// //project.addBeforeChangeListener(this);
+// }
+// }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.hibernate.core.IOrmModelListener#projectsChanged(org.jboss.tools.hibernate.core.OrmModelEvent)
+ */
+// public void modelChanged(OrmModelEvent event) {
+//
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW )
+// ExceptionHandler.logInfo("OrmContentProvider.modelChanged(OrmModelEvent)" + ",tip="+tip);
+//
+// // Add tau 21.06.2005
+// int type = event.getType();
+// if (type == OrmModelEvent.AddProject){
+// ((IOrmProject) event.getProject()).addChangedListener(this);
+// // add tau 28.11.2005
+// //((IOrmProject) event.getProject()).addBeforeChangeListener(this);
+// }
+//
+//
+// // Update tau 18.05.2005
+// final IOrmModel model = event.getOrmModel();
+// viewerRefreshUpdate(model, false);
+//
+// /*
+// Control control = viewer.getControl();
+// if (control == null || control.isDisposed())
+// return;
+//
+// control.getDisplay().syncExec(new Runnable() {
+// public void run() {
+// if (!viewer.getControl().isDisposed()){
+// viewer.getTree().setRedraw(false);
+// viewer.refresh(model, true);
+// viewer.getTree().setRedraw(true);
+// // add 04.04.2005
+// //viewer.getControl().setFocus();
+// }
+// }
+// });
+// */
+//
+// }
+
+ /*
+ * edit 05.12.2005
+ *
+ * @see org.jboss.tools.hibernate.core.IOrmProjectListener#modelChanged(org.jboss.tools.hibernate.core.OrmProjectEvent)
+ */
+// public void projectChanged(OrmProjectEvent event, boolean flagUpdate) {
+//
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.projectChanged((eventSource=," + event.getSource()+ "), tip="+tip);
+//
+// final IOrmProject project = event.getProject();
+//
+// viewerRefreshUpdate(project, flagUpdate);
+//
+// /* del tau 05.2005
+// //!!! event from OrmBuilder == IOrmProject - edit tau 05.12.2005
+// if (event.getSource() instanceof IOrmProject || !(isBuilder(project.getProject()))){
+// viewerRefresh(project);
+// }
+// */
+// }
+
+ /*
+ public void projectBeforeChange(OrmProjectEvent event) {
+
+ Control control = viewer.getControl();
+ if (control == null || control.isDisposed()) {
+ if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("->NO REFRESH, control="+ control + ",tip="+tip);
+ return;
+ }
+
+ // add tau 17.11.2005
+ if (beforeChangeElements != null){
+ if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("->projectBeforeChange("+event.getSource()+")beforeChangeElements != null"+",tip="+tip);
+ return;
+ }
+
+ // TODO (!tau->tau) asyncExec???
+ //control.getDisplay().asyncExec(new Runnable() {
+ control.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ // edit tau 24.11.2005 +OrmCore.lock.acquire();
+ try {
+ if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> TRY projectBeforeChange(...) lock(=" + OrmCore.lock + ").acquire(), Depth=" + OrmCore.lock.getDepth() + ", tip="+tip);
+ OrmCore.lock.acquire();
+ lockMenu = true; // add tau 05.12.2005
+ if (!viewer.getControl().isDisposed()) {
+ beforeChangeElements = saveElements();
+ beforeChangeSelectionElementQualifiedName = saveSelection();
+ }
+ } finally {
+ OrmCore.lock.release();
+ lockMenu = false; // add tau 05.12.2005
+ if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> END projectBeforeChange(...)=lock(=" + OrmCore.lock.toString() + ").release(), Depth=" + OrmCore.lock.getDepth() + ", tip="+tip);
+ }
+ }
+ });
+ }
+ */
+
+
+ public int getTip() {
+ return tip;
+ }
+
+ public void setSorting(boolean sorting) {
+ this.sorting = sorting;
+ }
+
+ /*
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+ */
+
+ public Object[] getExpandedElements() {
+ return expandedElements;
+ }
+
+ public void setExpandedElements(Object[] expandedElements) {
+ this.expandedElements = expandedElements;
+ }
+
+ public ISelection getSelectionElements() {
+ return selectionElements;
+ }
+
+ public void setSelectionElements(ISelection selectionElements) {
+ this.selectionElements = selectionElements;
+ }
+
+ public void viewerRefreshUpdate(final Object element, final boolean flagUpdate) {
+
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.viewerRefresh(...)1= " + element + " ,flagUpdate = "+ flagUpdate);
+
+ Control control = viewer.getControl();
+
+ if (control == null || control.isDisposed()) {
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> NO REFRESH, control="+ control + ",tip="+tip);
+ return;
+ }
+
+ Display display = control.getDisplay();
+
+ /*
+ Thread tc = display.getSyncThread();
+ boolean dd = display.isDisposed();
+ boolean dd2 = display.isDisposed();
+ Thread tt = display.getThread();
+
+ // add tau 24.01.2006
+ display.wake();
+
+ if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.viewerRefresh(...)4= " + tc + tt + dd + dd2);
+ */
+
+ // edit tau 30.01.2006
+ //display.syncExec(new Runnable() {
+ display.asyncExec(new Runnable() {
+
+ public void run() {
+ // add try and OrmCore.lock.acquire(); - tau 01.12.2005
+ try {
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> TRY REFRESH lock(=" + OrmCore.lock + ").acquire(), Depth=" + OrmCore.lock.getDepth() + ", viewerRefresh("+element+"),tip="+tip);
+// OrmCore.lock.acquire();
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> RUN REFRESH, viewerRefresh("+element+"), isDisposed()="+ viewer.getControl().isDisposed() + ",tip="+tip);
+
+ if (!viewer.getControl().isDisposed()) {
+
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> REFRESHing, viewerRefresh("+element+"),tip="+tip);
+
+ viewer.getTree().setRedraw(false);
+
+ // add tau 02.12.2005 SAVE
+ if (beforeChangeElements == null){
+ beforeChangeElements = saveElements();
+ beforeChangeSelectionElementQualifiedName = saveSelection();
+ }
+
+ if (flagUpdate) {
+ // Update
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("viewerRefresh("+element+") -> viewer.update(element, null), tip = "+tip);
+ viewer.update(element, null);
+ } else {
+ // REFRESH
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("viewerRefresh("+element+") -> viewer.refresh(element, true), tip = "+tip);
+ viewer.refresh(element, true);
+ }
+
+ // LOAD
+ if (beforeChangeElements != null){
+ restoreElements(beforeChangeElements, beforeChangeSelectionElementQualifiedName);
+ beforeChangeElements = null;
+ }
+
+ viewer.getTree().setRedraw(true);
+ }
+ } finally {
+// OrmCore.lock.release();
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> END REFRESH=lock(=" + OrmCore.lock.toString() + ").release(), Depth=" + OrmCore.lock.getDepth() + ", viewerRefresh("+element+"),tip="+tip);
+ }
+ }
+ });
+ }
+
+
+ // tau 08.11.2005
+ private String[] saveElements() {
+ // add tau 15.11.2005
+ String [] expandedElements = null;
+ int length = viewer.getExpandedElements().length;
+ if (length != 0) {
+ expandedElements = new String [length];
+ }
+ //
+
+ int j = 0;
+ TreeItem[] items = viewer.getTree().getItems();
+ for (int i = 0; i < items.length; i++) {
+ TreeItem item = items[i];
+ j = saveItem(item, expandedElements, j);
+ }
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW) ExceptionHandler.logInfo(".saveElements()= " + length + ",tip="+tip);
+ return expandedElements;
+ }
+
+ // tau 08.11.2005
+ private int saveItem(TreeItem treeItem, String [] expandedElements, int j) {
+// if (treeItem.getExpanded()) {
+// if (treeItem.getData() instanceof IOrmElement ){
+// expandedElements[j++] = ((IOrmElement)treeItem.getData()).getQualifiedName(treeItem);
+// TreeItem[] items = treeItem.getItems();
+// for (int i = 0; i < items.length; i++) {
+// j = saveItem(items[i], expandedElements, j);
+// }
+// } else {
+// return j;
+// }
+//
+// }
+ return j;
+ }
+
+ private String saveSelection() {
+ String selectionElementQualifiedName = ""; // default
+ ISelection selection = viewer.getSelection();
+ if (!selection.isEmpty()) {
+ TreeItem[] selectionTreeItems = viewer.getTree().getSelection();
+ if (selectionTreeItems.length != 0) {
+ TreeItem selectionItem = selectionTreeItems[0];
+ if (selection instanceof StructuredSelection) {
+ // edit tau 05.04.2006 for /ESORM-562
+ //IOrmElement selectionElement = (IOrmElement) ((StructuredSelection) selection).getFirstElement();
+ Object selectionElement = ((StructuredSelection) selection).getFirstElement();
+// if (selectionElement instanceof IOrmElement) {
+// IOrmElement selectionOrmElement = (IOrmElement) selectionElement;
+// selectionElementQualifiedName = selectionOrmElement.getQualifiedName(selectionItem);
+// }
+ }
+ }
+ }
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW) ExceptionHandler.logInfo(".saveSelection()= " + selectionElementQualifiedName + ",tip="+tip);
+ return selectionElementQualifiedName;
+ }
+
+ private void restoreElements(String[] expandedElements, String selectionElementQualifiedName) {
+ //viewer.getTree().setRedraw(false);
+ checkItem(viewer.getTree().getItems(), expandedElements, selectionElementQualifiedName);
+ //viewer.getTree().setRedraw(true);
+ //if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW) ExceptionHandler.logInfo(".restoreElements()=" + expandedElements.length + ", tip="+tip);
+ }
+
+ // #changed# by Konstantin Mishin on 03.09.2005 fixed for ORMIISTUD-699
+ private void checkItem(TreeItem[] items, String[] expandedElements, String selectionElementQualifiedName) {
+ for (int j = 0; j < items.length; j++) {
+ TreeItem item = items[j];
+
+ // add tau 07.03.2006
+// if (!(item.getData() instanceof IOrmElement)){
+// continue;
+// }
+
+// IOrmElement itemElement = (IOrmElement) item.getData();
+// String itemElementQualifiedName = itemElement.getQualifiedName(item);
+// if (itemElementQualifiedName.equals("")) continue;
+//
+// if (selectionElementQualifiedName != null && selectionElementQualifiedName.equals(itemElementQualifiedName)) {
+// viewer.setSelection(new StructuredSelection(itemElement), true);
+// // add tau 28.11.2005
+// viewer.reveal(itemElement);
+// }
+//
+// for (int i = 0; i < expandedElements.length; i++) {
+// if (itemElementQualifiedName.equals(expandedElements[i])) {
+// viewer.setExpandedState(itemElement, true);
+// TreeItem[] childrenItems = item.getItems();
+// checkItem(childrenItems, expandedElements, selectionElementQualifiedName);
+// }
+// }
+ }
+ }
+
+ private boolean isBuilder(IProject project){
+ boolean flag = false;
+ if (project.getWorkspace().isAutoBuilding()) {
+ IProjectDescription description;
+// try {
+// description = project.getProject().getDescription();
+// ICommand[] builderCommands = description.getBuildSpec();
+// flag = false;
+// for (int i = 0; i < builderCommands.length; i++){
+// if (builderCommands[i].getBuilderName().equals(OrmHibernateNature.ORM_HIBERNATE_BUILDER_ID)) {
+// flag = true;
+// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.isBuilder(...), tip="+tip + ",flagRefresh->"+flag);
+// break;
+// }
+// }
+// } catch (CoreException e) {
+// ExceptionHandler.logThrowableError(e, "projectChanged");
+// }
+ }
+ return flag;
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java 2007-07-05 12:46:15 UTC (rev 2323)
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * 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 java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.IFontProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.hibernate.mapping.Column;
+import org.hibernate.mapping.Component;
+import org.hibernate.mapping.DependantValue;
+import org.hibernate.mapping.ManyToOne;
+import org.hibernate.mapping.OneToMany;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.RootClass;
+import org.hibernate.mapping.SimpleValue;
+import org.hibernate.mapping.SingleTableSubclass;
+import org.hibernate.mapping.Table;
+
+public class OrmLabelProvider extends LabelProvider implements IColorProvider, IFontProvider {
+
+ private Map imageCache = new HashMap(25);
+ private OrmModelImageVisitor ormModelImageVisitor;
+ private OrmModelNameVisitor ormModelNameVisitor;
+
+ public OrmLabelProvider(OrmModelImageVisitor imageVisitor, OrmModelNameVisitor nameVisitor) {
+ super();
+ ormModelImageVisitor = imageVisitor;
+ ormModelNameVisitor = nameVisitor;
+ }
+
+ public Image getImage(Object element) {
+ ImageDescriptor descriptor = null;
+
+ if (element instanceof RootClass) {
+ descriptor = (ImageDescriptor) ((RootClass) element).accept(ormModelImageVisitor);
+ } else if (element instanceof Property) {
+ descriptor = (ImageDescriptor)ormModelImageVisitor.visitPersistentField((Property) element, null);
+ } else if (element instanceof Table) {
+ descriptor = (ImageDescriptor)ormModelImageVisitor.visitDatabaseTable((Table) element);
+ } else if (element instanceof Column) {
+ descriptor = (ImageDescriptor)ormModelImageVisitor.visitDatabaseColumn((Column) element);
+ } else if (element instanceof DependantValue) {
+ descriptor = (ImageDescriptor)ormModelImageVisitor.visitComponentKeyMapping((DependantValue) element, null);
+ } else if (element instanceof Component) {
+ descriptor = (ImageDescriptor)ormModelImageVisitor.visitComponentMapping((Component) element);
+ } else {
+ //throw unknownElement(element);
+ return null;
+ }
+
+ Image image = (Image) imageCache.get(descriptor);
+ if (image == null) {
+ image = descriptor.createImage();
+ imageCache.put(descriptor, image);
+ }
+ return image;
+ }
+
+ public String getText(Object element) {
+ if (element instanceof RootClass) {
+ String name = (String)ormModelNameVisitor.visitPersistentClass((RootClass)element, null);
+ if (name == null) {
+ return "OrmElement";
+ } else {
+ return name;
+ }
+ } else if (element instanceof SingleTableSubclass) {
+ String name = (String)ormModelNameVisitor.visitPersistentClass((SingleTableSubclass)element, null);
+ if (name == null) {
+ return "OrmElement";
+ } else {
+ return name;
+ }
+ } else if (element instanceof Property) {
+ String name = (String)ormModelNameVisitor.visitPersistentField((Property)element, null);
+ if (name == null) {
+ return "OrmElement";
+ } else {
+ return name;
+ }
+ } else if (element instanceof Column) {
+ String name = (String)ormModelNameVisitor.visitDatabaseColumn((Column)element, null);
+ if (name == null) {
+ return "OrmElement";
+ } else {
+ return name;
+ }
+ } else if (element instanceof OneToMany || element instanceof ManyToOne) {
+ String name = "element";
+ if (name == null) {
+ return "OrmElement";
+ } else {
+ return name;
+ }
+ } else if (element instanceof SimpleValue) {
+ if (element instanceof DependantValue) {
+ String name = (String)ormModelNameVisitor.visitCollectionKeyMapping((DependantValue)element, null);
+ if (name == null) {
+ return "OrmElement";
+ } else {
+ return name;
+ }
+ } else if (element instanceof Component) {
+ String name = (String)ormModelNameVisitor.visitComponentMapping((Component)element, null);
+ if (name == null) {
+ return "OrmElement";
+ } else {
+ return name;
+ }
+ } else {
+ return "element";
+// throw unknownElement(element);
+ }
+ } else if (element instanceof String){
+ return (String) element;
+ } else {
+ throw unknownElement(element);
+ }
+
+ }
+
+ protected RuntimeException unknownElement(Object element) {
+ if (element != null && element.getClass() != null )
+ return new RuntimeException("Unknown type of element in tree of type: " + element.getClass().getName());
+ else return new RuntimeException("Unknown type of element in tree of type: " + element);
+
+ }
+
+ public void dispose() {
+ for (Iterator i = imageCache.values().iterator(); i.hasNext();) {
+ ((Image) i.next()).dispose();
+ }
+ imageCache.clear();
+ }
+
+ public Color getForeground(Object element) {
+ if (element instanceof RootClass) {
+ return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN);
+ } else if (element instanceof Property) {
+ return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE);
+ }
+
+ return null;
+ }
+
+ public Color getBackground(Object element) {
+ return null;
+ }
+
+ public Font getFont(Object element) {
+/* if (element instanceof IOrmProject) {
+ return JFaceResources.getFontRegistry().getBold(JFaceResources.getTextFont().getFontData()[0].getName());
+ }*/
+ return null;
+ }
+
+}
\ No newline at end of file
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelImageVisitor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelImageVisitor.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelImageVisitor.java 2007-07-05 12:46:15 UTC (rev 2323)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * 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 java.util.ResourceBundle;
+
+import org.hibernate.mapping.Column;
+import org.hibernate.mapping.Component;
+import org.hibernate.mapping.DependantValue;
+import org.hibernate.mapping.JoinedSubclass;
+import org.hibernate.mapping.PersistentClassVisitor;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.RootClass;
+import org.hibernate.mapping.SingleTableSubclass;
+import org.hibernate.mapping.Subclass;
+import org.hibernate.mapping.Table;
+import org.hibernate.mapping.UnionSubclass;
+import org.jboss.tools.hibernate.ui.view.ViewPlugin;
+
+
+
+/**
+ * @author Tau
+ *
+ */
+public class OrmModelImageVisitor implements /*IOrmModelVisitor, IHibernateMappingVisitor,*/ PersistentClassVisitor {
+
+ private ResourceBundle BUNDLE = ViewPlugin.BUNDLE_IMAGE;
+
+ private static Integer ID = new Integer(1);
+ private static Integer VER = new Integer(2);
+
+
+ public Object visitDatabaseTable(Table table) {
+ return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseTable")); //$NON-NLS-1$
+ }
+
+ public Object visitDatabaseColumn(Column column) {
+ if(column.isUnique()) {
+ return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseUniqueKeyColumn"));
+ } else return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseColumn")); //$NON-NLS-1$
+
+ }
+
+ public Object visitPersistentField(Property field, Object argument) {
+ if (field !=null){
+ if (field.getType().isCollectionType()) {
+ return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldCollection")); //$NON-NLS-1$
+ }
+ }
+ return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
+ }
+
+ public Object visitComponentMapping(Component mapping) {
+ if (mapping != null){
+ return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldComponent")); //$NON-NLS-1$
+ }
+ return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
+ }
+
+ public Object visitComponentKeyMapping(DependantValue mapping, Object argument) {
+ if (argument == ID){
+ return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldComponent_id")); //$NON-NLS-1$
+ }
+ return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
+ }
+
+ public Object visitDatabaseColumn(Column column, Object argument) {
+ return null;
+ }
+
+ public Object accept(RootClass arg0) {
+ return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentClass")); //$NON-NLS-1$
+ }
+
+ public Object accept(UnionSubclass arg0) {
+ return null;
+ }
+
+ public Object accept(SingleTableSubclass arg0) {
+ return null;
+ }
+
+ public Object accept(JoinedSubclass arg0) {
+ return null;
+ }
+
+ public Object accept(Subclass arg0) {
+ return null;
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java 2007-07-05 12:46:15 UTC (rev 2323)
@@ -0,0 +1,707 @@
+/*******************************************************************************
+ * 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 java.sql.Types;
+import java.util.ResourceBundle;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jface.viewers.ContentViewer;
+import org.hibernate.mapping.Column;
+import org.hibernate.mapping.Component;
+import org.hibernate.mapping.DependantValue;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.RootClass;
+import org.hibernate.mapping.SingleTableSubclass;
+import org.hibernate.mapping.Table;
+
+/**
+ * @author Tau from Minsk
+ *
+ */
+public class OrmModelNameVisitor /*implements IOrmModelVisitor*/ {
+
+ private ContentViewer viewer;
+
+ static private String SPACE = " ";
+
+ static private String POINTER = " -> ";
+
+ // add 16.03.2005 tau
+ private ResourceBundle BUNDLE = ResourceBundle
+ .getBundle(OrmModelNameVisitor.class.getPackage().getName()
+ + ".views");
+
+ public OrmModelNameVisitor(ContentViewer viewer) {
+ super();
+ this.viewer = viewer;
+ }
+
+ /**
+ * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitOrmModel(org.jboss.tools.hibernate.core.IOrmProject, java.lang.Object)
+ */
+// public Object visitOrmProject(IOrmProject schema, Object argument) {
+// return schema.getName();
+// }
+
+ /**
+ * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitDatabaseSchema(org.jboss.tools.hibernate.core.IDatabaseSchema, java.lang.Object)
+ */
+// public Object visitDatabaseSchema(IDatabaseSchema schema, Object argument) {
+// if (schema.getName() == null || schema.getName().trim().length() == 0) {
+// return BUNDLE
+// .getString("OrmModelNameVisitor.DefaultDatabaseSchema");
+// } else {
+// return schema.getName();
+// }
+// }
+
+ /**
+ * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitDatabaseTable(org.jboss.tools.hibernate.core.IDatabaseTable, java.lang.Object)
+ */
+// public Object visitDatabaseTable(IDatabaseTable table, Object argument) {
+// // Table name (Class1, Class2 ...)
+// // add tau 13.04.2005
+// // edit tau 28.04.2005 -> vs ()
+// StringBuffer name = new StringBuffer();
+// name.append(table.getName());
+//
+// IPersistentClassMapping[] classMappings = table
+// .getPersistentClassMappings();
+// if (classMappings.length != 0) {
+// name.append(POINTER);
+// for (int i = 0; i < classMappings.length; i++) {
+// IPersistentClass persistentClass = classMappings[i]
+// .getPersistentClass();
+// if (persistentClass != null) {
+// name.append(persistentClass.getName());
+// name.append(BUNDLE.getString("OrmModelNameVisitor.Comma"));
+// name.append(" ");
+// }
+// }
+// name.delete(name.length() - 2, name.length());
+// }
+// return name.toString();
+//
+// }
+
+ /**
+ * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitDatabaseColumn(org.jboss.tools.hibernate.core.IDatabaseColumn, java.lang.Object)
+ */
+// public Object visitDatabaseColumn(IDatabaseColumn column, Object argument) {
+// // update tau 16.03.2005
+// StringBuffer name = new StringBuffer();
+// name.append(column.getName());
+// //by Nick 22.04.2005
+//
+// int length = -1;
+// int scale = -1;
+//
+// if (!column.isNativeType()) {
+// int typeCode = column.getSqlTypeCode();
+// String typeName = column.getSqlTypeName();
+//
+// if (typeName == null)
+// typeCode = Types.NULL;
+//
+// //by Nick
+//
+// // (tau->tau) Column types should be shown in the following manner:
+// /*
+//
+// Character types:
+// VARCHAR(length)
+// CHAR(length)
+//
+// Numeric types:
+// NUMBER(length, precision)
+// NUMERIC(length, precision)
+//
+// Other types:
+// BIT
+// INTEGER
+// BIGNINT
+// DATE
+// FLOAT
+// REAL
+// CLOB
+// BINARY
+// etc. */
+// //by Nick 22.04.2005
+// // TODO (tau->tau)
+// // testing for ORACLE
+// // edit tau 28.04.2005 -> vs ()
+// switch (typeCode) {
+// case Types.VARCHAR:
+// case Types.CHAR:
+// case Types.NUMERIC:
+// case Types.DECIMAL: //8.07.2005 by Nick DECIMAL JDBC type denotes Oracle NUMBER type
+// //changed by Nick 10.05.2005 - fixes "->" in SQL types
+// if (typeCode == Types.NUMERIC || typeCode == Types.DECIMAL) {
+// length = column.getPrecision();
+// scale = column.getScale();
+// } else {
+// length = column.getLength();
+// }
+//
+// default:
+// break;
+//
+// }
+// } else {
+// if (column.getLength() > Column.DEFAULT_LENGTH) {
+// length = column.getLength();
+// } else if (column.getPrecision() > Column.DEFAULT_PRECISION
+// || column.getScale() > Column.DEFAULT_SCALE) {
+// length = column.getPrecision() > Column.DEFAULT_PRECISION ? (column
+// .getPrecision())
+// : (column.getScale() > 0 ? column.getScale() : 1);
+// scale = column.getScale();
+// }
+// }
+//
+// StringBuffer typeName = new StringBuffer(column.getSqlTypeName());
+//
+// //by Nick
+//
+// // (tau->tau) Column types should be shown in the following manner:
+// /*
+//
+// Character types:
+// VARCHAR(length)
+// CHAR(length)
+//
+// Numeric types:
+// NUMBER(length, precision)
+// NUMERIC(length, precision)
+//
+// Other types:
+// BIT
+// INTEGER
+// BIGNINT
+// DATE
+// FLOAT
+// REAL
+// CLOB
+// BINARY
+// etc. */
+// //by Nick 22.04.2005
+// /*
+// switch (key) {
+// case value:
+//
+// break;
+//
+// default:
+// break;
+// }
+// */
+//
+// // TODO (tau->tau)
+// // testing for ORACLE
+//
+// StringBuffer lpBuffer = new StringBuffer();
+// //name.append(POINTER);
+//
+// if (length > Column.DEFAULT_LENGTH) {
+// lpBuffer.append(SPACE);
+// lpBuffer.append(BUNDLE
+// .getString("OrmModelNameVisitor.OpenBrackets"));
+// lpBuffer.append(length);
+// if (scale > Column.DEFAULT_SCALE) {
+// lpBuffer.append(BUNDLE.getString("OrmModelNameVisitor.Comma"));
+// lpBuffer.append(SPACE);
+// lpBuffer.append(scale);
+// }
+// lpBuffer.append(BUNDLE
+// .getString("OrmModelNameVisitor.CloseBrackets"));
+// }
+// //by Nick
+//
+// if (typeName.length() != 0) {
+// // edit tau 28.04.2005 -> vs ()
+// //8.07.2005 by Nick DECIMAL JDBC type denotes Oracle NUMBER type
+// //changed by Nick 10.05.2005 - fixes "->" in SQL types
+// name.append(BUNDLE.getString("OrmModelNameVisitor.Colon"));
+// name.append(SPACE);
+// typeName.append(lpBuffer);
+// }
+//
+// name.append(typeName);
+// // name.append(SPACE);
+//
+// // by Nick
+// return name.toString();
+//
+// }
+
+ public Object visitDatabaseColumn(Column column, Object argument) {
+ // update tau 16.03.2005
+ StringBuffer name = new StringBuffer();
+ name.append(column.getName());
+ //by Nick 22.04.2005
+
+ int length = -1;
+ int scale = -1;
+
+// if (!column.isNativeType())
+// {
+// int typeCode = column.getSqlTypeCode();
+// String typeName = column.getSqlTypeName();
+//
+// if (typeName == null) typeCode = Types.NULL;
+//
+// //by Nick
+//
+// // (tau->tau) Column types should be shown in the following manner:
+// /*
+//
+// Character types:
+// VARCHAR(length)
+// CHAR(length)
+//
+// Numeric types:
+// NUMBER(length, precision)
+// NUMERIC(length, precision)
+//
+// Other types:
+// BIT
+// INTEGER
+// BIGNINT
+// DATE
+// FLOAT
+// REAL
+// CLOB
+// BINARY
+// etc. */
+// //by Nick 22.04.2005
+// /*
+// switch (key) {
+// case value:
+//
+// break;
+//
+// default:
+// break;
+// }
+// */
+//
+// // TODO (tau->tau)
+// // testing for ORACLE
+//
+// // edit tau 28.04.2005 -> vs ()
+//
+// switch (typeCode) {
+// case Types.VARCHAR:
+// case Types.CHAR:
+// case Types.NUMERIC:
+// case Types.DECIMAL: //8.07.2005 by Nick DECIMAL JDBC type denotes Oracle NUMBER type
+// //changed by Nick 10.05.2005 - fixes "->" in SQL types
+// if (typeCode == Types.NUMERIC || typeCode == Types.DECIMAL) {
+// length = column.getPrecision();
+// scale = column.getScale();
+// }
+// else
+// {
+// length = column.getLength();
+// }
+//
+// default:
+// break;
+//
+// }
+// }
+// else
+// {
+// if (column.getLength() > Column.DEFAULT_LENGTH)
+// {
+// length = column.getLength();
+// }
+// else if (column.getPrecision() > Column.DEFAULT_PRECISION || column.getScale() > Column.DEFAULT_SCALE)
+// {
+// length = column.getPrecision() > Column.DEFAULT_PRECISION ? (column.getPrecision()) : (column.getScale() > 0 ? column.getScale() : 1);
+// scale = column.getScale();
+// }
+// }
+
+// StringBuffer typeName = new StringBuffer(column.getSqlTypeName());
+//
+// //by Nick
+//
+// // (tau->tau) Column types should be shown in the following manner:
+// /*
+//
+// Character types:
+// VARCHAR(length)
+// CHAR(length)
+//
+// Numeric types:
+// NUMBER(length, precision)
+// NUMERIC(length, precision)
+//
+// Other types:
+// BIT
+// INTEGER
+// BIGNINT
+// DATE
+// FLOAT
+// REAL
+// CLOB
+// BINARY
+// etc. */
+// //by Nick 22.04.2005
+// /*
+// switch (key) {
+// case value:
+//
+// break;
+//
+// default:
+// break;
+// }
+// */
+//
+// // TODO (tau->tau)
+// // testing for ORACLE
+//
+//
+// StringBuffer lpBuffer = new StringBuffer();
+// //name.append(POINTER);
+//
+// if (length > Column.DEFAULT_LENGTH)
+// {
+// lpBuffer.append(SPACE);
+// lpBuffer.append(BUNDLE.getString("OrmModelNameVisitor.OpenBrackets"));
+// lpBuffer.append(length);
+// if (scale > Column.DEFAULT_SCALE)
+// {
+// lpBuffer.append(BUNDLE.getString("OrmModelNameVisitor.Comma"));
+// lpBuffer.append(SPACE);
+// lpBuffer.append(scale);
+// }
+// lpBuffer.append(BUNDLE.getString("OrmModelNameVisitor.CloseBrackets"));
+// }
+// //by Nick
+//
+// if (typeName.length() != 0)
+// {
+// // edit tau 28.04.2005 -> vs ()
+// //8.07.2005 by Nick DECIMAL JDBC type denotes Oracle NUMBER type
+// //changed by Nick 10.05.2005 - fixes "->" in SQL types
+// name.append(BUNDLE.getString("OrmModelNameVisitor.Colon"));
+// name.append(SPACE);
+// typeName.append(lpBuffer);
+// }
+//
+// name.append(typeName);
+//// name.append(SPACE);
+//
+// // by Nick
+ return name.toString();
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitDatabaseConstraint(org.jboss.tools.hibernate.core.IDatabaseConstraint, java.lang.Object)
+ */
+// public Object visitDatabaseConstraint(IDatabaseConstraint constraint,
+// Object argument) {
+// return constraint.getName();
+// }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPackage(org.jboss.tools.hibernate.core.IPackage, java.lang.Object)
+ */
+// public Object visitPackage(IPackage pakage, Object argument) {
+// if (pakage.getName() == null || pakage.getName().trim().length() == 0) {
+// return BUNDLE.getString("OrmModelNameVisitor.DefaultPackageName");
+// } else {
+// //return pakage.getName();
+// return pakage.getProjectQualifiedName();
+// }
+// }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitMapping(org.jboss.tools.hibernate.core.IMapping, java.lang.Object)
+ */
+// public Object visitMapping(IMapping mapping, Object argument) {
+// return mapping.getName();
+// }
+
+ /**
+ * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitMappingStorage(org.jboss.tools.hibernate.core.IMappingStorage, java.lang.Object)
+ */
+// public Object visitMappingStorage(IMappingStorage storage, Object argument) {
+// return storage.getName();
+// }
+
+ /**
+ * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentClass(org.jboss.tools.hibernate.core.IPersistentClass, java.lang.Object)
+ */
+// public Object visitPersistentClass(IPersistentClass clazz, Object argument) {
+//
+// StringBuffer name = new StringBuffer();
+// if (((OrmContentProvider) viewer.getContentProvider()).getTip() == OrmContentProvider.PACKAGE_CLASS_FIELD_CONTENT_PROVIDER) {
+// name.append(clazz.getShortName());
+// } else {
+// name.append(clazz.getName());
+// }
+//
+// //edit tau 24.04.2006
+// IDatabaseTable table = clazz.getDatabaseTable(); // upd tau 06.06.2005
+// //IDatabaseTable table = HibernateAutoMappingHelper.getPrivateTable(classMapping); // upd tau 18.04.2005
+// if (table != null) {
+// String tableName = table.getName();
+// if (tableName != null) {
+// //name.append(" (");
+// name.append(POINTER);
+// name.append(tableName);
+// //name.append(")");
+// }
+// }
+//
+// return name.toString();
+// }
+
+ public Object visitPersistentClass(RootClass clazz, Object argument) {
+
+ StringBuffer name = new StringBuffer();
+// if (((OrmContentProvider) viewer.getContentProvider()).getTip() == OrmContentProvider.PACKAGE_CLASS_FIELD_CONTENT_PROVIDER) {
+ name.append(clazz.getClassName());
+// } else {
+// name.append(clazz.getClassName());
+// }
+
+ //edit tau 24.04.2006
+ Table table = clazz.getTable(); // upd tau 06.06.2005
+ //IDatabaseTable table = HibernateAutoMappingHelper.getPrivateTable(classMapping); // upd tau 18.04.2005
+ if (table != null) {
+ String tableName = table.getName();
+ if (tableName != null) {
+ //name.append(" (");
+ name.append(POINTER);
+ name.append(tableName);
+ //name.append(")");
+ }
+ }
+
+ return name.toString();
+ }
+
+ public Object visitPersistentClass(SingleTableSubclass clazz, Object argument) {
+
+ StringBuffer name = new StringBuffer();
+// if (((OrmContentProvider) viewer.getContentProvider()).getTip() == OrmContentProvider.PACKAGE_CLASS_FIELD_CONTENT_PROVIDER) {
+ name.append(clazz.getEntityName());
+// } else {
+// name.append(clazz.getClassName());
+// }
+
+ //edit tau 24.04.2006
+ Table table = clazz.getTable(); // upd tau 06.06.2005
+ //IDatabaseTable table = HibernateAutoMappingHelper.getPrivateTable(classMapping); // upd tau 18.04.2005
+ if (table != null) {
+ String tableName = table.getName();
+ if (tableName != null) {
+ //name.append(" (");
+ name.append(POINTER);
+ name.append(tableName);
+ //name.append(")");
+ }
+ }
+
+ return name.toString();
+ }
+
+ /**
+ * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentField(org.jboss.tools.hibernate.core.IPersistentField, java.lang.Object)
+ */
+// public Object visitPersistentField(IPersistentField field, Object argument) {
+// StringBuffer name = new StringBuffer();
+// name.append(field.getName());
+// name.append(BUNDLE.getString("OrmModelNameVisitor.Colon"));
+// String typeString = field.getType();
+//
+// if (typeString != null) {
+// //added by Nick 31.03.2005
+// IPersistentValueMapping value = null;
+// if (field.getMapping() != null)
+// value = field.getMapping().getPersistentValueMapping();
+//
+// //added by Nick 18.04.2005 - to handle BLOB mappings
+// if (Signature.getArrayCount(typeString) != 0) {
+// // changed by Nick 20.10.2005
+// int depth = Signature.getArrayCount(typeString);
+// typeString = Signature.getElementType(typeString);
+// for (int i = 0; i < depth; i++) {
+// typeString += "[]";
+// }
+// // by Nick
+// }
+//
+// //by Nick
+// if (value != null && value instanceof CollectionMapping
+// && !(value instanceof ArrayMapping)) {
+// String elementsClsName = ((CollectionMapping) value)
+// .getCollectionElementClassName();
+// if (elementsClsName != null)
+// typeString = field.getType() + "(" + elementsClsName + ")";
+// }
+//
+// if (value != null && value instanceof CollectionMapping) {
+// //added by Nick 12.05.2005 to show collection table in explorer
+// IDatabaseTable collectionTable = ((CollectionMapping) value)
+// .getCollectionTable();
+// if (collectionTable != null
+// && collectionTable.getShortName() != null)
+// typeString += POINTER + collectionTable.getShortName();
+// //by Nick
+// }
+// //by Nick
+// name.append(typeString);
+//
+// // added by Nick 29.07.2005
+// if (field.getGenerifiedTypes() != null) {
+// String[] types = field.getGenerifiedTypes();
+//
+// StringBuffer buf = new StringBuffer("<");
+//
+// for (int i = 0; i < types.length; i++) {
+// String string = types[i];
+// buf.append(string);
+//
+// if (i != types.length - 1)
+// buf.append(", ");
+// }
+//
+// buf.append(">");
+//
+// name.append(buf);
+// }
+// // by Nick
+// }
+// return name.toString();
+//
+// }
+
+ public Object visitPersistentField(Property field, Object argument) {
+ StringBuffer name = new StringBuffer();
+ name.append(field.getName());
+ name.append(BUNDLE.getString("OrmModelNameVisitor.Colon"));
+ String typeString = field.getType().getReturnedClass().getName();
+
+ if (typeString != null) {
+/* IPersistentValueMapping value = null;
+ if (field.getMapping() != null)
+ value = field.getMapping().getPersistentValueMapping();
+
+ if (Signature.getArrayCount(typeString) != 0)
+ {
+ int depth = Signature.getArrayCount(typeString);
+ typeString = Signature.getElementType(typeString);
+ for (int i = 0; i < depth; i++) {
+ typeString += "[]";
+ }
+ }
+
+ if (value != null && value instanceof CollectionMapping && !(value instanceof ArrayMapping))
+ {
+ String elementsClsName = ((CollectionMapping)value).getCollectionElementClassName();
+ if (elementsClsName != null)
+ typeString = field.getType() + "(" + elementsClsName + ")";
+ }
+
+ if (value != null && value instanceof CollectionMapping)
+ {
+ IDatabaseTable collectionTable = ((CollectionMapping)value).getCollectionTable();
+ if (collectionTable != null && collectionTable.getShortName() != null)
+ typeString += POINTER + collectionTable.getShortName();
+ }*/
+ name.append(typeString);
+
+/* if (field.getGenerifiedTypes() != null)
+ {
+ String[] types = field.getGenerifiedTypes();
+
+ StringBuffer buf = new StringBuffer("<");
+
+ for (int i = 0; i < types.length; i++) {
+ String string = types[i];
+ buf.append(string);
+
+ if (i != types.length - 1)
+ buf.append(", ");
+ }
+
+ buf.append(">");
+
+ name.append(buf);
+ }*/
+ }
+ return name.toString();
+
+ }
+
+ /**
+ * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentClassMapping(org.jboss.tools.hibernate.core.IPersistentClassMapping, java.lang.Object)
+ */
+// public Object visitPersistentClassMapping(IPersistentClassMapping mapping,
+// Object argument) {
+// // add tau 22.04.2005
+// // Class mapping should be shown as Class name -> table name
+//
+// StringBuffer name = new StringBuffer();
+// name.append(mapping.getName());
+//
+// IDatabaseTable table = HibernateAutoMappingHelper
+// .getPrivateTable(mapping); // upd tau 22.04.2005
+// if (table != null) {
+// String tableName = table.getName();
+// if (tableName != null) {
+// name.append(POINTER);
+// name.append(tableName);
+// }
+// }
+//
+// return name.toString();
+//
+// }
+
+ /**
+ * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentFieldMapping(org.jboss.tools.hibernate.core.IPersistentFieldMapping, java.lang.Object)
+ */
+// public Object visitPersistentFieldMapping(IPersistentFieldMapping mapping,
+// Object argument) {
+// return mapping.getName();
+// }
+
+ /**
+ * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentValueMapping(org.jboss.tools.hibernate.core.IPersistentValueMapping, java.lang.Object)
+ */
+// public Object visitPersistentValueMapping(IPersistentValueMapping mapping,
+// Object argument) {
+// return mapping.getName();
+// }
+
+ // add tau 27.07.2005
+// public Object visitNamedQueryMapping(INamedQueryMapping mapping,
+// Object argument) {
+// return mapping.getName();
+// }
+
+
+ public Object visitCollectionKeyMapping(DependantValue mapping, Object argument) {
+ return "key";
+ }
+
+ public Object visitComponentMapping(Component mapping, Object argument) {
+ return "element";
+ }
+}
\ No newline at end of file
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ViewsAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ViewsAction.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ViewsAction.java 2007-07-05 12:46:15 UTC (rev 2323)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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 java.util.HashMap;
+import java.util.ResourceBundle;
+
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.ide.IDE;
+import org.jboss.tools.hibernate.ui.view.ViewPlugin;
+
+
+public class ViewsAction {
+ static ActionOrmTree openEditorAction;
+
+ static private ResourceBundle BUNDLE_IMAGE = ViewPlugin.BUNDLE_IMAGE;
+ static private ResourceBundle BUNDLE = ResourceBundle.getBundle(ViewsAction.class.getPackage().getName() + ".views");
+
+ static {
+ openEditorAction = new ActionOrmTree() {
+ HashMap<Object,ObjectEditorInput> hashMap = new HashMap<Object,ObjectEditorInput>();
+ public void rush() {
+ ObjectEditorInput input = hashMap.get(this.getViewer().getTree().getSelection()[0].getData());
+ if(input == null) {
+ input = new ObjectEditorInput(this.getViewer().getTree().getSelection()[0].getData());
+ hashMap.put(this.getViewer().getTree().getSelection()[0].getData(), input);
+ }
+ try {
+ IDE.openEditor(ViewPlugin.getPage(),input ,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor");
+ } catch (PartInitException e) {
+// ExceptionHandler.logThrowableError(e,"OpenEditor");
+ }
+ }
+ };
+ openEditorAction.setText(BUNDLE.getString("Explorer.OpenEditorActionName"));
+ openEditorAction.setToolTipText(BUNDLE.getString("Explorer.OpenEditorActionToolTipText"));
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/views.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/views.properties (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/views.properties 2007-07-05 12:46:15 UTC (rev 2323)
@@ -0,0 +1,245 @@
+//Explorer
+Explorer.ActionRootPackageClassFieldName=project -> mapping -> package -> class(table) -> field -> column(s)
+Explorer.ActionRootPackageClassFieldContentDescription=project -> mapping -> package -> class(table) -> field
+Explorer.ActionRootPackageClassFieldToolTipText=Group by package
+
+Explorer.ActionRootClassFieldName=project -> mapping -> class(table) -> field -> column(s)
+Explorer.ActionRootClassFieldContentDescription=project -> mapping -> class(table) -> field -> column(s)
+Explorer.ActionRootClassFieldToolTipText=Group by mapping
+
+Explorer.ActionRootStorageClassFieldName=project -> mapping -> mapping storage -> class(table) -> field -> column(s)
+Explorer.ActionRootStorageClassFieldContentDescription=project -> mapping -> mapping storage -> class(table) -> field -> column(s)
+Explorer.ActionRootStorageClassFieldToolTipText=Group by storage
+
+Explorer.HibernateConnectionWizardName=Edit Hibernate Configuration...
+Explorer.HibernateConnectionWizardToolTipText=Hibernate configuration wizard
+
+Explorer.PersistentClassesWizardName=Add Persistent Classes...
+Explorer.PersistentClassesWizardToolTipText=Add persistent classes wizard
+
+Explorer.GenerateDAOWizardName=Generate DAO Classes...
+Explorer.GenerateDAOWizardToolTipText=Generate DAO wizard
+
+Explorer.FieldMappingWizardName=Edit Mapping...
+Explorer.FieldMappingWizardToolTipText=Field mapping wizard
+//Kuzmin 06.10.2005
+Explorer.FieldMappingWizardNameNew=New Mapping...
+
+Explorer.TablesClassesWizardName=Reverse Engineer Database Schema...
+Explorer.TablesClassesWizardToolTipText=Add tables classes wizard
+Explorer.TablesClassesWizardInfoCreate=Created classes
+Explorer.TablesClassesWizardInfonoPK=Tables have no PK
+Explorer.TablesClassesWizardInfoLink=Many-to-many link tables
+Explorer.TablesClassesWizardInfoTitle=Red Hat Developer Studio Reversing Operation Report
+
+Explorer.AddNamedQueryName=Add Named Query...
+Explorer.AddNamedQueryToolTipText=Create new named query
+Explorer.AddNamedQuery.DefaultNewName=New query
+
+Explorer.TestQueryName=Query Test...
+Explorer.TestQueryToolTipText=Query test
+Explorer.TestQuery.DefaultQuery=from {0}
+
+Explorer.EditNamedQueryName=Edit Named Query...
+Explorer.EditNamedQueryToolTipText=Edit selected named query
+
+Explorer.RemoveNamedQueryName=Remove Named Query
+Explorer.RemoveNamedQueryToolTipText=Remove selected named query
+Explorer.RemoveNamedQueryTitle=Confirm Remove Named Query
+Explorer.RemoveNamedQueryMessage=Do you want to remove the Named Query "{0}"?
+
+Explorer.DuplicateQueryNameErrorTitle=Duplicate Query Name Error
+
+Explorer.MappingWizardName=Edit Mapping...
+Explorer.MappingWizardToolTipText=Edit mapping
+
+Explorer.GenerateDDLWizardName=Generate DDL Wizard...
+Explorer.GenerateDDLWizardToolTipText=Generate DDL file
+Explorer.GenerateDDLErrorTitle=Generate DDL Error
+
+Explorer.AutoBuildingFalseTitle=Warning
+Explorer.AutoBuildingFalseMessage=Build Automaticaly is switch off.\nContinue?
+
+Explorer.HibernateCacheWizardName=Hibernate Cache Wizard...
+Explorer.HibernateCacheWizardToolTipText=Hibernate cache wizard
+
+Explorer.AutoMappingSettingName=Auto Mapping Settings...
+Explorer.AutoMappingSettingToolTipText=Auto mapping settings
+
+Explorer.RunTimeSettingName=Edit hibernate.properties...
+Explorer.RunTimeSettingToolTipText=Hibernate properties
+
+#new 11.05.2005
+Explorer.ClearPackageMappingName=Clear Mapping...
+Explorer.ClearPackageMappingToolTipText=Clear mapping
+Explorer.ClearPackageMappingTitle=Confirm Clear Mapping
+Explorer.ClearPackageMappingQuestion=Are you sure you want to remove the mapping\nfor the "{0}"?
+
+
+Explorer.ClearClassMappingName=Clear Mapping...
+Explorer.ClearClassMappingToolTipText=Clear mapping
+Explorer.ClearClassMappingTitle=Confirm Clear Mapping
+Explorer.ClearClassMappingQuestion=Are you sure you want to remove the mapping\nfor the "{0}"?
+
+
+Explorer.RemoveClassActionName=Remove Persistent Class...
+Explorer.RemoveClassActionToolTipText=Remove a persistent class
+Explorer.RemoveClassAction.QuestionDialog.Title=Remove Persistent Class
+Explorer.RemoveClassAction.QuestionDialog.Message=Do you want to remove "{0}" ?
+Explorer.RemoveClassAction.QuestionDialog.Radio1=Delete mapping file (if empty)
+Explorer.RemoveClassAction.QuestionDialog.Radio2=Delete source code
+
+Explorer.RemoveClassesActionName=Remove Persistent Classes...
+Explorer.RemoveClassesActionToolTipText=Remove persistent classes
+Explorer.RemoveClassesAction.QuestionDialog.Title=Remove Persistent Classes
+Explorer.RemoveClassesAction.QuestionDialog.Message=Do you want to remove all classes in "{0}"?
+Explorer.RemoveClassesAction.QuestionDialog.Radio1=Delete mapping files (if empty)
+Explorer.RemoveClassesAction.QuestionDialog.Radio2=Delete source code
+
+Explorer.ClearFieldMappingActionName=Clear Mapping...
+Explorer.ClearFieldMappingActionToolTipText=Clear mapping
+Explorer.ClearFieldMappingTitle=Confirm Clear Mapping
+Explorer.ClearFieldMappingQuestion=Are you sure you want to remove the mapping\nfor the "{0}"?
+
+Explorer.ClassAutoMappingActionName=Auto Mapping
+Explorer.ClassAutoMappingActionToolTipText=Auto mapping
+
+Explorer.RefreshClassSchemaMappingActionName=Synchronize Mapping...
+Explorer.RefreshClassSchemaMappingActionToolTipText=Synchronize Mapping
+Explorer.RefreshClassSchemaMappingTitle=Warning
+Explorer.RefreshClassSchemaMappingQuestion=Red Hat Developer Studio will automatically synchronize mapping with the source code.\n\nPress OK to continue.
+
+
+Explorer.PackageAutoMappingActionName=Auto Mapping
+Explorer.PackageAutoMappingActionToolTipText=Auto mapping
+Explorer.PackageAutoMappingAction.ProgressMonitor=Auto mapping "{0}"
+
+Explorer.RefreshPackageSchemaMappingActionName=Synchronize Mapping...
+Explorer.RefreshPackageSchemaMappingActionToolTipText=Synchronize Mapping
+Explorer.RefreshPackageSchemaMappingTitle=Warning
+Explorer.RefreshPackageSchemaMappingQuestion=Red Hat Developer Studio will automatically synchronize mapping with the source code.\n\nPress OK to continue.
+
+Explorer.RefreshMappingSchemaMappingActionName=Synchronize Mapping...
+Explorer.RefreshMappingSchemaMappingActionToolTipText=Synchronize Mapping
+Explorer.RefreshMappingSchemaMapping.ProgressMonitor=Synchronize Mapping "{0}"
+Explorer.RefreshMappingSchemaMappingTitle=Warning
+Explorer.RefreshMappingSchemaMappingQuestion=Red Hat Developer Studio will automatically synchronize mapping with the source code.\n\nPress OK to continue.
+
+Explorer.RefactoringDialogClassActionName=Rename Class...
+Explorer.RefactoringDialogClassActionToolTipText=Rename a class
+
+Explorer.RefactoringDialogFieldActionName=Rename Field...
+Explorer.refactoringDialogFieldActionToolTipText=Rename a field
+
+Explorer.FetchStrategyWizarddName=Fetch Strategy Wizard...
+Explorer.FetchStrategyWizardToolTipText=Fetch strategy
+
+Explorer.CollapseAllActionName=Collapse All
+Explorer.CollapseAllActionToolTipText=Collapse all
+
+Explorer.ExpandAllActionName=Expand All
+Explorer.ExpandAllActionToolTipText=Expand all
+
+Explorer.refreshMappingActionName=Refresh
+Explorer.refreshMappingActionToolTipText=Refresh
+Explorer.refreshMappingAction.ProgressMonitor=Refresh
+
+Explorer.refreshOrmProjectActionName=Refresh
+Explorer.refreshOrmProjectActionToolTipText=Refresh
+Explorer.refreshOrmProjectAction.ProgressMonitor=Refresh "{0}"
+
+Explorer.removeConfigAction.ProgressMonitor=Remove "{0}"
+Explorer.removeConfigActionName=Remove Hibernate Configuration...
+Explorer.removeConfigActionToolTipText=Remove Hibernate configuration
+Explorer.removeConfigAction.QuestionDialog.Title=Confirm Remove Hibernate Configuration
+Explorer.removeConfigAction.QuestionDialog.Message=Do you want to remove the Hibernate Configuration "{0}"?
+Explorer.removeConfigAction.QuestionDialog.Radio1=Also delete the mapping files
+Explorer.removeConfigAction.QuestionDialog.Radio2=Do not delete the mapping files
+
+Explorer.RenameTableObjectActionName=Rename Table...
+Explorer.RenameTableObjectActionToolTipText=Rename table
+
+Explorer.AddColumnDialogActionName=Add Column...
+Explorer.AddColumnDialogActionToolTipText=Add column
+
+Explorer.RemoveTableActionName=Remove Table...
+Explorer.RemoveTableActionTipText=Remove table
+Explorer.RemoveTableQuestion=Are you sure you want to remove table '
+Explorer.RemoveTableConfirmDeleteTitle=Confirm Delete
+
+Explorer.renameTableObjectDialogForColumnActionName=Rename Column...
+Explorer.renameTableObjectDialogForColumnActionToolTipText=Rename column
+
+Explorer.AddMappingStorageActionName=Add Mapping Files...
+Explorer.AddMappingStorageActionMessage=Choose mapping files to be added to the current Hibernate configuration:
+Explorer.AddMappingStorageActionTipText=Add a Hibernate mapping file
+Explorer.FileNoErrorProjectDialogTitle=Action Explorer Visitor
+Explorer.FileNoErrorProjectDialogMessage=File "{0}" is outside of project "{1}"
+Explorer.ConfirmProjectToPathDialogTitle=Confirm Add Project to the Build Path
+Explorer.ConfirmProjectToPathDialogMessage=Do you want to add project "{0}" to the build path and mapping files to the current Hibernate configuration?
+Explorer.ConfirmProjectToPathDialogButtonLabelOK=OK
+Explorer.ConfirmProjectToPathDialogButtonLabelCancel=Cancel
+Explorer.XMLFileStorageDublicateTitle=Add Mapping Files
+Explorer.XMLFileStorageDublicateMessage=File "{0}" contains mapping for existing persistent class "{1}".\nThe file will be ignored.
+
+
+Explorer.ColumnPropertyDialogActionName=Properties...
+Explorer.ColumnPropertyDialogActionToolTipText=Properties
+
+Explorer.ViewTableActionName=View Table
+Explorer.ViewTableActionToolTipText=View table
+
+Explorer.ormProjectsNotFound=There are no projects available with Hibernate capabilities!
+Explorer.ormProjectsWasFound=
+
+Explorer.openSourceActionName=Open Source Code
+Explorer.openSourceActionToolTipText=Open a source file
+
+Explorer.openMappingStorageActionName=Open Mapping
+Explorer.openMappingStorageActionToolTipText=Open a mapping storage file
+
+Explorer.openMappingActionName=Open Mapping
+Explorer.openMappingActionToolTipText=Open a Hibernate configuration file
+
+Explorer.hibernateAddMappingWizardName=New Hibernate Configuration...
+Explorer.hibernateAddMappingWizardToolTipText=New Hibernate Configuration...
+
+Explorer.RefreshSchemaMappingActionName=Synchronize Schema Mapping...
+Explorer.RefreshSchemaMappingActionToolTipText=Synchronize Schema Mapping
+Explorer.RefreshSchemaMappingTitle=Warning
+Explorer.RefreshSchemaMappingQuestion=Warning.\nRed Hat Developer Studio will automatically synchronize mapping with the Data Schema.
+
+
+Explorer.RefreshDatabaseTableSchemaMappingActionName=Synchronize Table Mapping...
+Explorer.RefreshDatabaseTableSchemaMappingActionToolTipText=Synchronize Table Mapping
+Explorer.RefreshDatabaseTableSchemaTitle=Warning
+Explorer.RefreshDatabaseTableSchemaQuestion=Warning.\nRed Hat Developer Studio will automatically synchronize mapping with the Data Schema.
+
+Explorer.HQLConsole=HQL Console
+Explorer.HQLConsoleToolTipText=HQL Console
+Explorer.HibernateConsole=Hibernate Console
+Explorer.HibernateConsoleToolTipText=Hibernate Console
+
+Explorer.OpenEditorActionName=Open Mapping Diagram
+Explorer.OpenEditorActionToolTipText=Open Mapping Diagram
+
+#ExplorerBase
+ExplorerBase.ActionRootSchemaTableColumnName=project -> mapping -> schema -> table -> column
+ExplorerBase.ActionRootSchemaTableColumnContentDescription=project -> mapping -> schema -> table -> column
+ExplorerBase.ActionRootSchemaTableColumnToolTipText=Show Relational Schema
+
+ExplorerBase.ActionRootTableColumnName=project -> mapping -> table -> column
+ExplorerBase.ActionRootTableColumnContentDescription=project -> mapping -> table -> column
+ExplorerBase.ActionRootTableColumnToolTipText=Show columns
+OrmExplorer.licenceTitle=Evaluation Period
+OrmExplorer.licencemessage=Evaluation period expired.
+#OrmModelNameVisitor
+OrmModelNameVisitor.DefaultPackageName=Default Package
+OrmModelNameVisitor.DefaultDatabaseSchema=Default Schema
+OrmModelNameVisitor.Colon=:
+OrmModelNameVisitor.OpenBrackets=(
+OrmModelNameVisitor.Comma=,
+OrmModelNameVisitor.CloseBrackets=)
+
+#Job
+Job.LoadMapping=Loading mappings...
17 years, 5 months