JBoss Tools SVN: r20536 - in trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui: action and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-02-28 04:59:15 -0500 (Sun, 28 Feb 2010)
New Revision: 20536
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/Messages.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-4876
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/Messages.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/Messages.java 2010-02-28 09:28:32 UTC (rev 20535)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/Messages.java 2010-02-28 09:59:15 UTC (rev 20536)
@@ -70,6 +70,7 @@
public static String WebAppFoldersFormLayoutData_Persistence;
public static String WebCompoundEditor_WebXMLEditor;
public static String XActionProvider_CompanyName;
+ public static String AddTLDMarkerResolution_Name;
static {
// initialize resource bundle
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java 2010-02-28 09:28:32 UTC (rev 20535)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java 2010-02-28 09:59:15 UTC (rev 20536)
@@ -10,19 +10,17 @@
******************************************************************************/
package org.jboss.tools.jst.web.ui.action;
-import java.util.HashMap;
import java.util.Properties;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.DocumentProviderRegistry;
import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteTaglibInserter;
+import org.jboss.tools.jst.web.ui.Messages;
import org.jboss.tools.jst.web.ui.WebUiPlugin;
/**
@@ -32,62 +30,31 @@
*
*/
public class AddTLDMarkerResolution implements IMarkerResolution{
- private IFile file;
- private IDocument document;
+ private IDocumentProvider provider;
+ private FileEditorInput input;
private Properties properties;
- public static HashMap<String, String> libs = new HashMap<String, String>();
- static{
- libs.put("s", "http://jboss.com/products/seam/taglib"); //$NON-NLS-1$//$NON-NLS-2$
- libs.put("ui", "http://java.sun.com/jsf/facelets"); //$NON-NLS-1$ //$NON-NLS-2$
- libs.put("f", "http://java.sun.com/jsf/core"); //$NON-NLS-1$ //$NON-NLS-2$
- libs.put("h", "http://java.sun.com/jsf/html"); //$NON-NLS-1$ //$NON-NLS-2$
- libs.put("rich", "http://richfaces.org/rich"); //$NON-NLS-1$ //$NON-NLS-2$
- libs.put("a4j", "http://richfaces.org/a4j"); //$NON-NLS-1$ //$NON-NLS-2$
- libs.put("a", "http://richfaces.org/a4j"); //$NON-NLS-1$ //$NON-NLS-2$
- libs.put("c", "http://java.sun.com/jstl/core"); //$NON-NLS-1$ //$NON-NLS-2$
- libs.put("jsp", "http://java.sun.com/JSP/Page"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public AddTLDMarkerResolution(IFile file, IDocument document, Properties properties){
- this.file = file;
- this.document = document;
+ public AddTLDMarkerResolution(IDocumentProvider provider, FileEditorInput input, Properties properties){
+ this.provider = provider;
+ this.input = input;
this.properties = properties;
}
public String getLabel() {
- return "Insert tag library defenition";
+ return Messages.AddTLDMarkerResolution_Name;
}
- public static String getPrifix(String message){
- String prefix="";
-
- int start = message.indexOf("(");
- if(start < 0)
- return null;
-
- int end = message.indexOf(":", start);
- if(end < 0)
- return null;
-
- prefix = message.substring(start+1, end);
-
- return prefix;
- }
- public static IDocument getDocument(IFile file) {
- FileEditorInput input = new FileEditorInput(file);
- IDocumentProvider provider= DocumentProviderRegistry.getDefault().getDocumentProvider(input);
- try {
- provider.connect(input);
- } catch (CoreException e) {
- WebUiPlugin.getPluginLog().logError(e);
- }
- return provider.getDocument(input);
- }
public void run(IMarker marker) {
+ IDocument document = provider.getDocument(input);
PaletteTaglibInserter inserter = new PaletteTaglibInserter();
inserter.inserTaglib(document, properties);
+ try{
+ provider.saveDocument(new NullProgressMonitor(), input, document, true);
+ }catch(CoreException ex){
+ WebUiPlugin.getPluginLog().logError(ex);
+ }
}
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2010-02-28 09:28:32 UTC (rev 20535)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2010-02-28 09:59:15 UTC (rev 20536)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jst.web.ui.action;
+import java.util.HashMap;
import java.util.Properties;
import org.eclipse.core.resources.IFile;
@@ -22,6 +23,9 @@
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.DocumentProviderRegistry;
+import org.eclipse.ui.texteditor.IDocumentProvider;
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteTaglibInserter;
@@ -34,15 +38,30 @@
*
*/
public class JSPProblemMarkerResolutionGenerator implements IMarkerResolutionGenerator {
+
+ public static HashMap<String, String> libs = new HashMap<String, String>();
+ static{
+ libs.put("s", "http://jboss.com/products/seam/taglib"); //$NON-NLS-1$//$NON-NLS-2$
+ libs.put("ui", "http://java.sun.com/jsf/facelets"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("f", "http://java.sun.com/jsf/core"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("h", "http://java.sun.com/jsf/html"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("rich", "http://richfaces.org/rich"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("a4j", "http://richfaces.org/a4j"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("a", "http://richfaces.org/a4j"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("c", "http://java.sun.com/jstl/core"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("jsp", "http://java.sun.com/JSP/Page"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
private IFile file;
- private IDocument document;
+ private IDocumentProvider provider;
+ private FileEditorInput input;
private Properties properties;
public IMarkerResolution[] getResolutions(IMarker marker) {
try{
if(isOurCase(marker)){
return new IMarkerResolution[] {
- new AddTLDMarkerResolution(file, document, properties)
+ new AddTLDMarkerResolution(provider, input, properties)
};
}
@@ -56,22 +75,22 @@
String message = (String)marker.getAttribute(IMarker.MESSAGE);
final int start = ((Integer)marker.getAttribute(IMarker.CHAR_START)).intValue();
final int end = ((Integer)marker.getAttribute(IMarker.CHAR_END)).intValue();
- if(!message.startsWith("Unknown tag"))
+ if(!message.startsWith("Unknown tag")) //$NON-NLS-1$
return false;
- String prefix = AddTLDMarkerResolution.getPrifix(message);
+ String prefix = getPrifix(message);
if(prefix == null)
return false;
- if(!AddTLDMarkerResolution.libs.containsKey(prefix))
+ if(!libs.containsKey(prefix))
return false;
file = (IFile)marker.getResource();
- document = AddTLDMarkerResolution.getDocument(file);
+ IDocument document = getDocument(file);
properties = new Properties();
- properties.put(JSPPaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI, AddTLDMarkerResolution.libs.get(prefix));
+ properties.put(JSPPaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI, libs.get(prefix));
properties.put(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX, prefix);
properties.put(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER, new ISelectionProvider() {
@@ -98,4 +117,34 @@
return true;
}
+
+ public static String getPrifix(String message){
+ String prefix=""; //$NON-NLS-1$
+
+ int start = message.indexOf("("); //$NON-NLS-1$
+ if(start < 0)
+ return null;
+
+ int end = message.indexOf(":", start); //$NON-NLS-1$
+ if(end < 0)
+ return null;
+
+ prefix = message.substring(start+1, end);
+
+ return prefix;
+ }
+
+
+ public IDocument getDocument(IFile file) {
+ input = new FileEditorInput(file);
+ provider = DocumentProviderRegistry.getDefault().getDocumentProvider(input);
+ try {
+ provider.connect(input);
+ } catch (CoreException e) {
+ WebUiPlugin.getPluginLog().logError(e);
+ }
+
+ return provider.getDocument(input);
+ }
+
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties 2010-02-28 09:28:32 UTC (rev 20535)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties 2010-02-28 09:59:15 UTC (rev 20536)
@@ -64,3 +64,4 @@
WebAppFoldersFormLayoutData_WebAppMimeMapping=WebAppMimeMapping
WebCompoundEditor_WebXMLEditor=Web XML Editor
XActionProvider_CompanyName=Red Hat
+AddTLDMarkerResolution_Name=Insert tag library definition
14 years, 10 months
JBoss Tools SVN: r20535 - trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-02-28 04:28:32 -0500 (Sun, 28 Feb 2010)
New Revision: 20535
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4876
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java 2010-02-27 20:40:00 UTC (rev 20534)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java 2010-02-28 09:28:32 UTC (rev 20535)
@@ -11,6 +11,7 @@
package org.jboss.tools.jst.web.ui.action;
import java.util.HashMap;
+import java.util.Properties;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
@@ -20,6 +21,8 @@
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.DocumentProviderRegistry;
import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteTaglibInserter;
import org.jboss.tools.jst.web.ui.WebUiPlugin;
/**
@@ -29,6 +32,9 @@
*
*/
public class AddTLDMarkerResolution implements IMarkerResolution{
+ private IFile file;
+ private IDocument document;
+ private Properties properties;
public static HashMap<String, String> libs = new HashMap<String, String>();
static{
@@ -42,6 +48,12 @@
libs.put("c", "http://java.sun.com/jstl/core"); //$NON-NLS-1$ //$NON-NLS-2$
libs.put("jsp", "http://java.sun.com/JSP/Page"); //$NON-NLS-1$ //$NON-NLS-2$
}
+
+ public AddTLDMarkerResolution(IFile file, IDocument document, Properties properties){
+ this.file = file;
+ this.document = document;
+ this.properties = properties;
+ }
public String getLabel() {
return "Insert tag library defenition";
@@ -75,6 +87,7 @@
}
public void run(IMarker marker) {
-
+ PaletteTaglibInserter inserter = new PaletteTaglibInserter();
+ inserter.inserTaglib(document, properties);
}
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2010-02-27 20:40:00 UTC (rev 20534)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2010-02-28 09:28:32 UTC (rev 20535)
@@ -34,11 +34,15 @@
*
*/
public class JSPProblemMarkerResolutionGenerator implements IMarkerResolutionGenerator {
+ private IFile file;
+ private IDocument document;
+ private Properties properties;
+
public IMarkerResolution[] getResolutions(IMarker marker) {
try{
if(isOurCase(marker)){
return new IMarkerResolution[] {
- new AddTLDMarkerResolution()
+ new AddTLDMarkerResolution(file, document, properties)
};
}
@@ -59,18 +63,14 @@
if(prefix == null)
return false;
- //System.out.println("Prefix - "+prefix);
-
if(!AddTLDMarkerResolution.libs.containsKey(prefix))
return false;
- IFile file = (IFile)marker.getResource();
+ file = (IFile)marker.getResource();
- //System.out.println("File - "+file.getFullPath());
+ document = AddTLDMarkerResolution.getDocument(file);
- IDocument document = AddTLDMarkerResolution.getDocument(file);
-
- Properties properties = new Properties();
+ properties = new Properties();
properties.put(JSPPaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI, AddTLDMarkerResolution.libs.get(prefix));
properties.put(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX, prefix);
properties.put(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER, new ISelectionProvider() {
@@ -96,18 +96,6 @@
if(p.containsValue(prefix))
return false;
-
-// ArrayList<TaglibData> includeTaglibs = new ArrayList<TaglibData>();
-
-// List<TaglibData> taglibs = XmlUtil.getTaglibsForJSPDocument(document, includeTaglibs);
-//
-// for(TaglibData data : taglibs){
-// System.out.println("Taglib prefix - "+data.getPrefix()+" URI - "+data.getUri());
-// }
-
-// if(XmlUtil.getTaglibForPrefix(prefix, taglibs) != null)
-// return false;
-
return true;
}
}
\ No newline at end of file
14 years, 10 months
JBoss Tools SVN: r20534 - in trunk/cdi/tests: org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-02-27 15:40:00 -0500 (Sat, 27 Feb 2010)
New Revision: 20534
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSetup.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTestUtil.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/META-INF/MANIFEST.MF
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/DefinitionTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointHyperlinkDetectorTest.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CATest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5808
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/META-INF/MANIFEST.MF 2010-02-27 15:15:07 UTC (rev 20533)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/META-INF/MANIFEST.MF 2010-02-27 20:40:00 UTC (rev 20534)
@@ -10,6 +10,8 @@
org.eclipse.core.resources,
org.junit,
org.jboss.tools.cdi.core,
- org.jboss.tools.common
+ org.jboss.tools.common,
+ org.eclipse.ui,
+ org.eclipse.jdt.core
Export-Package: org.jboss.tools.cdi.core.test,
org.jboss.tools.cdi.core.test.tck
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java 2010-02-27 15:15:07 UTC (rev 20533)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java 2010-02-27 20:40:00 UTC (rev 20534)
@@ -13,8 +13,6 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.jboss.tools.cdi.core.test.tck.DefinitionTest;
-import org.jboss.tools.cdi.core.test.tck.ValidationTest;
import org.jboss.tools.tests.AbstractPluginsLoadTest;
/**
@@ -24,8 +22,7 @@
public static Test suite() {
TestSuite suite = new TestSuite("CDI Core Tests");
- suite.addTestSuite(DefinitionTest.class);
- suite.addTestSuite(ValidationTest.class);
+ suite.addTest(new CDICoreTestSetup(CDICoreTestSuite.suite()));
return suite;
}
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSetup.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSetup.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSetup.java 2010-02-27 20:40:00 UTC (rev 20534)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.cdi.core.test;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.cdi.core.test.tck.TCKTest;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class CDICoreTestSetup extends TestSetup {
+
+ protected IProject tckProject;
+
+ public CDICoreTestSetup(Test test) {
+ super(test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ tckProject = TCKTest.importPreparedProject("/");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
+ JobUtils.waitForIdle();
+ tckProject.delete(true, true, null);
+ JobUtils.waitForIdle();
+ ResourcesUtils.setBuildAutomatically(saveAutoBuild);
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSetup.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java 2010-02-27 20:40:00 UTC (rev 20534)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.cdi.core.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.tools.cdi.core.test.tck.DefinitionTest;
+import org.jboss.tools.cdi.core.test.tck.ValidationTest;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class CDICoreTestSuite extends TestSuite {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("CDI Core Tests");
+ suite.addTestSuite(DefinitionTest.class);
+ suite.addTestSuite(ValidationTest.class);
+ return suite;
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/DefinitionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/DefinitionTest.java 2010-02-27 15:15:07 UTC (rev 20533)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/DefinitionTest.java 2010-02-27 20:40:00 UTC (rev 20534)
@@ -10,22 +10,25 @@
******************************************************************************/
package org.jboss.tools.cdi.core.test.tck;
-import org.eclipse.core.resources.IProject;
+import java.util.Set;
+import org.eclipse.core.resources.IFile;
+import org.jboss.tools.cdi.core.IBean;
+
/**
+ * Section 2 - Concepts
+ *
* @author Alexey Kazakov
*/
public class DefinitionTest extends TCKTest {
- protected void setUp() throws Exception {
- IProject p = importPreparedProject("/definition/qualifier");
+ /**
+ * a) A bean comprises of a (nonempty) set of bean types.
+ */
+ public void testBeanTypesNonEmpty() {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/bean/RedSnapper.java");
+ Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
+ assertEquals("There should be the only bean in org.jboss.jsr299.tck.tests.definition.bean.RedSnapper", 1, beans.size());
+ assertTrue("No legal types were found for org.jboss.jsr299.tck.tests.definition.bean.RedSnapper bean.", beans.iterator().next().getLegalTypes().size() > 0);
}
-
- public void test1() {
-
- }
-
- protected void tearDown() throws Exception {
- cleanProject("/definition/qualifier");
- }
}
\ No newline at end of file
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2010-02-27 15:15:07 UTC (rev 20533)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2010-02-27 20:40:00 UTC (rev 20534)
@@ -11,6 +11,8 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
@@ -32,7 +34,34 @@
protected static String TCK_RESOURCES_PREFIX = "/resources/tck";
- public IProject importPreparedProject(String packPath) throws Exception {
+ protected IProject tckProject;
+ protected ICDIProject cdiProject;
+
+ public TCKTest() {
+ tckProject = getTestProject();
+ cdiProject = CDICorePlugin.getCDIProject(tckProject, false);
+ }
+
+ public IProject getTestProject() {
+ if(tckProject==null) {
+ try {
+ tckProject = findTestProject();
+ if(tckProject==null || !tckProject.exists()) {
+ tckProject = importPreparedProject("/");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Can't import CDI test project: " + e.getMessage());
+ }
+ }
+ return tckProject;
+ }
+
+ public static IProject findTestProject() {
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
+ }
+
+ public static IProject importPreparedProject(String packPath) throws Exception {
Bundle b = Platform.getBundle(PLUGIN_ID);
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
if(project==null || !project.exists()) {
@@ -57,28 +86,28 @@
return project;
}
- class JavaFileFilter implements FileFilter {
+ static class JavaFileFilter implements FileFilter {
public boolean accept(File pathname) {
String name = pathname.getName();
- return pathname.isDirectory() || (name.endsWith(".java") && !name.endsWith("Test.java"));
- }
+ return (pathname.isDirectory() && !name.endsWith(".svn")) || (name.endsWith(".java") && !name.endsWith("Test.java"));
+ }
}
- class XmlFileFilter implements FileFilter {
+ static class XmlFileFilter implements FileFilter {
public boolean accept(File pathname) {
String name = pathname.getName();
- return pathname.isDirectory() || name.endsWith(".xml");
+ return (pathname.isDirectory() && !name.endsWith(".svn")) || name.endsWith(".xml");
}
}
- class PageFileFilter implements FileFilter {
+ static class PageFileFilter implements FileFilter {
public boolean accept(File pathname) {
String name = pathname.getName();
- return pathname.isDirectory() || !name.endsWith(".java") && !name.endsWith(".xml");
+ return (pathname.isDirectory() && !name.endsWith(".svn")) && !name.endsWith(".xml");
}
}
- public void cleanProject(String _resourcePath) throws Exception {
+ public static void cleanProject(String _resourcePath) throws Exception {
Bundle b = Platform.getBundle(PLUGIN_ID);
String projectPath = FileLocator.resolve(b.getEntry(PROJECT_PATH)).getFile();
@@ -108,4 +137,4 @@
FileUtil.remove(fs[i]);
}
}
-}
+}
\ No newline at end of file
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTestUtil.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTestUtil.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTestUtil.java 2010-02-27 20:40:00 UTC (rev 20534)
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.cdi.core.test.tck;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class TCKTestUtil {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTestUtil.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-02-27 15:15:07 UTC (rev 20533)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-02-27 20:40:00 UTC (rev 20534)
@@ -11,7 +11,6 @@
package org.jboss.tools.cdi.core.test.tck;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.jboss.tools.tests.AbstractResourceMarkerTest;
@@ -21,48 +20,40 @@
public class ValidationTest extends TCKTest {
public void testLegalTypesInTyped() throws Exception {
- IProject p = importPreparedProject("/tests/lookup/typesafe/resolution");
- IFile petShopFile = p.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java");
+ IFile petShopFile = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java");
AbstractResourceMarkerTest.assertMarkerIsCreated(petShopFile, AbstractResourceMarkerTest.MARKER_TYPE, "Bean class or producer method or field specifies a @Typed annotation, and the value member specifies a class which does not correspond to a type in the unrestricted set of bean types of a bean", 25);
int markerNumbers = getMarkersNumber(petShopFile);
assertEquals("PetShop.java should has the only error marker.", markerNumbers, 1);
- cleanProject("/lookup/typesafe/resolution");
}
/*
* 2.7.1.3. Stereotype declares a non-empty @Named annotation (Non-Portable behavior)
*/
public void testNonEmptyNamedForStereotype() throws Exception {
- IProject p = importPreparedProject("/tests/definition/stereotype");
- IFile file = p.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/nonEmptyNamed/StereotypeWithNonEmptyNamed_Broken.java");
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/nonEmptyNamed/StereotypeWithNonEmptyNamed_Broken.java");
AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, "Stereotype declares a non-empty @Named annotation", 31);
int markerNumbers = getMarkersNumber(file);
assertEquals("StereotypeWithNonEmptyNamed_Broken.java should has the only error marker.", markerNumbers, 1);
- cleanProject("/definition/stereotype");
}
/*
* 2.7.1.3. Stereotype declares any other qualifier annotation
*/
public void testAnnotatedStereotype() throws Exception {
- IProject p = importPreparedProject("/tests/definition/stereotype");
- IFile file = p.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/withBindingType/StereotypeWithBindingTypes_Broken.java");
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/withBindingType/StereotypeWithBindingTypes_Broken.java");
AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, "Stereotype declares any qualifier annotation other than @Named", 30);
int markerNumbers = getMarkersNumber(file);
assertEquals("StereotypeWithBindingTypes_Broken.java should has the only error marker.", markerNumbers, 1);
- cleanProject("/definition/stereotype");
}
/*
* 2.7.1.3. Stereotype is annotated @Typed
*/
public void testTypedStereotype() throws Exception {
- IProject p = importPreparedProject("/tests/definition/stereotype");
- IFile file = p.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/withBindingType/StereotypeWithTyped_Broken.java");
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/withBindingType/StereotypeWithTyped_Broken.java");
AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, "Stereotype is annotated @Typed", 15);
int markerNumbers = getMarkersNumber(file);
assertEquals("StereotypeWithTyped_Broken.java should has the only error marker.", markerNumbers, 1);
- cleanProject("/definition/stereotype");
}
/*
@@ -70,12 +61,10 @@
* - stereotype declares more than one scope
*/
public void testStereotypeScope() throws Exception {
- IProject p = importPreparedProject("/tests/definition/stereotype");
- IFile file = p.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/tooManyScopes/StereotypeWithTooManyScopeTypes_Broken.java");
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/tooManyScopes/StereotypeWithTooManyScopeTypes_Broken.java");
AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, "Stereotype declares more than one scope", 32, 33);
int markerNumbers = getMarkersNumber(file);
assertEquals("StereotypeWithTooManyScopeTypes_Broken.java should has two error markers.", markerNumbers, 2);
- cleanProject("/definition/stereotype");
}
/*
@@ -83,12 +72,10 @@
* - bean class or producer method or field specifies multiple scope type annotations
*/
public void testMultipleBeanScope() throws Exception {
- IProject p = importPreparedProject("/tests/definition/scope");
- IFile file = p.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/scope/broken/tooManyScopes/BeanWithTooManyScopeTypes_Broken.java");
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/scope/broken/tooManyScopes/BeanWithTooManyScopeTypes_Broken.java");
AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, "Bean class or producer method or field specifies multiple scope type annotations", 22, 23);
int markerNumbers = getMarkersNumber(file);
assertEquals("StereotypeWithTyped_Broken.java should has two error markers.", markerNumbers, 2);
- cleanProject("/definition/scope");
}
/*
@@ -97,12 +84,10 @@
* (there are two different stereotypes declared by the bean that declare different default scopes)
*/
public void testBeanWithMultipleScopedStereotypes() throws Exception {
- IProject p = importPreparedProject("/tests/definition/stereotype");
- IFile file = p.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/scopeConflict/Scallop_Broken.java");
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/scopeConflict/Scallop_Broken.java");
AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, "Bean does not explicitly declare a scope when there is no default scope", 24, 25);
int markerNumbers = getMarkersNumber(file);
assertEquals("Scallop_Broken.java should has two error markers.", markerNumbers, 2);
- cleanProject("/definition/stereotype");
}
public static int getMarkersNumber(IResource resource) {
Modified: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointHyperlinkDetectorTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointHyperlinkDetectorTest.java 2010-02-27 15:15:07 UTC (rev 20533)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointHyperlinkDetectorTest.java 2010-02-27 20:40:00 UTC (rev 20534)
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import junit.framework.Test;
+import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.resources.IFile;
@@ -32,28 +33,28 @@
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.AxisUtil;
-public class InjectedPointHyperlinkDetectorTest extends TCKTest {
+public class InjectedPointHyperlinkDetectorTest extends TestCase {
private static final String PROJECT_NAME = "/tests/lookup/injectionpoint";
private static final String FILE_NAME = "JavaSource/org/jboss/jsr299/tck/tests/lookup/injectionpoint/LoggerConsumer.java";
public static Test suite() {
return new TestSuite(InjectedPointHyperlinkDetectorTest.class);
}
-
+
public void testInjectedPointHyperlinkDetector() throws Exception {
- IProject project = importPreparedProject(PROJECT_NAME);
+ IProject project = TCKTest.importPreparedProject(PROJECT_NAME);
doTest(project);
- cleanProject(PROJECT_NAME);
+ TCKTest.cleanProject(PROJECT_NAME);
}
private void doTest(IProject project) throws Exception {
IFile javaFile = project.getFile(FILE_NAME);
- assertTrue("The file \"" + FILE_NAME + "\" is not found", (javaFile != null));
- assertTrue("The file \"" + FILE_NAME + "\" is not found", (javaFile.exists()));
+ TCKTest.assertTrue("The file \"" + FILE_NAME + "\" is not found", (javaFile != null));
+ TCKTest.assertTrue("The file \"" + FILE_NAME + "\" is not found", (javaFile.exists()));
FileEditorInput editorInput = new FileEditorInput(javaFile);
-
+
IDocumentProvider documentProvider = null;
Throwable exception = null;
try {
@@ -74,41 +75,40 @@
assertTrue("The document provider is not able to be initialized with the editor input", false);
}
assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
-
+
IDocument document = documentProvider.getDocument(editorInput);
assertNotNull("The document for the file \"" + FILE_NAME + "\" is not loaded", document);
-
+
InjectedPointHyperlinkDetector elPartitioner = new InjectedPointHyperlinkDetector();
-
+
ArrayList<Region> regionList = new ArrayList<Region>();
regionList.add(new Region(115, 6)); // Inject
regionList.add(new Region(140, 6)); // logger
regionList.add(new Region(196, 6)); // logger
regionList.add(new Region(250, 6)); // logger
-
IEditorPart part = openFileInEditor(javaFile);
ISourceViewer viewer = null;
if(part instanceof JavaEditor){
viewer = ((JavaEditor)part).getViewer();
}
-
+
elPartitioner.setContext(new TestContext((ITextEditor)part));
-
+
int counter = 0;
for (int i = 0; i < document.getLength(); i++) {
TestData testData = new TestData(document, i);
IHyperlink[] links = elPartitioner.detectHyperlinks(viewer, testData.getHyperlinkRegion(), true);
boolean recognized = links != null;
-
+
if (recognized) {
counter++;
if(!findOffsetInRegions(i, regionList)){
fail("Wrong detection for offset - "+i);
}
- }else{
+ } else {
for(Region region : regionList){
if(i >= region.getOffset() && i <= region.getOffset()+region.getLength())
fail("Wrong detection for region - "+region.getOffset()+" : "+region.getLength()+region.getLength()+" region - "+i);
@@ -117,10 +117,10 @@
}
assertEquals("Wrong recognized region count: ", 28, counter);
-
+
documentProvider.disconnect(editorInput);
}
-
+
private boolean findOffsetInRegions(int offset, ArrayList<Region> regionList){
for(Region region : regionList){
if(offset >= region.getOffset() && offset <= region.getOffset()+region.getLength())
@@ -128,7 +128,7 @@
}
return false;
}
-
+
private IEditorPart openFileInEditor(IFile input) {
if (input != null && input.exists()) {
try {
@@ -141,26 +141,26 @@
}
return null;
}
-
+
class TestData {
IDocument document;
int offset;
IRegion region;
String contentType;
private IHyperlinkRegion hyperlinkRegion = null;
-
+
TestData (IDocument document, int offset) {
this.document = document;
this.offset = offset;
init();
}
-
+
private void init() {
this.region = getDocumentRegion();
this.contentType = getContentType();
this.hyperlinkRegion = getHyperlinkRegion();
}
-
+
private IRegion getDocumentRegion() {
IRegion region = null;
try {
@@ -169,11 +169,11 @@
return region;
}
-
+
public IHyperlinkRegion getHyperlinkRegion() {
if (hyperlinkRegion != null)
return hyperlinkRegion;
-
+
return new IHyperlinkRegion() {
public String getAxis() {
return AxisUtil.getAxis(document, region.getOffset());
@@ -195,8 +195,7 @@
}
};
}
-
-
+
/**
* Returns the content type of document
*
@@ -222,19 +221,18 @@
return type;
}
}
-
+
class TestContext implements IAdaptable{
ITextEditor editor;
-
+
public TestContext(ITextEditor editor){
this.editor = editor;
}
-
+
public Object getAdapter(Class adapter) {
if(adapter.equals(ITextEditor.class))
return editor;
return null;
}
}
-
-}
+}
\ No newline at end of file
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CATest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CATest.java 2010-02-27 15:15:07 UTC (rev 20533)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CATest.java 2010-02-27 20:40:00 UTC (rev 20534)
@@ -12,6 +12,8 @@
import java.io.File;
+import junit.framework.TestCase;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.FileLocator;
@@ -26,7 +28,7 @@
/**
* @author Alexey Kazakov
*/
-public class CATest extends TCKTest {
+public class CATest extends TestCase {
private IProject project;
private ContentAssistantTestCase caTest = new ContentAssistantTestCase();
@@ -39,7 +41,7 @@
public CATest() {
super();
try {
- project = importPreparedProject("/tests/lookup");
+ project = TCKTest.importPreparedProject("/tests/lookup");
Bundle ui = Platform.getBundle(UI_TEST_PLUGIN_ID);
String projectPath = project.getLocation().toString();
String resourcePath = FileLocator.resolve(ui.getEntry(RESOURCE_NAME)).getFile();
14 years, 10 months
JBoss Tools SVN: r20533 - in trunk/jst/plugins: org.jboss.tools.jst.web.ui and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-02-27 10:15:07 -0500 (Sat, 27 Feb 2010)
New Revision: 20533
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JSPPaletteInsertHelper.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteTaglibInserter.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4876
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JSPPaletteInsertHelper.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JSPPaletteInsertHelper.java 2010-02-27 14:27:27 UTC (rev 20532)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JSPPaletteInsertHelper.java 2010-02-27 15:15:07 UTC (rev 20533)
@@ -26,15 +26,16 @@
public JSPPaletteInsertHelper() {}
protected void modify(ISourceViewer v, Properties p, String[] texts) {
+ p.put("viewer", v);
String tagname = p.getProperty(PROPOPERTY_TAG_NAME);
String uri = p.getProperty(PROPOPERTY_TAGLIBRARY_URI);
String startText = texts[0];
if(startText != null && startText.startsWith("<%@ taglib")) { //$NON-NLS-1$
- if(PaletteTaglibInserter.inserTaglibInXml(v, p)) {
+ if(PaletteTaglibInserter.inserTaglibInXml(v.getDocument(), p)) {
return;
}
} else {
- p = PaletteTaglibInserter.inserTaglib(v, p);
+ p = PaletteTaglibInserter.inserTaglib(v.getDocument(), p);
}
String defaultPrefix = p.getProperty(PROPOPERTY_DEFAULT_PREFIX);
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteTaglibInserter.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteTaglibInserter.java 2010-02-27 14:27:27 UTC (rev 20532)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteTaglibInserter.java 2010-02-27 15:15:07 UTC (rev 20533)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.jspeditor.dnd;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;
@@ -17,8 +18,10 @@
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
@@ -30,6 +33,7 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
+import org.jboss.tools.jst.jsp.util.XmlUtil;
import org.jboss.tools.jst.web.tld.TaglibData;
import org.jboss.tools.jst.web.tld.VpeTaglibManager;
import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
@@ -46,9 +50,9 @@
private static final String TAGLIB_START = "<%@ taglib"; //$NON-NLS-1$
- public Properties inserTaglib(ISourceViewer v, Properties p) {
- if(!inserTaglibInXml(v, p)) {
- inserTaglibInOldJsp(v, p);
+ public Properties inserTaglib(IDocument d, Properties p) {
+ if(!inserTaglibInXml(d, p)) {
+ inserTaglibInOldJsp(d, p);
}
return p;
}
@@ -63,12 +67,11 @@
p.getProperty(PaletteInsertHelper.PROPOPERTY_START_TEXT) != null;
}
- public boolean inserTaglibInOldJsp(ISourceViewer v, Properties p) {
+ public boolean inserTaglibInOldJsp(IDocument d, Properties p) {
if(!checkProperties(p)) {
return false;
}
- IDocument d = v.getDocument();
IStructuredModel model = null;
try {
@@ -77,7 +80,7 @@
if (xmlDocument == null) {
return false;
}
- Properties tl = getPrefixes(v);
+ Properties tl = getPrefixes(d, p);
if(tl == null) tl = JSPPaletteInsertHelper.getPrefixes(d.get());
Element root = xmlDocument.getDocumentElement();
@@ -93,9 +96,9 @@
p.setProperty(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX, (String)tl.get(uri_p));
}
} else if(!tl.containsValue(defaultPrefix_p)) {
- if (checkplace(xmlDocument, d, "jsp:directive.taglib", tg, p, v) == false) { //$NON-NLS-1$
+ if (checkplace(xmlDocument, d, "jsp:directive.taglib", tg, p) == false) { //$NON-NLS-1$
d.replace(0, 0, tg.toString());
- mouveFocusOnPage(p,v, tg.toString().length(), 0);
+ mouveFocusOnPage(p, tg.toString().length(), 0);
return true;
}
}
@@ -103,9 +106,9 @@
DocumentImpl docImpl = (DocumentImpl)xmlDocument;
// Only for JSP
if(docImpl.isJSPType()) {
- if (checkplace(xmlDocument, d, "jsp:directive.page", tg, p, v) == false) { //$NON-NLS-1$
+ if (checkplace(xmlDocument, d, "jsp:directive.page", tg, p) == false) { //$NON-NLS-1$
d.replace(0, 0, tg.toString());
- mouveFocusOnPage(p,v, tg.toString().length(), 0);
+ mouveFocusOnPage(p, tg.toString().length(), 0);
return true;
}
}
@@ -118,7 +121,39 @@
return false;
}
- private static Node getSelectedNode(ISourceViewer v, Properties p){
+ /**
+ * copied from ContentAssistUtils
+ * @param viewer
+ * @param documentOffset
+ * @return
+ */
+ public static IndexedRegion getNodeAt(IDocument d, int documentOffset) {
+
+ if (d == null)
+ return null;
+
+ IndexedRegion node = null;
+ IModelManager mm = StructuredModelManager.getModelManager();
+ IStructuredModel model = null;
+ if (mm != null)
+ model = mm.getExistingModelForRead(d);
+ try {
+ if (model != null) {
+ int lastOffset = documentOffset;
+ node = model.getIndexedRegion(documentOffset);
+ while (node == null && lastOffset >= 0) {
+ lastOffset--;
+ node = model.getIndexedRegion(lastOffset);
+ }
+ }
+ } finally {
+ if (model != null)
+ model.releaseFromRead();
+ }
+ return node;
+ }
+
+ private static Node getSelectedNode(IDocument d, Properties p){
ISelectionProvider selProvider = (ISelectionProvider)p.get(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER);
if(selProvider == null) return null;
@@ -128,7 +163,7 @@
selection = (ITextSelection)selProvider.getSelection();
else return null;
- IndexedRegion region = ContentAssistUtils.getNodeAt(v, selection.getOffset());
+ IndexedRegion region = getNodeAt(d, selection.getOffset());
if(region == null) return null;
if(!(region instanceof Node)) return null;
@@ -142,11 +177,11 @@
return text;
}
- private static boolean checkSelectedElement(HashMap<String,String> map, ISourceViewer v, Properties p){
+ private static boolean checkSelectedElement(HashMap<String,String> map, IDocument d, Properties p){
String taglibUri = p.getProperty(JSPPaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI);
if(taglibUri == null) return false;
- Node selectedNode = getSelectedNode(v, p);
+ Node selectedNode = getSelectedNode(d, p);
if(selectedNode == null) return false;
return checkElement(map, selectedNode, taglibUri);
@@ -171,12 +206,11 @@
}
}
- public boolean inserTaglibInXml(ISourceViewer v, Properties p) {
+ public boolean inserTaglibInXml(IDocument d, Properties p) {
if(!checkProperties(p)) {
return false;
}
- IDocument d = v.getDocument();
IStructuredModel model = null;
try {
@@ -187,7 +221,7 @@
return false;
}
- Properties tl = getPrefixes(v);
+ Properties tl = getPrefixes(d, p);
if(tl == null) tl = JSPPaletteInsertHelper.getPrefixes(d.get());
Element root = xmlDocument.getDocumentElement();
if(root != null) {
@@ -195,11 +229,11 @@
if (xmlDocument.getDoctype() != null /* && tagLibListConainsFacelet(tl)*/ ) {
String publicId = xmlDocument.getDoctype().getPublicId();
if (publicId!=null && publicId.toUpperCase().startsWith("-//W3C//DTD XHTML")) { // && root.getNodeName().equalsIgnoreCase(HTML_SOURCE_ROOT_ELEMENT)) { //$NON-NLS-1$
- checkTL(root, v, p, d);
+ checkTL(root, p, d);
return true;
}
} else if(xmlDocument.isXMLType() || root.getNodeName().equals(JSP_SOURCE_ROOT_ELEMENT)) {
- checkTL(root, v, p, d);
+ checkTL(root, p, d);
return true;
}
}
@@ -224,19 +258,36 @@
/*
* analyse source for taglib, return the list of taglib
*/
- private static Properties getPrefixes(ISourceViewer viewer) {
- VpeTaglibManager tldManager = null;
- if((tldManager == null) && (viewer instanceof VpeTaglibManagerProvider)) {
- tldManager = ((VpeTaglibManagerProvider)viewer).getTaglibManager();
- if(tldManager != null) {
- List list = tldManager.getTagLibs();
- Properties p = new Properties();
- for (int i = 0; i < list.size(); i++) {
- TaglibData data = (TaglibData)list.get(i);
- p.setProperty(data.getUri(), data.getPrefix());
+ public static Properties getPrefixes(IDocument d, Properties properties) {
+ List list = getTaglibData(d, properties);
+ Properties p = new Properties();
+ for (int i = 0; i < list.size(); i++) {
+ TaglibData data = (TaglibData)list.get(i);
+ p.setProperty(data.getUri(), data.getPrefix());
+ }
+ return p;
+ }
+
+ private static List<TaglibData> getTaglibData(IDocument d, Properties p){
+ ISourceViewer viewer= getViewer(p);
+ if(viewer != null){
+ VpeTaglibManager tldManager = null;
+ if(viewer instanceof VpeTaglibManagerProvider) {
+ tldManager = ((VpeTaglibManagerProvider)viewer).getTaglibManager();
+ if(tldManager != null) {
+ return tldManager.getTagLibs();
+ }
+ }
+ }else{
+ List<TaglibData> result = XmlUtil.getTaglibsForJSPDocument(d, new ArrayList<TaglibData>());
+
+ if(result == null || result.isEmpty()){
+ Node node = getSelectedNode(d, p);
+ if(node != null){
+ result = XmlUtil.processNode(node, new ArrayList<TaglibData>());
}
- return p;
- }
+ }
+ return result;
}
return null;
}
@@ -245,7 +296,7 @@
* for jsp:root and html check the taglib if exist check the prefix else add the taglib
* with text formatting
*/
- private static Properties checkTL(Element root, ISourceViewer v, Properties p, IDocument d) {
+ private static Properties checkTL(Element root, Properties p, IDocument d) {
String uri_p = p.getProperty(JSPPaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI);
String defaultPrefix_p = p.getProperty(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX);
@@ -260,7 +311,7 @@
}
}
- if (map.containsKey(uri_p) || checkSelectedElement(map, v, p)) {
+ if (map.containsKey(uri_p) || checkSelectedElement(map, d, p)) {
if (!map.get(uri_p).equals(defaultPrefix_p)) {
p.setProperty(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX, (String) map.get(uri_p));
}
@@ -299,8 +350,13 @@
ca[i]=' ';
return ca;
}
+
+ private static ISourceViewer getViewer(Properties p){
+ return (ISourceViewer)p.get("viewer"); //$NON-NLS-1$
+ }
- private static void mouveFocusOnPage(Properties p, ISourceViewer v, int length, int pos){
+ private static void mouveFocusOnPage(Properties p, int length, int pos){
+ ISourceViewer v = getViewer(p);
ISelectionProvider selProvider = (ISelectionProvider)p.get(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER);
IDocument doc = v.getDocument();
@@ -331,7 +387,7 @@
return st;
}
- private static boolean checkplace(IDOMDocument xmlDocument, IDocument d, String st, StringBuffer tg, Properties p, ISourceViewer v) throws BadLocationException {
+ private static boolean checkplace(IDOMDocument xmlDocument, IDocument d, String st, StringBuffer tg, Properties p) throws BadLocationException {
NodeList nl = xmlDocument.getChildNodes();
boolean docType = false;
IndexedRegion irdt = null;
@@ -371,12 +427,12 @@
if (d.getLineOffset(d.getLineOfOffset(so)) == so) {
tgleft.append(tg);
d.replace(eo, 0, tgleft.toString());
- mouveFocusOnPage(p,v, eo + tgleft.length(), eo);
+ mouveFocusOnPage(p, eo + tgleft.length(), eo);
} else {
tgleft.append(analyseSubstring(d.get(d.getLineOffset(d.getLineOfOffset(so)), so-d.getLineOffset(d.getLineOfOffset(so)))));
tgleft.append(tg);
d.replace(eo, 0, tgleft.toString());
- mouveFocusOnPage(p,v, eo + tgleft.length(), eo);
+ mouveFocusOnPage(p, eo + tgleft.length(), eo);
}
return true;
}
@@ -388,12 +444,12 @@
if (d.getLineOffset(d.getLineOfOffset(so)) == so) {
tgleft.append(tg);
d.replace(eo, 0, tgleft.toString());
- mouveFocusOnPage(p,v, eo + tgleft.length(), eo);
+ mouveFocusOnPage(p, eo + tgleft.length(), eo);
} else {
tgleft.append(analyseSubstring(d.get(d.getLineOffset(d.getLineOfOffset(so)), so-d.getLineOffset(d.getLineOfOffset(so)))));
tgleft.append(tg);
d.replace(eo, 0, tgleft.toString());
- mouveFocusOnPage(p,v, eo + tgleft.length(), eo);
+ mouveFocusOnPage(p, eo + tgleft.length(), eo);
}
return true;
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-02-27 14:27:27 UTC (rev 20532)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-02-27 15:15:07 UTC (rev 20533)
@@ -676,5 +676,19 @@
</labelDecorator>
</extension>
+
+ <extension point="org.eclipse.ui.ide.markerResolution">
+ <markerResolutionGenerator
+ markerType="org.eclipse.jst.jsp.core.validationMarker"
+ class="org.jboss.tools.jst.web.ui.action.JSPProblemMarkerResolutionGenerator">
+ </markerResolutionGenerator>
+ </extension>
+ <extension point="org.eclipse.ui.ide.markerResolution">
+ <markerResolutionGenerator
+ markerType="org.eclipse.wst.html.core.validationMarker"
+ class="org.jboss.tools.jst.web.ui.action.JSPProblemMarkerResolutionGenerator">
+ </markerResolutionGenerator>
+ </extension>
+
</plugin>
Added: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java 2010-02-27 15:15:07 UTC (rev 20533)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.web.ui.action;
+
+import java.util.HashMap;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.DocumentProviderRegistry;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.jboss.tools.jst.web.ui.WebUiPlugin;
+
+/**
+ * The Marker Resolution that adds tag lib declaration to jsp or xhtml file
+ *
+ * @author Daniel Azarov
+ *
+ */
+public class AddTLDMarkerResolution implements IMarkerResolution{
+
+ public static HashMap<String, String> libs = new HashMap<String, String>();
+ static{
+ libs.put("s", "http://jboss.com/products/seam/taglib"); //$NON-NLS-1$//$NON-NLS-2$
+ libs.put("ui", "http://java.sun.com/jsf/facelets"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("f", "http://java.sun.com/jsf/core"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("h", "http://java.sun.com/jsf/html"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("rich", "http://richfaces.org/rich"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("a4j", "http://richfaces.org/a4j"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("a", "http://richfaces.org/a4j"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("c", "http://java.sun.com/jstl/core"); //$NON-NLS-1$ //$NON-NLS-2$
+ libs.put("jsp", "http://java.sun.com/JSP/Page"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public String getLabel() {
+ return "Insert tag library defenition";
+ }
+
+ public static String getPrifix(String message){
+ String prefix="";
+
+ int start = message.indexOf("(");
+ if(start < 0)
+ return null;
+
+ int end = message.indexOf(":", start);
+ if(end < 0)
+ return null;
+
+ prefix = message.substring(start+1, end);
+
+ return prefix;
+ }
+
+ public static IDocument getDocument(IFile file) {
+ FileEditorInput input = new FileEditorInput(file);
+ IDocumentProvider provider= DocumentProviderRegistry.getDefault().getDocumentProvider(input);
+ try {
+ provider.connect(input);
+ } catch (CoreException e) {
+ WebUiPlugin.getPluginLog().logError(e);
+ }
+ return provider.getDocument(input);
+ }
+
+ public void run(IMarker marker) {
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2010-02-27 15:15:07 UTC (rev 20533)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.web.ui.action;
+
+import java.util.Properties;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolutionGenerator;
+import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteTaglibInserter;
+import org.jboss.tools.jst.web.ui.WebUiPlugin;
+
+/**
+ * Shows the Marker Resolutions for Unknown tag JSP Problem Marker
+ *
+ * @author Daniel Azarov
+ *
+ */
+public class JSPProblemMarkerResolutionGenerator implements IMarkerResolutionGenerator {
+ public IMarkerResolution[] getResolutions(IMarker marker) {
+ try{
+ if(isOurCase(marker)){
+ return new IMarkerResolution[] {
+ new AddTLDMarkerResolution()
+ };
+ }
+
+ }catch(CoreException ex){
+ WebUiPlugin.getPluginLog().logError(ex);
+ }
+ return new IMarkerResolution[]{};
+ }
+
+ private boolean isOurCase(IMarker marker) throws CoreException{
+ String message = (String)marker.getAttribute(IMarker.MESSAGE);
+ final int start = ((Integer)marker.getAttribute(IMarker.CHAR_START)).intValue();
+ final int end = ((Integer)marker.getAttribute(IMarker.CHAR_END)).intValue();
+ if(!message.startsWith("Unknown tag"))
+ return false;
+
+ String prefix = AddTLDMarkerResolution.getPrifix(message);
+ if(prefix == null)
+ return false;
+
+ //System.out.println("Prefix - "+prefix);
+
+ if(!AddTLDMarkerResolution.libs.containsKey(prefix))
+ return false;
+
+ IFile file = (IFile)marker.getResource();
+
+ //System.out.println("File - "+file.getFullPath());
+
+ IDocument document = AddTLDMarkerResolution.getDocument(file);
+
+ Properties properties = new Properties();
+ properties.put(JSPPaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI, AddTLDMarkerResolution.libs.get(prefix));
+ properties.put(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX, prefix);
+ properties.put(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER, new ISelectionProvider() {
+
+ public void setSelection(ISelection selection) {
+ }
+
+ public void removeSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ }
+
+ public ISelection getSelection() {
+ return new TextSelection(start, end-start);
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ }
+ });
+ properties.put(JSPPaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, "true"); //$NON-NLS-1$
+
+ Properties p = PaletteTaglibInserter.getPrefixes(document, properties);
+
+ if(p.containsValue(prefix))
+ return false;
+
+
+// ArrayList<TaglibData> includeTaglibs = new ArrayList<TaglibData>();
+
+// List<TaglibData> taglibs = XmlUtil.getTaglibsForJSPDocument(document, includeTaglibs);
+//
+// for(TaglibData data : taglibs){
+// System.out.println("Taglib prefix - "+data.getPrefix()+" URI - "+data.getUri());
+// }
+
+// if(XmlUtil.getTaglibForPrefix(prefix, taglibs) != null)
+// return false;
+
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 10 months
JBoss Tools SVN: r20532 - branches/jbosstools-3.1.x/esb/plugins/org.jboss.tools.esb.core/resources/meta.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-02-27 09:27:27 -0500 (Sat, 27 Feb 2010)
New Revision: 20532
Modified:
branches/jbosstools-3.1.x/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta
Log:
https://jira.jboss.org/jira/browse/JBIDE-5939
Modified: branches/jbosstools-3.1.x/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta
===================================================================
--- branches/jbosstools-3.1.x/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta 2010-02-27 14:13:43 UTC (rev 20531)
+++ branches/jbosstools-3.1.x/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta 2010-02-27 14:27:27 UTC (rev 20532)
@@ -1778,7 +1778,14 @@
<XModelAttribute PROPERTIES="pre=true;category=general"
name="password" xmlname="password"/>
<XModelAttribute PROPERTIES="pre=true;category=advanced"
- name="smooks handler config" xmlname="smooks-handler-config"/>
+ name="smooks handler config" xmlname="smooks-handler-config">
+ <Constraint loader="Tree">
+ <value name="ESBResourceTree"/>
+ <value name="extensions=xml"/>
+ <value name="linkAction=OpenHandler"/>
+ </Constraint>
+ <Editor name="TreeChooser"/>
+ </XModelAttribute>
<XModelAttribute PROPERTIES="pre=true;category=advanced"
name="custom handlers" xmlname="custom-handlers"/>
<XModelAttribute PROPERTIES="category=advanced;pre=true"
@@ -1808,6 +1815,11 @@
ICON="action.empty"
PROPERTIES="actionpath=Open;attribute=smooks response mapper"
displayName="Open Response Mapper" kind="action" name="OpenResponse"/>
+ <XActionItem
+ HandlerClassName="org.jboss.tools.esb.core.model.handlers.OpenESBResourceHandler"
+ ICON="action.empty"
+ PROPERTIES="actionpath=Open;attribute=smooks handler config"
+ displayName="Open Handler Config" kind="action" name="OpenHandler"/>
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
14 years, 10 months
JBoss Tools SVN: r20531 - trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-02-27 09:13:43 -0500 (Sat, 27 Feb 2010)
New Revision: 20531
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta
Log:
https://jira.jboss.org/jira/browse/JBIDE-5939
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta 2010-02-27 11:24:20 UTC (rev 20530)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta 2010-02-27 14:13:43 UTC (rev 20531)
@@ -1778,7 +1778,14 @@
<XModelAttribute PROPERTIES="pre=true;category=general"
name="password" xmlname="password"/>
<XModelAttribute PROPERTIES="pre=true;category=advanced"
- name="smooks handler config" xmlname="smooks-handler-config"/>
+ name="smooks handler config" xmlname="smooks-handler-config">
+ <Constraint loader="Tree">
+ <value name="ESBResourceTree"/>
+ <value name="extensions=xml"/>
+ <value name="linkAction=OpenHandler"/>
+ </Constraint>
+ <Editor name="TreeChooser"/>
+ </XModelAttribute>
<XModelAttribute PROPERTIES="pre=true;category=advanced"
name="custom handlers" xmlname="custom-handlers"/>
<XModelAttribute PROPERTIES="category=advanced;pre=true"
@@ -1808,6 +1815,11 @@
ICON="action.empty"
PROPERTIES="actionpath=Open;attribute=smooks response mapper"
displayName="Open Response Mapper" kind="action" name="OpenResponse"/>
+ <XActionItem
+ HandlerClassName="org.jboss.tools.esb.core.model.handlers.OpenESBResourceHandler"
+ ICON="action.empty"
+ PROPERTIES="actionpath=Open;attribute=smooks handler config"
+ displayName="Open Handler Config" kind="action" name="OpenHandler"/>
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
14 years, 10 months
JBoss Tools SVN: r20530 - branches/jbosstools-3.1.x/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-02-27 06:24:20 -0500 (Sat, 27 Feb 2010)
New Revision: 20530
Modified:
branches/jbosstools-3.1.x/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard/NewActionWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5916
Modified: branches/jbosstools-3.1.x/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard/NewActionWizard.java
===================================================================
--- branches/jbosstools-3.1.x/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard/NewActionWizard.java 2010-02-27 11:21:02 UTC (rev 20529)
+++ branches/jbosstools-3.1.x/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard/NewActionWizard.java 2010-02-27 11:24:20 UTC (rev 20530)
@@ -151,6 +151,7 @@
}
s = b.getContents();
+ boolean hasOverrideAnnotation = s.indexOf("@Override") > 0;
int i = s.indexOf('{');
int j = s.lastIndexOf('}');
@@ -163,7 +164,7 @@
+ tab + tab + "_config = config;"+ lineDelimiter
+ tab + "}" + lineDelimiter
+ lineDelimiter
- + tab + "@Override" + lineDelimiter
+ + (hasOverrideAnnotation ? tab + "@Override" + lineDelimiter : "")
+ tab + "public Message process(Message message) throws ActionProcessingException {" + lineDelimiter
+ tab + tab + "//ADD CUSTOM ACTION CODE HERE" + lineDelimiter
+ tab + tab + "return message;" + lineDelimiter
14 years, 10 months
JBoss Tools SVN: r20529 - trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-02-27 06:21:02 -0500 (Sat, 27 Feb 2010)
New Revision: 20529
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard/NewActionWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5916
Modified: trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard/NewActionWizard.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard/NewActionWizard.java 2010-02-27 11:08:26 UTC (rev 20528)
+++ trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard/NewActionWizard.java 2010-02-27 11:21:02 UTC (rev 20529)
@@ -151,6 +151,7 @@
}
s = b.getContents();
+ boolean hasOverrideAnnotation = s.indexOf("@Override") > 0;
int i = s.indexOf('{');
int j = s.lastIndexOf('}');
@@ -163,7 +164,7 @@
+ tab + tab + "_config = config;"+ lineDelimiter
+ tab + "}" + lineDelimiter
+ lineDelimiter
- + tab + "@Override" + lineDelimiter
+ + (hasOverrideAnnotation ? tab + "@Override" + lineDelimiter : "")
+ tab + "public Message process(Message message) throws ActionProcessingException {" + lineDelimiter
+ tab + tab + "//ADD CUSTOM ACTION CODE HERE" + lineDelimiter
+ tab + tab + "return message;" + lineDelimiter
14 years, 10 months
JBoss Tools SVN: r20528 - branches/jbosstools-3.1.x/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-02-27 06:08:26 -0500 (Sat, 27 Feb 2010)
New Revision: 20528
Modified:
branches/jbosstools-3.1.x/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLinkHelper.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5884
Modified: branches/jbosstools-3.1.x/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLinkHelper.java
===================================================================
--- branches/jbosstools-3.1.x/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLinkHelper.java 2010-02-27 11:07:00 UTC (rev 20527)
+++ branches/jbosstools-3.1.x/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLinkHelper.java 2010-02-27 11:08:26 UTC (rev 20528)
@@ -76,6 +76,9 @@
ISeamComponent[] cs = seamProject.getComponents();
for (ISeamComponent c : cs) {
ISeamJavaComponentDeclaration d = c.getJavaDeclaration();
+ if(d == null) {
+ continue;
+ }
IMember m = d.getSourceMember();
if(m == type)
return new StructuredSelection(d);
14 years, 10 months
JBoss Tools SVN: r20527 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-02-27 06:07:00 -0500 (Sat, 27 Feb 2010)
New Revision: 20527
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLinkHelper.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5884
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLinkHelper.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLinkHelper.java 2010-02-27 00:55:31 UTC (rev 20526)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLinkHelper.java 2010-02-27 11:07:00 UTC (rev 20527)
@@ -76,6 +76,9 @@
ISeamComponent[] cs = seamProject.getComponents();
for (ISeamComponent c : cs) {
ISeamJavaComponentDeclaration d = c.getJavaDeclaration();
+ if(d == null) {
+ continue;
+ }
IMember m = d.getSourceMember();
if(m == type)
return new StructuredSelection(d);
14 years, 10 months