JBoss Tools SVN: r36420 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-11-17 16:19:41 -0500 (Thu, 17 Nov 2011)
New Revision: 36420
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers/InnerModelHelper.java
Log:
JBIDE-10177
https://issues.jboss.org/browse/JBIDE-10177
WebUtils moved to common
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers/InnerModelHelper.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers/InnerModelHelper.java 2011-11-17 21:13:32 UTC (rev 36419)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers/InnerModelHelper.java 2011-11-17 21:19:41 UTC (rev 36420)
@@ -13,6 +13,7 @@
import java.io.IOException;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -26,9 +27,9 @@
import org.jboss.tools.common.model.XModelConstants;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.project.IModelNature;
-import org.jboss.tools.common.model.project.ProjectHome;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.model.util.XModelObjectUtil;
+import org.jboss.tools.common.web.WebUtils;
public class InnerModelHelper {
@@ -74,7 +75,16 @@
}
//Taken from J2EEUtils and modified
- public static IPath getWebInfPath(IProject project) {
+ public static IPath getWebInfPath(IProject project) {
+ IContainer[] cs = WebUtils.getWebRootFolders(project, true);
+ for (IContainer c: cs) {
+ if(c.exists()) {
+ IFolder f = c.getFolder(new Path("WEB-INF")); //$NON-NLS-1$
+ if(f.exists()) {
+ return f.getFullPath();
+ }
+ }
+ }
IVirtualComponent component = ComponentCore.createComponent(project);
if(component == null) return null;
IVirtualFolder webInfDir = component.getRootFolder().getFolder(new Path("/WEB-INF")); //$NON-NLS-1$
@@ -82,11 +92,22 @@
return (!webInfDir.exists()) ? null : modulePath;
}
+ public static IPath getFirstWebContentPath(IProject project) {
+ IContainer[] cs = WebUtils.getWebRootFolders(project, true);
+ for (IContainer c: cs) {
+ if(c.exists()) {
+ return c.getFullPath();
+ }
+ }
+ return null;
+ }
+
+
static String getWebRootPath(IProject project, String webInfLocation) {
String webRootLocation = XModelConstants.WORKSPACE_REF + "/.."; //$NON-NLS-1$
- IPath wrp = ProjectHome.getFirstWebContentPath(project);
- IPath wip = ProjectHome.getWebInfPath(project);
+ IPath wrp = getFirstWebContentPath(project);
+ IPath wip = getWebInfPath(project);
if(wrp == null || wip == null) {
return webRootLocation;
14 years, 5 months
JBoss Tools SVN: r36419 - trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-11-17 16:13:32 -0500 (Thu, 17 Nov 2011)
New Revision: 36419
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/WebUtils.java
Log:
JBIDE-10177
https://issues.jboss.org/browse/JBIDE-10177
WebUtils moved to common
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/WebUtils.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/WebUtils.java 2011-11-17 21:11:20 UTC (rev 36418)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/WebUtils.java 2011-11-17 21:13:32 UTC (rev 36419)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.common.web;
import java.lang.reflect.InvocationTargetException;
14 years, 5 months
JBoss Tools SVN: r36418 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/bean/build.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-11-17 16:11:20 -0500 (Thu, 17 Nov 2011)
New Revision: 36418
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/bean/build/JSF2ProjectBuilder.java
Log:
JBIDE-10177
https://issues.jboss.org/browse/JBIDE-10177
WebUtils moved to common
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/bean/build/JSF2ProjectBuilder.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/bean/build/JSF2ProjectBuilder.java 2011-11-17 21:10:54 UTC (rev 36417)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/bean/build/JSF2ProjectBuilder.java 2011-11-17 21:11:20 UTC (rev 36418)
@@ -44,6 +44,7 @@
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.project.ProjectHome;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.web.WebUtils;
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.jsf2.bean.model.JSF2ProjectFactory;
import org.jboss.tools.jsf.jsf2.bean.model.impl.DefinitionContext;
@@ -263,7 +264,7 @@
public JSF2ResourceVisitor() {
getJavaSourceRoots(getProject());
- webinfs = ProjectHome.getWebInfPaths(getProject());
+ webinfs = WebUtils.getWebInfPaths(getProject());
}
void getJavaSourceRoots(IProject project) {
14 years, 5 months
JBoss Tools SVN: r36417 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-11-17 16:10:54 -0500 (Thu, 17 Nov 2011)
New Revision: 36417
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
Log:
JBIDE-10177
https://issues.jboss.org/browse/JBIDE-10177
WebUtils moved to common
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2011-11-17 21:10:23 UTC (rev 36416)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2011-11-17 21:10:54 UTC (rev 36417)
@@ -54,6 +54,7 @@
import org.jboss.tools.common.model.project.ProjectHome;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.web.WebUtils;
public class CDICoreBuilder extends IncrementalProjectBuilder {
public static String BUILDER_ID = "org.jboss.tools.cdi.core.cdibuilder";
@@ -387,7 +388,7 @@
Set<IPath> visited = new HashSet<IPath>();
CDIResourceVisitor() {
- webinfs = ProjectHome.getWebInfPaths(getProject());
+ webinfs = WebUtils.getWebInfPaths(getProject());
getJavaSourceRoots(getProject());
}
14 years, 5 months
JBoss Tools SVN: r36416 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-11-17 16:10:23 -0500 (Thu, 17 Nov 2011)
New Revision: 36416
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbResourceVisitor.java
Log:
JBIDE-10177
https://issues.jboss.org/browse/JBIDE-10177
WebUtils moved to common
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbResourceVisitor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbResourceVisitor.java 2011-11-17 21:09:53 UTC (rev 36415)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbResourceVisitor.java 2011-11-17 21:10:23 UTC (rev 36416)
@@ -20,6 +20,7 @@
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.project.ProjectHome;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.web.WebUtils;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
import org.jboss.tools.jst.web.kb.internal.scanner.IFileScanner;
import org.jboss.tools.jst.web.kb.internal.scanner.JSF2ResourcesScanner;
@@ -53,8 +54,8 @@
List<IPath> jsf2rs = new ArrayList<IPath>();
XModel model = InnerModelHelper.createXModel(p.getProject());
if(model != null) {
- webinfs = ProjectHome.getWebInfPaths(p.getProject());
- IPath[] webContents = ProjectHome.getWebContentPaths(p.getProject());
+ webinfs = WebUtils.getWebInfPaths(p.getProject());
+ IPath[] webContents = WebUtils.getWebContentPaths(p.getProject());
for (IPath webcontent: webContents) {
IPath jsf2r = webcontent.append("resources"); //$NON-NLS-1$
IResource rf = ResourcesPlugin.getWorkspace().getRoot().getFolder(jsf2r);
14 years, 5 months
JBoss Tools SVN: r36415 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-11-17 16:09:53 -0500 (Thu, 17 Nov 2011)
New Revision: 36415
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java
Log:
JBIDE-10177
https://issues.jboss.org/browse/JBIDE-10177
WebUtils moved to common
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java 2011-11-17 21:09:20 UTC (rev 36414)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java 2011-11-17 21:09:53 UTC (rev 36415)
@@ -11,32 +11,22 @@
package org.jboss.tools.common.model.project;
import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Properties;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.common.model.XModelConstants;
import org.jboss.tools.common.model.XModelObjectConstants;
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.util.*;
+import org.jboss.tools.common.web.WebUtils;
import org.w3c.dom.Element;
public class ProjectHome {
@@ -106,7 +96,7 @@
//Taken from J2EEUtils and modified
public static IPath getWebInfPath(IProject project) {
- IPath[] ps = getWebInfPaths(project);
+ IPath[] ps = WebUtils.getWebInfPaths(project);
if(ps.length > 0) {
return ps[0];
}
@@ -117,122 +107,7 @@
return (!webInfDir.exists()) ? null : modulePath;
}
- public static IPath[] getWebInfPaths(IProject project) {
- IVirtualComponent component = ComponentCore.createComponent(project);
- if(component != null && component.getRootFolder() != null) {
- List<IPath> ps = new ArrayList<IPath>();
- IContainer[] cs = getWebRootFolders(project, true);
- for (IContainer c: cs) {
- if(c.exists()) {
- IFolder f = c.getFolder(new Path("/WEB-INF")); //$NON-NLS-1$
- if(f.exists()) {
- ps.add(f.getFullPath());
- }
- }
- }
- return ps.toArray(new IPath[0]);
- }
- return new IPath[0];
- }
-
- public static IPath[] getWebContentPaths(IProject project) {
- IVirtualComponent component = ComponentCore.createComponent(project);
- if(component != null && component.getRootFolder() != null) {
-
- List<IPath> ps = new ArrayList<IPath>();
- IContainer[] cs = getWebRootFolders(project, true);
- for (IContainer c: cs) {
- if(c.exists()) {
- ps.add(c.getFullPath());
- }
- }
- return ps.toArray(new IPath[0]);
- }
- return new IPath[0];
- }
-
public static IPath getFirstWebContentPath(IProject project) {
- IPath modulePath = null;
- IVirtualComponent vc = ComponentCore.createComponent(project);
- if (vc == null || vc.getRootFolder() == null)
- return null;
- IContainer[] cs = getWebRootFolders(project, true);
- for (IContainer c: cs) {
- if(c.exists()) {
- return c.getFullPath();
- }
- }
- if (ModuleCoreNature.isFlexibleProject(project)) {
- modulePath = vc.getRootFolder().getWorkspaceRelativePath();
- }
-
- return modulePath;
+ return WebUtils.getFirstWebContentPath(project);
}
-
- public static IContainer[] getWebRootFolders(IProject project, boolean ignoreDerived) {
- IFacetedProject facetedProject = null;
- try {
- facetedProject = ProjectFacetsManager.create(project);
- } catch (CoreException e) {
- ModelPlugin.getDefault().logError(e);
- }
- if(facetedProject!=null && facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.DYNAMIC_WEB_FACET)!=null) {
- IVirtualComponent component = ComponentCore.createComponent(project);
- if(component!=null) {
- IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
-
- IPath defaultPath = getDefaultDeploymentDescriptorFolder(webRootVirtFolder);
-
- IContainer[] folders = webRootVirtFolder.getUnderlyingFolders();
- if(folders.length > 1){
- ArrayList<IContainer> containers = new ArrayList<IContainer>();
- for(IContainer container : folders){
- if(!ignoreDerived || !container.isDerived(IResource.CHECK_ANCESTORS)) {
- if(defaultPath!=null && defaultPath.equals(container.getFullPath())) {
- containers.add(0, container); // Put default root folder to the first position of the list
- } else {
- containers.add(container);
- }
- }
- }
- return containers.toArray(new IContainer[containers.size()]);
- } else {
- return folders;
- }
- }
- }
- return EMPTY_ARRAY;
- }
-
- private static final IContainer[] EMPTY_ARRAY = new IContainer[0];
- private static boolean WTP_3_3_0 = false;
-
- /**
- * Returns all the web root folders of the project.
- * If the project is not a web project then the method will return an empty array.
- * All the derived resources or resources belonged to derived containers will be eliminated.
- * If some folder is set as default web root source folder (available since WTP 3.3.1) then this folder will be places in the very beginning of the result array.
- * @param project
- * @return
- */
- public static IPath getDefaultDeploymentDescriptorFolder(IVirtualFolder folder) {
- if(!WTP_3_3_0) {
- try {
- Method getDefaultDeploymentDescriptorFolder = J2EEModuleVirtualComponent.class.getMethod("getDefaultDeploymentDescriptorFolder", IVirtualFolder.class); //$NON-NLS-1$
- return (IPath) getDefaultDeploymentDescriptorFolder.invoke(null, folder);
- } catch (NoSuchMethodException nsme) {
- // Not available in this WTP version, let's ignore it
- WTP_3_3_0 = true;
- } catch (IllegalArgumentException e) {
- ModelPlugin.getDefault().logError(e);
- } catch (IllegalAccessException e) {
- ModelPlugin.getDefault().logError(e);
- } catch (InvocationTargetException e) {
- // Not available in this WTP version, let's ignore it
- WTP_3_3_0 = true;
- }
- }
- return null;
- }
-
}
14 years, 5 months
JBoss Tools SVN: r36414 - in trunk/common/plugins/org.jboss.tools.common: src/org/jboss/tools/common and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-11-17 16:09:20 -0500 (Thu, 17 Nov 2011)
New Revision: 36414
Added:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/WebUtils.java
Modified:
trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF
Log:
JBIDE-10177
https://issues.jboss.org/browse/JBIDE-10177
WebUtils moved to common
Modified: trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF 2011-11-17 20:32:10 UTC (rev 36413)
+++ trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF 2011-11-17 21:09:20 UTC (rev 36414)
@@ -16,9 +16,16 @@
org.jboss.tools.common.text,
org.jboss.tools.common.util,
org.jboss.tools.common.xml,
+ org.jboss.tools.common.web,
org.jboss.tools.common.zip
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.wst.xml.core;bundle-version="1.1.600";visibility:=reexport,
+ org.eclipse.wst.common.modulecore;bundle-version="1.2.100",
+ org.eclipse.jst.j2ee;bundle-version="1.1.500",
+ org.eclipse.jst.j2ee.core;bundle-version="1.2.100",
+ org.eclipse.wst.common.project.facet.core;bundle-version="1.4.200",
+ org.eclipse.jem.util;bundle-version="2.1.2",
+ org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.2.100",
org.eclipse.jface;bundle-version="3.7.0",
org.eclipse.core.resources;bundle-version="3.7.100",
org.eclipse.ui;bundle-version="3.7.0",
Added: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/WebUtils.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/WebUtils.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/WebUtils.java 2011-11-17 21:09:20 UTC (rev 36414)
@@ -0,0 +1,145 @@
+package org.jboss.tools.common.web;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.common.CommonPlugin;
+
+public class WebUtils {
+
+ public static IPath[] getWebInfPaths(IProject project) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if(component != null && component.getRootFolder() != null) {
+ List<IPath> ps = new ArrayList<IPath>();
+ IContainer[] cs = getWebRootFolders(project, true);
+ for (IContainer c: cs) {
+ if(c.exists()) {
+ IFolder f = c.getFolder(new Path("/WEB-INF")); //$NON-NLS-1$
+ if(f.exists()) {
+ ps.add(f.getFullPath());
+ }
+ }
+ }
+ return ps.toArray(new IPath[0]);
+ }
+ return new IPath[0];
+ }
+
+ public static IPath[] getWebContentPaths(IProject project) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if(component != null && component.getRootFolder() != null) {
+
+ List<IPath> ps = new ArrayList<IPath>();
+ IContainer[] cs = getWebRootFolders(project, true);
+ for (IContainer c: cs) {
+ if(c.exists()) {
+ ps.add(c.getFullPath());
+ }
+ }
+ return ps.toArray(new IPath[0]);
+ }
+ return new IPath[0];
+ }
+
+ public static IPath getFirstWebContentPath(IProject project) {
+ IPath modulePath = null;
+ IVirtualComponent vc = ComponentCore.createComponent(project);
+ if (vc == null || vc.getRootFolder() == null)
+ return null;
+ IContainer[] cs = getWebRootFolders(project, true);
+ for (IContainer c: cs) {
+ if(c.exists()) {
+ return c.getFullPath();
+ }
+ }
+ if (ModuleCoreNature.isFlexibleProject(project)) {
+ modulePath = vc.getRootFolder().getWorkspaceRelativePath();
+ }
+
+ return modulePath;
+ }
+
+ public static IContainer[] getWebRootFolders(IProject project, boolean ignoreDerived) {
+ IFacetedProject facetedProject = null;
+ try {
+ facetedProject = ProjectFacetsManager.create(project);
+ } catch (CoreException e) {
+ CommonPlugin.getDefault().logError(e);
+ }
+ if(facetedProject!=null && facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.DYNAMIC_WEB_FACET)!=null) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if(component!=null) {
+ IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
+
+ IPath defaultPath = getDefaultDeploymentDescriptorFolder(webRootVirtFolder);
+
+ IContainer[] folders = webRootVirtFolder.getUnderlyingFolders();
+ if(folders.length > 1){
+ ArrayList<IContainer> containers = new ArrayList<IContainer>();
+ for(IContainer container : folders){
+ if(!ignoreDerived || !container.isDerived(IResource.CHECK_ANCESTORS)) {
+ if(defaultPath!=null && defaultPath.equals(container.getFullPath())) {
+ containers.add(0, container); // Put default root folder to the first position of the list
+ } else {
+ containers.add(container);
+ }
+ }
+ }
+ return containers.toArray(new IContainer[containers.size()]);
+ } else {
+ return folders;
+ }
+ }
+ }
+ return EMPTY_ARRAY;
+ }
+
+ private static final IContainer[] EMPTY_ARRAY = new IContainer[0];
+ private static boolean WTP_3_3_0 = false;
+
+ /**
+ * Returns all the web root folders of the project.
+ * If the project is not a web project then the method will return an empty array.
+ * All the derived resources or resources belonged to derived containers will be eliminated.
+ * If some folder is set as default web root source folder (available since WTP 3.3.1) then this folder will be places in the very beginning of the result array.
+ * @param project
+ * @return
+ */
+ public static IPath getDefaultDeploymentDescriptorFolder(IVirtualFolder folder) {
+ if(!WTP_3_3_0) {
+ try {
+ Method getDefaultDeploymentDescriptorFolder = J2EEModuleVirtualComponent.class.getMethod("getDefaultDeploymentDescriptorFolder", IVirtualFolder.class); //$NON-NLS-1$
+ return (IPath) getDefaultDeploymentDescriptorFolder.invoke(null, folder);
+ } catch (NoSuchMethodException nsme) {
+ // Not available in this WTP version, let's ignore it
+ WTP_3_3_0 = true;
+ } catch (IllegalArgumentException e) {
+ CommonPlugin.getDefault().logError(e);
+ } catch (IllegalAccessException e) {
+ CommonPlugin.getDefault().logError(e);
+ } catch (InvocationTargetException e) {
+ // Not available in this WTP version, let's ignore it
+ WTP_3_3_0 = true;
+ }
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/WebUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 5 months
JBoss Tools SVN: r36413 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-11-17 15:32:10 -0500 (Thu, 17 Nov 2011)
New Revision: 36413
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java
Log:
JBIDE-10177
https://issues.jboss.org/browse/JBIDE-10177
Fix for default web content folder for XModel.
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java 2011-11-17 19:26:02 UTC (rev 36412)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java 2011-11-17 20:32:10 UTC (rev 36413)
@@ -131,18 +131,6 @@
}
}
return ps.toArray(new IPath[0]);
-
-// IVirtualFolder webInfDir = component.getRootFolder().getFolder(new Path("/WEB-INF")); //$NON-NLS-1$
-// if(webInfDir.exists()) {
-// IContainer[] cs = webInfDir.getUnderlyingFolders();
-// List<IPath> ps = new ArrayList<IPath>();
-// for (IContainer c: cs) {
-// if(c.exists()) {
-// ps.add(c.getFullPath());
-// }
-// }
-// return ps.toArray(new IPath[0]);
-// }
}
return new IPath[0];
}
@@ -155,25 +143,10 @@
IContainer[] cs = getWebRootFolders(project, true);
for (IContainer c: cs) {
if(c.exists()) {
- IFolder f = c.getFolder(new Path("/WEB-INF")); //$NON-NLS-1$
- if(f.exists()) {
- ps.add(f.getFullPath());
- }
+ ps.add(c.getFullPath());
}
}
return ps.toArray(new IPath[0]);
-
-// IVirtualFolder webDir = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
-// if(webDir.exists()) {
-// IContainer[] cs = webDir.getUnderlyingFolders();
-// List<IPath> ps = new ArrayList<IPath>();
-// for (IContainer c: cs) {
-// if(c.exists()) {
-// ps.add(c.getFullPath());
-// }
-// }
-// return ps.toArray(new IPath[0]);
-// }
}
return new IPath[0];
}
14 years, 5 months
JBoss Tools SVN: r36412 - in trunk: cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences and 14 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-11-17 14:26:02 -0500 (Thu, 17 Nov 2011)
New Revision: 36412
Added:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityPreferencePage.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java
trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/TestValidator.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidationConfigurationBlock.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/KBValidationConfigurationBlock.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorConfigurationBlock.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationErrorManager.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java
Log:
"Configure Problem Severity" quick fix for every CDI Problem Markers which opens Preferences Dialog filtered with current problem https://issues.jboss.org/browse/JBIDE-9885
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -2517,5 +2517,10 @@
CDICorePlugin.getDefault().logError(e);
}
}
+
+ @Override
+ protected String getPreferencePageId() {
+ return "org.jboss.tools.cdi.ui.preferences.CDIValidatorPreferencePage";
+ }
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -69,4 +69,9 @@
protected IDialogSettings getDialogSettings() {
return CDICorePlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
}
+
+ @Override
+ protected String getQualifier() {
+ return CDICorePlugin.PLUGIN_ID;
+ }
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF 2011-11-17 19:26:02 UTC (rev 36412)
@@ -21,7 +21,8 @@
org.eclipse.core.databinding.beans;bundle-version="1.2.100",
org.eclipse.ui.navigator;bundle-version="3.5.100",
org.eclipse.ui.navigator.resources;bundle-version="3.4.300",
- org.eclipse.debug.ui;bundle-version="3.7.0"
+ org.eclipse.debug.ui;bundle-version="3.7.0",
+ org.jboss.tools.common.validation;bundle-version="3.3.0"
Export-Package: org.jboss.tools.common.ui,
org.jboss.tools.common.ui.databinding,
org.jboss.tools.common.ui.preferences,
Modified: trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml 2011-11-17 19:26:02 UTC (rev 36412)
@@ -55,4 +55,9 @@
name="%perspective.name">
</perspective>
</extension>
+ <extension point="org.eclipse.ui.ide.markerResolution">
+ <markerResolutionGenerator
+ class="org.jboss.tools.common.ui.marker.ConfigureProblemSeverityResolutionGenerator"/>
+ </extension>
+
</plugin>
Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -73,6 +73,8 @@
public static String URLSTRINGVALIDATOR_NOT_A_VALID_URL;
public static String MANDATORYSTRING_VALIDATOR_MUST_PROVIDE_VALUE;
+
+ public static String CONFIGURE_PROBLEM_SEVERITY;
static {
NLS.initializeMessages(BUNDLE_NAME, CommonUIMessages.class);
Added: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.ui.marker;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMarkerResolution2;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.progress.UIJob;
+import org.jboss.tools.common.ui.CommonUIMessages;
+
+/**
+ * @author Daniel Azarov
+ */
+public class ConfigureProblemSeverityMarkerResolution implements
+ IMarkerResolution2 {
+ private String preferencePageId;
+ private String preferenceKey;
+
+ public ConfigureProblemSeverityMarkerResolution(String preferencePageId, String preferenceKey){
+ this.preferencePageId = preferencePageId;
+ this.preferenceKey = preferenceKey;
+ }
+
+ public String getLabel() {
+ return CommonUIMessages.CONFIGURE_PROBLEM_SEVERITY;
+ }
+
+ public void run(IMarker marker) {
+ UIJob job = new UIJob(""){ //$NON-NLS-1$
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ PreferencesUtil.createPreferenceDialogOn(DebugUIPlugin.getShell(),
+ ConfigureProblemSeverityMarkerResolution.this.preferencePageId,
+ new String[]{ConfigureProblemSeverityMarkerResolution.this.preferencePageId},
+ ConfigureProblemSeverityMarkerResolution.this.preferenceKey).open();
+ return Status.OK_STATUS;
+ }
+ };
+ job.setSystem(true);
+ job.setPriority(Job.INTERACTIVE);
+ job.schedule();
+ }
+
+ public String getDescription() {
+ return CommonUIMessages.CONFIGURE_PROBLEM_SEVERITY;
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.ui.marker;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolutionGenerator2;
+import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+
+/**
+ * @author Daniel Azarov
+ */
+public class ConfigureProblemSeverityResolutionGenerator implements
+ IMarkerResolutionGenerator2 {
+
+ public IMarkerResolution[] getResolutions(IMarker marker) {
+ try {
+ String preferenceKey = getPreferenceKey(marker);
+ String preferencePageId = getPreferencePageId(marker);
+ if(preferenceKey != null && preferencePageId != null){
+ return new IMarkerResolution[]{new ConfigureProblemSeverityMarkerResolution(preferencePageId, preferenceKey)};
+ }
+ } catch (CoreException e) {
+ CommonUIPlugin.getDefault().logError(e);
+ }
+ return new IMarkerResolution[] {};
+ }
+
+ public boolean hasResolutions(IMarker marker) {
+ try {
+ return getPreferenceKey(marker) != null && getPreferencePageId(marker) != null;
+ } catch (CoreException ex) {
+ CommonUIPlugin.getDefault().logError(ex);
+ }
+ return false;
+ }
+
+ private String getPreferenceKey(IMarker marker)throws CoreException{
+ String attribute = marker.getAttribute(ValidationErrorManager.PREFERENCE_KEY_ATTRIBUTE_NAME, null);
+ return attribute;
+ }
+
+ private String getPreferencePageId(IMarker marker)throws CoreException{
+ String attribute = marker.getAttribute(ValidationErrorManager.PREFERENCE_PAGE_ID_NAME, null);
+ return attribute;
+ }
+
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties 2011-11-17 19:26:02 UTC (rev 36412)
@@ -31,4 +31,6 @@
BROWSER_COULD_NOT_DISPLAY_MALFORMED_URL=Could not display malformed url \"{0}\".
URLSTRINGVALIDATOR_NOT_A_VALID_URL=\"{0}\" is not a valid url.
-MANDATORYSTRING_VALIDATOR_MUST_PROVIDE_VALUE=You have to provide a {0}.
\ No newline at end of file
+MANDATORYSTRING_VALIDATOR_MUST_PROVIDE_VALUE=You have to provide a {0}.
+
+CONFIGURE_PROBLEM_SEVERITY=Configure Problem Severity
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -32,6 +32,7 @@
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
@@ -83,7 +84,7 @@
protected PixelConverter fPixelConverter;
protected FilteredPreferenceTree fFilteredPrefTree;
-
+
public SeverityConfigurationBlock(IStatusChangeListener context,
IProject project, Key[] allKeys,
IWorkbenchPreferenceContainer container) {
@@ -300,4 +301,25 @@
key = getKey(pluginId, keyName);
}
}
+
+ public void doFilter(String prefId){
+ String qualifier = getQualifier();
+ Key key = null;
+ for(Key k : fAllKeys){
+ if(k.getQualifier().equals(qualifier) && k.getName().equals(prefId))
+ key = k;
+ }
+ if(key != null){
+ Combo combo = getComboBox(key);
+ if(combo != null){
+ String value = ((Label)fLabels.get(combo)).getText();
+
+ if(value != null)
+ fFilteredPrefTree.doFilter(value);
+ }
+ }
+ }
+
+ abstract protected String getQualifier();
+
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityPreferencePage.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityPreferencePage.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityPreferencePage.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -155,4 +155,13 @@
getPreferenceStore().setValue(SeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, newValue);
}
}
+
+ @Override
+ public void applyData(Object data) {
+ if(data instanceof String){
+ getConfigurationBlock().doFilter((String)data);
+ }else{
+ super.applyData(data);
+ }
+ }
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -41,6 +41,8 @@
public static String DEFAULT_VALIDATION_MARKER = ValidationPlugin.PLUGIN_ID + ".problemmarker"; //$NON-NLS-1$
static String VALIDATION_MARKER_OWNER = "owner"; //$NON-NLS-1$
static String VALIDATION_MARKER_GROUP = "groupName"; //$NON-NLS-1$
+ public static final String PREFERENCE_KEY_ATTRIBUTE_NAME = "preference_key"; //$NON-NLS-1$
+ public static final String PREFERENCE_PAGE_ID_NAME = "preference_page_id"; //$NON-NLS-1$
protected IStatus OK_STATUS = new Status(IStatus.OK,
"org.eclipse.wst.validation", 0, "OK", null); //$NON-NLS-1$ //$NON-NLS-2$
@@ -226,6 +228,8 @@
markers.clear();
}
+ abstract protected String getPreferencePageId();
+
/*
* (non-Javadoc)
* @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#addError(java.lang.String, java.lang.String, java.lang.String[], int, int, org.eclipse.core.resources.IResource)
@@ -251,6 +255,18 @@
marker = addError(message, severity, messageArguments, lineNumber, length, offset, target, getDocumentProvider(), getMarkerId(), getMarkerOwner());
}
}
+ try {
+ if(marker!=null) {
+ String preferencePageId = getPreferencePageId();
+ if(preferencePageId != null && preferenceKey != null){
+ marker.setAttribute(PREFERENCE_KEY_ATTRIBUTE_NAME, preferenceKey);
+ marker.setAttribute(PREFERENCE_PAGE_ID_NAME, preferencePageId);
+ }
+
+ }
+ } catch(CoreException e) {
+ CommonPlugin.getDefault().logError(e);
+ }
return marker;
}
Modified: trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/TestValidator.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/TestValidator.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/TestValidator.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -100,4 +100,9 @@
public String getMarkerType() {
return ValidationErrorManager.DEFAULT_VALIDATION_MARKER;
}
+
+ @Override
+ protected String getPreferencePageId() {
+ return null;
+ }
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -377,4 +377,9 @@
protected boolean shouldValidateJavaSources() {
return false;
}
+
+ @Override
+ protected String getPreferencePageId() {
+ return "org.jboss.tools.jsf.ui.preferences.JSFValidationPreferencePage";
+ }
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidationConfigurationBlock.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidationConfigurationBlock.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidationConfigurationBlock.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -84,4 +84,9 @@
protected IDialogSettings getDialogSettings() {
return JSFModelPlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
}
+
+ @Override
+ protected String getQualifier() {
+ return JSFModelPlugin.PLUGIN_ID;
+ }
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -490,4 +490,9 @@
protected boolean shouldValidateJavaSources() {
return true;
}
+
+ @Override
+ protected String getPreferencePageId() {
+ return "org.jboss.tools.jst.web.kb.preferences.KBValidationPreferencePage";
+ }
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/KBValidationConfigurationBlock.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/KBValidationConfigurationBlock.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/KBValidationConfigurationBlock.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -71,4 +71,9 @@
protected IDialogSettings getDialogSettings() {
return WebKbPlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
}
+
+ @Override
+ protected String getQualifier() {
+ return WebKbPlugin.PLUGIN_ID;
+ }
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorConfigurationBlock.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorConfigurationBlock.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorConfigurationBlock.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -183,4 +183,9 @@
protected IDialogSettings getDialogSettings() {
return WebKbPlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
}
+
+ @Override
+ protected String getQualifier() {
+ return WebKbPlugin.PLUGIN_ID;
+ }
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationErrorManager.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationErrorManager.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationErrorManager.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -37,4 +37,9 @@
public int getMaxNumberOfMarkersPerFile(IProject project) {
return SeamPreferences.getMaxNumberOfProblemMarkersPerFile(project);
}
+
+ @Override
+ protected String getPreferencePageId() {
+ return "org.jboss.tools.seam.ui.preferences.SeamValidatorPreferencePage";
+ }
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java 2011-11-17 19:18:12 UTC (rev 36411)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java 2011-11-17 19:26:02 UTC (rev 36412)
@@ -180,4 +180,9 @@
protected IDialogSettings getDialogSettings() {
return SeamCorePlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
}
+
+ @Override
+ protected String getQualifier() {
+ return SeamCorePlugin.PLUGIN_ID;
+ }
}
\ No newline at end of file
14 years, 5 months
JBoss Tools SVN: r36411 - in workspace/yradtsevich/browsersim/swt-webkit-browsersim: org.jboss.tools.browsersim.webkit/src/org/jboss/tools/browsersim/webkit and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2011-11-17 14:18:12 -0500 (Thu, 17 Nov 2011)
New Revision: 36411
Modified:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit/src/org/jboss/tools/browsersim/webkit/WebKitBrowserFactory.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ui/BrowserSim.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ui/Messages.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ui/messages.properties
Log:
https://issues.jboss.org/browse/JBIDE-9539 : Browsersim app for testing mobile/desktop web apps
- unsupported platform handling
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ui/BrowserSim.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ui/BrowserSim.java 2011-11-17 19:13:02 UTC (rev 36410)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ui/BrowserSim.java 2011-11-17 19:18:12 UTC (rev 36411)
@@ -131,11 +131,11 @@
try {
browser = WebKitBrowserFactory.createWebKitBrowser(shell, SWT.NONE);
} catch (SWTError e) {
- System.out.println(Messages.BrowserSim_COULD_NOT_INSTANTIATE_BROWSER + e.getMessage());
+ System.out.println(Messages.BrowserSim_COULD_NOT_INSTANTIATE_WEBKIT_BROWSER + e.getMessage());
MessageBox messageBox = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
messageBox.setText("Error");
- messageBox.setMessage(Messages.BrowserSim_COULD_NOT_INSTANTIATE_BROWSER + e.getMessage());
+ messageBox.setMessage(Messages.BrowserSim_COULD_NOT_INSTANTIATE_WEBKIT_BROWSER + e.getMessage());
messageBox.open();
display.dispose();
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ui/Messages.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ui/Messages.java 2011-11-17 19:13:02 UTC (rev 36410)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ui/Messages.java 2011-11-17 19:18:12 UTC (rev 36411)
@@ -19,7 +19,7 @@
private static final String BUNDLE_NAME = Messages.class.getName().toString().toLowerCase();
public static String BrowserSim_ADDRESS;
public static String BrowserSim_BROWSER_SIM;
- public static String BrowserSim_COULD_NOT_INSTANTIATE_BROWSER;
+ public static String BrowserSim_COULD_NOT_INSTANTIATE_WEBKIT_BROWSER;
public static String BrowserSim_DEVICES;
public static String BrowserSim_ERROR;
public static String BrowserSim_EXIT;
@@ -47,6 +47,7 @@
public static String ManageDevicesDialog_LOAD_DEFAULTS;
public static String ManageDevicesDialog_USER_AGENT;
public static String ManageDevicesDialog_WIDTH;
+
static {
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ui/messages.properties
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ui/messages.properties 2011-11-17 19:13:02 UTC (rev 36410)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ui/messages.properties 2011-11-17 19:18:12 UTC (rev 36411)
@@ -1,6 +1,6 @@
BrowserSim_ADDRESS=Address
BrowserSim_BROWSER_SIM=BrowserSim
-BrowserSim_COULD_NOT_INSTANTIATE_BROWSER=Could not instantiate Browser:
+BrowserSim_COULD_NOT_INSTANTIATE_WEBKIT_BROWSER=Could not instantiate WebKit Browser:
BrowserSim_DEVICES=Devices
BrowserSim_ERROR=Error
BrowserSim_EXIT=Exit
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit/src/org/jboss/tools/browsersim/webkit/WebKitBrowserFactory.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit/src/org/jboss/tools/browsersim/webkit/WebKitBrowserFactory.java 2011-11-17 19:13:02 UTC (rev 36410)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit/src/org/jboss/tools/browsersim/webkit/WebKitBrowserFactory.java 2011-11-17 19:18:12 UTC (rev 36411)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.browsersim.webkit;
+import org.eclipse.swt.SWTError;
import org.eclipse.swt.widgets.Composite;
import org.jboss.tools.browsersim.webkit.internal.WebKitBrowser_gtk_linux_x86;
import org.jboss.tools.browsersim.webkit.internal.WebKitBrowser_gtk_linux_x86_64;
@@ -30,7 +31,7 @@
} else if (PlatformUtil.CURRENT_PLATFORM.equals("win32.win32.x86")) {
return new WebKitBrowser_win32_win32_x86(parent, style);
}
- //TODO: handle null properly in callers
- return null;
+
+ throw new SWTError("Unsupported Platform");
}
}
14 years, 5 months