JBoss Tools SVN: r8673 - trunk/documentation/jboss-tools-docs.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-06-10 07:21:08 -0400 (Tue, 10 Jun 2008)
New Revision: 8673
Modified:
trunk/documentation/jboss-tools-docs/pom.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-351
the incorrect folder was generated because of maven assembly plugin incorrect version - fixed
Modified: trunk/documentation/jboss-tools-docs/pom.xml
===================================================================
--- trunk/documentation/jboss-tools-docs/pom.xml 2008-06-10 10:26:03 UTC (rev 8672)
+++ trunk/documentation/jboss-tools-docs/pom.xml 2008-06-10 11:21:08 UTC (rev 8673)
@@ -31,7 +31,7 @@
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-1</version>
+ <version>2.2-beta-2</version>
<configuration>
<descriptors>
<descriptor>all-guides.xml</descriptor>
17 years, 10 months
JBoss Tools SVN: r8672 - in trunk/ws/plugins: org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2008-06-10 06:26:03 -0400 (Tue, 10 Jun 2008)
New Revision: 8672
Removed:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossStatusUtils.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeClassPathInitializer.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeManager.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSClassPathCommand.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSRuntimeCommand.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/IJBossWSFacetDataModelProperties.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JbossWSCoreUtils.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/BindingFilesValidationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSProviderInvokeCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSFacetInstallPage.java
Log:
JBIDE-2262: change the way of getting runtime location of Jboss web service runtime location,
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF 2008-06-10 10:26:03 UTC (rev 8672)
@@ -19,7 +19,8 @@
org.eclipse.jdt.launching,
org.eclipse.jst.jsf.core,
org.eclipse.jst.jsf.ui,
- org.eclipse.jdt.launching
+ org.eclipse.jdt.launching,
+ org.eclipse.jst.j2ee
Eclipse-LazyStart: true
Bundle-Vendor: %PLUGIN_PROVIDER
Export-Package: org.jboss.tools.ws.core,
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeClassPathInitializer.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeClassPathInitializer.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeClassPathInitializer.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -5,6 +5,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.ClasspathContainerInitializer;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
@@ -67,7 +68,8 @@
public IClasspathEntry[] getClasspathEntries() {
if (entries == null) {
ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
- IPath wsPath = JbossWSCoreUtils.getJbossWSRuntimePath(segment);
+ JbossWSRuntime jbws = JbossWSRuntimeManager.getInstance().findRuntimeByName(segment);
+ IPath wsPath = new Path(jbws.getHomeDir());
if (wsPath != null) {
IPath libPath = wsPath.append(JbossWSCoreMessages.Dir_Lib);
list.addAll(Arrays.asList(getEntries(libPath)));
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeManager.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeManager.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeManager.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -246,9 +246,7 @@
e.printStackTrace();
}
for (IFacetedProject facetedProject : facetedProjects) {
- QualifiedName qRuntimeName = new QualifiedName(
- IJBossWSFacetDataModelProperties.QUALIFIEDNAME_IDENTIFIER_IS_SERVER_SUPPLIED,
- IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID);
+ QualifiedName qRuntimeName = IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_QNAME_RUNTIME_NAME;
String name = null;
try {
name = facetedProject.getProject().getPersistentProperty(qRuntimeName);
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSClassPathCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSClassPathCommand.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSClassPathCommand.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -21,10 +21,14 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IAccessRule;
+import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -56,27 +60,29 @@
boolean isServerSupplied = model
.getBooleanProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED);
if (isServerSupplied) {
- QualifiedName serverSupplied_qn = new QualifiedName(
- IJBossWSFacetDataModelProperties.QUALIFIEDNAME_IDENTIFIER_IS_SERVER_SUPPLIED,
- IJBossWSFacetDataModelProperties.PERSISTENT_PROPERTY_IS_SERVER_SUPPLIED_RUNTIME);
- project.setPersistentProperty(serverSupplied_qn, "1");
+ project
+ .setPersistentProperty(
+ IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_SERVER_SUPPLIED_RUNTIME,
+ IJBossWSFacetDataModelProperties.DEFAULT_VALUE_IS_SERVER_SUPPLIED);
} else {
// store runtime name and runtime location to the project
- QualifiedName qRuntimeName = new QualifiedName(
- IJBossWSFacetDataModelProperties.QUALIFIEDNAME_IDENTIFIER_IS_SERVER_SUPPLIED,
- IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID);
- QualifiedName qRuntimeLocation = new QualifiedName(
- IJBossWSFacetDataModelProperties.QUALIFIEDNAME_IDENTIFIER_IS_SERVER_SUPPLIED,
- IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID);
+
String runtimeName = model
.getStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID);
String runtimeLocation = model
.getStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_HOME);
- project.setPersistentProperty(qRuntimeName, runtimeName);
project
- .setPersistentProperty(qRuntimeLocation,
+ .setPersistentProperty(
+ IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_QNAME_RUNTIME_NAME,
+ runtimeName);
+ project
+ .setPersistentProperty(
+ IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_RNTIME_LOCATION,
runtimeLocation);
- status = addClassPath(project, runtimeName);
+ boolean isDeployed = model
+ .getBooleanProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_DEPLOY);
+
+ status = addClassPath(project, runtimeName, isDeployed);
}
} catch (CoreException e) {
@@ -86,14 +92,29 @@
return status;
}
- public IStatus addClassPath(IProject project, String segment) {
+ public IStatus addClassPath(IProject project, String segment,
+ boolean isDeployed) {
IStatus status = Status.OK_STATUS;
try {
+ IClasspathEntry newClasspath;
IJavaProject javaProject = JavaCore.create(project);
- IClasspathEntry newClasspath = JavaCore.newContainerEntry(new Path(
- JbossWSCoreMessages.JBossWS_Runtime_Lib).append(segment));
+ if (isDeployed) {
+ IClasspathAttribute depAttrib = JavaCore
+ .newClasspathAttribute(
+ IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY,
+ ClasspathDependencyUtil.getDefaultRuntimePath(
+ true).toString());
+ newClasspath = JavaCore.newContainerEntry(new Path(
+ JbossWSCoreMessages.JBossWS_Runtime_Lib)
+ .append(segment), null,
+ new IClasspathAttribute[] { depAttrib }, true);
+ } else {
+ newClasspath = JavaCore.newContainerEntry(new Path(
+ JbossWSCoreMessages.JBossWS_Runtime_Lib)
+ .append(segment));
+ }
IClasspathEntry[] oldClasspathEntries = javaProject
.readRawClasspath();
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSRuntimeCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSRuntimeCommand.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSRuntimeCommand.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -17,6 +17,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
@@ -45,7 +46,7 @@
IStatus status = Status.OK_STATUS;
// copy lib jars to project's folder
- IPath wsPath = JbossWSCoreUtils.getJbossWSRuntimePath(null);
+ IPath wsPath = new Path("");
IPath libPath = null;
try {
libPath = wsPath.append(JbossWSCoreMessages.Dir_Lib);
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/IJBossWSFacetDataModelProperties.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/IJBossWSFacetDataModelProperties.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/IJBossWSFacetDataModelProperties.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -11,38 +11,31 @@
package org.jboss.tools.ws.core.facet.delegate;
+import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
-/**
- * Seam facet properties collected in Seam Web Project Wizard.
- * Only properties listed below are saved in Seam WebProject Preferences:
- * ISeamFacetDataModelProperties.SESSION_BEAN_SOURCE_FOLDER,
- * ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME,
- * ISeamFacetDataModelProperties.ENTITY_BEAN_SOURCE_FOLDER,
- * ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME,
- * ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
- * ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
- * ISeamFacetDataModelProperties.SEAM_TEST_PROJECT,
- * ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
- * ISeamFacetDataModelProperties.SEAM_SETTINGS_VERSION,
- * ISeamFacetDataModelProperties.TEST_SOURCE_FOLDER,
- * ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME,
- * ISeamFacetDataModelProperties.TEST_CREATING,
- * ISeamFacetDataModelProperties.SEAM_EJB_PROJECT,
- * ISeamFacetDataModelProperties.SEAM_EAR_PROJECT
- * @author eskimo
- */
+
public interface IJBossWSFacetDataModelProperties extends IActionConfigFactory {
// Seam Preferences names constants
String JBOSS_WS_FACET_ID = "jbossws.core";
+ String JBOSS_WS_DEPLOY = "jboss.ws.deploy";
+ String QUALIFIEDNAME_IDENTIFIER = "jboss.tools.jbossws";
String JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED = "jboss.ws.is.server.supplied";
String JBOSS_WS_RUNTIME_ID = "jboss.ws.runtime_id";
- String JBOSS_WS_DEPLOY = "jboss.ws.deploy";
- String JBOSS_WS_RUNTIME_HOME = "jboss.ws.runtime.home";
- String QUALIFIEDNAME_IDENTIFIER_IS_SERVER_SUPPLIED = "jboss.tools.jbossws";
+
String PERSISTENT_PROPERTY_IS_SERVER_SUPPLIED_RUNTIME = "is.server.supplied.runtime";
+ String JBOSS_WS_RUNTIME_HOME = "jboss.ws.runtime.home";
+ String DEFAULT_VALUE_IS_SERVER_SUPPLIED = "1";
+
+ QualifiedName PERSISTENCE_PROPERTY_QNAME_RUNTIME_NAME = new QualifiedName(QUALIFIEDNAME_IDENTIFIER,
+ JBOSS_WS_RUNTIME_ID);
+ QualifiedName PERSISTENCE_PROPERTY_RNTIME_LOCATION = new QualifiedName(QUALIFIEDNAME_IDENTIFIER,
+ JBOSS_WS_RUNTIME_HOME);
+ QualifiedName PERSISTENCE_PROPERTY_SERVER_SUPPLIED_RUNTIME = new QualifiedName(
+ QUALIFIEDNAME_IDENTIFIER,
+ PERSISTENT_PROPERTY_IS_SERVER_SUPPLIED_RUNTIME);
}
\ No newline at end of file
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JbossWSCoreUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JbossWSCoreUtils.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JbossWSCoreUtils.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -220,27 +220,7 @@
}
}
- public static IPath getJbossWSRuntimePath(String runtimeName) {
- JbossWSRuntime[] runtimes = JbossWSRuntimeManager.getInstance().getRuntimes();
- if(runtimes == null || runtimes.length == 0){
- return null;
- }
- if (runtimeName == null || runtimeName.equals("")) {
- for (JbossWSRuntime rt : runtimes) {
- if (rt.isDefault()) {
- return new Path(rt.getHomeDir());
- }
- }
- return null;
- } else {
- for (JbossWSRuntime rt : runtimes) {
- if(rt.getName().equals(runtimeName)){
- return new Path(rt.getHomeDir());
- }
- }
- }
- return null;
- }
+
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF 2008-06-10 10:26:03 UTC (rev 8672)
@@ -26,7 +26,10 @@
org.eclipse.jdt.core,
org.eclipse.jface.text,
org.eclipse.core.filebuffers,
- org.eclipse.jdt.ui
+ org.eclipse.jdt.ui,
+ org.eclipse.wst.common.project.facet.core,
+ org.eclipse.wst.server.core,
+ org.jboss.tools.common
Eclipse-LazyStart: true
Export-Package: org.jboss.tools.ws.creation.core,
org.jboss.tools.ws.creation.core.commands,
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -1,12 +1,12 @@
package org.jboss.tools.ws.creation.core;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.tools.common.log.BaseUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
-public class JBossWSCreationCore extends AbstractUIPlugin {
+public class JBossWSCreationCore extends BaseUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.jboss.tools.ws.creation.core";
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/BindingFilesValidationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/BindingFilesValidationCommand.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/BindingFilesValidationCommand.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -12,9 +12,9 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
-import org.jboss.tools.ws.creation.core.utils.JBossStatusUtils;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
@@ -64,13 +64,13 @@
reader.parse(is);
} catch (SAXException e) {
- return JBossStatusUtils
+ return StatusUtils
.errorStatus(
NLS.bind(JBossWSCreationCoreMessages.Error_Message_Invalid_Binding_File,
new String[] {filename, e.getLocalizedMessage() }), e);
} catch (IOException e) {
- return JBossStatusUtils
+ return StatusUtils
.errorStatus(
NLS.bind(JBossWSCreationCoreMessages.Error_Message_Invalid_Binding_File,
new String[] {filename, e.getLocalizedMessage() }), e);
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -30,16 +30,10 @@
import org.eclipse.jdt.core.dom.Block;
import org.eclipse.jdt.core.dom.BooleanLiteral;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.ExpressionStatement;
-import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.ImportDeclaration;
-import org.eclipse.jdt.core.dom.InfixExpression;
-import org.eclipse.jdt.core.dom.Initializer;
import org.eclipse.jdt.core.dom.MemberValuePair;
import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.MethodInvocation;
import org.eclipse.jdt.core.dom.Modifier;
-import org.eclipse.jdt.core.dom.Name;
import org.eclipse.jdt.core.dom.NormalAnnotation;
import org.eclipse.jdt.core.dom.NumberLiteral;
import org.eclipse.jdt.core.dom.PackageDeclaration;
@@ -52,16 +46,15 @@
import org.eclipse.jdt.core.dom.StringLiteral;
import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.core.dom.WildcardType;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
-import org.eclipse.text.edits.MalformedTreeException;
import org.eclipse.text.edits.TextEdit;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.jboss.tools.ws.core.utils.StatusUtils;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
-import org.jboss.tools.ws.creation.core.utils.JBossStatusUtils;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
public class ImplementationClassCreationCommand extends
@@ -70,7 +63,6 @@
private static final String RESOURCE_FOLDER = "src";
private static final String PREFIX_JAXWS_ANNOTATION_CLASS = "javax.jws";
- private static final String SUFFIX_PACKAGENAME_IMPL = "impl";
private static final String DEFAULT_CU_SUFFIX = ".java";
private static final String ANNOTATION_WEB_SERVICE_FULLNAME = "javax.jws.WebService";
@@ -79,11 +71,6 @@
private static final String ANNOTATION_PROPERTY_SERVICE_NAME = "serviceName";
private static final String ANNOTATION_PROPERTY_ENDPOINT_INTERFACE = "endpointInterface";
- private static final String LOGGER_FIELD_NAME = "log";
- private static final String LOGGER_CLASS_FULLNAME = "org.jboss.logging.Logger";
- private static final String LOGGER_CLASS_NAME = "Logger";
- private static final String LOGGER_METHOD_NAME_GETLOGGER = "getLogger";
- private static final String LOGGER_METHOD_NAME_INFO = "info";
private ServiceModel model;
private IWorkspaceRoot fWorkspaceRoot;
@@ -108,35 +95,31 @@
}
} catch (CoreException e) {
- status = JBossStatusUtils
+ status = StatusUtils
.errorStatus(
- JBossWSCreationCoreMessages.Error_Message_Invalid_Binding_File,
+ JBossWSCreationCoreMessages.Error_Message_Failed_to_Generate_Implementation,
e);
- } catch (MalformedTreeException e) {
- status = JBossStatusUtils
- .errorStatus(
- JBossWSCreationCoreMessages.Error_Message_Invalid_Binding_File,
- e);
+ JBossWSCreationCore.getDefault().logError(e);
} catch (BadLocationException e) {
- status = JBossStatusUtils
+ status = StatusUtils
.errorStatus(
- JBossWSCreationCoreMessages.Error_Message_Invalid_Binding_File,
+ JBossWSCreationCoreMessages.Error_Message_Failed_to_Generate_Implementation,
e);
+ JBossWSCreationCore.getDefault().logError(e);
}
return status;
}
protected void generateImplClass(String portTypeName/* , IFile implJavaFile */)
- throws CoreException, MalformedTreeException, BadLocationException {
+ throws CoreException, BadLocationException {
CompilationUnit portTypeCU = getCompilationUnitForInterface(portTypeName);
- Object obj = portTypeCU.imports();
List<ImportDeclaration> imports = getImportsWithoutJaxwsAnnotation(portTypeCU);
IPackageFragment pack = getImplPakcage();
- String cuName = getJavaFileName(portTypeName);
- ICompilationUnit icu = pack.createCompilationUnit(cuName,
+ String implFileName = getJavaFileName(portTypeName);
+ ICompilationUnit icu = pack.createCompilationUnit(implFileName,
"", true, null); //$NON-NLS-1$
// create a working copy with a new owner
@@ -270,7 +253,7 @@
implCU.imports().add(newId);
}
- // import port type interface and jboss Logger
+ // import port type interface
ImportDeclaration importDec = implAST.newImportDeclaration();
QualifiedName portTypeImport = implAST.newQualifiedName(implAST
.newName(portTypeCU.getPackage().getName()
@@ -278,8 +261,8 @@
.newSimpleName(portTypeName));
importDec.setName(portTypeImport);
implCU.imports().add(importDec);
- importDec = implAST.newImportDeclaration();
- importDec.setName(implAST.newName(LOGGER_CLASS_FULLNAME));
+ //importDec = implAST.newImportDeclaration();
+ //importDec.setName(implAST.newName(LOGGER_CLASS_FULLNAME));
implCU.imports().add(importDec);
// import jaxws WebService
@@ -391,40 +374,6 @@
return md;
}
-/* protected FieldDeclaration createLoggerField(AST ast, TypeDeclaration type, String portTypeName) {
- VariableDeclarationFragment vdf = ast.newVariableDeclarationFragment();
- vdf.setName(ast.newSimpleName(LOGGER_FIELD_NAME));
- Initializer clsAccesss = ast.newInitializer();
- FieldDeclaration fd = ast.newFieldDeclaration(vdf);
- fd.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD));
- fd.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.STATIC_KEYWORD));
- fd.setType(ast.newSimpleType(ast.newSimpleName(LOGGER_CLASS_NAME)));
- MethodInvocation mi = ast.newMethodInvocation();
- mi.setExpression(ast.newSimpleName(LOGGER_CLASS_NAME));
- mi.setName(ast.newSimpleName(LOGGER_METHOD_NAME_GETLOGGER));
- String implClsName = getImplPackageName() + "." + getImplClassName(portTypeName);
- StringLiteral sl = ast.newStringLiteral();
- sl.setLiteralValue(implClsName);
- mi.arguments().add(sl);
- vdf.setInitializer(mi);
- type.bodyDeclarations().add(fd);
-
- return fd;
- }
-
- protected ExpressionStatement createLoggerInvokeStatement(AST ast, String methodName){
- MethodInvocation methodInvocation = ast.newMethodInvocation();
- Name fieldName = ast.newSimpleName(LOGGER_FIELD_NAME);
- methodInvocation.setExpression(fieldName);
- methodInvocation.setName(ast.newSimpleName(LOGGER_METHOD_NAME_INFO));
- StringLiteral param = ast.newStringLiteral();
- param.setLiteralValue("The method: " + methodName + "() is invoked.");
- methodInvocation.arguments().add(param);
- ExpressionStatement infoStatement = ast.newExpressionStatement(methodInvocation);
-
- return infoStatement;
-
- }*/
private Type copyTypeFromOtherASTNode(AST ast, Type type) {
if (type instanceof PrimitiveType) {
@@ -468,8 +417,11 @@
return importList;
}
- private CompilationUnit getCompilationUnitForInterface(String portTypeName) {
+ private CompilationUnit getCompilationUnitForInterface(String portTypeName) throws CoreException {
IFile inFile = getServiceInterfaceFile(portTypeName);
+ if(!inFile.exists()){
+ throw new CoreException(StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code));
+ }
ICompilationUnit icu = JBossWSCreationUtils.getJavaUnitFromFile(inFile);
ASTParser astp = ASTParser.newParser(AST.JLS3);
astp.setSource(icu);
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -12,6 +12,7 @@
import org.eclipse.wst.ws.internal.wsrt.IWebService;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
import org.jboss.tools.ws.core.JbossWSCorePlugin;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
@@ -48,6 +49,7 @@
model.setPortTypeList(reader.getPortTypeList());
} catch (WSDLException e) {
+ JBossWSCreationCore.getDefault().logError(e);
return StatusUtils.errorStatus(e.getLocalizedMessage(), e);
}
} else {
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaCommand.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaCommand.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -2,30 +2,35 @@
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.util.List;
-import javax.xml.parsers.SAXParserFactory;
-
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.jboss.tools.ws.core.JbossWSCorePlugin;
+import org.jboss.tools.ws.core.utils.StatusUtils;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.core.utils.JBossStatusUtils;
+import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
public class WSDL2JavaCommand extends AbstractDataModelOperation{
private ServiceModel model;
+ private static String WSCONSUEM_FILE_NAME_LINUX = "wsconsume.sh";
+ private static String WSCONSUEM_FILE_NAME_WIN = "wsconsume.bat";
-
public WSDL2JavaCommand(ServiceModel model){
this.model = model;
}
@@ -33,17 +38,31 @@
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
-
- String runtimeLocation = JbossWSCorePlugin.getDefault().getPreferenceStore().getString("jbosswsruntimelocation");
- String commandLocation = runtimeLocation + Path.SEPARATOR + "bin";
- String command = "sh wsconsume.sh ";
- if(System.getProperty("os.name").toLowerCase().indexOf("win") >= 0){
- command = "cmd.exe /c wsconsume.bat ";
- }
- String args = getCommandlineArgs();
- command += " -k " + args + " " + model.getWsdlURI();
+ IStatus status = Status.OK_STATUS;
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(model
+ .getWebProjectName());
+
try {
+ String runtimeLocation = JBossWSCreationUtils.getJbossWSRuntimeLocation(project);
+ String commandLocation = runtimeLocation + Path.SEPARATOR + "bin";
+ IPath path = new Path(commandLocation);
+ String command = "sh " + WSCONSUEM_FILE_NAME_LINUX;
+ if(System.getProperty("os.name").toLowerCase().indexOf("win") >= 0){
+ command = "cmd.exe /c " + WSCONSUEM_FILE_NAME_WIN;
+ path.append(WSCONSUEM_FILE_NAME_WIN);
+ }else{
+ path.append(WSCONSUEM_FILE_NAME_LINUX);
+ }
+
+ if(!path.toFile().exists()){
+ return StatusUtils.errorStatus(
+ NLS.bind(JBossWSCreationCoreMessages.Error_Message_Command_File_Not_Found,
+ new String[] {path.toOSString()}));
+ }
+
+ String args = getCommandlineArgs();
+ command += " -k " + args + " " + model.getWsdlURI();
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(command, null, new File(commandLocation));
InputStreamReader ir = new InputStreamReader(proc.getErrorStream());
@@ -57,29 +76,46 @@
}
int exitValue = proc.waitFor();
if(exitValue != 0){
- return JBossStatusUtils.errorStatus(result.toString());
+ return StatusUtils.errorStatus(result.toString());
}
+
+ // log the result of the command execution
+ JBossWSCreationCore.getDefault().logInfo(convertInputStreamToString(proc.getInputStream()));
+ } catch (IOException e) {
+ JBossWSCreationCore.getDefault().logError(e);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
} catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ // ignore
+ } catch (CoreException e) {
+ JBossWSCreationCore.getDefault().logError(e);
+ //unable to get runtime location
+ return e.getStatus();
}
refreshProject(model.getWebProjectName(), monitor);
- return Status.OK_STATUS;
+ return status;
}
+ private String convertInputStreamToString(InputStream input) throws IOException{
+ InputStreamReader ir = new InputStreamReader(input);
+ LineNumberReader reader = new LineNumberReader(ir);
+ String str = reader.readLine();
+ StringBuffer result = new StringBuffer();
+ while(str != null){
+ result.append(str).append("\t\r");
+ str = reader.readLine();
+
+ }
+ return result.toString();
+ }
private void refreshProject(String project, IProgressMonitor monitor){
try {
JBossWSCreationUtils.getProjectByName(project).refreshLocal(2, monitor);
} catch (CoreException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
+ JBossWSCreationCore.getDefault().logError(e);
}
}
@@ -117,28 +153,4 @@
}
-/* private List<String> getEnv(){
- List<String> env = new ArrayList<String>();
-
- String project = model.getWebProjectName();
- String projectRoot = JBossWSCreationUtils.getProjectRoot(project).toOSString();
- env.add("o=" + projectRoot + Path.SEPARATOR + "src");
-
- String customePkg = model.getPackageText();
- if(customePkg != null && !"".equals(customePkg)){
- env.add(" p=" + customePkg);
- }
-
- String bindingFileLocation = model.getBindingFileLocation();
- if(bindingFileLocation != null && !"".equals(bindingFileLocation)){
- File bindingFile = new File(bindingFileLocation);
- if(bindingFile.exists()){
- env.add("b=" + bindingFileLocation);
- }
- }
-
- return env;
-
- }
-*/
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSProviderInvokeCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSProviderInvokeCommand.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSProviderInvokeCommand.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -25,8 +25,8 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.JbossWSCorePlugin;
+import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.core.utils.JBossStatusUtils;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
/**
@@ -68,7 +68,7 @@
}
int exitValue = proc.waitFor();
if (exitValue != 0) {
- return JBossStatusUtils.errorStatus(result.toString());
+ return StatusUtils.errorStatus(result.toString());
}
} catch (IOException e) {
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2008-06-10 10:26:03 UTC (rev 8672)
@@ -9,6 +9,10 @@
Error_Message_Invalid_Binding_File={0} is not a valid JAX-WS or JAXB binding file
Error_Read_Binding_File=Exception occurred while reading binding file
+Error_Message_Failed_To_Generate_Code=Failed to Generate code, please read the log for more details
+Error_Message_Failed_to_Generate_Implementation=Failed to generate implementation class
+Error_Message_Command_File_Not_Found=The command file:{0} does not exist, please check the JBoss Web Service runtime setting to make sure the location of JBoss Web Service runtime is valid.
+Error_Message_Execute_Command=Exception occurred while execute JBossWS tool command
Separator_Java=/
Error_Implemetation_Code_Generation=Exception occurred while generating implementation class
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -27,8 +27,14 @@
public static String Error_Message_Invalid_Binding_File;
public static String Error_Read_Binding_File;
public static String Separator_Java;
+ public static String Error_Message_Failed_To_Generate_Code;
+ public static String Error_Message_Failed_to_Generate_Implementation;
+ public static String Error_Message_Command_File_Not_Found;
+ public static String Error_Message_Execute_Command;
+
+
public static String Error_Implemetation_Code_Generation;
public static String Error_No_Annotation;
public static String WebserviceClient_Annotation;
Deleted: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossStatusUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossStatusUtils.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossStatusUtils.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -1,24 +0,0 @@
-package org.jboss.tools.ws.creation.core.utils;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-
-public class JBossStatusUtils {
-
- public static IStatus errorStatus(String message, Throwable exc) {
- return new Status(IStatus.ERROR, "id", 0, message, exc);
- }
-
- public static IStatus errorStatus(String message) {
- return new Status(IStatus.ERROR, "id", message);
- }
-
- public static MultiStatus errorMultiStatus(String message, IStatus[] status) {
- return new MultiStatus("id", 0, status, message, null);
- }
-
- public static MultiStatus errorMultiStatus(String message) {
- return new MultiStatus("id", 0, message, null);
- }
-}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -29,6 +29,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
@@ -39,8 +40,18 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jst.ws.internal.common.J2EEUtils;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.internal.FacetedProject;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.server.core.ServerCore;
import org.jboss.tools.ws.core.JbossWSCorePlugin;
+import org.jboss.tools.ws.core.classpath.JbossWSRuntime;
+import org.jboss.tools.ws.core.classpath.JbossWSRuntimeManager;
+import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
import org.jboss.tools.ws.core.messages.JbossWSCoreMessages;
+import org.jboss.tools.ws.core.utils.StatusUtils;
public class JBossWSCreationUtils {
@@ -271,4 +282,39 @@
return true;
}
+ public static String getJbossWSRuntimeLocation(IProject project) throws CoreException{
+
+
+ //if users select server as its jbossws runtime, then get runtime location from project target runtime
+ String isServerSupplied = project.getPersistentProperty(IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_SERVER_SUPPLIED_RUNTIME);
+ if(IJBossWSFacetDataModelProperties.DEFAULT_VALUE_IS_SERVER_SUPPLIED.equals(isServerSupplied)){
+ IFacetedProject facetedPrj = ProjectFacetsManager.create( project );
+ IRuntime prjRuntime = facetedPrj.getPrimaryRuntime();
+ // TODO get runtime location from specified project target runtime
+ prjRuntime.getRuntimeComponents().get(0).getProperties();
+
+ //if no target runtime specified, get runtime location from default jbossws runtime from jbossws preference
+ if(prjRuntime == null){
+ JbossWSRuntime jbws = JbossWSRuntimeManager.getInstance().getDefaultRuntime();
+ if(jbws != null){
+ return jbws.getHomeDir();
+ }else{
+ throw new CoreException(StatusUtils.errorStatus("No JBoss Web Service runtime specified."));
+ }
+
+ }
+ }else{
+ String jbwsRuntimeName = project.getPersistentProperty(IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_QNAME_RUNTIME_NAME);
+ JbossWSRuntime jbws = JbossWSRuntimeManager.getInstance().findRuntimeByName(jbwsRuntimeName);
+ if(jbws != null){
+ return jbws.getHomeDir();
+ }else{
+ String jbwsHomeDir = project.getPersistentProperty(IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_RNTIME_LOCATION);
+ return jbwsHomeDir;
+ }
+ }
+ return "";
+
+ }
+
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSFacetInstallPage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSFacetInstallPage.java 2008-06-10 10:24:27 UTC (rev 8671)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSFacetInstallPage.java 2008-06-10 10:26:03 UTC (rev 8672)
@@ -14,7 +14,6 @@
import java.util.Arrays;
import java.util.EventObject;
import java.util.List;
-import java.util.Map;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
@@ -37,8 +36,6 @@
import org.jboss.tools.ws.core.classpath.JbossWSRuntime;
import org.jboss.tools.ws.core.classpath.JbossWSRuntimeManager;
import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
-import org.jboss.tools.ws.core.messages.JbossWSCoreMessages;
-import org.jboss.tools.ws.core.utils.JbossWSCoreUtils;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.ui.preferences.JbossRuntimeListFieldEditor;
@@ -138,6 +135,7 @@
btnNew.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
newJBossWSRuntime();
+ changePageStatus();
}
});
@@ -189,7 +187,7 @@
for (int i = 0; i < runtimes.length; i++) {
JbossWSRuntime jr = runtimes[i];
cmRuntime.add(jr.getName());
- cmRuntime.setData(jr.getName(), jr.getHomeDir());
+ cmRuntime.setData(jr.getName(), jr);
// get default jbossws runtime
if (jr.isDefault()) {
@@ -209,6 +207,7 @@
exists, added) {
public boolean performFinish() {
JbossWSRuntime rt = getRuntime();
+ rt.setDefault(true);
JbossWSRuntimeManager.getInstance().addRuntime(rt);
JbossWSRuntimeManager.getInstance().save();
@@ -217,9 +216,9 @@
};
WizardDialog dialog = new WizardDialog(Display.getCurrent()
.getActiveShell(), newRtwizard);
- if (dialog.open() == dialog.OK) {
+ if (dialog.open() == WizardDialog.OK) {
initializeRuntimesCombo(cmbRuntimes);
- cmbRuntimes.select(cmbRuntimes.getItemCount() - 1);
+ //cmbRuntimes.select(0);
}
}
17 years, 10 months
JBoss Tools SVN: r8671 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-06-10 06:24:27 -0400 (Tue, 10 Jun 2008)
New Revision: 8671
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2030, method for stopping switcher was put into "finally" block, in case of exception switcher will be stopped in any case.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-06-10 10:24:22 UTC (rev 8670)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-06-10 10:24:27 UTC (rev 8671)
@@ -499,146 +499,168 @@
public void notifyChangedInUiThread(INodeNotifier notifier, int eventType,
- Object feature, Object oldValue, Object newValue, int pos) {
- if (switcher == null || !switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
- return;
- }
- if (VpeDebug.PRINT_SOURCE_MUTATION_EVENT) {
- printSourceEvent(notifier, eventType, feature, oldValue, newValue,
- pos);
- }
- if (visualBuilder == null) {
- return;
- }
- // visualBuilder.rebuildFlag = false;
-
- switch (eventType) {
- case INodeNotifier.CHANGE:
- sourceChangeFlag = true;
- int type = ((Node) notifier).getNodeType();
- visualEditor.hideResizer();
- visualBuilder.setSelectionRectangle(null);
- if (type == Node.TEXT_NODE) {
- boolean update = visualBuilder.setText((Node) notifier);
- visualEditor.showResizer();
- // Added by Max Areshkau JBIDE-1554
- if (!update)
- visualBuilder.updateNode((Node) notifier);
- } else if (type == Node.COMMENT_NODE) {
- if ("yes".equals(VpePreference.SHOW_COMMENTS.getValue())) { //$NON-NLS-1$
- visualBuilder.setSelectionRectangle(null);
- visualBuilder.updateNode((Node) notifier);
+ Object feature, Object oldValue, Object newValue, int pos) {
+ if (switcher == null
+ || !switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
+ return;
}
- } else if (feature != null
- && ((Node) feature).getNodeType() == Node.ATTRIBUTE_NODE) {
- if (newValue != null) {
- String attrName = ((Attr) feature).getName();
- if ((Attr) feature == lastRemovedAttr
- && !attrName.equals(lastRemovedAttrName)) {
- lastRemovedAttr = null;
- visualBuilder.removeAttribute((Element) notifier,
- lastRemovedAttrName);
- }
- visualBuilder.setAttribute((Element) notifier,
- ((Attr) feature).getName(), (String) newValue);
- } else {
- lastRemovedAttr = (Attr) feature;
- lastRemovedAttrName = ((Attr) feature).getName();
- visualBuilder.removeAttribute((Element) notifier,
- lastRemovedAttrName);
- }
- }
- visualEditor.showResizer();
- break;
+ try {
+ if (VpeDebug.PRINT_SOURCE_MUTATION_EVENT) {
+ printSourceEvent(notifier, eventType, feature, oldValue,
+ newValue, pos);
+ }
+ if (visualBuilder == null) {
+ return;
+ }
+ // visualBuilder.rebuildFlag = false;
- case INodeNotifier.ADD:
- // we should remove all parent nodes from vpe cash
- visualBuilder.removeNode((Node) newValue);
- break;
+ switch (eventType) {
+ case INodeNotifier.CHANGE:
+ sourceChangeFlag = true;
+ int type = ((Node) notifier).getNodeType();
+ visualEditor.hideResizer();
+ visualBuilder.setSelectionRectangle(null);
+ if (type == Node.TEXT_NODE) {
+ boolean update = visualBuilder.setText((Node) notifier);
+ visualEditor.showResizer();
+ // Added by Max Areshkau JBIDE-1554
+ if (!update)
+ visualBuilder.updateNode((Node) notifier);
+ } else if (type == Node.COMMENT_NODE) {
+ if ("yes".equals(VpePreference.SHOW_COMMENTS.getValue())) { //$NON-NLS-1$
+ visualBuilder.setSelectionRectangle(null);
+ visualBuilder.updateNode((Node) notifier);
+ }
+ } else if (feature != null
+ && ((Node) feature).getNodeType() == Node.ATTRIBUTE_NODE) {
+ if (newValue != null) {
+ String attrName = ((Attr) feature).getName();
+ if ((Attr) feature == lastRemovedAttr
+ && !attrName.equals(lastRemovedAttrName)) {
+ lastRemovedAttr = null;
+ visualBuilder.removeAttribute((Element) notifier,
+ lastRemovedAttrName);
+ }
+ visualBuilder.setAttribute((Element) notifier,
+ ((Attr) feature).getName(), (String) newValue);
+ } else {
+ lastRemovedAttr = (Attr) feature;
+ lastRemovedAttrName = ((Attr) feature).getName();
+ visualBuilder.removeAttribute((Element) notifier,
+ lastRemovedAttrName);
+ }
+ }
+ visualEditor.showResizer();
+ break;
- case INodeNotifier.REMOVE:
- visualBuilder.stopToggle((Node) feature);
- visualBuilder.removeNode((Node) feature);
- break;
+ case INodeNotifier.ADD:
+ // we should remove all parent nodes from vpe cash
+ visualBuilder.removeNode((Node) newValue);
+ break;
- case INodeNotifier.STRUCTURE_CHANGED:
- visualEditor.hideResizer();
- visualBuilder.setSelectionRectangle(null);
- visualBuilder.updateNode((Node) notifier);
- break;
- case INodeNotifier.CONTENT_CHANGED:
- if (!sourceChangeFlag) {
- if (feature != null
- && ((Node) feature).getNodeType() == Node.TEXT_NODE) {
- // if
- // (((Node)notifier).getNodeName().equalsIgnoreCase("style"))
- // {
- visualEditor.hideResizer();
- visualBuilder.setSelectionRectangle(null);
- visualBuilder.setText((Node) feature);
- visualEditor.showResizer();
- // }
+ case INodeNotifier.REMOVE:
+ visualBuilder.stopToggle((Node) feature);
+ visualBuilder.removeNode((Node) feature);
+ break;
+
+ case INodeNotifier.STRUCTURE_CHANGED:
+ visualEditor.hideResizer();
+ visualBuilder.setSelectionRectangle(null);
+ visualBuilder.updateNode((Node) notifier);
+ break;
+ case INodeNotifier.CONTENT_CHANGED:
+ if (!sourceChangeFlag) {
+ if (feature != null
+ && ((Node) feature).getNodeType() == Node.TEXT_NODE) {
+ // if
+ // (((Node)notifier).getNodeName().equalsIgnoreCase(
+ // "style"))
+ // {
+ visualEditor.hideResizer();
+ visualBuilder.setSelectionRectangle(null);
+ visualBuilder.setText((Node) feature);
+ visualEditor.showResizer();
+ // }
+ }
+ } else {
+ sourceChangeFlag = false;
+ }
+ break;
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
}
- } else {
- sourceChangeFlag = false;
- }
- break;
}
- switcher.stopActiveEditor();
- }
// INodeSelectionListener implementation
public void nodeSelectionChanged(NodeSelectionChangedEvent event) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
+ return;
+ }
+ try {
+ List<?> nodes = event.getSelectedNodes();
+ if (nodes != null && nodes.size() > 0) {
+ Node sourceNode = (Node) nodes.get(0);
+ if (VpeDebug.PRINT_SOURCE_SELECTION_EVENT) {
+ System.out
+ .println(">>>>>>>>>>>>>> nodeSelectionChanged sourceNode: " + sourceNode.getNodeName() + " " + event.getCaretPosition()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (event.getSource() instanceof IContentOutlinePage) {
+ sourceSelectionChanged();
+ }
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- List<?> nodes = event.getSelectedNodes();
- if (nodes != null && nodes.size() > 0) {
- Node sourceNode = (Node) nodes.get(0);
- if (VpeDebug.PRINT_SOURCE_SELECTION_EVENT) {
- System.out
- .println(">>>>>>>>>>>>>> nodeSelectionChanged sourceNode: " + sourceNode.getNodeName() + " " + event.getCaretPosition()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (event.getSource() instanceof IContentOutlinePage) {
- sourceSelectionChanged();
- }
- }
- switcher.stopActiveEditor();
- }
// ITextSelectionListener implementation
// TODO Max Areshau looks like this method don't used
public void textSelectionChanged(TextSelectionChangedEvent event) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
+ return;
+ }
+ try {
+ if (VpeDebug.PRINT_SOURCE_SELECTION_EVENT) {
+ System.out
+ .println(">>>>>>>>>>>>>> textSelectionChanged " + event.getSource()); //$NON-NLS-1$
+ }
+ // if (event.getSource() instanceof StyledText) {
+ sourceSelectionChanged();
+ // }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- if (VpeDebug.PRINT_SOURCE_SELECTION_EVENT) {
- System.out
- .println(">>>>>>>>>>>>>> textSelectionChanged " + event.getSource()); //$NON-NLS-1$
- }
- // if (event.getSource() instanceof StyledText) {
- sourceSelectionChanged();
- // }
- switcher.stopActiveEditor();
- }
// SelectionListener implementation
public void widgetSelected(SelectionEvent event) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
+ return;
+ }
+ try {
+ if (VpeDebug.PRINT_SOURCE_SELECTION_EVENT) {
+ System.out.println(">>>>>>>>>>>>>> widgetSelected"); //$NON-NLS-1$
+ }
+ if (event.getSource() instanceof StyledText) {
+ sourceSelectionChanged();
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- if (VpeDebug.PRINT_SOURCE_SELECTION_EVENT) {
- System.out.println(">>>>>>>>>>>>>> widgetSelected"); //$NON-NLS-1$
- }
- if (event.getSource() instanceof StyledText) {
- sourceSelectionChanged();
- }
- switcher.stopActiveEditor();
- }
public void widgetDefaultSelected(SelectionEvent event) {
if (VpeDebug.PRINT_SOURCE_SELECTION_EVENT) {
@@ -743,393 +765,477 @@
}
public void sourceSelectionToVisualSelection(boolean showCaret) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
+ return;
+ }
+ try {
+ sourceSelectionChanged(showCaret);
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- sourceSelectionChanged(showCaret);
- switcher.stopActiveEditor();
- }
// IModelLifecycleListener implementation
public void processPreModelEvent(ModelLifecycleEvent event) {
}
public void processPostModelEvent(ModelLifecycleEvent event) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
+ return;
+ }
+ try {
+ /*
+ * Added by Max Areshkau JBIDE-1457
+ * ModelLifecycleEvent.MODEL_RELEASED generated when model in model
+ * calls methods releaseFromRead() or releaseFromEdit(). When editor
+ * is open he has only when href on model, so nothing can generated
+ * this event.When editor closes generation of this event depends
+ * from cantains any service href on model or not. It's can be a
+ * reason of problems on reopen file.
+ *
+ * We shouldn't call here rebuild dom.
+ */
+ if (event.getType() == ModelLifecycleEvent.MODEL_RELEASED) {
+ if (VpeDebug.PRINT_SOURCE_MODEL_LIFECYCLE_EVENT) {
+ System.out
+ .println(">>> processPostModelEvent: " + event.toString()); //$NON-NLS-1$
+ }
+ visualBuilder.setSelectionRectangle(null);
+ IStructuredModel model = event.getModel();
+ model.removeModelLifecycleListener(this);
+ IDOMModel sourceModel = (IDOMModel) getModel();
+ sourceModel.addModelLifecycleListener(this);
+ bundle.clearAll();
+ bundle.refresh();
+ visualBuilder.setSelectionRectangle(null);
+ IDOMDocument sourceDocument = sourceModel.getDocument();
+ // JBIDE-1457
+ // visualBuilder.rebuildDom(sourceDocument);
+ // pageContext.fireTaglibsChanged();
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- /*
- * Added by Max Areshkau JBIDE-1457 ModelLifecycleEvent.MODEL_RELEASED
- * generated when model in model calls methods releaseFromRead() or
- * releaseFromEdit(). When editor is open he has only when href on
- * model, so nothing can generated this event.When editor closes
- * generation of this event depends from cantains any service href on
- * model or not. It's can be a reason of problems on reopen file.
- *
- * We shouldn't call here rebuild dom.
- */
- if (event.getType() == ModelLifecycleEvent.MODEL_RELEASED) {
- if (VpeDebug.PRINT_SOURCE_MODEL_LIFECYCLE_EVENT) {
- System.out
- .println(">>> processPostModelEvent: " + event.toString()); //$NON-NLS-1$
- }
- visualBuilder.setSelectionRectangle(null);
- IStructuredModel model = event.getModel();
- model.removeModelLifecycleListener(this);
- IDOMModel sourceModel = (IDOMModel) getModel();
- sourceModel.addModelLifecycleListener(this);
- bundle.clearAll();
- bundle.refresh();
- visualBuilder.setSelectionRectangle(null);
- IDOMDocument sourceDocument = sourceModel.getDocument();
- // JBIDE-1457
- // visualBuilder.rebuildDom(sourceDocument);
- // pageContext.fireTaglibsChanged();
- }
- switcher.stopActiveEditor();
- }
// EditorDomEventListener implementation
public void subtreeModified(nsIDOMMutationEvent mutationEvent) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
+ printVisualEvent(mutationEvent);
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
- printVisualEvent(mutationEvent);
- }
- switcher.stopActiveEditor();
- }
public void nodeInserted(nsIDOMMutationEvent mutationEvent) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
+ printVisualEvent(mutationEvent);
+ }
+ nsIDOMNode targetNode = mutationEvent.getRelatedNode();
+ if (!VpeVisualDomBuilder.isAnonElement(targetNode)) {
+ sourceBuilder.addNode(targetNode);
+ visualBuilder.resetPseudoElement(targetNode);
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
- printVisualEvent(mutationEvent);
- }
- nsIDOMNode targetNode = mutationEvent.getRelatedNode();
- if (!VpeVisualDomBuilder.isAnonElement(targetNode)) {
- sourceBuilder.addNode(targetNode);
- visualBuilder.resetPseudoElement(targetNode);
- }
- switcher.stopActiveEditor();
- }
public void nodeRemoved(nsIDOMMutationEvent mutationEvent) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
+ printVisualEvent(mutationEvent);
+ }
+ nsIDOMNode targetNode = VisualDomUtil.getTargetNode(mutationEvent);
+ if (!VpeVisualDomBuilder.isAnonElement(targetNode)) {
+ visualBuilder.setSelectionRectangle(null);
+ sourceBuilder.removeNode(targetNode);
+ visualBuilder.resetPseudoElement(targetNode);
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
- printVisualEvent(mutationEvent);
- }
- nsIDOMNode targetNode = VisualDomUtil.getTargetNode(mutationEvent);
- if (!VpeVisualDomBuilder.isAnonElement(targetNode)) {
- visualBuilder.setSelectionRectangle(null);
- sourceBuilder.removeNode(targetNode);
- visualBuilder.resetPseudoElement(targetNode);
- }
- switcher.stopActiveEditor();
- }
public void nodeRemovedFromDocument(nsIDOMMutationEvent mutationEvent) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
+ printVisualEvent(mutationEvent);
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
- printVisualEvent(mutationEvent);
- }
- switcher.stopActiveEditor();
- }
public void nodeInsertedIntoDocument(nsIDOMMutationEvent mutationEvent) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
+ printVisualEvent(mutationEvent);
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
- printVisualEvent(mutationEvent);
- }
- switcher.stopActiveEditor();
- }
public void attrModified(nsIDOMMutationEvent mutationEvent) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
- }
- if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
- printVisualEvent(mutationEvent);
- }
- switcher.stopActiveEditor();
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
+ printVisualEvent(mutationEvent);
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
public void characterDataModified(nsIDOMMutationEvent mutationEvent) {
-
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
- }
- if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
- printVisualEvent(mutationEvent);
- }
- nsIDOMNode targetNode = VisualDomUtil.getTargetNode(mutationEvent);
- sourceBuilder.setText(targetNode);
- visualBuilder.resetPseudoElement(targetNode);
- switcher.stopActiveEditor();
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ if (VpeDebug.PRINT_VISUAL_MUTATION_EVENT) {
+ printVisualEvent(mutationEvent);
+ }
+ nsIDOMNode targetNode = VisualDomUtil.getTargetNode(mutationEvent);
+ sourceBuilder.setText(targetNode);
+ visualBuilder.resetPseudoElement(targetNode);
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
public void notifySelectionChanged(nsIDOMDocument doc,
- nsISelection selection, short reason) {
- if (switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- mouseUpSelectionReasonFlag = (reason & nsISelectionListener.MOUSEUP_REASON) > 0;
- if (mouseUpSelectionReasonFlag
- || reason == nsISelectionListener.NO_REASON
- || reason == nsISelectionListener.KEYPRESS_REASON
- || reason == nsISelectionListener.SELECTALL_REASON
- || (reason & nsISelectionListener.MOUSEDOWN_REASON) > 0) {
- if (VpeDebug.PRINT_VISUAL_SELECTION_EVENT) {
- System.out.println("<<< notifySelectionChanged: " + reason); //$NON-NLS-1$
+ nsISelection selection, short reason) {
+ if (switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ try {
+ mouseUpSelectionReasonFlag = (reason & nsISelectionListener.MOUSEUP_REASON) > 0;
+ if (mouseUpSelectionReasonFlag
+ || reason == nsISelectionListener.NO_REASON
+ || reason == nsISelectionListener.KEYPRESS_REASON
+ || reason == nsISelectionListener.SELECTALL_REASON
+ || (reason & nsISelectionListener.MOUSEDOWN_REASON) > 0) {
+ if (VpeDebug.PRINT_VISUAL_SELECTION_EVENT) {
+ System.out
+ .println("<<< notifySelectionChanged: " + reason); //$NON-NLS-1$
+ }
+ selectionBuilder.setSelection(selection);
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- selectionBuilder.setSelection(selection);
- }
- switcher.stopActiveEditor();
}
- }
public void mouseDown(nsIDOMMouseEvent mouseEvent) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
- }
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ mouseDownSelectionFlag = false;
+ VpeTemplate template = TemplateManagingUtil
+ .getTemplateByVisualSelection(pageContext, VisualDomUtil
+ .getTargetNode(mouseEvent));
+ if (template instanceof ITemplateSelectionManager) {
+ ((ITemplateSelectionManager) template).setSelectionByMouse(
+ pageContext, visualSelectionController, mouseEvent);
+ mouseDownSelectionFlag = true;
+ } else {
+ nsIDOMElement visualDragElement = selectionBuilder
+ .getDragElement(mouseEvent);
+ if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
+ nsIDOMNode visualNode = VisualDomUtil
+ .getTargetNode(mouseEvent);
+ System.out
+ .println("<<< mouseDown targetNode: " + visualNode.getNodeName() + " (" + visualNode + ") selectedElement: " + (visualDragElement != null ? visualDragElement.getNodeName() + " (" + visualDragElement + ")" : null)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ }
- mouseDownSelectionFlag = false;
+ if (visualDragElement != null) {
- VpeTemplate template = TemplateManagingUtil
- .getTemplateByVisualSelection(pageContext, VisualDomUtil
- .getTargetNode(mouseEvent));
+ // we shouldn't change selection when we click on <input
+ // type="text" /> element,
+ // because if we change after resizing the input element
+ // lost
+ // selection
+ // if(!(HTML.TAG_INPUT.equalsIgnoreCase(visualDragElement.
+ // getNodeName())&&
+ // HTML.ATTR_TEXT.equalsIgnoreCase(visualDragElement.
+ // getAttribute(HTML.ATTR_TYPE))
+ // &&visualDragElement.getAttribute(HTML.ATTR_TYPE)!=null))
+ // {
- if (template instanceof ITemplateSelectionManager) {
-
- ((ITemplateSelectionManager) template).setSelectionByMouse(
- pageContext, visualSelectionController, mouseEvent);
-
- mouseDownSelectionFlag = true;
-
- } else {
- nsIDOMElement visualDragElement = selectionBuilder
- .getDragElement(mouseEvent);
- if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
- nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
- System.out
- .println("<<< mouseDown targetNode: " + visualNode.getNodeName() + " (" + visualNode + ") selectedElement: " + (visualDragElement != null ? visualDragElement.getNodeName() + " (" + visualDragElement + ")" : null)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- }
-
- if (visualDragElement != null) {
-
- // we shouldn't change selection when we click on <input
- // type="text" /> element,
- // because if we change after resizing the input element lost
- // selection
- // if(!(HTML.TAG_INPUT.equalsIgnoreCase(visualDragElement.getNodeName())&&
- // HTML.ATTR_TEXT.equalsIgnoreCase(visualDragElement.getAttribute(HTML.ATTR_TYPE))
- // &&visualDragElement.getAttribute(HTML.ATTR_TYPE)!=null)) {
-
- selectionBuilder.setVisualElementSelection(visualDragElement);
- mouseDownSelectionFlag = true;
- // }
- } else {
- selectionBuilder.setCaretAtMouse(mouseEvent);
- }
+ selectionBuilder
+ .setVisualElementSelection(visualDragElement);
+ mouseDownSelectionFlag = true;
+ // }
+ } else {
+ selectionBuilder.setCaretAtMouse(mouseEvent);
+ }
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- switcher.stopActiveEditor();
- }
public void mouseUp(nsIDOMMouseEvent mouseEvent) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
+ System.out.println("<<< mouseUp"); //$NON-NLS-1$
+ }
+ if (mouseDownSelectionFlag) {
+ mouseEvent.preventDefault();
+ mouseEvent.stopPropagation();
+ mouseDownSelectionFlag = false;
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
- System.out.println("<<< mouseUp"); //$NON-NLS-1$
- }
- if (mouseDownSelectionFlag) {
- mouseEvent.preventDefault();
- mouseEvent.stopPropagation();
- mouseDownSelectionFlag = false;
- }
- switcher.stopActiveEditor();
- }
public void mouseClick(nsIDOMMouseEvent mouseEvent) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
- }
- nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
+ if (visualNode != null) {
+ if (!mouseUpSelectionReasonFlag) {
+ if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
+ System.out
+ .println("<<< mouseClick visualNode: " + visualNode.getNodeName() + " (" + visualNode + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ if (visualBuilder.isContentArea(visualNode)) {
+ selectionBuilder.setClickContentAreaSelection();
+ }
+ } else {
+ mouseUpSelectionReasonFlag = false;
+ }
- if (visualNode != null) {
- if (!mouseUpSelectionReasonFlag) {
- if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
- System.out
- .println("<<< mouseClick visualNode: " + visualNode.getNodeName() + " (" + visualNode + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- if (visualBuilder.isContentArea(visualNode)) {
- selectionBuilder.setClickContentAreaSelection();
- }
- } else {
- mouseUpSelectionReasonFlag = false;
- }
-
- if (visualBuilder.doToggle(VisualDomUtil.getTargetNode(mouseEvent))) {
- selectionBuilder.setClickContentAreaSelection();
- }
- }
- switcher.stopActiveEditor();
+ if (visualBuilder.doToggle(VisualDomUtil
+ .getTargetNode(mouseEvent))) {
+ selectionBuilder.setClickContentAreaSelection();
+ }
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
public void mouseDblClick(nsIDOMMouseEvent mouseEvent) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
+ if (visualNode != null) {
+ if (!sourceBuilder.openBundleEditors(visualNode)) {
+ sourceBuilder.openIncludeEditor(visualNode);
+ }
+ if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
+ System.out
+ .println("<<< mouseDblClick visualNode: " + visualNode.getNodeName() + " (" + visualNode + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
- if (visualNode != null) {
- if (!sourceBuilder.openBundleEditors(visualNode)) {
- sourceBuilder.openIncludeEditor(visualNode);
- }
- if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
- System.out
- .println("<<< mouseDblClick visualNode: " + visualNode.getNodeName() + " (" + visualNode + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- switcher.stopActiveEditor();
- }
public void mouseMove(nsIDOMMouseEvent mouseEvent) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
+ if (visualNode != null) {
+ if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
+ System.out.println("<<< mouseMove visualNode: "
+ + visualNode.getNodeName() + " (" + visualNode
+ + ")");
+ }
+ visualBuilder.setMoveCursor(mouseEvent);
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
- if (visualNode != null) {
- if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
- System.out.println("<<< mouseMove visualNode: "
- + visualNode.getNodeName() + " (" + visualNode + ")");
- }
- visualBuilder.setMoveCursor(mouseEvent);
- }
- switcher.stopActiveEditor();
- }
public void keyPress(nsIDOMKeyEvent keyEvent) {
- if (VpeDebug.PRINT_VISUAL_KEY_EVENT) {
- System.out
- .println("<<< keyPress type: " + keyEvent.getType() + " Ctrl: " + keyEvent.getCtrlKey() + " Shift: " + keyEvent.getShiftKey() + " CharCode: " + keyEvent.getCharCode() + " KeyCode: " + keyEvent.getKeyCode()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- }
+ if (VpeDebug.PRINT_VISUAL_KEY_EVENT) {
+ System.out
+ .println("<<< keyPress type: " + keyEvent.getType() + " Ctrl: " + keyEvent.getCtrlKey() + " Shift: " + keyEvent.getShiftKey() + " CharCode: " + keyEvent.getCharCode() + " KeyCode: " + keyEvent.getKeyCode()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ }
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ switcher.stopActiveEditor();
+ return;
+ }
+ try {
+ visualEditor.hideResizer();
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- switcher.stopActiveEditor();
- return;
- }
+ try {
+ if (visualKeyHandler.keyPressHandler(keyEvent)) {
+ switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL);
+ try {
+ // Edward
+ sourceSelectionChanged(true);
+ visualSelectionController.setCaretEnabled(true);
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
+ } else {
+ // adding calls of core event handlers, for example' CTR+H' or
+ //' CTRL+M' event handler dialog
+ Event keyboardEvent = new Event();
+ // widget where event occur
+ keyboardEvent.widget = xulRunnerEditor.getBrowser();
- visualEditor.hideResizer();
- switcher.stopActiveEditor();
+ keyboardEvent.stateMask = (keyEvent.getAltKey() ? SWT.ALT : 0)
+ | (keyEvent.getCtrlKey() ? SWT.CTRL : 0)
+ | (keyEvent.getShiftKey() ? SWT.SHIFT : 0)
+ | (keyEvent.getMetaKey() ? SWT.MOD1 : 0);
+ keyboardEvent.x = 0;
+ keyboardEvent.y = 0;
+ keyboardEvent.type = SWT.KeyDown;
- try {
- if (visualKeyHandler.keyPressHandler(keyEvent)) {
- switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL);
- // Edward
- sourceSelectionChanged(true);
- visualSelectionController.setCaretEnabled(true);
- switcher.stopActiveEditor();
- } else {
- // adding calls of core event handlers, for example 'CTR+H' or
- // 'CTRL+M' event handler dialog
- Event keyboardEvent = new Event();
- // widget where event occur
- keyboardEvent.widget = xulRunnerEditor.getBrowser();
+ if (keyEvent.getKeyCode() == 0) {
+ keyboardEvent.keyCode = (int) keyEvent.getCharCode();
+ } else {
+ keyboardEvent.keyCode = (int) keyEvent.getKeyCode();
+ }
+ // JBIDE-1627
+ List<KeyStroke> possibleKeyStrokes = WorkbenchKeyboard
+ .generatePossibleKeyStrokes(keyboardEvent);
+ IWorkbench iWorkbench = VpePlugin.getDefault().getWorkbench();
+ if (iWorkbench.hasService(IBindingService.class)) {
+ IBindingService iBindingService = (IBindingService) iWorkbench
+ .getService(IBindingService.class);
- keyboardEvent.stateMask = (keyEvent.getAltKey() ? SWT.ALT : 0)
- | (keyEvent.getCtrlKey() ? SWT.CTRL : 0)
- | (keyEvent.getShiftKey() ? SWT.SHIFT : 0)
- | (keyEvent.getMetaKey() ? SWT.MOD1 : 0);
- keyboardEvent.x = 0;
- keyboardEvent.y = 0;
- keyboardEvent.type = SWT.KeyDown;
+ KeySequence sequenceBeforeKeyStroke = KeySequence
+ .getInstance();
+ for (Iterator<KeyStroke> iterator = possibleKeyStrokes
+ .iterator(); iterator.hasNext();) {
+ KeySequence sequenceAfterKeyStroke = KeySequence
+ .getInstance(sequenceBeforeKeyStroke, iterator
+ .next());
+ if (iBindingService
+ .isPerfectMatch(sequenceAfterKeyStroke)) {
+ final Binding binding = iBindingService
+ .getPerfectMatch(sequenceAfterKeyStroke);
- if (keyEvent.getKeyCode() == 0) {
-
- keyboardEvent.keyCode = (int) keyEvent.getCharCode();
- } else {
- keyboardEvent.keyCode = (int) keyEvent.getKeyCode();
- }
-
- // JBIDE-1627
- List<KeyStroke> possibleKeyStrokes = WorkbenchKeyboard
- .generatePossibleKeyStrokes(keyboardEvent);
- IWorkbench iWorkbench = VpePlugin.getDefault().getWorkbench();
- if (iWorkbench.hasService(IBindingService.class)) {
- IBindingService iBindingService = (IBindingService) iWorkbench
- .getService(IBindingService.class);
-
- KeySequence sequenceBeforeKeyStroke = KeySequence
- .getInstance();
- for (Iterator<KeyStroke> iterator = possibleKeyStrokes
- .iterator(); iterator.hasNext();) {
- KeySequence sequenceAfterKeyStroke = KeySequence
- .getInstance(sequenceBeforeKeyStroke, iterator
- .next());
- if (iBindingService
- .isPerfectMatch(sequenceAfterKeyStroke)) {
- final Binding binding = iBindingService
- .getPerfectMatch(sequenceAfterKeyStroke);
-
- if ((binding != null)
- && (binding.getParameterizedCommand() != null)
- && (binding.getParameterizedCommand()
- .getCommand() != null)
- && ContentAssistCommandAdapter.CONTENT_PROPOSAL_COMMAND
- .equals(binding
- .getParameterizedCommand()
- .getCommand().getId())) {
- keyboardEvent.type = SWT.NONE;
- }
+ if ((binding != null)
+ && (binding.getParameterizedCommand() != null)
+ && (binding.getParameterizedCommand()
+ .getCommand() != null)
+ && ContentAssistCommandAdapter.CONTENT_PROPOSAL_COMMAND
+ .equals(binding
+ .getParameterizedCommand()
+ .getCommand().getId())) {
+ keyboardEvent.type = SWT.NONE;
+ }
+ }
+ }
+ }
+ // sends xulrunner event to eclipse environment
+ getXulRunnerEditor().getBrowser().notifyListeners(
+ keyboardEvent.type, keyboardEvent);
}
- }
+ } catch (Exception e) {
+ VpePlugin.getPluginLog().logError(e);
+ visualRefresh();
}
- // sends xulrunner event to eclipse environment
- getXulRunnerEditor().getBrowser().notifyListeners(
- keyboardEvent.type, keyboardEvent);
-
- }
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
- visualRefresh();
}
- }
-
public void elementResized(nsIDOMElement element, int resizerConstrains,
- int top, int left, int width, int height) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
- }
- visualEditor.hideResizer();
- switcher.stopActiveEditor();
-
- visualBuilder.resize(element, resizerConstrains, top, left, width,
- height);
- sourceSelectionChanged();
+ int top, int left, int width, int height) {
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ visualEditor.hideResizer();
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
+ visualBuilder.resize(element, resizerConstrains, top, left, width, height);
+ sourceSelectionChanged();
}
public void dragGesture(nsIDOMEvent domEvent) {
@@ -1443,15 +1549,19 @@
}
public void visualRefresh() {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
+ return;
+ }
+ try {
+ visualRefreshImpl();
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- visualRefreshImpl();
- switcher.stopActiveEditor();
- }
-
void visualRefreshImpl() {
visualEditor.hideResizer();
@@ -1477,13 +1587,13 @@
}
public void preLongOperation() {
- switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL);
- }
+ switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL);
+ }
public void postLongOperation() {
- switcher.stopActiveEditor();
- visualRefresh();
- }
+ switcher.stopActiveEditor();
+ visualRefresh();
+ }
// for debug
private void printSourceEvent(INodeNotifier notifier, int eventType,
@@ -1602,38 +1712,48 @@
}
void refreshBundleValues() {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
+ return;
+ }
+ try {
+ if (bundle != null) {
+ bundle.refresh();
+ if (pageContext != null) {
+ pageContext.refreshBundleValues();
+ }
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- if (bundle != null) {
- bundle.refresh();
- if (pageContext != null) {
- pageContext.refreshBundleValues();
- }
- }
- switcher.stopActiveEditor();
- }
void refreshTemplates() {
- if (includeList.includesRefresh()) {
- visualRefresh();
- }
- if (templateManager != null) {
- templateManager.reload();
- }
- if (bundle != null) {
- bundle.refresh();
- if (pageContext != null) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
- return;
+ if (includeList.includesRefresh()) {
+ visualRefresh();
}
- pageContext.refreshBundleValues();
- switcher.stopActiveEditor();
- }
+ if (templateManager != null) {
+ templateManager.reload();
+ }
+ if (bundle != null) {
+ bundle.refresh();
+ if (pageContext != null) {
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
+ return;
+ }
+ try {
+ pageContext.refreshBundleValues();
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
+ }
+ }
}
- }
// implements XModelTreeListener
public void nodeChanged(XModelTreeEvent event) {
@@ -2118,49 +2238,50 @@
}
public void dragOver(nsIDOMEvent event) {
-
- visualBuilder.getDnd().dragOver(event, this);
-
+ visualBuilder.getDnd().dragOver(event, this);
}
public void _dragOver(nsIDOMEvent event) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ return;
+ }
+ try {
+ if (VpeDebug.PRINT_VISUAL_DRAGDROP_EVENT) {
+ System.out.println("<<<<<<<<<<<<<<<<<<<< dragOver"); //$NON-NLS-1$
+ }
+ // browser.computeDropPosition(event);
+ boolean canDrop = !xulRunnerEditor.isMozillaDragFlavor();
+ if (canDrop) {
+ Clipboard clipboard = new Clipboard(Display.getCurrent());
+ canDrop = clipboard.getContents(ModelTransfer.getInstance()) != null;
+ }
+ if (canDrop) {
+ canDrop = VpeDndUtil
+ .isDropEnabled((IModelObjectEditorInput) sourceEditor
+ .getEditorInput());
+ }
+ if (canDrop) {
+ VpeVisualCaretInfo caretInfo = selectionBuilder
+ .getVisualCaretInfo(event);
+ canDrop = caretInfo.exist();
+ if (canDrop) {
+ caretInfo.showCaret();
+ } else {
+ caretInfo.hideCaret();
+ }
+ }
+ if (!canDrop) {
+ event.stopPropagation();
+ event.preventDefault();
+ }
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
+ }
}
- if (VpeDebug.PRINT_VISUAL_DRAGDROP_EVENT) {
- System.out.println("<<<<<<<<<<<<<<<<<<<< dragOver"); //$NON-NLS-1$
- }
- // browser.computeDropPosition(event);
-
- boolean canDrop = !xulRunnerEditor.isMozillaDragFlavor();
- if (canDrop) {
- Clipboard clipboard = new Clipboard(Display.getCurrent());
- canDrop = clipboard.getContents(ModelTransfer.getInstance()) != null;
- }
- if (canDrop) {
- canDrop = VpeDndUtil
- .isDropEnabled((IModelObjectEditorInput) sourceEditor
- .getEditorInput());
- }
- if (canDrop) {
- VpeVisualCaretInfo caretInfo = selectionBuilder
- .getVisualCaretInfo(event);
- canDrop = caretInfo.exist();
- if (canDrop) {
- caretInfo.showCaret();
- } else {
- caretInfo.hideCaret();
- }
- }
- if (!canDrop) {
- event.stopPropagation();
- event.preventDefault();
- }
- switcher.stopActiveEditor();
- }
-
public void drop(nsIDOMEvent event) {
if (VpeDebug.PRINT_VISUAL_DRAGDROP_EVENT) {
System.out.println("<<< outerDrop"); //$NON-NLS-1$
@@ -2719,33 +2840,37 @@
}
public void selectionChanged(SelectionChangedEvent event) {
- //FIX for JBIDE-2114
- if (!isVisualEditorVisible()) {
- //selection event doesn't changes a content
-// synced = false;
+ // FIX for JBIDE-2114
+ if (!isVisualEditorVisible()) {
+ // selection event doesn't changes a content
+ // synced = false;
return;
}
- //TODO Max Areshkau Adjust this code, now we haven's source mode
+ // TODO Max Areshkau Adjust this code, now we haven's source mode
if (editPart.getVisualMode() != VpeEditorPart.SOURCE_MODE) {
- if (toolbarFormatControllerManager != null)
- toolbarFormatControllerManager.selectionChanged();
+ if (toolbarFormatControllerManager != null)
+ toolbarFormatControllerManager.selectionChanged();
}
-
+
if (selectionBar != null)
- selectionBar.selectionChanged();
-
+ selectionBar.selectionChanged();
+
if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
- return;
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
+ return;
}
- if (VpeDebug.PRINT_SOURCE_SELECTION_EVENT) {
- System.out
- .println(">>>>>>>>>>>>>> selectionChanged " + event.getSource()); //$NON-NLS-1$
+ try {
+ if (VpeDebug.PRINT_SOURCE_SELECTION_EVENT) {
+ System.out
+ .println(">>>>>>>>>>>>>> selectionChanged " + event.getSource()); //$NON-NLS-1$
+ }
+ sourceSelectionChanged();
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ } finally {
+ switcher.stopActiveEditor();
}
- sourceSelectionChanged();
- switcher.stopActiveEditor();
-
- }
+ }
// nsIClipboardDragDropHooks implementation
public void onPasteOrDrop(nsIDOMMouseEvent mouseEvent, String flavor,
17 years, 10 months
JBoss Tools SVN: r8670 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-06-10 06:24:22 -0400 (Tue, 10 Jun 2008)
New Revision: 8670
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2030, method for stopping switcher was put into "finally" block, in case of exception switcher will be stopped in any case.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-06-10 10:21:16 UTC (rev 8669)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-06-10 10:24:22 UTC (rev 8670)
@@ -659,25 +659,33 @@
}
public void doOperation(int operation) {
- if (operation == UNDO || operation == REDO
- || operation == FORMAT_DOCUMENT
- || operation == FORMAT_ACTIVE_ELEMENTS) {
- if (editor.getVPEController() != null) {
- editor.getVPEController().preLongOperation();
+ if (operation == UNDO || operation == REDO
+ || operation == FORMAT_DOCUMENT
+ || operation == FORMAT_ACTIVE_ELEMENTS) {
+ if (editor.getVPEController() != null) {
+ editor.getVPEController().preLongOperation();
+ }
+ }
+ /*
+ * Fixes http://jira.jboss.com/jira/browse/JBIDE-2030
+ * Stops ActiveEditorSwitcher in any case.
+ * Author: dmaliarevich
+ */
+ try {
+ super.doOperation(operation);
+ } catch (Exception e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ } finally {
+ if (operation == UNDO || operation == REDO
+ || operation == FORMAT_DOCUMENT
+ || operation == FORMAT_ACTIVE_ELEMENTS) {
+ if (editor.getVPEController() != null) {
+ editor.getVPEController().postLongOperation();
+ }
+ }
+ }
}
- }
- super.doOperation(operation);
-
- if (operation == UNDO || operation == REDO
- || operation == FORMAT_DOCUMENT
- || operation == FORMAT_ACTIVE_ELEMENTS) {
- if (editor.getVPEController() != null) {
- editor.getVPEController().postLongOperation();
- }
- }
- }
-
protected void handleDispose() {
if (editor != null && editor.getSourceViewer() != null
&& editor.getSourceViewer().getTextWidget() != null
17 years, 10 months
JBoss Tools SVN: r8669 - trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2008-06-10 06:21:16 -0400 (Tue, 10 Jun 2008)
New Revision: 8669
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossRuntimeListFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage.java
Log:
JBIDE-2261: add validation for changing runtime name
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossRuntimeListFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossRuntimeListFieldEditor.java 2008-06-10 09:43:57 UTC (rev 8668)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossRuntimeListFieldEditor.java 2008-06-10 10:21:16 UTC (rev 8669)
@@ -332,12 +332,15 @@
if (checkedElement == jbossWSRuntime) {
checked = true;
+ tableView.setChecked(checkedElement, true);
break;
}
}
if (!checked) {
- tableView.setChecked(runtimes.get(0), true);
- checkedElement = runtimes.get(0);
+ if (tableView.getCheckedElements() == null) {
+ tableView.setChecked(runtimes.get(0), true);
+ checkedElement = runtimes.get(0);
+ }
}
}
@@ -697,9 +700,13 @@
source.setHomeDir(rt.getHomeDir());
} else {
changed.put(rt, source);
+ if (source.isDefault()) {
+ rt.setDefault(true);
+ }
int i = value.indexOf(source);
if (i >= 0) {
value.set(i, rt);
+
} else {
value.remove(source);
value.add(rt);
@@ -964,12 +971,17 @@
.getActiveShell(), wiz);
dialog.open();
tableView.refresh();
+ JbossWSRuntime c = null;
if (changed.containsValue(selected)) {
- JbossWSRuntime c = findChangedRuntime(selected);
+ c = findChangedRuntime(selected);
if (c != null) {
tableView.setSelection(new StructuredSelection(c));
}
}
+ if (c != null & c.isDefault()) {
+ checkedElement = c;
+ }
+ setDefaultRuntime();
}
private JbossWSRuntime findChangedRuntime(JbossWSRuntime source) {
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage.java 2008-06-10 09:43:57 UTC (rev 8668)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage.java 2008-06-10 10:21:16 UTC (rev 8669)
@@ -29,7 +29,8 @@
/**
* @author Grid Qian
*/
-public class JbossWSRuntimePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+public class JbossWSRuntimePreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
public JbossWSRuntimePreferencePage() {
super();
@@ -42,8 +43,8 @@
"rtlist", JbossWSUIMessages.JBossWS_Preference_Page_Runtimes, new ArrayList<JbossWSRuntime>(Arrays.asList(JbossWSRuntimeManager.getInstance().getRuntimes()))); //$NON-NLS-1$
/**
- * Create contents of JbossWS preferences page. JbossWSRuntime list editor is
- * created
+ * Create contents of JbossWS preferences page. JbossWSRuntime list editor
+ * is created
*
* @return Control
*/
@@ -80,23 +81,30 @@
JbossWSRuntimeManager.getInstance().removeRuntime(rt);
}
jbossWSRuntimes.getRemoved().clear();
- JbossWSRuntime defaultRuntime = jbossWSRuntimes.getDefaultJbossWSRuntime();
- // reset default runtime
- for (JbossWSRuntime jbossWSRuntime : JbossWSRuntimeManager.getInstance().getRuntimes()) {
- jbossWSRuntime.setDefault(false);
+ JbossWSRuntime defaultRuntime = jbossWSRuntimes
+ .getDefaultJbossWSRuntime();
+ // reset default runtime
+ for (JbossWSRuntime jbossWSRuntime : JbossWSRuntimeManager
+ .getInstance().getRuntimes()) {
+ jbossWSRuntime.setDefault(false);
}
// set deafult runtime
- defaultRuntime.setDefault(true);
+ if (defaultRuntime != null) {
+ defaultRuntime.setDefault(true);
+ }
jbossWSRuntimes.setDefaultJbossWSRuntime(null);
- Map<JbossWSRuntime, JbossWSRuntime> changed = jbossWSRuntimes.getChangedJbossWSRuntimes();
+ Map<JbossWSRuntime, JbossWSRuntime> changed = jbossWSRuntimes
+ .getChangedJbossWSRuntimes();
for (JbossWSRuntime c : changed.keySet()) {
JbossWSRuntime o = changed.get(c);
o.setHomeDir(c.getHomeDir());
String oldName = o.getName();
String newName = c.getName();
if (!oldName.equals(newName)) {
- JbossWSRuntimeManager.getInstance().changeRuntimeName(oldName, newName);
+ JbossWSRuntimeManager.getInstance().changeRuntimeName(oldName,
+ newName);
}
+ o.setDefault(c.isDefault());
}
jbossWSRuntimes.getChangedJbossWSRuntimes().clear();
17 years, 10 months
JBoss Tools SVN: r8668 - trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-06-10 05:43:57 -0400 (Tue, 10 Jun 2008)
New Revision: 8668
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide/JBide2227TestCase.java
Log:
Change testcases.
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide/JBide2227TestCase.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide/JBide2227TestCase.java 2008-06-10 09:32:49 UTC (rev 8667)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide/JBide2227TestCase.java 2008-06-10 09:43:57 UTC (rev 8668)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.seam.ui.test.jbide;
@@ -21,57 +31,118 @@
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
-import org.jboss.tools.jst.jsp.test.ca.ContentAssistantTestCase;
import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
/**
* The Class JBide2227TestCase.
*/
-public class JBide2227TestCase extends ContentAssistantTestCase {
+public class JBide2227TestCase extends VpeTest {
+ /** The Constant CA_NAME. */
+ private static final String CA_NAME = "org.eclipse.wst.html.HTML_DEFAULT";
+
/** The Constant IMPORT_PROJECT_NAME. */
private static final String IMPORT_PROJECT_NAME = "TestSeamELContentAssist";
/** The Constant PAGE_1. */
private static final String PAGE_1 = "/WebContent/jbide2227/withEl.xhtml";
- /** The Constant CA_NAME. */
- private static final String CA_NAME = "org.eclipse.wst.html.HTML_DEFAULT";
+ /** The Constant PAGE_2. */
+ private static final String PAGE_2 = "/WebContent/jbide2227/withoutEl.xhtml";
- /** The provider. */
- private TestProjectProvider provider;
+ /**
+ * Suite.
+ *
+ * @return the test
+ */
+ public static Test suite() {
+ return new TestSuite(JBide2227TestCase.class);
+ }
- /** The project. */
- private IProject project;
-
/** The make copy. */
private boolean makeCopy;
- /** The Constant PAGE_2. */
- private static final String PAGE_2 = "/WebContent/jbide2227/withoutEl.xhtml";
+ /** The project. */
+ private IProject project;
+ /** The provider. */
+ private TestProjectProvider provider;
/**
* The Constructor.
*/
public JBide2227TestCase() {
- super();
+ super("");
}
/**
- * Suite.
+ * The Constructor.
*
- * @return the test
+ * @param name
+ * the name
*/
- public static Test suite() {
- return new TestSuite(JBide2227TestCase.class);
+ public JBide2227TestCase(String name) {
+ super(name);
}
/**
+ * Base checkof CA.
+ *
+ * @param testPagePath
+ * the test page path
+ * @param position
+ * the position
+ * @param caName
+ * the ca name
+ * @param numberOfProposals
+ * the number of proposals
+ *
+ * @throws CoreException
+ * the core exception
+ */
+ protected void check(String caName, String testPagePath, int position, int numberOfProposals) throws CoreException {
+ // get test page path
+ IFile file = project.getFile(testPagePath);
+ assertNotNull("Could not open specified file " + file.getFullPath(), file);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ assertNotNull("Editor input is null", input);
+
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ // sets cursor position
+ part.getSourceEditor().getTextViewer().getTextWidget().setCaretOffset(position);
+ TestUtil.waitForJobs();
+ TestUtil.delay(2000);
+ SourceViewerConfiguration sourceViewerConfiguration = ((JSPTextEditor) part.getSourceEditor())
+ .getSourceViewerConfigurationForTest();
+ // errase errors which can be on start of editor(for example xuklunner
+ // not found)
+ setException(null);
+ StructuredTextViewerConfiguration stvc = (StructuredTextViewerConfiguration) sourceViewerConfiguration;
+ IContentAssistant iContentAssistant = stvc.getContentAssistant((ISourceViewer) part.getSourceEditor().getAdapter(
+ ISourceViewer.class));
+ assertNotNull(iContentAssistant);
+ IContentAssistProcessor iContentAssistProcessor = iContentAssistant.getContentAssistProcessor(caName);
+ assertNotNull(iContentAssistProcessor);
+ ICompletionProposal[] results = iContentAssistProcessor
+ .computeCompletionProposals(part.getSourceEditor().getTextViewer(), position);
+ assertNotNull(results);
+ assertEquals(numberOfProposals, results.length);
+
+ closeEditors();
+ TestUtil.delay(1000L);
+ }
+
+ /**
* Sets the up.
*
- * @throws Exception the exception
+ * @throws Exception
+ * the exception
*/
public void setUp() throws Exception {
provider = new TestProjectProvider("org.jboss.tools.seam.ui.test", null, IMPORT_PROJECT_NAME, makeCopy);
@@ -89,7 +160,8 @@
/**
* Tear down.
*
- * @throws Exception the exception
+ * @throws Exception
+ * the exception
*/
protected void tearDown() throws Exception {
if (provider != null) {
@@ -100,90 +172,34 @@
/**
* Test content assist with el.
*
- * @throws Throwable the throwable
+ * @throws Throwable
+ * the throwable
*/
public void testContentAssistWithEl() throws Throwable {
// wait
TestUtil.waitForJobs();
// set exception
-
- // FIXME Compilation Error
- // setException(null);
-
+ setException(null);
// Tests CA
check(CA_NAME, PAGE_1, 576, 114);
// check exception
- /*
- * FIXME COmpilation error
- * if (getException() != null) {
+ if (getException() != null) {
throw getException();
- }*/
+ }
}
/**
- * Base checkof CA.
- *
- * @param testPagePath the test page path
- * @param position the position
- * @param caName the ca name
- * @param numberOfProposals the number of proposals
- *
- * @throws CoreException the core exception
- */
- protected void check(String caName, String testPagePath, int position, int numberOfProposals) throws CoreException {
- // get test page path
- IFile file = project.getFile(testPagePath);
- assertNotNull("Could not open specified file " + file.getFullPath(), file);
-
- IEditorInput input = new FileEditorInput(file);
-
- assertNotNull("Editor input is null", input);
-
- // open and get editor
- JSPMultiPageEditor part = null;
- // FIXME Compilation Error
- //JSPMultiPageEditor part = openEditor(input);
-
- // sets cursor position
- part.getSourceEditor().getTextViewer().getTextWidget().setCaretOffset(position);
- TestUtil.waitForJobs();
- TestUtil.delay(2000);
- SourceViewerConfiguration sourceViewerConfiguration = ((JSPTextEditor) part.getSourceEditor())
- .getSourceViewerConfigurationForTest();
- // errase errors which can be on start of editor(for example xuklunner
- // not found)
- // FIXME Compilation Errors
- //setException(null);
- StructuredTextViewerConfiguration stvc = (StructuredTextViewerConfiguration) sourceViewerConfiguration;
- IContentAssistant iContentAssistant = stvc.getContentAssistant((ISourceViewer) part.getSourceEditor().getAdapter(
- ISourceViewer.class));
- assertNotNull(iContentAssistant);
- IContentAssistProcessor iContentAssistProcessor = iContentAssistant.getContentAssistProcessor(caName);
- assertNotNull(iContentAssistProcessor);
- ICompletionProposal[] results = iContentAssistProcessor
- .computeCompletionProposals(part.getSourceEditor().getTextViewer(), position);
- assertNotNull(results);
- assertEquals(numberOfProposals, results.length);
-
- // FIXME Compilation Errors
- //closeEditors();
- TestUtil.delay(1000L);
- }
-
- /**
* Test content assist without el.
*
- * @throws Throwable the throwable
+ * @throws Throwable
+ * the throwable
*/
public void testContentAssistWithoutEl() throws Throwable {
TestUtil.waitForJobs();
- /* FIXME Compilation error
- * setException(null);
- */
check(CA_NAME, PAGE_2, 580, 11);
}
17 years, 10 months
JBoss Tools SVN: r8667 - trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-06-10 05:32:49 -0400 (Tue, 10 Jun 2008)
New Revision: 8667
Modified:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java
Log:
Write junit for http://jira.jboss.com/jira/browse/JBIDE-1791 issue.
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java 2008-06-10 09:32:02 UTC (rev 8666)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java 2008-06-10 09:32:49 UTC (rev 8667)
@@ -14,7 +14,6 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
@@ -86,42 +85,44 @@
}
- protected void checkProposals(String fileName, int offset, String[] proposals, boolean exactly){
- checkProposals(fileName, null, offset, proposals, exactly);
- }
+ protected ICompletionProposal[] checkProposals(String fileName, int offset, String[] proposals, boolean exactly) {
+ return checkProposals(fileName, null, offset, proposals, exactly);
+ }
- protected void checkProposals(String fileName, String substring, int offset, String[] proposals, boolean exactly){
+ protected ICompletionProposal[] checkProposals(String fileName, String substring, int offset, String[] proposals, boolean exactly){
openEditor(fileName);
- int position = 0;
- if(substring != null){
- String documentContent = document.get();
- position = documentContent.indexOf(substring);
- }
+ int position = 0;
+ if (substring != null) {
+ String documentContent = document.get();
+ position = documentContent.indexOf(substring);
+ }
- ICompletionProposal[] result= null;
+ ICompletionProposal[] result = null;
- IContentAssistProcessor p= TestUtil.getProcessor(viewer, position+offset, contentAssistant);
- if (p != null) {
- try {
- result= p.computeCompletionProposals(viewer, position+offset);
- } catch (Throwable x) {
- x.printStackTrace();
- }
- }
+ IContentAssistProcessor p = TestUtil.getProcessor(viewer, position + offset, contentAssistant);
+ if (p != null) {
+ try {
+ result = p.computeCompletionProposals(viewer, position + offset);
+ } catch (Throwable x) {
+ x.printStackTrace();
+ }
+ }
- assertTrue("Content Assistant returned no proposals", (result != null && result.length > 0));
+ assertTrue("Content Assistant returned no proposals", (result != null && result.length > 0));
-// for (int i = 0; i < result.length; i++) {
-// System.out.println("proposal - "+result[i].getDisplayString());
-// }
+ // for (int i = 0; i < result.length; i++) {
+ // System.out.println("proposal - "+result[i].getDisplayString());
+ // }
- for (int i = 0; i < proposals.length; i++) {
- assertTrue("Proposal "+proposals[i]+" not found!", compareProposal(proposals[i], result));
- }
+ for (int i = 0; i < proposals.length; i++) {
+ assertTrue("Proposal " + proposals[i] + " not found!", compareProposal(proposals[i], result));
+ }
- if(exactly)
- assertTrue("Some other proposals was found!", result.length == proposals.length);
+ if (exactly) {
+ assertTrue("Some other proposals was found!", result.length == proposals.length);
+ }
+ return result;
}
protected boolean compareProposal(String proposalName, ICompletionProposal[] proposals){
17 years, 10 months
JBoss Tools SVN: r8666 - trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-06-10 05:32:02 -0400 (Tue, 10 Jun 2008)
New Revision: 8666
Added:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java
Log:
Write junit for http://jira.jboss.com/jira/browse/JBIDE-1791 issue.
Added: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java 2008-06-10 09:32:02 UTC (rev 8666)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.test.ca;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.jboss.tools.common.test.util.TestProjectProvider;
+
+/**
+ * Test cast testing http://jira.jboss.com/jira/browse/JBIDE-1791 issue.
+ *
+ * @author Eugene Stherbin
+ *
+ */
+public class Jbide1791Test extends ContentAssistantTestCase {
+ private static final String PROJECT_NAME = "JsfJbide1791Test";
+ private static final String PAGE_NAME = "/WebContent/pages/jbide1791.xhtml";
+ private TestProjectProvider provider = null;
+
+ public static Test suite() {
+ return new TestSuite(Jbide1791Test.class);
+ }
+ public void setUp() throws Exception {
+ provider = new TestProjectProvider("org.jboss.tools.jst.jsp.test", null, PROJECT_NAME,false);
+ project = provider.getProject();
+ Throwable exception = null;
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+ } catch (Exception x) {
+ exception = x;
+ x.printStackTrace();
+ }
+ assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
+ }
+
+ protected void tearDown() throws Exception {
+ if(provider != null) {
+ provider.dispose();
+ }
+ }
+ public void testJbide1791(){
+ final String[] proposals = new String[]{
+ "h1",
+ "h2",
+ "h3",
+ "h4",
+ "h5",
+ "h6",
+ "hr"
+ };
+ final ICompletionProposal[] rst = checkProposals(PAGE_NAME,353, proposals, false);
+
+ checkResult(rst,proposals);
+ }
+ /**
+ * @param rst
+ * @param proposals
+ */
+ private void checkResult(ICompletionProposal[] rst, String[] proposals) {
+ for ( int i = 0 ; i < proposals.length ; i ++ ){
+ assertTrue("Should be in proposals list",isInResultList(rst,proposals[i]));
+ }
+
+ }
+ /**
+ * @param rst
+ * @param string
+ * @return
+ */
+ private boolean isInResultList(ICompletionProposal[] rst, String string) {
+ boolean r = false;
+
+ for(ICompletionProposal cp:rst){
+ if(cp.getDisplayString().equals(string)){
+ r = true;
+ break;
+ }
+ }
+ return r;
+ }
+}
Property changes on: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
17 years, 10 months
JBoss Tools SVN: r8665 - in trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects: JsfJbide1791Test and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-06-10 05:30:45 -0400 (Tue, 10 Jun 2008)
New Revision: 8665
Added:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/
trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/.classpath
trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/.project
trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/WebContent/
trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/WebContent/pages/
trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/WebContent/pages/jbide1791.xhtml
Log:
Write junit for http://jira.jboss.com/jira/browse/JBIDE-1791 issue.
Added: trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/.classpath
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/.classpath (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/.classpath 2008-06-10 09:30:45 UTC (rev 8665)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="JavaSource"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
+</classpath>
Property changes on: trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/.project
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/.project (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/.project 2008-06-10 09:30:45 UTC (rev 8665)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>JsfJspJbide1807Test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/.project
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/WebContent/pages/jbide1791.xhtml
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/WebContent/pages/jbide1791.xhtml (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/WebContent/pages/jbide1791.xhtml 2008-06-10 09:30:45 UTC (rev 8665)
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+ <head>
+ <style type="text/css">
+
+ </style>
+ </head>
+</html>
\ No newline at end of file
Property changes on: trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/WebContent/pages/jbide1791.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/html
Name: svn:eol-style
+ native
17 years, 10 months
JBoss Tools SVN: r8664 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-06-10 05:29:12 -0400 (Tue, 10 Jun 2008)
New Revision: 8664
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java
Log:
Fix http://jira.jboss.com/jira/browse/JBIDE-1791 issue.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java 2008-06-10 09:27:51 UTC (rev 8663)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java 2008-06-10 09:29:12 UTC (rev 8664)
@@ -25,6 +25,8 @@
import org.eclipse.jst.jsp.core.text.IJSPPartitions;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
+import org.eclipse.wst.css.core.text.ICSSPartitions;
+import org.eclipse.wst.css.ui.internal.contentassist.CSSContentAssistProcessor;
import org.eclipse.wst.html.core.text.IHTMLPartitions;
import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
import org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy;
@@ -40,7 +42,8 @@
super();
}
- protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
+ @SuppressWarnings("restriction")
+ protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
// IContentAssistProcessor[] processors = null;
// if we have our own processors we need
@@ -64,6 +67,11 @@
partitionType == IJSPPartitions.JSP_DEFAULT_EL) {
processors.add(new FaceletsHtmlContentAssistProcessor());
}
+ //added by estherbin
+ //fix http://jira.jboss.com/jira/browse/JBIDE-1791
+ if(partitionType.equals(ICSSPartitions.STYLE)){
+ processors.add(new CSSContentAssistProcessor());
+ }
return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
}
17 years, 10 months