Author: vrubezhny
Date: 2009-08-19 10:53:59 -0400 (Wed, 19 Aug 2009)
New Revision: 17161
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/actions/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/actions/EnableJSFCAOnProject.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/actions/KBProblemMarkerResolutionGenerator.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties
Log:
JBIDE-4770: The quick-fix is to be present to allow to specify the KB-nature and
KB-builder on the project.
Issue is fixed.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2009-08-19 13:32:30 UTC (rev
17160)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2009-08-19 14:53:59 UTC (rev
17161)
@@ -531,10 +531,20 @@
</key>
</extension>
- <extension id="kbproblemmarker" name="%KBProblemName"
point="org.eclipse.core.resources.markers">
+ <extension id="kbproblemmarker" name="%KBProblemName"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.core.resources.problemmarker">
</super>
<persistent value="true">
</persistent>
+
</extension>
+
+ <extension point="org.eclipse.ui.ide.markerResolution">
+ <markerResolutionGenerator
+ markerType="org.jboss.tools.jst.jsp.kbproblemmarker"
+ class="org.jboss.tools.jst.jsp.contentassist.actions.KBProblemMarkerResolutionGenerator">
+ </markerResolutionGenerator>
+ </extension>
+
+
</plugin>
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-08-19
13:32:30 UTC (rev 17160)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-08-19
14:53:59 UTC (rev 17161)
@@ -164,12 +164,9 @@
private IMarker createOrUpdateKbProblemMarker(IMarker m, IResource r, boolean
kbNatureIsAbsent, boolean kbBuilderIsAbsent) throws CoreException {
ArrayList<String> args = new ArrayList<String>();
- if (kbNatureIsAbsent) {
- args.add(JstUIMessages.KBNATURE_NOT_FOUND);
- }
- if (kbBuilderIsAbsent) {
- args.add(JstUIMessages.KBBUILDER_NOT_FOUND);
- }
+ args.add(kbNatureIsAbsent ? JstUIMessages.KBNATURE_NOT_FOUND : "");
//$NON-NLS-1$
+ args.add(kbBuilderIsAbsent ? JstUIMessages.KBBUILDER_NOT_FOUND : "");
//$NON-NLS-1$
+
String message = MessageFormat.format(JstUIMessages.KBPROBLEM, args.toArray());
if (m == null) m = r.createMarker(KB_PROBLEM_MARKER_TYPE);
m.setAttribute(IMarker.MESSAGE, message);
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/actions/EnableJSFCAOnProject.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/actions/EnableJSFCAOnProject.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/actions/EnableJSFCAOnProject.java 2009-08-19
14:53:59 UTC (rev 17161)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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.jst.jsp.contentassist.actions;
+
+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.ui.IMarkerResolution;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor;
+import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+import org.jboss.tools.jst.web.kb.IKbProject;
+
+/**
+ * The Marker Resolution that enables the KB Nature on the project
+ *
+ * @author Victor Rubezhny
+ *
+ */
+public class EnableJSFCAOnProject implements IMarkerResolution{
+
+ public String getLabel() {
+ return JstUIMessages.ENABLE_KB;
+ }
+
+ public void run(IMarker marker) {
+ IResource resource = marker.getResource();
+ IProject project = resource instanceof IProject ? (IProject)resource :
+ resource != null ? resource.getProject() : null;
+
+ if (project == null)
+ return;
+
+ try {
+ EclipseResourceUtil.addNatureToProject(project, IKbProject.NATURE_ID);
+ // Find existing KBNATURE problem marker and kill it if exists
+ project.deleteMarkers(AbstractXMLContentAssistProcessor.KB_PROBLEM_MARKER_TYPE, true,
IResource.DEPTH_ONE);
+ } catch (CoreException e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/actions/EnableJSFCAOnProject.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/actions/KBProblemMarkerResolutionGenerator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/actions/KBProblemMarkerResolutionGenerator.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/actions/KBProblemMarkerResolutionGenerator.java 2009-08-19
14:53:59 UTC (rev 17161)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.jst.jsp.contentassist.actions;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolutionGenerator;
+
+/**
+ * Shows the Marker Resolutions for KB Problem Marker
+ *
+ * @author Victor Rubezhny
+ *
+ */
+public class KBProblemMarkerResolutionGenerator implements IMarkerResolutionGenerator {
+ public IMarkerResolution[] getResolutions(IMarker marker) {
+ return new IMarkerResolution[] {
+ new EnableJSFCAOnProject()
+ };
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/actions/KBProblemMarkerResolutionGenerator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java 2009-08-19
13:32:30 UTC (rev 17160)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java 2009-08-19
14:53:59 UTC (rev 17161)
@@ -118,4 +118,5 @@
public static String KBNATURE_NOT_FOUND;
public static String KBBUILDER_NOT_FOUND;
public static String KBPROBLEM;
+ public static String ENABLE_KB;
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties 2009-08-19
13:32:30 UTC (rev 17160)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties 2009-08-19
14:53:59 UTC (rev 17161)
@@ -96,3 +96,4 @@
KBNATURE_NOT_FOUND=KB Nature is not installed.
KBBUILDER_NOT_FOUND=KB Builder is not installed.
KBPROBLEM=KB Problem: {0} {1} Use Quick Fix to allow JSF Content Assistant.
+ENABLE_KB=Enable JSF CA on this project