JBoss Tools SVN: r36163 - trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-11-03 18:35:24 -0400 (Thu, 03 Nov 2011)
New Revision: 36163
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/WebWithModuleTest.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/JsfKbAllTests.java
Log:
JBIDE-10103
https://issues.jboss.org/browse/JBIDE-10103
Loaded composite components from Java source folders.
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/JsfKbAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/JsfKbAllTests.java 2011-11-03 21:04:41 UTC (rev 36162)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/JsfKbAllTests.java 2011-11-03 22:35:24 UTC (rev 36163)
@@ -14,6 +14,7 @@
import junit.framework.TestSuite;
import org.jboss.tools.common.model.util.test.XProjectImportTestSetUp;
+import org.jboss.tools.jsf.kb.test.WebWithModuleTest;
import org.jboss.tools.test.util.ProjectImportTestSetup;
/**
@@ -22,6 +23,7 @@
public class JsfKbAllTests {
public static Test suite() {
+ TestSuite suiteAll = new TestSuite("JSF Core Tests");
TestSuite suite = new TestSuite(JsfKbAllTests.class.getName());
suite.addTestSuite(FaceletsKbModelTest.class);
suite.addTestSuite(KbModelTest.class);
@@ -29,6 +31,14 @@
"org.jboss.tools.jsf.test",
new String[]{"projects/TestKbModel"},
new String[]{"TestKbModel"});
+ suiteAll.addTest(testSetup);
+ suite = new TestSuite(WebWithModuleTest.class.getName());
+ suite.addTestSuite(WebWithModuleTest.class);
+ testSetup = new XProjectImportTestSetUp(suite,
+ "org.jboss.tools.jst.web.kb.test",
+ new String[]{"projects/utility", "projects/webapp"},
+ new String[]{"utility", "webapp"});
+ suiteAll.addTest(testSetup);
return testSetup;
}
}
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/WebWithModuleTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/WebWithModuleTest.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/WebWithModuleTest.java 2011-11-03 22:35:24 UTC (rev 36163)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.kb.test;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
+import org.jboss.tools.jst.web.kb.taglib.IComponent;
+import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class WebWithModuleTest extends TestCase {
+ protected IProject utility = null;
+ protected IProject webapp = null;
+
+ public WebWithModuleTest() {
+ super("MyFaces Kb Model Test");
+ }
+
+ public void setUp() throws Exception {
+ utility = ResourcesPlugin.getWorkspace().getRoot().getProject("utility");
+ assertNotNull("Can't load utility", utility); //$NON-NLS-1$
+ webapp = ResourcesPlugin.getWorkspace().getRoot().getProject("webapp");
+ assertNotNull("Can't load webapp", webapp); //$NON-NLS-1$
+ }
+
+ /**
+ * webapp project has kb nature, and depends on utility project without kb nature.
+ * In this case builder adds kb problem marker to 'webapp'
+ * and sets on 'utility' property '...mock' to 'true'..
+ *
+ * Check that file 'utility' has correct property '...mock'.
+ * Check that kb model of 'webapp' has tag library declared in sources of 'utility'.
+ *
+ * @throws CoreException
+ */
+ public void testWebProject() throws CoreException {
+ assertTrue("true".equals(utility.getPersistentProperty(KbProjectFactory.NATURE_MOCK)));
+
+ IKbProject kbUtility = KbProjectFactory.getKbProject(utility, true);
+ assertNotNull(kbUtility);
+ int w = 0;
+ while(kbUtility.getTagLibraries().length == 0 && w++ < 50) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+
+ IKbProject kb = KbProjectFactory.getKbProject(webapp, true);
+ ITagLibrary[] ls = kb.getTagLibraries("utility-lib");
+ assertTrue(ls.length > 0);
+ ls = kb.getTagLibraries("http://java.sun.com/jsf/composite/cc");
+ assertTrue(ls.length > 0);
+ IComponent c = ls[0].getComponent("inputText");
+ assertNotNull(c);
+ }
+
+}
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/WebWithModuleTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 1 month
JBoss Tools SVN: r36162 - in workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite: features and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-11-03 17:04:41 -0400 (Thu, 03 Nov 2011)
New Revision: 36162
Added:
workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/features/org.jboss.tools.maven.ee6.classpath.feature_1.0.1.201111032203.jar
workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/plugins/org.jboss.tools.maven.ee6.classpath.ui_1.0.1.201111032203.jar
workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/plugins/org.jboss.tools.maven.ee6.classpath_1.0.1.201111032203.jar
Removed:
workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/features/org.jboss.tools.maven.ee6.classpath.feature_1.0.1.201111011649.jar
workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/plugins/org.jboss.tools.maven.ee6.classpath.ui_1.0.1.201111011649.jar
workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/plugins/org.jboss.tools.maven.ee6.classpath_1.0.1.201111011649.jar
Modified:
workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/artifacts.jar
workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/content.jar
workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/site.xml
Log:
JBoss EE6 Classpath
Modified: workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/artifacts.jar
===================================================================
(Binary files differ)
Modified: workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/content.jar
===================================================================
(Binary files differ)
Deleted: workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/features/org.jboss.tools.maven.ee6.classpath.feature_1.0.1.201111011649.jar
===================================================================
(Binary files differ)
Added: workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/features/org.jboss.tools.maven.ee6.classpath.feature_1.0.1.201111032203.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/features/org.jboss.tools.maven.ee6.classpath.feature_1.0.1.201111032203.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Deleted: workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/plugins/org.jboss.tools.maven.ee6.classpath.ui_1.0.1.201111011649.jar
===================================================================
(Binary files differ)
Added: workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/plugins/org.jboss.tools.maven.ee6.classpath.ui_1.0.1.201111032203.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/plugins/org.jboss.tools.maven.ee6.classpath.ui_1.0.1.201111032203.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Deleted: workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/plugins/org.jboss.tools.maven.ee6.classpath_1.0.1.201111011649.jar
===================================================================
(Binary files differ)
Added: workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/plugins/org.jboss.tools.maven.ee6.classpath_1.0.1.201111032203.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/plugins/org.jboss.tools.maven.ee6.classpath_1.0.1.201111032203.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/site.xml
===================================================================
--- workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/site.xml 2011-11-03 16:57:25 UTC (rev 36161)
+++ workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/site.xml 2011-11-03 21:04:41 UTC (rev 36162)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
- <feature url="features/org.jboss.tools.maven.ee6.classpath.feature_1.0.1.201111011649.jar" id="org.jboss.tools.maven.ee6.classpath.feature" version="1.0.1.201111011649">
+ <feature url="features/org.jboss.tools.maven.ee6.classpath.feature_1.0.1.201111032203.jar" id="org.jboss.tools.maven.ee6.classpath.feature" version="1.0.1.201111032203">
<category name="org.jboss.tools.maven.ee6.classpath"/>
</feature>
<category-def name="org.jboss.tools.maven.ee6.classpath" label="EE6 Classpath Patch"/>
13 years, 1 month
JBoss Tools SVN: r36161 - trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-11-03 12:57:25 -0400 (Thu, 03 Nov 2011)
New Revision: 36161
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java
Log:
Quickfix and Wizard for fixing ambigious injection warning is confusing https://issues.jboss.org/browse/JBIDE-9940
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java 2011-11-03 12:52:28 UTC (rev 36160)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java 2011-11-03 16:57:25 UTC (rev 36161)
@@ -18,6 +18,7 @@
import java.util.HashSet;
import java.util.Iterator;
+import org.eclipse.core.internal.resources.Workspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
@@ -448,16 +449,14 @@
PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress(){
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
- monitor.beginTask(CDICoreMessages.CDI_UTIL_BUILD_CDI_MODEL, 10);
- monitor.worked(3);
-
- try {
+ Job autoBuildJob = null;
+ Job[] jobs = Job.getJobManager().find(ResourcesPlugin.FAMILY_AUTO_BUILD);
+ for(Job j : jobs){
+ autoBuildJob = j;
+ }
+ if(autoBuildJob != null && autoBuildJob.getState() == Job.RUNNING){
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
- } catch (InterruptedException e) {
- // do nothing
}
-
- monitor.worked(7);
}
});
}catch(InterruptedException ie){
13 years, 1 month
JBoss Tools SVN: r36160 - in branches/dead/hibernatetools-multiversion2/plugins: org.hibernate.eclipse/src/org/hibernate/console and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-11-03 08:52:28 -0400 (Thu, 03 Nov 2011)
New Revision: 36160
Added:
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor2.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/CompletionProposalsResult.java
Modified:
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLSourceViewerConfiguration.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HQLQueryPage.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HibernateExtension.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HibernateExtensionDefinition.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/JavaPage.java
Log:
https://issues.jboss.org/browse/JBIDE-10098
Use appropriate Hibernate tools jar for code completion in multihibernate support plugins
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF 2011-11-03 12:52:16 UTC (rev 36159)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF 2011-11-03 12:52:28 UTC (rev 36160)
@@ -21,7 +21,8 @@
org.eclipse.ui.console,
org.eclipse.jface,
org.eclipse.jdt.apt.core,
- org.eclipse.datatools.connectivity
+ org.eclipse.datatools.connectivity,
+ org.eclipse.jface.text;bundle-version="3.7.0"
Bundle-ActivationPolicy: lazy
Eclipse-BuddyPolicy: registered
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2011-11-03 12:52:16 UTC (rev 36159)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2011-11-03 12:52:28 UTC (rev 36160)
@@ -35,7 +35,6 @@
import java.util.Map;
import org.eclipse.osgi.util.NLS;
-import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
@@ -68,11 +67,6 @@
private HibernateExtension extension;
- //TODO do we need to create new instance every time???
- public HibernateExtension getConsoleConfigurationExtension(){
- return extension;
- }
-
private void loadHibernateExtension(){
String version = hibernateVersion == null ? "3.5" : hibernateVersion;//3.5 is a default version
HibernateExtensionDefinition def = ExtensionManager.findHibernateExtensionDefinition(version);
@@ -85,7 +79,7 @@
}
}
- private void setHibernateVersion(String hibernateVersion){
+ private void updateHibernateVersion(String hibernateVersion){
if (!StringUtils.equals(this.hibernateVersion, hibernateVersion)){
this.hibernateVersion = hibernateVersion;
loadHibernateExtension();
@@ -93,9 +87,10 @@
}
public HibernateExtension getHibernateExtension(){
+ updateHibernateVersion(prefs.getHibernateVersion());//reinit is necessary
return this.extension;
}
-
+
//****************************** EXTENSION **********************
public ConsoleConfiguration(ConsoleConfigurationPreferences config) {
@@ -209,7 +204,6 @@
public void build() {
configuration = buildWith(null, true);
- setHibernateVersion(prefs.getHibernateVersion());
getHibernateExtension().build();
fireConfigurationBuilt();
}
Added: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/CompletionProposalsResult.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/CompletionProposalsResult.java (rev 0)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/CompletionProposalsResult.java 2011-11-03 12:52:28 UTC (rev 36160)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.console.ext;
+
+import java.util.List;
+
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class CompletionProposalsResult {
+
+ private final List<ICompletionProposal> result;
+
+ private final String errorMessage;
+
+ public CompletionProposalsResult(List<ICompletionProposal> result, String errorMessage){
+ this.result = result;
+ this.errorMessage = errorMessage;
+ }
+
+ public List<ICompletionProposal> getCompletionProposals() {
+ return result;
+ }
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+}
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HQLQueryPage.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HQLQueryPage.java 2011-11-03 12:52:16 UTC (rev 36159)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HQLQueryPage.java 2011-11-03 12:52:28 UTC (rev 36160)
@@ -43,7 +43,7 @@
private void updateQueryResults(){
try {
list = new ArrayList<Object>();
- queryResult = getConsoleConfiguration().getConsoleConfigurationExtension()
+ queryResult = getConsoleConfiguration().getHibernateExtension()
.executeHQLQuery(queryString, model);
if (!queryResult.hasExceptions()){
Iterator<?> iter = queryResult.list().iterator(); // need to be user-controllable to toggle between iterate, scroll etc.
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HibernateExtension.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HibernateExtension.java 2011-11-03 12:52:16 UTC (rev 36159)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HibernateExtension.java 2011-11-03 12:52:28 UTC (rev 36160)
@@ -44,7 +44,7 @@
public Object getSessionFactory();
//FIXME remove this method
*/
-
+ public CompletionProposalsResult hqlCodeComplete(String query, int position);
}
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HibernateExtensionDefinition.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HibernateExtensionDefinition.java 2011-11-03 12:52:16 UTC (rev 36159)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HibernateExtensionDefinition.java 2011-11-03 12:52:28 UTC (rev 36160)
@@ -44,27 +44,15 @@
public HibernateExtension createHibernateExtensionInstance() {
HibernateExtension hiberanteExtension = null;
- try {
- // hiberanteExtension = (HibernateExtension) ReflectHelper.classForName( classname ).newInstance();
- hiberanteExtension = (HibernateExtension) element.createExecutableExtension(CLASSNAME);
- }
- /* catch (InstantiationException e) {
- throw new HibernateConsoleRuntimeException(NLS.bind(
- "Problem while creating hibernate extension instance {0}", classname));
- }
- catch (IllegalAccessException e) {
- throw new HibernateConsoleRuntimeException(NLS.bind(
- "Problem while creating hibernate extension instance {0}", classname)); }
- catch (ClassNotFoundException e) {
- throw new HibernateConsoleRuntimeException(NLS.bind(
- "Problem while creating hibernate extension instance {0}", classname));
- } */catch (CoreException e) {
- // TODO Auto-generated catch block
+ try {
+ hiberanteExtension = (HibernateExtension) element
+ .createExecutableExtension(CLASSNAME);
+ } catch (CoreException e) {
e.printStackTrace();
}
- return hiberanteExtension;
- }
+ return hiberanteExtension;
+ }
/**
* @return the hibernateVersion
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/JavaPage.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/JavaPage.java 2011-11-03 12:52:16 UTC (rev 36159)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/JavaPage.java 2011-11-03 12:52:28 UTC (rev 36160)
@@ -51,7 +51,7 @@
private void updateQueryResults(){
try {
list = new ArrayList<Object>();
- queryResult = getConsoleConfiguration().getConsoleConfigurationExtension()
+ queryResult = getConsoleConfiguration().getHibernateExtension()
.executeCriteriaQuery(criteriaCode, model);
if (!queryResult.hasExceptions()){
Iterator<?> iter = queryResult.list().iterator(); // need to be user-controllable to toggle between iterate, scroll etc.
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java 2011-11-03 12:52:16 UTC (rev 36159)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java 2011-11-03 12:52:28 UTC (rev 36160)
@@ -110,13 +110,13 @@
return getLazyDatabaseSchema(o).getConsoleConfiguration();
}
- protected DefaultDatabaseCollector readDatabaseSchema(final IProgressMonitor monitor, ConsoleConfiguration consoleConfiguration, final ReverseEngineeringStrategy strategy) {
+ protected DefaultDatabaseCollector readDatabaseSchema(final IProgressMonitor monitor, final ConsoleConfiguration consoleConfiguration, final ReverseEngineeringStrategy strategy) {
final Configuration configuration = consoleConfiguration.buildWith(null, false);
return (DefaultDatabaseCollector) consoleConfiguration.execute(new ExecutionContext.Command() {
public Object execute() {
DefaultDatabaseCollector db = null;
- Settings settings = configuration.buildSettings();
+ Settings settings = consoleConfiguration.getSettings(configuration);
ConnectionProvider connectionProvider = null;
try {
connectionProvider = settings.getConnectionProvider();
Added: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor2.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor2.java (rev 0)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor2.java 2011-11-03 12:52:28 UTC (rev 36160)
@@ -0,0 +1,186 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.hibernate.eclipse.hqleditor;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.ext.CompletionProposalsResult;
+import org.hibernate.eclipse.console.HibernateConsoleMessages;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.eclipse.console.QueryEditor;
+
+/**
+ * content assist processor for HQL code.
+ */
+public class HQLCompletionProcessor2 implements IContentAssistProcessor {
+
+ private char[] autoActivationChars = { '.' };
+ protected IContextInformationValidator validator = new MinimalDiffContextInformationValidator(5);
+ private final Comparator<ICompletionProposal> completionComparator;
+ //private final HQLEditor editor;
+ private QueryEditor hqlEditor;
+ private String errorMessage;
+
+ public HQLCompletionProcessor2(QueryEditor editor) {
+ super();
+ this.hqlEditor = editor;
+ completionComparator = DisplayStringProposalComparator.INSTANCE;
+ }
+
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
+ IDocument doc = viewer.getDocument();
+ return computeCompletionProposals(doc, documentOffset);
+ }
+
+ public ICompletionProposal[] computeCompletionProposals(IDocument doc, int documentOffset) {
+ ICompletionProposal[] result = new ICompletionProposal[0];
+
+ try {
+ ITypedRegion partition = null;
+
+ if (documentOffset > 0) {
+ partition = doc.getPartition( documentOffset - 1 );
+ }
+ else {
+ partition = doc.getPartition( documentOffset );
+ }
+
+ if(partition!=null) {
+ result = computeProposals( doc, partition.getOffset(), documentOffset, hqlEditor.getConsoleConfiguration() );
+ }
+ }
+ catch (BadLocationException x) {
+ }
+ catch (RuntimeException re) {
+ HibernateConsolePlugin.getDefault().logErrorMessage( HibernateConsoleMessages.HQLCompletionProcessor_error_while_performing_hql_completion, re );
+ }
+
+ if (result != null)
+ result = sort( result );
+
+ return result;
+ }
+
+ ICompletionProposal[] computeProposals(IDocument doc, int lineStart, final int currentOffset, final ConsoleConfiguration consoleConfiguration) {
+ ICompletionProposal[] result = null;
+ errorMessage = null;
+ if (doc != null && currentOffset >= 0) {
+
+ List<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>();
+ String startWord = null;
+
+ int startOffset = findNearestWhiteSpace( doc, currentOffset, lineStart );
+
+ int wordLength = currentOffset - startOffset;
+ startWord = getWord( doc, startOffset, wordLength );
+
+ if(startWord!=null) {
+ try {
+ doc.get(0,doc.getLength()).toCharArray();
+ }
+ catch (BadLocationException e) {
+ errorMessage = HibernateConsoleMessages.HQLCompletionProcessor_could_not_get_document_contents;
+ return result;
+ }
+
+ if(consoleConfiguration != null) {
+ //EclipseHQLCompletionRequestor eclipseHQLCompletionCollector = new EclipseHQLCompletionRequestor();
+ CompletionProposalsResult codeCompletions = consoleConfiguration.getHibernateExtension().hqlCodeComplete(doc.get(), currentOffset);
+
+ proposalList.addAll(codeCompletions.getCompletionProposals());
+ errorMessage = codeCompletions.getErrorMessage();//eclipseHQLCompletionCollector.getLastErrorMessage();
+
+ result = proposalList.toArray(new ICompletionProposal[proposalList.size()]);
+ if(result.length==0 && errorMessage==null) {
+ errorMessage = HibernateConsoleMessages.HQLCompletionProcessor_no_hql_completions_available;
+ }
+ }
+ } else {
+ errorMessage = HibernateConsoleMessages.HQLCompletionProcessor_no_start_word_found;
+ }
+ }
+
+ return result;
+ }
+
+ private String getWord(IDocument doc, int startOffset, int wordLength) {
+ try {
+ return doc.get( startOffset, wordLength );
+ }
+ catch (BadLocationException e) {
+ return null; // no word found.
+ }
+ }
+
+
+ public IContextInformation[] computeContextInformation( ITextViewer viewer, int documentOffset ) { return null; }
+
+ public char[] getCompletionProposalAutoActivationCharacters() { return autoActivationChars; }
+
+ public char[] getContextInformationAutoActivationCharacters() { return null; }
+
+ public IContextInformationValidator getContextInformationValidator() { return validator; }
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ private ICompletionProposal[] sort( ICompletionProposal[] proposals ) {
+ Arrays.sort( proposals, completionComparator );
+ return proposals;
+ }
+
+ public int findNearestWhiteSpace( IDocument doc, int documentOffset, int offset ) {
+ boolean loop = true;
+
+ int tmpOffset = documentOffset - 1;
+ try {
+ while (loop && offset <= tmpOffset) {
+ char c = doc.getChar(tmpOffset);
+ if(c=='"' || Character.isWhitespace(c)) {
+ loop = false;
+ } else {
+ tmpOffset--;
+ }
+ }
+ }
+ catch (BadLocationException x) {
+ }
+
+ offset = tmpOffset + 1;
+
+ return offset;
+ }
+
+ }
\ No newline at end of file
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLSourceViewerConfiguration.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLSourceViewerConfiguration.java 2011-11-03 12:52:16 UTC (rev 36159)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLSourceViewerConfiguration.java 2011-11-03 12:52:28 UTC (rev 36160)
@@ -25,6 +25,7 @@
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.formatter.ContentFormatter;
import org.eclipse.jface.text.formatter.IContentFormatter;
@@ -42,7 +43,7 @@
public class HQLSourceViewerConfiguration extends SourceViewerConfiguration {
public final static String HQL_PARTITIONING= "__hql_partitioning"; //$NON-NLS-1$
- private HQLCompletionProcessor completionProcessor;
+ private IContentAssistProcessor completionProcessor;
//private HQLEditor hqlEditor;
private QueryEditor hqlEditor;
@@ -54,7 +55,7 @@
public HQLSourceViewerConfiguration(QueryEditor editor) {
this.hqlEditor = editor;
- completionProcessor = new HQLCompletionProcessor(editor);
+ completionProcessor = new HQLCompletionProcessor2(editor);
}
public String getConfiguredDocumentPartitioning( ISourceViewer sourceViewer ) {
@@ -66,7 +67,7 @@
assistant.setDocumentPartitioning( getConfiguredDocumentPartitioning( sourceViewer ));
- completionProcessor = new HQLCompletionProcessor(hqlEditor);
+ completionProcessor = new HQLCompletionProcessor2(hqlEditor);
assistant.setContentAssistProcessor( completionProcessor, IDocument.DEFAULT_CONTENT_TYPE);
assistant.enableAutoActivation( true );
13 years, 1 month
JBoss Tools SVN: r36159 - in branches/dead/hibernatetools-multiversion2/plugins: org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5 and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-11-03 08:52:16 -0400 (Thu, 03 Nov 2011)
New Revision: 36159
Added:
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/lib/tools/
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/lib/tools/hibernate-tools-3.5.0.Alpha.jar
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/CompletionProposal.java
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/EclipseHQLCompletionRequestor.java
Modified:
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/META-INF/MANIFEST.MF
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/.classpath
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/META-INF/MANIFEST.MF
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/build.properties
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HibernateExtension4_0.java
Log:
https://issues.jboss.org/browse/JBIDE-10098
Use appropriate Hibernate tools jar for code completion in multihibernate support plugins
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/META-INF/MANIFEST.MF
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/META-INF/MANIFEST.MF 2011-11-03 11:30:02 UTC (rev 36158)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/META-INF/MANIFEST.MF 2011-11-03 12:52:16 UTC (rev 36159)
@@ -7,6 +7,8 @@
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.hibernate.eclipse;bundle-version="3.4.0",
- org.hibernate.eclipse.libs;bundle-version="1.0.0"
+ org.hibernate.eclipse.libs;bundle-version="1.0.0",
+ org.eclipse.jface.text;bundle-version="3.7.0",
+ org.hibernate.eclipse.console;bundle-version="3.4.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java 2011-11-03 11:30:02 UTC (rev 36158)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java 2011-11-03 12:52:16 UTC (rev 36159)
@@ -26,13 +26,17 @@
import org.hibernate.console.execution.DefaultExecutionContext;
import org.hibernate.console.execution.ExecutionContext;
import org.hibernate.console.execution.ExecutionContext.Command;
+import org.hibernate.console.ext.CompletionProposalsResult;
import org.hibernate.console.ext.HibernateException;
import org.hibernate.console.ext.HibernateExtension;
import org.hibernate.console.ext.QueryResult;
import org.hibernate.console.ext.QueryResultImpl;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.console.preferences.PreferencesClassPathUtils;
+import org.hibernate.eclipse.hqleditor.EclipseHQLCompletionRequestor;
import org.hibernate.eclipse.libs.FakeDelegatingDriver;
+import org.hibernate.tool.ide.completion.HQLCodeAssist;
+import org.hibernate.tool.ide.completion.IHQLCodeAssist;
/**
*
@@ -255,5 +259,30 @@
// TODO Auto-generated method stub
return configuration != null;
}
-
+
+ @Override
+ public CompletionProposalsResult hqlCodeComplete(String query, int currentOffset) {
+ EclipseHQLCompletionRequestor requestor = new EclipseHQLCompletionRequestor();
+ if (!hasConfiguration()){
+ try {
+ build();
+ execute( new ExecutionContext.Command() {
+ public Object execute() {
+ if(hasConfiguration()) {
+ configuration.buildMappings();
+ }
+ return null;
+ }
+ });
+ } catch (HibernateException e){
+ //FIXME
+ //String mess = NLS.bind(HibernateConsoleMessages.CompletionHelper_error_could_not_build_cc, consoleConfiguration.getName());
+ //HibernateConsolePlugin.getDefault().logErrorMessage(mess, e);
+ }
+ }
+ IHQLCodeAssist hqlEval = new HQLCodeAssist(configuration);
+ query = query.replace('\t', ' ');
+ hqlEval.codeComplete(query, currentOffset, requestor);
+ return new CompletionProposalsResult(requestor.getCompletionProposals(), requestor.getLastErrorMessage());
+ }
}
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/.classpath
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/.classpath 2011-11-03 11:30:02 UTC (rev 36158)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/.classpath 2011-11-03 12:52:16 UTC (rev 36159)
@@ -30,5 +30,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="lib" path="lib/tools/hibernate-tools-3.5.0.Alpha.jar" sourcepath="C:/dev/workspaces/RedHat/_Git/dgeraskov/hibernate-tools/target/hibernate-tools-3.5.0.Alpha-SNAPSHOT-sources.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/META-INF/MANIFEST.MF
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/META-INF/MANIFEST.MF 2011-11-03 11:30:02 UTC (rev 36158)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/META-INF/MANIFEST.MF 2011-11-03 12:52:16 UTC (rev 36159)
@@ -7,7 +7,9 @@
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.hibernate.eclipse;bundle-version="3.4.0",
- org.eclipse.datatools.connectivity;bundle-version="1.2.2"
+ org.eclipse.datatools.connectivity;bundle-version="1.2.2",
+ org.hibernate.eclipse.console;bundle-version="3.4.0",
+ org.eclipse.jface.text;bundle-version="3.7.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: lib/required/jboss-logging-3.0.0.GA.jar,
@@ -25,4 +27,5 @@
lib/required/jta-1.1.jar,
lib/jpa/hibernate-entitymanager-4.0.0.CR3.jar,
lib/bsh-core-2.0b4.jar,
+ lib/tools/hibernate-tools-3.5.0.Alpha.jar,
.
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/build.properties
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/build.properties 2011-11-03 11:30:02 UTC (rev 36158)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/build.properties 2011-11-03 12:52:16 UTC (rev 36159)
@@ -29,4 +29,5 @@
lib/optional/infinispan/rhq-pluginAnnotations-3.0.1.jar,\
lib/optional/proxool/hibernate-proxool-4.0.0.CR3.jar,\
lib/optional/proxool/proxool-0.8.3.jar,\
- lib/bsh-core-2.0b4.jar
+ lib/bsh-core-2.0b4.jar,\
+ lib/tools/hibernate-tools-3.5.0.Alpha.jar
Added: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/lib/tools/hibernate-tools-3.5.0.Alpha.jar
===================================================================
(Binary files differ)
Property changes on: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/lib/tools/hibernate-tools-3.5.0.Alpha.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/CompletionProposal.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/CompletionProposal.java (rev 0)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/CompletionProposal.java 2011-11-03 12:52:16 UTC (rev 36159)
@@ -0,0 +1,279 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tools.hibernate4_0;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposalExtension;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+
+/**
+ * Generic completion proposal to be used as is, or as base for other completion proposals.
+ *
+ * @author Max Rydahl Andersen
+ *
+ */
+public class CompletionProposal implements ICompletionProposal, ICompletionProposalExtension {
+
+ private String displayString;
+ private String replacementString;
+ private int replacementOffset;
+ private int documentOffset = -1;
+ private int replacementLength;
+ private int cursorPosition;
+ private Image image;
+ private IContextInformation contextInformation;
+ private int contextInformationPosition;
+ private char[] triggerCharacters;
+ private String additionalProposalInfo;
+
+ /**
+ * Creates a new completion proposal. All fields are initialized based on
+ * the provided information.
+ *
+ * @param additionalInfo additional information about the completion proposal
+ * @param replacementString the actual string to be inserted into the document
+ * @param replacementOffset offset of the text to be replaced
+ * @param documentOffset offset of the document
+ * @param replacementLength length of the text to be replaced
+ * @param image the image to display for this proposal
+ * @param displayString the string to be displayed for the proposal If set
+ * to <code>null</code>, the replacement string will be taken
+ * as display string.
+ */
+ public CompletionProposal( String additionalInfo, String replacementString, int replacementOffset,
+ int documentOffset, int replacementLength, Image image, String displayString,
+ IContextInformation contextInformation ) {
+
+ this.replacementString = replacementString;
+ this.replacementOffset = replacementOffset;
+ this.documentOffset = documentOffset;
+ this.replacementLength = replacementLength;
+ this.image = image;
+ this.displayString = displayString != null ? displayString : replacementString;
+
+ this.cursorPosition = replacementString.length();
+
+ this.contextInformation = contextInformation;
+
+ this.triggerCharacters = null;
+ this.additionalProposalInfo = additionalInfo;
+ }
+
+ /**
+ * Creates a new completion proposal. All fields are initialized based on
+ * the provided information.
+ *
+ * @param replacementString the actual string to be inserted into the document
+ * @param replacementOffset the offset of the text to be replaced
+ * @param replacementLength the length of the text to be replaced
+ * @param cursorPosition the position of the cursor following the insert
+ * relative to replacementOffset
+ * @param image the image to display for this proposal
+ * @param displayString the string to be displayed for the proposal
+ * @param contentInformation the context information associated with this proposal
+ * @param additionalProposalInfo the additional information associated with
+ * this proposal
+ */
+ public CompletionProposal( String replacementString, int replacementOffset, int replacementLength,
+ int cursorPosition, Image image, String displayString, IContextInformation contextInformation,
+ String additionalProposalInfo ) {
+
+ this.replacementString = replacementString;
+ this.replacementOffset = replacementOffset;
+ this.documentOffset = replacementOffset;
+ this.replacementLength = replacementLength;
+ this.cursorPosition = cursorPosition;
+ this.image = image;
+ this.displayString = displayString;
+ this.contextInformation = contextInformation;
+ this.additionalProposalInfo = additionalProposalInfo;
+
+ }
+
+ public void setContextInformation( IContextInformation contextInformation ) {
+ this.contextInformation = contextInformation;
+ contextInformationPosition = (contextInformation != null ? cursorPosition : -1);
+ }
+
+ /**
+ * Sets the trigger characters.
+ *
+ * @param triggerCharacters The set of characters which can trigger the
+ * application of this completion proposal
+ */
+ public void setTriggerCharacters( char[] triggerCharacters ) {
+ this.triggerCharacters = triggerCharacters;
+ }
+
+ /**
+ * Sets the cursor position relative to the insertion offset. By default
+ * this is the length of the completion string (Cursor positioned after the
+ * completion)
+ *
+ * @param cursorPosition The cursorPosition to set
+ */
+ public void setCursorPosition( int cursorPosition ) {
+
+ if (cursorPosition >= 0) {
+ this.cursorPosition = cursorPosition;
+ this.contextInformationPosition = (contextInformation != null ? cursorPosition : -1);
+ }
+ }
+
+ public void apply( IDocument document, char trigger, int offset ) {
+ try {
+ // patch replacement length
+
+ int delta = offset - (documentOffset + replacementLength);
+ if (delta > 0)
+ replacementLength += delta;
+
+ if (trigger == (char) 0) {
+ replace( document, documentOffset, replacementLength, replacementString );
+ }
+ else {
+ StringBuffer buffer = new StringBuffer( replacementString );
+
+ if ((replacementLength < buffer.length() && buffer.charAt( replacementLength ) != trigger)) {
+ buffer.insert( cursorPosition, trigger );
+ ++cursorPosition;
+ }
+
+ replace( document, documentOffset, replacementLength, buffer.toString() );
+ }
+
+ int oldLen = document.getLength();
+ documentOffset += document.getLength() - oldLen;
+ }
+ catch (BadLocationException e) {
+ HibernateConsolePlugin.getDefault().log( e );
+ }
+ }
+
+ /**
+ * Replaces the document content at the specified offset and length with the
+ * specified string.
+ *
+ * @param document the document opened in the editor
+ * @param offset offset to the document content to be replaced
+ * @param length length of text to be replaced
+ * @param string replacement string
+ * @throws BadLocationException
+ */
+ private void replace( IDocument document, int offset, int length, String string ) throws BadLocationException {
+ if (document != null && string != null && offset >= 0 && length >= 0) {
+ if (!document.get( offset, length ).equals( string ))
+ document.replace( offset, length, string );
+ }
+ }
+
+ public void apply( IDocument document ) {
+ apply( document, (char) 0, documentOffset + replacementLength );
+ }
+
+ public Point getSelection( IDocument document ) {
+ return new Point( documentOffset + cursorPosition, 0 );
+ }
+
+ public IContextInformation getContextInformation() {
+ return contextInformation;
+ }
+
+ public Image getImage() {
+ return image;
+ }
+
+ public String getDisplayString() {
+ return displayString;
+ }
+
+ public String getAdditionalProposalInfo() {
+ return additionalProposalInfo;
+ }
+
+ public char[] getTriggerCharacters() {
+ return triggerCharacters;
+ }
+
+ public int getContextInformationPosition() {
+ return replacementOffset + contextInformationPosition;
+ }
+
+ public int getReplacementOffset() {
+ return replacementOffset;
+ }
+
+ public void setReplacementOffset( int replacementOffset ) {
+
+ if (replacementOffset >= 0) {
+ this.replacementOffset = replacementOffset;
+ }
+ }
+
+ public int getReplacementLength() {
+ return replacementLength;
+ }
+
+ public void setReplacementLength( int replacementLength ) {
+
+ if (replacementLength >= 0) {
+ this.replacementLength = replacementLength;
+ }
+ }
+
+ public String getReplacementString() {
+ return replacementString;
+ }
+
+ public void setReplacementString( String replacementString ) {
+ this.replacementString = replacementString;
+ }
+
+ public void setImage( Image image ) {
+ this.image = image;
+ }
+
+ public boolean isValidFor( IDocument document, int offset ) {
+ if (offset < replacementOffset)
+ return false;
+
+ int replacementLength = replacementString == null ? 0 : replacementString.length();
+ if (offset >= replacementOffset + replacementLength)
+ return false;
+
+ try {
+ int length = offset - replacementOffset;
+ String start = document.get( replacementOffset, length );
+ return replacementString.substring( 0, length ).equalsIgnoreCase( start );
+ }
+ catch (BadLocationException x) {
+ }
+
+ return false;
+ }
+
+}
\ No newline at end of file
Added: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/EclipseHQLCompletionRequestor.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/EclipseHQLCompletionRequestor.java (rev 0)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/EclipseHQLCompletionRequestor.java 2011-11-03 12:52:16 UTC (rev 36159)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tools.hibernate4_0;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.swt.graphics.Image;
+import org.hibernate.console.ImageConstants;
+import org.hibernate.eclipse.console.utils.EclipseImages;
+import org.hibernate.eclipse.console.workbench.HibernateWorkbenchHelper;
+import org.hibernate.internal.util.StringHelper;
+import org.hibernate.tool.ide.completion.HQLCompletionProposal;
+import org.hibernate.tool.ide.completion.IHQLCompletionRequestor;
+
+public class EclipseHQLCompletionRequestor implements IHQLCompletionRequestor {
+
+ private final List<ICompletionProposal> result = new ArrayList<ICompletionProposal>();
+ private String lastErrorMessage;
+ private final int virtualOffset;
+
+ public EclipseHQLCompletionRequestor() {
+ virtualOffset = 0;
+ }
+
+ public EclipseHQLCompletionRequestor(int virtualOffset) {
+ this.virtualOffset = virtualOffset;
+ }
+
+ public List<ICompletionProposal> getCompletionProposals() {
+ return result;
+ }
+
+ public boolean accept(HQLCompletionProposal proposal) {
+ result.add(new CompletionProposal(proposal.getCompletion(), // replacementString
+ proposal.getReplaceStart()+virtualOffset, // replacementOffset
+ proposal.getReplaceEnd()-proposal.getReplaceStart(), // replacementLength
+ proposal.getCompletion().length(), // cursorPosition (relativeTo replacementStart)
+ getImage(proposal),
+ getDisplayString(proposal),
+ null,
+ null));
+ return true;
+ }
+
+ private String getDisplayString(HQLCompletionProposal proposal) {
+ StringBuffer buf = new StringBuffer(proposal.getSimpleName());
+
+ switch(proposal.getCompletionKind()) {
+ case HQLCompletionProposal.ENTITY_NAME:
+ if(proposal.getEntityName()!=null &&
+ !(proposal.getSimpleName().equals( proposal.getEntityName()))) {
+ buf.append(" - "); //$NON-NLS-1$
+ buf.append(StringHelper.qualifier( proposal.getEntityName() ));
+ } else if(proposal.getShortEntityName()!=null &&
+ !(proposal.getSimpleName().equals( proposal.getEntityName()))) {
+ buf.append( " - " + proposal.getShortEntityName() ); //$NON-NLS-1$
+ }
+ break;
+ case HQLCompletionProposal.ALIAS_REF:
+ if(proposal.getShortEntityName()!=null) {
+ buf.append( " - " + proposal.getShortEntityName() ); //$NON-NLS-1$
+ } else if(proposal.getEntityName()!=null) {
+ buf.append( " - " + proposal.getEntityName() ); //$NON-NLS-1$
+ }
+ break;
+ case HQLCompletionProposal.PROPERTY:
+ if(proposal.getShortEntityName()!=null) {
+ buf.append( " - " + proposal.getShortEntityName() ); //$NON-NLS-1$
+ } else if(proposal.getEntityName()!=null) {
+ if(proposal.getEntityName().indexOf( "." )>=0) { //$NON-NLS-1$
+ buf.append( " - " + StringHelper.unqualify( proposal.getEntityName() )); //$NON-NLS-1$
+ } else {
+ buf.append( " - " + proposal.getEntityName() ); //$NON-NLS-1$
+ }
+ }
+ break;
+ case HQLCompletionProposal.KEYWORD:
+ break;
+ case HQLCompletionProposal.FUNCTION:
+ break;
+ default:
+
+ }
+
+
+ return buf.toString();
+ }
+
+ private Image getImage(HQLCompletionProposal proposal) {
+ String key = null;
+
+ switch(proposal.getCompletionKind()) {
+ case HQLCompletionProposal.ENTITY_NAME:
+ case HQLCompletionProposal.ALIAS_REF:
+ key = ImageConstants.MAPPEDCLASS;
+ break;
+ case HQLCompletionProposal.PROPERTY:
+ if(proposal.getProperty()!=null) {
+ return HibernateWorkbenchHelper.getImage( proposal.getProperty() );
+ } else {
+ key = ImageConstants.PROPERTY;
+ }
+ break;
+ case HQLCompletionProposal.KEYWORD:
+ key = null;
+ break;
+ case HQLCompletionProposal.FUNCTION:
+ key = ImageConstants.FUNCTION;
+ break;
+ default:
+ key = null;
+ }
+
+ return key==null?null:EclipseImages.getImage( key );
+ }
+
+ public void completionFailure(String errorMessage) {
+ lastErrorMessage = errorMessage;
+ }
+
+ public String getLastErrorMessage() {
+ return lastErrorMessage;
+ }
+
+ public void clear() {
+ result.clear();
+ lastErrorMessage = null;
+ }
+
+}
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HibernateExtension4_0.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HibernateExtension4_0.java 2011-11-03 11:30:02 UTC (rev 36158)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HibernateExtension4_0.java 2011-11-03 12:52:16 UTC (rev 36159)
@@ -29,6 +29,7 @@
import org.hibernate.console.execution.DefaultExecutionContext;
import org.hibernate.console.execution.ExecutionContext;
import org.hibernate.console.execution.ExecutionContext.Command;
+import org.hibernate.console.ext.CompletionProposalsResult;
import org.hibernate.console.ext.HibernateException;
import org.hibernate.console.ext.HibernateExtension;
import org.hibernate.console.ext.QueryResult;
@@ -38,6 +39,8 @@
import org.hibernate.service.BasicServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl;
+import org.hibernate.tool.ide.completion.HQLCodeAssist;
+import org.hibernate.tool.ide.completion.IHQLCodeAssist;
/**
*
@@ -207,6 +210,9 @@
return super.findClass(name);
} catch (ClassNotFoundException cnfe) {
throw cnfe;
+ } catch (IllegalStateException e){
+ e.printStackTrace();
+ throw e;
}
}
@@ -305,4 +311,30 @@
return configuration != null;
}
+ @Override
+ public CompletionProposalsResult hqlCodeComplete(String query, int currentOffset) {
+ EclipseHQLCompletionRequestor requestor = new EclipseHQLCompletionRequestor();
+ if (!hasConfiguration()){
+ try {
+ build();
+ execute( new ExecutionContext.Command() {
+ public Object execute() {
+ if(hasConfiguration()) {
+ configuration.buildMappings();
+ }
+ return null;
+ }
+ });
+ } catch (HibernateException e){
+ //FIXME
+ //String mess = NLS.bind(HibernateConsoleMessages.CompletionHelper_error_could_not_build_cc, consoleConfiguration.getName());
+ //HibernateConsolePlugin.getDefault().logErrorMessage(mess, e);
+ }
+ }
+ IHQLCodeAssist hqlEval = new HQLCodeAssist(configuration);
+ query = query.replace('\t', ' ');
+ hqlEval.codeComplete(query, currentOffset, requestor);
+ return new CompletionProposalsResult(requestor.getCompletionProposals(), requestor.getLastErrorMessage());
+ }
+
}
\ No newline at end of file
13 years, 1 month
JBoss Tools SVN: r36158 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2011-11-03 07:30:02 -0400 (Thu, 03 Nov 2011)
New Revision: 36158
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
Log:
https://issues.jboss.org/browse/JBIDE-10089 - moving style updating code to the top, before searching routine in getNodeForUpdate(..)
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2011-11-03 08:40:23 UTC (rev 36157)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2011-11-03 11:30:02 UTC (rev 36158)
@@ -785,23 +785,21 @@
if (nodeMapping instanceof VpeElementMapping) {
elementMapping = (VpeElementMapping) nodeMapping;
if (elementMapping != null && elementMapping.getTemplate() != null) {
- Node updateNode = elementMapping.getTemplate()
- .getNodeForUpdate(pageContext,
- elementMapping.getSourceNode(),
- elementMapping.getVisualNode(),
- elementMapping.getData());
/*
- * special processing of "style" element
- *
- * for unification of updating nodes - or redevelop updating
- * mechanism (for example : transfer this function to template )
- * or redevelop template of "style" element
+ * https://issues.jboss.org/browse/JBIDE-10089
+ * <style> is updated in a special way:
+ * There is no need in removing and adding its visual node.
+ * Thus the underneath statement is reasonable here.
*/
if (HTML.TAG_STYLE.equalsIgnoreCase(sourceNode.getNodeName())) {
- // refresh style node
VpeStyleUtil.refreshStyleElement(this, elementMapping);
return;
}
+ Node updateNode = elementMapping.getTemplate()
+ .getNodeForUpdate(pageContext,
+ elementMapping.getSourceNode(),
+ elementMapping.getVisualNode(),
+ elementMapping.getData());
if ((updateNode != null) && (updateNode != sourceNode)) {
updateNode(updateNode);
return;
13 years, 1 month
JBoss Tools SVN: r36157 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2011-11-03 04:40:23 -0400 (Thu, 03 Nov 2011)
New Revision: 36157
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TextUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-9548 - if statement was corrected.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TextUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TextUtil.java 2011-11-03 06:40:32 UTC (rev 36156)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TextUtil.java 2011-11-03 08:40:23 UTC (rev 36157)
@@ -348,11 +348,18 @@
* Without <span> for text nodes -- there is an
* string out of bounds exception.
*/
- int substringPosition = sourcePosition;
- if (sourceText.length() < sourcePosition) {
- substringPosition = sourceText.length() - 1;
+ int endPos = sourcePosition;
+ int length = sourceText.length();
+ String s1 = sourceText;
+ /*
+ * If sourceText is not empty -- correct endPos
+ */
+ if (length > 0) {
+ if (endPos > length) {
+ endPos = length;
+ }
+ s1 = sourceText.substring(0, endPos);
}
- String s1 = sourceText.substring(0, substringPosition);
String s2 = s1.replaceAll(SOURCE_BREAK, VISUAL_BREAK);
return calcPosition - (s1.length() - s2.length());
}
13 years, 1 month
JBoss Tools SVN: r36156 - trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-11-03 02:40:32 -0400 (Thu, 03 Nov 2011)
New Revision: 36156
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java
Log:
JBDS-1762 - as7 delay for browser
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java 2011-11-03 06:32:53 UTC (rev 36155)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java 2011-11-03 06:40:32 UTC (rev 36156)
@@ -49,7 +49,7 @@
public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception {
AS7Manager manager = new AS7Manager(host, port);
- return manager.getDeploymentState(deploymentName);
+ return manager.getDeploymentStateSafe(deploymentName);
}
@Deprecated
13 years, 1 month
JBoss Tools SVN: r36155 - in trunk/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-11-03 02:32:53 -0400 (Thu, 03 Nov 2011)
New Revision: 36155
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7DeploymentState.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/JBTWebLaunchableClient.java
Log:
JBDS-1762 - as7 delay for browser
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java 2011-11-03 02:45:18 UTC (rev 36154)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java 2011-11-03 06:32:53 UTC (rev 36155)
@@ -10,12 +10,10 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal.v7;
-import java.text.MessageFormat;
-
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.core.ExtensionManager;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.extensions.polling.WebPortPoller;
@@ -58,7 +56,7 @@
} catch (Exception e) {
return new Status(
IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
- MessageFormat.format(Messages.JBoss7ServerBehavior_could_not_stop, server.getName()), e);
+ NLS.bind(Messages.JBoss7ServerBehavior_could_not_stop, server.getName()), e);
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7DeploymentState.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7DeploymentState.java 2011-11-03 02:45:18 UTC (rev 36154)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7DeploymentState.java 2011-11-03 06:32:53 UTC (rev 36155)
@@ -18,5 +18,6 @@
*/
public enum JBoss7DeploymentState {
STARTED ,
- STOPPED;
+ STOPPED,
+ NOT_FOUND;
}
\ No newline at end of file
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java 2011-11-03 02:45:18 UTC (rev 36154)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java 2011-11-03 06:32:53 UTC (rev 36155)
@@ -11,12 +11,15 @@
package org.jboss.ide.eclipse.as.internal.management.as7;
import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.ADDRESS;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.CHILD_TYPE;
import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.DEPLOYMENT;
import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.ENABLED;
import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.FAILURE_DESCRIPTION;
import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.NAME;
import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.OP;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.OP_ADDR;
import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION;
+import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.READ_CHILDREN_NAMES_OPERATION;
import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.READ_RESOURCE_OPERATION;
import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.RESULT;
import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.SERVER_STATE;
@@ -25,6 +28,10 @@
import java.io.File;
import java.io.IOException;
import java.net.UnknownHostException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CancellationException;
import java.util.concurrent.Future;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -127,11 +134,42 @@
}
}
+ /**
+ * Get the deployment state
+ * This API may cause additional management requests, but it prevents exceptions
+ * from being thrown on the server.
+ *
+ * @param name
+ * @return
+ * @throws JBoss7ManangerException
+ */
+ public JBoss7DeploymentState getDeploymentStateSafe(String name) throws JBoss7ManangerException {
+ if( !getDeploymentNames().contains(name))
+ return JBoss7DeploymentState.NOT_FOUND;
+
+ return getDeploymentState(name);
+ }
+
+ /**
+ * Get the deployment state.
+ * This may cause exceptions to be thrown on the server side if the deployment has not yet
+ * been found or started to register.
+ *
+ *
+ * @param name
+ * @return
+ * @throws JBoss7ManangerException
+ */
public JBoss7DeploymentState getDeploymentState(String name) throws JBoss7ManangerException {
ModelNode request = new ModelNode();
request.get(OP).set(READ_RESOURCE_OPERATION);
request.get(ADDRESS).add(DEPLOYMENT, name);
- ModelNode result = execute(request);
+ ModelNode result = null;
+ try {
+ result = execute(request);
+ } catch( JBoss7ManangerException j7me ) {
+ return JBoss7DeploymentState.NOT_FOUND;
+ }
Boolean enabled = AS7ManagerUtil.getBooleanProperty(ENABLED, result);
if (enabled == null) {
@@ -225,4 +263,39 @@
throw new JBoss7ManangerException(e);
}
}
+
+ public static ModelNode getEmptyOperation(String operationName, ModelNode address) {
+ ModelNode op = new ModelNode();
+ op.get(OP).set(operationName);
+ if (address != null) {
+ op.get(OP_ADDR).set(address);
+ }
+ else {
+ // Just establish the standard structure; caller can fill in address later
+ op.get(OP_ADDR);
+ }
+ return op;
+ }
+
+ private Set<String> getDeploymentNames() throws CancellationException {
+ final ModelNode op = getEmptyOperation(READ_CHILDREN_NAMES_OPERATION, new ModelNode());
+ op.get(CHILD_TYPE).set(DEPLOYMENT);
+ ModelNode response;
+ try {
+ response = client.execute(op);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ final ModelNode result = response.get(RESULT);
+ final Set<String> deploymentNames = new HashSet<String>();
+ if (result.isDefined()) {
+ final List<ModelNode> deploymentNodes = result.asList();
+ for (ModelNode node : deploymentNodes) {
+ deploymentNames.add(node.asString());
+ }
+ }
+ return deploymentNames;
+ }
+
+
}
\ No newline at end of file
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/JBTWebLaunchableClient.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/JBTWebLaunchableClient.java 2011-11-03 02:45:18 UTC (rev 36154)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/JBTWebLaunchableClient.java 2011-11-03 06:32:53 UTC (rev 36155)
@@ -9,11 +9,13 @@
import javax.management.ObjectName;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunch;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.browser.IWebBrowser;
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
@@ -26,9 +28,15 @@
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
+import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.internal.JBossLaunchAdapter.JBTCustomHttpLaunchable;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7Server;
+import org.jboss.ide.eclipse.as.core.server.v7.management.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7DeploymentState;
+import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7ManagerUtil;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
public class JBTWebLaunchableClient extends ClientDelegate {
@@ -41,7 +49,7 @@
return (launchable instanceof JBTCustomHttpLaunchable);
}
- protected boolean shouldSuspendScanner(IServer server) {
+ protected boolean isJMXServer(IServer server) {
JBossServer jbs = ServerConverter.getJBossServer(server);
return jbs != null && server.getServerState() == IServer.STATE_STARTED
&& jbs.hasJMXProvider() && ExtensionManager.getDefault().getJMXRunner() != null;
@@ -75,10 +83,45 @@
}
protected void wait(final IServer server, final IModule module) {
- if( shouldSuspendScanner(server)) {
+ if( isJMXServer(server)) {
+ waitJMX(server, module);
+ } else if( ServerUtil.isJBoss7(server)) {
+ waitJBoss7(server, module);
+ }
+ }
+
+ protected void waitJBoss7(final IServer server, final IModule module) {
+ try {
+ JBoss7Server jbossServer = ServerConverter.checkedGetJBossServer(server, JBoss7Server.class);
+ IJBoss7ManagerService service = JBoss7ManagerUtil.getService(server);
+ IPath deployPath = PublishUtil.getDeployPath(new IModule[]{module}, jbossServer);
+ long time = new Date().getTime();
+ long endTime = time + getMaxDelay();
+ while( new Date().getTime() < endTime ) {
+ JBoss7DeploymentState state = service.getDeploymentState(jbossServer.getHost(), jbossServer.getManagementPort(),
+ deployPath.lastSegment());
+ boolean done = (state == JBoss7DeploymentState.STARTED);
+ if( done ) {
+ return;
+ }
+ try {
+ Thread.sleep(2000);
+ } catch(InterruptedException ie) {}
+ }
+ } catch (Exception e) {
+ IStatus s = new Status(
+ IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID,
+ NLS.bind("Could not acquire the management service for this JBoss installation",
+ server.getName()), e);
+ JBossServerUIPlugin.log(s.getMessage(), e);
+ }
+
+ }
+
+ protected void waitJMX(final IServer server, final IModule module) {
IServerJMXRunnable r = new IServerJMXRunnable() {
public void run(MBeanServerConnection connection) throws Exception {
- waitForDeploymentStarted(server, module, connection, null);
+ jmxWaitForDeploymentStarted(server, module, connection, null);
}
};
try {
@@ -89,17 +132,16 @@
} finally {
ExtensionManager.getDefault().getJMXRunner().endTransaction(server, this);
}
- }
}
- protected void waitForDeploymentStarted(final IServer server, final IModule module,
+ protected void jmxWaitForDeploymentStarted(final IServer server, final IModule module,
final MBeanServerConnection connection, IProgressMonitor monitor) throws Exception {
monitor = monitor == null ? new NullProgressMonitor() : monitor;
monitor.beginTask("Ensuring Deployments are Loaded", 10000); //$NON-NLS-1$
long time = new Date().getTime();
- while( new Date().getTime() < (time + 20000)) {
+ long endTime = time + getMaxDelay();
+ while( new Date().getTime() < endTime ) {
boolean done = checkDeploymentStarted(server, module, connection, monitor);
- System.out.println(done);
if( done ) {
monitor.done();
return;
@@ -109,6 +151,10 @@
} catch(InterruptedException ie) {}
}
}
+
+ protected long getMaxDelay() {
+ return 20000;
+ }
protected boolean checkDeploymentStarted(final IServer server, final IModule module,
final MBeanServerConnection connection, IProgressMonitor monitor) throws Exception {
13 years, 1 month
JBoss Tools SVN: r36154 - trunk/jsf/docs/jsf_tools_ref_guide/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2011-11-02 22:45:18 -0400 (Wed, 02 Nov 2011)
New Revision: 36154
Modified:
trunk/jsf/docs/jsf_tools_ref_guide/en-US/Book_Info.xml
Log:
updated for brew
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en-US/Book_Info.xml
===================================================================
--- trunk/jsf/docs/jsf_tools_ref_guide/en-US/Book_Info.xml 2011-11-03 02:44:32 UTC (rev 36153)
+++ trunk/jsf/docs/jsf_tools_ref_guide/en-US/Book_Info.xml 2011-11-03 02:45:18 UTC (rev 36154)
@@ -7,7 +7,7 @@
<productname>JBoss Developer Studio</productname>
<productnumber>5.0</productnumber>
<edition>5.0.0</edition>
- <pubsnumber>1</pubsnumber>
+ <pubsnumber>2</pubsnumber>
<abstract>
<para>The JSF Tools Reference Guide explains how to use the JSF Tools module to develop JSF applications.</para>
</abstract>
13 years, 1 month