JBoss Tools SVN: r21632 - in trunk/esb/plugins/org.jboss.tools.esb.validator: META-INF and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-04-23 08:42:17 -0400 (Fri, 23 Apr 2010)
New Revision: 21632
Added:
trunk/esb/plugins/org.jboss.tools.esb.validator/.classpath
trunk/esb/plugins/org.jboss.tools.esb.validator/.cvsignore
trunk/esb/plugins/org.jboss.tools.esb.validator/.options.template
trunk/esb/plugins/org.jboss.tools.esb.validator/.project
trunk/esb/plugins/org.jboss.tools.esb.validator/.settings/
trunk/esb/plugins/org.jboss.tools.esb.validator/META-INF/
trunk/esb/plugins/org.jboss.tools.esb.validator/META-INF/MANIFEST.MF
trunk/esb/plugins/org.jboss.tools.esb.validator/about.html
trunk/esb/plugins/org.jboss.tools.esb.validator/build.properties
trunk/esb/plugins/org.jboss.tools.esb.validator/images/
trunk/esb/plugins/org.jboss.tools.esb.validator/images/esb/
trunk/esb/plugins/org.jboss.tools.esb.validator/plugin.properties
trunk/esb/plugins/org.jboss.tools.esb.validator/plugin.xml
trunk/esb/plugins/org.jboss.tools.esb.validator/plugin_ja.properties
trunk/esb/plugins/org.jboss.tools.esb.validator/resources/
trunk/esb/plugins/org.jboss.tools.esb.validator/src/
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferenceInitializer.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidationErrorManager.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorMessages.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorPlugin.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages.properties
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages_ja.properties
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.properties
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBValidatorPreferencePage.java
Log:
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/.classpath
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/.classpath (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/.classpath 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/.cvsignore
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/.cvsignore (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/.cvsignore 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,4 @@
+bin
+meta
+yguard.log
+.options
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/.cvsignore
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/.options.template
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/.options.template (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/.options.template 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1 @@
+org.jboss.tools.seam.xml/debug=true
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/.project
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/.project (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/.project 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.esb.validator</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/META-INF/MANIFEST.MF
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/META-INF/MANIFEST.MF (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/META-INF/MANIFEST.MF 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ActivationPolicy: lazy
+Bundle-Name: %pluginName
+Bundle-Activator: org.jboss.tools.esb.validator.ESBValidatorPlugin
+Bundle-ManifestVersion: 2
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.jboss.tools.esb.validator;singleton:=true
+Bundle-Localization: plugin
+Export-Package: org.jboss.tools.esb.validator,
+ org.jboss.tools.esb.validator.ui
+Require-Bundle: org.jboss.tools.jst.web;visibility:=reexport,
+ org.jboss.tools.common.ui,
+ org.jboss.tools.jst.web.kb,
+ org.jboss.tools.esb.core,
+ org.eclipse.ui,
+ org.jboss.tools.esb.project.core,
+ org.eclipse.wst.validation,
+ org.eclipse.jdt.ui
+Bundle-Version: 2.0.0
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/about.html
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/about.html (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/about.html 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+
+<BODY lang="EN-US">
+
+<H3>About This Content</H3>
+
+<P>©2007 Red Hat, Inc. All rights reserved</P>
+
+<H3>License</H3>
+
+<P>Red Hat Inc., through its JBoss division, makes available all content in this plug-in
+("Content"). Unless otherwise indicated below, the Content is provided to you
+under the terms and conditions of the Eclipse Public License Version 1.0
+("EPL"). A copy of the EPL is available at
+<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
+For purposes of the EPL, "Program" will mean the Content.</P>
+
+<P>If you did not receive this Content directly from Red Hat Inc., the
+Content is being redistributed by another party ("Redistributor") and different
+terms and conditions may apply to your use of any object code in the Content.
+Check the Redistributor's license that was provided with the Content. If no such
+license exists, contact the Redistributor. Unless otherwise indicated below, the
+terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at
+ <A href="http://www.jboss.org/tools">http://www.jboss.org/tools</A>.</P>
+
+</BODY>
+</HTML>
\ No newline at end of file
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/about.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/build.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/build.properties (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/build.properties 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,15 @@
+source.. = src/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ plugin.properties,\
+ about.html,\
+ .,\
+ images/
+jars.compile.order = .
+src.includes = src/,\
+ images/,\
+ plugin.xml,\
+ plugin.properties,\
+ build.properties,\
+ about.html,\
+ META-INF/
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/plugin.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/plugin.properties (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/plugin.properties 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,4 @@
+providerName=JBoss by Red Hat
+pluginName=ESB Validator Plugin
+
+PreferencePage_Validator=ESB Validator
\ No newline at end of file
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/plugin.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/plugin.xml
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/plugin.xml (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/plugin.xml 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.jboss.tools.esb.validator.ESBPreferenceInitializer"/>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.jst.web.kb.validator">
+ <validator
+ class="org.jboss.tools.esb.validator.ESBCoreValidator"
+ id="org.jboss.tools.esb.validator.ESBCoreValidator">
+ </validator>
+ </extension>
+
+ <extension point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.jboss.tools.common.model.ui.MainPreferencePage"
+ class="org.jboss.tools.esb.validator.ui.ESBValidatorPreferencePage"
+ id="org.jboss.tools.esb.validator.ui.ESBValidatorPreferencePage"
+ name="%PreferencePage_Validator">
+ </page>
+ </extension>
+
+
+</plugin>
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/plugin.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/plugin_ja.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/plugin_ja.properties (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/plugin_ja.properties 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,2 @@
+providerName=JBoss by Red Hat
+pluginName=ESB \u30B3\u30A2\u30FB\u30D7\u30E9\u30B0\u30A4\u30F3
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/plugin_ja.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,225 @@
+package org.jboss.tools.esb.validator;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.model.util.PositionSearcher;
+import org.jboss.tools.common.text.ITextSourceReference;
+import org.jboss.tools.esb.core.ESBProjectConstant;
+import org.jboss.tools.esb.core.facet.IJBossESBFacetDataModelProperties;
+import org.jboss.tools.esb.core.model.ESBConstants;
+import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
+import org.jboss.tools.jst.web.kb.internal.validation.ProjectValidationContext;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidatingProjectSet;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
+import org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet;
+import org.jboss.tools.jst.web.kb.validation.IValidationContext;
+import org.jboss.tools.jst.web.kb.validation.IValidator;
+import org.jboss.tools.jst.web.model.project.ext.store.XMLValueInfo;
+
+public class ESBCoreValidator extends ESBValidationErrorManager implements IValidator {
+ public static final String ID = "org.jboss.tools.esb.validator.ESBCoreValidator";
+
+ String projectName;
+ Map<IProject, IValidationContext> contexts = new HashMap<IProject, IValidationContext>();
+
+ public String getId() {
+ return ID;
+ }
+
+ public IValidatingProjectSet getValidatingProjects(IProject project) {
+ IValidationContext rootContext = contexts.get(project);
+ if(rootContext == null) {
+ rootContext = new ProjectValidationContext();
+ contexts.put(project, rootContext);
+ }
+
+ List<IProject> projects = new ArrayList<IProject>();
+ projects.add(project);
+ return new ValidatingProjectSet(project, projects, rootContext);
+ }
+
+ public boolean shouldValidate(IProject project) {
+ String esbContentFolder = null;
+
+ try {
+ esbContentFolder = project.getPersistentProperty(IJBossESBFacetDataModelProperties.QNAME_ESB_CONTENT_FOLDER);
+ } catch (CoreException e) {
+ //ignore
+ }
+
+ if(esbContentFolder != null) return true;
+
+ try {
+ return project != null && project.isAccessible() && project.hasNature(ESBProjectConstant.ESB_PROJECT_NATURE);
+ } catch (CoreException e) {
+ ESBValidatorPlugin.log(e);
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#init(org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager, org.eclipse.wst.validation.internal.provisional.core.IReporter, org.jboss.tools.jst.web.kb.validation.IValidationContext)
+ */
+ @Override
+ public void init(IProject project, ContextValidationHelper validationHelper, org.eclipse.wst.validation.internal.provisional.core.IValidator manager, IReporter reporter) {
+ super.init(project, validationHelper, manager, reporter);
+// cdiProject = CDICorePlugin.getCDIProject(project, false);
+ projectName = project.getName();
+ }
+
+ public IStatus validate(Set<IFile> changedFiles, IProject project,
+ ContextValidationHelper validationHelper, ValidatorManager manager,
+ IReporter reporter) throws ValidationException {
+ init(project, validationHelper, manager, reporter);
+
+ for (IFile file: changedFiles) {
+ String name = file.getName();
+ if(!name.endsWith(".xml")) continue;
+ XModelObject o = EclipseResourceUtil.createObjectForResource(file);
+ if(o != null && o.getModelEntity().getName().startsWith(ESBConstants.ENT_ESB_FILE)) {
+ validateESBConfigFile(o, file);
+ }
+ }
+
+ return OK_STATUS;
+ }
+
+ private void validateESBConfigFile(XModelObject object, IFile file) {
+// System.out.println("Validate ESB Config " + file);
+ validateChannelIDRefs(object, file);
+ }
+
+ public IStatus validateAll(IProject project,
+ ContextValidationHelper validationHelper, ValidatorManager manager,
+ IReporter reporter) throws ValidationException {
+ init(project, validationHelper, manager, reporter);
+ displaySubtask(ESBValidatorMessages.VALIDATING_PROJECT, new String[]{projectName});
+
+ String esbContentFolder = null;
+
+ try {
+ esbContentFolder = project.getPersistentProperty(IJBossESBFacetDataModelProperties.QNAME_ESB_CONTENT_FOLDER);
+ } catch (CoreException e) {
+ //ignore
+ }
+
+ if(esbContentFolder != null) {
+ IFolder esbContent = project.getFolder(new Path(esbContentFolder + "/META-INF"));
+ if(esbContent != null && esbContent.exists()) {
+ IResource[] rs = null;
+ try {
+ rs = esbContent.members();
+ } catch (CoreException e) {
+ ESBValidatorPlugin.log(e);
+ }
+ for (IResource r: rs) {
+ if(r instanceof IFile) {
+ IFile file = (IFile)r;
+ String name = file.getName();
+ if(!name.endsWith(".xml")) continue;
+ XModelObject o = EclipseResourceUtil.createObjectForResource(file);
+ if(o != null && o.getModelEntity().getName().startsWith(ESBConstants.ENT_ESB_FILE)) {
+ validateESBConfigFile(o, file);
+ }
+ }
+ }
+ }
+ }
+
+ return OK_STATUS;
+ }
+
+
+ void validateChannelIDRefs(XModelObject object, IFile file) {
+ XModelObject servicesFolder = object.getChildByPath("Services");
+ if(servicesFolder == null) return;
+ Map<String, String> ids = getAllChannelRefIDs(object);
+ XModelObject[] services = servicesFolder.getChildren();
+ for (XModelObject service: services) {
+ XModelObject listenersFolder = service.getChildByPath("Listeners");
+ XModelObject[] listeners = listenersFolder.getChildren();
+ for (XModelObject listener: listeners) {
+ String channelIDRef = listener.getAttributeValue(ESBConstants.ATTR_BUS_ID_REF);
+ if(channelIDRef == null) continue;
+ String entity = ids.get(channelIDRef);
+ if(channelIDRef.length() == 0) {
+ //no id set, it is not an error
+ } else if(entity == null) {
+ //addError - no id found
+ IMarker marker = addError(ESBValidatorMessages.LISTENER_REFERENCES_NON_EXISTENT_CHANNEL,
+ ESBPreferences.LISTENER_REFERENCES_NON_EXISTENT_CHANNEL, getSourceReference(listener, ESBConstants.ATTR_BUS_ID_REF), file);
+ if(marker != null) try {
+ marker.setAttribute("path", listener.getPath());
+ marker.setAttribute("attribute", ESBConstants.ATTR_BUS_ID_REF);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ } else {
+ String busEntityPrefix = getBusEntityPrefix(listener.getModelEntity().getName());
+ if(busEntityPrefix != null && !entity.startsWith(busEntityPrefix)) {
+ IMarker marker = addError(ESBValidatorMessages.LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL,
+ ESBPreferences.LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL, getSourceReference(listener, ESBConstants.ATTR_BUS_ID_REF), file);
+ if(marker != null) try {
+ marker.setAttribute("path", listener.getPath());
+ marker.setAttribute("attribute", ESBConstants.ATTR_BUS_ID_REF);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ }
+ private String getBusEntityPrefix(String listenerEntity) {
+ if(listenerEntity == null) return null;
+ if(listenerEntity.startsWith("ESBListener")) {
+ return null;
+ }
+ if(listenerEntity.startsWith("ESBJCAGateway")) {
+ return "ESBJMSBus";
+ }
+ int i = listenerEntity.indexOf("Listener");
+ if(i < 0) return null;
+ return listenerEntity.substring(0, i) + "Bus";
+ }
+ //id - bus entity
+ private Map<String, String> getAllChannelRefIDs(XModelObject object) {
+ Map<String, String> result = new HashMap<String, String>();
+ XModelObject[] ps = object.getChildByPath("Providers").getChildren();
+ for (int i = 0; i < ps.length; i++) {
+ XModelObject[] cs = ps[i].getChildren();
+ for (int j = 0; j < cs.length; j++) {
+ if(cs[j].getModelEntity().getAttribute(ESBConstants.ATTR_BUS_ID) != null) {
+ String v = cs[j].getAttributeValue(ESBConstants.ATTR_BUS_ID);
+ if(v != null && v.length() > 0) {
+ result.put(v, cs[j].getModelEntity().getName());
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ ITextSourceReference getSourceReference(XModelObject o, String attr) {
+ return new XMLValueInfo(o, attr);
+ }
+}
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferenceInitializer.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferenceInitializer.java (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferenceInitializer.java 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.validator;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class ESBPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(ESBValidatorPlugin.PLUGIN_ID);
+ for (String name : ESBPreferences.SEVERITY_OPTION_NAMES) {
+ defaultPreferences.put(name, SeverityPreferences.ERROR);
+ }
+// defaultPreferences.put(CDIPreferences.DECORATOR_HAS_NAME, CDIPreferences.WARNING);
+ }
+}
\ No newline at end of file
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferenceInitializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.validator;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ESBPreferences extends SeverityPreferences {
+
+ public static final Set<String> SEVERITY_OPTION_NAMES = new HashSet<String>();
+
+ private static ESBPreferences INSTANCE = new ESBPreferences();
+
+ //Channel ID ref group
+
+ public static final String LISTENER_REFERENCES_NON_EXISTENT_CHANNEL = INSTANCE.createSeverityOption("listenerReferencesNonExistentChannel"); //$NON-NLS-1
+ public static final String LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL = INSTANCE.createSeverityOption("listenerReferencesIncompatibleChannel"); //$NON-NLS-1
+
+ /**
+ * @return the only instance of CDIPreferences
+ */
+ public static ESBPreferences getInstance() {
+ return INSTANCE;
+ }
+
+ private ESBPreferences() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.preferences.SeverityPreferences#createSeverityOption(java.lang.String)
+ */
+ @Override
+ protected String createSeverityOption(String shortName) {
+ String name = getPluginId() + ".validator.problem." + shortName; //$NON-NLS-1$
+ SEVERITY_OPTION_NAMES.add(name);
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.preferences.SeverityPreferences#getPluginId()
+ */
+ @Override
+ protected String getPluginId() {
+ return ESBValidatorPlugin.PLUGIN_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.preferences.SeverityPreferences#getSeverityOptionNames()
+ */
+ @Override
+ protected Set<String> getSeverityOptionNames() {
+ return SEVERITY_OPTION_NAMES;
+ }
+
+ public static boolean shouldValidateCore(IProject project) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidationErrorManager.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidationErrorManager.java (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidationErrorManager.java 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.validator;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager;
+
+public class ESBValidationErrorManager extends ValidationErrorManager {
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getPreference(org.eclipse.core.resources.IProject, java.lang.String)
+ */
+ @Override
+ protected String getPreference(IProject project, String preferenceKey) {
+ return ESBPreferences.getInstance().getProjectPreference(project, preferenceKey);
+ }
+}
\ No newline at end of file
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidationErrorManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorMessages.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorMessages.java (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorMessages.java 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.validator;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ESBValidatorMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.esb.validator.messages"; //$NON-NLS-1$
+
+ public static String ESB_CORE_PLUGIN_NO_MESSAGE;
+
+ public static String VALIDATING_RESOURCE;
+ public static String VALIDATING_PROJECT;
+
+ public static String LISTENER_REFERENCES_NON_EXISTENT_CHANNEL;
+ public static String LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, ESBValidatorMessages.class);
+ }
+}
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorPlugin.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorPlugin.java (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorPlugin.java 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.validator;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ */
+public class ESBValidatorPlugin extends AbstractUIPlugin {
+ public static final String PLUGIN_ID = "org.jboss.tools.esb.validator"; //$NON-NLS-1$
+
+ public ESBValidatorPlugin() {
+ super();
+ INSTANCE = this;
+ }
+
+ public static void log(String msg) {
+ if(isDebugEnabled()) INSTANCE.getLog().log(new Status(Status.INFO, PLUGIN_ID, Status.OK, msg, null));
+ }
+
+ public static void log(IStatus status) {
+ if(isDebugEnabled() || !status.isOK()) INSTANCE.getLog().log(status);
+ }
+
+ public static void log(String message, Throwable exception) {
+ INSTANCE.getLog().log(new Status(Status.ERROR, PLUGIN_ID, Status.OK, message, exception));
+ }
+
+ public static void log(Exception ex) {
+ INSTANCE.getLog().log(new Status(Status.ERROR, PLUGIN_ID, Status.OK, ESBValidatorMessages.ESB_CORE_PLUGIN_NO_MESSAGE, ex));
+ }
+
+ public static boolean isDebugEnabled() {
+ return INSTANCE.isDebugging();
+ }
+
+ public static ESBValidatorPlugin getDefault() {
+ return INSTANCE;
+ }
+
+ static ESBValidatorPlugin INSTANCE = null;
+}
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorPlugin.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages.properties (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages.properties 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,6 @@
+ESB_CORE_PLUGIN_NO_MESSAGE=No message
+VALIDATING_RESOURCE=project "{0}"; resource "{1}"
+VALIDATING_PROJECT=project "{0}"
+
+LISTENER_REFERENCES_NON_EXISTENT_CHANNEL=Listener references non-existent channel
+LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL=Listener references incompatible channel
\ No newline at end of file
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages_ja.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages_ja.properties (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages_ja.properties 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1 @@
+ESB_CORE_PLUGIN_NO_MESSAGE=\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u3042\u308A\u307E\u305B\u3093
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages_ja.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.validator.ui;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock;
+import org.jboss.tools.esb.validator.ESBPreferences;
+import org.jboss.tools.esb.validator.ESBValidatorPlugin;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class ESBConfigurationBlock extends SeverityConfigurationBlock {
+
+ private static final String SETTINGS_SECTION_NAME = "CDIValidatorConfigurationBlock";
+
+ private static SectionDescription SECTION_CHANNEL_ID_REF = new SectionDescription(
+ ESBPreferencesMessages.ESBValidatorConfigurationBlock_section_channelidref,
+ new String[][]{
+ {ESBPreferences.LISTENER_REFERENCES_NON_EXISTENT_CHANNEL, ESBPreferencesMessages.ESBValidatorConfigurationBlock_pb_listenerReferencesNonExistentChannel_label},
+ {ESBPreferences.LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL, ESBPreferencesMessages.ESBValidatorConfigurationBlock_pb_listenerReferencesIncompatibleChannel_label},
+ },
+ ESBValidatorPlugin.PLUGIN_ID
+ );
+
+ private static SectionDescription[] ALL_SECTIONS = new SectionDescription[]{
+ SECTION_CHANNEL_ID_REF,
+ };
+
+ private static Key[] getKeys() {
+ ArrayList<Key> keys = new ArrayList<Key>();
+ for (int i = 0; i < ALL_SECTIONS.length; i++) {
+ for (int j = 0; j < ALL_SECTIONS[i].options.length; j++) {
+ keys.add(ALL_SECTIONS[i].options[j].key);
+ }
+ }
+ return keys.toArray(new Key[0]);
+ }
+
+ public ESBConfigurationBlock(IStatusChangeListener context,
+ IProject project, IWorkbenchPreferenceContainer container) {
+ super(context, project, getKeys(), container);
+ }
+
+ @Override
+ protected SectionDescription[] getAllSections() {
+ return ALL_SECTIONS;
+ }
+
+ @Override
+ protected String getCommonDescription() {
+ return ESBPreferencesMessages.ESBValidatorConfigurationBlock_common_description;
+ }
+
+ @Override
+ protected IDialogSettings getDialogSettings() {
+ return ESBValidatorPlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
+ }
+}
\ No newline at end of file
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.java (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.java 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.esb.validator.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class ESBPreferencesMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.esb.validator.ui.ESBPreferencesMessages"; //$NON-NLS-1$
+
+ // Validator Preference page
+ public static String ESBValidatorConfigurationBlock_common_description;
+
+ // Section Name
+ public static String ESBValidatorConfigurationBlock_section_channelidref;
+ public static String ESBValidatorConfigurationBlock_pb_listenerReferencesNonExistentChannel_label;
+ public static String ESBValidatorConfigurationBlock_pb_listenerReferencesIncompatibleChannel_label;
+
+ public static String ESB_VALIDATOR_PREFERENCE_PAGE_ESB_VALIDATOR;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, ESBPreferencesMessages.class);
+ }
+}
\ No newline at end of file
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.properties (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.properties 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,19 @@
+##################################################################################
+### Copyright (c) 2009 Red Hat, Inc.
+### Distributed under license by Red Hat, Inc. All rights reserved.
+### This program is made available under the terms of the
+### Eclipse Public License v1.0 which accompanies this distribution,
+### and is available at http://www.eclipse.org/legal/epl-v10.html
+###
+### Contributors:
+### Red Hat, Inc. - initial API and implementation
+##################################################################################
+
+ESBValidatorConfigurationBlock_common_description=Select the severity level for the following optional ESB Validator problems:
+
+##Section Channel ID Ref
+ESBValidatorConfigurationBlock_section_channelidref=Channel ID Ref
+ESBValidatorConfigurationBlock_pb_listenerReferencesNonExistentChannel_label=Listener References Non-existent Channel:
+ESBValidatorConfigurationBlock_pb_listenerReferencesIncompatibleChannel_label=Listener References Incompatible Channel:
+
+ESB_VALIDATOR_PREFERENCE_PAGE_ESB_VALIDATOR=ESB Validator
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBValidatorPreferencePage.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBValidatorPreferencePage.java (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBValidatorPreferencePage.java 2010-04-23 12:42:17 UTC (rev 21632)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.validator.ui;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.ui.preferences.SeverityPreferencePage;
+import org.jboss.tools.esb.validator.ESBValidatorPlugin;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class ESBValidatorPreferencePage extends SeverityPreferencePage {
+
+ public static final String PREF_ID = "org.jboss.tools.esb.validator.ui.ESBValidatorPreferencePage"; //$NON-NLS-1$
+ public static final String PROP_ID = "org.jboss.tools.esb.validator.ui.propertyPages.ESBValidatorPreferencePage"; //$NON-NLS-1$
+
+ public ESBValidatorPreferencePage() {
+ setPreferenceStore(ESBValidatorPlugin.getDefault().getPreferenceStore());
+ setTitle(ESBPreferencesMessages.ESB_VALIDATOR_PREFERENCE_PAGE_ESB_VALIDATOR);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPreferencePageID()
+ */
+ @Override
+ protected String getPreferencePageID() {
+ return PREF_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPropertyPageID()
+ */
+ @Override
+ protected String getPropertyPageID() {
+ return PROP_ID;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer();
+ fConfigurationBlock = new ESBConfigurationBlock(getNewStatusChangedListener(), getProject(), container);
+
+ super.createControl(parent);
+ }
+}
\ No newline at end of file
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBValidatorPreferencePage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 8 months
JBoss Tools SVN: r21630 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2010-04-23 05:31:18 -0400 (Fri, 23 Apr 2010)
New Revision: 21630
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5042
Enhance DnD support in VPE
- Code cleanup has been done.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2010-04-23 05:27:04 UTC (rev 21629)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2010-04-23 09:31:18 UTC (rev 21630)
@@ -363,39 +363,7 @@
mouseEvent.preventDefault();
mouseEvent.stopPropagation();
-// boolean canDrop = true;
-// //in this condition early was check for xulelement
-// if (getDragService().getCurrentSession().isDataFlavorSupported(VpeController.MODEL_FLAVOR)) {
-// MozillaDropInfo info;
-//
-// if(isInnerDragSession()){
-// info = canInnerDrop(mouseEvent);
-// } else {
-// info = canExternalDrop(mouseEvent, VpeController.MODEL_FLAVOR, ""); //$NON-NLS-1$
-// }
-// if (info != null) {
-// canDrop = info.canDrop();
-// }
-// }
-// //sets possability to drop current element here
-// //Added by estherbin fix jbide-1046
-// VpeSelectionController selectionController = vpeController.getVisualSelectionController();
-// final VpeVisualCaretInfo visualCaretInfo = vpeController.getSelectionBuilder().getVisualCaretInfo(event);
-//
-// final nsIDOMEventTarget target = event.getTarget();
-// final nsIDOMNode targetDomNode = (nsIDOMNode) target.queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
-//// final nsIDOMNode selectedVisualNode = controller.getXulRunnerEditor().getLastSelectedNode();
-// try {
-// if ((targetDomNode.getFirstChild() != null) && (targetDomNode.getFirstChild().getNodeType() == nsIDOMNode.TEXT_NODE)) {
-// selectionController.getSelection(nsISelectionController.SELECTION_NORMAL).collapse(targetDomNode.getFirstChild(),
-// visualCaretInfo.getRageOffset());
-// } else if ((targetDomNode.getNodeType() != nsIDOMNode.TEXT_NODE)) {
-// selectionController.getSelection(nsISelectionController.SELECTION_NORMAL).collapse(targetDomNode, 0);
-// }
-// } catch (XPCOMException xpcome) {
-// event.stopPropagation();
-// event.preventDefault();
-// }
+
}
private void externalDropAny(final String flavor, final String data,
@@ -406,33 +374,9 @@
return;
}
- //vpeController.getSourceEditor().getTextViewer().getTextWidget().setCaretOffset(range.x);
sourceEditor.setHighlightRange(range.x, range.y, true);
((IDNDTextEditor) sourceEditor).runDropCommand(flavor, data);
-// IDropCommand dropCommand = DropCommandFactory.getInstance()
-// .getDropCommand(flavor, JSPTagProposalFactory.getInstance());
-//
-// boolean promptAttributes = JspEditorPlugin.getDefault()
-// .getPreferenceStore().getBoolean(
-// IVpePreferencesPage.ASK_TAG_ATTRIBUTES_ON_TAG_INSERT);
-// dropCommand.getDefaultModel().setPromptForTagAttributesRequired(
-// promptAttributes);
-// DropData dropData = new DropData(flavor, data,
-// vpeController.getSourceEditor().getEditorInput(),
-// (ISourceViewer) vpeController.getSourceEditor().getAdapter(ISourceViewer.class),
-// vpeController.new VpeSelectionProvider(range.x, range.y),
-// container);
-//
-// /*
-// * https://jira.jboss.org/jira/browse/JBIDE-4982 Setting the value
-// * provider to create tag insert dialog.
-// */
-// if (vpeController.getSourceEditor() instanceof JSPTextEditor) {
-// dropData.setValueProvider(((JSPTextEditor) vpeController.getSourceEditor())
-// .createAttributeDescriptorValueProvider());
-// }
-//
-// dropCommand.execute(dropData);
+
}
private boolean isInnerDragSession() {
@@ -493,78 +437,6 @@
return canDrag;
}
-// this method is never used
-// private MozillaDropInfo canInnerDrop(nsIDOMMouseEvent event) {
-// vpeController.onHideTooltip();
-//
-// if (vpeController.getDropWindow().isActive()) {
-// if (!event.getAltKey()) {
-// vpeController.getDropWindow().close();
-// } else {
-// return null;
-// }
-// }
-// if (event.getAltKey()) {
-// nsIDOMNode visualNode = VisualDomUtil.getTargetNode(event);
-// Node sourceNode = vpeController.getDomMapping().getNearSourceNode(visualNode);
-// if (sourceNode != null) {
-// vpeController.getDropWindow().setActive(true);
-// vpeController.getDropWindow().setEventPosition(event.getScreenX(), event
-// .getScreenY());
-// vpeController.getDropWindow().setInitialTargetNode(sourceNode);
-// vpeController.getDropWindow().open();
-// event.stopPropagation();
-// event.preventDefault();
-// return null;
-// }
-// }
-// if (VpeDebug.PRINT_VISUAL_INNER_DRAGDROP_EVENT) {
-// System.out.print("<<<<<< canInnerDrop"); //$NON-NLS-1$
-// }
-// boolean canDrop = false;
-//
-// nsIDOMNode caretParent = null;
-// long caretOffset = 0;
-// if (sourceInnerDragInfo != null) {
-// VpeVisualDropInfo visualDropInfo = getDropInfo(event);
-// if (visualDropInfo.getDropContainer() != null) {
-// if (VpeDebug.PRINT_VISUAL_INNER_DRAGDROP_EVENT) {
-// System.out.print(" container: " //$NON-NLS-1$
-// + visualDropInfo.getDropContainer().getNodeName()
-// + "(" //$NON-NLS-1$
-// + visualDropInfo.getDropContainer()
-// + ") parent: " //$NON-NLS-1$
-// + visualDropInfo.getDropContainer().getParentNode()
-// .getNodeName()
-// + "(" //$NON-NLS-1$
-// + visualDropInfo.getDropContainer().getParentNode()
-// + ") offset: " //$NON-NLS-1$
-// + visualDropInfo.getDropOffset());
-// }
-// VpeSourceDropInfo sourceDropInfo
-// = getSourceDropInfo(sourceInnerDragInfo.getNode(),
-// visualDropInfo, true);
-// canDrop = sourceDropInfo.canDrop();
-// if (canDrop) {
-// VpeVisualDropInfo newVisualDropInfo
-// = getDropInfo(sourceDropInfo.getContainer(),
-// sourceDropInfo.getOffset());
-// if (newVisualDropInfo != null) {
-// correctVisualDropPosition(event,
-// newVisualDropInfo, visualDropInfo);
-// caretParent = newVisualDropInfo.getDropContainer();
-// caretOffset = newVisualDropInfo.getDropOffset();
-// }
-// }
-// }
-// visualDropInfo.release();
-// }
-// if (VpeDebug.PRINT_VISUAL_INNER_DRAGDROP_EVENT) {
-// System.out.println(" canDrop: " + canDrop); //$NON-NLS-1$
-// }
-// return new MozillaDropInfo(canDrop, caretParent, caretOffset);
-// }
-
private void innerDrop(nsIDOMMouseEvent event) {
vpeController.onHideTooltip();
@@ -607,11 +479,6 @@
Point range = getSourceSelectionRange(
dropInfo.getContainer(), dropInfo.getOffset());
- // if (MODEL_FLAVOR.equals(flavor)) {
- // XModelObject object = PreferenceModelUtilities.getPreferenceModel()
- // .getModelBuffer().source();
- // if(object == null)
-
final DragTransferData dragTransferData = DndUtil.getDragTransferData();
final nsISupports aValue = dragTransferData.getValue();
@@ -640,30 +507,7 @@
aFlavor = DndUtil.kURLMime;
}
}
-
- // if (object.getFileType() == XModelObject.FILE
- // && !TLDUtil.isTaglib(object)) {
- // flavor = "application/x-moz-file"; //$NON-NLS-1$
- // IFile f = (IFile) EclipseResourceUtil.getResource(object);
- // try {
- // data = f.getLocation().toFile().toURL().toString();
- // } catch (Exception e) {
- // VpePlugin.getPluginLog().logError(e);
- // }
- // } else {
- // String tagname = getTagName(object);
- // if (tagname.indexOf("taglib") >= 0)tagname = "taglib"; //$NON-NLS-1$ //$NON-NLS-2$
- // Node sourceDragNode = ((Document) getModel().getAdapter(
- // Document.class)).createElement(tagname);
- // if (visualDropInfo.getDropContainer() != null) {
- // sourceDropInfo = vpeController.getVisualBuilder().getSourceDropInfo(
- // sourceDragNode, visualDropInfo, true);
- // range = vpeController.getSelectionBuilder().getSourceSelectionRange(
- // sourceDropInfo.getContainer(), sourceDropInfo
- // .getOffset());
- // }
- // }
-
+
if (dropInfo.getContainer() != null && data != null) {
if (VpeDebug.PRINT_VISUAL_INNER_DRAGDROP_EVENT) {
System.out
14 years, 8 months
JBoss Tools SVN: r21629 - branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2010-04-23 01:27:04 -0400 (Fri, 23 Apr 2010)
New Revision: 21629
Modified:
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java
Log:
JBIDE-6175: to 3.1.x branch
Modified: branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
===================================================================
--- branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2010-04-23 04:43:50 UTC (rev 21628)
+++ branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2010-04-23 05:27:04 UTC (rev 21629)
@@ -43,14 +43,14 @@
this.model = model;
cmdFileName_linux = getCommandLineFileName_linux();
cmdFileName_win = getCommandLineFileName_win();
-
+
}
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
- if(monitor==null) {
- monitor=new NullProgressMonitor();
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
}
try {
monitor.beginTask("", 100); //$NON-NLS-1$
@@ -114,11 +114,14 @@
JBossWSCreationCore.getDefault().logError(
inputResult.toString());
-// there is no way to know if the failure of invoking is because of failure of
-// compiling or because of failure of generating java code, so try to analyze the
-// output string of the command, if the string contains "javac -d", means the java
-// java code generating is complete.
-
+ // there is no way to know if the failure of invoking is
+ // because of failure of
+ // compiling or because of failure of generating java code,
+ // so try to analyze the
+ // output string of the command, if the string contains
+ // "javac -d", means the java
+ // java code generating is complete.
+
if (resultInput != null
&& resultInput.indexOf("javac -d") >= 0) {//$NON-NLS-1$
return StatusUtils
@@ -126,18 +129,27 @@
}
return StatusUtils.errorStatus(errorResult.toString());
} else {
- if (resultInput != null
- && resultInput.indexOf("[ERROR]") >= 0) { //$NON-NLS-1$
- JBossWSCreationCore.getDefault()
- .logWarning(resultInput);
- IStatus errorStatus = StatusUtils
- .warningStatus(resultInput);
- status = StatusUtils
- .warningStatus(
- JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code,
- new CoreException(errorStatus));
- } else {
- JBossWSCreationCore.getDefault().logInfo(resultInput);
+ if (resultInput != null) {
+ if (resultInput.indexOf("[ERROR]") >= 0) { //$NON-NLS-1$
+ JBossWSCreationCore.getDefault().logWarning(
+ resultInput);
+ IStatus errorStatus = StatusUtils
+ .warningStatus(resultInput);
+ status = StatusUtils
+ .warningStatus(
+ JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code,
+ new CoreException(errorStatus));
+ }
+ if (resultInput.indexOf("error") >= 0) { //$NON-NLS-1$
+ JBossWSCreationCore.getDefault().logError(
+ resultInput);
+ IStatus errorStatus = StatusUtils
+ .errorStatus(resultInput);
+ status = StatusUtils
+ .errorStatus(
+ JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code,
+ new CoreException(errorStatus));
+ }
}
}
@@ -161,33 +173,36 @@
}
- //SET JAVA_HOME environment variable to the location of java runtime of the project if the user
+ // SET JAVA_HOME environment variable to the location of java runtime of the
+ // project if the user
// doesn't set the env variable
- private String[] getEnvironmentVariables(IProject project){
+ private String[] getEnvironmentVariables(IProject project) {
String[] env = null;
String javaHome = System.getenv(JAVA_HOME);
- if(javaHome == null || !(new File(javaHome).exists())){
+ if (javaHome == null || !(new File(javaHome).exists())) {
IJavaProject javaProject = JavaCore.create(project);
- if(javaProject == null || !javaProject.exists()) return null;
-
+ if (javaProject == null || !javaProject.exists())
+ return null;
+
try {
- if(!javaProject.isOpen()){
+ if (!javaProject.isOpen()) {
javaProject.open(null);
}
-
+
IVMInstall vm = JavaRuntime.getVMInstall(javaProject);
String javaLocation = vm.getInstallLocation().toString();
- env = new String[]{JAVA_HOME + "=" + javaLocation}; //$NON-NLS-1$
-
+ env = new String[] { JAVA_HOME + "=" + javaLocation }; //$NON-NLS-1$
+
} catch (CoreException e1) {
e1.printStackTrace();
}
}
-
+
return env;
}
-
- private void addCommonArgs(List<String> command, IProject project) throws Exception {
+
+ private void addCommonArgs(List<String> command, IProject project)
+ throws Exception {
String projectRoot = JBossWSCreationUtils.getProjectRoot(
model.getWebProjectName()).toOSString();
IJavaProject javaProject = JavaCore.create(project);
Modified: branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java
===================================================================
--- branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java 2010-04-23 04:43:50 UTC (rev 21628)
+++ branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java 2010-04-23 05:27:04 UTC (rev 21629)
@@ -302,15 +302,20 @@
* @param annotation
* @return
*/
- private List<ICompilationUnit> findJavaUnitsByAnnotation(
+ public List<ICompilationUnit> findJavaUnitsByAnnotation(
IJavaProject project, String annotation) {
List<ICompilationUnit> units = new LinkedList<ICompilationUnit>();
try {
- ICompilationUnit[] javaFiles = project.findPackageFragment(
- addPackagetoPath(project)).getCompilationUnits();
- for (ICompilationUnit unit : javaFiles) {
- if (unit.getSource().contains(annotation)) {
- units.add(unit);
+ ICompilationUnit[] javaFiles = null;
+ if (project.findPackageFragment(addPackagetoPath(project)) != null) {
+ javaFiles = project.findPackageFragment(
+ addPackagetoPath(project)).getCompilationUnits();
+ }
+ if (javaFiles != null) {
+ for (ICompilationUnit unit : javaFiles) {
+ if (unit.getSource().contains(annotation)) {
+ units.add(unit);
+ }
}
}
} catch (JavaModelException e) {
14 years, 8 months
JBoss Tools SVN: r21628 - in branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui: src/org/jboss/tools/smooks/configuration/editors and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2010-04-23 00:43:50 -0400 (Fri, 23 Apr 2010)
New Revision: 21628
Added:
branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/ISmooksActionProvider.java
Modified:
branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java
branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiPageEditorContributor.java
branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
Log:
JBIDE-6022
synchronize with trunk
Modified: branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
===================================================================
--- branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2010-04-23 03:41:26 UTC (rev 21627)
+++ branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2010-04-23 04:43:50 UTC (rev 21628)
@@ -6,6 +6,7 @@
point="org.eclipse.ui.editors">
<editor
class="org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor"
+ contributorClass="org.jboss.tools.smooks.configuration.editors.SmooksMultiPageEditorContributor"
icon="icons/smooks-sm.gif"
id="org.jboss.tools.smooks.configuration.editors.MultiPageEditor"
name="Smooks Configuration Editor">
Modified: branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java
===================================================================
--- branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java 2010-04-23 03:41:26 UTC (rev 21627)
+++ branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java 2010-04-23 04:43:50 UTC (rev 21628)
@@ -341,7 +341,7 @@
toolkit.createLabel(globalParamComposite, Messages.SmooksConfigurationOverviewPage_SerializationLabel)
.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
gd = new GridData(SWT.FILL, SWT.NONE, true, false);
- defaultSerializationOnCheckbox = toolkit.createButton(globalParamComposite, "", SWT.CHECK); //$NON-NLS-1$
+ defaultSerializationOnCheckbox = toolkit.createButton(globalParamComposite, null, SWT.CHECK); //$NON-NLS-1$
defaultSerializationOnCheckbox.setLayoutData(gd);
initGlobalSettingControls();
Modified: branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
===================================================================
--- branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2010-04-23 03:41:26 UTC (rev 21627)
+++ branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2010-04-23 04:43:50 UTC (rev 21628)
@@ -22,10 +22,12 @@
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.ui.IEditorActionBarContributor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
@@ -104,19 +106,18 @@
}
private void addProcessGraphicalEditor() {
- processPage = new SmooksProcessGraphicalEditor(this, "process", Messages.SmooksMultiFormEditor_processpage_name, this); //$NON-NLS-1$
+ processPage = new SmooksProcessGraphicalEditor(this,
+ "process", Messages.SmooksMultiFormEditor_processpage_name, this); //$NON-NLS-1$
addSourceSynchronizeListener(processPage);
addValidateListener(processPage);
addSmooksEditorInitListener(processPage);
try {
- int index = this.addPage(processPage );
+ int index = this.addPage(processPage);
setPageText(index, Messages.SmooksMultiFormEditor_processtabel_label);
} catch (PartInitException e) {
e.printStackTrace();
}
}
-
-
// private void addSmooksGraphicalEditor() {
// graphicalPage = new SmooksGraphicalEditorPart(this);
@@ -129,34 +130,53 @@
// }
// }
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.forms.editor.FormEditor#getActiveEditor()
*/
@Override
public IEditorPart getActiveEditor() {
int index = getActivePage();
if (index != -1) {
- IEditorPart part = getEditor(index);
- if(part == null){
-// if(index == 0){
-// part = processPage;
-// }
-// if(index == 1){
-// part = configurationPage;
-// }
+ IEditorPart part = getEditor(index);
+ if (part == null) {
+ // if(index == 0){
+ // part = processPage;
+ // }
+ // if(index == 1){
+ // part = configurationPage;
+ // }
}
return part;
}
return null;
}
- /* (non-Javadoc)
- * @see org.jboss.tools.smooks.editor.AbstractSmooksFormEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
+ protected void pageChange(int newPageIndex) {
+ super.pageChange(newPageIndex);
+ IEditorPart activeEditor = getEditor(newPageIndex);
+ if (activeEditor == null) {
+ if (newPageIndex == 0) {
+ IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor();
+ if (contributor != null && contributor instanceof MultiPageEditorActionBarContributor) {
+ ((MultiPageEditorActionBarContributor) contributor).setActivePage(processPage);
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.jboss.tools.smooks.editor.AbstractSmooksFormEditor#init(org.eclipse
+ * .ui.IEditorSite, org.eclipse.ui.IEditorInput)
*/
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
super.init(site, input);
-// site.setSelectionProvider(this);
+ // site.setSelectionProvider(this);
}
public Object getAdapter(Class adapter) {
@@ -164,13 +184,13 @@
tabbedPropertySheetPage = new TabbedPropertySheetPage(this);
return tabbedPropertySheetPage;
}
-
- if(adapter == GraphicalViewer.class){
- if(this.processPage != null){
+
+ if (adapter == GraphicalViewer.class) {
+ if (this.processPage != null) {
Object activeEditorPart = processPage.getActiveEditorPage();
- if(activeEditorPart != null && activeEditorPart instanceof IEditorPart){
- if(activeEditorPart instanceof GraphicalEditor){
- return ((IEditorPart)activeEditorPart).getAdapter(adapter);
+ if (activeEditorPart != null && activeEditorPart instanceof IEditorPart) {
+ if (activeEditorPart instanceof GraphicalEditor) {
+ return ((IEditorPart) activeEditorPart).getAdapter(adapter);
}
}
}
@@ -185,7 +205,8 @@
// }
private SmooksConfigurationOverviewPage createSmooksConfigurationOverviewPage() {
- return new SmooksConfigurationOverviewPage(this, "options_page", Messages.SmooksMultiFormEditor_optinepage_name, this); //$NON-NLS-1$
+ return new SmooksConfigurationOverviewPage(this,
+ "options_page", Messages.SmooksMultiFormEditor_optinepage_name, this); //$NON-NLS-1$
}
@Override
Modified: branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiPageEditorContributor.java
===================================================================
--- branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiPageEditorContributor.java 2010-04-23 03:41:26 UTC (rev 21627)
+++ branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiPageEditorContributor.java 2010-04-23 04:43:50 UTC (rev 21628)
@@ -1,17 +1,12 @@
package org.jboss.tools.smooks.configuration.editors;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.action.IAction;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.ide.IDEActionFactory;
import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
-import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+import org.jboss.tools.smooks.graphical.actions.ISmooksActionProvider;
/**
* Manages the installation/deinstallation of global actions for multi-page editors.
@@ -20,21 +15,21 @@
*/
public class SmooksMultiPageEditorContributor extends MultiPageEditorActionBarContributor {
private IEditorPart activeEditorPart;
- private Action sampleAction;
/**
* Creates a multi-page contributor.
*/
public SmooksMultiPageEditorContributor() {
super();
- createActions();
}
- /**
- * Returns the action registed with the given text editor.
- * @return IAction or null if editor is null.
- */
- protected IAction getAction(ITextEditor editor, String actionID) {
- return (editor == null ? null : editor.getAction(actionID));
+
+
+ protected IAction getAction(IEditorPart editor , String actionID){
+ if(editor instanceof ISmooksActionProvider){
+ return ((ISmooksActionProvider)editor).getAction(actionID);
+ }
+ return null;
}
+
/* (non-JavaDoc)
* Method declared in AbstractMultiPageEditorActionBarContributor.
*/
@@ -42,16 +37,13 @@
public void setActivePage(IEditorPart part) {
if (activeEditorPart == part)
return;
-
activeEditorPart = part;
-
IActionBars actionBars = getActionBars();
if (actionBars != null) {
+
+ IEditorPart editor = activeEditorPart;
- ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
-
- actionBars.setGlobalActionHandler(
- ActionFactory.DELETE.getId(),
+ actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),
getAction(editor, ITextEditorActionConstants.DELETE));
actionBars.setGlobalActionHandler(
ActionFactory.UNDO.getId(),
@@ -59,45 +51,27 @@
actionBars.setGlobalActionHandler(
ActionFactory.REDO.getId(),
getAction(editor, ITextEditorActionConstants.REDO));
- actionBars.setGlobalActionHandler(
- ActionFactory.CUT.getId(),
- getAction(editor, ITextEditorActionConstants.CUT));
- actionBars.setGlobalActionHandler(
- ActionFactory.COPY.getId(),
- getAction(editor, ITextEditorActionConstants.COPY));
- actionBars.setGlobalActionHandler(
- ActionFactory.PASTE.getId(),
- getAction(editor, ITextEditorActionConstants.PASTE));
- actionBars.setGlobalActionHandler(
- ActionFactory.SELECT_ALL.getId(),
- getAction(editor, ITextEditorActionConstants.SELECT_ALL));
- actionBars.setGlobalActionHandler(
- ActionFactory.FIND.getId(),
- getAction(editor, ITextEditorActionConstants.FIND));
- actionBars.setGlobalActionHandler(
- IDEActionFactory.BOOKMARK.getId(),
- getAction(editor, IDEActionFactory.BOOKMARK.getId()));
actionBars.updateActionBars();
}
}
- private void createActions() {
- sampleAction = new Action() {
- public void run() {
- MessageDialog.openInformation(null, "Configuration Plug-in", "Sample Action Executed"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- };
- sampleAction.setText("Sample Action"); //$NON-NLS-1$
- sampleAction.setToolTipText("Sample Action tool tip"); //$NON-NLS-1$
- sampleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
- getImageDescriptor(IDE.SharedImages.IMG_OBJS_TASK_TSK));
- }
- public void contributeToMenu(IMenuManager manager) {
- IMenuManager menu = new MenuManager("Editor &Menu"); //$NON-NLS-1$
- manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu);
- menu.add(sampleAction);
- }
- public void contributeToToolBar(IToolBarManager manager) {
- manager.add(new Separator());
- manager.add(sampleAction);
- }
+// private void createActions() {
+// sampleAction = new Action() {
+// public void run() {
+// MessageDialog.openInformation(null, "Configuration Plug-in", "Sample Action Executed"); //$NON-NLS-1$ //$NON-NLS-2$
+// }
+// };
+// sampleAction.setText("Sample Action"); //$NON-NLS-1$
+// sampleAction.setToolTipText("Sample Action tool tip"); //$NON-NLS-1$
+// sampleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+// getImageDescriptor(IDE.SharedImages.IMG_OBJS_TASK_TSK));
+// }
+// public void contributeToMenu(IMenuManager manager) {
+// IMenuManager menu = new MenuManager("Editor &Menu"); //$NON-NLS-1$
+// manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu);
+// menu.add(sampleAction);
+// }
+// public void contributeToToolBar(IToolBarManager manager) {
+// manager.add(new Separator());
+// manager.add(sampleAction);
+// }
}
Added: branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/ISmooksActionProvider.java
===================================================================
--- branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/ISmooksActionProvider.java (rev 0)
+++ branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/ISmooksActionProvider.java 2010-04-23 04:43:50 UTC (rev 21628)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.actions;
+
+import org.eclipse.jface.action.IAction;
+
+/**
+ * @author Dart
+ *
+ */
+public interface ISmooksActionProvider {
+ IAction getAction(String actionId);
+}
Property changes on: branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/ISmooksActionProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
===================================================================
--- branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2010-04-23 03:41:26 UTC (rev 21627)
+++ branches/jbosstools-3.1.x/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2010-04-23 04:43:50 UTC (rev 21628)
@@ -45,17 +45,21 @@
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IEditorActionBarContributor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.IMessage;
import org.eclipse.ui.forms.editor.FormEditor;
@@ -64,6 +68,7 @@
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.ScrolledPageBook;
import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
import org.eclipse.zest.core.viewers.GraphViewer;
import org.eclipse.zest.core.widgets.CGraphNode;
import org.eclipse.zest.core.widgets.Graph;
@@ -81,9 +86,11 @@
import org.jboss.tools.smooks.editor.AbstractSmooksFormEditor;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.editor.ISourceSynchronizeListener;
+import org.jboss.tools.smooks.gef.common.SmooksGraphicalMenuContextProvider;
import org.jboss.tools.smooks.graphical.actions.AbstractProcessGraphAction;
import org.jboss.tools.smooks.graphical.actions.AddNextTaskNodeAction;
import org.jboss.tools.smooks.graphical.actions.DeleteTaskNodeAction;
+import org.jboss.tools.smooks.graphical.actions.ISmooksActionProvider;
import org.jboss.tools.smooks.graphical.editors.TaskTypeManager.TaskTypeDescriptor;
import org.jboss.tools.smooks.graphical.editors.process.IProcessProvider;
import org.jboss.tools.smooks.graphical.editors.process.ProcessFactory;
@@ -108,8 +115,10 @@
*/
public class SmooksProcessGraphicalEditor extends FormPage implements ISelectionChangedListener,
ISourceSynchronizeListener, IPropertyListener, ISmooksModelValidateListener, IProcessProvider,
- PropertyChangeListener, ISmooksEditorInitListener {
+ PropertyChangeListener, ISmooksEditorInitListener, ISmooksActionProvider {
+ private boolean processMapActived = false;
+
private int currentMessageType = IMessageProvider.NONE;
private String currentMessage = null;
@@ -260,10 +269,35 @@
}
showTaskControl(firstElement);
SmooksProcessGraphicalEditor.this.selectionChanged(event);
+ updateGlobalActions();
}
});
+ // when focus change , update the actions in the Eclipse menu via
+ // EditorContributor
+ getProcessGraphViewer().getControl().addFocusListener(new FocusListener() {
+
+ public void focusLost(FocusEvent e) {
+ processMapActived = false;
+ updateGlobalActions();
+ }
+
+ public void focusGained(FocusEvent e) {
+ processMapActived = true;
+ updateGlobalActions();
+ }
+ });
}
+ private void updateGlobalActions() {
+ IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor();
+ if (contributor != null && contributor instanceof MultiPageEditorActionBarContributor) {
+ // clean all actions
+ ((MultiPageEditorActionBarContributor) contributor).setActivePage(null);
+ // re-active the page and add all actions
+ ((MultiPageEditorActionBarContributor) contributor).setActivePage(SmooksProcessGraphicalEditor.this);
+ }
+ }
+
protected void unhighlightGraphNodes() {
Graph graph = this.getProcessGraphViewer().getGraphControl();
@@ -793,7 +827,7 @@
public void selectionChanged(SelectionChangedEvent event) {
ISelectionProvider provider = getEditor().getSite().getSelectionProvider();
- if(provider != null){
+ if (provider != null) {
provider.setSelection(event.getSelection());
}
}
@@ -855,9 +889,9 @@
}
return null;
}
-
- public Object getActiveEditorPage(){
- if(pageBook != null){
+
+ public Object getActiveEditorPage() {
+ if (pageBook != null) {
Control control = pageBook.getCurrentPage();
return control.getData();
}
@@ -941,7 +975,7 @@
}
});
-
+ updateGlobalActions();
}
protected IEditorSite createSite(IEditorPart editor) {
@@ -1313,4 +1347,26 @@
}
}
}
+
+ public IAction getAction(String actionId) {
+ if (processMapActived) {
+ updateProcessActions(processGraphViewer.getSelection());
+ if(ActionFactory.DELETE.getId().equals(actionId)){
+ for (Iterator<?> iterator = processPanelActions.iterator(); iterator.hasNext();) {
+ IAction action = (IAction) iterator.next();
+ if(action instanceof DeleteTaskNodeAction){
+ return action;
+ }
+ }
+ }
+ } else {
+ IEditorPart editor = (IEditorPart) getActiveEditorPage();
+ if (editor != null && editor instanceof SmooksGraphicalEditorPart) {
+ SmooksGraphicalMenuContextProvider provider = (SmooksGraphicalMenuContextProvider) ((SmooksGraphicalEditorPart) editor)
+ .getContextMenuProvider();
+ return provider.getActionRegistry().getAction(actionId);
+ }
+ }
+ return null;
+ }
}
14 years, 8 months
JBoss Tools SVN: r21627 - trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2010-04-22 23:41:26 -0400 (Thu, 22 Apr 2010)
New Revision: 21627
Modified:
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/JBossWSCreationCoreTests.java
Log:
JBIDE-6175: to trunk
Modified: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/JBossWSCreationCoreTests.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/JBossWSCreationCoreTests.java 2010-04-23 03:19:09 UTC (rev 21626)
+++ trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/JBossWSCreationCoreTests.java 2010-04-23 03:41:26 UTC (rev 21627)
@@ -16,6 +16,7 @@
import junit.framework.TestSuite;
import org.jboss.tools.ws.creation.core.test.command.JBossWSClientCommandTest;
+import org.jboss.tools.ws.creation.core.test.command.JBossWSClientSampleCreationCommandTest;
import org.jboss.tools.ws.creation.core.test.command.JBossWSJavaFirstCommandTest;
import org.jboss.tools.ws.creation.core.test.command.JBossWSMergeWebXMLCommandTest;
import org.jboss.tools.ws.creation.core.test.command.JBossWSTopDownCommandTest;
@@ -29,6 +30,7 @@
suite.addTestSuite(JBossWSJavaFirstCommandTest.class);
suite.addTestSuite(JBossWSClientCommandTest.class);
suite.addTestSuite(JBossWSMergeWebXMLCommandTest.class);
+ suite.addTestSuite(JBossWSClientSampleCreationCommandTest.class);
return suite;
}
}
\ No newline at end of file
14 years, 8 months
JBoss Tools SVN: r21626 - in trunk/ws: tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2010-04-22 23:19:09 -0400 (Thu, 22 Apr 2010)
New Revision: 21626
Added:
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSClientSampleCreationCommandTest.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSClientCommandTest.java
Log:
JBIDE-6175: to trunk
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2010-04-23 03:11:19 UTC (rev 21625)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2010-04-23 03:19:09 UTC (rev 21626)
@@ -43,14 +43,14 @@
this.model = model;
cmdFileName_linux = getCommandLineFileName_linux();
cmdFileName_win = getCommandLineFileName_win();
-
+
}
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
- if(monitor==null) {
- monitor=new NullProgressMonitor();
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
}
try {
monitor.beginTask("", 100); //$NON-NLS-1$
@@ -114,11 +114,14 @@
JBossWSCreationCorePlugin.getDefault().logError(
inputResult.toString());
-// there is no way to know if the failure of invoking is because of failure of
-// compiling or because of failure of generating java code, so try to analyze the
-// output string of the command, if the string contains "javac -d", means the java
-// java code generating is complete.
-
+ // there is no way to know if the failure of invoking is
+ // because of failure of
+ // compiling or because of failure of generating java code,
+ // so try to analyze the
+ // output string of the command, if the string contains
+ // "javac -d", means the java
+ // java code generating is complete.
+
if (resultInput != null
&& resultInput.indexOf("javac -d") >= 0) {//$NON-NLS-1$
return StatusUtils
@@ -126,17 +129,28 @@
}
return StatusUtils.errorStatus(errorResult.toString());
} else {
- if (resultInput != null
- && resultInput.indexOf("[ERROR]") >= 0) { //$NON-NLS-1$
- JBossWSCreationCorePlugin.getDefault()
- .logWarning(resultInput);
- IStatus errorStatus = StatusUtils
- .warningStatus(resultInput);
- status = StatusUtils
- .warningStatus(
- JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code,
- new CoreException(errorStatus));
- }
+ if (resultInput != null) {
+ if (resultInput.indexOf("[ERROR]") >= 0) { //$NON-NLS-1$
+ JBossWSCreationCorePlugin.getDefault().logWarning(
+ resultInput);
+ IStatus errorStatus = StatusUtils
+ .warningStatus(resultInput);
+ status = StatusUtils
+ .warningStatus(
+ JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code,
+ new CoreException(errorStatus));
+ }
+ if (resultInput.indexOf("error") >= 0) { //$NON-NLS-1$
+ JBossWSCreationCorePlugin.getDefault().logError(
+ resultInput);
+ IStatus errorStatus = StatusUtils
+ .errorStatus(resultInput);
+ status = StatusUtils
+ .errorStatus(
+ JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code,
+ new CoreException(errorStatus));
+ }
+ }
}
} catch (InterruptedException e) {
@@ -159,33 +173,36 @@
}
- //SET JAVA_HOME environment variable to the location of java runtime of the project if the user
+ // SET JAVA_HOME environment variable to the location of java runtime of the
+ // project if the user
// doesn't set the env variable
- private String[] getEnvironmentVariables(IProject project){
+ private String[] getEnvironmentVariables(IProject project) {
String[] env = null;
String javaHome = System.getenv(JAVA_HOME);
- if(javaHome == null || !(new File(javaHome).exists())){
+ if (javaHome == null || !(new File(javaHome).exists())) {
IJavaProject javaProject = JavaCore.create(project);
- if(javaProject == null || !javaProject.exists()) return null;
-
+ if (javaProject == null || !javaProject.exists())
+ return null;
+
try {
- if(!javaProject.isOpen()){
+ if (!javaProject.isOpen()) {
javaProject.open(null);
}
-
+
IVMInstall vm = JavaRuntime.getVMInstall(javaProject);
String javaLocation = vm.getInstallLocation().toString();
- env = new String[]{JAVA_HOME + "=" + javaLocation}; //$NON-NLS-1$
-
+ env = new String[] { JAVA_HOME + "=" + javaLocation }; //$NON-NLS-1$
+
} catch (CoreException e1) {
e1.printStackTrace();
}
}
-
+
return env;
}
-
- private void addCommonArgs(List<String> command, IProject project) throws Exception {
+
+ private void addCommonArgs(List<String> command, IProject project)
+ throws Exception {
String projectRoot = JBossWSCreationUtils.getProjectRoot(
model.getWebProjectName()).toOSString();
IJavaProject javaProject = JavaCore.create(project);
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java 2010-04-23 03:11:19 UTC (rev 21625)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java 2010-04-23 03:19:09 UTC (rev 21626)
@@ -302,15 +302,20 @@
* @param annotation
* @return
*/
- private List<ICompilationUnit> findJavaUnitsByAnnotation(
+ public List<ICompilationUnit> findJavaUnitsByAnnotation(
IJavaProject project, String annotation) {
List<ICompilationUnit> units = new LinkedList<ICompilationUnit>();
try {
- ICompilationUnit[] javaFiles = project.findPackageFragment(
- addPackagetoPath(project)).getCompilationUnits();
- for (ICompilationUnit unit : javaFiles) {
- if (unit.getSource().contains(annotation)) {
- units.add(unit);
+ ICompilationUnit[] javaFiles = null;
+ if (project.findPackageFragment(addPackagetoPath(project)) != null) {
+ javaFiles = project.findPackageFragment(
+ addPackagetoPath(project)).getCompilationUnits();
+ }
+ if (javaFiles != null) {
+ for (ICompilationUnit unit : javaFiles) {
+ if (unit.getSource().contains(annotation)) {
+ units.add(unit);
+ }
}
}
} catch (JavaModelException e) {
Modified: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSClientCommandTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSClientCommandTest.java 2010-04-23 03:11:19 UTC (rev 21625)
+++ trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSClientCommandTest.java 2010-04-23 03:19:09 UTC (rev 21626)
@@ -29,7 +29,7 @@
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
import org.jboss.tools.ws.core.classpath.JBossWSRuntime;
import org.jboss.tools.ws.core.classpath.JBossWSRuntimeManager;
-import org.jboss.tools.ws.core.classpath.JBossWSRuntimeClassPathInitializer.JBossWSRuntimeClasspathContainer;
+import org.jboss.tools.ws.core.classpath.JBossWSRuntimeClasspathContainer;
import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
import org.jboss.tools.ws.core.facet.delegate.JBossWSFacetInstallDataModelProvider;
import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
Added: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSClientSampleCreationCommandTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSClientSampleCreationCommandTest.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSClientSampleCreationCommandTest.java 2010-04-23 03:19:09 UTC (rev 21626)
@@ -0,0 +1,63 @@
+package org.jboss.tools.ws.creation.core.test.command;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.JavaCore;
+import org.jboss.tools.common.test.util.TestProjectProvider;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
+import org.jboss.tools.ws.creation.core.commands.ClientSampleCreationCommand;
+import org.jboss.tools.ws.creation.core.data.ServiceModel;
+
+public class JBossWSClientSampleCreationCommandTest extends TestCase{
+ static String BUNDLE = "org.jboss.tools.ws.creation.core.test";
+ IProject prj;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ TestProjectProvider provider = new TestProjectProvider(BUNDLE,
+ "/projects/" + "WebTest", "WebTest", true);
+ prj = provider.getProject();
+ JobUtils.delay(3000);
+ }
+
+ public void testJBIDE6175() throws ExecutionException{
+ IResource src = prj.findMember("src");
+ assertTrue("src is there",src.exists());
+ ServiceModel model = new ServiceModel();
+ model.setCustomPackage("");
+ model.setWebProjectName("WebTest");
+ ClientSampleCreationCommand command = new ClientSampleCreationCommand(model);
+ List<ICompilationUnit> list = command.findJavaUnitsByAnnotation(JavaCore.create(prj), "@WebService");
+ assertTrue("No java files in src!",list.isEmpty());
+ }
+
+ protected void tearDown() throws Exception {
+ boolean oldAutoBuilding = ResourcesUtils.setBuildAutomatically(false);
+ Exception last = null;
+ try {
+ JobUtils.delay(500);
+ try {
+ System.out.println("Deleting " + prj);
+ prj.delete(true, null);
+ JobUtils.delay(500);
+ } catch (Exception e) {
+ System.out.println("Error deleting " + prj);
+ e.printStackTrace();
+ last = e;
+ }
+ } finally {
+ ResourcesUtils.setBuildAutomatically(oldAutoBuilding);
+ }
+
+ if (last != null)
+ throw last;
+ super.tearDown();
+ }
+}
Property changes on: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSClientSampleCreationCommandTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 8 months
JBoss Tools SVN: r21625 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui: src/org/jboss/tools/smooks/configuration/editors and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2010-04-22 23:11:19 -0400 (Thu, 22 Apr 2010)
New Revision: 21625
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/ISmooksActionProvider.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiPageEditorContributor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
Log:
JBIDE-6022
resolved
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2010-04-23 03:11:09 UTC (rev 21624)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2010-04-23 03:11:19 UTC (rev 21625)
@@ -6,6 +6,7 @@
point="org.eclipse.ui.editors">
<editor
class="org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor"
+ contributorClass="org.jboss.tools.smooks.configuration.editors.SmooksMultiPageEditorContributor"
icon="icons/smooks-sm.gif"
id="org.jboss.tools.smooks.configuration.editors.MultiPageEditor"
name="Smooks Configuration Editor">
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2010-04-23 03:11:09 UTC (rev 21624)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2010-04-23 03:11:19 UTC (rev 21625)
@@ -22,10 +22,12 @@
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.ui.IEditorActionBarContributor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
@@ -104,19 +106,18 @@
}
private void addProcessGraphicalEditor() {
- processPage = new SmooksProcessGraphicalEditor(this, "process", Messages.SmooksMultiFormEditor_processpage_name, this); //$NON-NLS-1$
+ processPage = new SmooksProcessGraphicalEditor(this,
+ "process", Messages.SmooksMultiFormEditor_processpage_name, this); //$NON-NLS-1$
addSourceSynchronizeListener(processPage);
addValidateListener(processPage);
addSmooksEditorInitListener(processPage);
try {
- int index = this.addPage(processPage );
+ int index = this.addPage(processPage);
setPageText(index, Messages.SmooksMultiFormEditor_processtabel_label);
} catch (PartInitException e) {
e.printStackTrace();
}
}
-
-
// private void addSmooksGraphicalEditor() {
// graphicalPage = new SmooksGraphicalEditorPart(this);
@@ -129,34 +130,53 @@
// }
// }
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.forms.editor.FormEditor#getActiveEditor()
*/
@Override
public IEditorPart getActiveEditor() {
int index = getActivePage();
if (index != -1) {
- IEditorPart part = getEditor(index);
- if(part == null){
-// if(index == 0){
-// part = processPage;
-// }
-// if(index == 1){
-// part = configurationPage;
-// }
+ IEditorPart part = getEditor(index);
+ if (part == null) {
+ // if(index == 0){
+ // part = processPage;
+ // }
+ // if(index == 1){
+ // part = configurationPage;
+ // }
}
return part;
}
return null;
}
- /* (non-Javadoc)
- * @see org.jboss.tools.smooks.editor.AbstractSmooksFormEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
+ protected void pageChange(int newPageIndex) {
+ super.pageChange(newPageIndex);
+ IEditorPart activeEditor = getEditor(newPageIndex);
+ if (activeEditor == null) {
+ if (newPageIndex == 0) {
+ IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor();
+ if (contributor != null && contributor instanceof MultiPageEditorActionBarContributor) {
+ ((MultiPageEditorActionBarContributor) contributor).setActivePage(processPage);
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.jboss.tools.smooks.editor.AbstractSmooksFormEditor#init(org.eclipse
+ * .ui.IEditorSite, org.eclipse.ui.IEditorInput)
*/
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
super.init(site, input);
-// site.setSelectionProvider(this);
+ // site.setSelectionProvider(this);
}
public Object getAdapter(Class adapter) {
@@ -164,13 +184,13 @@
tabbedPropertySheetPage = new TabbedPropertySheetPage(this);
return tabbedPropertySheetPage;
}
-
- if(adapter == GraphicalViewer.class){
- if(this.processPage != null){
+
+ if (adapter == GraphicalViewer.class) {
+ if (this.processPage != null) {
Object activeEditorPart = processPage.getActiveEditorPage();
- if(activeEditorPart != null && activeEditorPart instanceof IEditorPart){
- if(activeEditorPart instanceof GraphicalEditor){
- return ((IEditorPart)activeEditorPart).getAdapter(adapter);
+ if (activeEditorPart != null && activeEditorPart instanceof IEditorPart) {
+ if (activeEditorPart instanceof GraphicalEditor) {
+ return ((IEditorPart) activeEditorPart).getAdapter(adapter);
}
}
}
@@ -185,7 +205,8 @@
// }
private SmooksConfigurationOverviewPage createSmooksConfigurationOverviewPage() {
- return new SmooksConfigurationOverviewPage(this, "options_page", Messages.SmooksMultiFormEditor_optinepage_name, this); //$NON-NLS-1$
+ return new SmooksConfigurationOverviewPage(this,
+ "options_page", Messages.SmooksMultiFormEditor_optinepage_name, this); //$NON-NLS-1$
}
@Override
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiPageEditorContributor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiPageEditorContributor.java 2010-04-23 03:11:09 UTC (rev 21624)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiPageEditorContributor.java 2010-04-23 03:11:19 UTC (rev 21625)
@@ -1,17 +1,12 @@
package org.jboss.tools.smooks.configuration.editors;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.action.IAction;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.ide.IDEActionFactory;
import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
-import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+import org.jboss.tools.smooks.graphical.actions.ISmooksActionProvider;
/**
* Manages the installation/deinstallation of global actions for multi-page editors.
@@ -20,21 +15,21 @@
*/
public class SmooksMultiPageEditorContributor extends MultiPageEditorActionBarContributor {
private IEditorPart activeEditorPart;
- private Action sampleAction;
/**
* Creates a multi-page contributor.
*/
public SmooksMultiPageEditorContributor() {
super();
- createActions();
}
- /**
- * Returns the action registed with the given text editor.
- * @return IAction or null if editor is null.
- */
- protected IAction getAction(ITextEditor editor, String actionID) {
- return (editor == null ? null : editor.getAction(actionID));
+
+
+ protected IAction getAction(IEditorPart editor , String actionID){
+ if(editor instanceof ISmooksActionProvider){
+ return ((ISmooksActionProvider)editor).getAction(actionID);
+ }
+ return null;
}
+
/* (non-JavaDoc)
* Method declared in AbstractMultiPageEditorActionBarContributor.
*/
@@ -42,16 +37,13 @@
public void setActivePage(IEditorPart part) {
if (activeEditorPart == part)
return;
-
activeEditorPart = part;
-
IActionBars actionBars = getActionBars();
if (actionBars != null) {
+
+ IEditorPart editor = activeEditorPart;
- ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
-
- actionBars.setGlobalActionHandler(
- ActionFactory.DELETE.getId(),
+ actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),
getAction(editor, ITextEditorActionConstants.DELETE));
actionBars.setGlobalActionHandler(
ActionFactory.UNDO.getId(),
@@ -59,45 +51,27 @@
actionBars.setGlobalActionHandler(
ActionFactory.REDO.getId(),
getAction(editor, ITextEditorActionConstants.REDO));
- actionBars.setGlobalActionHandler(
- ActionFactory.CUT.getId(),
- getAction(editor, ITextEditorActionConstants.CUT));
- actionBars.setGlobalActionHandler(
- ActionFactory.COPY.getId(),
- getAction(editor, ITextEditorActionConstants.COPY));
- actionBars.setGlobalActionHandler(
- ActionFactory.PASTE.getId(),
- getAction(editor, ITextEditorActionConstants.PASTE));
- actionBars.setGlobalActionHandler(
- ActionFactory.SELECT_ALL.getId(),
- getAction(editor, ITextEditorActionConstants.SELECT_ALL));
- actionBars.setGlobalActionHandler(
- ActionFactory.FIND.getId(),
- getAction(editor, ITextEditorActionConstants.FIND));
- actionBars.setGlobalActionHandler(
- IDEActionFactory.BOOKMARK.getId(),
- getAction(editor, IDEActionFactory.BOOKMARK.getId()));
actionBars.updateActionBars();
}
}
- private void createActions() {
- sampleAction = new Action() {
- public void run() {
- MessageDialog.openInformation(null, "Configuration Plug-in", "Sample Action Executed"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- };
- sampleAction.setText("Sample Action"); //$NON-NLS-1$
- sampleAction.setToolTipText("Sample Action tool tip"); //$NON-NLS-1$
- sampleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
- getImageDescriptor(IDE.SharedImages.IMG_OBJS_TASK_TSK));
- }
- public void contributeToMenu(IMenuManager manager) {
- IMenuManager menu = new MenuManager("Editor &Menu"); //$NON-NLS-1$
- manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu);
- menu.add(sampleAction);
- }
- public void contributeToToolBar(IToolBarManager manager) {
- manager.add(new Separator());
- manager.add(sampleAction);
- }
+// private void createActions() {
+// sampleAction = new Action() {
+// public void run() {
+// MessageDialog.openInformation(null, "Configuration Plug-in", "Sample Action Executed"); //$NON-NLS-1$ //$NON-NLS-2$
+// }
+// };
+// sampleAction.setText("Sample Action"); //$NON-NLS-1$
+// sampleAction.setToolTipText("Sample Action tool tip"); //$NON-NLS-1$
+// sampleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+// getImageDescriptor(IDE.SharedImages.IMG_OBJS_TASK_TSK));
+// }
+// public void contributeToMenu(IMenuManager manager) {
+// IMenuManager menu = new MenuManager("Editor &Menu"); //$NON-NLS-1$
+// manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu);
+// menu.add(sampleAction);
+// }
+// public void contributeToToolBar(IToolBarManager manager) {
+// manager.add(new Separator());
+// manager.add(sampleAction);
+// }
}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/ISmooksActionProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/ISmooksActionProvider.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/ISmooksActionProvider.java 2010-04-23 03:11:19 UTC (rev 21625)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.actions;
+
+import org.eclipse.jface.action.IAction;
+
+/**
+ * @author Dart
+ *
+ */
+public interface ISmooksActionProvider {
+ IAction getAction(String actionId);
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/ISmooksActionProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2010-04-23 03:11:09 UTC (rev 21624)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2010-04-23 03:11:19 UTC (rev 21625)
@@ -45,17 +45,21 @@
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IEditorActionBarContributor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.IMessage;
import org.eclipse.ui.forms.editor.FormEditor;
@@ -64,6 +68,7 @@
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.ScrolledPageBook;
import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
import org.eclipse.zest.core.viewers.GraphViewer;
import org.eclipse.zest.core.widgets.CGraphNode;
import org.eclipse.zest.core.widgets.Graph;
@@ -81,9 +86,11 @@
import org.jboss.tools.smooks.editor.AbstractSmooksFormEditor;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.editor.ISourceSynchronizeListener;
+import org.jboss.tools.smooks.gef.common.SmooksGraphicalMenuContextProvider;
import org.jboss.tools.smooks.graphical.actions.AbstractProcessGraphAction;
import org.jboss.tools.smooks.graphical.actions.AddNextTaskNodeAction;
import org.jboss.tools.smooks.graphical.actions.DeleteTaskNodeAction;
+import org.jboss.tools.smooks.graphical.actions.ISmooksActionProvider;
import org.jboss.tools.smooks.graphical.editors.TaskTypeManager.TaskTypeDescriptor;
import org.jboss.tools.smooks.graphical.editors.process.IProcessProvider;
import org.jboss.tools.smooks.graphical.editors.process.ProcessFactory;
@@ -108,8 +115,10 @@
*/
public class SmooksProcessGraphicalEditor extends FormPage implements ISelectionChangedListener,
ISourceSynchronizeListener, IPropertyListener, ISmooksModelValidateListener, IProcessProvider,
- PropertyChangeListener, ISmooksEditorInitListener {
+ PropertyChangeListener, ISmooksEditorInitListener, ISmooksActionProvider {
+ private boolean processMapActived = false;
+
private int currentMessageType = IMessageProvider.NONE;
private String currentMessage = null;
@@ -260,10 +269,35 @@
}
showTaskControl(firstElement);
SmooksProcessGraphicalEditor.this.selectionChanged(event);
+ updateGlobalActions();
}
});
+ // when focus change , update the actions in the Eclipse menu via
+ // EditorContributor
+ getProcessGraphViewer().getControl().addFocusListener(new FocusListener() {
+
+ public void focusLost(FocusEvent e) {
+ processMapActived = false;
+ updateGlobalActions();
+ }
+
+ public void focusGained(FocusEvent e) {
+ processMapActived = true;
+ updateGlobalActions();
+ }
+ });
}
+ private void updateGlobalActions() {
+ IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor();
+ if (contributor != null && contributor instanceof MultiPageEditorActionBarContributor) {
+ // clean all actions
+ ((MultiPageEditorActionBarContributor) contributor).setActivePage(null);
+ // re-active the page and add all actions
+ ((MultiPageEditorActionBarContributor) contributor).setActivePage(SmooksProcessGraphicalEditor.this);
+ }
+ }
+
protected void unhighlightGraphNodes() {
Graph graph = this.getProcessGraphViewer().getGraphControl();
@@ -793,7 +827,7 @@
public void selectionChanged(SelectionChangedEvent event) {
ISelectionProvider provider = getEditor().getSite().getSelectionProvider();
- if(provider != null){
+ if (provider != null) {
provider.setSelection(event.getSelection());
}
}
@@ -855,9 +889,9 @@
}
return null;
}
-
- public Object getActiveEditorPage(){
- if(pageBook != null){
+
+ public Object getActiveEditorPage() {
+ if (pageBook != null) {
Control control = pageBook.getCurrentPage();
return control.getData();
}
@@ -941,7 +975,7 @@
}
});
-
+ updateGlobalActions();
}
protected IEditorSite createSite(IEditorPart editor) {
@@ -1313,4 +1347,26 @@
}
}
}
+
+ public IAction getAction(String actionId) {
+ if (processMapActived) {
+ updateProcessActions(processGraphViewer.getSelection());
+ if(ActionFactory.DELETE.getId().equals(actionId)){
+ for (Iterator<?> iterator = processPanelActions.iterator(); iterator.hasNext();) {
+ IAction action = (IAction) iterator.next();
+ if(action instanceof DeleteTaskNodeAction){
+ return action;
+ }
+ }
+ }
+ } else {
+ IEditorPart editor = (IEditorPart) getActiveEditorPage();
+ if (editor != null && editor instanceof SmooksGraphicalEditorPart) {
+ SmooksGraphicalMenuContextProvider provider = (SmooksGraphicalMenuContextProvider) ((SmooksGraphicalEditorPart) editor)
+ .getContextMenuProvider();
+ return provider.getActionRegistry().getAction(actionId);
+ }
+ }
+ return null;
+ }
}
14 years, 8 months
JBoss Tools SVN: r21624 - branches/modular_build/xulrunner/site/org.mozilla.xulrunner.site.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-22 23:11:09 -0400 (Thu, 22 Apr 2010)
New Revision: 21624
Modified:
branches/modular_build/xulrunner/site/org.mozilla.xulrunner.site/pom.xml
Log:
use 0.0.1-SNAPSHOT instead of 0.0.0 as site version
Modified: branches/modular_build/xulrunner/site/org.mozilla.xulrunner.site/pom.xml
===================================================================
--- branches/modular_build/xulrunner/site/org.mozilla.xulrunner.site/pom.xml 2010-04-23 03:09:58 UTC (rev 21623)
+++ branches/modular_build/xulrunner/site/org.mozilla.xulrunner.site/pom.xml 2010-04-23 03:11:09 UTC (rev 21624)
@@ -7,9 +7,8 @@
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
- <groupId>org.jboss.tools</groupId>
+ <groupId>org.jboss.tools</groupId>
<artifactId>org.mozilla.xulrunner.site</artifactId>
- <version>1.9.1.2</version>
- <packaging>eclipse-update-site</packaging>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>eclipse-update-site</packaging>
</project>
-
14 years, 8 months