JBoss Tools SVN: r40020 - in trunk/archives: tests/org.jboss.ide.eclipse.archives.test and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-04-04 00:28:59 -0400 (Wed, 04 Apr 2012)
New Revision: 40020
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/pom.xml
trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/META-INF/MANIFEST.MF
Log:
apply JBIDE11094.patch2.txt for JBIDE-11094
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF 2012-04-04 02:37:29 UTC (rev 40019)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF 2012-04-04 04:28:59 UTC (rev 40020)
@@ -14,6 +14,7 @@
org.eclipse.core.variables;bundle-version="3.2.500",
org.jboss.tools.usage;resolution:=optional;x-installation:=greedy
Bundle-ActivationPolicy: lazy
+Eclipse-BundleShape: dir
Bundle-ClassPath: archivescore.jar,
archivescore-eclipse.jar,
lib/concurrent-1.3.4.jar,
Modified: trunk/archives/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/archives/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF 2012-04-04 02:37:29 UTC (rev 40019)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF 2012-04-04 04:28:59 UTC (rev 40020)
@@ -19,6 +19,7 @@
org.eclipse.jdt.core;bundle-version="3.4.4",
org.jboss.ide.eclipse.archives.jdt.integration;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
+Eclipse-BundleShape: dir
Export-Package: org.jboss.ide.eclipse.archives.test,
org.jboss.ide.eclipse.archives.test.core,
org.jboss.ide.eclipse.archives.test.model,
Modified: trunk/archives/tests/org.jboss.ide.eclipse.archives.test/pom.xml
===================================================================
--- trunk/archives/tests/org.jboss.ide.eclipse.archives.test/pom.xml 2012-04-04 02:37:29 UTC (rev 40019)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.test/pom.xml 2012-04-04 04:28:59 UTC (rev 40020)
@@ -13,19 +13,4 @@
<coverage.filter>org.jboss.ide.eclipse.archives.core*</coverage.filter>
<emma.instrument.bundles>org.jboss.ide.eclipse.archives.core</emma.instrument.bundles>
</properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-surefire-plugin</artifactId>
- <configuration>
- <explodedBundles>
- <bundle>org.jboss.ide.eclipse.archives.core</bundle>
- <bundle>org.jboss.ide.eclipse.archives.test</bundle>
- </explodedBundles>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
</project>
Modified: trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/META-INF/MANIFEST.MF 2012-04-04 02:37:29 UTC (rev 40019)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/META-INF/MANIFEST.MF 2012-04-04 04:28:59 UTC (rev 40020)
@@ -5,6 +5,7 @@
Bundle-Version: 3.2.1.qualifier
Bundle-Vendor: JBoss by RedHat
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Eclipse-BundleShape: dir
Require-Bundle: org.junit,
org.jboss.tools.tests,
org.jboss.ide.eclipse.archives.ui,
13 years, 8 months
JBoss Tools SVN: r40019 - trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples.
by jbosstools-commits@lists.jboss.org
Author: ldimaggio
Date: 2012-04-03 22:37:29 -0400 (Tue, 03 Apr 2012)
New Revision: 40019
Modified:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/SimpleEAPTest.java
Log:
Added more test steps to simple EAP test
Modified: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/SimpleEAPTest.java
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/SimpleEAPTest.java 2012-04-03 21:28:39 UTC (rev 40018)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/SimpleEAPTest.java 2012-04-04 02:37:29 UTC (rev 40019)
@@ -1,5 +1,9 @@
package org.jboss.tools.esb.ui.bot.tests.examples;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+
import org.jboss.tools.ui.bot.ext.ExampleTest;
import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
import org.jboss.tools.ui.bot.ext.SWTOpenExt;
@@ -11,6 +15,9 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
import org.jboss.tools.ui.bot.ext.gen.ActionItem;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.ESBESBFile;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.ESBESBProject;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.SeamSeamWebProject;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebDynamicWebProject;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
@@ -22,6 +29,7 @@
import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.GeneralFolder;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.View.ServerServers;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.view.ProblemsView;
import org.jboss.tools.ui.bot.ext.view.ServersView;
@@ -56,7 +64,8 @@
@Require(server=(a)Server(type=ServerType.EAP,state=ServerState.Running))
public class SimpleEAPTest extends EAPExampleTest {
- public static String baseDir = "/opt/local/EAP6_ER3";
+ public static String baseDir = null; // "/opt/local/EAP6_ER41";
+ Hashtable<String, Integer> portTable = new Hashtable<String, Integer>();
@Override
public String getExampleName() {
@@ -68,6 +77,10 @@
}
@Override
protected void executeExample() {
+
+ /* Ports referenced in the server's config */
+ portTable.put("Web", 8080);
+ portTable.put("Management", 9999);
// 1) Open recent JBoss Tools
// 2) open servers view (window -> show view -> other -> Servers)
@@ -87,14 +100,22 @@
// 5) in editor, verify all server ports are accurate (JNDI / Web / JMX RMI) (right side of editor)
theServer.doubleClick();
- assertTrue("The web port is 8080 ", bot.textWithLabel("Web").getText().equals("8080"));
- assertTrue("The management port is 9999 ", bot.textWithLabel("Management").getText().equals("9999"));
-
+ Enumeration<String> ePortKeys = portTable.keys();
+ while (ePortKeys.hasMoreElements()) {
+ String tempStr = ePortKeys.nextElement();
+ assertTrue("The " + tempStr + " port should be " + portTable.get(tempStr), bot.textWithLabel(tempStr).getText().equals(portTable.get(tempStr).toString()));
+ }
+
//6) click "open launch configuration" in the editor, verify launch configuration arguments and vm args match with what is expected
// a) *** If there are any new arguments that have changed since the previous AS version, MAKE SURE the launch configuration HAS them!
bot.hyperlink("Open launch configuration").click();
bot.sleep(3000l);
+
+ String tempStr1 = bot.textInGroup("Working directory:", 1).getText();
+ int binStr = tempStr1.indexOf("/jboss-eap-6.0/bin");
+ String baseDir = tempStr1.substring(0, binStr);
+
//System.out.println (bot.textInGroup("Program &arguments:").getText() );
assertTrue ("The Program arguments match ",
bot.textInGroup("Program &arguments:").getText().equals("-mp \"" + baseDir + "/jboss-eap-6.0/modules\" -jaxpmodule javax.xml.jaxp-provider " +
@@ -114,11 +135,40 @@
"\"-Dlogging.configuration=file:" + baseDir + "/jboss-eap-6.0/standalone/configuration/logging.properties\" " +
"\"-Djboss.home.dir=" + baseDir + "/jboss-eap-6.0\" "));
- //org.jboss.tools.ui.bot.ext.SWTUtilExt.displayAllBotWidgets(bot);
+ org.jboss.tools.ui.bot.ext.SWTUtilExt.displayAllBotWidgets(bot);
+ //bot.sleep(30000l);
+ bot.button("Cancel").click();
-// 7) In servers view, expand the server and look at XML Configuration/Ports, verify all labels have a number next to them
-// 9) Create a project (seam or dynamic web is fine, seam project is better)
+ // 7) In servers view, expand the server and look at XML Configuration/Ports, verify all labels have a number next to them
+ theSWTBotView = open.viewOpen(ServerServers.LABEL);
+ serverTree = bot.tree(0);
+ theServerView = new ServersView();
+ theServer = theServerView.findServerByName(serverTree, "EAP-6.0");
+
+ theServer.expand();
+ SWTBotTreeItem thePorts = theServer.expandNode("XML Configuration").getNode("Ports");
+ ePortKeys = portTable.keys();
+ while (ePortKeys.hasMoreElements()) {
+ String tempStr = ePortKeys.nextElement();
+ assertTrue("The " + tempStr + " port should be " + portTable.get(tempStr), bot.textWithLabel(tempStr).getText().equals(portTable.get(tempStr).toString()));
+ }
+
+ // 9) Create a project (seam or dynamic web is fine, seam project is better)
+ theSWTBotView = open.viewOpen(ActionItem.View.GeneralNavigator.LABEL);
+ SWTBot wiz = open.newObject(ActionItem.NewObject.WebDynamicWebProject.LABEL);
+ wiz.textWithLabel(WebDynamicWebProject.TEXT_PROJECT_NAME).setText("DynWebProject");
+ wiz.button(IDELabel.Button.NEXT).click();
+ wiz.button(IDELabel.Button.NEXT).click();
+ wiz.button("Finish").click();
+ wiz.sleep(30000l);
+ bot.button("No").click();
+
// 10) Deploy it to the server, Verify the deployment works
+
+
+
+
+
// 11) remove deployment, verify console shows deployment removed
// 12) Open MBean Viewer,
// a) note that the server can now be expanded,
@@ -129,10 +179,14 @@
// 14) use mbean viewer / editor to execute start() operation on DeploymentScaner
// 15) verify console now accepts deployment
- bot.sleep(60000l);
+ bot.sleep(10000l);
System.out.println("***End");
SWTTestExt.servers.removeAllProjectsFromServer();
// 16) stop server, verify server shuts down properly without error.
}
}
+
+
+
+//org.jboss.tools.ui.bot.ext.SWTUtilExt.displayAllBotWidgets(bot);
\ No newline at end of file
13 years, 8 months
JBoss Tools SVN: r40018 - trunk/maven/plugins/org.jboss.tools.maven.gwt/src/org/jboss/tools/maven/gwt.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-04-03 17:28:39 -0400 (Tue, 03 Apr 2012)
New Revision: 40018
Modified:
trunk/maven/plugins/org.jboss.tools.maven.gwt/src/org/jboss/tools/maven/gwt/GWTProjectConfigurator.java
Log:
https://issues.jboss.org/browse/JBIDE-11244 Auto-discover all the modules and add them to the configuration on GWT project import
check for none java project added to avoid NP Exceptions
Modified: trunk/maven/plugins/org.jboss.tools.maven.gwt/src/org/jboss/tools/maven/gwt/GWTProjectConfigurator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.gwt/src/org/jboss/tools/maven/gwt/GWTProjectConfigurator.java 2012-04-03 21:06:25 UTC (rev 40017)
+++ trunk/maven/plugins/org.jboss.tools.maven.gwt/src/org/jboss/tools/maven/gwt/GWTProjectConfigurator.java 2012-04-03 21:28:39 UTC (rev 40018)
@@ -17,6 +17,7 @@
import org.apache.maven.plugin.MojoExecution;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.m2e.core.project.MavenProjectChangedEvent;
@@ -44,18 +45,24 @@
boolean configureGWT = store.getBoolean(Activator.CONFIGURE_GWT);
log.debug("GWT Entry Point Modules configuration is {}",configureGWT ? "enabled" : "disabled");
if(configureGWT && projectConfig.getMavenProject().getPlugin(GWT_WAR_MAVEN_PLUGIN_KEY)!=null) {
- log.debug("Configure Entry Point Modules for GWT Project {}", projectConfig.getProject().getName());
- IModule[] modules = ModuleUtils.findAllModules(JavaCore.create(projectConfig.getProject()),false);
- List<String> modNames = new ArrayList<String>();
- for (IModule iModule : modules) {
- modNames.add(iModule.getQualifiedName());
- log.debug("\t {}",iModule.getQualifiedName());
+ String projectName = projectConfig.getProject().getName();
+ IJavaProject javaProject = JavaCore.create(projectConfig.getProject());
+ if(javaProject!=null) {
+ log.debug("Configure Entry Point Modules for GWT Project {}", projectName);
+ IModule[] modules = ModuleUtils.findAllModules(javaProject,false);
+ List<String> modNames = new ArrayList<String>();
+ for (IModule iModule : modules) {
+ modNames.add(iModule.getQualifiedName());
+ log.debug("\t{}",iModule.getQualifiedName());
+ }
+ try {
+ GWTProjectProperties.setEntryPointModules(projectConfig.getProject(), modNames);
+ } catch (BackingStoreException e) {
+ log.error("Exception in Maven GWT Configurator", e);
+ }
+ } else {
+ log.debug("Skip configurator for non Java project {}",projectName);
}
- try {
- GWTProjectProperties.setEntryPointModules(projectConfig.getProject(), modNames);
- } catch (BackingStoreException e) {
- log.error("Exception in Maven GWT Configurator", e);
- }
}
}
}
13 years, 8 months
JBoss Tools SVN: r40017 - trunk/openshift/features/org.jboss.tools.openshift.egit.integration.test.feature.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-04-03 17:06:25 -0400 (Tue, 03 Apr 2012)
New Revision: 40017
Modified:
trunk/openshift/features/org.jboss.tools.openshift.egit.integration.test.feature/.project
Log:
project name updated to match feature name and fix import errors about conflicting names
Modified: trunk/openshift/features/org.jboss.tools.openshift.egit.integration.test.feature/.project
===================================================================
--- trunk/openshift/features/org.jboss.tools.openshift.egit.integration.test.feature/.project 2012-04-03 20:50:15 UTC (rev 40016)
+++ trunk/openshift/features/org.jboss.tools.openshift.egit.integration.test.feature/.project 2012-04-03 21:06:25 UTC (rev 40017)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.jboss.tools.openshift.express.test.feature</name>
+ <name>org.jboss.tools.openshift.egit.integration.test.feature</name>
<comment></comment>
<projects>
</projects>
13 years, 8 months
JBoss Tools SVN: r40016 - in trunk/modeshape: plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/cnd and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: elvisisking
Date: 2012-04-03 16:50:15 -0400 (Tue, 03 Apr 2012)
New Revision: 40016
Added:
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/ItemOwnerProvider.java
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/ChildNodeDialog.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndFormsEditorPage.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndMessages.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/PropertyDialog.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/cndMessages.properties
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/ChildNodeDefinition.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/ItemDefinition.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/NodeTypeDefinition.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/PropertyDefinition.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/cnd/CndImporter.java
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/ChildNodeDefinitionTest.java
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CndValidatorTest.java
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/NodeTypeDefinitionTest.java
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/PropertyDefinitionTest.java
Log:
JBIDE-10702 Editor for JCR Compact Node Definition (CND) files. For inherited item definitions, now showing their declaring node type in the tables. Required changes to the business objects so that they knew who their owner/parent is.
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/ChildNodeDefinition.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/ChildNodeDefinition.java 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/ChildNodeDefinition.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -25,9 +25,9 @@
import org.jboss.tools.modeshape.jcr.cnd.CndNotationPreferences.Preference;
/**
- *
+ * The <code>ChildNodeDefinition</code> class represents node type child node definition.
*/
-public class ChildNodeDefinition implements ItemDefinition, Comparable, NodeDefinitionTemplate {
+public class ChildNodeDefinition implements ItemDefinition, NodeDefinitionTemplate {
/**
* The prefix used in CND notation before the property definition.
@@ -36,10 +36,12 @@
/**
* @param childNodeBeingCopied the child node definition being copied (cannot be <code>null</code>)
+ * @param ownerProvider the owner provider that owns this child node (cannot be <code>null</code>)
* @return the copy (never <code>null</code>)
*/
- public static ChildNodeDefinition copy( final ChildNodeDefinition childNodeBeingCopied ) {
- final ChildNodeDefinition copy = new ChildNodeDefinition();
+ public static ChildNodeDefinition copy( final ChildNodeDefinition childNodeBeingCopied,
+ final ItemOwnerProvider ownerProvider ) {
+ final ChildNodeDefinition copy = new ChildNodeDefinition(ownerProvider);
// name
copy.setName(childNodeBeingCopied.getName());
@@ -86,14 +88,24 @@
private final QualifiedName name;
/**
+ * An owner provider for this property (never <code>null</code>).
+ */
+ private final ItemOwnerProvider ownerProvider;
+
+ /**
* The node required types (never <code>null</code>).
*/
private final RequiredTypes requiredTypes;
/**
* Constructs an instance set to all defaults.
+ *
+ * @param ownerProvider the item owner provider that owns this child node (cannot be <code>null</code>)
*/
- public ChildNodeDefinition() {
+ public ChildNodeDefinition( final ItemOwnerProvider ownerProvider ) {
+ Utils.verifyIsNotNull(ownerProvider, "ownerProvider"); //$NON-NLS-1$
+
+ this.ownerProvider = ownerProvider;
this.attributes = new NodeAttributes();
this.name = new QualifiedName();
this.defaultType = new DefaultType();
@@ -263,6 +275,10 @@
return false;
}
+ if (!Utils.equals(getDeclaringNodeTypeDefinitionName(), that.getDeclaringNodeTypeDefinitionName())) {
+ return false;
+ }
+
return this.requiredTypes.equals(that.requiredTypes);
}
@@ -294,6 +310,16 @@
/**
* {@inheritDoc}
*
+ * @see org.jboss.tools.modeshape.jcr.ItemDefinition#getDeclaringNodeTypeDefinitionName()
+ */
+ @Override
+ public QualifiedName getDeclaringNodeTypeDefinitionName() {
+ return this.ownerProvider.getOwnerQualifiedName();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see javax.jcr.nodetype.NodeDefinition#getDefaultPrimaryType()
* @throws UnsupportedOperationException if method is called
*/
@@ -464,7 +490,8 @@
*/
@Override
public int hashCode() {
- return Utils.hashCode(this.attributes, this.name, this.defaultType, this.requiredTypes);
+ return Utils.hashCode(this.attributes, this.name, this.defaultType, this.requiredTypes,
+ getDeclaringNodeTypeDefinitionName());
}
/**
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/ItemDefinition.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/ItemDefinition.java 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/ItemDefinition.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -12,7 +12,7 @@
/**
* An interface for property definitions and child node definitions.
*/
-public interface ItemDefinition extends CndElement {
+public interface ItemDefinition extends CndElement, Comparable {
/**
* Defines a residual set of child items.
@@ -20,6 +20,11 @@
String RESIDUAL_NAME = "*"; //$NON-NLS-1$
/**
+ * @return the name of the node type definition where this item definition is defined (never <code>null</code>)
+ */
+ QualifiedName getDeclaringNodeTypeDefinitionName();
+
+ /**
* @return the qualified name (never <code>null</code>)
*/
QualifiedName getQualifiedName();
Added: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/ItemOwnerProvider.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/ItemOwnerProvider.java (rev 0)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/ItemOwnerProvider.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -0,0 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ *
+ * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
+ *
+ * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
+ */
+package org.jboss.tools.modeshape.jcr;
+
+/**
+ * Provides information about an item's owner.
+ */
+public interface ItemOwnerProvider {
+
+ /**
+ * @return the qualified name of the owner (never <code>null</code>)
+ */
+ QualifiedName getOwnerQualifiedName();
+}
Property changes on: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/ItemOwnerProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/NodeTypeDefinition.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/NodeTypeDefinition.java 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/NodeTypeDefinition.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -31,7 +31,7 @@
/**
* Represents a CND node type definition.
*/
-public class NodeTypeDefinition implements CndElement, Comparable, NodeTypeTemplate {
+public class NodeTypeDefinition implements CndElement, Comparable, ItemOwnerProvider, NodeTypeTemplate {
/**
* Then node type name prefix used in the CND notation.
@@ -65,12 +65,12 @@
// child nodes
for (final ChildNodeDefinition childNode : nodeTypeToCopy.getChildNodeDefinitions()) {
- copy.addChildNodeDefinition(ChildNodeDefinition.copy(childNode));
+ copy.addChildNodeDefinition(ChildNodeDefinition.copy(childNode, copy));
}
// properties
for (final PropertyDefinition property : nodeTypeToCopy.getPropertyDefinitions()) {
- copy.addPropertyDefinition(PropertyDefinition.copy(property));
+ copy.addPropertyDefinition(PropertyDefinition.copy(property, copy));
}
// supertypes
@@ -317,7 +317,7 @@
}
/**
- * @return the child node definitions (never <code>null</code>)
+ * @return the declared child node definitions (never <code>null</code>)
*/
public List<ChildNodeDefinition> getChildNodeDefinitions() {
if (this.cndElements == null) {
@@ -416,6 +416,16 @@
}
/**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.tools.modeshape.jcr.ItemOwnerProvider#getOwnerQualifiedName()
+ */
+ @Override
+ public QualifiedName getOwnerQualifiedName() {
+ return getQualifiedName();
+ }
+
+ /**
* @return the qualified primary item name (never <code>null</code>)
*/
public QualifiedName getPrimaryItem() {
@@ -440,7 +450,7 @@
}
/**
- * @return the property definitions (never <code>null</code>)
+ * @return the declared property definitions (never <code>null</code>)
*/
public List<PropertyDefinition> getPropertyDefinitions() {
if (this.cndElements == null) {
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/PropertyDefinition.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/PropertyDefinition.java 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/PropertyDefinition.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -32,7 +32,7 @@
/**
* The <code>PropertyDefinition</code> class represents node type property definition.
*/
-public class PropertyDefinition implements ItemDefinition, Comparable, PropertyDefinitionTemplate {
+public class PropertyDefinition implements ItemDefinition, PropertyDefinitionTemplate {
/**
* The prefix used in CND notation before the property definition.
@@ -46,10 +46,12 @@
/**
* @param propertyBeingCopied the property definition being copied (cannot be <code>null</code>)
+ * @param ownerProvider the item owner provider that owns this property (cannot be <code>null</code>)
* @return the copy (never <code>null</code>)
*/
- public static final PropertyDefinition copy( final PropertyDefinition propertyBeingCopied ) {
- final PropertyDefinition copy = new PropertyDefinition();
+ public static final PropertyDefinition copy( final PropertyDefinition propertyBeingCopied,
+ final ItemOwnerProvider ownerProvider ) {
+ final PropertyDefinition copy = new PropertyDefinition(ownerProvider);
// name
copy.setName(propertyBeingCopied.getName());
@@ -106,6 +108,11 @@
private final QualifiedName name;
/**
+ * An owner provider for this property (never <code>null</code>).
+ */
+ private final ItemOwnerProvider ownerProvider;
+
+ /**
* The property type (never <code>null</code>).
*/
private PropertyType type;
@@ -117,8 +124,13 @@
/**
* Constructs an instance with a default type of {@link PropertyType#STRING}.
+ *
+ * @param ownerProvider the item owner provider that owns this property (cannot be <code>null</code>)
*/
- public PropertyDefinition() {
+ public PropertyDefinition( final ItemOwnerProvider ownerProvider ) {
+ Utils.verifyIsNotNull(ownerProvider, "ownerProvider"); //$NON-NLS-1$
+
+ this.ownerProvider = ownerProvider;
this.type = PropertyType.DEFAULT_VALUE;
this.name = new QualifiedName();
this.attributes = new PropertyAttributes();
@@ -325,8 +337,6 @@
}
final PropertyDefinition that = (PropertyDefinition)obj;
- // this.defaultValues = new DefaultValues();
- // this.valueConstraints = new ValueConstraints();
if (!this.attributes.equals(that.attributes)) {
return false;
@@ -344,6 +354,10 @@
return false;
}
+ if (!Utils.equals(getDeclaringNodeTypeDefinitionName(), that.getDeclaringNodeTypeDefinitionName())) {
+ return false;
+ }
+
return this.valueConstraints.equals(that.valueConstraints);
}
@@ -385,6 +399,16 @@
/**
* {@inheritDoc}
*
+ * @see org.jboss.tools.modeshape.jcr.ItemDefinition#getDeclaringNodeTypeDefinitionName()
+ */
+ @Override
+ public QualifiedName getDeclaringNodeTypeDefinitionName() {
+ return this.ownerProvider.getOwnerQualifiedName();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see javax.jcr.nodetype.PropertyDefinition#getDefaultValues()
*/
@Override
@@ -542,7 +566,8 @@
*/
@Override
public int hashCode() {
- return Utils.hashCode(this.attributes, this.name, this.defaultValues, this.type, this.valueConstraints);
+ return Utils.hashCode(this.attributes, this.name, this.defaultValues, this.type, this.valueConstraints,
+ getDeclaringNodeTypeDefinitionName());
}
/**
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/cnd/CndImporter.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/cnd/CndImporter.java 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/cnd/CndImporter.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -172,7 +172,7 @@
assert (nodeTypeDefn != null) : "nodeTypeDefn is null"; //$NON-NLS-1$
tokens.consume(ChildNodeDefinition.NOTATION_PREFIX);
- final ChildNodeDefinition childNodeDefn = new ChildNodeDefinition();
+ final ChildNodeDefinition childNodeDefn = new ChildNodeDefinition(nodeTypeDefn);
// name
final String name = parseName(tokens);
@@ -610,7 +610,7 @@
assert (nodeTypeDefn != null) : "nodeTypeDefn is null"; //$NON-NLS-1$
tokens.consume(PropertyDefinition.NOTATION_PREFIX);
- final PropertyDefinition propDefn = new PropertyDefinition();
+ final PropertyDefinition propDefn = new PropertyDefinition(nodeTypeDefn);
// name
final String name = parseName(tokens);
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/ChildNodeDialog.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/ChildNodeDialog.java 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/ChildNodeDialog.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -56,6 +56,7 @@
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.jboss.tools.modeshape.jcr.ChildNodeDefinition;
import org.jboss.tools.modeshape.jcr.ChildNodeDefinition.PropertyName;
+import org.jboss.tools.modeshape.jcr.ItemOwnerProvider;
import org.jboss.tools.modeshape.jcr.Messages;
import org.jboss.tools.modeshape.jcr.QualifiedName;
import org.jboss.tools.modeshape.jcr.Utils;
@@ -108,13 +109,17 @@
* Used to create a new child node definition.
*
* @param parentShell the parent shell (can be <code>null</code>)
+ * @param ownerProvider an item owner provider for the new child node (cannot be <code>null</code>)
* @param existingChildNodeNames the existing child node names (can be <code>null</code> or empty)
* @param existingNamespacePrefixes the existing CND namespace prefixes (can be <code>null</code> or empty)
*/
public ChildNodeDialog( final Shell parentShell,
+ final ItemOwnerProvider ownerProvider,
final Collection<QualifiedName> existingChildNodeNames,
final Collection<String> existingNamespacePrefixes ) {
super(parentShell);
+ Utils.verifyIsNotNull(ownerProvider, "ownerProvider"); //$NON-NLS-1$
+
this.existingChildNodeNames = ((existingChildNodeNames == null) ? Collections.<QualifiedName> emptyList()
: new ArrayList<QualifiedName>(existingChildNodeNames));
this.existingNamespacePrefixes = ((existingNamespacePrefixes == null) ? Collections.<String> emptyList()
@@ -122,28 +127,30 @@
this.nameError = new ErrorMessage();
this.defaultTypeError = new ErrorMessage();
this.requiredTypesError = new ErrorMessage();
- this.childNodeBeingEdited = new ChildNodeDefinition();
+ this.childNodeBeingEdited = new ChildNodeDefinition(ownerProvider);
}
/**
* Used to edit a child node definition.
*
* @param parentShell the parent shell (can be <code>null</code>)
+ * @param ownerProvider an item owner provider for the new child node (cannot be <code>null</code>)
* @param existingChildNodeNames the existing child node names (can be <code>null</code> or empty)
* @param existingNamespacePrefixes the existing CND namespace prefixes (can be <code>null</code> or empty)
* @param childNodeBeingEdited the child node definition being edited (cannot be <code>null</code>)
*/
public ChildNodeDialog( final Shell parentShell,
+ final ItemOwnerProvider ownerProvider,
final Collection<QualifiedName> existingChildNodeNames,
final Collection<String> existingNamespacePrefixes,
final ChildNodeDefinition childNodeBeingEdited ) {
- this(parentShell, existingChildNodeNames, existingNamespacePrefixes);
+ this(parentShell, ownerProvider, existingChildNodeNames, existingNamespacePrefixes);
Utils.verifyIsNotNull(childNodeBeingEdited, "childNodeBeingEdited"); //$NON-NLS-1$
this.originalChildNode = childNodeBeingEdited;
// create copy of child node being edited
- this.childNodeBeingEdited = ChildNodeDefinition.copy(this.originalChildNode);
+ this.childNodeBeingEdited = ChildNodeDefinition.copy(this.originalChildNode, ownerProvider);
// remove name from existing names so that validation won't show it as a duplicate
if (!Utils.isEmpty(this.childNodeBeingEdited.getName())) {
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndFormsEditorPage.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndFormsEditorPage.java 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndFormsEditorPage.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -293,13 +293,14 @@
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getBackground(java.lang.Object)
*/
@Override
- public Color getBackground( Object element ) {
+ public Color getBackground( final Object element ) {
final ChildNodeDefinition childNodeDefinition = (ChildNodeDefinition)element;
if (shouldShowInheritedChildNodes()) {
- NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
+ final NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
- if (!nodeTypeDefinition.hasDeclaredChildNodeDefinition(childNodeDefinition.getName())) {
+ if (Utils.equivalent(nodeTypeDefinition.getName(), childNodeDefinition.getDeclaringNodeTypeDefinitionName()
+ .get())) {
return getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
}
}
@@ -313,13 +314,14 @@
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getFont(java.lang.Object)
*/
@Override
- public Font getFont( Object element ) {
+ public Font getFont( final Object element ) {
final ChildNodeDefinition childNodeDefinition = (ChildNodeDefinition)element;
if (shouldShowInheritedChildNodes()) {
- NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
+ final NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
- if (!nodeTypeDefinition.hasDeclaredChildNodeDefinition(childNodeDefinition.getName())) {
+ if (Utils.equivalent(nodeTypeDefinition.getName(), childNodeDefinition.getDeclaringNodeTypeDefinitionName()
+ .get())) {
return JFaceResources.getFontRegistry().getItalic(JFaceResources.TEXT_FONT);
}
}
@@ -342,6 +344,15 @@
final NotationType notationType = NotationType.LONG;
+ if (this.columnIndex == ChildNodeColumnIndexes.DECLARING_NODE_TYPE) {
+ if (Utils.equivalent(getSelectedNodeType().getName(), childNodeDefinition.getDeclaringNodeTypeDefinitionName()
+ .get())) {
+ return childNodeDefinition.getDeclaringNodeTypeDefinitionName().get();
+ }
+
+ return Utils.EMPTY_STRING;
+ }
+
if (this.columnIndex == ChildNodeColumnIndexes.DEFAULT_TYPE) {
return childNodeDefinition.getDefaultType().getDefaultType().get();
}
@@ -387,7 +398,7 @@
try {
return getCnd().getChildNodeDefinitions(nodeTypeDefinition.getName(), shouldShowInheritedChildNodes())
.toArray();
- } catch (Exception e) {
+ } catch (final Exception e) {
Activator.getSharedInstance()
.getLog()
.log(new Status(IStatus.ERROR,
@@ -417,7 +428,7 @@
// open edit child node on double click
final IAction editAction = this.editChildNode;
-
+
this.childNodeViewer.addDoubleClickListener(new IDoubleClickListener() {
/**
@@ -471,6 +482,12 @@
CndMessages.attributesHeaderText, CndMessages.childNodeAttributesToolTip, false, true);
}
+ { // create declaring node type column
+ final TableViewerColumn nodeTypeColumn = new TableViewerColumn(this.childNodeViewer, SWT.LEFT);
+ UiUtils.configureColumn(nodeTypeColumn, new ChildNodeLabelProvider(ChildNodeColumnIndexes.DECLARING_NODE_TYPE),
+ CndMessages.declaringNodeTypeHeaderText, CndMessages.declaringNodeTypeToolTip, false, true);
+ }
+
// this will sort by child node name
this.childNodeViewer.setSorter(new ViewerSorter() {
@@ -1286,13 +1303,14 @@
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getBackground(java.lang.Object)
*/
@Override
- public Color getBackground( Object element ) {
+ public Color getBackground( final Object element ) {
final PropertyDefinition propertyDefinition = (PropertyDefinition)element;
if (shouldShowInheritedProperties()) {
- NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
+ final NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
- if (!nodeTypeDefinition.hasDeclaredPropertyDefinition(propertyDefinition.getName())) {
+ if (!Utils.equivalent(nodeTypeDefinition.getName(), propertyDefinition.getDeclaringNodeTypeDefinitionName()
+ .get())) {
return getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
}
}
@@ -1306,13 +1324,14 @@
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getFont(java.lang.Object)
*/
@Override
- public Font getFont( Object element ) {
+ public Font getFont( final Object element ) {
final PropertyDefinition propertyDefinition = (PropertyDefinition)element;
if (shouldShowInheritedProperties()) {
- NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
+ final NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
- if (!nodeTypeDefinition.hasDeclaredPropertyDefinition(propertyDefinition.getName())) {
+ if (!Utils.equivalent(nodeTypeDefinition.getName(), propertyDefinition.getDeclaringNodeTypeDefinitionName()
+ .get())) {
return JFaceResources.getFontRegistry().getItalic(JFaceResources.TEXT_FONT);
}
}
@@ -1343,6 +1362,15 @@
return propertyDefinition.getAttributesCndNotation(notationType);
}
+ if (this.columnIndex == PropertyColumnIndexes.DECLARING_NODE_TYPE) {
+ if (!Utils.equivalent(getSelectedNodeType().getName(), propertyDefinition.getDeclaringNodeTypeDefinitionName()
+ .get())) {
+ return propertyDefinition.getDeclaringNodeTypeDefinitionName().get();
+ }
+
+ return Utils.EMPTY_STRING;
+ }
+
if (this.columnIndex == PropertyColumnIndexes.DEFAULT_VALUES) {
final List<String> defaultValues = propertyDefinition.getDefaultValuesAsStrings();
@@ -1390,7 +1418,7 @@
try {
return getCnd().getPropertyDefinitions(nodeTypeDefinition.getName(), shouldShowInheritedProperties())
.toArray();
- } catch (Exception e) {
+ } catch (final Exception e) {
Activator.getSharedInstance()
.getLog()
.log(new Status(IStatus.ERROR,
@@ -1481,6 +1509,12 @@
true);
}
+ { // create declaring node type column
+ final TableViewerColumn nodeTypeColumn = new TableViewerColumn(this.propertyViewer, SWT.LEFT);
+ UiUtils.configureColumn(nodeTypeColumn, new PropertyLabelProvider(PropertyColumnIndexes.DECLARING_NODE_TYPE),
+ CndMessages.declaringNodeTypeHeaderText, CndMessages.declaringNodeTypeToolTip, false, true);
+ }
+
// this will sort by property name
this.propertyViewer.setSorter(new ViewerSorter() {
@@ -1768,7 +1802,10 @@
void handleAddChildNode() {
assert (getSelectedNodeType() != null) : "add child node handler called but there is no selected node type"; //$NON-NLS-1$
- final ChildNodeDialog dialog = new ChildNodeDialog(getShell(), getChildNodeNames(), getCnd().getNamespacePrefixes());
+ final ChildNodeDialog dialog = new ChildNodeDialog(getShell(),
+ getSelectedNodeType(),
+ getChildNodeNames(),
+ getCnd().getNamespacePrefixes());
dialog.create();
dialog.getShell().pack();
@@ -1854,6 +1891,7 @@
final NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
final PropertyDialog dialog = new PropertyDialog(getShell(),
+ getSelectedNodeType(),
getPropertyNames(),
getCnd().getNamespacePrefixes(),
nodeTypeDefinition.isQueryable());
@@ -2062,6 +2100,7 @@
final ChildNodeDefinition childNodeBeingEdited = getSelectedChildNode();
final ChildNodeDialog dialog = new ChildNodeDialog(getShell(),
+ getSelectedNodeType(),
getChildNodeNames(),
getCnd().getNamespacePrefixes(),
childNodeBeingEdited);
@@ -2138,6 +2177,7 @@
final NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
final PropertyDefinition propertyBeingEdited = getSelectedProperty();
final PropertyDialog dialog = new PropertyDialog(getShell(),
+ getSelectedNodeType(),
getPropertyNames(),
getCnd().getNamespacePrefixes(),
nodeTypeDefinition.isQueryable(),
@@ -2848,6 +2888,7 @@
interface ChildNodeColumnIndexes {
int ATTRIBUTES = 3;
+ int DECLARING_NODE_TYPE = 4;
int DEFAULT_TYPE = 2;
int NAME = 0;
int REQUIRED_TYPES = 1;
@@ -2872,6 +2913,7 @@
interface PropertyColumnIndexes {
int ATTRIBUTES = 3;
int CONSTRAINTS = 4;
+ int DECLARING_NODE_TYPE = 5;
int DEFAULT_VALUES = 2;
int NAME = 0;
int TYPE = 1;
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndMessages.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndMessages.java 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndMessages.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -320,6 +320,16 @@
public static String cndMessageDialogTitle;
/**
+ * The column header text of the declaring node type of an item definition.
+ */
+ public static String declaringNodeTypeHeaderText;
+
+ /**
+ * The tool tip message of the declaring node type of an item definition.
+ */
+ public static String declaringNodeTypeToolTip;
+
+ /**
* The column header text of the default type of a child node definition.
*/
public static String defaultTypeHeaderText;
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/PropertyDialog.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/PropertyDialog.java 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/PropertyDialog.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -52,6 +52,7 @@
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.jboss.tools.modeshape.jcr.ItemOwnerProvider;
import org.jboss.tools.modeshape.jcr.Messages;
import org.jboss.tools.modeshape.jcr.PropertyDefinition;
import org.jboss.tools.modeshape.jcr.PropertyDefinition.PropertyName;
@@ -107,11 +108,13 @@
* Used to create a new property definition.
*
* @param parentShell the parent shell (can be <code>null</code>)
+ * @param ownerProvider an item owner provider for the new property (cannot be <code>null</code>)
* @param existingPropertyNames the existing property names (can be <code>null</code> or empty)
* @param existingNamespacePrefixes the existing CND namespace prefixes (can be <code>null</code> or empty)
* @param nodeTypeQueryable indicates if node type of the property being created is queryable
*/
public PropertyDialog( final Shell parentShell,
+ final ItemOwnerProvider ownerProvider,
final Collection<QualifiedName> existingPropertyNames,
final Collection<String> existingNamespacePrefixes,
final boolean nodeTypeQueryable ) {
@@ -124,30 +127,32 @@
this.defaultValuesError = new ErrorMessage();
this.nameError = new ErrorMessage();
this.valueConstraintsError = new ErrorMessage();
- this.propertyBeingEdited = new PropertyDefinition();
+ this.propertyBeingEdited = new PropertyDefinition(ownerProvider);
}
/**
* Used to edit a property definition.
*
* @param parentShell the parent shell (can be <code>null</code>)
+ * @param ownerProvider an item owner provider for the new property (cannot be <code>null</code>)
* @param existingPropertyNames the existing property names (can be <code>null</code> or empty)
* @param existingNamespacePrefixes the existing CND namespace prefixes (can be <code>null</code> or empty)
* @param nodeTypeQueryable indicates if node type of the property being edited is queryable
* @param propertyDefinitionBeingEdited the property definition being edited (cannot be <code>null</code>)
*/
public PropertyDialog( final Shell parentShell,
+ final ItemOwnerProvider ownerProvider,
final Collection<QualifiedName> existingPropertyNames,
final Collection<String> existingNamespacePrefixes,
final boolean nodeTypeQueryable,
final PropertyDefinition propertyDefinitionBeingEdited ) {
- this(parentShell, existingPropertyNames, existingNamespacePrefixes, nodeTypeQueryable);
+ this(parentShell, ownerProvider, existingPropertyNames, existingNamespacePrefixes, nodeTypeQueryable);
Utils.verifyIsNotNull(propertyDefinitionBeingEdited, "propertyDefinitionBeingEdited"); //$NON-NLS-1$
this.originalProperty = propertyDefinitionBeingEdited;
// create copy of property being edited
- this.propertyBeingEdited = PropertyDefinition.copy(this.originalProperty);
+ this.propertyBeingEdited = PropertyDefinition.copy(this.originalProperty, ownerProvider);
// remove name from existing names so that validation won't show it as a duplicate
if (!Utils.isEmpty(this.propertyBeingEdited.getName())) {
@@ -633,7 +638,7 @@
*/
@Override
public void widgetSelected( final SelectionEvent e ) {
- Button btn = (Button)e.widget;
+ final Button btn = (Button)e.widget;
handleQueryOperatorChanged(btn.getText(), btn.getSelection());
}
});
@@ -658,7 +663,7 @@
*/
@Override
public void widgetSelected( final SelectionEvent e ) {
- Button btn = (Button)e.widget;
+ final Button btn = (Button)e.widget;
handleQueryOperatorChanged(btn.getText(), btn.getSelection());
}
});
@@ -683,7 +688,7 @@
*/
@Override
public void widgetSelected( final SelectionEvent e ) {
- Button btn = (Button)e.widget;
+ final Button btn = (Button)e.widget;
handleQueryOperatorChanged(btn.getText(), btn.getSelection());
}
});
@@ -708,7 +713,7 @@
*/
@Override
public void widgetSelected( final SelectionEvent e ) {
- Button btn = (Button)e.widget;
+ final Button btn = (Button)e.widget;
handleQueryOperatorChanged(btn.getText(), btn.getSelection());
}
});
@@ -734,7 +739,7 @@
*/
@Override
public void widgetSelected( final SelectionEvent e ) {
- Button btn = (Button)e.widget;
+ final Button btn = (Button)e.widget;
handleQueryOperatorChanged(btn.getText(), btn.getSelection());
}
});
@@ -759,7 +764,7 @@
*/
@Override
public void widgetSelected( final SelectionEvent e ) {
- Button btn = (Button)e.widget;
+ final Button btn = (Button)e.widget;
handleQueryOperatorChanged(btn.getText(), btn.getSelection());
}
});
@@ -888,19 +893,6 @@
validateType();
}
- /**
- * @param text
- * @param selection
- */
- protected void handleQueryOperatorChanged( String text,
- boolean selection ) {
- if (selection) {
- this.propertyBeingEdited.addQueryOperator(QueryOperator.find(text));
- } else {
- this.propertyBeingEdited.removeQueryOperator(QueryOperator.find(text));
- }
- }
-
void createValueConstraintsActions() {
this.addValueConstraint = new Action(Utils.EMPTY_STRING) {
@@ -1429,6 +1421,19 @@
this.propertyBeingEdited.setProtected(newProtected);
}
+ /**
+ * @param text
+ * @param selection
+ */
+ protected void handleQueryOperatorChanged( final String text,
+ final boolean selection ) {
+ if (selection) {
+ this.propertyBeingEdited.addQueryOperator(QueryOperator.find(text));
+ } else {
+ this.propertyBeingEdited.removeQueryOperator(QueryOperator.find(text));
+ }
+ }
+
void handleTypeChanged( final String newType ) {
this.propertyBeingEdited.setType(PropertyType.valueOf(newType));
}
@@ -1481,7 +1486,7 @@
}
private void validateDefaultValues() {
- updateMessage(CndValidator.validateDefaultValues(this.propertyBeingEdited, existingNamespacePrefixes),
+ updateMessage(CndValidator.validateDefaultValues(this.propertyBeingEdited, this.existingNamespacePrefixes),
this.defaultValuesError);
}
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/cndMessages.properties
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/cndMessages.properties 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/cndMessages.properties 2012-04-03 20:50:15 UTC (rev 40016)
@@ -68,6 +68,8 @@
cndMessageDialogMessageAreaMessage = The {0} CND has {1} error(s), {2} warnings, and {3} information messages.
cndMessageDialogMessageAreaTitle = Message Summary
cndMessageDialogTitle = CND Validation Messages
+declaringNodeTypeHeaderText = Declaring Node Type
+declaringNodeTypeToolTip = The node type definition that defines the property or child node
defaultTypeHeaderText = Default Type
defaultValueDialogCreateMsg = Create Default Value
defaultValueDialogEditMsg = Edit Default Value
@@ -223,8 +225,8 @@
requiredTypesLabel = Required Types:
sameNamedSiblingsAttribute = Same Named Siblings
sameNamedSiblingsAttributeToolTip = Indicates if the node type can be queried
-showInheritedChildNodesToolTip = Show the child node definitions inherited by the selected node type definition
-showInheritedPropertiesToolTip = Show the property definitions inherited by the selected node type definition
+showInheritedChildNodesToolTip = Show the child node definitions inherited by the selected node type or just those explictly declared
+showInheritedPropertiesToolTip = Show the property definitions inherited by the selected node type or just those explictly declared
supertypesLabel = Supertypes:
supertypesToolTip = The supertypes (node types and mixins) whose property definitions and child node definitions are inherited
typeHeaderText = Type
Modified: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/ChildNodeDefinitionTest.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/ChildNodeDefinitionTest.java 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/ChildNodeDefinitionTest.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -15,6 +15,8 @@
import org.jboss.tools.modeshape.jcr.ChildNodeDefinition;
import org.jboss.tools.modeshape.jcr.ChildNodeDefinition.PropertyName;
import org.jboss.tools.modeshape.jcr.Listener;
+import org.jboss.tools.modeshape.jcr.NodeTypeDefinition;
+import org.jboss.tools.modeshape.jcr.QualifiedName;
import org.jboss.tools.modeshape.jcr.Utils;
import org.jboss.tools.modeshape.jcr.attributes.AttributeState.Value;
import org.jboss.tools.modeshape.jcr.attributes.OnParentVersion;
@@ -26,63 +28,68 @@
*/
public class ChildNodeDefinitionTest {
+ private static final QualifiedName OWNER_NAME = Constants.QUALIFIED_NAME1;
+
+ private NodeTypeDefinition owner;
private ChildNodeDefinition childNodeDefinition;
@Before
public void beforeEach() {
- this.childNodeDefinition = new ChildNodeDefinition();
+ this.owner = new NodeTypeDefinition();
+ this.owner.setName(OWNER_NAME.get());
+ this.childNodeDefinition = new ChildNodeDefinition(owner);
}
@Test
public void copiesShouldBeEqualAndHaveSameHashCode() {
- ChildNodeDefinition thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition);
+ ChildNodeDefinition thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition, this.owner);
assertEquals(this.childNodeDefinition, thatChildNodeDefinition);
assertEquals(this.childNodeDefinition.hashCode(), thatChildNodeDefinition.hashCode());
this.childNodeDefinition.setName(Constants.QUALIFIED_NAME1.get());
- thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition);
+ thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition, this.owner);
assertEquals(this.childNodeDefinition, thatChildNodeDefinition);
assertEquals(this.childNodeDefinition.hashCode(), thatChildNodeDefinition.hashCode());
this.childNodeDefinition.setDefaultPrimaryTypeName(Constants.DEFAULT_TYPE);
- thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition);
+ thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition, this.owner);
assertEquals(this.childNodeDefinition, thatChildNodeDefinition);
assertEquals(this.childNodeDefinition.hashCode(), thatChildNodeDefinition.hashCode());
this.childNodeDefinition.setAutoCreated(!this.childNodeDefinition.isAutoCreated());
- thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition);
+ thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition, this.owner);
assertEquals(this.childNodeDefinition, thatChildNodeDefinition);
assertEquals(this.childNodeDefinition.hashCode(), thatChildNodeDefinition.hashCode());
this.childNodeDefinition.setMandatory(!this.childNodeDefinition.isMandatory());
- thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition);
+ thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition, this.owner);
assertEquals(this.childNodeDefinition, thatChildNodeDefinition);
assertEquals(this.childNodeDefinition.hashCode(), thatChildNodeDefinition.hashCode());
this.childNodeDefinition.setProtected(!this.childNodeDefinition.isProtected());
- thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition);
+ thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition, this.owner);
assertEquals(this.childNodeDefinition, thatChildNodeDefinition);
assertEquals(this.childNodeDefinition.hashCode(), thatChildNodeDefinition.hashCode());
this.childNodeDefinition.setSameNameSiblings(!this.childNodeDefinition.allowsSameNameSiblings());
- thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition);
+ thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition, this.owner);
assertEquals(this.childNodeDefinition, thatChildNodeDefinition);
assertEquals(this.childNodeDefinition.hashCode(), thatChildNodeDefinition.hashCode());
this.childNodeDefinition.setOnParentVersion(OnParentVersion.ABORT.asJcrValue());
- thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition);
+ thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition, this.owner);
assertEquals(this.childNodeDefinition, thatChildNodeDefinition);
assertEquals(this.childNodeDefinition.hashCode(), thatChildNodeDefinition.hashCode());
this.childNodeDefinition.setRequiredPrimaryTypeNames(Constants.Helper.getDefaultQualifiedNamesAsStringArray());
- thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition);
+ thatChildNodeDefinition = ChildNodeDefinition.copy(this.childNodeDefinition, this.owner);
assertEquals(this.childNodeDefinition, thatChildNodeDefinition);
assertEquals(this.childNodeDefinition.hashCode(), thatChildNodeDefinition.hashCode());
}
@Test
public void differentInstancesWithSameValuesShouldBeEqual() {
- final ChildNodeDefinition that = new ChildNodeDefinition();
+ final ChildNodeDefinition that = new ChildNodeDefinition(this.owner);
assertEquals(this.childNodeDefinition, that);
this.childNodeDefinition.setName(Constants.QUALIFIED_NAME1.get());
@@ -120,7 +127,7 @@
@Test
public void differentInstancesWithSameValuesShouldHaveSameHashCode() {
- assertEquals(this.childNodeDefinition.hashCode(), new ChildNodeDefinition().hashCode());
+ assertEquals(this.childNodeDefinition.hashCode(), new ChildNodeDefinition(this.owner).hashCode());
}
@Test
Modified: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CndValidatorTest.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CndValidatorTest.java 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CndValidatorTest.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -35,16 +35,16 @@
@Before
public void beforeEach() {
- this.childNodeDefinition = new ChildNodeDefinition();
- this.childNodeDefinition.setName(Constants.QUALIFIED_NAME1.get());
-
this.cnd = new CompactNodeTypeDefinition();
this.namespaceMapping = new NamespaceMapping();
this.nodeTypeDefinition = new NodeTypeDefinition();
this.nodeTypeDefinition.setName(Constants.QUALIFIED_NAME1.get());
- this.propertyDefinition = new PropertyDefinition();
+ this.childNodeDefinition = new ChildNodeDefinition(this.nodeTypeDefinition);
+ this.childNodeDefinition.setName(Constants.QUALIFIED_NAME1.get());
+
+ this.propertyDefinition = new PropertyDefinition(this.nodeTypeDefinition);
this.propertyDefinition.setName(Constants.QUALIFIED_NAME1.get());
}
@@ -177,7 +177,7 @@
final String NAME = "name"; //$NON-NLS-1$
this.childNodeDefinition.setName(NAME);
- final ChildNodeDefinition child2 = new ChildNodeDefinition();
+ final ChildNodeDefinition child2 = new ChildNodeDefinition(this.nodeTypeDefinition);
child2.setName(NAME);
this.nodeTypeDefinition.addChildNodeDefinition(this.childNodeDefinition);
@@ -192,7 +192,7 @@
final String NAME = "name"; //$NON-NLS-1$
this.propertyDefinition.setName(NAME);
- final PropertyDefinition prop2 = new PropertyDefinition();
+ final PropertyDefinition prop2 = new PropertyDefinition(this.nodeTypeDefinition);
prop2.setName(NAME);
this.nodeTypeDefinition.addPropertyDefinition(this.propertyDefinition);
@@ -316,7 +316,7 @@
public void shouldAllowMultipleChildNodeDefinitionsWithResidualNames() {
this.nodeTypeDefinition.setName("nodeName"); //$NON-NLS-1$
this.childNodeDefinition.setName(ItemDefinition.RESIDUAL_NAME);
- final ChildNodeDefinition childNode2 = new ChildNodeDefinition();
+ final ChildNodeDefinition childNode2 = new ChildNodeDefinition(this.nodeTypeDefinition);
childNode2.setName(ItemDefinition.RESIDUAL_NAME);
this.nodeTypeDefinition.addChildNodeDefinition(this.childNodeDefinition);
this.nodeTypeDefinition.addChildNodeDefinition(childNode2);
@@ -328,7 +328,7 @@
public void shouldAllowMultiplePropertyDefinitionsWithResidualNames() {
this.nodeTypeDefinition.setName("nodeName"); //$NON-NLS-1$
this.propertyDefinition.setName(ItemDefinition.RESIDUAL_NAME);
- final PropertyDefinition propDefn2 = new PropertyDefinition();
+ final PropertyDefinition propDefn2 = new PropertyDefinition(this.nodeTypeDefinition);
propDefn2.setName(ItemDefinition.RESIDUAL_NAME);
this.nodeTypeDefinition.addPropertyDefinition(this.propertyDefinition);
this.nodeTypeDefinition.addPropertyDefinition(propDefn2);
@@ -346,7 +346,7 @@
public void shouldNotAllowChildNodeDefinitionsWithSameName() {
this.nodeTypeDefinition.setName("nodeName"); //$NON-NLS-1$
this.childNodeDefinition.setName("name"); //$NON-NLS-1$
- final ChildNodeDefinition childNode2 = new ChildNodeDefinition();
+ final ChildNodeDefinition childNode2 = new ChildNodeDefinition(this.nodeTypeDefinition);
childNode2.setName(this.childNodeDefinition.getName());
this.nodeTypeDefinition.addChildNodeDefinition(this.childNodeDefinition);
this.nodeTypeDefinition.addChildNodeDefinition(childNode2);
@@ -378,7 +378,7 @@
public void shouldNotAllowPropertyDefinitionsWithSameName() {
this.nodeTypeDefinition.setName("nodeName"); //$NON-NLS-1$
this.propertyDefinition.setName("name"); //$NON-NLS-1$
- final PropertyDefinition propDefn2 = new PropertyDefinition();
+ final PropertyDefinition propDefn2 = new PropertyDefinition(this.nodeTypeDefinition);
propDefn2.setName(this.propertyDefinition.getName());
this.nodeTypeDefinition.addPropertyDefinition(this.propertyDefinition);
this.nodeTypeDefinition.addPropertyDefinition(propDefn2);
Modified: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/NodeTypeDefinitionTest.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/NodeTypeDefinitionTest.java 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/NodeTypeDefinitionTest.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -33,9 +33,9 @@
@Before
public void beforeEach() {
- this.childNodeDefinition = new ChildNodeDefinition();
this.nodeTypeDefinition = new NodeTypeDefinition();
- this.propertyDefinition = new PropertyDefinition();
+ this.childNodeDefinition = new ChildNodeDefinition(this.nodeTypeDefinition);
+ this.propertyDefinition = new PropertyDefinition(this.nodeTypeDefinition);
}
@Test
@@ -79,12 +79,12 @@
assertEquals(this.nodeTypeDefinition, thatNodeTypeDefinition);
assertEquals(this.nodeTypeDefinition.hashCode(), thatNodeTypeDefinition.hashCode());
- this.nodeTypeDefinition.addChildNodeDefinition(new ChildNodeDefinition());
+ this.nodeTypeDefinition.addChildNodeDefinition(new ChildNodeDefinition(this.nodeTypeDefinition));
thatNodeTypeDefinition = NodeTypeDefinition.copy(this.nodeTypeDefinition);
assertEquals(this.nodeTypeDefinition, thatNodeTypeDefinition);
assertEquals(this.nodeTypeDefinition.hashCode(), thatNodeTypeDefinition.hashCode());
- this.nodeTypeDefinition.addPropertyDefinition(new PropertyDefinition());
+ this.nodeTypeDefinition.addPropertyDefinition(new PropertyDefinition(this.nodeTypeDefinition));
thatNodeTypeDefinition = NodeTypeDefinition.copy(this.nodeTypeDefinition);
assertEquals(this.nodeTypeDefinition, thatNodeTypeDefinition);
assertEquals(this.nodeTypeDefinition.hashCode(), thatNodeTypeDefinition.hashCode());
Modified: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/PropertyDefinitionTest.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/PropertyDefinitionTest.java 2012-04-03 20:08:42 UTC (rev 40015)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/PropertyDefinitionTest.java 2012-04-03 20:50:15 UTC (rev 40016)
@@ -16,8 +16,10 @@
import java.util.Collections;
import org.jboss.tools.modeshape.jcr.Listener;
+import org.jboss.tools.modeshape.jcr.NodeTypeDefinition;
import org.jboss.tools.modeshape.jcr.PropertyDefinition;
import org.jboss.tools.modeshape.jcr.PropertyDefinition.PropertyName;
+import org.jboss.tools.modeshape.jcr.QualifiedName;
import org.jboss.tools.modeshape.jcr.Utils;
import org.jboss.tools.modeshape.jcr.attributes.AttributeState.Value;
import org.jboss.tools.modeshape.jcr.attributes.OnParentVersion;
@@ -32,83 +34,88 @@
*/
public class PropertyDefinitionTest {
+ private static final QualifiedName OWNER_NAME = Constants.QUALIFIED_NAME1;
+
+ private NodeTypeDefinition owner;
private PropertyDefinition propDefn;
@Before
public void beforeEach() {
- this.propDefn = new PropertyDefinition();
+ this.owner = new NodeTypeDefinition();
+ this.owner.setName(OWNER_NAME.get());
+ this.propDefn = new PropertyDefinition(this.owner);
}
@Test
public void copiesShouldBeEqualAndHaveSameHashCode() {
- PropertyDefinition thatPropDefn = PropertyDefinition.copy(this.propDefn);
+ PropertyDefinition thatPropDefn = PropertyDefinition.copy(this.propDefn, this.owner);
assertEquals(this.propDefn, thatPropDefn);
assertEquals(this.propDefn.hashCode(), thatPropDefn.hashCode());
this.propDefn.setAvailableQueryOperators(Constants.Helper.getDefaultQueryOperators());
- thatPropDefn = PropertyDefinition.copy(this.propDefn);
+ thatPropDefn = PropertyDefinition.copy(this.propDefn, this.owner);
assertEquals(this.propDefn, thatPropDefn);
assertEquals(this.propDefn.hashCode(), thatPropDefn.hashCode());
this.propDefn.setAutoCreated(!this.propDefn.isAutoCreated());
- thatPropDefn = PropertyDefinition.copy(this.propDefn);
+ thatPropDefn = PropertyDefinition.copy(this.propDefn, this.owner);
assertEquals(this.propDefn, thatPropDefn);
assertEquals(this.propDefn.hashCode(), thatPropDefn.hashCode());
this.propDefn.setDefaultValues(Constants.Helper.getDefaultStringValues());
- thatPropDefn = PropertyDefinition.copy(this.propDefn);
+ thatPropDefn = PropertyDefinition.copy(this.propDefn, this.owner);
assertEquals(this.propDefn, thatPropDefn);
assertEquals(this.propDefn.hashCode(), thatPropDefn.hashCode());
this.propDefn.setFullTextSearchable(!this.propDefn.isFullTextSearchable());
- thatPropDefn = PropertyDefinition.copy(this.propDefn);
+ thatPropDefn = PropertyDefinition.copy(this.propDefn, this.owner);
assertEquals(this.propDefn, thatPropDefn);
assertEquals(this.propDefn.hashCode(), thatPropDefn.hashCode());
this.propDefn.setMandatory(!this.propDefn.isMandatory());
- thatPropDefn = PropertyDefinition.copy(this.propDefn);
+ thatPropDefn = PropertyDefinition.copy(this.propDefn, this.owner);
assertEquals(this.propDefn, thatPropDefn);
assertEquals(this.propDefn.hashCode(), thatPropDefn.hashCode());
this.propDefn.setMultiple(!this.propDefn.isMultiple());
- thatPropDefn = PropertyDefinition.copy(this.propDefn);
+ thatPropDefn = PropertyDefinition.copy(this.propDefn, this.owner);
assertEquals(this.propDefn, thatPropDefn);
assertEquals(this.propDefn.hashCode(), thatPropDefn.hashCode());
this.propDefn.setName(Constants.QUALIFIED_NAME1.get());
- thatPropDefn = PropertyDefinition.copy(this.propDefn);
+ thatPropDefn = PropertyDefinition.copy(this.propDefn, this.owner);
assertEquals(this.propDefn, thatPropDefn);
assertEquals(this.propDefn.hashCode(), thatPropDefn.hashCode());
this.propDefn.setOnParentVersion(OnParentVersion.COMPUTE.asJcrValue());
- thatPropDefn = PropertyDefinition.copy(this.propDefn);
+ thatPropDefn = PropertyDefinition.copy(this.propDefn, this.owner);
assertEquals(this.propDefn, thatPropDefn);
assertEquals(this.propDefn.hashCode(), thatPropDefn.hashCode());
this.propDefn.setProtected(!this.propDefn.isProtected());
- thatPropDefn = PropertyDefinition.copy(this.propDefn);
+ thatPropDefn = PropertyDefinition.copy(this.propDefn, this.owner);
assertEquals(this.propDefn, thatPropDefn);
assertEquals(this.propDefn.hashCode(), thatPropDefn.hashCode());
this.propDefn.setQueryOrderable(!this.propDefn.isQueryOrderable());
- thatPropDefn = PropertyDefinition.copy(this.propDefn);
+ thatPropDefn = PropertyDefinition.copy(this.propDefn, this.owner);
assertEquals(this.propDefn, thatPropDefn);
assertEquals(this.propDefn.hashCode(), thatPropDefn.hashCode());
this.propDefn.setRequiredType(PropertyType.BINARY.asJcrValue());
- thatPropDefn = PropertyDefinition.copy(this.propDefn);
+ thatPropDefn = PropertyDefinition.copy(this.propDefn, this.owner);
assertEquals(this.propDefn, thatPropDefn);
assertEquals(this.propDefn.hashCode(), thatPropDefn.hashCode());
this.propDefn.setValueConstraints(Constants.DEFAULT_VALUE_CONSTRAINTS);
- thatPropDefn = PropertyDefinition.copy(this.propDefn);
+ thatPropDefn = PropertyDefinition.copy(this.propDefn, this.owner);
assertEquals(this.propDefn, thatPropDefn);
assertEquals(this.propDefn.hashCode(), thatPropDefn.hashCode());
}
@Test
public void differentInstancesWithSameValuesShouldBeEqual() {
- final PropertyDefinition thatPropDefn = new PropertyDefinition();
+ final PropertyDefinition thatPropDefn = new PropertyDefinition(this.owner);
assertEquals(this.propDefn, thatPropDefn);
this.propDefn.setAvailableQueryOperators(Constants.Helper.getDefaultQueryOperators());
@@ -162,7 +169,7 @@
@Test
public void differentInstancesWithSameValuesShouldHaveSameHashCode() {
- assertEquals(this.propDefn.hashCode(), new PropertyDefinition().hashCode());
+ assertEquals(this.propDefn.hashCode(), new PropertyDefinition(this.owner).hashCode());
}
@Test
13 years, 8 months
JBoss Tools SVN: r40015 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ext.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-04-03 16:08:42 -0400 (Tue, 03 Apr 2012)
New Revision: 40015
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ext/AbstractClassPathMonitor.java
Log:
JBIDE-11451
https://issues.jboss.org/browse/JBIDE-11451
Method Libs.update() should not be called in synchronized block. It is safe to be run in concurrent threads.
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ext/AbstractClassPathMonitor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ext/AbstractClassPathMonitor.java 2012-04-03 19:47:32 UTC (rev 40014)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ext/AbstractClassPathMonitor.java 2012-04-03 20:08:42 UTC (rev 40015)
@@ -65,27 +65,29 @@
* Otherwise, updates inner model and disables class loader.
* @return
*/
- public synchronized boolean update() {
+ public boolean update() {
Libs libs = FileSystemsHelper.getLibs(model);
if(libs == null) {
return false;
}
libs.update();
- List<String> newPaths = libs.getPaths();
- boolean result = libsModified || !loaded;
- if(newPaths != null) {
- paths = newPaths;
- loaded = true;
- } else {
- paths = new ArrayList<String>();
- loaded = false;
+ synchronized(this) {
+ List<String> newPaths = libs.getPaths();
+ boolean result = libsModified || !loaded;
+ if(newPaths != null) {
+ paths = newPaths;
+ loaded = true;
+ } else {
+ paths = new ArrayList<String>();
+ loaded = false;
+ }
+ if(result) {
+ paths2.clear();
+ paths2.putAll(libs.getPathsAsMap());
+ }
+ libsModified = false;
+ return result;
}
- if(result) {
- paths2.clear();
- paths2.putAll(libs.getPathsAsMap());
- }
- libsModified = false;
- return result;
}
public void pathLoaded(IPath path) {
13 years, 8 months
JBoss Tools SVN: r40014 - trunk/build/aggregate/site.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-04-03 15:47:32 -0400 (Tue, 03 Apr 2012)
New Revision: 40014
Modified:
trunk/build/aggregate/site/site.xml
Log:
https://issues.jboss.org/browse/JBIDE-11244 Auto-discover all the modules and add them to the configuration on GWT project import
added gwt configiurator to aggregated update site under MavenTools category
Modified: trunk/build/aggregate/site/site.xml
===================================================================
--- trunk/build/aggregate/site/site.xml 2012-04-03 19:19:22 UTC (rev 40013)
+++ trunk/build/aggregate/site/site.xml 2012-04-03 19:47:32 UTC (rev 40014)
@@ -190,6 +190,9 @@
<feature url="features/org.jboss.tools.maven.jbosspackaging.feature_0.0.0.jar" id="org.jboss.tools.maven.jbosspackaging.feature" version="0.0.0">
<category name="MavenTools" />
</feature>
+ <feature url="features/org.jboss.tools.maven.gwt.feature_0.0.0.jar" id="org.jboss.tools.maven.gwt.feature" version="0.0.0">
+ <category name="MavenTools" />
+ </feature>
<!-- only in JBT -->
<feature url="features/org.jboss.tools.gwt.feature_0.0.0.jar" id="org.jboss.tools.gwt.feature" version="0.0.0">
<category name="GeneralTools" />
13 years, 8 months
JBoss Tools SVN: r40013 - in trunk/central/features: org.jboss.tools.community.central.feature and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-04-03 15:19:22 -0400 (Tue, 03 Apr 2012)
New Revision: 40013
Modified:
trunk/central/features/org.jboss.tools.central.feature/feature.xml
trunk/central/features/org.jboss.tools.community.central.feature/feature.xml
Log:
JBIDE-11299 move nested/included features in org.jboss.tools.central.feature to required features in org.jboss.tools.community.central.feature; now the 1-feature solution to installing Central is to install org.jboss.tools.community.central.feature, which will bring in the other 4 features.
Modified: trunk/central/features/org.jboss.tools.central.feature/feature.xml
===================================================================
--- trunk/central/features/org.jboss.tools.central.feature/feature.xml 2012-04-03 17:25:43 UTC (rev 40012)
+++ trunk/central/features/org.jboss.tools.central.feature/feature.xml 2012-04-03 19:19:22 UTC (rev 40013)
@@ -14,9 +14,4 @@
<plugin id="org.jboss.tools.central" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <!-- JBIDE-11299 - include Examples features when installing Central -->
- <includes id="org.jboss.tools.project.examples.feature" version="0.0.0" />
- <includes id="org.jboss.tools.community.project.examples.feature" version="0.0.0" />
- <includes id="org.jboss.tools.maven.project.examples.feature" version="0.0.0" />
-
</feature>
Modified: trunk/central/features/org.jboss.tools.community.central.feature/feature.xml
===================================================================
--- trunk/central/features/org.jboss.tools.community.central.feature/feature.xml 2012-04-03 17:25:43 UTC (rev 40012)
+++ trunk/central/features/org.jboss.tools.community.central.feature/feature.xml 2012-04-03 19:19:22 UTC (rev 40013)
@@ -1,11 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.jboss.tools.community.central.feature"
- label="%featureName"
- version="1.0.0.qualifier"
- provider-name="%providerName"
- plugin="org.jboss.tools.community.central">
-
+<feature id="org.jboss.tools.community.central.feature" label="%featureName" version="1.0.0.qualifier" provider-name="%providerName" plugin="org.jboss.tools.community.central">
<description>
%description
</description>
@@ -18,14 +12,14 @@
%license
</license>
+ <!-- JBIDE-11299 - include Examples features when installing Central -->
<requires>
+ <import feature="org.jboss.tools.central.feature" version="1.0.0.qualifier" match="greaterOrEqual"/>
+ <import feature="org.jboss.tools.project.examples.feature" version="1.2.1.qualifier" match="greaterOrEqual"/>
<import feature="org.jboss.tools.community.project.examples.feature" version="1.2.1.qualifier" match="greaterOrEqual"/>
+ <import feature="org.jboss.tools.maven.project.examples.feature" version="1.3.0.qualifier" match="greaterOrEqual"/>
</requires>
- <plugin
- id="org.jboss.tools.community.central"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
+ <plugin id="org.jboss.tools.community.central" download-size="0" install-size="0" version="0.0.0"/>
</feature>
13 years, 8 months
JBoss Tools SVN: r40012 - in trunk/modeshape: plugins/org.jboss.tools.modeshape.jcr/META-INF and 11 other directories.
by jbosstools-commits@lists.jboss.org
Author: elvisisking
Date: 2012-04-03 13:25:43 -0400 (Tue, 03 Apr 2012)
New Revision: 40012
Added:
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/icons/show-inherited-16x.gif
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/cnd/
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/cnd/jsr_283_builtins.cnd
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/WorkspaceRegistry.java
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/cnd/
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/cnd/jsr_283_builtins.cnd
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/WorkspaceRegistryTest.java
Removed:
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/testdata/jsr_283_builtins.cnd
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/JcrUiConstants.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndEditor.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndFormsEditorPage.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndMessages.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/NamespaceMappingDialog.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/PropertyDialog.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/QualifiedNameEditor.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/cndMessages.properties
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/META-INF/MANIFEST.MF
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/build.properties
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/Messages.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/NamespaceMapping.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/NodeTypeDefinition.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/Utils.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/cnd/CndValidator.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/cnd/CompactNodeTypeDefinition.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/messages.properties
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/build.properties
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CndImporterTest.java
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CndValidatorTest.java
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CompactNodeTypeDefinitionTest.java
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/Constants.java
trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/test/AllTests.java
Log:
JBIDE-10702 Editor for JCR Compact Node Definition (CND) files. Added an option to show/hide inherited property definitions and child node definitions. QualifiedNameEditor now sorts the qualifiers. URIs of built-in namespaces are autopopulated in the NamespaceMappingEditor. Query operators now cannot be edited if their owning node type is not queryable. Fixed an issue where the editor was staying writable when the file was changed to readonly from outside Eclipse. Property definitions of type NAME are now validated correctly.
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/META-INF/MANIFEST.MF
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/META-INF/MANIFEST.MF 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/META-INF/MANIFEST.MF 2012-04-03 17:25:43 UTC (rev 40012)
@@ -8,7 +8,8 @@
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Import-Package: org.eclipse.osgi.util
-Require-Bundle: org.jboss.tools.modeshape.client
+Require-Bundle: org.jboss.tools.modeshape.client,
+ org.eclipse.core.runtime
Export-Package: org.jboss.tools.modeshape.jcr,
org.jboss.tools.modeshape.jcr.attributes,
org.jboss.tools.modeshape.jcr.cnd
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/build.properties
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/build.properties 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/build.properties 2012-04-03 17:25:43 UTC (rev 40012)
@@ -11,7 +11,8 @@
#
bin.includes = META-INF/,\
.,\
- OSGI-INF/
+ OSGI-INF/,\
+ cnd/jsr_283_builtins.cnd
jars.compile.order = .
source.. = src/
output.. = bin/
Added: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/cnd/jsr_283_builtins.cnd
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/cnd/jsr_283_builtins.cnd (rev 0)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/cnd/jsr_283_builtins.cnd 2012-04-03 17:25:43 UTC (rev 40012)
@@ -0,0 +1,183 @@
+<jcr='http://www.jcp.org/jcr/1.0'>
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<mix='http://www.jcp.org/jcr/mix/1.0'>
+
+// ------------------------------------------------------------------------
+// Pre-defined Node Types
+// ------------------------------------------------------------------------
+
+[nt:base] abstract
+ - jcr:primaryType (name) mandatory autocreated
+ protected compute
+ - jcr:mixinTypes (name) protected multiple compute
+
+[nt:unstructured]
+ orderable
+ - * (undefined) multiple
+ - * (undefined)
+ + * (nt:base) = nt:unstructured sns version
+
+[mix:created] mixin
+ - jcr:created (date) protected
+ - jcr:createdBy (string) protected
+
+[nt:hierarchyNode] > mix:created abstract
+
+[nt:file] > nt:hierarchyNode
+ + jcr:content (nt:base) primary mandatory
+
+[nt:linkedFile] > nt:hierarchyNode
+ - jcr:content (reference) primary mandatory
+
+[nt:folder] > nt:hierarchyNode
+ + * (nt:hierarchyNode) version
+
+[mix:referenceable] mixin
+ - jcr:uuid (string) mandatory autocreated protected initialize
+
+[mix:mimeType] mixin
+ - jcr:mimeType (string)
+ - jcr:encoding (string)
+
+[mix:lastModified] mixin
+ - jcr:lastModified (date)
+ - jcr:lastModifiedBy (string)
+
+[nt:resource] > mix:mimeType, mix:lastModified
+ - jcr:data (binary) primary mandatory
+
+[nt:nodeType]
+ - jcr:nodeTypeName (name) mandatory protected copy
+ - jcr:supertypes (name) multiple protected copy
+ - jcr:isAbstract (boolean) mandatory protected copy
+ - jcr:isMixin (boolean) mandatory protected copy
+ - jcr:isQueryable (boolean) mandatory protected copy
+ - jcr:hasOrderableChildNodes (boolean) mandatory protected copy
+ - jcr:primaryItemName (name) protected copy
+ + jcr:propertyDefinition (nt:propertyDefinition) = nt:propertyDefinition sns protected copy
+ + jcr:childNodeDefinition (nt:childNodeDefinition) = nt:childNodeDefinition sns protected copy
+
+[nt:propertyDefinition]
+ - jcr:name (name) protected
+ - jcr:autoCreated (boolean) mandatory protected
+ - jcr:mandatory (boolean) mandatory protected
+ - jcr:isFullTextSearchable (boolean) mandatory protected
+ - jcr:isQueryOrderable (boolean) mandatory protected
+ - jcr:onParentVersion (string) mandatory protected
+ < 'COPY', 'VERSION', 'INITIALIZE', 'COMPUTE',
+ 'IGNORE', 'ABORT'
+ - jcr:protected (boolean) mandatory protected
+ - jcr:requiredType (string) mandatory protected
+ < 'STRING', 'URI', 'BINARY', 'LONG', 'DOUBLE', 'DECIMAL', 'BOOLEAN',
+ 'DATE', 'NAME', 'PATH', 'REFERENCE', 'WEAKREFERENCE', 'UNDEFINED'
+ - jcr:valueConstraints (string) multiple protected
+ - jcr:availableQueryOperators (name) mandatory multiple protected
+ - jcr:defaultValues (undefined) multiple protected
+ - jcr:multiple (boolean) mandatory protected
+
+[nt:childNodeDefinition]
+ - jcr:name (name) protected
+ - jcr:autoCreated (boolean) mandatory protected
+ - jcr:mandatory (boolean) mandatory protected
+ - jcr:onParentVersion (string) mandatory protected
+ < 'COPY', 'VERSION', 'INITIALIZE', 'COMPUTE',
+ 'IGNORE', 'ABORT'
+ - jcr:protected (boolean) mandatory protected
+ - jcr:requiredPrimaryTypes (name) = 'nt:base' mandatory protected multiple
+ - jcr:defaultPrimaryType (name) protected
+ - jcr:sameNameSiblings (boolean) mandatory protected
+
+[nt:versionHistory] > mix:referenceable
+ - jcr:versionableUuid (string) mandatory autocreated protected abort
+ - jcr:copiedFrom (weakreference) protected abort < 'nt:version'
+ + jcr:rootVersion (nt:version) = nt:version mandatory autocreated protected abort
+ + jcr:versionLabels (nt:versionLabels) = nt:versionLabels mandatory autocreated protected abort
+ + * (nt:version) = nt:version protected abort
+
+
+[nt:versionLabels]
+ - * (reference) protected abort < 'nt:version'
+
+[nt:version] > mix:referenceable
+ - jcr:created (date) mandatory autocreated protected abort
+ - jcr:predecessors (reference) protected multiple abort < 'nt:version'
+ - jcr:successors (reference) protected multiple abort < 'nt:version'
+ - jcr:activity (reference) protected abort < 'nt:activity'
+ + jcr:frozenNode (nt:frozenNode) protected abort
+
+[nt:frozenNode] > mix:referenceable
+ orderable
+ - jcr:frozenPrimaryType (name) mandatory autocreated protected abort
+ - jcr:frozenMixinTypes (name) protected multiple abort
+ - jcr:frozenUuid (string) mandatory autocreated protected abort
+ - * (undefined) protected abort
+ - * (undefined) protected multiple abort
+ + * (nt:base) protected sns abort
+
+[nt:versionedChild]
+ - jcr:childVersionHistory (reference) mandatory autocreated protected abort < 'nt:versionHistory'
+
+[nt:query]
+ - jcr:statement (string)
+ - jcr:language (string)
+
+[nt:activity] > mix:referenceable
+ - jcr:activityTitle (string) mandatory autocreated protected
+
+
+[mix:simpleVersionable] mixin
+ - jcr:isCheckedOut (boolean) = 'true' mandatory autocreated protected ignore
+
+[mix:versionable] > mix:simpleVersionable, mix:referenceable mixin
+ - jcr:versionHistory (reference) mandatory protected ignore < 'nt:versionHistory'
+ - jcr:baseVersion (reference) mandatory protected ignore < 'nt:version'
+ - jcr:predecessors (reference) mandatory protected multiple ignore < 'nt:version'
+ - jcr:mergeFailed (reference) protected multiple abort
+ - jcr:activity (reference) protected < 'nt:version'
+ - jcr:configuration (reference) protected ignore < 'nt:configuration'
+
+[nt:configuration] > mix:versionable
+ - jcr:root (reference) mandatory autocreated protected
+
+[nt:address]
+ - jcr:protocol (string)
+ - jcr:host (string)
+ - jcr:port (string)
+ - jcr:repository (string)
+ - jcr:workspace (string)
+ - jcr:path (path)
+ - jcr:id (weakreference)
+
+[nt:naturalText]
+ - jcr:text (string)
+ - jcr:messageId (string)
+
+
+// ------------------------------------------------------------------------
+// Pre-defined Mixins
+// ------------------------------------------------------------------------
+
+[mix:etag] mixin
+ - jcr:etag (string) protected autocreated
+
+[mix:lockable] mixin
+ - jcr:lockOwner (string) protected ignore
+ - jcr:lockIsDeep (boolean) protected ignore
+
+[mix:lifecycle] mixin
+ - jcr:lifecyclePolicy (reference) protected initialize
+ - jcr:currentLifecycleState (string) protected initialize
+
+[mix:managedRetention] > mix:referenceable mixin
+ - jcr:hold (string) protected multiple
+ - jcr:isDeep (boolean) protected multiple
+ - jcr:retentionPolicy (reference) protected
+
+[mix:shareable] > mix:referenceable mixin
+
+[mix:title] mixin
+ - jcr:title (string)
+ - jcr:description (string)
+
+[mix:language] mixin
+ - jcr:language (string)
\ No newline at end of file
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/Messages.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/Messages.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/Messages.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -193,6 +193,12 @@
public static String invalidGetStateRequest;
/**
+ * A message indicating a default value of a property definition with a NAME type has an invalid qualifier. Two parameters, the
+ * property definition name and the default value, are required.
+ */
+ public static String invalidQualifierForDefaultValue;
+
+ /**
* A message indicating an invalid property valid was found. The parameters of invalid property value, property type, and
* property definition name are required.
*/
@@ -210,6 +216,18 @@
public static String invalidUri;
/**
+ * An error message indicating that the JSR built-ins CND could not be found in the workspace. One parameter, the path of the
+ * CND file, is required.
+ */
+ public static String jsrBuiltInsCndFileNotFound;
+
+ /**
+ * An error message indicating that the JSR built-ins CND could not be found in the filesystem. One parameter, the path of the
+ * CND file, is required.
+ */
+ public static String jsrBuiltInsCndFileNotFoundInFilesystem;
+
+ /**
* A message indicating a name equal to parent or self was found. One parameter, a string identifying the name, is required.
*/
public static String localNameEqualToSelfOrParent;
@@ -263,7 +281,7 @@
* A message used for the node type definition name property.
*/
public static String nodeTypeDefinitionName;
-
+
/**
* A message indicating a <code>null</code> was found. One parameter, a string identifying the object, is required.
*/
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/NamespaceMapping.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/NamespaceMapping.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/NamespaceMapping.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -251,37 +251,6 @@
}
/**
- * The built-in namespace mappings.
- */
- public interface BuiltIns {
-
- /**
- * Reserved for items defined within built-in node types.
- */
- NamespaceMapping JCR = new NamespaceMapping("jcr", "http://www.jcp.org/jcr/1.0"); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * Reserved for the names of built-in mixin node types.
- */
- NamespaceMapping MIX = new NamespaceMapping("mix", "http://www.jcp.org/jcr/mix/1.0"); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * Reserved for the names of built-in primary node types.
- */
- NamespaceMapping NT = new NamespaceMapping("nt", "http://www.jcp.org/jcr/nt/1.0"); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * Reserved for reasons of compatibility with XML.
- */
- NamespaceMapping XML = new NamespaceMapping("xml", "http://www.w3.org/XML/1998/namespace"); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * A collection of all built-in namespace mappings.
- */
- NamespaceMapping[] ALL_BUILT_INS = new NamespaceMapping[] { JCR, NT, MIX, XML };
- }
-
- /**
* The property names whose <code>toString()</code> is used in {@link PropertyChangeEvent}s.
*/
public enum PropertyName {
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/NodeTypeDefinition.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/NodeTypeDefinition.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/NodeTypeDefinition.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -89,14 +89,9 @@
private final NodeTypeAttributes attributes;
/**
- * The collection of CND elements (can be <code>null</code>).
+ * The collection of property definitions and child node definitions (can be <code>null</code>).
*/
private List<CndElement> cndElements;
- //
- // /**
- // * The collection of child node definitions (can be <code>null</code>).
- // */
- // private List<ChildNodeDefinition> childNodesDefinitions;
/**
* The collection of property change listeners (never <code>null</code>).
@@ -107,11 +102,6 @@
* The node type name (never <code>null</code> but can have a <code>null</code> or empty value).
*/
private final QualifiedName name;
- //
- // /**
- // * The collection of property definitions (can be <code>null</code>).
- // */
- // private List<PropertyDefinition> propertyDefinitions;
/**
* The super types (never <code>null</code>).
@@ -531,6 +521,42 @@
}
/**
+ * Inherited child node definitions are not checked.
+ *
+ * @param name the child node definition name being searched for (cannot be <code>null</code> or empty)
+ * @return <code>true</code> if a child node definition with the specified name was found
+ */
+ public boolean hasDeclaredChildNodeDefinition( final String name ) {
+ Utils.verifyIsNotEmpty(name, "name"); //$NON-NLS-1$
+
+ for (final ChildNodeDefinition childNode : getChildNodeDefinitions()) {
+ if (name.equals(childNode.getName())) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Inherited property definitions are not checked.
+ *
+ * @param name the property definition name being searched for (cannot be <code>null</code> or empty)
+ * @return <code>true</code> if a property definition with the specified name was found
+ */
+ public boolean hasDeclaredPropertyDefinition( final String name ) {
+ Utils.verifyIsNotEmpty(name, "name"); //$NON-NLS-1$
+
+ for (final PropertyDefinition prop : getPropertyDefinitions()) {
+ if (name.equals(prop.getName())) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
* {@inheritDoc}
*
* @see java.lang.Object#hashCode()
@@ -538,10 +564,8 @@
@Override
public int hashCode() {
final int result1 = Utils.hashCode(this.name, this.attributes, this.superTypes);
- final int result2 = Utils.hashCode(getChildNodeDefinitions().toArray());
- final int result3 = Utils.hashCode(getPropertyDefinitions().toArray());
-
- return Utils.hashCode(result1, result2, result3);
+ final int result2 = Utils.hashCode(getElements().toArray());
+ return Utils.hashCode(result1, result2);
}
/**
@@ -822,11 +846,12 @@
}
{ // elements
- final String elementStartDelimiter = CndNotationPreferences.DEFAULT_PREFERENCES.get(Preference.ELEMENTS_START_DELIMITER);
- final String elementDelimiter = CndNotationPreferences.DEFAULT_PREFERENCES.get(Preference.ELEMENT_DELIMITER);
final List<CndElement> elements = getElements();
if (!Utils.isEmpty(elements)) {
+ final String elementStartDelimiter = CndNotationPreferences.DEFAULT_PREFERENCES.get(Preference.ELEMENTS_START_DELIMITER);
+ final String elementDelimiter = CndNotationPreferences.DEFAULT_PREFERENCES.get(Preference.ELEMENT_DELIMITER);
+
for (final CndElement element : elements) {
builder.append(elementStartDelimiter);
builder.append(element.toCndNotation(notationType));
@@ -900,5 +925,4 @@
return (getClass().getName() + '.' + super.toString());
}
}
-
}
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/Utils.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/Utils.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/Utils.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -20,6 +20,10 @@
public final class Utils {
/**
+ * The plug-in bundle's symbolic name.
+ */
+ public static final String PLUGIN_ID = Utils.class.getPackage().getName();
+ /**
* And empty object array.
*/
public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
Added: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/WorkspaceRegistry.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/WorkspaceRegistry.java (rev 0)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/WorkspaceRegistry.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -0,0 +1,267 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ *
+ * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
+ *
+ * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
+ */
+package org.jboss.tools.modeshape.jcr;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.modeshape.jcr.cnd.CndImporter;
+import org.jboss.tools.modeshape.jcr.cnd.CndValidator;
+import org.jboss.tools.modeshape.jcr.cnd.CompactNodeTypeDefinition;
+import org.osgi.framework.Bundle;
+
+/**
+ * A registry containing {@link NamespaceMapping namespace mappings} and {@link NodeTypeDefinition node type definitions}. At
+ * construction the registry holds the built-in JSR namespaces and node types.
+ */
+public class WorkspaceRegistry {
+
+ private static WorkspaceRegistry _registry;
+
+ private static String BUILT_INS_CND_FILE_NAME = "cnd/jsr_283_builtins.cnd"; //$NON-NLS-1$
+
+ /**
+ * @return the shared instance of the workspace registry (never <code>null</code>)
+ * @throws Exception if there is a problem loading the registry
+ */
+ public static WorkspaceRegistry get() throws Exception {
+ if (_registry == null) {
+ _registry = new WorkspaceRegistry();
+ }
+
+ return _registry;
+ }
+
+ private final Collection<NamespaceMapping> namespaces;
+
+ private final Collection<NodeTypeDefinition> nodeTypes;
+
+ /**
+ * Don't allow construction outside of this class.
+ */
+ private WorkspaceRegistry() throws Exception {
+ final CndImporter importer = new CndImporter();
+ final List<Throwable> errors = new ArrayList<Throwable>();
+ File builtInsCndFile = null;
+
+ if (Platform.isRunning()) {
+ Bundle bundle = Platform.getBundle(Utils.PLUGIN_ID);
+ URL url = bundle.getEntry(BUILT_INS_CND_FILE_NAME);
+
+ if (url == null) {
+ throw new Exception(NLS.bind(Messages.jsrBuiltInsCndFileNotFound, BUILT_INS_CND_FILE_NAME));
+ }
+
+ builtInsCndFile = new File(org.eclipse.core.runtime.FileLocator.toFileURL(url).getFile());
+
+ if (!builtInsCndFile.exists()) {
+ throw new Exception(NLS.bind(Messages.jsrBuiltInsCndFileNotFoundInFilesystem, BUILT_INS_CND_FILE_NAME));
+ }
+ } else {
+ // when running unit tests
+ builtInsCndFile = new File(BUILT_INS_CND_FILE_NAME);
+ }
+
+ final CompactNodeTypeDefinition jsrBuiltIns = importer.importFrom(builtInsCndFile, errors);
+
+ // check for parse errors
+ if (!errors.isEmpty()) {
+ final Throwable t = errors.iterator().next();
+
+ if (t.getCause() == null) {
+ throw new RuntimeException(t);
+ }
+
+ throw new Exception(t.getCause());
+ }
+
+ this.namespaces = new ArrayList<NamespaceMapping>();
+ this.nodeTypes = new ArrayList<NodeTypeDefinition>();
+
+ // register namespace mappings
+ for (final NamespaceMapping namespace : jsrBuiltIns.getNamespaceMappings()) {
+ assert !CndValidator.validateNamespaceMapping(namespace).isError() : "Invalid namespace " + namespace; //$NON-NLS-1$
+ this.namespaces.add(namespace);
+ }
+
+ // register node type definitions
+ for (final NodeTypeDefinition nodeType : jsrBuiltIns.getNodeTypeDefinitions()) {
+ assert !CndValidator.validateNodeTypeDefinition(nodeType, getPrefixes(), null, true).isError() : "Invalid node type definition " //$NON-NLS-1$
+ + nodeType.getName();
+ this.nodeTypes.add(nodeType);
+ }
+ }
+
+ /**
+ * @param nodeTypeDefinitionName the name of the node type definition whose child nodes are being requested (cannot be
+ * <code>null</code> or empty)
+ * @param includeInherited indicates if inherited child nodes should be included
+ * @return the child nodes (never <code>null</code>)
+ */
+ public Collection<ChildNodeDefinition> getChildNodeDefinitions( final String nodeTypeDefinitionName,
+ final boolean includeInherited ) {
+ final NodeTypeDefinition nodeType = getNodeTypeDefinition(nodeTypeDefinitionName);
+
+ if (nodeType == null) {
+ return Collections.emptyList();
+ }
+
+ final Collection<ChildNodeDefinition> childNodes = new ArrayList<ChildNodeDefinition>(nodeType.getChildNodeDefinitions());
+
+ if (includeInherited) {
+ for (final QualifiedName superType : nodeType.getSupertypes()) {
+ final NodeTypeDefinition superTypeNodeType = getNodeTypeDefinition(superType.get());
+
+ if (superTypeNodeType != null) {
+ childNodes.addAll(getChildNodeDefinitions(superTypeNodeType.getName(), true));
+ }
+ }
+ }
+
+ return childNodes;
+ }
+
+ /**
+ * @param prefix the prefix whose namespace mapping is being requested (cannot be <code>null</code> or empty)
+ * @return thre requested namespace mapping or <code>null</code> if not found
+ */
+ public NamespaceMapping getNamespaceMapping( final String prefix ) {
+ Utils.verifyIsNotEmpty(prefix, "prefix"); //$NON-NLS-1$
+
+ for (final NamespaceMapping namespace : getNamespaceMappings()) {
+ if (namespace.getPrefix().equals(prefix)) {
+ return namespace;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @return an unmodifiable collection of namespace mappings (never <code>null</code>)
+ */
+ public Collection<NamespaceMapping> getNamespaceMappings() {
+ return Collections.unmodifiableCollection(this.namespaces);
+ }
+
+ /**
+ * @param name the name of the node type definition being requested (cannot be <code>null</code> or empty)
+ * @return the node type definition or <code>null</code> if not found
+ */
+ public NodeTypeDefinition getNodeTypeDefinition( final String name ) {
+ Utils.verifyIsNotEmpty(name, "name"); //$NON-NLS-1$
+
+ for (final NodeTypeDefinition nodeType : getNodeTypeDefinitions()) {
+ if (nodeType.getName().equals(name)) {
+ return nodeType;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @return an unmodifiable collection of all primary and mixin node type definitions (never <code>null</code>)
+ */
+ public Collection<NodeTypeDefinition> getNodeTypeDefinitions() {
+ return Collections.unmodifiableCollection(this.nodeTypes);
+ }
+
+ /**
+ * @param uri the URI whose prefix is being requested (cannot be <code>null</code> or empty)
+ * @return the prefix or <code>null</code> if a namespace mapping was not found
+ */
+ public String getPrefix( final String uri ) {
+ Utils.verifyIsNotEmpty(uri, "uri"); //$NON-NLS-1$
+
+ for (final NamespaceMapping namespace : this.namespaces) {
+ if (namespace.getUri().equals(uri)) {
+ return namespace.getPrefix();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @return the registered prefixes (never <code>null</code>)
+ */
+ public Collection<String> getPrefixes() {
+ final Collection<String> prefixes = new ArrayList<String>(this.namespaces.size());
+
+ for (final NamespaceMapping namespace : this.namespaces) {
+ prefixes.add(namespace.getPrefix());
+ }
+
+ return prefixes;
+ }
+
+ /**
+ * @param nodeTypeDefinitionName the name of the node type definition whose properties are being requested (cannot be
+ * <code>null</code> or empty)
+ * @param includeInherited indicates if inherited properties should be included
+ * @return the properties (never <code>null</code>)
+ */
+ public Collection<PropertyDefinition> getPropertyDefinitions( final String nodeTypeDefinitionName,
+ final boolean includeInherited ) {
+ final NodeTypeDefinition nodeType = getNodeTypeDefinition(nodeTypeDefinitionName);
+
+ if (nodeType == null) {
+ return Collections.emptyList();
+ }
+
+ final Collection<PropertyDefinition> properties = new ArrayList<PropertyDefinition>(nodeType.getPropertyDefinitions());
+
+ if (includeInherited) {
+ for (final QualifiedName superType : nodeType.getSupertypes()) {
+ final NodeTypeDefinition superTypeNodeType = getNodeTypeDefinition(superType.get());
+
+ if (superTypeNodeType != null) {
+ properties.addAll(getPropertyDefinitions(superTypeNodeType.getName(), true));
+ }
+ }
+ }
+
+ return properties;
+ }
+
+ /**
+ * @param prefix the prefix whose URI is being requested (cannot be <code>null</code> or empty)
+ * @return the URI or <code>null</code> if the namespace mapping does not exist
+ */
+ public String getUri( final String prefix ) {
+ Utils.verifyIsNotEmpty(prefix, "prefix"); //$NON-NLS-1$
+
+ for (final NamespaceMapping namespace : this.namespaces) {
+ if (namespace.getPrefix().equals(prefix)) {
+ return namespace.getUri();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @return the registered prefixes (never <code>null</code>)
+ */
+ public Collection<String> getUris() {
+ final Collection<String> uris = new ArrayList<String>(this.namespaces.size());
+
+ for (final NamespaceMapping namespace : this.namespaces) {
+ uris.add(namespace.getUri());
+ }
+
+ return uris;
+ }
+}
Property changes on: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/WorkspaceRegistry.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/cnd/CndValidator.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/cnd/CndValidator.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/cnd/CndValidator.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -97,7 +97,7 @@
PropertyType.LONG));
}
} else if (PropertyType.NAME == propertyType) {
- return validateLocalName(value, propertyName);
+ return validateQualifiedName(QualifiedName.parse(value), propertyName, null, null);
} else if (PropertyType.PATH == propertyType) {
return validatePath(value, propertyName);
} else if (PropertyType.REFERENCE == propertyType) {
@@ -359,19 +359,23 @@
/**
* @param propertyDefinition the property definition whose default values are being validated (cannot be <code>null</code>)
+ * @param validNamespacePrefixes the valid namespace prefixes (can be <code>null</code> or empty)
* @return the status (never <code>null</code>)
*/
- public static MultiValidationStatus validateDefaultValues( final PropertyDefinition propertyDefinition ) {
+ public static MultiValidationStatus validateDefaultValues( final PropertyDefinition propertyDefinition,
+ final Collection<String> validNamespacePrefixes ) {
final MultiValidationStatus status = new MultiValidationStatus();
- validateDefaultValues(propertyDefinition, status);
+ validateDefaultValues(propertyDefinition, validNamespacePrefixes, status);
return status;
}
/**
* @param propertyDefinition the property definition whose default values are being validated (cannot be <code>null</code>)
+ * @param validNamespacePrefixes the valid namespace prefixes (can be <code>null</code> or empty)
* @param status the status to add the new status to (cannot be <code>null</code>)
*/
public static void validateDefaultValues( final PropertyDefinition propertyDefinition,
+ final Collection<String> validNamespacePrefixes,
final MultiValidationStatus status ) {
Utils.verifyIsNotNull(propertyDefinition, "propertyDefinition"); //$NON-NLS-1$
Utils.verifyIsNotNull(status, "status"); //$NON-NLS-1$
@@ -402,6 +406,27 @@
// ERROR - Default value is not valid for the property definition type
isValid(defaultValue, propertyDefinition.getType(), Messages.defaultValue, status);
+ // make sure if NAME type the qualifier is valid
+ if (!Utils.isEmpty(validNamespacePrefixes) && propertyDefinition.getType() == PropertyType.NAME) {
+ QualifiedName qname = QualifiedName.parse(defaultValue);
+ String qualifier = qname.getQualifier();
+ boolean valid = false;
+
+ if (!Utils.isEmpty(qualifier)) {
+ for (String validQualifier : validNamespacePrefixes) {
+ if (validQualifier.equals(qualifier)) {
+ valid = true;
+ break;
+ }
+ }
+ }
+
+ if (!valid) {
+ status.add(ValidationStatus.createErrorMessage(NLS.bind(Messages.invalidQualifierForDefaultValue,
+ propertyName, defaultValue)));
+ }
+ }
+
if (!Utils.isEmpty(defaultValue)) {
// ERROR - Duplicate default value
if (values.contains(defaultValue)) {
@@ -1068,7 +1093,7 @@
}
{ // default values
- validateDefaultValues(propertyDefinition, status);
+ validateDefaultValues(propertyDefinition, validNamespacePrefixes, status);
}
{ // value constraints
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/cnd/CompactNodeTypeDefinition.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/cnd/CompactNodeTypeDefinition.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/cnd/CompactNodeTypeDefinition.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -15,9 +15,13 @@
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
+import org.jboss.tools.modeshape.jcr.ChildNodeDefinition;
import org.jboss.tools.modeshape.jcr.NamespaceMapping;
import org.jboss.tools.modeshape.jcr.NodeTypeDefinition;
+import org.jboss.tools.modeshape.jcr.PropertyDefinition;
+import org.jboss.tools.modeshape.jcr.QualifiedName;
import org.jboss.tools.modeshape.jcr.Utils;
+import org.jboss.tools.modeshape.jcr.WorkspaceRegistry;
import org.jboss.tools.modeshape.jcr.cnd.CndNotationPreferences.Preference;
/**
@@ -208,6 +212,43 @@
return true;
}
+ /**
+ * The node type definition must exist in this CND for it to return child nodes.
+ *
+ * @param nodeTypeDefinitionName the name of the node type definition whose child nodes are being requested (cannot be
+ * <code>null</code> or empty)
+ * @param includeInherited indicates if inherited child nodes should be included
+ * @return the child nodes (never <code>null</code>)
+ * @throws Exception if there is a problem obtaining the inherited child node definitions
+ */
+ public Collection<ChildNodeDefinition> getChildNodeDefinitions( final String nodeTypeDefinitionName,
+ final boolean includeInherited ) throws Exception {
+ final NodeTypeDefinition nodeType = getNodeTypeDefinition(nodeTypeDefinitionName);
+
+ // if not found in CND return empty collection
+ if (nodeType == null) {
+ return Collections.emptyList();
+ }
+
+ // first add declared child nodes
+ final Collection<ChildNodeDefinition> childNodes = new ArrayList<ChildNodeDefinition>(nodeType.getChildNodeDefinitions());
+
+ // now add inherited child nodes
+ if (includeInherited) {
+ for (final QualifiedName superType : nodeType.getSupertypes()) {
+ final NodeTypeDefinition superTypeNodeType = getNodeTypeDefinition(superType.get());
+
+ if (superTypeNodeType == null) {
+ childNodes.addAll(WorkspaceRegistry.get().getChildNodeDefinitions(nodeTypeDefinitionName, true));
+ } else {
+ childNodes.addAll(getChildNodeDefinitions(superTypeNodeType.getName(), true));
+ }
+ }
+ }
+
+ return childNodes;
+ }
+
private String getEndNamespaceMappingSectionDelimiter() {
return CndNotationPreferences.DEFAULT_PREFERENCES.get(Preference.NAMESPACE_MAPPING_SECTION_END_DELIMITER);
}
@@ -250,6 +291,22 @@
return prefixes;
}
+ /**
+ * @param name the name of the node type definition being requested (cannot be <code>null</code> or empty)
+ * @return the node type definition or <code>null</code> if not found
+ */
+ public NodeTypeDefinition getNodeTypeDefinition( final String name ) {
+ Utils.verifyIsNotEmpty(name, "name"); //$NON-NLS-1$
+
+ for (final NodeTypeDefinition ntd : getNodeTypeDefinitions()) {
+ if (name.equals(ntd.getName())) {
+ return ntd;
+ }
+ }
+
+ return null;
+ }
+
private String getNodeTypeDefinitionDelimiter() {
return CndNotationPreferences.DEFAULT_PREFERENCES.get(Preference.NODE_TYPE_DEFINITION_DELIMITER);
}
@@ -266,6 +323,43 @@
}
/**
+ * The node type definition must exist in this CND for it to return properties.
+ *
+ * @param nodeTypeDefinitionName the name of the node type definition whose properties are being requested (cannot be
+ * <code>null</code> or empty)
+ * @param includeInherited indicates if inherited properties should be included
+ * @return the properties (never <code>null</code>)
+ * @throws Exception if there is a problem obtaining inherited property definitions
+ */
+ public Collection<PropertyDefinition> getPropertyDefinitions( final String nodeTypeDefinitionName,
+ final boolean includeInherited ) throws Exception {
+ final NodeTypeDefinition nodeType = getNodeTypeDefinition(nodeTypeDefinitionName);
+
+ // if not found in CND return empty collection
+ if (nodeType == null) {
+ return Collections.emptyList();
+ }
+
+ // first add declared properties
+ final Collection<PropertyDefinition> properties = new ArrayList<PropertyDefinition>(nodeType.getPropertyDefinitions());
+
+ // now add inherited properties
+ if (includeInherited) {
+ for (final QualifiedName superType : nodeType.getSupertypes()) {
+ final NodeTypeDefinition superTypeNodeType = getNodeTypeDefinition(superType.get());
+
+ if (superTypeNodeType == null) {
+ properties.addAll(WorkspaceRegistry.get().getPropertyDefinitions(nodeTypeDefinitionName, true));
+ } else {
+ properties.addAll(getPropertyDefinitions(superTypeNodeType.getName(), true));
+ }
+ }
+ }
+
+ return properties;
+ }
+
+ /**
* {@inheritDoc}
*
* @see java.lang.Object#hashCode()
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/messages.properties
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/messages.properties 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr/src/org/jboss/tools/modeshape/jcr/messages.properties 2012-04-03 17:25:43 UTC (rev 40012)
@@ -67,12 +67,18 @@
invalidFindUsingJcrValueRequest = The "findUsingJcrValue" method cannot be used for a value of "{0}."
# 0 = property definition name
invalidGetStateRequest = The "getState" method cannot be used for property "{0}."
+# 0 = property definition name, 1 = default value with the invalid qualifier
+invalidQualifierForDefaultValue = Property definition "{0}" has a default value of "{1}" that does not have a valid qualifier.
# 0 = invalid query operator
invalidQueryOperator = Expected a valid query operator ('=', '<>', '<', '<=', '>', '>=', or 'LIKE'), but was "{0}" for property definition "{1}."
# 0 = property value, 1 = property type, 2 = property definition name
invalidPropertyValueForType = The value "{0}" is not valid for a "{1}" property type in property "{2}."
# 0 = URI value
invalidUri = "{0}" is not a valid URI.
+# 0 = path to CND file
+jsrBuiltInsCndFileNotFound = The JSR built-ins CND file "{0}" could not be found in workspace.
+# 0 = path to CND file
+jsrBuiltInsCndFileNotFoundInFilesystem = The JSR built-ins CND file "{0}" could not be found in the filesystem.
# 0 = a name
localNameEqualToSelfOrParent = The "{0}" cannot be equal to self (dot) or parent (dot dot).
# 0 = property or attribute name
Added: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/icons/show-inherited-16x.gif
===================================================================
(Binary files differ)
Property changes on: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/icons/show-inherited-16x.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/JcrUiConstants.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/JcrUiConstants.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/JcrUiConstants.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -69,5 +69,10 @@
* The relative path from the plugin folder to the icon used for the CND editor.
*/
String CND_EDITOR = ICONS_FOLDER + "cnd-editor-16x.png"; //$NON-NLS-1$
+
+ /**
+ * The relative path from the plugin folder to the icon used to show inherited properties and child nodes.
+ */
+ String SHOW_INHERITED = ICONS_FOLDER + "show-inherited-16x.gif"; //$NON-NLS-1$
}
}
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndEditor.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndEditor.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndEditor.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -536,6 +536,8 @@
hookRefreshListener();
}
+
+ refreshReadOnlyState();
}
/**
@@ -670,7 +672,6 @@
public void setFocus() {
super.setFocus();
refreshCnd();
- refreshReadOnlyState();
}
/**
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndFormsEditorPage.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndFormsEditorPage.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndFormsEditorPage.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -17,6 +17,8 @@
import java.util.Collections;
import java.util.List;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.MenuManager;
@@ -45,7 +47,9 @@
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -79,6 +83,8 @@
import org.jboss.tools.modeshape.jcr.cnd.CndElement.NotationType;
import org.jboss.tools.modeshape.jcr.cnd.CndValidator;
import org.jboss.tools.modeshape.jcr.cnd.CompactNodeTypeDefinition;
+import org.jboss.tools.modeshape.jcr.ui.Activator;
+import org.jboss.tools.modeshape.jcr.ui.JcrUiConstants;
import org.jboss.tools.modeshape.jcr.ui.JcrUiUtils;
import org.jboss.tools.modeshape.ui.UiMessages;
import org.jboss.tools.modeshape.ui.UiUtils;
@@ -93,7 +99,6 @@
class CndFormsEditorPage extends CndEditorPage implements PropertyChangeListener {
private IAction addChildNode;
-
private IAction addNamespace;
private IAction addNodeType;
private IAction addProperty;
@@ -124,6 +129,8 @@
private Section propertiesSection;
private TableViewer propertyViewer;
private NodeTypeDefinition selectedNodeType; // needed for property changes (can be null)
+ private IAction showInheritedChildNodes;
+ private IAction showInheritedProperties;
private TableViewer superTypesViewer;
private Text txtFilter;
@@ -204,6 +211,22 @@
this.editChildNode.setEnabled(false);
this.editChildNode.setToolTipText(CndMessages.editChildNodeToolTip);
this.editChildNode.setImageDescriptor(JcrUiUtils.getEditImageDescriptor());
+
+ this.showInheritedChildNodes = new Action(Utils.EMPTY_STRING, SWT.TOGGLE) {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ handleShowInheritedChildNodesChanged();
+ }
+ };
+ this.showInheritedChildNodes.setToolTipText(CndMessages.showInheritedChildNodesToolTip);
+ this.showInheritedChildNodes.setImageDescriptor(Activator.getSharedInstance()
+ .getImageDescriptor(JcrUiConstants.Images.SHOW_INHERITED));
}
private void createChildNodeSection( final IManagedForm managedForm,
@@ -238,7 +261,8 @@
toolkit.paintBordersFor(container);
// create toolbar
- FormUtils.createToolBar(container, toolkit, new IAction[] { this.addChildNode, this.editChildNode, this.deleteChildNode });
+ FormUtils.createToolBar(container, toolkit, new IAction[] { this.addChildNode, this.editChildNode, this.deleteChildNode,
+ this.showInheritedChildNodes });
final Table table = FormUtils.createTable(toolkit, container);
((GridData)table.getLayoutData()).heightHint = table.getItemHeight() * 5;
@@ -266,6 +290,46 @@
/**
* {@inheritDoc}
*
+ * @see org.eclipse.jface.viewers.ColumnLabelProvider#getBackground(java.lang.Object)
+ */
+ @Override
+ public Color getBackground( Object element ) {
+ final ChildNodeDefinition childNodeDefinition = (ChildNodeDefinition)element;
+
+ if (shouldShowInheritedChildNodes()) {
+ NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
+
+ if (!nodeTypeDefinition.hasDeclaredChildNodeDefinition(childNodeDefinition.getName())) {
+ return getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
+ }
+ }
+
+ return super.getBackground(element);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.ColumnLabelProvider#getFont(java.lang.Object)
+ */
+ @Override
+ public Font getFont( Object element ) {
+ final ChildNodeDefinition childNodeDefinition = (ChildNodeDefinition)element;
+
+ if (shouldShowInheritedChildNodes()) {
+ NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
+
+ if (!nodeTypeDefinition.hasDeclaredChildNodeDefinition(childNodeDefinition.getName())) {
+ return JFaceResources.getFontRegistry().getItalic(JFaceResources.TEXT_FONT);
+ }
+ }
+
+ return super.getFont(element);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
*/
@Override
@@ -319,11 +383,22 @@
public Object[] getElements( final Object inputElement ) {
final NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
- if (nodeTypeDefinition == null) {
- return Utils.EMPTY_OBJECT_ARRAY;
+ if (nodeTypeDefinition != null) {
+ try {
+ return getCnd().getChildNodeDefinitions(nodeTypeDefinition.getName(), shouldShowInheritedChildNodes())
+ .toArray();
+ } catch (Exception e) {
+ Activator.getSharedInstance()
+ .getLog()
+ .log(new Status(IStatus.ERROR,
+ JcrUiConstants.PLUGIN_ID,
+ NLS.bind(CndMessages.errorObtainingInheritedItemDefinitions,
+ nodeTypeDefinition.getName()),
+ e));
+ }
}
- return nodeTypeDefinition.getChildNodeDefinitions().toArray();
+ return Utils.EMPTY_OBJECT_ARRAY;
}
/**
@@ -341,6 +416,8 @@
});
// open edit child node on double click
+ final IAction editAction = this.editChildNode;
+
this.childNodeViewer.addDoubleClickListener(new IDoubleClickListener() {
/**
@@ -350,7 +427,9 @@
*/
@Override
public void doubleClick( final DoubleClickEvent event ) {
- handleEditChildNode();
+ if (editAction.isEnabled()) {
+ handleEditChildNode();
+ }
}
});
@@ -777,6 +856,8 @@
});
// open edit namespace on double click
+ final IAction editAction = this.editNamespace;
+
this.namespaceViewer.addDoubleClickListener(new IDoubleClickListener() {
/**
@@ -786,7 +867,9 @@
*/
@Override
public void doubleClick( final DoubleClickEvent event ) {
- handleEditNamespace();
+ if (editAction.isEnabled()) {
+ handleEditNamespace();
+ }
}
});
@@ -1121,6 +1204,22 @@
this.editProperty.setEnabled(false);
this.editProperty.setToolTipText(CndMessages.editPropertyToolTip);
this.editProperty.setImageDescriptor(JcrUiUtils.getEditImageDescriptor());
+
+ this.showInheritedProperties = new Action(Utils.EMPTY_STRING, SWT.TOGGLE) {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ handleShowInheritedPropertiesChanged();
+ }
+ };
+ this.showInheritedProperties.setToolTipText(CndMessages.showInheritedPropertiesToolTip);
+ this.showInheritedProperties.setImageDescriptor(Activator.getSharedInstance()
+ .getImageDescriptor(JcrUiConstants.Images.SHOW_INHERITED));
}
private void createPropertySection( final IManagedForm managedForm,
@@ -1155,7 +1254,8 @@
toolkit.paintBordersFor(container);
// create toolbar
- FormUtils.createToolBar(container, toolkit, new IAction[] { this.addProperty, this.editProperty, this.deleteProperty });
+ FormUtils.createToolBar(container, toolkit, new IAction[] { this.addProperty, this.editProperty, this.deleteProperty,
+ this.showInheritedProperties });
final Table table = FormUtils.createTable(toolkit, container);
((GridData)table.getLayoutData()).heightHint = table.getItemHeight() * 5;
@@ -1183,6 +1283,46 @@
/**
* {@inheritDoc}
*
+ * @see org.eclipse.jface.viewers.ColumnLabelProvider#getBackground(java.lang.Object)
+ */
+ @Override
+ public Color getBackground( Object element ) {
+ final PropertyDefinition propertyDefinition = (PropertyDefinition)element;
+
+ if (shouldShowInheritedProperties()) {
+ NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
+
+ if (!nodeTypeDefinition.hasDeclaredPropertyDefinition(propertyDefinition.getName())) {
+ return getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
+ }
+ }
+
+ return super.getBackground(element);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.ColumnLabelProvider#getFont(java.lang.Object)
+ */
+ @Override
+ public Font getFont( Object element ) {
+ final PropertyDefinition propertyDefinition = (PropertyDefinition)element;
+
+ if (shouldShowInheritedProperties()) {
+ NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
+
+ if (!nodeTypeDefinition.hasDeclaredPropertyDefinition(propertyDefinition.getName())) {
+ return JFaceResources.getFontRegistry().getItalic(JFaceResources.TEXT_FONT);
+ }
+ }
+
+ return super.getFont(element);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
*/
@Override
@@ -1246,11 +1386,22 @@
public Object[] getElements( final Object inputElement ) {
final NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
- if (nodeTypeDefinition == null) {
- return Utils.EMPTY_OBJECT_ARRAY;
+ if (nodeTypeDefinition != null) {
+ try {
+ return getCnd().getPropertyDefinitions(nodeTypeDefinition.getName(), shouldShowInheritedProperties())
+ .toArray();
+ } catch (Exception e) {
+ Activator.getSharedInstance()
+ .getLog()
+ .log(new Status(IStatus.ERROR,
+ JcrUiConstants.PLUGIN_ID,
+ NLS.bind(CndMessages.errorObtainingInheritedItemDefinitions,
+ nodeTypeDefinition.getName()),
+ e));
+ }
}
- return nodeTypeDefinition.getPropertyDefinitions().toArray();
+ return Utils.EMPTY_OBJECT_ARRAY;
}
/**
@@ -1268,6 +1419,8 @@
});
// open edit property on double click
+ final IAction editAction = this.editProperty;
+
this.propertyViewer.addDoubleClickListener(new IDoubleClickListener() {
/**
@@ -1277,7 +1430,9 @@
*/
@Override
public void doubleClick( final DoubleClickEvent event ) {
- handleEditProperty();
+ if (editAction.isEnabled()) {
+ handleEditProperty();
+ }
}
});
@@ -1437,6 +1592,8 @@
}
});
+ final IAction editAction = this.editSuperType;
+
this.superTypesViewer.addDoubleClickListener(new IDoubleClickListener() {
/**
@@ -1446,7 +1603,9 @@
*/
@Override
public void doubleClick( final DoubleClickEvent event ) {
- handleEditSuperType();
+ if (editAction.isEnabled()) {
+ handleEditSuperType();
+ }
}
});
@@ -1693,7 +1852,11 @@
void handleAddProperty() {
assert (getSelectedNodeType() != null) : "add property handler called but there is no selected node type"; //$NON-NLS-1$
- final PropertyDialog dialog = new PropertyDialog(getShell(), getPropertyNames(), getCnd().getNamespacePrefixes());
+ final NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
+ final PropertyDialog dialog = new PropertyDialog(getShell(),
+ getPropertyNames(),
+ getCnd().getNamespacePrefixes(),
+ nodeTypeDefinition.isQueryable());
dialog.create();
dialog.getShell().pack();
@@ -1701,7 +1864,7 @@
final PropertyDefinition newPropertyDefinition = dialog.getPropertyDefinition();
// add and select new property definition
- if (getSelectedNodeType().addPropertyDefinition(newPropertyDefinition)) {
+ if (nodeTypeDefinition.addPropertyDefinition(newPropertyDefinition)) {
this.propertyViewer.setSelection(new StructuredSelection(newPropertyDefinition), true);
UiUtils.pack(this.propertyViewer);
@@ -1757,6 +1920,11 @@
enable = (getSelectedChildNode() != null);
+ // disable if selected child node is inherited
+ if (enable && shouldShowInheritedChildNodes()) {
+ enable = getSelectedNodeType().hasDeclaredChildNodeDefinition(getSelectedChildNode().getName());
+ }
+
if (this.editChildNode.isEnabled() != enable) {
this.editChildNode.setEnabled(enable);
}
@@ -1967,16 +2135,17 @@
assert (getSelectedNodeType() != null) : "Edit property handler called but there is no selected node type"; //$NON-NLS-1$
assert (getSelectedProperty() != null) : "Edit property handler has been called when there is no property selected"; //$NON-NLS-1$
+ final NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
final PropertyDefinition propertyBeingEdited = getSelectedProperty();
final PropertyDialog dialog = new PropertyDialog(getShell(),
getPropertyNames(),
getCnd().getNamespacePrefixes(),
+ nodeTypeDefinition.isQueryable(),
propertyBeingEdited);
dialog.create();
dialog.getShell().pack();
if (dialog.open() == Window.OK) {
- final NodeTypeDefinition nodeTypeDefinition = getSelectedNodeType();
final PropertyDefinition newPropertyDefinition = dialog.getPropertyDefinition();
boolean removed = false;
boolean added = false;
@@ -2086,8 +2255,8 @@
// update section descriptions
if (this.selectedNodeType == null) {
this.detailsSection.setDescription(CndMessages.cndEditorDetailsSectionDescription);
- this.propertiesSection.setDescription(CndMessages.cndEditorChildNodeSectionDescription);
- this.childNodeSection.setDescription(CndMessages.cndEditorPropertySectionDescription);
+ this.propertiesSection.setDescription(CndMessages.cndEditorPropertySectionDescription);
+ this.childNodeSection.setDescription(CndMessages.cndEditorChildNodeSectionDescription);
} else {
String name = this.selectedNodeType.getName();
@@ -2097,8 +2266,8 @@
this.nameEditor.setNameBeingEdited(this.selectedNodeType.getQualifiedName());
this.detailsSection.setDescription(NLS.bind(CndMessages.cndEditorChildNodeSectionDescriptionWithNodeTypeName, name));
- this.propertiesSection.setDescription(NLS.bind(CndMessages.cndEditorChildNodeSectionDescriptionWithNodeTypeName, name));
- this.childNodeSection.setDescription(NLS.bind(CndMessages.cndEditorPropertySectionDescriptionWithNodeTypeName, name));
+ this.propertiesSection.setDescription(NLS.bind(CndMessages.cndEditorPropertySectionDescriptionWithNodeTypeName, name));
+ this.childNodeSection.setDescription(NLS.bind(CndMessages.cndEditorChildNodeSectionDescriptionWithNodeTypeName, name));
}
// populate details section
@@ -2183,6 +2352,11 @@
enable = (getSelectedProperty() != null);
+ // disable if selected property is inherited
+ if (enable && shouldShowInheritedProperties()) {
+ enable = getSelectedNodeType().hasDeclaredPropertyDefinition(getSelectedProperty().getName());
+ }
+
if (this.editProperty.isEnabled() != enable) {
this.editProperty.setEnabled(enable);
}
@@ -2196,6 +2370,14 @@
getSelectedNodeType().setQueryable(newValue);
}
+ void handleShowInheritedChildNodesChanged() {
+ refreshChildNodeViewer();
+ }
+
+ void handleShowInheritedPropertiesChanged() {
+ refreshPropertyViewer();
+ }
+
void handleSuperTypeSelected() {
// update button enablements
final boolean enable = (getSelectedSuperType() != null);
@@ -2461,6 +2643,14 @@
updateEnabledState();
}
+ boolean shouldShowInheritedChildNodes() {
+ return this.showInheritedChildNodes.isChecked();
+ }
+
+ boolean shouldShowInheritedProperties() {
+ return this.showInheritedProperties.isChecked();
+ }
+
/**
* {@inheritDoc}
*
@@ -2570,8 +2760,13 @@
this.propertyViewer.getTable().setEnabled(enableWithNodeTypeSelected);
}
- final boolean enable = (enableWithNodeTypeSelected && (getSelectedProperty() != null));
+ boolean enable = (enableWithNodeTypeSelected && (getSelectedProperty() != null));
+ // disable if selected property is inherited
+ if (enable && shouldShowInheritedProperties()) {
+ enable = getSelectedNodeType().hasDeclaredPropertyDefinition(getSelectedProperty().getName());
+ }
+
if (this.editProperty.isEnabled() != enable) {
this.editProperty.setEnabled(enable);
}
@@ -2590,8 +2785,13 @@
this.childNodeViewer.getTable().setEnabled(enableWithNodeTypeSelected);
}
- final boolean enable = (enableWithNodeTypeSelected && (getSelectedChildNode() != null));
+ boolean enable = (enableWithNodeTypeSelected && (getSelectedChildNode() != null));
+ // disable if selected child node is inherited
+ if (enable && shouldShowInheritedChildNodes()) {
+ enable = getSelectedNodeType().hasDeclaredChildNodeDefinition(getSelectedChildNode().getName());
+ }
+
if (this.editChildNode.isEnabled() != enable) {
this.editChildNode.setEnabled(enable);
}
@@ -2629,13 +2829,13 @@
private void validateNamespaces() {
final MultiValidationStatus status = CndValidator.validateNamespaceMappings(getCnd().getNamespaceMappings());
- updateMessage(status, this.namespaceSection);
+ updateMessage(status, this.namespaceSection.getDescriptionControl());
}
private void validateNodeTypes() {
final MultiValidationStatus status = CndValidator.validateNodeTypeDefinitions(getCnd().getNodeTypeDefinitions(),
getCnd().getNamespacePrefixes(), true);
- updateMessage(status, this.nodeTypeSection);
+ updateMessage(status, this.nodeTypeSection.getDescriptionControl());
}
private void validateProperties() {
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndMessages.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndMessages.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/CndMessages.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -623,6 +623,11 @@
public static String editValueConstraintToolTip;
/**
+ * A tool tip message for the "equals" query operator.
+ */
+ public static String equalsOperatorToolTip;
+
+ /**
* An error message indicating the new child node definition was not added to the node type definition. One parameter, the child
* definition name, is required.
*/
@@ -755,11 +760,37 @@
public static String errorEditingValueConstraint;
/**
+ * The error message when there was a problem obtaining the node type definition's inherited properties and child nodes. One
+ * parameter, the node type definition name, is required.
+ */
+ public static String errorObtainingInheritedItemDefinitions;
+
+ /**
* The error message when the CND editor could not be opened.
*/
public static String errorOpeningCndEditor;
/**
+ * A tool tip message for the "greater than or equals to" query operator.
+ */
+ public static String greaterThanEqualsOperatorToolTip;
+
+ /**
+ * A tool tip message for the "greater than" query operator.
+ */
+ public static String greaterThanOperatorToolTip;
+
+ /**
+ * A tool tip message for the "less than or equals to" query operator.
+ */
+ public static String lessThanEqualsOperatorToolTip;
+
+ /**
+ * A tool tip message for the "less than" query operator.
+ */
+ public static String lessThanOperatorToolTip;
+
+ /**
* A name for the mandatory attribute suitable for a radio or check button.
*/
public static String mandatoryAttribute;
@@ -915,6 +946,11 @@
public static String noQueryOrderAttributeToolTip;
/**
+ * A tool tip message for the "not equals" query operator.
+ */
+ public static String notEqualsOperatorToolTip;
+
+ /**
* A label for an on parent version attribute control.
*/
public static String onParentVersionLabel;
@@ -1051,6 +1087,16 @@
public static String sameNamedSiblingsAttributeToolTip;
/**
+ * A tool tip message for the show inherited child node action.
+ */
+ public static String showInheritedChildNodesToolTip;
+
+ /**
+ * A tool tip message for the show inherited properties action.
+ */
+ public static String showInheritedPropertiesToolTip;
+
+ /**
* A label for a supertypes control.
*/
public static String supertypesLabel;
@@ -1076,6 +1122,11 @@
public static String unqualifiedNameToolTip;
/**
+ * A label for a URI control.
+ */
+ public static String uriLabel;
+
+ /**
* A tooltip message for a control containing all the valid qualifed name qualifiers in a CND.
*/
public static String validQualifiersToolTip;
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/NamespaceMappingDialog.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/NamespaceMappingDialog.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/NamespaceMappingDialog.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -16,6 +16,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -30,6 +31,7 @@
import org.jboss.tools.modeshape.jcr.MultiValidationStatus;
import org.jboss.tools.modeshape.jcr.NamespaceMapping;
import org.jboss.tools.modeshape.jcr.Utils;
+import org.jboss.tools.modeshape.jcr.WorkspaceRegistry;
import org.jboss.tools.modeshape.jcr.cnd.CndValidator;
import org.jboss.tools.modeshape.jcr.ui.Activator;
import org.jboss.tools.modeshape.jcr.ui.JcrUiConstants;
@@ -55,8 +57,12 @@
private String prefix;
+ private String saveUri = Utils.EMPTY_STRING;
+
private ScrolledForm scrolledForm;
+ private Text txtUri;
+
private String uri;
/**
@@ -176,21 +182,21 @@
}
{ // URI
- final Label lblUri = toolkit.createLabel(body, CndMessages.nameLabel, SWT.NONE);
+ final Label lblUri = toolkit.createLabel(body, CndMessages.uriLabel, SWT.NONE);
lblUri.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- final Text txtUri = toolkit.createText(body, null, Styles.TEXT_STYLE);
- txtUri.setToolTipText(CndMessages.namespaceUriToolTip);
+ this.txtUri = toolkit.createText(body, null, Styles.TEXT_STYLE);
+ this.txtUri.setToolTipText(CndMessages.namespaceUriToolTip);
final GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
gd.verticalIndent += ((GridLayout)body.getLayout()).verticalSpacing;
- txtUri.setLayoutData(gd);
+ this.txtUri.setLayoutData(gd);
if (isEditMode()) {
- txtUri.setText(this.namespaceBeingEdited.getUri());
+ this.txtUri.setText(this.namespaceBeingEdited.getUri());
}
- txtUri.addModifyListener(new ModifyListener() {
+ this.txtUri.addModifyListener(new ModifyListener() {
/**
* {@inheritDoc}
@@ -216,6 +222,20 @@
void handlePrefixChanged( final String newPrefix ) {
this.prefix = newPrefix;
+
+ try {
+ if (!Utils.isEmpty(this.prefix)) {
+ if (!Utils.isEmpty(this.saveUri) && WorkspaceRegistry.get().getUri(this.prefix) == null) {
+ this.txtUri.setText(this.saveUri);
+ this.saveUri = Utils.EMPTY_STRING;
+ } else {
+ this.saveUri = this.txtUri.getText();
+ this.txtUri.setText(WorkspaceRegistry.get().getUri(this.prefix));
+ }
+ }
+ } catch (final Exception e) {
+ }
+
updateState();
}
@@ -240,6 +260,11 @@
if (!enable) {
this.scrolledForm.setMessage(status.getMessage(), IMessageProvider.ERROR);
+ Point preferredSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
+
+ if (preferredSize.x > getShell().getSize().x) {
+ getShell().pack();
+ }
} else if ((isEditMode() && currentNamespace.equals(this.namespaceBeingEdited))
|| (!isEditMode() && Utils.isEmpty(this.prefix) && Utils.isEmpty(this.uri))) {
enable = false;
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/PropertyDialog.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/PropertyDialog.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/PropertyDialog.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -96,6 +96,7 @@
private final Collection<QualifiedName> existingPropertyNames;
private QualifiedNameEditor nameEditor;
private final ErrorMessage nameError;
+ private final boolean nodeTypeQueryable; // query ops are not used if node type is not queryable
private PropertyDefinition originalProperty;
private PropertyDefinition propertyBeingEdited;
private ScrolledForm scrolledForm;
@@ -108,15 +109,18 @@
* @param parentShell the parent shell (can be <code>null</code>)
* @param existingPropertyNames the existing property names (can be <code>null</code> or empty)
* @param existingNamespacePrefixes the existing CND namespace prefixes (can be <code>null</code> or empty)
+ * @param nodeTypeQueryable indicates if node type of the property being created is queryable
*/
public PropertyDialog( final Shell parentShell,
final Collection<QualifiedName> existingPropertyNames,
- final Collection<String> existingNamespacePrefixes ) {
+ final Collection<String> existingNamespacePrefixes,
+ final boolean nodeTypeQueryable ) {
super(parentShell);
this.existingPropertyNames = ((existingPropertyNames == null) ? Collections.<QualifiedName> emptyList()
: new ArrayList<QualifiedName>(existingPropertyNames));
this.existingNamespacePrefixes = ((existingNamespacePrefixes == null) ? Collections.<String> emptyList()
: new ArrayList<String>(existingNamespacePrefixes));
+ this.nodeTypeQueryable = nodeTypeQueryable;
this.defaultValuesError = new ErrorMessage();
this.nameError = new ErrorMessage();
this.valueConstraintsError = new ErrorMessage();
@@ -129,13 +133,15 @@
* @param parentShell the parent shell (can be <code>null</code>)
* @param existingPropertyNames the existing property names (can be <code>null</code> or empty)
* @param existingNamespacePrefixes the existing CND namespace prefixes (can be <code>null</code> or empty)
- * @param propertyDefinitionBeingEdited the proeprty definition being edited (cannot be <code>null</code>)
+ * @param nodeTypeQueryable indicates if node type of the property being edited is queryable
+ * @param propertyDefinitionBeingEdited the property definition being edited (cannot be <code>null</code>)
*/
public PropertyDialog( final Shell parentShell,
final Collection<QualifiedName> existingPropertyNames,
final Collection<String> existingNamespacePrefixes,
+ final boolean nodeTypeQueryable,
final PropertyDefinition propertyDefinitionBeingEdited ) {
- this(parentShell, existingPropertyNames, existingNamespacePrefixes);
+ this(parentShell, existingPropertyNames, existingNamespacePrefixes, nodeTypeQueryable);
Utils.verifyIsNotNull(propertyDefinitionBeingEdited, "propertyDefinitionBeingEdited"); //$NON-NLS-1$
this.originalProperty = propertyDefinitionBeingEdited;
@@ -599,163 +605,166 @@
});
}
- { // queryOps
- final Collection<String> supportedQueryOps = Arrays.asList(this.propertyBeingEdited.getAvailableQueryOperators());
- final Composite queryOpsContainer = toolkit.createComposite(attributesContainer);
- queryOpsContainer.setLayout(new GridLayout(7, false));
- ((GridLayout)queryOpsContainer.getLayout()).marginHeight = 0;
- ((GridLayout)queryOpsContainer.getLayout()).marginWidth = 0;
- queryOpsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- toolkit.paintBordersFor(queryOpsContainer);
- toolkit.createLabel(queryOpsContainer, CndMessages.queryOperatorsLabel);
+ if (this.nodeTypeQueryable) {
+ { // queryOps
+ final Collection<String> supportedQueryOps = Arrays.asList(this.propertyBeingEdited.getAvailableQueryOperators());
+ final Composite queryOpsContainer = toolkit.createComposite(attributesContainer);
+ queryOpsContainer.setLayout(new GridLayout(7, false));
+ ((GridLayout)queryOpsContainer.getLayout()).marginHeight = 0;
+ ((GridLayout)queryOpsContainer.getLayout()).marginWidth = 0;
+ queryOpsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ toolkit.paintBordersFor(queryOpsContainer);
+ toolkit.createLabel(queryOpsContainer, CndMessages.queryOperatorsLabel);
- { // equals query operator
- final Button btnEquals = toolkit.createButton(queryOpsContainer, QueryOperator.EQUALS.toString(), SWT.CHECK);
- btnEquals.setBackground(attributesContainer.getBackground());
+ { // equals query operator
+ final Button btnEquals = toolkit.createButton(queryOpsContainer, QueryOperator.EQUALS.toString(), SWT.CHECK);
+ btnEquals.setBackground(attributesContainer.getBackground());
- if (supportedQueryOps.contains(btnEquals.getText())) {
- btnEquals.setSelection(true);
+ if (supportedQueryOps.contains(btnEquals.getText())) {
+ btnEquals.setSelection(true);
+ }
+
+ btnEquals.addSelectionListener(new SelectionAdapter() {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected( final SelectionEvent e ) {
+ Button btn = (Button)e.widget;
+ handleQueryOperatorChanged(btn.getText(), btn.getSelection());
+ }
+ });
+ btnEquals.setToolTipText(CndMessages.equalsOperatorToolTip);
}
- btnEquals.addSelectionListener(new SelectionAdapter() {
+ { // not equals query operator
+ final Button btnNotEquals = toolkit.createButton(queryOpsContainer, QueryOperator.NOT_EQUALS.toString(),
+ SWT.CHECK);
+ btnNotEquals.setBackground(attributesContainer.getBackground());
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( final SelectionEvent e ) {
- Button btn = (Button)e.widget;
- handleQueryOperatorChanged(btn.getText(), btn.getSelection());
+ if (supportedQueryOps.contains(btnNotEquals.getText())) {
+ btnNotEquals.setSelection(true);
}
- });
- // btnEquals.setToolTipText(CndMessages.multipleAttributeToolTip);
- }
- { // not equals query operator
- final Button btnNotEquals = toolkit.createButton(queryOpsContainer, QueryOperator.NOT_EQUALS.toString(),
- SWT.CHECK);
- btnNotEquals.setBackground(attributesContainer.getBackground());
+ btnNotEquals.addSelectionListener(new SelectionAdapter() {
- if (supportedQueryOps.contains(btnNotEquals.getText())) {
- btnNotEquals.setSelection(true);
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected( final SelectionEvent e ) {
+ Button btn = (Button)e.widget;
+ handleQueryOperatorChanged(btn.getText(), btn.getSelection());
+ }
+ });
+ btnNotEquals.setToolTipText(CndMessages.notEqualsOperatorToolTip);
}
- btnNotEquals.addSelectionListener(new SelectionAdapter() {
+ { // greater than query operator
+ final Button btnGreaterThan = toolkit.createButton(queryOpsContainer,
+ QueryOperator.GREATER_THAN.toString(), SWT.CHECK);
+ btnGreaterThan.setBackground(attributesContainer.getBackground());
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( final SelectionEvent e ) {
- Button btn = (Button)e.widget;
- handleQueryOperatorChanged(btn.getText(), btn.getSelection());
+ if (supportedQueryOps.contains(btnGreaterThan.getText())) {
+ btnGreaterThan.setSelection(true);
}
- });
- // btnNotEquals.setToolTipText(CndMessages.multipleAttributeToolTip);
- }
- { // greater than query operator
- final Button btnGreaterThan = toolkit.createButton(queryOpsContainer, QueryOperator.GREATER_THAN.toString(),
- SWT.CHECK);
- btnGreaterThan.setBackground(attributesContainer.getBackground());
+ btnGreaterThan.addSelectionListener(new SelectionAdapter() {
- if (supportedQueryOps.contains(btnGreaterThan.getText())) {
- btnGreaterThan.setSelection(true);
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected( final SelectionEvent e ) {
+ Button btn = (Button)e.widget;
+ handleQueryOperatorChanged(btn.getText(), btn.getSelection());
+ }
+ });
+ btnGreaterThan.setToolTipText(CndMessages.greaterThanOperatorToolTip);
}
- btnGreaterThan.addSelectionListener(new SelectionAdapter() {
+ { // less than query operator
+ final Button btnLessThan = toolkit.createButton(queryOpsContainer, QueryOperator.LESS_THAN.toString(),
+ SWT.CHECK);
+ btnLessThan.setBackground(attributesContainer.getBackground());
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( final SelectionEvent e ) {
- Button btn = (Button)e.widget;
- handleQueryOperatorChanged(btn.getText(), btn.getSelection());
+ if (supportedQueryOps.contains(btnLessThan.getText())) {
+ btnLessThan.setSelection(true);
}
- });
- // btnGreater.setToolTipText(CndMessages.multipleAttributeToolTip);
- }
- { // less than query operator
- final Button btnLessThan = toolkit.createButton(queryOpsContainer, QueryOperator.LESS_THAN.toString(),
- SWT.CHECK);
- btnLessThan.setBackground(attributesContainer.getBackground());
+ btnLessThan.addSelectionListener(new SelectionAdapter() {
- if (supportedQueryOps.contains(btnLessThan.getText())) {
- btnLessThan.setSelection(true);
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected( final SelectionEvent e ) {
+ Button btn = (Button)e.widget;
+ handleQueryOperatorChanged(btn.getText(), btn.getSelection());
+ }
+ });
+ btnLessThan.setToolTipText(CndMessages.lessThanOperatorToolTip);
}
- btnLessThan.addSelectionListener(new SelectionAdapter() {
+ { // greater than or equal query operator
+ final Button btnGreaterThanEquals = toolkit.createButton(queryOpsContainer,
+ QueryOperator.GREATER_THAN_EQUALS.toString(),
+ SWT.CHECK);
+ btnGreaterThanEquals.setBackground(attributesContainer.getBackground());
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( final SelectionEvent e ) {
- Button btn = (Button)e.widget;
- handleQueryOperatorChanged(btn.getText(), btn.getSelection());
+ if (supportedQueryOps.contains(btnGreaterThanEquals.getText())) {
+ btnGreaterThanEquals.setSelection(true);
}
- });
- // btnLess.setToolTipText(CndMessages.multipleAttributeToolTip);
- }
- { // greater than or equal query operator
- final Button btnGreaterThanEqual = toolkit.createButton(queryOpsContainer,
- QueryOperator.GREATER_THAN_EQUALS.toString(), SWT.CHECK);
- btnGreaterThanEqual.setBackground(attributesContainer.getBackground());
+ btnGreaterThanEquals.addSelectionListener(new SelectionAdapter() {
- if (supportedQueryOps.contains(btnGreaterThanEqual.getText())) {
- btnGreaterThanEqual.setSelection(true);
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected( final SelectionEvent e ) {
+ Button btn = (Button)e.widget;
+ handleQueryOperatorChanged(btn.getText(), btn.getSelection());
+ }
+ });
+ btnGreaterThanEquals.setToolTipText(CndMessages.greaterThanEqualsOperatorToolTip);
}
- btnGreaterThanEqual.addSelectionListener(new SelectionAdapter() {
+ { // less than or equals query operator
+ final Button btnLessThanEquals = toolkit.createButton(queryOpsContainer,
+ QueryOperator.LESS_THAN_EQUALS.toString(), SWT.CHECK);
+ btnLessThanEquals.setBackground(attributesContainer.getBackground());
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( final SelectionEvent e ) {
- Button btn = (Button)e.widget;
- handleQueryOperatorChanged(btn.getText(), btn.getSelection());
+ if (supportedQueryOps.contains(btnLessThanEquals.getText())) {
+ btnLessThanEquals.setSelection(true);
}
- });
- // btnGreaterEqual.setToolTipText(CndMessages.multipleAttributeToolTip);
- }
- { // less than or equals query operator
- final Button btnLessThanEqual = toolkit.createButton(queryOpsContainer,
- QueryOperator.LESS_THAN_EQUALS.toString(), SWT.CHECK);
- btnLessThanEqual.setBackground(attributesContainer.getBackground());
+ btnLessThanEquals.addSelectionListener(new SelectionAdapter() {
- if (supportedQueryOps.contains(btnLessThanEqual.getText())) {
- btnLessThanEqual.setSelection(true);
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected( final SelectionEvent e ) {
+ Button btn = (Button)e.widget;
+ handleQueryOperatorChanged(btn.getText(), btn.getSelection());
+ }
+ });
+ btnLessThanEquals.setToolTipText(CndMessages.lessThanEqualsOperatorToolTip);
}
-
- btnLessThanEqual.addSelectionListener(new SelectionAdapter() {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( final SelectionEvent e ) {
- Button btn = (Button)e.widget;
- handleQueryOperatorChanged(btn.getText(), btn.getSelection());
- }
- });
- // btnLessThanEqual.setToolTipText(CndMessages.multipleAttributeToolTip);
}
}
}
@@ -1472,7 +1481,8 @@
}
private void validateDefaultValues() {
- updateMessage(CndValidator.validateDefaultValues(this.propertyBeingEdited), this.defaultValuesError);
+ updateMessage(CndValidator.validateDefaultValues(this.propertyBeingEdited, existingNamespacePrefixes),
+ this.defaultValuesError);
}
private void validateName() {
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/QualifiedNameEditor.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/QualifiedNameEditor.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/QualifiedNameEditor.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -242,7 +242,11 @@
*/
void setValidQualifiers( final Collection<String> validQualifiers ) {
this.validQualifiers = ((validQualifiers == null) ? new ArrayList<String>(1) : new ArrayList<String>(validQualifiers));
- this.validQualifiers.add(0, CndMessages.noNameQualifierChoice); // include empty qualifier at index 0
+
+ if (!this.validQualifiers.contains(CndMessages.noNameQualifierChoice)) {
+ this.validQualifiers.add(0, CndMessages.noNameQualifierChoice); // include empty qualifier at index 0
+ }
+
updateUi();
}
@@ -252,7 +256,9 @@
// only reload qualifiers if different
if ((this.validQualifiers.size() != currentItems.length) || !this.validQualifiers.containsAll(Arrays.asList(currentItems))) {
- this.cbxQualifiers.setItems(this.validQualifiers.toArray(new String[this.validQualifiers.size()]));
+ String[] newQualifiers = this.validQualifiers.toArray(new String[this.validQualifiers.size()]);
+ Arrays.sort(newQualifiers);
+ this.cbxQualifiers.setItems(newQualifiers);
}
// select the current qualifier and set the name
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/cndMessages.properties
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/cndMessages.properties 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.jcr.ui/src/org/jboss/tools/modeshape/jcr/ui/cnd/cndMessages.properties 2012-04-03 17:25:43 UTC (rev 40012)
@@ -135,6 +135,7 @@
editSuperTypeMenuText = Edit Supertype
editValueConstraintMenuText = Edit Value Constraint
editValueConstraintToolTip = Edit the selected value constraint of the property definition
+equalsOperatorToolTip = Indicates if the property supports the "equals" query operation
errorAddingChildNode = There was an unexpected error adding child node "{0}" to the node type definition.
errorAddingDefaultValue = There was an unexpected error adding default value "{0}" to the property definition.
errorAddingNamespaceMapping = There was an unexpected error adding namespace mapping "{0}" to the CND.
@@ -157,7 +158,12 @@
errorEditingRequiredType = There was an unexpected error updating required type "{0}" to the CND.\nThe remove command result: {1}. The add command result: {2}.
errorEditingSupertype = There was an unexpected error updating supertype "{0}" to the CND.\nThe remove command result: {1}. The add command result: {2}.
errorEditingValueConstraint = There was an unexpected error updating value constraint "{0}" to the property definition.\nThe remove command result: {1}. The add command result: {2}.
+errorObtainingInheritedItemDefinitions = There was a problem obtaining the inherited properties and child node for node type definition "{0}."
errorOpeningCndEditor = There were errors parsing the CND so the CND editor could not be created. Fix errors and retry.
+greaterThanEqualsOperatorToolTip = Indicates if the property supports the "greater than or equal to" query operation
+greaterThanOperatorToolTip = Indicates if the property supports the "greater than" query operation
+lessThanEqualsOperatorToolTip = Indicates if the property supports the "less than or equal to" query operation
+lessThanOperatorToolTip = Indicates if the property supports the "less than" query operation
mandatoryAttribute = Mandatory
mandatoryAttributeToolTip = Indicates if the child node/property must exist
missingValue = <missing>
@@ -189,6 +195,7 @@
noPrimaryItemChoice = <not assigned>
noQueryOrderAttribute = Not Query Orderable
noQueryOrderAttributeToolTip = Indicates if query results of this property cannot be ordered
+notEqualsOperatorToolTip = Indicates if the property supports the "not equals" query operation
onParentVersionLabel = On Parent Version:
onParentVersionToolTip = Indicates what happens to the child node/property when the parent is created
orderableAttribute = Orderable
@@ -216,11 +223,14 @@
requiredTypesLabel = Required Types:
sameNamedSiblingsAttribute = Same Named Siblings
sameNamedSiblingsAttributeToolTip = Indicates if the node type can be queried
+showInheritedChildNodesToolTip = Show the child node definitions inherited by the selected node type definition
+showInheritedPropertiesToolTip = Show the property definitions inherited by the selected node type definition
supertypesLabel = Supertypes:
supertypesToolTip = The supertypes (node types and mixins) whose property definitions and child node definitions are inherited
typeHeaderText = Type
typeLabel = Type:
unqualifiedNameToolTip = The name part of the qualified name (cannot be empty)
+uriLabel = URI:
validQualifiersToolTip = The qualifiers known to this CND
valueConstraintDialogCreateMsg = Create Value Constraint
valueConstraintDialogEditMsg = Edit Value Constraint
Modified: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/build.properties
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/build.properties 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/build.properties 2012-04-03 17:25:43 UTC (rev 40012)
@@ -13,5 +13,6 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
- OSGI-INF/
+ OSGI-INF/,\
+ cnd/
src.includes = testdata/
Added: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/cnd/jsr_283_builtins.cnd
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/cnd/jsr_283_builtins.cnd (rev 0)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/cnd/jsr_283_builtins.cnd 2012-04-03 17:25:43 UTC (rev 40012)
@@ -0,0 +1,183 @@
+<jcr='http://www.jcp.org/jcr/1.0'>
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<mix='http://www.jcp.org/jcr/mix/1.0'>
+
+// ------------------------------------------------------------------------
+// Pre-defined Node Types
+// ------------------------------------------------------------------------
+
+[nt:base] abstract
+ - jcr:primaryType (name) mandatory autocreated
+ protected compute
+ - jcr:mixinTypes (name) protected multiple compute
+
+[nt:unstructured]
+ orderable
+ - * (undefined) multiple
+ - * (undefined)
+ + * (nt:base) = nt:unstructured sns version
+
+[mix:created] mixin
+ - jcr:created (date) protected
+ - jcr:createdBy (string) protected
+
+[nt:hierarchyNode] > mix:created abstract
+
+[nt:file] > nt:hierarchyNode
+ + jcr:content (nt:base) primary mandatory
+
+[nt:linkedFile] > nt:hierarchyNode
+ - jcr:content (reference) primary mandatory
+
+[nt:folder] > nt:hierarchyNode
+ + * (nt:hierarchyNode) version
+
+[mix:referenceable] mixin
+ - jcr:uuid (string) mandatory autocreated protected initialize
+
+[mix:mimeType] mixin
+ - jcr:mimeType (string)
+ - jcr:encoding (string)
+
+[mix:lastModified] mixin
+ - jcr:lastModified (date)
+ - jcr:lastModifiedBy (string)
+
+[nt:resource] > mix:mimeType, mix:lastModified
+ - jcr:data (binary) primary mandatory
+
+[nt:nodeType]
+ - jcr:nodeTypeName (name) mandatory protected copy
+ - jcr:supertypes (name) multiple protected copy
+ - jcr:isAbstract (boolean) mandatory protected copy
+ - jcr:isMixin (boolean) mandatory protected copy
+ - jcr:isQueryable (boolean) mandatory protected copy
+ - jcr:hasOrderableChildNodes (boolean) mandatory protected copy
+ - jcr:primaryItemName (name) protected copy
+ + jcr:propertyDefinition (nt:propertyDefinition) = nt:propertyDefinition sns protected copy
+ + jcr:childNodeDefinition (nt:childNodeDefinition) = nt:childNodeDefinition sns protected copy
+
+[nt:propertyDefinition]
+ - jcr:name (name) protected
+ - jcr:autoCreated (boolean) mandatory protected
+ - jcr:mandatory (boolean) mandatory protected
+ - jcr:isFullTextSearchable (boolean) mandatory protected
+ - jcr:isQueryOrderable (boolean) mandatory protected
+ - jcr:onParentVersion (string) mandatory protected
+ < 'COPY', 'VERSION', 'INITIALIZE', 'COMPUTE',
+ 'IGNORE', 'ABORT'
+ - jcr:protected (boolean) mandatory protected
+ - jcr:requiredType (string) mandatory protected
+ < 'STRING', 'URI', 'BINARY', 'LONG', 'DOUBLE', 'DECIMAL', 'BOOLEAN',
+ 'DATE', 'NAME', 'PATH', 'REFERENCE', 'WEAKREFERENCE', 'UNDEFINED'
+ - jcr:valueConstraints (string) multiple protected
+ - jcr:availableQueryOperators (name) mandatory multiple protected
+ - jcr:defaultValues (undefined) multiple protected
+ - jcr:multiple (boolean) mandatory protected
+
+[nt:childNodeDefinition]
+ - jcr:name (name) protected
+ - jcr:autoCreated (boolean) mandatory protected
+ - jcr:mandatory (boolean) mandatory protected
+ - jcr:onParentVersion (string) mandatory protected
+ < 'COPY', 'VERSION', 'INITIALIZE', 'COMPUTE',
+ 'IGNORE', 'ABORT'
+ - jcr:protected (boolean) mandatory protected
+ - jcr:requiredPrimaryTypes (name) = 'nt:base' mandatory protected multiple
+ - jcr:defaultPrimaryType (name) protected
+ - jcr:sameNameSiblings (boolean) mandatory protected
+
+[nt:versionHistory] > mix:referenceable
+ - jcr:versionableUuid (string) mandatory autocreated protected abort
+ - jcr:copiedFrom (weakreference) protected abort < 'nt:version'
+ + jcr:rootVersion (nt:version) = nt:version mandatory autocreated protected abort
+ + jcr:versionLabels (nt:versionLabels) = nt:versionLabels mandatory autocreated protected abort
+ + * (nt:version) = nt:version protected abort
+
+
+[nt:versionLabels]
+ - * (reference) protected abort < 'nt:version'
+
+[nt:version] > mix:referenceable
+ - jcr:created (date) mandatory autocreated protected abort
+ - jcr:predecessors (reference) protected multiple abort < 'nt:version'
+ - jcr:successors (reference) protected multiple abort < 'nt:version'
+ - jcr:activity (reference) protected abort < 'nt:activity'
+ + jcr:frozenNode (nt:frozenNode) protected abort
+
+[nt:frozenNode] > mix:referenceable
+ orderable
+ - jcr:frozenPrimaryType (name) mandatory autocreated protected abort
+ - jcr:frozenMixinTypes (name) protected multiple abort
+ - jcr:frozenUuid (string) mandatory autocreated protected abort
+ - * (undefined) protected abort
+ - * (undefined) protected multiple abort
+ + * (nt:base) protected sns abort
+
+[nt:versionedChild]
+ - jcr:childVersionHistory (reference) mandatory autocreated protected abort < 'nt:versionHistory'
+
+[nt:query]
+ - jcr:statement (string)
+ - jcr:language (string)
+
+[nt:activity] > mix:referenceable
+ - jcr:activityTitle (string) mandatory autocreated protected
+
+
+[mix:simpleVersionable] mixin
+ - jcr:isCheckedOut (boolean) = 'true' mandatory autocreated protected ignore
+
+[mix:versionable] > mix:simpleVersionable, mix:referenceable mixin
+ - jcr:versionHistory (reference) mandatory protected ignore < 'nt:versionHistory'
+ - jcr:baseVersion (reference) mandatory protected ignore < 'nt:version'
+ - jcr:predecessors (reference) mandatory protected multiple ignore < 'nt:version'
+ - jcr:mergeFailed (reference) protected multiple abort
+ - jcr:activity (reference) protected < 'nt:version'
+ - jcr:configuration (reference) protected ignore < 'nt:configuration'
+
+[nt:configuration] > mix:versionable
+ - jcr:root (reference) mandatory autocreated protected
+
+[nt:address]
+ - jcr:protocol (string)
+ - jcr:host (string)
+ - jcr:port (string)
+ - jcr:repository (string)
+ - jcr:workspace (string)
+ - jcr:path (path)
+ - jcr:id (weakreference)
+
+[nt:naturalText]
+ - jcr:text (string)
+ - jcr:messageId (string)
+
+
+// ------------------------------------------------------------------------
+// Pre-defined Mixins
+// ------------------------------------------------------------------------
+
+[mix:etag] mixin
+ - jcr:etag (string) protected autocreated
+
+[mix:lockable] mixin
+ - jcr:lockOwner (string) protected ignore
+ - jcr:lockIsDeep (boolean) protected ignore
+
+[mix:lifecycle] mixin
+ - jcr:lifecyclePolicy (reference) protected initialize
+ - jcr:currentLifecycleState (string) protected initialize
+
+[mix:managedRetention] > mix:referenceable mixin
+ - jcr:hold (string) protected multiple
+ - jcr:isDeep (boolean) protected multiple
+ - jcr:retentionPolicy (reference) protected
+
+[mix:shareable] > mix:referenceable mixin
+
+[mix:title] mixin
+ - jcr:title (string)
+ - jcr:description (string)
+
+[mix:language] mixin
+ - jcr:language (string)
\ No newline at end of file
Modified: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CndImporterTest.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CndImporterTest.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CndImporterTest.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -838,6 +838,22 @@
}
@Test
+ public void shouldParseNamespacesAndNodeTypesInAnyOrder() {
+ final String content = "[foo] > supertype1, supertype2\n" //$NON-NLS-1$
+ + "<ns1 = 'http://namespace1.com/ns1'>\n" //$NON-NLS-1$
+ + "<ns2 = 'http://namespace2.com/ns2'>\n" //$NON-NLS-1$
+ + "[bar] > supertype1, supertype2\n" //$NON-NLS-1$
+ + "<ns3 = 'http://namespace3.com/ns3'>"; //$NON-NLS-1$
+ this.cnd = this.importer.parse(content);
+
+ final List<NamespaceMapping> namespaces = this.cnd.getNamespaceMappings();
+ assertEquals(3, namespaces.size());
+
+ final List<NodeTypeDefinition> nodeTypes = this.cnd.getNodeTypeDefinitions();
+ assertEquals(2, nodeTypes.size());
+ }
+
+ @Test
public void shouldParseNamespaceDeclarationWithQuotedUriAndUnquotedPrefix() {
final String content = "<ns = 'http://namespace.com/ns'>"; //$NON-NLS-1$
this.cnd = this.importer.parse(content);
Modified: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CndValidatorTest.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CndValidatorTest.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CndValidatorTest.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -98,6 +98,14 @@
}
@Test
+ public void defaultValueWithInvalidQualifierShouldBeAnError() {
+ assertTrue(this.propertyDefinition.setType(PropertyType.NAME));
+ assertTrue(this.propertyDefinition.addDefaultValue("bogus:value")); //$NON-NLS-1$
+ assertTrue(CndValidator.validateDefaultValues(this.propertyDefinition, Constants.Helper.getDefaultNamespacePrefixes())
+ .isError());
+ }
+
+ @Test
public void emptyNamespaceMappingPrefixShouldBeAnError() {
assertTrue(CndValidator.validateNamespaceMapping(this.namespaceMapping).isError());
}
Modified: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CompactNodeTypeDefinitionTest.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CompactNodeTypeDefinitionTest.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/CompactNodeTypeDefinitionTest.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -12,13 +12,9 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import java.util.Collection;
-import java.util.Collections;
-
import org.jboss.tools.modeshape.jcr.Listener;
import org.jboss.tools.modeshape.jcr.NamespaceMapping;
import org.jboss.tools.modeshape.jcr.NodeTypeDefinition;
-import org.jboss.tools.modeshape.jcr.Utils;
import org.jboss.tools.modeshape.jcr.cnd.CompactNodeTypeDefinition.PropertyName;
import org.junit.Before;
import org.junit.Test;
@@ -56,18 +52,6 @@
assertEquals(this.nodeTypeDefinition, this.cnd.getNodeTypeDefinitions().iterator().next());
}
- @Test
- public void shouldClearNamespaceMappings() {
- assertTrue(this.cnd.addNamespaceMapping(this.namespaceMapping));
- assertTrue(this.cnd.clearNamespaceMappings());
- }
-
- @Test
- public void shouldClearNodeTypeDefinitions() {
- assertTrue(this.cnd.addNodeTypeDefinition(this.nodeTypeDefinition));
- assertTrue(this.cnd.clearNodeTypeDefinitions());
- }
-
@Test(expected = IllegalArgumentException.class)
public void shouldNotAllowNullNamespaceToBeAdded() {
this.cnd.addNamespaceMapping(null);
@@ -79,16 +63,6 @@
}
@Test
- public void shouldNotClearNamespaceMappingsWhenEmpty() {
- assertFalse(this.cnd.clearNamespaceMappings());
- }
-
- @Test
- public void shouldNotClearNodeTypeDefinitionsWhenEmpty() {
- assertFalse(this.cnd.clearNodeTypeDefinitions());
- }
-
- @Test
public void shouldNotReceiveEventAfterUnregistering() {
final Listener l = new Listener();
assertTrue(this.cnd.addListener(l));
@@ -135,36 +109,6 @@
}
@Test
- public void shouldReceiveEventAfterClearingNamespaceMappings() {
- assertTrue(this.cnd.addNamespaceMapping(this.namespaceMapping));
- final Collection<NamespaceMapping> oldValue = Collections.singletonList(this.namespaceMapping);
-
- final Listener l = new Listener();
- assertTrue(this.cnd.addListener(l));
-
- assertTrue(this.cnd.clearNamespaceMappings());
- assertEquals(1, l.getCount());
- assertEquals(PropertyName.NAMESPACE_MAPPINGS.toString(), l.getPropertyName());
- assertNull(l.getNewValue());
- assertTrue(Utils.equivalent(oldValue, (Collection<NamespaceMapping>)l.getOldValue()));
- }
-
- @Test
- public void shouldReceiveEventAfterClearingNodeTypeDefinitions() {
- assertTrue(this.cnd.addNodeTypeDefinition(this.nodeTypeDefinition));
- final Collection<NodeTypeDefinition> oldValue = Collections.singletonList(this.nodeTypeDefinition);
-
- final Listener l = new Listener();
- assertTrue(this.cnd.addListener(l));
-
- assertTrue(this.cnd.clearNodeTypeDefinitions());
- assertEquals(1, l.getCount());
- assertEquals(PropertyName.NODE_TYPE_DEFINITIONS.toString(), l.getPropertyName());
- assertNull(l.getNewValue());
- assertTrue(Utils.equivalent(oldValue, (Collection<NodeTypeDefinition>)l.getOldValue()));
- }
-
- @Test
public void shouldReceiveEventAfterRemoveNamespaceMapping() {
assertTrue(this.cnd.addNamespaceMapping(this.namespaceMapping));
Modified: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/Constants.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/Constants.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/Constants.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -16,6 +16,7 @@
import org.jboss.tools.modeshape.jcr.QualifiedName;
import org.jboss.tools.modeshape.jcr.attributes.Abstract;
import org.jboss.tools.modeshape.jcr.attributes.AttributeState;
+import org.jboss.tools.modeshape.jcr.attributes.AttributeState.Value;
import org.jboss.tools.modeshape.jcr.attributes.Autocreated;
import org.jboss.tools.modeshape.jcr.attributes.DefaultType;
import org.jboss.tools.modeshape.jcr.attributes.DefaultValues;
@@ -29,12 +30,11 @@
import org.jboss.tools.modeshape.jcr.attributes.PropertyValue;
import org.jboss.tools.modeshape.jcr.attributes.Protected;
import org.jboss.tools.modeshape.jcr.attributes.QueryOperators;
+import org.jboss.tools.modeshape.jcr.attributes.QueryOperators.QueryOperator;
import org.jboss.tools.modeshape.jcr.attributes.RequiredTypes;
import org.jboss.tools.modeshape.jcr.attributes.SameNameSiblings;
import org.jboss.tools.modeshape.jcr.attributes.SuperTypes;
import org.jboss.tools.modeshape.jcr.attributes.ValueConstraints;
-import org.jboss.tools.modeshape.jcr.attributes.AttributeState.Value;
-import org.jboss.tools.modeshape.jcr.attributes.QueryOperators.QueryOperator;
import org.jboss.tools.modeshape.jcr.cnd.CndElement.NotationType;
import org.jboss.tools.modeshape.jcr.cnd.CndNotationPreferences.Preference;
@@ -310,4 +310,35 @@
new PropertyValue(PropertyType.STRING, ITEM_TWO), new PropertyValue(PropertyType.STRING, ITEM_THREE) };
}
}
+
+ /**
+ * The built-in namespace mappings.
+ */
+ public interface BuiltInNamespaces {
+
+ /**
+ * Reserved for items defined within built-in node types.
+ */
+ NamespaceMapping JCR = new NamespaceMapping("jcr", "http://www.jcp.org/jcr/1.0"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * Reserved for the names of built-in mixin node types.
+ */
+ NamespaceMapping MIX = new NamespaceMapping("mix", "http://www.jcp.org/jcr/mix/1.0"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * Reserved for the names of built-in primary node types.
+ */
+ NamespaceMapping NT = new NamespaceMapping("nt", "http://www.jcp.org/jcr/nt/1.0"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * Reserved for reasons of compatibility with XML.
+ */
+ NamespaceMapping XML = new NamespaceMapping("xml", "http://www.w3.org/XML/1998/namespace"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * A collection of all built-in namespace mappings.
+ */
+ NamespaceMapping[] ALL_BUILT_INS = new NamespaceMapping[] { JCR, NT, MIX, XML };
+ }
}
Added: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/WorkspaceRegistryTest.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/WorkspaceRegistryTest.java (rev 0)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/WorkspaceRegistryTest.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ *
+ * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
+ *
+ * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
+ */
+package org.jboss.tools.modeshape.jcr.cnd;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.jboss.tools.modeshape.jcr.PropertyDefinition;
+import org.jboss.tools.modeshape.jcr.WorkspaceRegistry;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class WorkspaceRegistryTest {
+
+ private WorkspaceRegistry registry;
+
+ @Before
+ public void beforeEach() throws Exception {
+ this.registry = WorkspaceRegistry.get();
+ }
+
+ @Test
+ public void jcrNamespaceShouldBeRegistered() {
+ assertNotNull(this.registry.getNamespaceMapping(Constants.BuiltInNamespaces.JCR.getPrefix()));
+ assertEquals(Constants.BuiltInNamespaces.JCR.getPrefix(), this.registry.getPrefix(Constants.BuiltInNamespaces.JCR.getUri()));
+ assertEquals(Constants.BuiltInNamespaces.JCR.getUri(), this.registry.getUri(Constants.BuiltInNamespaces.JCR.getPrefix()));
+ }
+
+ @Test
+ public void mixNamespaceShouldBeRegistered() {
+ assertNotNull(this.registry.getNamespaceMapping(Constants.BuiltInNamespaces.MIX.getPrefix()));
+ assertEquals(Constants.BuiltInNamespaces.MIX.getPrefix(), this.registry.getPrefix(Constants.BuiltInNamespaces.MIX.getUri()));
+ assertEquals(Constants.BuiltInNamespaces.MIX.getUri(), this.registry.getUri(Constants.BuiltInNamespaces.MIX.getPrefix()));
+ }
+
+ @Test
+ public void ntNamespaceShouldBeRegistered() {
+ assertNotNull(this.registry.getNamespaceMapping(Constants.BuiltInNamespaces.NT.getPrefix()));
+ assertEquals(Constants.BuiltInNamespaces.NT.getPrefix(), this.registry.getPrefix(Constants.BuiltInNamespaces.NT.getUri()));
+ assertEquals(Constants.BuiltInNamespaces.NT.getUri(), this.registry.getUri(Constants.BuiltInNamespaces.NT.getPrefix()));
+ }
+
+ @Test
+ public void shouldGetInheriteProperties() {
+ final Collection<PropertyDefinition> properties = this.registry.getPropertyDefinitions("nt:resource", true); //$NON-NLS-1$
+ assertEquals(5, properties.size());
+
+ final Collection<String> names = new ArrayList<String>(5);
+ names.add("jcr:mimeType"); //$NON-NLS-1$
+ names.add("jcr:encoding"); //$NON-NLS-1$
+ names.add("jcr:lastModified"); //$NON-NLS-1$
+ names.add("jcr:lastModifiedBy"); //$NON-NLS-1$
+ names.add("jcr:data"); //$NON-NLS-1$
+
+ for (final PropertyDefinition propDefn : properties) {
+ if (names.contains(propDefn.getName())) {
+ names.remove(propDefn.getName());
+ } else {
+ fail();
+ }
+ }
+
+ assertTrue(names.isEmpty());
+ }
+
+ @Test
+ public void shouldHaveRegisteredNodeTypes() throws Exception {
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:base")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:unstructured")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("mix:created")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:hierarchyNode")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:file")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:linkedFile")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:folder")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("mix:referenceable")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("mix:mimeType")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("mix:lastModified")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:resource")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:nodeType")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:propertyDefinition")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:childNodeDefinition")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:versionHistory")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:versionLabels")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:version")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:frozenNode")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:versionedChild")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:query")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:activity")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("mix:simpleVersionable")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("mix:versionable")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:configuration")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:address")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("nt:naturalText")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("mix:etag")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("mix:lockable")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("mix:lifecycle")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("mix:managedRetention")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("mix:shareable")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("mix:title")); //$NON-NLS-1$
+ assertNotNull(this.registry.getNodeTypeDefinition("mix:language")); //$NON-NLS-1$
+ }
+
+ @Test
+ public void shouldNotGetInheriteProperties() {
+ final Collection<PropertyDefinition> properties = this.registry.getPropertyDefinitions("nt:resource", false); //$NON-NLS-1$
+ assertEquals(1, properties.size());
+ assertEquals("jcr:data", properties.iterator().next().getName()); //$NON-NLS-1$
+ }
+}
Property changes on: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/cnd/WorkspaceRegistryTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/test/AllTests.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/test/AllTests.java 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/src/org/jboss/tools/modeshape/jcr/test/AllTests.java 2012-04-03 17:25:43 UTC (rev 40012)
@@ -14,8 +14,10 @@
import org.jboss.tools.modeshape.jcr.cnd.CompactNodeTypeDefinitionTest;
import org.jboss.tools.modeshape.jcr.cnd.LocalNameTest;
import org.jboss.tools.modeshape.jcr.cnd.NamespaceMappingTest;
+import org.jboss.tools.modeshape.jcr.cnd.NodeTypeDefinitionTest;
import org.jboss.tools.modeshape.jcr.cnd.PropertyDefinitionTest;
import org.jboss.tools.modeshape.jcr.cnd.QualifiedNameTest;
+import org.jboss.tools.modeshape.jcr.cnd.WorkspaceRegistryTest;
import org.jboss.tools.modeshape.jcr.cnd.attributes.AbstractTest;
import org.jboss.tools.modeshape.jcr.cnd.attributes.AutocreatedTest;
import org.jboss.tools.modeshape.jcr.cnd.attributes.DefaultTypeTest;
@@ -45,13 +47,40 @@
*
*/
@RunWith(Suite.class)
-(a)Suite.SuiteClasses({ ChildNodeDefinitionTest.class, CndImporterTest.class, CndTokenizerTest.class, CndValidatorTest.class,
- CompactNodeTypeDefinitionTest.class, LocalNameTest.class, NamespaceMappingTest.class, PropertyDefinitionTest.class,
- QualifiedNameTest.class, AbstractTest.class, AutocreatedTest.class, DefaultTypeTest.class, DefaultValuesTest.class,
- MandatoryTest.class, MixinTest.class, MultipleTest.class, NodeAttributesTest.class, NodeTypeAttributesTest.class,
- NoFullTextTest.class, NoQueryOrderTest.class, OnParentValueTest.class, OrderableTest.class, PrimaryItemTest.class,
- PropertyAttributesTest.class, ProtectedTest.class, QueryableTest.class, QueryOperatorsTest.class, RequiredTypesTest.class,
- SameNameSiblingsTest.class, SuperTypesTest.class, ValueConstraintsTest.class })
+(a)Suite.SuiteClasses({
+ ChildNodeDefinitionTest.class,
+ CndImporterTest.class,
+ CndTokenizerTest.class,
+ CndValidatorTest.class,
+ CompactNodeTypeDefinitionTest.class,
+ LocalNameTest.class,
+ NamespaceMappingTest.class,
+ NodeTypeDefinitionTest.class,
+ PropertyDefinitionTest.class,
+ QualifiedNameTest.class,
+ WorkspaceRegistryTest.class,
+ AbstractTest.class,
+ AutocreatedTest.class,
+ DefaultTypeTest.class,
+ DefaultValuesTest.class,
+ MandatoryTest.class,
+ MixinTest.class,
+ MultipleTest.class,
+ NodeAttributesTest.class,
+ NodeTypeAttributesTest.class,
+ NoFullTextTest.class,
+ NoQueryOrderTest.class,
+ OnParentValueTest.class,
+ OrderableTest.class,
+ PrimaryItemTest.class,
+ PropertyAttributesTest.class,
+ ProtectedTest.class,
+ QueryableTest.class,
+ QueryOperatorsTest.class,
+ RequiredTypesTest.class,
+ SameNameSiblingsTest.class,
+ SuperTypesTest.class,
+ ValueConstraintsTest.class })
public class AllTests {
// nothing to do
}
Deleted: trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/testdata/jsr_283_builtins.cnd
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/testdata/jsr_283_builtins.cnd 2012-04-03 14:26:17 UTC (rev 40011)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.jcr.test/testdata/jsr_283_builtins.cnd 2012-04-03 17:25:43 UTC (rev 40012)
@@ -1,183 +0,0 @@
-<jcr='http://www.jcp.org/jcr/1.0'>
-<nt='http://www.jcp.org/jcr/nt/1.0'>
-<mix='http://www.jcp.org/jcr/mix/1.0'>
-
-// ------------------------------------------------------------------------
-// Pre-defined Node Types
-// ------------------------------------------------------------------------
-
-[nt:base] abstract
- - jcr:primaryType (name) mandatory autocreated
- protected compute
- - jcr:mixinTypes (name) protected multiple compute
-
-[nt:unstructured]
- orderable
- - * (undefined) multiple
- - * (undefined)
- + * (nt:base) = nt:unstructured sns version
-
-[mix:created] mixin
- - jcr:created (date) protected
- - jcr:createdBy (string) protected
-
-[nt:hierarchyNode] > mix:created abstract
-
-[nt:file] > nt:hierarchyNode
- + jcr:content (nt:base) primary mandatory
-
-[nt:linkedFile] > nt:hierarchyNode
- - jcr:content (reference) primary mandatory
-
-[nt:folder] > nt:hierarchyNode
- + * (nt:hierarchyNode) version
-
-[mix:referenceable] mixin
- - jcr:uuid (string) mandatory autocreated protected initialize
-
-[mix:mimeType] mixin
- - jcr:mimeType (string)
- - jcr:encoding (string)
-
-[mix:lastModified] mixin
- - jcr:lastModified (date)
- - jcr:lastModifiedBy (string)
-
-[nt:resource] > mix:mimeType, mix:lastModified
- - jcr:data (binary) primary mandatory
-
-[nt:nodeType]
- - jcr:nodeTypeName (name) mandatory protected copy
- - jcr:supertypes (name) multiple protected copy
- - jcr:isAbstract (boolean) mandatory protected copy
- - jcr:isMixin (boolean) mandatory protected copy
- - jcr:isQueryable (boolean) mandatory protected copy
- - jcr:hasOrderableChildNodes (boolean) mandatory protected copy
- - jcr:primaryItemName (name) protected copy
- + jcr:propertyDefinition (nt:propertyDefinition) = nt:propertyDefinition sns protected copy
- + jcr:childNodeDefinition (nt:childNodeDefinition) = nt:childNodeDefinition sns protected copy
-
-[nt:propertyDefinition]
- - jcr:name (name) protected
- - jcr:autoCreated (boolean) mandatory protected
- - jcr:mandatory (boolean) mandatory protected
- - jcr:isFullTextSearchable (boolean) mandatory protected
- - jcr:isQueryOrderable (boolean) mandatory protected
- - jcr:onParentVersion (string) mandatory protected
- < 'COPY', 'VERSION', 'INITIALIZE', 'COMPUTE',
- 'IGNORE', 'ABORT'
- - jcr:protected (boolean) mandatory protected
- - jcr:requiredType (string) mandatory protected
- < 'STRING', 'URI', 'BINARY', 'LONG', 'DOUBLE', 'DECIMAL', 'BOOLEAN',
- 'DATE', 'NAME', 'PATH', 'REFERENCE', 'WEAKREFERENCE', 'UNDEFINED'
- - jcr:valueConstraints (string) multiple protected
- - jcr:availableQueryOperators (name) mandatory multiple protected
- - jcr:defaultValues (undefined) multiple protected
- - jcr:multiple (boolean) mandatory protected
-
-[nt:childNodeDefinition]
- - jcr:name (name) protected
- - jcr:autoCreated (boolean) mandatory protected
- - jcr:mandatory (boolean) mandatory protected
- - jcr:onParentVersion (string) mandatory protected
- < 'COPY', 'VERSION', 'INITIALIZE', 'COMPUTE',
- 'IGNORE', 'ABORT'
- - jcr:protected (boolean) mandatory protected
- - jcr:requiredPrimaryTypes (name) = 'nt:base' mandatory protected multiple
- - jcr:defaultPrimaryType (name) protected
- - jcr:sameNameSiblings (boolean) mandatory protected
-
-[nt:versionHistory] > mix:referenceable
- - jcr:versionableUuid (string) mandatory autocreated protected abort
- - jcr:copiedFrom (weakreference) protected abort < 'nt:version'
- + jcr:rootVersion (nt:version) = nt:version mandatory autocreated protected abort
- + jcr:versionLabels (nt:versionLabels) = nt:versionLabels mandatory autocreated protected abort
- + * (nt:version) = nt:version protected abort
-
-
-[nt:versionLabels]
- - * (reference) protected abort < 'nt:version'
-
-[nt:version] > mix:referenceable
- - jcr:created (date) mandatory autocreated protected abort
- - jcr:predecessors (reference) protected multiple abort < 'nt:version'
- - jcr:successors (reference) protected multiple abort < 'nt:version'
- - jcr:activity (reference) protected abort < 'nt:activity'
- + jcr:frozenNode (nt:frozenNode) protected abort
-
-[nt:frozenNode] > mix:referenceable
- orderable
- - jcr:frozenPrimaryType (name) mandatory autocreated protected abort
- - jcr:frozenMixinTypes (name) protected multiple abort
- - jcr:frozenUuid (string) mandatory autocreated protected abort
- - * (undefined) protected abort
- - * (undefined) protected multiple abort
- + * (nt:base) protected sns abort
-
-[nt:versionedChild]
- - jcr:childVersionHistory (reference) mandatory autocreated protected abort < 'nt:versionHistory'
-
-[nt:query]
- - jcr:statement (string)
- - jcr:language (string)
-
-[nt:activity] > mix:referenceable
- - jcr:activityTitle (string) mandatory autocreated protected
-
-
-[mix:simpleVersionable] mixin
- - jcr:isCheckedOut (boolean) = 'true' mandatory autocreated protected ignore
-
-[mix:versionable] > mix:simpleVersionable, mix:referenceable mixin
- - jcr:versionHistory (reference) mandatory protected ignore < 'nt:versionHistory'
- - jcr:baseVersion (reference) mandatory protected ignore < 'nt:version'
- - jcr:predecessors (reference) mandatory protected multiple ignore < 'nt:version'
- - jcr:mergeFailed (reference) protected multiple abort
- - jcr:activity (reference) protected < 'nt:version'
- - jcr:configuration (reference) protected ignore < 'nt:configuration'
-
-[nt:configuration] > mix:versionable
- - jcr:root (reference) mandatory autocreated protected
-
-[nt:address]
- - jcr:protocol (string)
- - jcr:host (string)
- - jcr:port (string)
- - jcr:repository (string)
- - jcr:workspace (string)
- - jcr:path (path)
- - jcr:id (weakreference)
-
-[nt:naturalText]
- - jcr:text (string)
- - jcr:messageId (string)
-
-
-// ------------------------------------------------------------------------
-// Pre-defined Mixins
-// ------------------------------------------------------------------------
-
-[mix:etag] mixin
- - jcr:etag (string) protected autocreated
-
-[mix:lockable] mixin
- - jcr:lockOwner (string) protected ignore
- - jcr:lockIsDeep (boolean) protected ignore
-
-[mix:lifecycle] mixin
- - jcr:lifecyclePolicy (reference) protected initialize
- - jcr:currentLifecycleState (string) protected initialize
-
-[mix:managedRetention] > mix:referenceable mixin
- - jcr:hold (string) protected multiple
- - jcr:isDeep (boolean) protected multiple
- - jcr:retentionPolicy (reference) protected
-
-[mix:shareable] > mix:referenceable mixin
-
-[mix:title] mixin
- - jcr:title (string)
- - jcr:description (string)
-
-[mix:language] mixin
- - jcr:language (string)
13 years, 8 months
JBoss Tools SVN: r40011 - in trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test: src/org/jboss/tools/hb/ui/bot/common and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-04-03 10:26:17 -0400 (Tue, 03 Apr 2012)
New Revision: 40011
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/JPAEntity.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAEntityTest.java
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/.classpath
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JPASuite.java
Log:
Initial version of JPA Create Entity Test added into hb ui bot tests
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/.classpath
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/.classpath 2012-04-03 14:24:19 UTC (rev 40010)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/.classpath 2012-04-03 14:26:17 UTC (rev 40011)
@@ -6,5 +6,13 @@
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
+ <classpathentry kind="lib" path="/hibernatelib/hibernate35/antlr-2.7.6.jar"/>
+ <classpathentry kind="lib" path="/hibernatelib/hibernate35/commons-collections-3.1.jar"/>
+ <classpathentry kind="lib" path="/hibernatelib/hibernate35/dom4j-1.6.1.jar"/>
+ <classpathentry kind="lib" path="/hibernatelib/hibernate35/hibernate3.jar"/>
+ <classpathentry kind="lib" path="/hibernatelib/hibernate35/javassist-3.9.0.GA.jar"/>
+ <classpathentry kind="lib" path="/hibernatelib/hibernate35/jta-1.1.jar"/>
+ <classpathentry kind="lib" path="/hibernatelib/hibernate35/slf4j-api-1.5.8.jar"/>
+ <classpathentry kind="lib" path="/hibernatelib/jpa2/javax.persistence_2.0.0.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/JPAEntity.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/JPAEntity.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/JPAEntity.java 2012-04-03 14:26:17 UTC (rev 40011)
@@ -0,0 +1,30 @@
+package org.jboss.tools.hb.ui.bot.common;
+
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses;
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTOpenExt;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+
+/*
+ * JPA entity bot common class
+ */
+public class JPAEntity {
+
+ static SWTBotExt bot = new SWTBotExt();
+ static SWTOpenExt open = new SWTOpenExt(bot);
+
+ public static void create(String packageName, String entityName) {
+ SWTBot bot = open.newObject(ActionItem.NewObject.JPAEntity.LABEL);
+ String title = "New JPA Entity";
+ bot.waitUntil(shellIsActive(title));
+ SWTBotShell shell = bot.shell(title);
+ bot.textWithLabel("Java package:").setText(packageName);
+ bot.textWithLabel("Class name:").setText(entityName);
+ bot.button("Finish").click();
+ bot.waitUntil(shellCloses(shell));
+ }
+}
Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/JPAEntity.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JPASuite.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JPASuite.java 2012-04-03 14:24:19 UTC (rev 40010)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JPASuite.java 2012-04-03 14:26:17 UTC (rev 40011)
@@ -1,13 +1,14 @@
package org.jboss.tools.hb.ui.bot.suite;
-import org.jboss.tools.hb.ui.bot.test.jpa.EditPersistenceXMLTest;
+import org.jboss.tools.hb.ui.bot.test.jpa.CreateJPAEntityTest;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(RequirementAwareSuite.class)
//(a)SuiteClasses({CreateJPAProjectTest.class})
-(a)SuiteClasses({EditPersistenceXMLTest.class})
+//(a)SuiteClasses({EditPersistenceXMLTest.class})
+(a)SuiteClasses({CreateJPAEntityTest.class})
public class JPASuite {
}
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAEntityTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAEntityTest.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAEntityTest.java 2012-04-03 14:26:17 UTC (rev 40011)
@@ -0,0 +1,52 @@
+package org.jboss.tools.hb.ui.bot.test.jpa;
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.jboss.tools.hb.ui.bot.common.JPAEntity;
+import org.jboss.tools.hb.ui.bot.common.Tree;
+import org.jboss.tools.hb.ui.bot.test.HibernateBaseTest;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.helper.StringHelper;
+import org.junit.Test;
+
+/**
+ * Create JPA Entity ui bot test
+ */
+public class CreateJPAEntityTest extends HibernateBaseTest {
+
+ final String prj = "jpatest35";
+ final String pkg = "org.newentity";
+ final String ent = "NewEntity";
+ final String ext = ".java";
+
+ @Test
+ public void createJPAProject() {
+ emptyErrorLog();
+ importTestProject("/resources/prj/" + prj);
+ importTestProject("/resources/prj/" + "hibernatelib");
+ createJPAEntity();
+ addIdIntoEntity();
+ checkErrorLog();
+ }
+
+ private void addIdIntoEntity() {
+ SWTBotEditor editor = bot.editorByTitle(ent + ext);
+ StringHelper sh = new StringHelper(editor.toTextEditor().getText());
+ Point p = sh.getPositionBefore("private static final long serialVersionUID");
+ editor.toTextEditor().selectRange(p.y, p.x, 0);
+ editor.toTextEditor().insertText("@Id\nprivate long id;\n");
+ editor.save();
+ editor.toTextEditor().selectRange(0, 0, editor.toTextEditor().getText().length());
+ bot.menu("Source").menu("Format").click();
+ editor.toTextEditor().selectRange(0, 0, 0);
+ editor.save();
+ }
+
+ private void createJPAEntity() {
+ SWTBotView view = open.viewOpen(ActionItem.View.GeneralProjectExplorer.LABEL);
+ Tree.select(view.bot(), prj);
+ JPAEntity.create(pkg,ent);
+ Tree.open(view.bot(),prj,"src", pkg,ent + ext);
+ }
+}
Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAEntityTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 8 months