JBoss Tools SVN: r10803 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-10-13 13:50:52 -0400 (Mon, 13 Oct 2008)
New Revision: 10803
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2118 Cleanup/unify the EL code completion used in JSF, Java, Seam completions
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java 2008-10-13 17:46:31 UTC (rev 10802)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java 2008-10-13 17:50:52 UTC (rev 10803)
@@ -32,6 +32,7 @@
import org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy;
import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorBuilder;
import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorDefinition;
+import org.jboss.tools.common.text.xml.contentassist.SortingCompoundContentAssistProcessor;
import org.jboss.tools.jst.jsp.contentassist.FaceletsHtmlContentAssistProcessor;
import org.jboss.tools.jst.jsp.format.HTMLFormatProcessor;
import org.osgi.framework.Bundle;
@@ -44,6 +45,15 @@
@SuppressWarnings("restriction")
protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
+ SortingCompoundContentAssistProcessor sortingCompoundProcessor = new SortingCompoundContentAssistProcessor(sourceViewer, partitionType);
+ List<IContentAssistProcessor> processors = new ArrayList<IContentAssistProcessor>();
+
+// if (sortingCompoundProcessor.size() > 0) {
+ if (sortingCompoundProcessor.supportsPartitionType(partitionType)) {
+ processors.add(sortingCompoundProcessor);
+ }
+
+/*
// IContentAssistProcessor[] processors = null;
// if we have our own processors we need
@@ -51,6 +61,7 @@
// plugins using extention point
// "org.jboss.tools.common.text.xml.contentAssistProcessor"
+
ContentAssistProcessorDefinition[] defs = ContentAssistProcessorBuilder.getInstance().getContentAssistProcessorDefinitions(partitionType);
if(defs==null) return null;
@@ -73,6 +84,7 @@
processors.add(new CSSContentAssistProcessor());
}
+*/
return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java 2008-10-13 17:46:31 UTC (rev 10802)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java 2008-10-13 17:50:52 UTC (rev 10803)
@@ -31,6 +31,7 @@
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorBuilder;
import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorDefinition;
+import org.jboss.tools.common.text.xml.contentassist.SortingCompoundContentAssistProcessor;
import org.jboss.tools.jst.jsp.contentassist.FaceletsHtmlContentAssistProcessor;
import org.jboss.tools.jst.jsp.contentassist.ExtendedJSPContentAssistProcessor;
@@ -44,6 +45,16 @@
}
protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
+ SortingCompoundContentAssistProcessor sortingCompoundProcessor = new SortingCompoundContentAssistProcessor(sourceViewer, partitionType);
+ List<IContentAssistProcessor> processors = new ArrayList<IContentAssistProcessor>();
+
+// if (sortingCompoundProcessor.size() > 0) {
+ if (sortingCompoundProcessor.supportsPartitionType(partitionType)) {
+ processors.add(sortingCompoundProcessor);
+ return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
+ }
+
+ /*
// if we have our own processors we need
// to define them in plugin.xml file of their
// plugins using extention point
@@ -71,6 +82,8 @@
processors.add(new ExtendedJSPContentAssistProcessor());
return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
}
+ */
+
IContentAssistProcessor[] superProcessors = super.getContentAssistProcessors(sourceViewer, partitionType);
if (superProcessors != null && superProcessors.length > 0) {
16 years, 5 months
JBoss Tools SVN: r10802 - trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-10-13 13:46:31 -0400 (Mon, 13 Oct 2008)
New Revision: 10802
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java
Log:
loading for perspective was added to test setUp
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java 2008-10-13 17:46:26 UTC (rev 10801)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java 2008-10-13 17:46:31 UTC (rev 10802)
@@ -31,12 +31,17 @@
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.navigator.CommonNavigator;
+import org.jboss.tools.jst.web.ui.WebDevelopmentPerspectiveFactory;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamPackage;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.ui.ISeamUiConstants;
+import org.jboss.tools.seam.ui.SeamPerspectiveFactory;
import org.jboss.tools.seam.ui.views.actions.SeamViewLayoutActionGroup.SeamContributionItem;
import org.jboss.tools.test.util.JUnitUtils;
import org.jboss.tools.test.util.WorkbenchUtils;
@@ -55,7 +60,12 @@
@Override
protected void setUp() throws Exception {
super.setUp();
-
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ try {
+ workbench.showPerspective(SeamPerspectiveFactory.PERSPECTIVE_ID,workbench.getActiveWorkbenchWindow());
+ } catch (WorkbenchException e) {
+ fail("Cannot load perspective '" + SeamPerspectiveFactory.PERSPECTIVE_ID + "'");
+ }
project = (IProject)ResourcesPlugin.getWorkspace().getRoot().findMember("TestComponentView");
assertNotNull("",project);
this.project.refreshLocal(IResource.DEPTH_INFINITE, null);
16 years, 5 months
JBoss Tools SVN: r10801 - in trunk/common/plugins/org.jboss.tools.common.text.xml: src/org/jboss/tools/common/text/xml and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-10-13 13:46:26 -0400 (Mon, 13 Oct 2008)
New Revision: 10801
Added:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/SortingCompoundContentAssistProcessor.java
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/schema/contentAssistProcessor.exsd
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorBuilder.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorDefinition.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2118 Cleanup/unify the EL code completion used in JSF, Java, Seam completions
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/schema/contentAssistProcessor.exsd
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/schema/contentAssistProcessor.exsd 2008-10-13 16:37:31 UTC (rev 10800)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/schema/contentAssistProcessor.exsd 2008-10-13 17:46:26 UTC (rev 10801)
@@ -74,6 +74,26 @@
</complexType>
</element>
+ <element name="contenttype">
+ <annotation>
+ <documentation>
+ Defined the editor's content type to be assotiated with the Content Assist Processor. The value is either one of the WTP structured model content type ID or any other structured text content type ID
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="partitiontype" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique ID for this contenttype. The value is either one of the WTP structured model content type ID or any other structured text content type ID.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
<element name="partitiontype">
<annotation>
<documentation>
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java 2008-10-13 16:37:31 UTC (rev 10800)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java 2008-10-13 17:46:26 UTC (rev 10801)
@@ -26,6 +26,7 @@
import org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML;
import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorBuilder;
import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorDefinition;
+import org.jboss.tools.common.text.xml.contentassist.SortingCompoundContentAssistProcessor;
/**
* @author Igels
@@ -43,7 +44,15 @@
}
protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
-
+
+ SortingCompoundContentAssistProcessor sortingCompoundProcessor = new SortingCompoundContentAssistProcessor(sourceViewer, partitionType);
+ List<IContentAssistProcessor> processors = new ArrayList<IContentAssistProcessor>();
+
+// if (sortingCompoundProcessor.size() > 0) {
+ if (sortingCompoundProcessor.supportsPartitionType(partitionType)) {
+ processors.add(sortingCompoundProcessor);
+ }
+/*
// if we have our own processors we need
// to define them in plugin.xml file of their
// plugins using extention point
@@ -53,18 +62,17 @@
if(defs==null) return null;
- List processors = new ArrayList();
for(int i=0; i<defs.length; i++) {
IContentAssistProcessor processor = defs[i].createContentAssistProcessor();
if(!processors.contains(processor)) {
processors.add(processor);
}
}
-
+*/
IContentAssistProcessor[] in = getInitialProcessors(sourceViewer, partitionType);
if(in != null && in.length > 0) {
- //we do not need super processors - make initial processors responcible for that
+ //we do not need super processors - make initial processors responsible for that
for(int i=0; i<in.length; i++) {
if(!processors.contains(in[i])) {
processors.add(in[i]);
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorBuilder.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorBuilder.java 2008-10-13 16:37:31 UTC (rev 10800)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorBuilder.java 2008-10-13 17:46:26 UTC (rev 10801)
@@ -12,6 +12,8 @@
package org.jboss.tools.common.text.xml.contentassist;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -26,6 +28,7 @@
public static final String PL_CONTENTASSISTPROCESSOR = "contentAssistProcessor"; //$NON-NLS-1$
public static final String TAG_CONTENTASSISTPROCESSOR = "contentAssistProcessor"; //$NON-NLS-1$
+ public static final String TAG_CONTENT_TYPE = "contenttype"; //$NON-NLS-1$
public static final String TAG_PARTITION_TYPE = "partitiontype"; //$NON-NLS-1$
public static final String ATT_ID = "id"; //$NON-NLS-1$
@@ -37,6 +40,7 @@
private List<ContentAssistProcessorDefinition> fContentAssistProcessorDefs = null;
private ContentAssistProcessorDefinition fCurrentDefinition = null;
+ private String fCurrentDefinitionContentType = null;
/**
* returns singleton instance of ContentAssistProcessorBuilder
@@ -94,6 +98,24 @@
}
/**
+ * Processes element which should be a configuration element specifying an
+ * open on object. Creates a new ContentAssistProcessor definitio object and adds it to the
+ * list of ContentAssistProcessor definition objects
+ *
+ * @param element ContentAssistProcessor configuration element
+ */
+ private void processContentTypeTag(IConfigurationElement element) {
+ String theId = getId(element);
+
+ if (theId != null && fCurrentDefinition != null) {
+ fCurrentDefinitionContentType = theId;
+ }
+ else {
+ fCurrentDefinitionContentType = null;
+ }
+ }
+
+ /**
* Processes element which should be a configuration element specifying a partition
* type for the current contentAssistProcessor tag. Assumes that there is a valid
* current contentAssistProcessor tag.
@@ -104,8 +126,8 @@
// add to current HyperlinkDefinition/contentType
String theId = getId(element);
- if (theId != null) {
- fCurrentDefinition.addPartitionType(theId);
+ if (theId != null && fCurrentDefinition != null && fCurrentDefinitionContentType != null) {
+ fCurrentDefinition.addPartitionType(fCurrentDefinitionContentType, theId);
}
}
@@ -123,6 +145,14 @@
}
return true;
}
+ else if (tag.equals(TAG_CONTENT_TYPE)) {
+ processContentTypeTag(element);
+
+ if (fCurrentDefinition != null) {
+ readElementChildren(element);
+ }
+ return true;
+ }
else if (tag.equals(TAG_PARTITION_TYPE)) {
processPartitionTypeTag(element);
return true;
@@ -147,7 +177,36 @@
(ContentAssistProcessorDefinition[])fContentAssistProcessorDefs.toArray(new ContentAssistProcessorDefinition[fContentAssistProcessorDefs.size()]));
}
+
/**
+ * Returns all the valid ContentTypes for partitionType
+ *
+ * @param partitionType
+ * @return if partitionType is null, null is returned
+ */
+ public Collection<String> getContentAssistProcessorContentTypes(String partitionType) {
+ if (partitionType == null) {
+ return null;
+ }
+
+ ContentAssistProcessorDefinition[] allDefs = getContentAssistProcessorDefinitions();
+ List<ContentAssistProcessorDefinition> defs = new ArrayList<ContentAssistProcessorDefinition>();
+ List<ContentAssistProcessorDefinition> lastDefs = new ArrayList<ContentAssistProcessorDefinition>();
+
+ HashSet<String> validContentTypes = new HashSet<String>();
+ for (int i = 0; i < allDefs.length; ++i) {
+ Collection<String> contentTypes = allDefs[i].getContentTypes();
+
+ if (contentTypes != null) {
+ validContentTypes.addAll(contentTypes);
+ }
+ }
+
+ return validContentTypes;
+ }
+
+
+ /**
* Returns all the ContentAssistProcessor definition objects valid for partitionType
*
* @param partitionType
@@ -159,26 +218,29 @@
}
ContentAssistProcessorDefinition[] allDefs = getContentAssistProcessorDefinitions();
- List defs = new ArrayList();
- List lastDefs = new ArrayList();
+ List<ContentAssistProcessorDefinition> defs = new ArrayList<ContentAssistProcessorDefinition>();
+ List<ContentAssistProcessorDefinition> lastDefs = new ArrayList<ContentAssistProcessorDefinition>();
for (int i = 0; i < allDefs.length; ++i) {
- List partitions = (List) allDefs[i].getPartitionTypes();
- if (partitions != null) {
- if (partitions.isEmpty()) {
- lastDefs.add(allDefs[i]);
- }
- else {
- int j = 0;
- boolean added = false;
- while (j < partitions.size() && !added) {
- if (partitionType.equals(partitions.get(j))) {
- defs.add(allDefs[i]);
- added = true;
+ for (String contentType : allDefs[i].getContentTypes()) {
+ List<String> partitions = allDefs[i].getPartitionTypes(contentType);
+
+ if (partitions != null) {
+ if (partitions.isEmpty()) {
+ lastDefs.add(allDefs[i]);
+ }
+ else {
+ int j = 0;
+ boolean added = false;
+ while (j < partitions.size() && !added) {
+ if (partitionType.equals(partitions.get(j))) {
+ defs.add(allDefs[i]);
+ added = true;
+ }
+ else {
+ ++j;
+ }
}
- else {
- ++j;
- }
}
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorDefinition.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorDefinition.java 2008-10-13 16:37:31 UTC (rev 10800)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorDefinition.java 2008-10-13 17:46:26 UTC (rev 10801)
@@ -12,7 +12,10 @@
package org.jboss.tools.common.text.xml.contentassist;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -26,8 +29,8 @@
private String fId = null;
private String fClassName = null;
- // a list of partition types (String)
- private List fPartitionTypes = null;
+ // a list of content types (String)
+ private Map<String, List<String>> fContentTypes = null;
private IConfigurationElement fConfigurationElement = null;
@@ -41,12 +44,20 @@
fId = id;
fClassName = class1;
fConfigurationElement = configurationElement;
- fPartitionTypes = new ArrayList();
+ fContentTypes = new HashMap<String, List<String>>();
}
- public void addPartitionType(String partitionType) {
- if (!fPartitionTypes.contains(partitionType))
- fPartitionTypes.add(partitionType);
+ public void addPartitionType(String contentType, String partitionType) {
+ List<String> partitionTypes = new ArrayList<String>();
+
+ if (fContentTypes.containsKey(contentType)) {
+ partitionTypes = fContentTypes.get(contentType);
+ }
+
+ if (!partitionTypes.contains(partitionType)) {
+ partitionTypes.add(partitionType);
+ fContentTypes.put(contentType, partitionTypes);
+ }
}
/**
@@ -131,9 +142,18 @@
}
/**
- * @return Returns the fPartitionTypes.
+ * @return Returns the collection of ContentTypes.
*/
- public List getPartitionTypes() {
- return fPartitionTypes;
+ public Collection<String> getContentTypes() {
+ return fContentTypes.keySet();
}
+
+ /**
+ * @return Returns the list of Partition Types for the specified ContentType.
+ */
+ public List<String> getPartitionTypes(String contentType) {
+ return (fContentTypes == null || !fContentTypes.containsKey(contentType) ?
+ new ArrayList<String>(): fContentTypes.get(contentType));
+ }
+
}
Added: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/SortingCompoundContentAssistProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/SortingCompoundContentAssistProcessor.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/SortingCompoundContentAssistProcessor.java 2008-10-13 17:46:26 UTC (rev 10801)
@@ -0,0 +1,543 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.common.text.xml.contentassist;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.TextPresentation;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationExtension;
+import org.eclipse.jface.text.contentassist.IContextInformationPresenter;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.swt.graphics.Image;
+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.StructuredModelManager;
+
+/**
+ * Reads the plugin.xml file for the processors defined using the
+ * extention point
+ * "org.jboss.tools.common.text.xml.contentAssistProcessor"
+ *
+ * @author jeremy
+ *
+ */
+
+public class SortingCompoundContentAssistProcessor implements IContentAssistProcessor {
+ private ISourceViewer fSourceViewer;
+ private String fPartitionType;
+ private String fErrorMessage;
+
+
+ private static Map<String, Map<String, List<IContentAssistProcessor>>> fProcessorsMap;
+
+ public SortingCompoundContentAssistProcessor(ISourceViewer sourceViewer, String partitionType) {
+ this.fSourceViewer = sourceViewer;
+ this.fPartitionType = partitionType;
+ init();
+ }
+
+ public boolean supportsPartitionType(String partitionType) {
+ if (fProcessorsMap == null)
+ return false;
+
+ for (String contentType : fProcessorsMap.keySet()) {
+ Map<String, List<IContentAssistProcessor>> partitionTypes =
+ fProcessorsMap.get(contentType);
+ if (partitionTypes != null && partitionTypes.containsKey(partitionType))
+ return true;
+ }
+ return false;
+ }
+
+ void init () {
+ ContentAssistProcessorDefinition[] defs = ContentAssistProcessorBuilder.getInstance().getContentAssistProcessorDefinitions(fPartitionType);
+
+ if(defs==null || defs.length == 0) return;
+
+ if (fProcessorsMap == null)
+ fProcessorsMap = new HashMap<String, Map<String, List<IContentAssistProcessor>>>();
+
+ for(int i=0; i<defs.length; i++) {
+ IContentAssistProcessor processor = defs[i].createContentAssistProcessor();
+ Collection<String> contentTypes = defs[i].getContentTypes();
+ if (contentTypes != null) {
+ for (String contentType : contentTypes) {
+ Map<String, List<IContentAssistProcessor>> contentTypeProcessors =
+ fProcessorsMap.get(contentType);
+
+ if (contentTypeProcessors == null) {
+ contentTypeProcessors = new HashMap<String, List<IContentAssistProcessor>>();
+ }
+
+ List<String> partitionTypes = defs[i].getPartitionTypes(contentType);
+ for (String partitionType : partitionTypes) {
+ List<IContentAssistProcessor> partitionTypeProcessors =
+ contentTypeProcessors.get(partitionType);
+
+ if (partitionTypeProcessors == null) {
+ partitionTypeProcessors = new ArrayList<IContentAssistProcessor>();
+ }
+
+ if(!containsAnObjectOfTheSameType(partitionTypeProcessors,processor)) {
+ partitionTypeProcessors.add(processor);
+ }
+
+ if (!contentTypeProcessors.containsKey(partitionType)) {
+ contentTypeProcessors.put(partitionType, partitionTypeProcessors);
+ }
+ }
+
+ if (!fProcessorsMap.containsKey(contentType)) {
+ fProcessorsMap.put(contentType, contentTypeProcessors);
+ }
+ }
+ }
+ }
+
+ }
+
+ boolean containsAnObjectOfTheSameType(Collection collection, Object obj) {
+ if (collection == null || obj == null)
+ return false;
+
+ String objClassName = obj.getClass().getName();
+ for (Object o : collection) {
+ if (objClassName.equals(o.getClass().getName()))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns the content type of document
+ *
+ * @param document -
+ * assumes document is not null
+ * @return String content type of given document
+ */
+ protected String getContentType(ISourceViewer viewer) {
+ if (viewer == null || viewer.getDocument() == null)
+ return null;
+
+ String type = null;
+
+ IModelManager mgr = StructuredModelManager.getModelManager();
+ IStructuredModel model = null;
+ try {
+ model = mgr.getExistingModelForRead(viewer.getDocument());
+ if (model != null) {
+ type = model.getContentTypeIdentifier();
+ }
+ } finally {
+ if (model != null) {
+ model.releaseFromRead();
+ }
+ }
+ return type;
+ }
+
+ /**
+ * Returns a list of completion proposals based on the
+ * specified location within the document that corresponds
+ * to the current cursor position within the text viewer.
+ *
+ * @param viewer the viewer whose document is used to compute the proposals
+ * @param offset an offset within the document for which completions should be computed
+ * @return an array of completion proposals or <code>null</code> if no proposals are possible
+ */
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
+ fErrorMessage = null;
+
+ String contentType = getContentType(fSourceViewer);
+ if (contentType == null)
+ return new ICompletionProposal[0];
+
+ List<ICompletionProposal> ret = new LinkedList<ICompletionProposal>();
+
+ if (fProcessorsMap.get(contentType) == null)
+ return new ICompletionProposal[0];
+
+ if (fProcessorsMap.get(contentType).get(fPartitionType) == null)
+ return new ICompletionProposal[0];
+
+ List<IContentAssistProcessor> processors = fProcessorsMap.get(contentType).get(fPartitionType);
+
+ for (IContentAssistProcessor p : processors) {
+ ICompletionProposal[] proposals = p.computeCompletionProposals(viewer, offset);
+ if (proposals != null && proposals.length > 0) {
+ ret.addAll(Arrays.asList(proposals));
+ fErrorMessage = null; // Hide previous errors
+ } else {
+ if (fErrorMessage == null && ret.isEmpty()) {
+ String errorMessage = p.getErrorMessage();
+ if (errorMessage != null) {
+ fErrorMessage = errorMessage;
+ }
+ }
+ }
+ }
+
+ ICompletionProposal[] resultArray = ret.toArray(new ICompletionProposal[ret.size()]);
+ // TODO: Need to improve the sorting algorithm
+/* Arrays.sort(resultArray, new Comparator<ICompletionProposal>() {
+ public int compare(ICompletionProposal arg0,
+ ICompletionProposal arg1) {
+ String str0 = (arg0 == null ? "" : arg0.getDisplayString()); //$NON-NLS-1$
+ String str1 = (arg1 == null ? "" : arg1.getDisplayString()); //$NON-NLS-1$
+ return str0.compareTo(str1);
+ }});
+*/
+
+ return resultArray;
+ }
+
+ /**
+ * Returns information about possible contexts based on the
+ * specified location within the document that corresponds
+ * to the current cursor position within the text viewer.
+ *
+ * @param viewer the viewer whose document is used to compute the possible contexts
+ * @param offset an offset within the document for which context information should be computed
+ * @return an array of context information objects or <code>null</code> if no context could be found
+ */
+ public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
+ fErrorMessage = null;
+
+ String contentType = getContentType(fSourceViewer);
+ if (contentType == null)
+ return new IContextInformation[0];
+
+ List<IContextInformation> ret = new LinkedList<IContextInformation>();
+
+ if (fProcessorsMap.get(contentType) == null)
+ return new IContextInformation[0];
+
+ if (fProcessorsMap.get(contentType).get(fPartitionType) == null)
+ return new IContextInformation[0];
+
+ for (IContentAssistProcessor p : fProcessorsMap.get(contentType).get(fPartitionType)) {
+ IContextInformation[] informations = p.computeContextInformation(viewer, offset);
+ if (informations != null && informations.length > 0) {
+ for (int i = 0; i < informations.length; i++)
+ ret.add(new ContextInformation(informations[i], p));
+ fErrorMessage = null; // Hide previous errors
+ } else {
+ if (fErrorMessage == null && ret.isEmpty()) {
+ String errorMessage = p.getErrorMessage();
+ if (errorMessage != null) {
+ fErrorMessage = errorMessage;
+ }
+ }
+ }
+ }
+ return (IContextInformation[]) ret.toArray(new IContextInformation[ret.size()]);
+ }
+
+ /**
+ * Returns the characters which when entered by the user should
+ * automatically trigger the presentation of possible completions.
+ *
+ * @return the auto activation characters for completion proposal or <code>null</code>
+ * if no auto activation is desired
+ */
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ String contentType = getContentType(fSourceViewer);
+ if (contentType == null)
+ return new char[0];
+
+ List<Character> ret = new LinkedList<Character>();
+
+ if (fProcessorsMap.get(contentType) == null)
+ return new char[0];
+
+ if (fProcessorsMap.get(contentType).get(fPartitionType) == null)
+ return new char[0];
+
+ for (IContentAssistProcessor p : fProcessorsMap.get(contentType).get(fPartitionType)) {
+ char[] chars = p.getCompletionProposalAutoActivationCharacters();
+ if (chars != null)
+ for (int i = 0; i < chars.length; i++)
+ ret.add(new Character(chars[i]));
+ }
+
+ char[] chars = new char[ret.size()];
+ int i = 0;
+ for (Iterator it = ret.iterator(); it.hasNext(); i++) {
+ Character ch = (Character) it.next();
+ chars[i] = ch.charValue();
+ }
+ return chars;
+ }
+
+ /**
+ * Returns the characters which when entered by the user should
+ * automatically trigger the presentation of context information.
+ *
+ * @return the auto activation characters for presenting context information
+ * or <code>null</code> if no auto activation is desired
+ */
+ public char[] getContextInformationAutoActivationCharacters() {
+ String contentType = getContentType(fSourceViewer);
+ if (contentType == null)
+ return new char[0];
+
+ List<Character> ret = new LinkedList<Character>();
+
+ if (fProcessorsMap.get(contentType) == null)
+ return new char[0];
+
+ if (fProcessorsMap.get(contentType).get(fPartitionType) == null)
+ return new char[0];
+
+ for (IContentAssistProcessor p : fProcessorsMap.get(contentType).get(fPartitionType)) {
+ char[] chars = p.getContextInformationAutoActivationCharacters();
+ if (chars != null)
+ for (int i = 0; i < chars.length; i++)
+ ret.add(new Character(chars[i]));
+ }
+
+ char[] chars = new char[ret.size()];
+ int i = 0;
+ for (Iterator it = ret.iterator(); it.hasNext(); i++) {
+ Character ch = (Character) it.next();
+ chars[i] = ch.charValue();
+ }
+ return chars;
+ }
+
+ /**
+ * Returns the reason why this content assist processor
+ * was unable to produce any completion proposals or context information.
+ *
+ * @return an error message or <code>null</code> if no error occurred
+ */
+ public String getErrorMessage() {
+ return fErrorMessage;
+ }
+
+ /**
+ * Returns a validator used to determine when displayed context information
+ * should be dismissed. May only return <code>null</code> if the processor is
+ * incapable of computing context information. <p>
+ *
+ * @return a context information validator, or <code>null</code> if the processor
+ * is incapable of computing context information
+ */
+ public IContextInformationValidator getContextInformationValidator() {
+ boolean hasValidator = false;
+ boolean hasPresenter = false;
+ boolean hasExtension = false;
+
+
+ String contentType = getContentType(fSourceViewer);
+ if (contentType == null)
+ return null;
+
+ List<Character> ret = new LinkedList<Character>();
+
+ if (fProcessorsMap.get(contentType) == null)
+ return null;
+
+ if (fProcessorsMap.get(contentType).get(fPartitionType) == null)
+ return null;
+
+ for (IContentAssistProcessor p : fProcessorsMap.get(contentType).get(fPartitionType)) {
+ IContextInformationValidator v = p.getContextInformationValidator();
+ if (v != null) {
+ hasValidator = true;
+ if (v instanceof IContextInformationPresenter) {
+ hasPresenter = true;
+ }
+ }
+ }
+
+ SortingCompoundContentAssistValidator validator = null;
+ if (hasPresenter)
+ validator = new SortingCompoundContentAssistValidatorPresenter();
+ else if (hasValidator)
+ validator = new SortingCompoundContentAssistValidator();
+
+ if (validator != null)
+ for (IContentAssistProcessor p : fProcessorsMap.get(contentType).get(fPartitionType)) {
+ IContextInformationValidator v = p.getContextInformationValidator();
+ if (v != null)
+ validator.add(v);
+ }
+
+ return validator;
+ }
+
+
+ static class ContextInformation implements IContextInformation, IContextInformationExtension {
+ private IContextInformation fInfo;
+ private IContentAssistProcessor fProcessor;
+
+ ContextInformation(IContextInformation info, IContentAssistProcessor processor) {
+ fInfo = info;
+ fProcessor = processor;
+ }
+
+ /*
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ return fInfo.equals(obj);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.IContextInformation#getContextDisplayString()
+ */
+ public String getContextDisplayString() {
+ return fInfo.getContextDisplayString();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.IContextInformation#getImage()
+ */
+ public Image getImage() {
+ return fInfo.getImage();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.IContextInformation#getInformationDisplayString()
+ */
+ public String getInformationDisplayString() {
+ return fInfo.getInformationDisplayString();
+ }
+
+ /*
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return fInfo.hashCode();
+ }
+
+ /*
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return fInfo.toString();
+ }
+
+ IContentAssistProcessor getProcessor() {
+ return fProcessor;
+ }
+
+ IContextInformation getContextInformation() {
+ return fInfo;
+ }
+
+ public int getContextInformationPosition() {
+ int position = -1;
+ if (fInfo instanceof IContextInformationExtension)
+ position = ((IContextInformationExtension)fInfo).getContextInformationPosition();
+ return position;
+ }
+ }
+
+ private static class SortingCompoundContentAssistValidator implements IContextInformationValidator {
+ List fValidators = new ArrayList();
+ IContextInformationValidator fValidator;
+
+ void add(IContextInformationValidator validator) {
+ fValidators.add(validator);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.IContextInformationValidator#install(org.eclipse.jface.text.contentassist.IContextInformation,
+ * org.eclipse.jface.text.ITextViewer, int)
+ */
+ public void install(IContextInformation info, ITextViewer viewer, int documentPosition) {
+ // install either the validator in the info, or all validators
+ fValidator = getValidator(info);
+ IContextInformation realInfo = getContextInformation(info);
+ if (fValidator != null)
+ fValidator.install(realInfo, viewer, documentPosition);
+ else {
+ for (Iterator it = fValidators.iterator(); it.hasNext();) {
+ IContextInformationValidator v = (IContextInformationValidator) it.next();
+ v.install(realInfo, viewer, documentPosition);
+ }
+ }
+ }
+
+ IContextInformationValidator getValidator(IContextInformation info) {
+ if (info instanceof ContextInformation) {
+ ContextInformation wrap = (ContextInformation) info;
+ return wrap.getProcessor().getContextInformationValidator();
+ }
+
+ return null;
+ }
+
+ IContextInformation getContextInformation(IContextInformation info) {
+ IContextInformation realInfo = info;
+ if (info instanceof ContextInformation) {
+ ContextInformation wrap = (ContextInformation) info;
+ realInfo = wrap.getContextInformation();
+ }
+
+ return realInfo;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.IContextInformationValidator#isContextInformationValid(int)
+ */
+ public boolean isContextInformationValid(int documentPosition) {
+ // use either the validator in the info, or all validators
+ boolean isValid = false;
+ if (fValidator != null)
+ isValid = fValidator.isContextInformationValid(documentPosition);
+ else {
+ for (Iterator it = fValidators.iterator(); it.hasNext();) {
+ IContextInformationValidator v = (IContextInformationValidator) it.next();
+ isValid |= v.isContextInformationValid(documentPosition);
+ }
+ }
+ return isValid;
+ }
+
+ }
+
+ private static class SortingCompoundContentAssistValidatorPresenter extends SortingCompoundContentAssistValidator implements IContextInformationPresenter {
+ public boolean updatePresentation(int offset, TextPresentation presentation) {
+ // use either the validator in the info, or all validators
+ boolean presentationUpdated = false;
+ if (fValidator instanceof IContextInformationPresenter)
+ presentationUpdated = ((IContextInformationPresenter) fValidator).updatePresentation(offset, presentation);
+ else {
+ for (Iterator it = fValidators.iterator(); it.hasNext();) {
+ IContextInformationValidator v = (IContextInformationValidator) it.next();
+ if (v instanceof IContextInformationPresenter)
+ presentationUpdated |= ((IContextInformationPresenter) v).updatePresentation(offset, presentation);
+ }
+ }
+ return presentationUpdated;
+ }
+ }
+}
16 years, 5 months
JBoss Tools SVN: r10800 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: resources/extendedDataTable and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-10-13 12:37:31 -0400 (Mon, 13 Oct 2008)
New Revision: 10800
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/extendedDataTable/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/extendedDataTable/extendedDataTable.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/extendedDataTable/sortable.gif
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2761
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/extendedDataTable/extendedDataTable.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/extendedDataTable/extendedDataTable.css (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/extendedDataTable/extendedDataTable.css 2008-10-13 16:37:31 UTC (rev 10800)
@@ -0,0 +1,117 @@
+.dr-table {
+ border-top: 1px solid;
+ border-left: 1px solid;
+ border-color: #C4C0B9;
+}
+
+.dr-table-cell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ font-size: 11px;
+ color: #000000;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-subtable-cell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ font-size: 11px;
+ color: #000000;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-table-header {
+ background-color: #D4CFC7;
+ background-position: top left;
+ background-repeat: repeat-x;
+}
+
+.dr-table-header-continue {
+ background-color: #D4CFC7;
+}
+
+.dr-table-headercell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ color: #000000;
+ text-align: center;
+ font-weight: bold;
+ font-size: 11px;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-table-subheader {
+ background-color: #F1EEE9;
+}
+
+.dr-table-subheadercell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ text-align: center;
+ font-size: 11px;
+ font-color: #000000;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-table-footercell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ color: #000000;
+ text-align: left;
+ font-weight: bold;
+ font-size: 11px;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-table-subfootercell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ text-align: left;
+ font-size: 11px;
+ color: #000000;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-subtable-header {
+ background-color: #F1EEE9;
+}
+
+.dr-subtable-headercell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ text-align: center;
+ font-size: 11px;
+ color: #000000;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+.dr-subtable-footercell {
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #C4C0B9;
+ padding: 4px 4px 4px 4px;
+ text-align: left;
+}
+
+.dr-spr {
+ display: block;
+}
+
+.dr-table-hidden {
+ overflow: hidden;
+ border: solid 1px #C4C0C9;
+}
\ No newline at end of file
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/extendedDataTable/sortable.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/extendedDataTable/sortable.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java 2008-10-13 16:04:38 UTC (rev 10799)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java 2008-10-13 16:37:31 UTC (rev 10800)
@@ -34,18 +34,50 @@
*/
public class RichFacesExtendedDataTableTemplate extends VpeAbstractTemplate {
- final static String DEFAULT_HEIGHT = "500px";
- final static String DEFAULT_WIDTH = "100%";
- final static String HEADER = "header";
- final static String HEADER_CLASS = "headerClass";
- final static String FOOTER = "footer";
- final static String FOOTER_CLASS = "footerClass";
- final static String CAPTION_CLASS = "captionClass";
- final static String CAPTION_STYLE = "captionStyle";
- final static String SPACE = " ";
+ private static final String COLUMNS = "columns"; //$NON-NLS-1$
+ private static final String FALSE = "false"; //$NON-NLS-1$
+ private static final String SCOP = "scop"; //$NON-NLS-1$
+ private static final String COL = "col"; //$NON-NLS-1$
+ private static final String TABLE_CAPTION_RICH_TABLE_CAPTION = "dr-table-caption rich-table-caption"; //$NON-NLS-1$
+ private static final String DR_TABLE_CAPTION_RICH_TABLE_CAPTION = "dr-table-caption rich-table-caption "; //$NON-NLS-1$
+ private static final String SUB_TABLE = ":subTable"; //$NON-NLS-1$
+ private static final String COLUMN_GROUP = ":columnGroup"; //$NON-NLS-1$
+ private static final String DR_TABLE_ROW_RICH_TABLE_ROW = "dr-table-row rich-table-row"; //$NON-NLS-1$
+ private static final String DR_TABLE_FIRSTROW_RICH_TABLE_FIRSTROW = "dr-table-firstrow rich-table-firstrow"; //$NON-NLS-1$
+ private static final String TRUE = "true"; //$NON-NLS-1$
+ private static final String BREAK_BEFORE = "breakBefore"; //$NON-NLS-1$
+ private static final String DR_TABLE_FOOTERCELL_RICH_TABLE_FOOTERCELL = "dr-table-footercell rich-table-footercell"; //$NON-NLS-1$
+ private static final String DR_TABLE_FOOTER_CONTINUE_RICH_TABLE_FOOTER_CONTINUE = "dr-table-footer-continue rich-table-footer-continue"; //$NON-NLS-1$
+ private static final String DR_TABLE_FOOTER_RICH_TABLE_FOOTER = "dr-table-footer rich-table-footer"; //$NON-NLS-1$
+ private static final String DR_TABLE_SUBFOOTERCELL_RICH_TABLE_SUBFOOTERCELL = "dr-table-subfootercell rich-table-subfootercell"; //$NON-NLS-1$
+ private static final String DR_TABLE_SUBFOOTER_RICH_TABLE_SUBFOOTER = "dr-table-subfooter rich-table-subfooter"; //$NON-NLS-1$
+ private static final String DR_TABLE_SUBHEADERCELL_RICH_TABLE_SUBHEADERCELL = "dr-table-subheadercell rich-table-subheadercell"; //$NON-NLS-1$
+ private static final String DR_TABLE_SUBHEADER_RICH_TABLE_SUBHEADER = "dr-table-subheader rich-table-subheader"; //$NON-NLS-1$
+ private static final String DR_TABLE_HEADERCELL_RICH_TABLE_HEADERCELL = "dr-table-headercell rich-table-headercell"; //$NON-NLS-1$
+ private static final String DR_TABLE_HEADER_CONTINUE_RICH_TABLE_HEADER_CONTINUE = "dr-table-header-continue rich-table-header-continue"; //$NON-NLS-1$
+ private static final String DR_TABLE_HEADER_RICH_TABLE_HEADER = "dr-table-header rich-table-header"; //$NON-NLS-1$
+ private static final String EMPTY = ""; //$NON-NLS-1$
+ private static final String DR_TABLE_RICH_TABLE = "dr-table rich-table "; //$NON-NLS-1$
+ private static final String RICH_FACES_DATA_TABLE = "richFacesDataTable"; //$NON-NLS-1$
+ private static final String EXTENDED_DATA_TABLE_CSS = "extendedDataTable/extendedDataTable.css"; //$NON-NLS-1$
+ private static final String SEMICOLON = ";"; //$NON-NLS-1$
+ private static final String COLON = " : "; //$NON-NLS-1$
+ private static final String DR_TABLE_HIDDEN = "dr-table-hidden"; //$NON-NLS-1$
+ private static final String COLUMN = ":column"; //$NON-NLS-1$
+ final static String DEFAULT_HEIGHT = "500px"; //$NON-NLS-1$
+ final static String DEFAULT_WIDTH = "100%"; //$NON-NLS-1$
+ final static String HEADER = "header"; //$NON-NLS-1$
+ final static String HEADER_CLASS = "headerClass"; //$NON-NLS-1$
+ final static String FOOTER = "footer"; //$NON-NLS-1$
+ final static String FOOTER_CLASS = "footerClass"; //$NON-NLS-1$
+ final static String CAPTION_CLASS = "captionClass"; //$NON-NLS-1$
+ final static String CAPTION_STYLE = "captionStyle"; //$NON-NLS-1$
+ final static String ATTR_SORTABLE = "sortable"; //$NON-NLS-1$
+ final static String SPACE = " "; //$NON-NLS-1$
+ final static String ZERRO = "0"; //$NON-NLS-1$
+ final static String SORTABLE_PATH = "extendedDataTable/sortable.gif"; //$NON-NLS-1$
- private static String STYLE_FOR_LOW_SCROLL = "overflow: scroll; width: 100%; height: 17px;";
- private static String STYLE_FOR_RIGHT_SCROLL = "overflow: scroll; width: 17px; height: 100%;";
+ private static String STYLE_FOR_RIGHT_SCROLL = "overflow: scroll; width: 17px; height: 100%;"; //$NON-NLS-1$
private static final int NUM_ROW = 5;
@@ -77,22 +109,8 @@
VpeCreationData creationData = new VpeCreationData(tableCommon);
nsIDOMElement tr1 = visualDocument.createElement(HTML.TAG_TR);
-
- nsIDOMElement tr2 = visualDocument.createElement(HTML.TAG_TR);
-
tableCommon.appendChild(tr1);
- tableCommon.appendChild(tr2);
- // ---------tr2
- nsIDOMElement tr2_TD = visualDocument.createElement(HTML.TAG_TD);
- tr2.appendChild(tr2_TD);
-
- nsIDOMElement tr2_td_DIV = visualDocument.createElement(HTML.TAG_DIV);
- tr2_td_DIV.setAttribute(HTML.ATTR_STYLE, STYLE_FOR_LOW_SCROLL);
- tr2_TD.appendChild(tr2_td_DIV);
-
- // --------------------------------------------
-
// ---------------------tr1------------------------
nsIDOMElement tr1_TD1 = visualDocument.createElement(HTML.TAG_TD);
tr1.appendChild(tr1_TD1);
@@ -107,12 +125,12 @@
// -------------------------------------------------------
nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
tr1_TD1.appendChild(div);
- div.setAttribute(HTML.ATTR_CLASS, "dr-table-hidden");
+ div.setAttribute(HTML.ATTR_CLASS, DR_TABLE_HIDDEN);
- String divStyle = HTML.ATTR_WIDTH + " : "
- + (width == null ? DEFAULT_WIDTH : width) + ";"
- + HTML.ATTR_HEIGHT + " : "
- + (height == null ? DEFAULT_HEIGHT : height) + ";";
+ String divStyle = HTML.ATTR_WIDTH + COLON
+ + (width == null ? DEFAULT_WIDTH : width) + SEMICOLON
+ + HTML.ATTR_HEIGHT + COLON
+ + (height == null ? DEFAULT_HEIGHT : height) + SEMICOLON;
div.setAttribute(HTML.ATTR_STYLE, divStyle);
@@ -121,13 +139,14 @@
table.removeAttribute(HTML.ATTR_HEIGHT);
div.appendChild(table);
- ComponentUtil.setCSSLink(pageContext,
- "scrollableDataTable/scrollableDataTable.css",
- "richFacesDataTable");
+ ComponentUtil
+ .setCSSLink(pageContext,
+ EXTENDED_DATA_TABLE_CSS,
+ RICH_FACES_DATA_TABLE);
String tableClass = sourceElement
.getAttribute(RichFaces.ATTR_STYLE_CLASS);
- table.setAttribute(HTML.ATTR_CLASS, "dr-table rich-table "
- + (tableClass == null ? "" : tableClass));
+ table.setAttribute(HTML.ATTR_CLASS, DR_TABLE_RICH_TABLE
+ + (tableClass == null ? EMPTY : tableClass));
// Encode colgroup definition.
ArrayList<Element> columns = getColumns(sourceElement);
@@ -151,23 +170,23 @@
if (header != null) {
encodeTableHeaderOrFooterFacet(creationData, thead,
columnsLength, visualDocument, header,
- "dr-table-header rich-table-header",
- "dr-table-header-continue rich-table-header-continue",
- "dr-table-headercell rich-table-headercell",
+ DR_TABLE_HEADER_RICH_TABLE_HEADER,
+ DR_TABLE_HEADER_CONTINUE_RICH_TABLE_HEADER_CONTINUE,
+ DR_TABLE_HEADERCELL_RICH_TABLE_HEADERCELL,
headerClass, HTML.TAG_TD);
}
if (!columnsHeaders.isEmpty()) {
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
thead.appendChild(tr);
String styleClass = encodeStyleClass(null,
- "dr-table-subheader rich-table-subheader", null,
+ DR_TABLE_SUBHEADER_RICH_TABLE_SUBHEADER, null,
headerClass);
if (styleClass != null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
}
encodeHeaderOrFooterFacets(creationData, tr, visualDocument,
columnsHeaders,
- "dr-table-subheadercell rich-table-subheadercell",
+ DR_TABLE_SUBHEADERCELL_RICH_TABLE_SUBHEADERCELL,
headerClass, HEADER, HTML.TAG_TD);
}
}
@@ -184,22 +203,22 @@
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
tfoot.appendChild(tr);
String styleClass = encodeStyleClass(null,
- "dr-table-subfooter rich-table-subfooter", null,
+ DR_TABLE_SUBFOOTER_RICH_TABLE_SUBFOOTER, null,
footerClass);
if (styleClass != null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
}
encodeHeaderOrFooterFacets(creationData, tr, visualDocument,
columnsFooters,
- "dr-table-subfootercell rich-table-subfootercell",
+ DR_TABLE_SUBFOOTERCELL_RICH_TABLE_SUBFOOTERCELL,
footerClass, FOOTER, HTML.TAG_TD);
}
if (footer != null) {
encodeTableHeaderOrFooterFacet(creationData, tfoot,
columnsLength, visualDocument, footer,
- "dr-table-footer rich-table-footer",
- "dr-table-footer-continue rich-table-footer-continue",
- "dr-table-footercell rich-table-footercell",
+ DR_TABLE_FOOTER_RICH_TABLE_FOOTER,
+ DR_TABLE_FOOTER_CONTINUE_RICH_TABLE_FOOTER_CONTINUE,
+ DR_TABLE_FOOTERCELL_RICH_TABLE_FOOTERCELL,
footerClass, HTML.TAG_TD);
}
}
@@ -214,34 +233,34 @@
nsIDOMElement tr = null;
VpeChildrenInfo trInfo = null;
for (Node child : children) {
- if (child.getNodeName().endsWith(":column")) {
+ if (child.getNodeName().endsWith(COLUMN)) {
String breakBefore = ((Element) child)
- .getAttribute("breakBefore");
+ .getAttribute(BREAK_BEFORE);
if (breakBefore != null
- && breakBefore.equalsIgnoreCase("true")) {
+ && breakBefore.equalsIgnoreCase(TRUE)) {
tr = null;
}
if (tr == null) {
tr = visualDocument.createElement(HTML.TAG_TR);
if (firstRow) {
tr.setAttribute(HTML.ATTR_CLASS,
- "dr-table-firstrow rich-table-firstrow");
+ DR_TABLE_FIRSTROW_RICH_TABLE_FIRSTROW);
firstRow = false;
} else {
tr.setAttribute(HTML.ATTR_CLASS,
- "dr-table-row rich-table-row");
+ DR_TABLE_ROW_RICH_TABLE_ROW);
}
trInfo = new VpeChildrenInfo(tr);
tbody.appendChild(tr);
creationData.addChildrenInfo(trInfo);
}
trInfo.addSourceChild(child);
- } else if (child.getNodeName().endsWith(":columnGroup")) {
+ } else if (child.getNodeName().endsWith(COLUMN_GROUP)) {
RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(
creationData, (Element) child, visualDocument,
tbody);
tr = null;
- } else if (child.getNodeName().endsWith(":subTable")) {
+ } else if (child.getNodeName().endsWith(SUB_TABLE)) {
RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(
creationData, (Element) child, visualDocument,
tbody);
@@ -279,10 +298,10 @@
.createElement(HTML.TAG_CAPTION);
table.appendChild(caption);
if (captionClass != null && captionClass.length() > 0) {
- captionClass = "dr-table-caption rich-table-caption "
+ captionClass = DR_TABLE_CAPTION_RICH_TABLE_CAPTION
+ captionClass;
} else {
- captionClass = "dr-table-caption rich-table-caption";
+ captionClass = TABLE_CAPTION_RICH_TABLE_CAPTION;
}
caption.setAttribute(HTML.ATTR_CLASS, captionClass);
if (captionStyle != null && captionStyle.length() > 0) {
@@ -311,24 +330,46 @@
nsIDOMElement parentTr, nsIDOMDocument visualDocument,
ArrayList<Element> headersOrFooters, String skinCellClass,
String headerClass, String facetName, String element) {
+ String extClass = "Class"; //$NON-NLS-1$
for (Element column : headersOrFooters) {
- String classAttribute = facetName + "Class";
+ String classAttribute = facetName + extClass;
String columnHeaderClass = column.getAttribute(classAttribute);
nsIDOMElement td = visualDocument.createElement(element);
+
+ nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+ td.appendChild(table);
+ table.setAttribute(HTML.ATTR_BORDER, ZERRO);
+ table.setAttribute(HTML.ATTR_CELLPADDING, ZERRO);
+ table.setAttribute(HTML.ATTR_CELLSPACING, ZERRO);
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ nsIDOMElement trTd1 = visualDocument.createElement(HTML.TAG_TD);
+ nsIDOMElement trTd2 = visualDocument.createElement(HTML.TAG_TD);
+ table.appendChild(tr);
+ tr.appendChild(trTd1);
+ tr.appendChild(trTd2);
+
parentTr.appendChild(td);
String styleClass = encodeStyleClass(null, skinCellClass,
headerClass, columnHeaderClass);
td.setAttribute(HTML.ATTR_CLASS, styleClass);
- td.setAttribute("scop", "col");
+ td.setAttribute(SCOP, COL);
String colspan = column.getAttribute(HTML.ATTR_COLSPAN);
if (colspan != null && colspan.length() > 0) {
td.setAttribute(HTML.ATTR_COLSPAN, colspan);
}
Element facetBody = ComponentUtil.getFacet(column, facetName);
- VpeChildrenInfo child = new VpeChildrenInfo(td);
+ VpeChildrenInfo child = new VpeChildrenInfo(trTd1);
child.addSourceChild(facetBody);
creationData.addChildrenInfo(child);
+ // Add sortable attribute
+ String sortable = ComponentUtil.getAttribute(column, ATTR_SORTABLE);
+ if (sortable.equalsIgnoreCase(FALSE)) {
+ continue;
+ }
+ nsIDOMElement img = visualDocument.createElement(HTML.TAG_IMG);
+ ComponentUtil.setImg(img, SORTABLE_PATH);
+ trTd2.appendChild(img);
}
}
@@ -351,8 +392,8 @@
String skinFirstRowClass, String skinRowClass,
String skinCellClass, String facetBodyClass, String element) {
boolean isColumnGroup = facetBody.getNodeName()
- .endsWith(":columnGroup");
- boolean isSubTable = facetBody.getNodeName().endsWith(":subTable");
+ .endsWith(COLUMN_GROUP);
+ boolean isSubTable = facetBody.getNodeName().endsWith(SUB_TABLE);
if (isColumnGroup) {
RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(creationData,
facetBody, visualDocument, parentTheadOrTfood);
@@ -402,7 +443,7 @@
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if ((child instanceof Element)
- && child.getNodeName().endsWith(":column")) {
+ && child.getNodeName().endsWith(COLUMN)) {
columns.add((Element) child);
}
}
@@ -468,7 +509,7 @@
int count = 0;
// check for exact value in component
try {
- int span = Integer.parseInt(sourceElement.getAttribute("columns"));
+ int span = Integer.parseInt(sourceElement.getAttribute(COLUMNS));
count = count > 0 ? span : calculateRowColumns(sourceElement,
columns);
} catch (NumberFormatException e) {
@@ -487,7 +528,7 @@
int currentLength = 0;
for (Element column : columns) {
if (ComponentUtil.isRendered(column)) {
- if (column.getNodeName().endsWith(":columnGroup")) {
+ if (column.getNodeName().endsWith(COLUMN_GROUP)) {
// Store max calculated value of previsous rows.
if (currentLength > count) {
count = currentLength;
@@ -501,8 +542,8 @@
}
currentLength = 0;
} else if (column.getNodeName().equals(
- sourceElement.getPrefix() + ":column")) {
- String breakBeforeStr = column.getAttribute("breakBefore");
+ sourceElement.getPrefix() + COLUMN)) {
+ String breakBeforeStr = column.getAttribute(BREAK_BEFORE);
// For new row, save length of previsous.
if (Boolean.getBoolean(breakBeforeStr)) {
if (currentLength > count) {
@@ -517,7 +558,7 @@
} catch (NumberFormatException e) {
currentLength++;
}
- } else if (column.getNodeName().endsWith(":column")) {
+ } else if (column.getNodeName().endsWith(COLUMN)) {
// UIColumn always have colspan == 1.
currentLength++;
}
16 years, 5 months
JBoss Tools SVN: r10799 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-10-13 12:04:38 -0400 (Mon, 13 Oct 2008)
New Revision: 10799
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java
Log:
JBIDE-2497, creating nested items in menu and groups was updated.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2008-10-13 15:26:03 UTC (rev 10798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2008-10-13 16:04:38 UTC (rev 10799)
@@ -39,7 +39,10 @@
*/
private final static String COMPONENT_NAME = "dropDownMenu"; //$NON-NLS-1$
private final static String STYLE_PATH = "dropDownMenu/dropDownMenu.css"; //$NON-NLS-1$
+ private final static String CHILD_GROUP_NAME = ":menuGroup"; //$NON-NLS-1$
+ private final static String CHILD_ITEM_NAME = ":menuItem"; //$NON-NLS-1$
private static final String LABEL_FACET_NAME = "label"; //$NON-NLS-1$
+ private static final String DEFAULT_DDM_TITLE = "ddm"; //$NON-NLS-1$
private static final String EMPTY = ""; //$NON-NLS-1$
private static final String SPACE = " "; //$NON-NLS-1$
@@ -140,13 +143,14 @@
* Nesting elements
*/
ddmLabelDiv.appendChild(ddmTextSpan);
- ddmTextSpan.appendChild(ddmLabelText);
+// ddmTextSpan.appendChild(ddmLabelText);
// ddmLabelDiv.appendChild(ddmListDiv);
ddmListDiv.appendChild(ddmListBorderDiv);
ddmListBorderDiv.appendChild(ddmListBgDiv);
ddmMainUL.appendChild(ddmMainLI);
ddmMainLI.appendChild(ddmLabelDiv);
+
/*
* Children <ul> will be added only if there are some of them.
*/
@@ -208,30 +212,36 @@
creationData.addChildrenInfo(childrenInfo);
} else {
Attr valueAttr = sourceElement.getAttributeNode(HTML.ATTR_VALUE);
- String labelValue = valueAttr != null && valueAttr.getValue() != null
+ String labelValue = (valueAttr != null && valueAttr.getValue() != null)
? valueAttr.getValue()
- : EMPTY;
+ : DEFAULT_DDM_TITLE;
ddmLabelText.setNodeValue(labelValue);
+ ddmTextSpan.appendChild(ddmLabelText);
}
/*
- * Adding child nodes
+ * Adding child nodes:
+ * <rich:menuGroup> and <rich:menuItem> only.
*/
List<Node> children = ComponentUtil.getChildren(sourceElement);
- if (children.size() > 0) {
- /*
- * Add children <ul> and children in it.
- */
- ddmMainLI.appendChild(ddmChildrenUL);
- for (Node child : children) {
-// nsIDOMElement childDiv = visualDocument
-// .createElement(HTML.TAG_DIV);
-// ddmListBgDiv.appendChild(childDiv);
- VpeChildrenInfo childDivInfo = new VpeChildrenInfo(ddmChildrenUL);
+ boolean missingChildContainer = true;
+ for (Node child : children) {
+ if (child.getNodeType() == Node.ELEMENT_NODE
+ && (child.getNodeName().endsWith(CHILD_GROUP_NAME) || child
+ .getNodeName().endsWith(CHILD_ITEM_NAME))) {
+ if (missingChildContainer) {
+ /*
+ * Add children <ul> tag.
+ */
+ ddmMainLI.appendChild(ddmChildrenUL);
+ missingChildContainer = false;
+ }
+ VpeChildrenInfo childDivInfo = new VpeChildrenInfo(
+ ddmChildrenUL);
childDivInfo.addSourceChild(child);
creationData.addChildrenInfo(childDivInfo);
}
- }
+ }
return creationData;
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java 2008-10-13 15:26:03 UTC (rev 10798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java 2008-10-13 16:04:38 UTC (rev 10799)
@@ -37,6 +37,8 @@
private final static String COMPONENT_NAME = "menuGroup"; //$NON-NLS-1$
private final static String STYLE_PATH = "menuGroup/menuGroup.css"; //$NON-NLS-1$
private static final String SPACER_IMG_PATH = "menuGroup/spacer.gif"; //$NON-NLS-1$
+ private final static String CHILD_GROUP_NAME = ":menuGroup"; //$NON-NLS-1$
+ private final static String CHILD_ITEM_NAME = ":menuItem"; //$NON-NLS-1$
private static final String ICON_FACET_NAME = "icon"; //$NON-NLS-1$
private static final String ICON_DISABLED_FACET_NAME = "iconDisabled"; //$NON-NLS-1$
private static final String EMPTY = ""; //$NON-NLS-1$
@@ -152,6 +154,7 @@
// grFolderDiv.appendChild(grListBorderDiv);
// grListBorderDiv.appendChild(grListBgDiv);
grMainLI.appendChild(grTopDiv);
+
/*
* Children <ul> will be added only if there are some of them.
*/
@@ -248,27 +251,29 @@
}
-// String menuGroupId = (String) sourceNode.getUserData(MENU_GROUP_ID);
/*
- * Adding child nodes
+ * Adding child nodes:
+ * <rich:menuGroup> and <rich:menuItem> only.
*/
List<Node> children = ComponentUtil.getChildren(sourceElement);
- if (children.size() > 0) {
- /*
- * Add children <ul> and children in it.
- */
- grMainLI.appendChild(grChildrenUL);
- for (Node child : children) {
-// nsIDOMElement childDiv = visualDocument
-// .createElement(HTML.TAG_DIV);
-// grListBgDiv.appendChild(childDiv);
-// VpeChildrenInfo childDivInfo = new VpeChildrenInfo(childDiv);
+ boolean missingChildContainer = true;
+ for (Node child : children) {
+ if (child.getNodeType() == Node.ELEMENT_NODE
+ && (child.getNodeName().endsWith(CHILD_GROUP_NAME)
+ || child.getNodeName().endsWith(CHILD_ITEM_NAME))) {
+ if (missingChildContainer) {
+ /*
+ * Add children <ul> tag.
+ */
+ grMainLI.appendChild(grChildrenUL);
+ missingChildContainer = false;
+ }
VpeChildrenInfo childDivInfo = new VpeChildrenInfo(grChildrenUL);
childDivInfo.addSourceChild(child);
creationData.addChildrenInfo(childDivInfo);
}
}
-
+
return creationData;
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java 2008-10-13 15:26:03 UTC (rev 10798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java 2008-10-13 16:04:38 UTC (rev 10799)
@@ -128,6 +128,7 @@
itemLabelSpan.appendChild(itemLabelText);
itemMainLI.appendChild(itemTopDiv);
+
/*
* Setting attributes for the drop-down mechanism
*/
@@ -173,14 +174,6 @@
itemMainLI.setAttribute(HTML.ATTR_STYLE, topDivStyle);
/*
- * Encode label and icon value
- */
- Attr valueAttr = sourceElement.getAttributeNode(HTML.ATTR_VALUE);
- String labelValue = valueAttr != null
- && valueAttr.getValue() != null ? valueAttr.getValue() : EMPTY;
- itemLabelText.setNodeValue(labelValue);
-
- /*
* Encode icon facets
*/
Element iconFacet = ComponentUtil.getFacet(sourceElement, ICON_FACET_NAME);
@@ -209,11 +202,20 @@
itemIconImgSpan.appendChild(itemIconImg);
}
+
+ /*
+ * Encode label and icon value
+ */
+ Attr valueAttr = sourceElement.getAttributeNode(HTML.ATTR_VALUE);
+ String labelValue = (valueAttr != null && valueAttr.getValue() != null)
+ ? valueAttr.getValue()
+ : EMPTY;
+ itemLabelText.setNodeValue(labelValue);
/*
- * Adding child nodes
+ * Adding child nodes, including text nodes.
*/
- List<Node> children = ComponentUtil.getChildren(sourceElement);
+ List<Node> children = ComponentUtil.getChildren(sourceElement, true);
for (Node child : children) {
VpeChildrenInfo childInfo = new VpeChildrenInfo(itemLabelSpan);
childInfo.addSourceChild(child);
16 years, 5 months
JBoss Tools SVN: r10798 - trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-10-13 11:26:03 -0400 (Mon, 13 Oct 2008)
New Revision: 10798
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
Log:
fix project deletion for vpe tests
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2008-10-13 14:21:09 UTC (rev 10797)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2008-10-13 15:26:03 UTC (rev 10798)
@@ -31,6 +31,7 @@
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
import org.jboss.tools.tests.ImportBean;
import org.jboss.tools.vpe.editor.VpeController;
@@ -142,11 +143,17 @@
* @throws CoreException the core exception
*/
static public void removeProject(String projectName) throws CoreException {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- projectName);
- if (project != null) {
- project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
- new NullProgressMonitor());
+ boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
+ try {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+ if (project != null) {
+ project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
+ new NullProgressMonitor());
+ JobUtils.waitForIdle();
+ }
+ } finally {
+ ResourcesUtils.setBuildAutomatically(saveAutoBuild);
}
}
16 years, 5 months
JBoss Tools SVN: r10797 - trunk/documentation/guides/GettingStartedGuide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-10-13 10:21:09 -0400 (Mon, 13 Oct 2008)
New Revision: 10797
Modified:
trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-446 - adding the link to Support Portal in the Support section;
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml 2008-10-13 14:20:15 UTC (rev 10796)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml 2008-10-13 14:21:09 UTC (rev 10797)
@@ -571,6 +571,9 @@
<para>Steps to reproduce the issue</para>
</listitem>
</orderedlist>
+
+ <para><property>JBDS</property> subscribers can get necessary support on our <ulink
+ url="https://network.jboss.com/jbossnetwork/login.html">Support Portal</ulink>.</para>
</section>
16 years, 5 months
JBoss Tools SVN: r10796 - trunk/documentation/guides/GettingStartedGuide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-10-13 10:20:15 -0400 (Mon, 13 Oct 2008)
New Revision: 10796
Modified:
trunk/documentation/guides/GettingStartedGuide/en/modules/further_reading.xml
trunk/documentation/guides/GettingStartedGuide/en/modules/gsg_faq.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-446 - deleting the roles;
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/further_reading.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/further_reading.xml 2008-10-13 13:54:12 UTC (rev 10795)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/further_reading.xml 2008-10-13 14:20:15 UTC (rev 10796)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<chapter id="further_reading" xreflabel="further_reading" role="updated">
+<chapter id="further_reading" xreflabel="further_reading">
<?dbhtml filename="further_reading.html"?>
<chapterinfo>
<keywordset>
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/gsg_faq.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/gsg_faq.xml 2008-10-13 13:54:12 UTC (rev 10795)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/gsg_faq.xml 2008-10-13 14:20:15 UTC (rev 10796)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<chapter id="gsg_faq" xreflabel="gsg_faq" role="new">
+<chapter id="gsg_faq" xreflabel="gsg_faq">
<?dbhtml filename="gsg_faq.html"?>
<chapterinfo>
<keywordset>
16 years, 5 months
JBoss Tools SVN: r10795 - in trunk: documentation/guides/Exadel-migration/en/modules and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-10-13 09:54:12 -0400 (Mon, 13 Oct 2008)
New Revision: 10795
Modified:
trunk/birt/docs/en/modules/introduction.xml
trunk/documentation/guides/Exadel-migration/en/modules/introduction.xml
trunk/portlet/docs/reference/en/modules/intro.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-418
links are fixed, as well as a table column text alignment
Modified: trunk/birt/docs/en/modules/introduction.xml
===================================================================
--- trunk/birt/docs/en/modules/introduction.xml 2008-10-13 13:46:05 UTC (rev 10794)
+++ trunk/birt/docs/en/modules/introduction.xml 2008-10-13 13:54:12 UTC (rev 10795)
@@ -37,7 +37,7 @@
<para>You can find detailed information on the BIRT report types and anatomy here:</para>
<ulink url="http://www.eclipse.org/birt/phoenix/intro/">JBoss BIRT</ulink>
- <para>All JBoss Developer Studio/JBoss Tools documentation you can find <ulink url="http://www.jboss.com/products/devstudio/docs">here</ulink>.</para>
+ <para>All JBoss Developer Studio/JBoss Tools documentation you can find <ulink url="http://docs.jboss.org/tools/">here</ulink>.</para>
<para>The latest documentation builds are available <ulink url="http://download.jboss.org/jbosstools/nightly-docs/">here</ulink>.</para>
</section>
Modified: trunk/documentation/guides/Exadel-migration/en/modules/introduction.xml
===================================================================
--- trunk/documentation/guides/Exadel-migration/en/modules/introduction.xml 2008-10-13 13:46:05 UTC (rev 10794)
+++ trunk/documentation/guides/Exadel-migration/en/modules/introduction.xml 2008-10-13 13:54:12 UTC (rev 10795)
@@ -15,7 +15,7 @@
</para>
<section>
<title>Other relevant resources on the topic</title>
- <para>All JBoss Developer Studio/JBoss Tools documentation you can find <ulink url="http://www.jboss.com/products/devstudio/docs">here</ulink>.</para>
+ <para>All JBoss Developer Studio/JBoss Tools documentation you can find <ulink url="http://docs.jboss.org/tools">here</ulink>.</para>
<para>The latest documentation builds are available <ulink url="http://download.jboss.org/jbosstools/nightly-docs/">here</ulink>.</para>
</section>
Modified: trunk/portlet/docs/reference/en/modules/intro.xml
===================================================================
--- trunk/portlet/docs/reference/en/modules/intro.xml 2008-10-13 13:46:05 UTC (rev 10794)
+++ trunk/portlet/docs/reference/en/modules/intro.xml 2008-10-13 13:54:12 UTC (rev 10795)
@@ -26,7 +26,7 @@
<colspec colnum="1" align="left" colwidth="1*"/>
<colspec colnum="2" colwidth="5*"/>
- <colspec colnum="3" colwidth="1*"/>
+ <colspec colnum="3" align="left" colwidth="1*"/>
<thead>
<row>
16 years, 5 months
JBoss Tools SVN: r10794 - in trunk: jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/xpl and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-10-13 09:46:05 -0400 (Mon, 13 Oct 2008)
New Revision: 10794
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeTaglibReferenceSupport.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeTaglibValidator.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/messages.properties
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/xpl/WebUIMessages.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/plugin.xml
trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta
Log:
=JBIDE-2828, validation of taglibs was added
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/messages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/messages.properties 2008-10-13 13:42:56 UTC (rev 10793)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/messages.properties 2008-10-13 13:46:05 UTC (rev 10794)
@@ -169,3 +169,4 @@
CHECK_JVM=Check JVM
CONTEXT_ROOT_CANNOT_CONTAIN_CHARACTER=Context root cannot contain character {0}.
WEB_RESOURCES=Web Resources
+INCORRECT_URI=Incorrect URI: {0}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/xpl/WebUIMessages.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/xpl/WebUIMessages.java 2008-10-13 13:42:56 UTC (rev 10793)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/xpl/WebUIMessages.java 2008-10-13 13:46:05 UTC (rev 10794)
@@ -187,4 +187,5 @@
public static String CHECK_JVM;
public static String CONTEXT_ROOT_CANNOT_CONTAIN_CHARACTER;
public static String WEB_RESOURCES;
+ public static String INCORRECT_URI;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta 2008-10-13 13:42:56 UTC (rev 10793)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta 2008-10-13 13:46:05 UTC (rev 10794)
@@ -411,7 +411,7 @@
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeCSSReferenceSupport"
displayName="Add CSS Reference..." kind="action" name="AddItem">
<EntityData EntityName="VPEImageReference">
<AttributeData AttributeName="location"/>
@@ -421,7 +421,7 @@
</XActionItem>
<XActionItem kind="list" name="EditActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeCSSReferenceSupport"
displayName="Edit CSS Reference..." kind="action" name="EditItem">
<EntityData EntityName="VPEImageReference">
<AttributeData AttributeName="location"/>
@@ -460,7 +460,7 @@
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeCSSReferenceSupport"
displayName="Add CSS Reference..." kind="action" name="AddItem">
<EntityData EntityName="VPEImageReferenceExt">
<AttributeData AttributeName="location"/>
@@ -470,7 +470,7 @@
</XActionItem>
<XActionItem kind="list" name="EditActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeCSSReferenceSupport"
displayName="Edit CSS Reference..." kind="action" name="EditItem">
<EntityData EntityName="VPEImageReferenceExt">
<AttributeData AttributeName="location"/>
@@ -510,7 +510,7 @@
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeTaglibReferenceSupport"
displayName="Add Taglib Reference..." kind="action" name="AddItem">
<EntityData EntityName="VPETLDReference">
<AttributeData AttributeName="location"/>
@@ -521,7 +521,7 @@
</XActionItem>
<XActionItem kind="list" name="EditActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeTaglibReferenceSupport"
displayName="Edit Taglib Reference..." kind="action" name="EditItem">
<EntityData EntityName="VPETLDReference">
<AttributeData AttributeName="location"/>
@@ -561,7 +561,7 @@
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeTaglibReferenceSupport"
displayName="Add TLD Reference..." kind="action" name="AddItem">
<EntityData EntityName="VPETLDReferenceExt">
<AttributeData AttributeName="location"/>
@@ -572,7 +572,7 @@
</XActionItem>
<XActionItem kind="list" name="EditActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.VpeTaglibReferenceSupport"
displayName="Edit TLD Reference..." kind="action" name="EditItem">
<EntityData EntityName="VPETLDReferenceExt">
<AttributeData AttributeName="location"/>
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/plugin.xml 2008-10-13 13:42:56 UTC (rev 10793)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/plugin.xml 2008-10-13 13:46:05 UTC (rev 10794)
@@ -8,5 +8,7 @@
class="org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"/>
<xclass id="org.jboss.tools.vpe.resref.core.VpeCSSReferenceSupport"
class="org.jboss.tools.vpe.resref.core.VpeCSSReferenceSupport"/>
+ <xclass id="org.jboss.tools.vpe.resref.core.VpeTaglibReferenceSupport"
+ class="org.jboss.tools.vpe.resref.core.VpeTaglibReferenceSupport"/>
</extension>
</plugin>
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeTaglibReferenceSupport.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeTaglibReferenceSupport.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeTaglibReferenceSupport.java 2008-10-13 13:46:05 UTC (rev 10794)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+* Copyright (c) 2007 Red Hat, Inc.
+* Distributed under license by Red Hat, Inc. All rights reserved.
+* This program is made available under the terms of the
+* Eclipse Public License v1.0 which accompanies this distribution,
+* and is available at http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* Red Hat, Inc. - initial API and implementation
+******************************************************************************/
+package org.jboss.tools.vpe.resref.core;
+
+import org.jboss.tools.common.meta.action.impl.WizardDataValidator;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class VpeTaglibReferenceSupport extends VpeAddReferenceSupport {
+
+ private WizardDataValidator wizardDataValidator;
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.meta.action.impl.SpecialWizardSupport#getValidator(int)
+ */
+ @Override
+ public WizardDataValidator getValidator(int step) {
+
+ if(this.wizardDataValidator == null) {
+
+ wizardDataValidator = new VpeTaglibValidator(this, step);
+ }
+
+ return this.wizardDataValidator;
+ }
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeTaglibValidator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeTaglibValidator.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeTaglibValidator.java 2008-10-13 13:46:05 UTC (rev 10794)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+* Copyright (c) 2007 Red Hat, Inc.
+* Distributed under license by Red Hat, Inc. All rights reserved.
+* This program is made available under the terms of the
+* Eclipse Public License v1.0 which accompanies this distribution,
+* and is available at http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* Red Hat, Inc. - initial API and implementation
+******************************************************************************/
+package org.jboss.tools.vpe.resref.core;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Properties;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.meta.action.impl.DefaultWizardDataValidator;
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+import org.jboss.tools.jst.web.messages.xpl.WebUIMessages;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class VpeTaglibValidator extends DefaultWizardDataValidator {
+
+ /**
+ *
+ * @param support
+ * @param step
+ */
+ public VpeTaglibValidator(SpecialWizardSupport support, int step) {
+ super.setSupport(support, step);
+ }
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.meta.action.impl.DefaultWizardDataValidator#validate(java.util.Properties)
+ */
+ @Override
+ public void validate(Properties data) {
+ super.validate(data);
+ if( (getErrorMessage()!=null) ||
+ (getWarningMessage()!=null)) {
+ return;
+ }
+ String uriStr = (String) data.get("location"); //$NON-NLS-1$
+ try {
+ new URI(uriStr);
+ }catch (URISyntaxException ex) {
+ message = NLS.bind(WebUIMessages.INCORRECT_URI,uriStr);
+ }
+ }
+}
16 years, 5 months