JBoss Tools SVN: r24026 - in trunk/cdi/plugins/org.jboss.tools.cdi.ui: src/org/jboss/tools/cdi/ui and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-08-10 12:58:27 -0400 (Tue, 10 Aug 2010)
New Revision: 24026
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorCreationWizard.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorWizardPage.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewCDIAnnotationWizardPage.java
Log:
https://jira.jboss.org/browse/JBIDE-3122
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml 2010-08-10 16:31:16 UTC (rev 24025)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml 2010-08-10 16:58:27 UTC (rev 24026)
@@ -178,6 +178,19 @@
Create a Interceptor Binding Java File
</description>
</wizard>
+
+ <wizard
+ category="org.jboss.tools.cdi.ui"
+ class="org.jboss.tools.cdi.ui.wizard.NewInterceptorCreationWizard"
+ icon="icons/cdi16.png"
+ id="org.jboss.tools.cdi.ui.wizard.NewInterceptorCreationWizard"
+ name="Interceptor Type"
+ project="false">
+ <description>
+ Create an Interceptor Java File
+ </description>
+ </wizard>
+
</extension>
</plugin>
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-08-10 16:31:16 UTC (rev 24025)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-08-10 16:58:27 UTC (rev 24026)
@@ -37,6 +37,9 @@
public static String NEW_INTERCEPTOR_BINDING_WIZARD_TITLE;
public static String NEW_INTERCEPTOR_BINDING_WIZARD_PAGE_NAME;
+ public static String NEW_INTERCEPTOR_WIZARD_TITLE;
+ public static String NEW_INTERCEPTOR_WIZARD_PAGE_NAME;
+
public static String SELECT_STEREOTYPE;
public static String SELECT_INTERCEPTOR_BINDING;
@@ -45,4 +48,7 @@
public static String FIELD_EDITOR_INTERCEPTOR_BINDINGS_LABEL;
public static String FIELD_EDITOR_STEREOTYPES_LABEL;
+ public static String MESSAGE_METHOD_NAME_EMPTY;
+ public static String MESSAGE_METHOD_NAME_NOT_VALID;
+
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-08-10 16:31:16 UTC (rev 24025)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-08-10 16:58:27 UTC (rev 24026)
@@ -26,6 +26,9 @@
NEW_INTERCEPTOR_BINDING_WIZARD_TITLE=New Interceptor Binding
NEW_INTERCEPTOR_BINDING_WIZARD_PAGE_NAME=Interceptor Binding Annotation Type
+NEW_INTERCEPTOR_WIZARD_TITLE=New Interceptor
+NEW_INTERCEPTOR_WIZARD_PAGE_NAME=Interceptor Type
+
SELECT_STEREOTYPE=Select Stereotype Annotation Type
SELECT_INTERCEPTOR_BINDING=Select Interceptor Binding Annotation Type
@@ -33,3 +36,6 @@
FIELD_EDITOR_TARGET_LABEL=Target:
FIELD_EDITOR_INTERCEPTOR_BINDINGS_LABEL=Interceptor Bindings:
FIELD_EDITOR_STEREOTYPES_LABEL=Stereotypes:
+
+MESSAGE_METHOD_NAME_EMPTY=Method Name is empty.
+MESSAGE_METHOD_NAME_NOT_VALID=Method Name is not valid. {0}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewCDIAnnotationWizardPage.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewCDIAnnotationWizardPage.java 2010-08-10 16:31:16 UTC (rev 24025)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewCDIAnnotationWizardPage.java 2010-08-10 16:58:27 UTC (rev 24026)
@@ -82,7 +82,7 @@
sb.append("@Target( {" + list.toString() + "} )").append(lineDelimiter);
}
- protected void addAnnotation(String typeName, ImportsManager imports, StringBuffer sb, String lineDelimiter) {
+ static void addAnnotation(String typeName, ImportsManager imports, StringBuffer sb, String lineDelimiter) {
int i = typeName.lastIndexOf('.');
String name = typeName.substring(i + 1);
imports.addImport(typeName);
@@ -199,7 +199,7 @@
}
}
- protected ICDIProject getCDIProject(IJavaProject jp) {
+ static ICDIProject getCDIProject(IJavaProject jp) {
CDICoreNature n = getCDINatureWithProgress(jp.getProject());
return n == null ? null : n.getDelegate();
}
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorCreationWizard.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorCreationWizard.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorCreationWizard.java 2010-08-10 16:58:27 UTC (rev 24026)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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.ui.wizard;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.internal.ui.wizards.NewElementWizard;
+import org.eclipse.jdt.ui.wizards.NewClassWizardPage;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class NewInterceptorCreationWizard extends NewElementWizard {
+ private NewClassWizardPage fPage;
+ private boolean fOpenEditorOnFinish = true;
+
+
+ public NewInterceptorCreationWizard() {
+ setWindowTitle(CDIUIMessages.NEW_INTERCEPTOR_WIZARD_TITLE);
+ }
+
+ /*
+ * @see Wizard#createPages
+ */
+ public void addPages() {
+ super.addPages();
+ if (fPage == null) {
+ fPage = new NewInterceptorWizardPage();
+ fPage.init(getSelection());
+ }
+ addPage(fPage);
+ }
+
+ /*(non-Javadoc)
+ * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#canRunForked()
+ */
+ protected boolean canRunForked() {
+ return !fPage.isEnclosingTypeSelected();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#finishPage(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException {
+ fPage.createType(monitor); // use the full progress monitor
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizard#performFinish()
+ */
+ public boolean performFinish() {
+ warnAboutTypeCommentDeprecation();
+ boolean res= super.performFinish();
+ if (res) {
+ IResource resource= fPage.getModifiedResource();
+ if (resource != null) {
+ selectAndReveal(resource);
+ if (fOpenEditorOnFinish) {
+ openResource((IFile) resource);
+ }
+ }
+ }
+ return res;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#getCreatedElement()
+ */
+ public IJavaElement getCreatedElement() {
+ return fPage.getCreatedType();
+ }
+
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorCreationWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorWizardPage.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorWizardPage.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorWizardPage.java 2010-08-10 16:58:27 UTC (rev 24026)
@@ -0,0 +1,309 @@
+/*******************************************************************************
+ * 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.ui.wizard;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jdt.core.IBuffer;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.formatter.CodeFormatter;
+import org.eclipse.jdt.internal.corext.codemanipulation.AddUnimplementedConstructorsOperation;
+import org.eclipse.jdt.internal.corext.codemanipulation.AddUnimplementedMethodsOperation;
+import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings;
+import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
+import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2;
+import org.eclipse.jdt.internal.corext.dom.ASTNodes;
+import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
+import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
+import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
+import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
+import org.eclipse.jdt.internal.ui.dialogs.StatusUtil;
+import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
+import org.eclipse.jdt.ui.CodeGeneration;
+import org.eclipse.jdt.ui.PreferenceConstants;
+import org.eclipse.jdt.ui.wizards.NewClassWizardPage;
+import org.eclipse.jdt.ui.wizards.NewTypeWizardPage.ImportsManager;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.cdi.core.CDIConstants;
+import org.jboss.tools.cdi.core.CDICoreNature;
+import org.jboss.tools.cdi.core.ICDIAnnotation;
+import org.jboss.tools.cdi.core.ICDIProject;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+import org.jboss.tools.common.java.generation.JavaBeanGenerator;
+import org.jboss.tools.common.ui.widget.editor.CompositeEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
+import org.jboss.tools.common.ui.widget.editor.LabelFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.ListFieldEditor;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class NewInterceptorWizardPage extends NewClassWizardPage {
+ protected InterceptorBindingSelectionProvider interceptorBindingsProvider = new InterceptorBindingSelectionProvider();
+ protected ListFieldEditor interceptorBindings = null;
+ IFieldEditor methodName = null;
+
+ protected StatusInfo methodNameStatus = new StatusInfo();
+ protected StatusInfo interceptorBindingsStatus = new StatusInfo();
+
+ public NewInterceptorWizardPage() {
+ setTitle(CDIUIMessages.NEW_INTERCEPTOR_WIZARD_PAGE_NAME);
+ }
+
+ public void init(IStructuredSelection selection) {
+ super.init(selection);
+ }
+
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite composite= new Composite(parent, SWT.NONE);
+ composite.setFont(parent.getFont());
+
+ int nColumns= 4;
+
+ GridLayout layout= new GridLayout();
+ layout.numColumns= nColumns;
+ composite.setLayout(layout);
+
+ // pick & choose the wanted UI components
+
+ createContainerControls(composite, nColumns);
+ createPackageControls(composite, nColumns);
+// createEnclosingTypeControls(composite, nColumns);
+
+ createSeparator(composite, nColumns);
+
+ createTypeNameControls(composite, nColumns);
+// createModifierControls(composite, nColumns);
+
+ createSuperClassControls(composite, nColumns);
+// createSuperInterfacesControls(composite, nColumns);
+
+// createMethodStubSelectionControls(composite, nColumns);
+
+ createCustomFields(composite);
+
+ createCommentControls(composite, nColumns);
+ enableCommentControl(true);
+
+ setControl(composite);
+
+ Dialog.applyDialogFont(composite);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.NEW_CLASS_WIZARD_PAGE);
+
+ onInterceptorBindingChange();
+ doStatusUpdate();
+ }
+
+ protected void createTypeMembers(IType newType, final ImportsManager imports, IProgressMonitor monitor) throws CoreException {
+ createInheritedMethods(newType, true, true, imports, new SubProgressMonitor(monitor, 1));
+
+ ISourceRange range = newType.getSourceRange();
+ IBuffer buf = newType.getCompilationUnit().getBuffer();
+ String lineDelimiter = StubUtility.getLineDelimiterUsed(newType.getJavaProject());
+ StringBuffer sb = new StringBuffer();
+ addAnnotations(imports, sb, lineDelimiter);
+ buf.replace(range.getOffset(), 0, sb.toString());
+ //TODO add method
+ createAroundInvokeMethod(newType, imports, monitor, lineDelimiter);
+ }
+
+ void addAnnotations(ImportsManager imports, StringBuffer sb, String lineDelimiter) {
+ addInterceptorBindingAnnotations(imports, sb, lineDelimiter);
+ addInterceptorAnnotation(imports, sb, lineDelimiter);
+ }
+
+ protected void addInterceptorAnnotation(ImportsManager imports, StringBuffer sb, String lineDelimiter) {
+ NewCDIAnnotationWizardPage.addAnnotation(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME, imports, sb, lineDelimiter);
+ }
+
+ protected void addInterceptorBindingAnnotations(ImportsManager imports, StringBuffer sb, String lineDelimiter) {
+ if(interceptorBindings != null) {
+ List list = (List)interceptorBindings.getValue();
+ for (Object o: list) {
+ if(o instanceof ICDIAnnotation) {
+ ICDIAnnotation a = (ICDIAnnotation)o;
+ String typeName = a.getSourceType().getFullyQualifiedName();
+ NewCDIAnnotationWizardPage.addAnnotation(typeName, imports, sb, lineDelimiter);
+ }
+ }
+ }
+ }
+
+ protected void createCustomFields(Composite composite) {
+ createInterceptorBindingField(composite);
+ createMethodNameField(composite);
+ }
+
+ protected void createInterceptorBindingField(Composite composite) {
+ interceptorBindings = new ListFieldEditor("interceptorBindings", CDIUIMessages.FIELD_EDITOR_INTERCEPTOR_BINDINGS_LABEL, new ArrayList<Object>());
+ interceptorBindings.setProvider(interceptorBindingsProvider);
+ interceptorBindingsProvider.setEditorField(interceptorBindings);
+ interceptorBindings.doFillIntoGrid(composite);
+ setInterceptorBindings(getPackageFragmentRoot());
+ interceptorBindings.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ onInterceptorBindingChange();
+ doStatusUpdate();
+ }
+ });
+ }
+
+ void onInterceptorBindingChange() {
+ interceptorBindingsStatus = new StatusInfo();
+ if(((List)interceptorBindings.getValue()).isEmpty()) {
+ interceptorBindingsStatus.setWarning("Interseptor Bindings list is empty.");
+ }
+ }
+
+ protected void createMethodNameField(Composite composite) {
+ String label = "Around Invoke Method Name:";
+ methodName = IFieldEditorFactory.INSTANCE.createTextEditor("methodName", label, "manage");
+ ((CompositeEditor)methodName).addFieldEditors(new IFieldEditor[]{new LabelFieldEditor("methodName", "")});
+ methodName.doFillIntoGrid(composite);
+ methodName.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ onMethodNameChange();
+ doStatusUpdate();
+ }
+ });
+ }
+
+ void setInterceptorBindings(IPackageFragmentRoot root) {
+ interceptorBindingsProvider.setProject(null);
+ if(root != null) {
+ IJavaProject jp = root.getJavaProject();
+ ICDIProject cdi = NewCDIAnnotationWizardPage.getCDIProject(jp);
+ if(cdi != null) {
+ interceptorBindingsProvider.setProject(cdi);
+ }
+ }
+ }
+
+ void onMethodNameChange() {
+ String methodName = this.methodName.getValueAsString();
+ methodNameStatus = new StatusInfo();
+ if(methodName.length() == 0) {
+ methodNameStatus.setError(CDIUIMessages.MESSAGE_METHOD_NAME_EMPTY);
+ return;
+ }
+ IStatus val = JavaConventionsUtil.validateMethodName(methodName, null);
+ if(val != null && val.getSeverity() == IStatus.ERROR) {
+ methodNameStatus.setError(NLS.bind(CDIUIMessages.MESSAGE_METHOD_NAME_NOT_VALID, val.getMessage()));
+ }
+
+ }
+
+ protected IMethod createAroundInvokeMethod(IType type, ImportsManager imports, IProgressMonitor monitor, String lineDelimiter) throws CoreException {
+ String methodName = "" + this.methodName.getValue();
+
+ imports.addImport("javax.interceptor.InvocationContext");
+ imports.addImport("javax.interceptor.AroundInvoke");
+
+ final ICompilationUnit cu= type.getCompilationUnit();
+ JavaModelUtil.reconcile(cu);
+ CodeGenerationSettings settings = JavaPreferencesSettings.getCodeGenerationSettings(type.getJavaProject());
+ settings.createComments = isAddComments();
+ String access = "public";
+ String javatype = "Object";
+
+ String methodHeader = "@AroundInvoke" + lineDelimiter + access + " " + javatype + " " + methodName + "(InvocationContext ic) throws Exception"; //$NON-NLS-1$ //$NON-NLS-2$
+ String stub = null;
+ if(!type.isInterface()) {
+ methodHeader += " {" + lineDelimiter; //$NON-NLS-1$
+ stub = methodHeader + "}" + lineDelimiter; //$NON-NLS-1$
+ } else {
+ methodHeader += ";" + lineDelimiter; //$NON-NLS-1$
+ stub = methodHeader;
+ }
+ IMethod m = type.createMethod(stub, null, true, null);
+
+ editMethod(cu, m, methodHeader, "return null;", lineDelimiter);
+ return m;
+ }
+
+ void editMethod(ICompilationUnit cu, IMethod m, String methodHeader, String methodContent, String lineDelimiter) throws CoreException {
+ synchronized(cu) {
+ cu.reconcile(ICompilationUnit.NO_AST, true, null, null);
+ }
+ ISourceRange range = m.getSourceRange();
+ IBuffer buf = cu.getBuffer();
+ StringBuffer sb = new StringBuffer(lineDelimiter);
+ if(isAddComments()) {
+ String methodComment = CodeGeneration.getMethodComment(m, null, lineDelimiter);
+ sb.append(methodComment);
+ }
+ sb.append(methodHeader);
+ if(methodContent != null) {
+ sb.append(methodContent).append("}").append(lineDelimiter); //$NON-NLS-1$
+ }
+ String formattedContent = JavaBeanGenerator.codeFormat2(CodeFormatter.K_CLASS_BODY_DECLARATIONS, sb.toString(), 1, lineDelimiter, cu.getJavaProject());
+ if(formattedContent != null && formattedContent.startsWith("\t")) { //$NON-NLS-1$
+ formattedContent = formattedContent.substring(1);
+ }
+ buf.replace(range.getOffset(), range.getLength(), formattedContent);
+ }
+
+
+ private void doStatusUpdate() {
+ // status of all used components
+ IStatus[] status= new IStatus[] {
+ fContainerStatus,
+ isEnclosingTypeSelected() ? fEnclosingTypeStatus : fPackageStatus,
+ fTypeNameStatus,
+ fModifierStatus,
+ fSuperClassStatus,
+ fSuperInterfacesStatus
+ };
+
+ // the mode severe status will be displayed and the OK button enabled/disabled.
+ updateStatus(status);
+ }
+
+ protected void updateStatus(IStatus[] status) {
+ IStatus[] ns = new IStatus[status.length + 2];
+ System.arraycopy(status, 0, ns, 0, status.length);
+ ns[status.length] = methodNameStatus;
+ ns[status.length + 1] = interceptorBindingsStatus;
+ status = ns;
+ updateStatus(StatusUtil.getMostSevere(status));
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 5 months
JBoss Tools SVN: r24025 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2010-08-10 12:31:16 -0400 (Tue, 10 Aug 2010)
New Revision: 24025
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java
Log:
JBIDE-6211: Move jsp/jsf/xml source editing to the Eclipse 3.6
And it's subtasks:
JBIDE-6266: Support for the Categories in JBoss CA processors
JBIDE-6509: Some JBoss CA tagname proposals duplicate the WTP ones
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java 2010-08-10 15:58:55 UTC (rev 24024)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java 2010-08-10 16:31:16 UTC (rev 24025)
@@ -195,8 +195,7 @@
if (n == null)
return false;
- String existingAttributeName = ((Element)n).getAttribute(attrName);
- return (existingAttributeName != null && existingAttributeName.length() > 0);
+ return (((Element)n).getAttributeNode(attrName) != null);
} finally {
if (sModel != null) {
sModel.releaseFromRead();
15 years, 5 months
JBoss Tools SVN: r24024 - in trunk/xulrunner-1.9.1.2: features and 11 other directories.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-08-10 11:58:55 -0400 (Tue, 10 Aug 2010)
New Revision: 24024
Modified:
trunk/xulrunner-1.9.1.2/features/org.mozilla.xpcom.feature/pom.xml
trunk/xulrunner-1.9.1.2/features/org.mozilla.xulrunner.feature/pom.xml
trunk/xulrunner-1.9.1.2/features/pom.xml
trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xpcom/pom.xml
trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.carbon.macosx/pom.xml
trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.cocoa.macosx/pom.xml
trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.gtk.linux.x86/pom.xml
trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.gtk.linux.x86_64/pom.xml
trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.win32.win32.x86/pom.xml
trunk/xulrunner-1.9.1.2/plugins/pom.xml
trunk/xulrunner-1.9.1.2/pom.xml
trunk/xulrunner-1.9.1.2/site/org.mozilla.xulrunner.site/pom.xml
trunk/xulrunner-1.9.1.2/site/pom.xml
Log:
remove relativePath from pom.xml
Modified: trunk/xulrunner-1.9.1.2/features/org.mozilla.xpcom.feature/pom.xml
===================================================================
--- trunk/xulrunner-1.9.1.2/features/org.mozilla.xpcom.feature/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
+++ trunk/xulrunner-1.9.1.2/features/org.mozilla.xpcom.feature/pom.xml 2010-08-10 15:58:55 UTC (rev 24024)
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <relativePath>../../../parent-pom.xml</relativePath>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
Modified: trunk/xulrunner-1.9.1.2/features/org.mozilla.xulrunner.feature/pom.xml
===================================================================
--- trunk/xulrunner-1.9.1.2/features/org.mozilla.xulrunner.feature/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
+++ trunk/xulrunner-1.9.1.2/features/org.mozilla.xulrunner.feature/pom.xml 2010-08-10 15:58:55 UTC (rev 24024)
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <relativePath>../../../parent-pom.xml</relativePath>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
Modified: trunk/xulrunner-1.9.1.2/features/pom.xml
===================================================================
--- trunk/xulrunner-1.9.1.2/features/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
+++ trunk/xulrunner-1.9.1.2/features/pom.xml 2010-08-10 15:58:55 UTC (rev 24024)
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <relativePath>../../parent-pom.xml</relativePath>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
@@ -16,4 +15,4 @@
<module>org.mozilla.xulrunner.feature</module>
</modules>
</project>
-
\ No newline at end of file
+
Modified: trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xpcom/pom.xml
===================================================================
--- trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xpcom/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
+++ trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xpcom/pom.xml 2010-08-10 15:58:55 UTC (rev 24024)
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <relativePath>../../../parent-pom.xml</relativePath>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
Modified: trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.carbon.macosx/pom.xml
===================================================================
--- trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.carbon.macosx/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
+++ trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.carbon.macosx/pom.xml 2010-08-10 15:58:55 UTC (rev 24024)
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <relativePath>../../../parent-pom.xml</relativePath>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
Modified: trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.cocoa.macosx/pom.xml
===================================================================
--- trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.cocoa.macosx/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
+++ trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.cocoa.macosx/pom.xml 2010-08-10 15:58:55 UTC (rev 24024)
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <relativePath>../../../parent-pom.xml</relativePath>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
Modified: trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.gtk.linux.x86/pom.xml
===================================================================
--- trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.gtk.linux.x86/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
+++ trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.gtk.linux.x86/pom.xml 2010-08-10 15:58:55 UTC (rev 24024)
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <relativePath>../../../parent-pom.xml</relativePath>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
Modified: trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.gtk.linux.x86_64/pom.xml
===================================================================
--- trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.gtk.linux.x86_64/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
+++ trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.gtk.linux.x86_64/pom.xml 2010-08-10 15:58:55 UTC (rev 24024)
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <relativePath>../../../parent-pom.xml</relativePath>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
Modified: trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.win32.win32.x86/pom.xml
===================================================================
--- trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.win32.win32.x86/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
+++ trunk/xulrunner-1.9.1.2/plugins/org.mozilla.xulrunner.win32.win32.x86/pom.xml 2010-08-10 15:58:55 UTC (rev 24024)
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <relativePath>../../../parent-pom.xml</relativePath>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
Modified: trunk/xulrunner-1.9.1.2/plugins/pom.xml
===================================================================
--- trunk/xulrunner-1.9.1.2/plugins/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
+++ trunk/xulrunner-1.9.1.2/plugins/pom.xml 2010-08-10 15:58:55 UTC (rev 24024)
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <relativePath>../../parent-pom.xml</relativePath>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
@@ -20,4 +19,4 @@
<module>org.mozilla.xulrunner.win32.win32.x86</module>
</modules>
</project>
-
\ No newline at end of file
+
Modified: trunk/xulrunner-1.9.1.2/pom.xml
===================================================================
--- trunk/xulrunner-1.9.1.2/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
+++ trunk/xulrunner-1.9.1.2/pom.xml 2010-08-10 15:58:55 UTC (rev 24024)
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <relativePath>../parent-pom.xml</relativePath>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
@@ -17,4 +16,4 @@
<module>site</module>
</modules>
</project>
-
\ No newline at end of file
+
Modified: trunk/xulrunner-1.9.1.2/site/org.mozilla.xulrunner.site/pom.xml
===================================================================
--- trunk/xulrunner-1.9.1.2/site/org.mozilla.xulrunner.site/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
+++ trunk/xulrunner-1.9.1.2/site/org.mozilla.xulrunner.site/pom.xml 2010-08-10 15:58:55 UTC (rev 24024)
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <relativePath>../../../parent-pom.xml</relativePath>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
Modified: trunk/xulrunner-1.9.1.2/site/pom.xml
===================================================================
--- trunk/xulrunner-1.9.1.2/site/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
+++ trunk/xulrunner-1.9.1.2/site/pom.xml 2010-08-10 15:58:55 UTC (rev 24024)
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <relativePath>../../parent-pom.xml</relativePath>
<groupId>org.jboss.tools</groupId>
<artifactId>org.jboss.tools.parent.pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
@@ -15,4 +14,4 @@
<module>org.mozilla.xulrunner.site</module>
</modules>
</project>
-
\ No newline at end of file
+
15 years, 5 months
JBoss Tools SVN: r24023 - in trunk: build/parent and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-08-10 11:13:04 -0400 (Tue, 10 Aug 2010)
New Revision: 24023
Modified:
trunk/build/parent/pom.xml
trunk/parent-pom.xml
Log:
synch parent-pom.xml build/parent/pom.xml and update to use better XulRunner 1.9.1.2 site
Modified: trunk/build/parent/pom.xml
===================================================================
--- trunk/build/parent/pom.xml 2010-08-10 14:41:51 UTC (rev 24022)
+++ trunk/build/parent/pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
@@ -277,7 +277,7 @@
</repository>
<repository>
<id>jboss-xulrunner-1.9.1.2</id>
- <url>http://download.jboss.org/jbosstools/updates/xulrunner/
+ <url>http://download.jboss.org/jbosstools/updates/xulrunner-1.9.1.2/
</url>
<layout>p2</layout>
<snapshots>
@@ -857,16 +857,4 @@
</releases>
</pluginRepository>
</pluginRepositories>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>apache-oro</groupId>
- <artifactId>jakarta-oro</artifactId>
- <version>2.0.8</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
</project>
Modified: trunk/parent-pom.xml
===================================================================
--- trunk/parent-pom.xml 2010-08-10 14:41:51 UTC (rev 24022)
+++ trunk/parent-pom.xml 2010-08-10 15:13:04 UTC (rev 24023)
@@ -6,6 +6,9 @@
<version>0.0.1-SNAPSHOT</version>
<name>JBoss Tools Parent</name>
<packaging>pom</packaging>
+ <modules>
+ <module>build/target-platform</module>
+ </modules>
<properties>
<!-- <tychoVersion>0.10.0-SNAPSHOT</tychoVersion> -->
@@ -149,7 +152,6 @@
<activeByDefault>true</activeByDefault>
</activation>
<properties>
- <target.platform>e36-wtp32</target.platform>
</properties>
<build>
<plugins>
@@ -274,6 +276,18 @@
</releases>
</repository>
<repository>
+ <id>jboss-xulrunner-1.9.1.2</id>
+ <url>http://download.jboss.org/jbosstools/updates/xulrunner-1.9.1.2/
+ </url>
+ <layout>p2</layout>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </repository>
+ <!--repository>
<id>jboss-xulrunner-1.9.2</id>
<url>http://download.jboss.org/jbosstools/updates/xulrunner-1.9.2/
</url>
@@ -284,7 +298,7 @@
<releases>
<enabled>true</enabled>
</releases>
- </repository>
+ </repository-->
<repository>
<id>google eclipse plugins</id>
<url>http://dl.google.com/eclipse/plugin/3.6</url>
@@ -779,6 +793,24 @@
</plugins>
</build>
</profile>
+
+ <profile>
+ <id>jbosstools-nightly-trunk</id>
+ <repositories>
+ <repository>
+ <id>jbosstools-nightly-trunk</id>
+ <url>http://download.jboss.org/jbosstools/updates/nightly/trunk/</url>
+ <layout>p2</layout>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </repository>
+ </repositories>
+ </profile>
+
</profiles>
<pluginRepositories>
<pluginRepository>
15 years, 5 months
JBoss Tools SVN: r24022 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/deltacloud/ui/views and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: jjohnstn
Date: 2010-08-10 10:41:51 -0400 (Tue, 10 Aug 2010)
New Revision: 24022
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.properties
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
Log:
2010-08-09 Jeff Johnston <jjohnstn(a)redhat.com>
* src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/InstanceView.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java: New file.
* plugin.properties: Add new messages for Instances view.
* plugin.xml: Add new Instances view.
* src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties: Add column names for
Instances view. Also change menu item from Create Instance to Launch Instance.
* src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java (ProfileComposite):
Fix formatting for combo box vs spinner size.
* src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.java: Change Create Instance
messages to be Launch Instance.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-08-10 14:28:26 UTC (rev 24021)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-08-10 14:41:51 UTC (rev 24022)
@@ -1,5 +1,19 @@
2010-08-09 Jeff Johnston <jjohnstn(a)redhat.com>
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceView.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java: New file.
+ * plugin.properties: Add new messages for Instances view.
+ * plugin.xml: Add new Instances view.
+ * src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties: Add column names for
+ Instances view. Also change menu item from Create Instance to Launch Instance.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java (ProfileComposite):
+ Fix formatting for combo box vs spinner size.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.java: Change Create Instance
+ messages to be Launch Instance.
+
+2010-08-09 Jeff Johnston <jjohnstn(a)redhat.com>
+
* src/org/jboss/tools/deltacloud/ui/DeltaCloudPerspective.java: New file.
* src/org/jboss/tools/deltacloud/ui/preferences/DeltaCloudPreferencePage.java: New file.
* src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.java: New file.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.properties
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.properties 2010-08-10 14:28:26 UTC (rev 24021)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.properties 2010-08-10 14:41:51 UTC (rev 24022)
@@ -1,5 +1,7 @@
DeltaCloudCategory=Delta Cloud
CloudViewerName=Cloud Viewer
+InstanceViewer.name=Instances
+ImageViewer.name=Images
DeltaCloudPerspective.name=Delta Cloud
Preferences.name=Delta Cloud
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-08-10 14:28:26 UTC (rev 24021)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-08-10 14:41:51 UTC (rev 24022)
@@ -15,6 +15,13 @@
class="org.jboss.tools.deltacloud.ui.views.DeltaCloudView"
id="org.jboss.tools.deltacloud.ui.views.CloudView">
</view>
+ <view
+ category="org.jboss.tools.deltacloud.ui"
+ class="org.jboss.tools.deltacloud.ui.views.InstanceView"
+ icon="icons/delta.gif"
+ id="org.jboss.tools.deltacloud.ui.views.InstanceView"
+ name="%InstanceViewer.name">
+ </view>
</extension>
<extension
point="org.eclipse.help.contexts">
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties 2010-08-10 14:28:26 UTC (rev 24021)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties 2010-08-10 14:41:51 UTC (rev 24022)
@@ -16,6 +16,13 @@
CollapseAll.label=Collapse All
+CloudSelector.label=Select Cloud:
+
RemoveCloud.label=Disconnect Cloud
Refresh.label=Refresh View
-CreateInstance.label=Create Instance
\ No newline at end of file
+CreateInstance.label=Launch Instance
+
+NAME=Name
+ID=ID
+HOSTNAME=Public Hostname
+STATUS=State
\ No newline at end of file
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java 2010-08-10 14:41:51 UTC (rev 24022)
@@ -0,0 +1,51 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+
+public class InstanceComparator extends ViewerComparator {
+
+ private final static int UP = 1;
+ private final static int DOWN = -1;
+
+
+ private int column;
+ private int direction;
+
+ public InstanceComparator(int column) {
+ this.column = column;
+ this.direction = UP;
+ }
+
+ public void setColumn(int newColumn) {
+ if (column != newColumn)
+ direction = UP;
+ column = newColumn;
+ }
+
+ public int getColumn() {
+ return column;
+ }
+
+ public void reverseDirection() {
+ direction *= -1;
+ }
+
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if (!(e1 instanceof DeltaCloudInstance) || !(e2 instanceof DeltaCloudInstance))
+ return 0;
+
+ int tmp = compareByColumn(viewer, (DeltaCloudInstance)e1, (DeltaCloudInstance)e2);
+ return tmp * direction;
+ }
+
+ private int compareByColumn(Viewer viewer, DeltaCloudInstance e1, DeltaCloudInstance e2) {
+ InstanceViewLabelAndContentProvider provider = (InstanceViewLabelAndContentProvider)((TableViewer)viewer).getContentProvider();
+ String s1 = provider.getColumnText(e1, column);
+ String s2 = provider.getColumnText(e2, column);
+ return s1.compareTo(s2);
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-08-10 14:41:51 UTC (rev 24022)
@@ -0,0 +1,286 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.TreeAdapter;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+import org.jboss.tools.deltacloud.core.ICloudManagerListener;
+
+public class InstanceView extends ViewPart implements ICloudManagerListener {
+
+ private final static String CLOUD_SELECTOR_LABEL = "CloudSelector.label"; //$NON-NLS-1$
+ private TableViewer viewer;
+ private Composite container;
+ private Combo cloudSelector;
+ private DeltaCloudInstance selectedElement;
+
+ private DeltaCloud[] clouds;
+ private DeltaCloud currCloud;
+
+ private Action doubleClickAction;
+
+ public InstanceView() {
+ // TODO Auto-generated constructor stub
+ }
+
+ private ModifyListener cloudModifyListener = new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ int index = cloudSelector.getSelectionIndex();
+ currCloud = clouds[index];
+ viewer.setInput(currCloud);
+ }
+
+ };
+
+ private class ColumnListener extends SelectionAdapter {
+
+ private int column;
+ private TableViewer viewer;
+
+ public ColumnListener(int column, TableViewer viewer) {
+ this.column = column;
+ this.viewer = viewer;
+ }
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ InstanceComparator comparator = (InstanceComparator)viewer.getComparator();
+ Table t = viewer.getTable();
+ int direction = SWT.UP;
+ if (comparator.getColumn() == column) {
+ comparator.reverseDirection();
+ if (t.getSortDirection() == SWT.UP)
+ direction = SWT.DOWN;
+ }
+ comparator.setColumn(column);
+ TableColumn tc = (TableColumn)e.getSource();
+ t.setSortColumn(tc);
+ t.setSortDirection(direction);
+ viewer.refresh();
+ }
+
+ };
+
+ @Override
+ public void createPartControl(Composite parent) {
+ container = new Composite(parent, SWT.NULL);
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ container.setLayout(layout);
+
+ Label cloudSelectorLabel = new Label(container, SWT.NULL);
+ cloudSelectorLabel.setText(CVMessages.getString(CLOUD_SELECTOR_LABEL));
+
+ cloudSelector = new Combo(container, SWT.BORDER | SWT.READ_ONLY);
+ initializeCloudSelector();
+ cloudSelector.addModifyListener(cloudModifyListener);
+ // Following is a kludge so that on Linux the Combo is read-only but
+ // has a white background.
+ cloudSelector.addVerifyListener(new VerifyListener() {
+ @Override
+ public void verifyText(VerifyEvent e) {
+ e.doit = false;
+ }
+ });
+
+ Composite tableArea = new Composite(container, SWT.NULL);
+ TableColumnLayout tableLayout = new TableColumnLayout();
+ tableArea.setLayout(tableLayout);
+
+ viewer = new TableViewer(tableArea, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ Table table = viewer.getTable();
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ viewer.setContentProvider(new InstanceViewLabelAndContentProvider());
+ viewer.setLabelProvider(new InstanceViewLabelAndContentProvider());
+ InstanceComparator comparator = new InstanceComparator(0);
+ viewer.setComparator(comparator);
+
+ for (int i = 0; i < InstanceViewLabelAndContentProvider.Column.getSize(); ++i) {
+ InstanceViewLabelAndContentProvider.Column c =
+ InstanceViewLabelAndContentProvider.Column.getColumn(i);
+ TableColumn tc = new TableColumn(table, SWT.NONE);
+ if (i == 0)
+ table.setSortColumn(tc);
+ tc.setText(CVMessages.getString(c.name()));
+ tableLayout.setColumnData(tc, new ColumnWeightData(c.getWeight()));
+ tc.addSelectionListener(new ColumnListener(i, viewer));
+ }
+ table.setSortDirection(SWT.UP);
+
+ viewer.setInput(clouds[0]);
+
+ FormData f = new FormData();
+ f.top = new FormAttachment(0, 8);
+ f.left = new FormAttachment(0, 30);
+ cloudSelectorLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(0, 5);
+ f.left = new FormAttachment(cloudSelectorLabel, 5);
+ cloudSelector.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(cloudSelector, 8);
+ f.left = new FormAttachment(0, 0);
+ f.right = new FormAttachment(100, 0);
+ f.bottom = new FormAttachment(100, 0);
+ tableArea.setLayoutData(f);
+
+ // Create the help context id for the viewer's control
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "org.jboss.tools.deltacloud.ui.viewer");
+ makeActions();
+ hookContextMenu();
+ hookDoubleClickAction();
+ hookSelection();
+ contributeToActionBars();
+
+ DeltaCloudManager.getDefault().addCloudManagerListener(this);
+ }
+
+ private void hookSelection() {
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ handleSelection();
+ }
+ });
+ }
+
+ private void hookContextMenu() {
+ MenuManager menuMgr = new MenuManager("#PopupMenu");
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ InstanceView.this.fillContextMenu(manager);
+ }
+ });
+ Menu menu = menuMgr.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, viewer);
+ }
+
+ private void contributeToActionBars() {
+ IActionBars bars = getViewSite().getActionBars();
+ fillLocalPullDown(bars.getMenuManager());
+ fillLocalToolBar(bars.getToolBarManager());
+ }
+
+ private void handleSelection() {
+ IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ selectedElement = (DeltaCloudInstance)selection.getFirstElement();
+ }
+
+ private void fillLocalPullDown(IMenuManager manager) {
+ //TODO
+ }
+
+ private void fillContextMenu(IMenuManager manager) {
+ //TODO
+ // Other plug-ins can contribute there actions here
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ private void fillLocalToolBar(IToolBarManager manager) {
+ //TODO
+ }
+
+ private void makeActions() {
+ doubleClickAction = new Action() {
+ public void run() {
+ ISelection selection = viewer.getSelection();
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ showMessage("Double-click detected on "+obj.toString());
+ }
+ };
+ }
+
+ private void hookDoubleClickAction() {
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ doubleClickAction.run();
+ }
+ });
+ }
+
+ private void showMessage(String message) {
+ MessageDialog.openInformation(
+ viewer.getControl().getShell(),
+ CVMessages.getString("CloudViewName"), //$NON-NLS-1$
+ message);
+ }
+
+
+ @Override
+ public void setFocus() {
+ // TODO Auto-generated method stub
+
+ }
+
+ private void initializeCloudSelector() {
+ clouds = DeltaCloudManager.getDefault().getClouds();
+ String[] cloudNames = new String[clouds.length];
+ for (int i = 0; i < clouds.length; ++i) {
+ cloudNames[i] = clouds[i].getName();
+ }
+ cloudSelector.setItems(cloudNames);
+ cloudSelector.setText(cloudNames[0]);
+ currCloud = clouds[0];
+ }
+
+ @Override
+ public void changeEvent(int type) {
+ String currName = currCloud.getName();
+ clouds = DeltaCloudManager.getDefault().getClouds();
+ String[] cloudNames = new String[clouds.length];
+ int index = 0;
+ for (int i = 0; i < clouds.length; ++i) {
+ cloudNames[i] = clouds[i].getName();
+ if (currName.equals(cloudNames[i]))
+ index = i;
+ }
+ cloudSelector.removeModifyListener(cloudModifyListener);
+ cloudSelector.setItems(cloudNames);
+ cloudSelector.setText(cloudNames[index]);
+ cloudSelector.addModifyListener(cloudModifyListener);
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java 2010-08-10 14:41:51 UTC (rev 24022)
@@ -0,0 +1,100 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+
+public class InstanceViewLabelAndContentProvider extends BaseLabelProvider implements IStructuredContentProvider, ITableLabelProvider {
+
+ private DeltaCloud cloud;
+ private DeltaCloudInstance[] instances;
+
+ public enum Column {
+ NAME(0, 30),
+ ID(1, 20),
+ STATUS(2, 20),
+ HOSTNAME(3, 30);
+
+ private int column;
+ private int weight;
+ private static final Map<Integer,Column> lookup
+ = new HashMap<Integer,Column>();
+
+ static {
+ for(Column c : EnumSet.allOf(Column.class))
+ lookup.put(c.getColumnNumber(), c);
+ }
+
+ private Column(int column, int weight) {
+ this.column = column;
+ this.weight = weight;
+ }
+
+ public int getColumnNumber() {
+ return column;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public static Column getColumn(int number) {
+ return lookup.get(number);
+ }
+
+ public static int getSize() {
+ return lookup.size();
+ }
+
+ };
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return instances;
+ }
+
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ if (newInput != null) {
+ cloud = (DeltaCloud)newInput;
+ instances = cloud.getInstances();
+ }
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ Column c = Column.getColumn(columnIndex);
+ DeltaCloudInstance i = (DeltaCloudInstance)element;
+ switch (c) {
+ case NAME:
+ return i.getName();
+ case ID:
+ return i.getId();
+ case STATUS:
+ return i.getState();
+ case HOSTNAME:
+ return i.getHostName();
+ }
+ return "";
+ }
+
+}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java 2010-08-10 14:28:26 UTC (rev 24021)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java 2010-08-10 14:41:51 UTC (rev 24022)
@@ -43,6 +43,8 @@
private Combo storageCombo;
private int storageDecDigits;
+ private int cw = 160;
+
private ModifyListener spinnerListener = new ModifyListener() {
@Override
@@ -73,7 +75,6 @@
};
-
public ProfileComposite(DeltaCloudHardwareProfile p, Composite parent) {
this.profile = p;
container = new Composite(parent, SWT.NULL);
@@ -118,12 +119,13 @@
FormData f = new FormData();
f.width = 80;
f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
cpuSpinner.setLayoutData(f);
cpuControl = cpuSpinner;
} else if (cpuProperty.getKind() == DeltaCloudHardwareProperty.Kind.ENUM) {
cpuDefaultValue = cpuProperty.getValue();
List<String> values = cpuProperty.getEnums();
- cpuCombo = new Combo(container, SWT.READ_ONLY | SWT.BORDER);
+ cpuCombo = new Combo(container, SWT.BORDER);
String[] items = new String[values.size()];
cpuCombo.setItems(values.toArray(items));
cpuCombo.setText(items[0]);
@@ -131,6 +133,7 @@
FormData f = new FormData();
f.width = 80;
f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
cpuCombo.setLayoutData(f);
cpuControl = cpuCombo;
}
@@ -210,13 +213,14 @@
FormData f = new FormData();
f.width = 80;
f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
f.top = new FormAttachment(cpuControl, 5);
memorySpinner.setLayoutData(f);
memoryControl = memorySpinner;
} else if (memoryProperty.getKind() == DeltaCloudHardwareProperty.Kind.ENUM) {
memoryDefaultValue = memoryProperty.getValue();
List<String> values = memoryProperty.getEnums();
- memoryCombo = new Combo(container, SWT.READ_ONLY | SWT.BORDER);
+ memoryCombo = new Combo(container, SWT.BORDER | SWT.READ_ONLY);
String[] items = new String[values.size()];
memoryCombo.setItems(values.toArray(items));
memoryCombo.setText(items[0]);
@@ -224,6 +228,7 @@
FormData f = new FormData();
f.width = 80;
f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
f.top = new FormAttachment(cpuControl, 5);
memoryCombo.setLayoutData(f);
memoryControl = memoryCombo;
@@ -308,12 +313,13 @@
f.width = 80;
f.top = new FormAttachment(memoryControl, 5);
f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
storageSpinner.setLayoutData(f);
storageControl = storageSpinner;
} else if (storageProperty.getKind() == DeltaCloudHardwareProperty.Kind.ENUM) {
storageDefaultValue = storageProperty.getValue();
List<String> values = storageProperty.getEnums();
- storageCombo = new Combo(container, SWT.READ_ONLY | SWT.BORDER);
+ storageCombo = new Combo(container, SWT.BORDER | SWT.READ_ONLY);
String[] items = new String[values.size()];
storageCombo.setItems(values.toArray(items));
storageCombo.setText(items[0]);
@@ -321,6 +327,7 @@
FormData f = new FormData();
f.width = 80;
f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
f.top = new FormAttachment(memoryControl, 5);
storageCombo.setLayoutData(f);
storageControl = storageCombo;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties 2010-08-10 14:28:26 UTC (rev 24021)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties 2010-08-10 14:41:51 UTC (rev 24022)
@@ -23,12 +23,12 @@
None.response=None
Defaulted=Defaulted
-CreateInstanceError.title=Create Instance Failure
-CreateInstanceError.msg=The attempt to create instance: name={0}, image={1}, realm={2}, profile={3}
-CreateInstanceErrorReason.msg=Server did not create instance
+CreateInstanceError.title=Launch Instance Failure
+CreateInstanceError.msg=The attempt to launch instance: name={0}, image={1}, realm={2}, profile={3}
+CreateInstanceErrorReason.msg=Server did not launch instance
-ConfirmCreate.title=Confirm Create Instance
-ConfirmCreate.msg=Creating an instance will end up starting it. This may result in financial charges. Do you wish to continue?
+ConfirmCreate.title=Confirm Launch Instance
+ConfirmCreate.msg=Launching an instance may result in financial charges. Do you wish to continue?
DontShowThisAgain.msg=Don't show this dialog again
EC2UserNameLink.text=For EC2 use the <a href="https://console.aws.amazon.com/ec2/home">Access ID</a>
@@ -38,6 +38,6 @@
ErrorInvalidURL.text=URL specified is invalid
ErrorNonCloudURL.text=URL specified is not a valid Delta-cloud address
-NewInstance.desc=Specify details for a new instance you wish to create based on an image
-NewInstance.title=Create Instance
-NewInstance.name=Create Instance
\ No newline at end of file
+NewInstance.desc=Specify details for a new instance you wish to launch based on an image
+NewInstance.title=Launch Instance
+NewInstance.name=Launch Instance
\ No newline at end of file
15 years, 5 months
JBoss Tools SVN: r24021 - trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views.
by jbosstools-commits@lists.jboss.org
Author: bfitzpat
Date: 2010-08-10 10:28:26 -0400 (Tue, 10 Aug 2010)
New Revision: 24021
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java
Log:
issue JBIDE-6660: [tester] does not handle password protected services - added ability to cancel
https://jira.jboss.org/browse/JBIDE-6660
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java 2010-08-10 14:13:05 UTC (rev 24020)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java 2010-08-10 14:28:26 UTC (rev 24021)
@@ -1177,6 +1177,8 @@
if (rtnCode == Window.OK) {
tempUID = authDialog.getUID();
tempPwd = authDialog.getPwd();
+ } else {
+ return;
}
}
final String uid = tempUID;
15 years, 5 months
JBoss Tools SVN: r24020 - in trunk: common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2010-08-10 10:13:05 -0400 (Tue, 10 Aug 2010)
New Revision: 24020
Added:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ProposalSorter.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/AbstractXmlCompletionProposalComputer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsELCompletionProposalComputer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsTagCompletionProposalComputer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/JspELCompletionProposalComputer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/JspTagCompletionProposalComputer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java
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/contentassist/SortingCompoundContentAssistProcessor.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
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:
JBIDE-6211: Move jsp/jsf/xml source editing to the Eclipse 3.6
And it's subtasks:
JBIDE-6266: Support for the Categories in JBoss CA processors
JBIDE-6509: Some JBoss CA tagname proposals duplicate the WTP ones
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java 2010-08-10 14:09:52 UTC (rev 24019)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java 2010-08-10 14:13:05 UTC (rev 24020)
@@ -29,7 +29,7 @@
public static final int R_JSP_ATTRIBUTE_VALUE = 830;
public static final int R_XML_ATTRIBUTE_VALUE = 850;
public static final int R_XML_ATTRIBUTE_NAME = 910;
- public static final int R_TAG_INSERTION = 500;
+ public static final int R_TAG_INSERTION = 1210; // This value was changed from 500 to 1210 because it seems that according WTP's value was risen up to 1200 in 3.6
public static final int R_XML_ATTRIBUTE_VALUE_TEMPLATE = 91;
public static final int R_CLOSE_TAG = 1550;
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 2010-08-10 14:09:52 UTC (rev 24019)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java 2010-08-10 14:13:05 UTC (rev 24020)
@@ -13,10 +13,10 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
@@ -25,12 +25,15 @@
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
import org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML;
-import org.jboss.tools.common.text.xml.contentassist.SortingCompoundContentAssistProcessor;
+import org.eclipse.wst.xml.ui.internal.contentassist.XMLStructuredContentAssistProcessor;
+import org.jboss.tools.common.text.xml.contentassist.ProposalSorter;
/**
* @author Igels
*/
+@SuppressWarnings("restriction")
public class XMLTextViewerConfiguration extends StructuredTextViewerConfigurationXML {
SourceViewerConfiguration initial = null;
@@ -45,15 +48,30 @@
protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
- IContentAssistProcessor[] superProcessors = super.getContentAssistProcessors(
- sourceViewer, partitionType);
+// IContentAssistProcessor[] superProcessors = super.getContentAssistProcessors(
+// sourceViewer, partitionType);
+
+ IContentAssistProcessor superProcessor = new XMLStructuredContentAssistProcessor(
+ this.getContentAssistant(), partitionType, sourceViewer) {
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ protected List filterAndSortProposals(List proposals,
+ IProgressMonitor monitor,
+ CompletionProposalInvocationContext context) {
+ return ProposalSorter.filterAndSortProposals(proposals, monitor, context);
+ }
+
+ };
+
List<IContentAssistProcessor> processors = new ArrayList<IContentAssistProcessor>();
- SortingCompoundContentAssistProcessor sortingCompoundProcessor = new SortingCompoundContentAssistProcessor(sourceViewer, partitionType);
- if (sortingCompoundProcessor.supportsPartitionType(partitionType)) {
- processors.add(sortingCompoundProcessor);
- }
- processors.addAll(Arrays.asList(superProcessors));
+// SortingCompoundContentAssistProcessor sortingCompoundProcessor = new SortingCompoundContentAssistProcessor(sourceViewer, partitionType);
+// if (sortingCompoundProcessor.supportsPartitionType(partitionType)) {
+// processors.add(sortingCompoundProcessor);
+// }
+// processors.addAll(Arrays.asList(superProcessors));
+ processors.add(superProcessor);
return processors.toArray(new IContentAssistProcessor[0]);
}
@@ -92,11 +110,15 @@
return total.toArray(new IHyperlinkDetector[0]);
}
+ @SuppressWarnings("deprecation")
private IHyperlinkDetector getTextEditorsExtensionsHyperlinkDetector() {
Plugin plugin = Platform.getPlugin("org.jboss.tools.common.text.ext"); //$NON-NLS-1$
return (plugin != null && plugin instanceof IAdaptable ? (IHyperlinkDetector)((IAdaptable)plugin).getAdapter(IHyperlinkDetector.class):null);
}
-
+
+ /**
+ * @deprecated
+ */
IContentAssistProcessor[] getInitialProcessors(ISourceViewer sourceViewer, String partitionType) {
if(initial == null) return null;
//method getContentAssistProcessors() is declared in StructuredTextViewerConfiguration
@@ -118,6 +140,9 @@
return null;
}
+ /**
+ * @deprecated
+ */
@SuppressWarnings("rawtypes")
private Method findDeclaredMethod(Class cls, String name, Class[] paramTypes) {
Method[] ms = cls.getDeclaredMethods();
Added: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ProposalSorter.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ProposalSorter.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ProposalSorter.java 2010-08-10 14:13:05 UTC (rev 24020)
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Exadel, Inc. and 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:
+ * Exadel, Inc. and 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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
+import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
+import org.eclipse.wst.sse.ui.internal.contentassist.IRelevanceCompletionProposal;
+import org.eclipse.wst.sse.ui.internal.util.Sorter;
+
+/**
+ * The utility helper class which purpose is to filter out and sort
+ * Content Assist proposals
+ *
+ * @author Jeremy
+ */
+@SuppressWarnings("restriction")
+public class ProposalSorter {
+
+ /**
+ * Filters and sorts the Content Assist proposals
+ *
+ */
+ public static List<ICompletionProposal> filterAndSortProposals(List<ICompletionProposal> proposals,
+ IProgressMonitor monitor, CompletionProposalInvocationContext context) {
+ if (proposals == null)
+ return null;
+ ICompletionProposal[] resultArray = (ICompletionProposal[])proposals.toArray(new ICompletionProposal[proposals.size()]);
+ Object[] sorted = createSorter().sort(resultArray);
+ System.arraycopy(sorted, 0, resultArray, 0, sorted.length);
+ resultArray = makeUnique(resultArray);
+ return Arrays.asList(resultArray);
+ }
+
+ private static Sorter createSorter() {
+ return new Sorter() {
+ public boolean compare(Object proposal1, Object proposal2) {
+
+ int pr1 = Integer.MIN_VALUE;
+ int pr2 = Integer.MIN_VALUE;
+
+ ICompletionProposal p1 = (ICompletionProposal)proposal1;
+ ICompletionProposal p2 = (ICompletionProposal)proposal2;
+
+ if (p1 instanceof IRelevanceCompletionProposal)
+ pr1 = ((IRelevanceCompletionProposal)p1).getRelevance();
+
+ if (p2 instanceof IRelevanceCompletionProposal)
+ pr2 = ((IRelevanceCompletionProposal)p2).getRelevance();
+
+
+ if (pr1 == pr2) {
+ String str1 = (p1.getDisplayString() == null ? "" : p1.getDisplayString()); //$NON-NLS-1$
+ String str2 = (p2.getDisplayString() == null ? "" : p2.getDisplayString()); //$NON-NLS-1$
+ return str2.compareTo(str1) > 0;
+ }
+
+ return (pr1 > pr2);
+ }
+ };
+ }
+
+ /**
+ * Removes duplicates of completion strings
+ *
+ * @param suggestions a list of suggestions ({@link String}).
+ * @return a list of unique completion suggestions.
+ */
+ public static ICompletionProposal[] makeUnique(ICompletionProposal[] proposals) {
+ if (proposals == null)
+ return null;
+
+ Map <String, ICompletionProposal> existingProposals = new HashMap<String, ICompletionProposal>(proposals.length);
+ ArrayList<ICompletionProposal> unique = new ArrayList<ICompletionProposal>(proposals.length);
+
+ for (ICompletionProposal proposal : proposals) {
+ if (proposal == null)
+ continue;
+
+ String replString = null;
+ String dispString = null;
+
+ if (proposal instanceof CustomCompletionProposal) {
+ replString = ((CustomCompletionProposal) proposal)
+ .getReplacementString();
+ }
+ dispString = unQuote(proposal.getDisplayString());
+ replString = getReplacementWord(replString == null ? dispString
+ : replString);
+
+ ICompletionProposal existingProposal = existingProposals.get(replString);
+ if (existingProposal == null) {
+ existingProposals.put(replString, proposal);
+ unique.add(proposal);
+ }
+ }
+ return unique.toArray(new ICompletionProposal[unique.size()]);
+ }
+
+ private static String getReplacementWord(String replacement) {
+ replacement = (replacement == null ? "" : //$NON-NLS-1$
+ replacement);
+ int index = replacement.indexOf('>');
+ if (index != -1) {
+ replacement = replacement.substring(0, index).trim();
+ if (replacement.endsWith("/")) //$NON-NLS-1$
+ replacement = replacement
+ .substring(0, replacement.length() - 1).trim();
+ }
+ index = replacement.indexOf("="); //$NON-NLS-1$
+ if (index != -1) {
+ replacement = replacement.substring(0, index).trim();
+ }
+ index = replacement.indexOf(" "); //$NON-NLS-1$
+ if (index != -1) {
+ replacement = replacement.substring(0, index).trim();
+ }
+ return replacement;
+ }
+
+ private static String unQuote(String str) {
+ str = (str == null ?
+ "" : //$NON-NLS-1$
+ str.toLowerCase());
+ if (str.startsWith("\"")) //$NON-NLS-1$
+ str = str.substring(1);
+ if (str.endsWith("\"")) //$NON-NLS-1$
+ str = str.substring(0, str.length() - 1);
+ str = str.trim().toLowerCase();
+
+ return str;
+ }
+
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ProposalSorter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: 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 2010-08-10 14:09:52 UTC (rev 24019)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/SortingCompoundContentAssistProcessor.java 2010-08-10 14:13:05 UTC (rev 24020)
@@ -20,6 +20,7 @@
import java.util.List;
import java.util.Map;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.TextPresentation;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
@@ -30,9 +31,10 @@
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.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
import org.eclipse.wst.sse.ui.internal.contentassist.IRelevanceCompletionProposal;
import org.eclipse.wst.sse.ui.internal.util.Sorter;
@@ -44,7 +46,7 @@
* "org.jboss.tools.common.text.xml.contentAssistProcessor"
*
* @author jeremy
- *
+ * @deprecated
*/
@SuppressWarnings("restriction")
@@ -53,6 +55,8 @@
private String fPartitionType;
private String fErrorMessage;
+ static private Map <CompletionProposalInvocationContext, SortingCompoundContentAssistProcessor> fContextMap =
+ new HashMap<CompletionProposalInvocationContext, SortingCompoundContentAssistProcessor>();
private Map<String, Map<String, List<IContentAssistProcessor>>> fProcessorsMap;
@@ -62,6 +66,31 @@
init();
}
+ public static class SortingCompletionProposalInvocationContext extends CompletionProposalInvocationContext {
+ SortingCompoundContentAssistProcessor fSortingProcessor;
+
+ public SortingCompletionProposalInvocationContext(SortingCompoundContentAssistProcessor sortingProcessor, ITextViewer viewer,
+ int invocationOffset) {
+ super(viewer, invocationOffset);
+ this.fSortingProcessor = sortingProcessor;
+ }
+
+ }
+
+ /**
+ * <p>Creates the context that is passed to the completion proposal
+ * computers.</p>
+ *
+ * <p>Extenders may override this method</p>
+ *
+ * @param viewer the viewer that content assist is invoked on
+ * @param offset the content assist offset
+ * @return the context to be passed to the computers
+ */
+ protected CompletionProposalInvocationContext createContext(ITextViewer viewer, int offset) {
+ return new SortingCompletionProposalInvocationContext(this, viewer, offset);
+ }
+
public boolean supportsPartitionType(String partitionType) {
if (fProcessorsMap == null)
return false;
@@ -259,13 +288,25 @@
return resultArray;
}
+ public static List<ICompletionProposal> doFilterAndSortProposals(List proposals,
+ IProgressMonitor monitor, CompletionProposalInvocationContext context) {
+ if (proposals == null)
+ return null;
+ ICompletionProposal[] resultArray = (ICompletionProposal[])proposals.toArray(new ICompletionProposal[proposals.size()]);
+ Object[] sorted = createSorter().sort(resultArray);
+ System.arraycopy(sorted, 0, resultArray, 0, sorted.length);
+ resultArray = makeUnique(resultArray);
+ return Arrays.asList(resultArray);
+ }
+
+
/**
* Removes duplicates of completion strings
*
* @param suggestions a list of suggestions ({@link String}).
* @return a list of unique completion suggestions.
*/
- public ICompletionProposal[] makeUnique(ICompletionProposal[] proposals) {
+ public static ICompletionProposal[] makeUnique(ICompletionProposal[] proposals) {
if (proposals == null)
return null;
@@ -296,7 +337,7 @@
return unique.toArray(new ICompletionProposal[unique.size()]);
}
- private String getReplacementWord(String replacement) {
+ private static String getReplacementWord(String replacement) {
replacement = (replacement == null ? "" : //$NON-NLS-1$
replacement);
int index = replacement.indexOf('>');
@@ -317,7 +358,7 @@
return replacement;
}
- private String unQuote(String str) {
+ private static String unQuote(String str) {
str = (str == null ?
"" : //$NON-NLS-1$
str.toLowerCase());
@@ -331,7 +372,7 @@
}
- protected Sorter createSorter() {
+ protected static Sorter createSorter() {
return new Sorter() {
public boolean compare(Object proposal1, Object proposal2) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2010-08-10 14:09:52 UTC (rev 24019)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2010-08-10 14:13:05 UTC (rev 24020)
@@ -8,6 +8,7 @@
Bundle-Localization: plugin
Export-Package: org.jboss.tools.jst.jsp,
org.jboss.tools.jst.jsp.contentassist,
+ org.jboss.tools.jst.jsp.contentassist.computers,
org.jboss.tools.jst.jsp.contentassist.xpl,
org.jboss.tools.jst.jsp.drop.treeviewer.model,
org.jboss.tools.jst.jsp.drop.treeviewer.ui,
@@ -49,6 +50,7 @@
org.eclipse.jface.databinding,
org.jboss.tools.jst.web.kb,
org.eclipse.core.databinding.property;bundle-version="1.2.0",
- org.eclipse.emf.ecore;bundle-version="2.5.0"
+ org.eclipse.emf.ecore;bundle-version="2.5.0",
+ org.eclipse.wst.dtd.core
Bundle-Version: 3.2.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties 2010-08-10 14:09:52 UTC (rev 24019)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties 2010-08-10 14:13:05 UTC (rev 24020)
@@ -13,3 +13,6 @@
javaStringELHover= EL in Java String
javaStringELHoverDescription= Shows the Javadoc of the selected EL-operand.
+
+proposalCategory.xmlEL= JBoss JSF/SEAM EL Proposals
+proposalCategory.xmlTag= JBoss JSF/SEAM Tag Proposals
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2010-08-10 14:09:52 UTC (rev 24019)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2010-08-10 14:13:05 UTC (rev 24020)
@@ -508,26 +508,27 @@
//added by estherbin
//fix http://jira.jboss.com/jira/browse/JBIDE-1791
-->
- <contentAssistProcessor
+ <!-- contentAssistProcessor
class="org.eclipse.wst.css.ui.internal.contentassist.CSSContentAssistProcessor"
id="org.eclipse.wst.css.ui.internal.contentassist.CSSContentAssistProcessor">
<contenttype id="org.eclipse.wst.html.core.htmlsource">
<partitiontype id="org.eclipse.wst.css.STYLE" />
</contenttype>
- </contentAssistProcessor>
+ </contentAssistProcessor -->
<!--
// Fix for JBIDE-5068
-->
- <contentAssistProcessor
+ <!-- contentAssistProcessor
class="org.eclipse.jst.jsp.ui.internal.contentassist.JSPJavaContentAssistProcessor"
id="org.eclipse.jst.jsp.ui.internal.contentassist.JSPJavaContentAssistProcessor">
<contenttype id="org.eclipse.jst.jsp.core.jspsource">
<partitiontype id="org.eclipse.jst.jsp.SCRIPT.JAVA" />
</contenttype>
- </contentAssistProcessor>
+ </contentAssistProcessor -->
-
+ <!-- This is to be replaced by org.eclipse.wst.sse.ui.completionProposal ext. point -->
+ <!--
<contentAssistProcessor
class="org.jboss.tools.jst.jsp.contentassist.JspContentAssistProcessor"
id="org.jboss.tools.jst.jsp.contentassist.JspContentAssistProcessor">
@@ -614,7 +615,7 @@
<partitiontype id="org.eclipse.wst.css.STYLE" />
</contenttype>
</contentAssistProcessor>
-
+ -->
</extension>
<extension
point="org.eclipse.ui.popupMenus">
@@ -669,4 +670,200 @@
point="org.eclipse.core.runtime.preferences">
<initializer class="org.jboss.tools.jst.jsp.preferences.VpePreferencesInitializer"/>
</extension>
+
+ <extension
+ point="org.eclipse.wst.sse.ui.completionProposal">
+ <proposalCategory
+ icon="images/ca/icons_JSF_EL.gif"
+ id="org.jboss.tools.jst.jsp.proposalCategory.xmlEL"
+ name="%proposalCategory.xmlEL">
+ </proposalCategory>
+ <proposalComputer
+ activate="false"
+ categoryId="org.jboss.tools.jst.jsp.proposalCategory.xmlEL"
+ class="org.jboss.tools.jst.jsp.contentassist.computers.XmlELCompletionProposalComputer"
+ id="org.jboss.tools.jst.jsp.proposalComputer.xmlEL">
+ <contentType id="org.eclipse.wst.xml.core.xmlsource">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitionType id="org.eclipse.wst.xml.XML_CDATA" />
+ <partitionType id="org.eclipse.wst.xml.XML_PI" />
+ <partitionType id="org.eclipse.wst.xml.XML_DECL" />
+ <partitionType id="org.eclipse.wst.xml.XML_COMMENT" />
+ <partitionType id="org.eclipse.wst.xml.dtd.internal_subset" />
+ <partitionType id="org.eclipse.wst.sse.ST_DEFAULT" />
+ <partitionType id="org.eclipse.wst.sse.UNKNOWN_PARTITION_TYPE" />
+ </contentType>
+ <contentType id="org.jboss.tools.seam.xml.ui.pages20xmlsource">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitionType id="org.eclipse.wst.xml.XML_CDATA" />
+ <partitionType id="org.eclipse.wst.xml.XML_PI" />
+ <partitionType id="org.eclipse.wst.xml.XML_DECL" />
+ <partitionType id="org.eclipse.wst.xml.XML_COMMENT" />
+ <partitionType id="org.eclipse.wst.xml.dtd.internal_subset" />
+ <partitionType id="org.eclipse.wst.sse.ST_DEFAULT" />
+ <partitionType id="org.eclipse.wst.sse.UNKNOWN_PARTITION_TYPE" />
+ </contentType>
+ <contentType id="org.eclipse.jst.jsf.facesconfig.facesConfigFile">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitionType id="org.eclipse.wst.xml.XML_CDATA" />
+ <partitionType id="org.eclipse.wst.xml.XML_PI" />
+ <partitionType id="org.eclipse.wst.xml.XML_DECL" />
+ <partitionType id="org.eclipse.wst.xml.XML_COMMENT" />
+ <partitionType id="org.eclipse.wst.xml.dtd.internal_subset" />
+ <partitionType id="org.eclipse.wst.sse.ST_DEFAULT" />
+ <partitionType id="org.eclipse.wst.sse.UNKNOWN_PARTITION_TYPE" />
+ </contentType>
+ <contentType id="org.jboss.tools.common.model.ui.xml">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitionType id="org.eclipse.wst.xml.XML_CDATA" />
+ <partitionType id="org.eclipse.wst.xml.XML_PI" />
+ <partitionType id="org.eclipse.wst.xml.XML_DECL" />
+ <partitionType id="org.eclipse.wst.xml.XML_COMMENT" />
+ <partitionType id="org.eclipse.wst.xml.dtd.internal_subset" />
+ <partitionType id="org.eclipse.wst.sse.ST_DEFAULT" />
+ <partitionType id="org.eclipse.wst.sse.UNKNOWN_PARTITION_TYPE" />
+ </contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitionType id="org.eclipse.wst.xml.XML_CDATA" />
+ <partitionType id="org.eclipse.wst.xml.XML_PI" />
+ <partitionType id="org.eclipse.wst.xml.XML_DECL" />
+ <partitionType id="org.eclipse.wst.xml.XML_COMMENT" />
+ <partitionType id="org.eclipse.wst.xml.dtd.internal_subset" />
+ <partitionType id="org.eclipse.wst.sse.ST_DEFAULT" />
+ <partitionType id="org.eclipse.wst.sse.UNKNOWN_PARTITION_TYPE" />
+ </contentType>
+ </proposalComputer>
+ <proposalComputer
+ activate="false"
+ categoryId="org.jboss.tools.jst.jsp.proposalCategory.xmlEL"
+ class="org.jboss.tools.jst.jsp.contentassist.computers.JspELCompletionProposalComputer"
+ id="org.jboss.tools.jst.jsp.proposalComputer.jspEL">
+ <contentType id="org.eclipse.jst.jsp.core.jspsource">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitionType id="org.eclipse.wst.html.HTML_DEFAULT" />
+ <partitionType id="org.eclipse.jst.jsp.DEFAULT_JSP" />
+ <partitionType id="org.eclipse.jst.jsp.JSP_DIRECTIVE" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.DELIMITER" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" />
+ <partitionType id="org.eclipse.wst.css.STYLE" />
+ </contentType>
+ </proposalComputer>
+ <proposalComputer
+ activate="false"
+ categoryId="org.jboss.tools.jst.jsp.proposalCategory.xmlEL"
+ class="org.jboss.tools.jst.jsp.contentassist.computers.FaceletsELCompletionProposalComputer"
+ id="org.jboss.tools.jst.jsp.proposalComputer.xhtmlEL">
+ <contentType id="org.eclipse.wst.html.core.htmlsource">
+ <partitionType id="org.eclipse.wst.html.HTML_DEFAULT" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" />
+ <partitionType id="org.eclipse.wst.css.STYLE" />
+ </contentType>
+ <contentType id="jsf.facelet">
+ <partitionType id="org.eclipse.wst.html.HTML_DEFAULT" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" />
+ <partitionType id="org.eclipse.wst.css.STYLE" />
+ </contentType>
+ </proposalComputer>
+
+ <proposalCategory
+ icon="images/ca/icons_JSF_EL.gif"
+ id="org.jboss.tools.jst.jsp.proposalCategory.xmlTag"
+ name="%proposalCategory.xmlTag">
+ </proposalCategory>
+ <proposalComputer
+ activate="false"
+ categoryId="org.jboss.tools.jst.jsp.proposalCategory.xmlTag"
+ class="org.jboss.tools.jst.jsp.contentassist.computers.XmlTagCompletionProposalComputer"
+ id="org.jboss.tools.jst.jsp.proposalComputer.xmlTag">
+ <contentType id="org.eclipse.wst.xml.core.xmlsource">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitionType id="org.eclipse.wst.xml.XML_CDATA" />
+ <partitionType id="org.eclipse.wst.xml.XML_PI" />
+ <partitionType id="org.eclipse.wst.xml.XML_DECL" />
+ <partitionType id="org.eclipse.wst.xml.XML_COMMENT" />
+ <partitionType id="org.eclipse.wst.xml.dtd.internal_subset" />
+ <partitionType id="org.eclipse.wst.sse.ST_DEFAULT" />
+ <partitionType id="org.eclipse.wst.sse.UNKNOWN_PARTITION_TYPE" />
+ </contentType>
+ <contentType id="org.jboss.tools.seam.xml.ui.pages20xmlsource">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitionType id="org.eclipse.wst.xml.XML_CDATA" />
+ <partitionType id="org.eclipse.wst.xml.XML_PI" />
+ <partitionType id="org.eclipse.wst.xml.XML_DECL" />
+ <partitionType id="org.eclipse.wst.xml.XML_COMMENT" />
+ <partitionType id="org.eclipse.wst.xml.dtd.internal_subset" />
+ <partitionType id="org.eclipse.wst.sse.ST_DEFAULT" />
+ <partitionType id="org.eclipse.wst.sse.UNKNOWN_PARTITION_TYPE" />
+ </contentType>
+ <contentType id="org.eclipse.jst.jsf.facesconfig.facesConfigFile">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitionType id="org.eclipse.wst.xml.XML_CDATA" />
+ <partitionType id="org.eclipse.wst.xml.XML_PI" />
+ <partitionType id="org.eclipse.wst.xml.XML_DECL" />
+ <partitionType id="org.eclipse.wst.xml.XML_COMMENT" />
+ <partitionType id="org.eclipse.wst.xml.dtd.internal_subset" />
+ <partitionType id="org.eclipse.wst.sse.ST_DEFAULT" />
+ <partitionType id="org.eclipse.wst.sse.UNKNOWN_PARTITION_TYPE" />
+ </contentType>
+ <contentType id="org.jboss.tools.common.model.ui.xml">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitionType id="org.eclipse.wst.xml.XML_CDATA" />
+ <partitionType id="org.eclipse.wst.xml.XML_PI" />
+ <partitionType id="org.eclipse.wst.xml.XML_DECL" />
+ <partitionType id="org.eclipse.wst.xml.XML_COMMENT" />
+ <partitionType id="org.eclipse.wst.xml.dtd.internal_subset" />
+ <partitionType id="org.eclipse.wst.sse.ST_DEFAULT" />
+ <partitionType id="org.eclipse.wst.sse.UNKNOWN_PARTITION_TYPE" />
+ </contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitionType id="org.eclipse.wst.xml.XML_CDATA" />
+ <partitionType id="org.eclipse.wst.xml.XML_PI" />
+ <partitionType id="org.eclipse.wst.xml.XML_DECL" />
+ <partitionType id="org.eclipse.wst.xml.XML_COMMENT" />
+ <partitionType id="org.eclipse.wst.xml.dtd.internal_subset" />
+ <partitionType id="org.eclipse.wst.sse.ST_DEFAULT" />
+ <partitionType id="org.eclipse.wst.sse.UNKNOWN_PARTITION_TYPE" />
+ </contentType>
+ </proposalComputer>
+ <proposalComputer
+ activate="false"
+ categoryId="org.jboss.tools.jst.jsp.proposalCategory.xmlTag"
+ class="org.jboss.tools.jst.jsp.contentassist.computers.JspTagCompletionProposalComputer"
+ id="org.jboss.tools.jst.jsp.proposalComputer.jspTag">
+ <contentType id="org.eclipse.jst.jsp.core.jspsource">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitionType id="org.eclipse.wst.html.HTML_DEFAULT" />
+ <partitionType id="org.eclipse.jst.jsp.DEFAULT_JSP" />
+ <partitionType id="org.eclipse.jst.jsp.JSP_DIRECTIVE" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.DELIMITER" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" />
+ <partitionType id="org.eclipse.wst.css.STYLE" />
+ </contentType>
+ </proposalComputer>
+ <proposalComputer
+ activate="false"
+ categoryId="org.jboss.tools.jst.jsp.proposalCategory.xmlTag"
+ class="org.jboss.tools.jst.jsp.contentassist.computers.FaceletsTagCompletionProposalComputer"
+ id="org.jboss.tools.jst.jsp.proposalComputer.xhtmltag">
+ <contentType id="org.eclipse.wst.html.core.htmlsource">
+ <partitionType id="org.eclipse.wst.html.HTML_DEFAULT" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" />
+ <partitionType id="org.eclipse.wst.css.STYLE" />
+ </contentType>
+ <contentType id="jsf.facelet">
+ <partitionType id="org.eclipse.wst.html.HTML_DEFAULT" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
+ <partitionType id="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" />
+ <partitionType id="org.eclipse.wst.css.STYLE" />
+ </contentType>
+ </proposalComputer>
+ </extension>
+
</plugin>
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 2010-08-10 14:09:52 UTC (rev 24019)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java 2010-08-10 14:13:05 UTC (rev 24020)
@@ -12,7 +12,6 @@
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -20,6 +19,7 @@
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
@@ -31,15 +31,17 @@
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.wst.html.core.text.IHTMLPartitions;
import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
+import org.eclipse.wst.html.ui.internal.contentassist.HTMLStructuredContentAssistProcessor;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
import org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy;
import org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor;
import org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor;
import org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager;
+import org.jboss.tools.common.text.xml.contentassist.ProposalSorter;
import org.jboss.tools.jst.jsp.format.HTMLFormatProcessor;
import org.jboss.tools.jst.jsp.jspeditor.info.ChainTextHover;
-import org.osgi.framework.Bundle;
@SuppressWarnings("restriction")
public class HTMLTextViewerConfiguration extends
@@ -58,16 +60,28 @@
protected IContentAssistProcessor[] getContentAssistProcessors(
ISourceViewer sourceViewer, String partitionType) {
-
- IContentAssistProcessor[] superProcessors = super.getContentAssistProcessors(
- sourceViewer, partitionType);
+// IContentAssistProcessor[] superProcessors = super.getContentAssistProcessors(
+// sourceViewer, partitionType);
+ IContentAssistProcessor superProcessor = new HTMLStructuredContentAssistProcessor(
+ this.getContentAssistant(), partitionType, sourceViewer) {
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ protected List filterAndSortProposals(List proposals,
+ IProgressMonitor monitor,
+ CompletionProposalInvocationContext context) {
+ return ProposalSorter.filterAndSortProposals(proposals, monitor, context);
+ }
+
+ };
List<IContentAssistProcessor> processors = new ArrayList<IContentAssistProcessor>();
processors.addAll(
Arrays.asList(
configurationDelegate.getContentAssistProcessors(
sourceViewer,
partitionType)));
- processors.addAll(Arrays.asList(superProcessors));
+// processors.addAll(Arrays.asList(superProcessors));
+ processors.add(superProcessor);
return processors.toArray(new IContentAssistProcessor[0]);
}
@@ -101,11 +115,16 @@
return formatter;
}
+ /**
+ * @deprecated
+ */
public IContentAssistProcessor[] getContentAssistProcessorsForPartitionType(
ISourceViewer sourceViewer, String partitionType) {
// IContentAssistProcessor[] results = super.getContentAssistProcessors(
// sourceViewer, partitionType);
// added by Maksim Areshkau
+ // TODO: create a CA computer and move it to
+ // org.eclipse.wst.sse.ui.completionProposal extension point
if ("org.eclipse.wst.html.HTML_DEFAULT".equalsIgnoreCase(partitionType)) { //$NON-NLS-1$
List<IContentAssistProcessor> contAssists = getVpeTestExtensions();
return contAssists.toArray(new IContentAssistProcessor[0]);
@@ -124,7 +143,7 @@
* @param partitionType
* @return
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
private ITextHover[] createDocumentationHovers(String partitionType) {
List extendedTextHover = ExtendedConfigurationBuilder.getInstance()
.getConfigurations(
@@ -183,6 +202,8 @@
}
/**
+ * @deprecated
+ *
* Returns all extensions of {@value #VPE_TEST_EXTENTION_POINT_ID}
*/
public List<IContentAssistProcessor> getVpeTestExtensions() {
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 2010-08-10 14:09:52 UTC (rev 24019)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java 2010-08-10 14:13:05 UTC (rev 24020)
@@ -14,18 +14,23 @@
import java.util.Arrays;
import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jst.jsp.core.text.IJSPPartitions;
import org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP;
+import org.eclipse.jst.jsp.ui.internal.contentassist.JSPStructuredContentAssistProcessor;
import org.eclipse.jst.jsp.ui.internal.style.jspel.LineStyleProviderForJSPEL;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
+import org.jboss.tools.common.text.xml.contentassist.ProposalSorter;
/**
* @author Igels
*/
+@SuppressWarnings("restriction")
public class JSPTextViewerConfiguration extends StructuredTextViewerConfigurationJSP implements ITextViewerConfiguration {
private TextViewerConfigurationDelegate configurationDelegate;
@@ -78,15 +83,29 @@
}
protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
- IContentAssistProcessor[] superProcessors = super.getContentAssistProcessors(
- sourceViewer, partitionType);
+// IContentAssistProcessor[] superProcessors = super.getContentAssistProcessors(
+// sourceViewer, partitionType);
+ IContentAssistProcessor superProcessor = new JSPStructuredContentAssistProcessor(
+ this.getContentAssistant(), partitionType, sourceViewer) {
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ protected List filterAndSortProposals(List proposals,
+ IProgressMonitor monitor,
+ CompletionProposalInvocationContext context) {
+ return ProposalSorter.filterAndSortProposals(proposals, monitor, context);
+ }
+
+ };
+
List<IContentAssistProcessor> processors = new ArrayList<IContentAssistProcessor>();
processors.addAll(
Arrays.asList(
configurationDelegate.getContentAssistProcessors(
sourceViewer,
partitionType)));
- processors.addAll(Arrays.asList(superProcessors));
+// processors.addAll(Arrays.asList(superProcessors));
+ processors.add(superProcessor);
return processors.toArray(new IContentAssistProcessor[0]);
}
@@ -100,6 +119,9 @@
fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED));
}
+ /**
+ * @deprecated
+ */
public IContentAssistProcessor[] getContentAssistProcessorsForPartitionType(
ISourceViewer sourceViewer, String partitionType) {
// TODO Auto-generated method stub
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/AbstractXmlCompletionProposalComputer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/AbstractXmlCompletionProposalComputer.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/AbstractXmlCompletionProposalComputer.java 2010-08-10 14:13:05 UTC (rev 24020)
@@ -0,0 +1,682 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.contentassist.computers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
+import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.eclipse.wst.xml.ui.internal.contentassist.AbstractXMLModelQueryCompletionProposalComputer;
+import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.KbQuery;
+import org.jboss.tools.jst.web.kb.KbQuery.Type;
+import org.jboss.tools.jst.web.kb.internal.KbProject;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Abstract base class for XML proposal computers
+ *
+ * @since 3.2.0
+ * @author Jeremy
+ *
+ */
+@SuppressWarnings("restriction")
+abstract public class AbstractXmlCompletionProposalComputer extends AbstractXMLModelQueryCompletionProposalComputer {
+ protected static final ICompletionProposal[] EMPTY_PROPOSAL_LIST = new ICompletionProposal[0];
+ private static final String[] EMPTY_TAGS = new String[0];
+
+ protected CompletionProposalInvocationContext fCurrentContext;
+
+ protected ELContext fContext;
+
+ /**
+ * <p>Determine if the document is XHTML or not, then compute the proposals</p>
+ *
+ * @see org.eclipse.wst.xml.ui.internal.contentassist.AbstractXMLCompletionProposalComputer#computeCompletionProposals(org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @SuppressWarnings("rawtypes")
+ public List computeCompletionProposals(
+ CompletionProposalInvocationContext context,
+ IProgressMonitor monitor) {
+
+ this.fCurrentContext = context;
+
+ this.fContext = createContext();
+
+ IFile resource = fContext == null ? null : fContext.getResource();
+ KbProject.checkKBBuilderInstalled(resource);
+
+ //compute the completion proposals
+ return super.computeCompletionProposals(context, monitor);
+ }
+
+ /**
+ * Calculates and adds the tag proposals to the Content Assist Request object
+ *
+ * @param contentAssistRequest Content Assist Request object
+ * @param childPosition the
+ */
+
+ abstract protected void addTagInsertionProposals(
+ ContentAssistRequest contentAssistRequest, int childPosition, CompletionProposalInvocationContext context);
+
+ /**
+ * Calculates and adds the tag attribute value proposals to the Content Assist Request object
+ *
+ * @param contentAssistRequest Content Assist Request object
+ * @param childPosition the
+ */
+ abstract protected void addAttributeValueProposals(
+ ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context);
+
+ /**
+ * Creates and fulfills the <code>org.jboss.tools.common.el.core.resolver.ELContext</code>
+ * instance
+ *
+ * @return
+ */
+ abstract protected ELContext createContext();
+
+ /**
+ * Returns the <code>org.jboss.tools.jst.web.kb.KbQuery</code> instance. The prefix and URI for the tags
+ * are calculated from the current node
+ *
+ * @param type One of the <code>org.jboss.tools.jst.web.kb.KbQuery.Type</code> values
+ * @param query The value for query
+ * @param stringQuery the full text of the query value
+ *
+ * @return The <code>org.jboss.tools.jst.web.kb.KbQuery</code> instance
+ */
+ abstract protected KbQuery createKbQuery(Type type, String query, String stringQuery);
+
+ /**
+ * Returns the <code>org.jboss.tools.jst.web.kb.KbQuery</code> instance
+ *
+ * @param type One of the <code>org.jboss.tools.jst.web.kb.KbQuery.Type</code> values
+ * @param query The value for query
+ * @param prefix the prefix for the tag
+ * @param uri the URI for the tag
+ *
+ * @return The <code>org.jboss.tools.jst.web.kb.KbQuery</code> instance
+ */
+ abstract protected KbQuery createKbQuery(Type type, String query, String stringQuery, String prefix, String uri);
+
+ /* Utility functions */
+ Node findNodeForOffset(IDOMNode node, int offset) {
+ if(node == null) return null;
+ if (!node.contains(offset)) return null;
+
+ if (node.hasChildNodes()) {
+ // Try to find the node in children
+ NodeList children = node.getChildNodes();
+ for (int i = 0; children != null && i < children.getLength(); i++) {
+ IDOMNode child = (IDOMNode)children.item(i);
+ if (child.contains(offset)) {
+ return findNodeForOffset(child, offset);
+ }
+ }
+ }
+ // Not found in children or nave no children
+ if (node.hasAttributes()) {
+ // Try to find in the node attributes
+ NamedNodeMap attributes = node.getAttributes();
+
+ for (int i = 0; attributes != null && i < attributes.getLength(); i++) {
+ IDOMNode attr = (IDOMNode)attributes.item(i);
+ if (attr.contains(offset)) {
+ return attr;
+ }
+ }
+ }
+ // Return the node itself
+ return node;
+ }
+
+ Node findNodeForOffset(Node node, int offset) {
+ return (node instanceof IDOMNode) ? findNodeForOffset((IDOMNode)node, offset) : null;
+ }
+
+ /**
+ * this is the position the cursor should be in after the proposal is
+ * applied
+ *
+ * @param proposedText
+ * @return the position the cursor should be in after the proposal is
+ * applied
+ */
+ protected static int getCursorPositionForProposedText(String proposedText) {
+ int cursorAdjustment;
+ cursorAdjustment = proposedText.indexOf("\"\"") + 1; //$NON-NLS-1$
+ // otherwise, after the first tag
+ if (cursorAdjustment == 0) {
+ cursorAdjustment = proposedText.indexOf('>') + 1;
+ }
+ if (cursorAdjustment == 0) {
+ cursorAdjustment = proposedText.length();
+ }
+
+ return cursorAdjustment;
+ }
+
+ /**
+ * Returns array of the parent tags
+ *
+ * @return
+ */
+ public String[] getParentTags(boolean includeThisTag) {
+ List<String> parentTags = new ArrayList<String>();
+
+ IStructuredModel sModel = StructuredModelManager
+ .getModelManager()
+ .getExistingModelForRead(getDocument());
+ try {
+ if (sModel == null)
+ return EMPTY_TAGS;
+
+ Document xmlDocument = (sModel instanceof IDOMModel)
+ ? ((IDOMModel) sModel).getDocument()
+ : null;
+
+ if (xmlDocument == null)
+ return EMPTY_TAGS;
+
+
+ Node n = null;
+ if (includeThisTag) {
+ n = findNodeForOffset(xmlDocument, getOffset());
+ } else {
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
+ if (sdFixedRegion == null)
+ return EMPTY_TAGS;
+
+ n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
+ }
+ if (n == null)
+ return EMPTY_TAGS;
+
+ // Find the first parent tag
+ if (!(n instanceof Element)) {
+ if (n instanceof Attr) {
+ n = ((Attr) n).getOwnerElement();
+ } else {
+ n = n.getParentNode();
+ }
+ } else if (!includeThisTag) {
+ n = n.getParentNode();
+ }
+
+ // Store all the parents
+ while (n != null && n instanceof Element) {
+ String tagName = getTagName(n);
+ parentTags.add(0, tagName);
+ n = n.getParentNode();
+ }
+
+ return (String[])parentTags.toArray(new String[parentTags.size()]);
+ } finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+ }
+
+ protected String getTagName(Node tag) {
+ return tag.getNodeName();
+ }
+
+ /**
+ * Returns name of the parent attribute/tag name
+ *
+ * @return
+ */
+ protected String getParent(boolean returnAttributeName, boolean returnThisElement) {
+ IStructuredModel sModel = StructuredModelManager
+ .getModelManager()
+ .getExistingModelForRead(getDocument());
+ try {
+ if (sModel == null)
+ return null;
+
+ Document xmlDocument = (sModel instanceof IDOMModel)
+ ? ((IDOMModel) sModel).getDocument()
+ : null;
+
+ if (xmlDocument == null)
+ return null;
+
+ Node n = null;
+ if (returnAttributeName) {
+ n = findNodeForOffset(xmlDocument, getOffset());
+ } else {
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
+ if (sdFixedRegion == null)
+ return null;
+
+ n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
+ }
+
+ if (n == null)
+ return null;
+
+ // Find the first parent tag
+ if (!(n instanceof Element)) {
+ if (n instanceof Attr) {
+ if (returnAttributeName) {
+ String parentAttrName = n.getNodeName();
+ return parentAttrName;
+ }
+ n = ((Attr) n).getOwnerElement();
+ } else {
+ n = n.getParentNode();
+ }
+ } else {
+ if (!returnThisElement)
+ n = n.getParentNode();
+ }
+ if (n == null)
+ return null;
+
+ String parentTagName = getTagName(n);
+ return parentTagName;
+ } finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+ }
+
+ /**
+ * Returns URI for the current/parent tag
+ * @return
+ */
+ public String getTagPrefix() {
+ IStructuredModel sModel = StructuredModelManager
+ .getModelManager()
+ .getExistingModelForRead(getDocument());
+ try {
+ if (sModel == null)
+ return null;
+
+ Document xmlDocument = (sModel instanceof IDOMModel)
+ ? ((IDOMModel) sModel).getDocument()
+ : null;
+
+ if (xmlDocument == null)
+ return null;
+
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
+ if (sdFixedRegion == null)
+ return null;
+
+ Node n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
+ if (n == null)
+ return null;
+
+
+ if (!(n instanceof Element) && !(n instanceof Attr))
+ return null;
+
+ if (n instanceof Attr) {
+ n = ((Attr) n).getOwnerElement();
+ }
+
+ if (n == null)
+ return null;
+
+ String nodePrefix = ((Element)n).getPrefix();
+ return nodePrefix;
+ } finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+ }
+
+ /**
+ * Returns URI for the current/parent tag
+ * @return
+ */
+ abstract public String getTagUri();
+
+ /**
+ * Returns URI string for the prefix specified using the namespaces collected for
+ * the {@link IPageContext} context.
+ *
+ * @Override org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor#getUri(String)
+ */
+ abstract protected String getUri(String prefix);
+
+ /**
+ * Returns the document position where the CA is invoked
+ * @return
+ */
+ protected int getOffset() {
+ return fCurrentContext.getInvocationOffset();
+ }
+
+
+ /**
+ * Returns the document
+ *
+ * @return
+ */
+ protected IDocument getDocument() {
+ return fCurrentContext.getDocument();
+ }
+
+ /**
+ * Returns IFile resource of the document
+ *
+ * @return
+ */
+ protected IFile getResource() {
+ IStructuredModel sModel = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
+ try {
+ if (sModel != null) {
+ String baseLocation = sModel.getBaseLocation();
+ IPath location = new Path(baseLocation).makeAbsolute();
+ return FileBuffers.getWorkspaceFileAtLocation(location);
+ }
+ }
+ finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the <code>org.jboss.tools.common.el.core.resolver.ELContext</code> instance
+ *
+ * @return
+ */
+ protected ELContext getContext() {
+ return this.fContext;
+ }
+
+ /**
+ * The reason of overriding is that the method returns wrong region in case of incomplete tag (a tag with no '>'-closing char)
+ * In this case we have to return that previous incomplete tag instead of the current tag)
+ */
+ public IStructuredDocumentRegion getStructuredDocumentRegion(int pos) {
+ IStructuredDocumentRegion sdRegion = null;
+
+ int lastOffset = pos;
+ IStructuredDocument doc = (IStructuredDocument) getDocument();
+ if (doc == null)
+ return null;
+
+ do {
+ sdRegion = doc.getRegionAtCharacterOffset(lastOffset);
+ if (sdRegion != null) {
+ ITextRegion region = sdRegion.getRegionAtCharacterOffset(lastOffset);
+ if (region != null && region.getType() == DOMRegionContext.XML_TAG_OPEN &&
+ sdRegion.getStartOffset(region) == lastOffset) {
+ // The offset is at the beginning of the region
+ if ((sdRegion.getStartOffset(region) == sdRegion.getStartOffset()) && (sdRegion.getPrevious() != null) && (!sdRegion.getPrevious().isEnded())) {
+ // Is the region also the start of the node? If so, the
+ // previous IStructuredDocumentRegion is
+ // where to look for a useful region.
+// sdRegion = sdRegion.getPrevious();
+ sdRegion = null;
+ }
+ else {
+ // Is there no separating whitespace from the previous region?
+ // If not,
+ // then that region is the important one
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(lastOffset - 1);
+ if ((previousRegion != null) && (previousRegion != region) && (previousRegion.getTextLength() == previousRegion.getLength())) {
+// sdRegion = sdRegion.getPrevious();
+ sdRegion = null;
+ }
+ }
+ }
+ }
+ lastOffset--;
+ } while (sdRegion == null && lastOffset >= 0);
+ return sdRegion;
+ }
+
+ /**
+ * The reason of overriding is that the method returns wrong region in case of incomplete tag (a tag with no '>'-closing char)
+ * In this case we have to return that previous incomplete tag instead of the current tag)
+ */
+ protected ITextRegion getCompletionRegion(int documentPosition, Node domnode) {
+ if (domnode == null) {
+ return null;
+ }
+ // Get the original WTP Structured Document Region
+ IStructuredDocumentRegion sdNormalRegion = ContentAssistUtils.getStructuredDocumentRegion(fCurrentContext.getViewer(), documentPosition);
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(documentPosition);
+
+ // If original and fixed regions are different we have to replace domnode with its parent node
+ if (sdFixedRegion != null && !sdFixedRegion.equals(sdNormalRegion)) {
+ Node prevnode = domnode.getParentNode();
+ if (prevnode != null) {
+ domnode = prevnode;
+ }
+ }
+
+ return getSuperCompletionRegion(documentPosition, domnode);
+ }
+
+ /**
+ * Return the region whose content's require completion. This is something
+ * of a misnomer as sometimes the user wants to be prompted for contents
+ * of a non-existant ITextRegion, such as for enumerated attribute values
+ * following an '=' sign.
+ */
+ private ITextRegion getSuperCompletionRegion(int documentPosition, Node domnode) {
+ if (domnode == null) {
+ return null;
+ }
+
+ ITextRegion region = null;
+ int offset = documentPosition;
+ IStructuredDocumentRegion flatNode = null;
+ IDOMNode node = (IDOMNode) domnode;
+
+ if (node.getNodeType() == Node.DOCUMENT_NODE) {
+ if (node.getStructuredDocument().getLength() == 0) {
+ return null;
+ }
+ ITextRegion result = node.getStructuredDocument().getRegionAtCharacterOffset(offset).getRegionAtCharacterOffset(offset);
+ while (result == null) {
+ offset--;
+ result = node.getStructuredDocument().getRegionAtCharacterOffset(offset).getRegionAtCharacterOffset(offset);
+ }
+ return result;
+ }
+
+ IStructuredDocumentRegion startTag = node.getStartStructuredDocumentRegion();
+ IStructuredDocumentRegion endTag = node.getEndStructuredDocumentRegion();
+
+ // Determine if the offset is within the start
+ // IStructuredDocumentRegion, end IStructuredDocumentRegion, or
+ // somewhere within the Node's XML content.
+ if ((startTag != null) && (startTag.getStartOffset() <= offset) && (offset < startTag.getStartOffset() + startTag.getLength())) {
+ flatNode = startTag;
+ }
+ else if ((endTag != null) && (endTag.getStartOffset() <= offset) && (offset < endTag.getStartOffset() + endTag.getLength())) {
+ flatNode = endTag;
+ }
+
+ if (flatNode != null) {
+ // the offset is definitely within the start or end tag, continue
+ // on and find the region
+ region = getCompletionRegion(offset, flatNode);
+ }
+ else {
+ // the docPosition is neither within the start nor the end, so it
+ // must be content
+ flatNode = node.getStructuredDocument().getRegionAtCharacterOffset(offset);
+ // (pa) ITextRegion refactor
+ // if (flatNode.contains(documentPosition)) {
+ if ((flatNode.getStartOffset() <= documentPosition) && (flatNode.getEndOffset() >= documentPosition)) {
+ // we're interesting in completing/extending the previous
+ // IStructuredDocumentRegion if the current
+ // IStructuredDocumentRegion isn't plain content or if it's
+ // preceded by an orphan '<'
+ if ((offset == flatNode.getStartOffset()) &&
+ (flatNode.getPrevious() != null) &&
+ (((flatNode.getRegionAtCharacterOffset(documentPosition) != null) &&
+ (flatNode.getRegionAtCharacterOffset(documentPosition).getType() != DOMRegionContext.XML_CONTENT)) ||
+ (flatNode.getPrevious().getLastRegion().getType() == DOMRegionContext.XML_TAG_OPEN) ||
+ (flatNode.getPrevious().getLastRegion().getType() == DOMRegionContext.XML_END_TAG_OPEN))) {
+
+ // Is the region also the start of the node? If so, the
+ // previous IStructuredDocumentRegion is
+ // where to look for a useful region.
+ region = flatNode.getPrevious().getLastRegion();
+ }
+ else if (flatNode.getEndOffset() == documentPosition) {
+ region = flatNode.getLastRegion();
+ }
+ else {
+ region = flatNode.getFirstRegion();
+ }
+ }
+ else {
+ // catch end of document positions where the docPosition isn't
+ // in a IStructuredDocumentRegion
+ region = flatNode.getLastRegion();
+ }
+ }
+
+ return region;
+ }
+
+
+ protected ITextRegion getCompletionRegion(int offset, IStructuredDocumentRegion sdRegion) {
+ ITextRegion region = getSuperCompletionRegion(offset, sdRegion);
+ if (region != null && region.getType() == DOMRegionContext.UNDEFINED) {
+ // FIX: JBIDE-2332 CA with proposal list for comonent's atributes doesn't work before double quotes.
+ // Sometimes, especially if we have a broken XML node, the region returned has UNDEFINED type.
+ // If so, we're try to use the prevoius region, which probably will be the region of type XML_TAG_NAME.
+
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(offset - 1);
+ if ((previousRegion != null) && (previousRegion != region) && (previousRegion.getTextLength() < previousRegion.getLength())) {
+ region = previousRegion;
+ }
+ }
+ return region;
+ }
+
+ private ITextRegion getSuperCompletionRegion(int offset, IStructuredDocumentRegion sdRegion) {
+ ITextRegion region = sdRegion.getRegionAtCharacterOffset(offset);
+ if (region == null) {
+ return null;
+ }
+
+ if (sdRegion.getStartOffset(region) == offset) {
+ // The offset is at the beginning of the region
+ if ((sdRegion.getStartOffset(region) == sdRegion.getStartOffset()) && (sdRegion.getPrevious() != null) && (!sdRegion.getPrevious().isEnded())) {
+ // Is the region also the start of the node? If so, the
+ // previous IStructuredDocumentRegion is
+ // where to look for a useful region.
+ region = sdRegion.getPrevious().getRegionAtCharacterOffset(offset - 1);
+ }
+ else {
+ // Is there no separating whitespace from the previous region?
+ // If not,
+ // then that region is the important one
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(offset - 1);
+ if ((previousRegion != null) && (previousRegion != region) && (previousRegion.getTextLength() == previousRegion.getLength())) {
+ region = previousRegion;
+ }
+ }
+ }
+ else {
+ // The offset is NOT at the beginning of the region
+ if (offset > sdRegion.getStartOffset(region) + region.getTextLength()) {
+ // Is the offset within the whitespace after the text in this
+ // region?
+ // If so, use the next region
+ ITextRegion nextRegion = sdRegion.getRegionAtCharacterOffset(sdRegion.getStartOffset(region) + region.getLength());
+ if (nextRegion != null) {
+ region = nextRegion;
+ }
+ }
+ else {
+ // Is the offset within the important text for this region?
+ // If so, then we've already got the right one.
+ }
+ }
+
+ // valid WHITE_SPACE region handler (#179924)
+ if ((region != null) && (region.getType() == DOMRegionContext.WHITE_SPACE)) {
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(sdRegion.getStartOffset(region) - 1);
+ if (previousRegion != null) {
+ region = previousRegion;
+ }
+ }
+
+ return region;
+ }
+
+
+
+ /**
+ * Calculates and adds the tag name proposals to the Content Assist Request object
+ *
+ * @param contentAssistRequest
+ * @param childPosition
+ */
+ abstract protected void addTagNameProposals(ContentAssistRequest contentAssistRequest, int childPosition,
+ CompletionProposalInvocationContext context);
+
+
+ /**
+ * Calculates and adds the EL proposals in attribute value to the Content Assist Request object
+ *
+ * @param contentAssistRequest
+ */
+ abstract protected void addAttributeValueELProposals(ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context);
+
+ /**
+ * Calculates and adds the EL proposals in text to the Content Assist Request object
+ *
+ * @param contentAssistRequest
+ */
+ abstract protected void addTextELProposals(ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context);
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/AbstractXmlCompletionProposalComputer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsELCompletionProposalComputer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsELCompletionProposalComputer.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsELCompletionProposalComputer.java 2010-08-10 14:13:05 UTC (rev 24020)
@@ -0,0 +1,266 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.contentassist.computers;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.html.core.internal.contentmodel.HTMLCMDocument;
+import org.eclipse.wst.html.core.internal.provisional.HTMLCMProperties;
+import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
+import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.ssemodelquery.ModelQueryAdapter;
+import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
+import org.jboss.tools.common.el.core.ca.ELTextProposal;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor.TextRegion;
+import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
+import org.jboss.tools.jst.jsp.contentassist.AutoELContentAssistantProposal;
+import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+import org.jboss.tools.jst.web.kb.IFaceletPageContext;
+import org.jboss.tools.jst.web.kb.KbQuery;
+import org.jboss.tools.jst.web.kb.KbQuery.Type;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.jboss.tools.jst.web.kb.PageProcessor;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * EL Proposal computer for XHTML pages
+ *
+ * @author Jeremy
+ *
+ */
+@SuppressWarnings("restriction")
+public class FaceletsELCompletionProposalComputer extends JspELCompletionProposalComputer {
+ private static final String JSFC_ATTRIBUTE_NAME = "jsfc"; //$NON-NLS-1$
+ private boolean replaceJsfcTags;
+
+ /** <code>true</code> if the document the proposal request is on is XHTML */
+ protected boolean isXHTML = false;
+
+ /**
+ * <p>Determine if the document is XHTML or not, then compute the proposals</p>
+ * @TODO: move the XHTML determination to XHTML computer
+ *
+ * @see org.eclipse.wst.xml.ui.internal.contentassist.AbstractXMLCompletionProposalComputer#computeCompletionProposals(org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @SuppressWarnings("rawtypes")
+ public List computeCompletionProposals(
+ CompletionProposalInvocationContext context,
+ IProgressMonitor monitor) {
+
+ try {
+ //determine if the content is XHTML or not
+ IndexedRegion treeNode = ContentAssistUtils.getNodeAt(context.getViewer(),
+ context.getInvocationOffset());
+ IDOMNode node = (IDOMNode) treeNode;
+ boolean isXHTMLNode = isXHTMLNode(node);
+ if(this.isXHTML != isXHTMLNode) {
+ this.isXHTML = isXHTMLNode;
+ }
+
+ //compute the completion proposals
+ return super.computeCompletionProposals(context, monitor);
+ } finally {
+ fCurrentContext = null;
+ }
+ }
+
+ /**
+ * Determine if this Document is an XHTML Document. Operates solely off of
+ * the Document Type declaration
+ */
+ @SuppressWarnings("deprecation")
+ private static boolean isXHTMLNode(Node node) {
+ if (node == null) {
+ return false;
+ }
+
+ Document doc = null;
+ if (node.getNodeType() != Node.DOCUMENT_NODE)
+ doc = node.getOwnerDocument();
+ else
+ doc = ((Document) node);
+
+ if (doc instanceof IDOMDocument) {
+ return ((IDOMDocument) doc).isXMLType();
+ }
+
+ if (doc instanceof INodeNotifier) {
+ ModelQueryAdapter adapter = (ModelQueryAdapter) ((INodeNotifier) doc).getAdapterFor(ModelQueryAdapter.class);
+ CMDocument cmdoc = null;
+ if (adapter != null && adapter.getModelQuery() != null)
+ cmdoc = adapter.getModelQuery().getCorrespondingCMDocument(doc);
+ if (cmdoc != null) {
+ // treat as XHTML unless we've got the in-code HTML content
+ // model
+ if (cmdoc instanceof HTMLCMDocument)
+ return false;
+ if (cmdoc.supports(HTMLCMProperties.IS_XHTML))
+ return Boolean.TRUE.equals(cmdoc.getProperty(HTMLCMProperties.IS_XHTML));
+ }
+ }
+ // this should never be reached
+ DocumentType docType = doc.getDoctype();
+ return docType != null && docType.getPublicId() != null && docType.getPublicId().indexOf("-//W3C//DTD XHTML ") == 0; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor#createContext()
+ */
+ @Override
+ protected ELContext createContext() {
+ return PageContextFactory.createPageContext(getResource(), PageContextFactory.FACELETS_PAGE_CONTEXT_TYPE);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.JspContentAssistProcessor#getContext()
+ */
+ @Override
+ public IFaceletPageContext getContext() {
+ return (IFaceletPageContext)super.getContext();
+ }
+
+ @Override
+ protected void addTagInsertionProposals(
+ ContentAssistRequest contentAssistRequest, int childPosition, CompletionProposalInvocationContext context) {
+
+ // Need to check if an EL Expression is opened here.
+ // If it is true we don't need to start any new tag proposals
+ TextRegion prefix = getELPrefix(contentAssistRequest);
+ if (prefix != null && !prefix.isELStarted()) {
+ return;
+ }
+
+ addELPredicateProposals(contentAssistRequest, TextProposal.R_TAG_INSERTION, true);
+ }
+
+ @Override
+ protected void addTextELProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context) {
+ if (!isELCAToBeShown())
+ return;
+
+ TextRegion prefix = getELPrefix(contentAssistRequest);
+ if (prefix == null || !prefix.isELStarted()) {
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true, "#{}", //$NON-NLS-1$
+ contentAssistRequest.getReplacementBeginPosition(),
+ 0, 2, JSF_EL_PROPOSAL_IMAGE, JstUIMessages.JspContentAssistProcessor_NewELExpression, null,
+ JstUIMessages.FaceletPageContectAssistProcessor_NewELExpressionTextInfo, TextProposal.R_TAG_INSERTION + 1);
+
+ contentAssistRequest.addProposal(proposal);
+ return;
+ }
+ String matchString = "#{" + prefix.getText(); //$NON-NLS-1$
+ String query = matchString;
+ String stringQuery = matchString;
+
+ int beginChangeOffset = prefix.getStartOffset() + prefix.getOffset();
+
+ KbQuery kbQuery = createKbQuery(Type.TEXT, query, stringQuery);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+ if (proposals == null || proposals.length == 0)
+ return;
+
+ for (TextProposal textProposal : proposals) {
+ int replacementOffset = beginChangeOffset;
+ int replacementLength = prefix.getLength();
+ String replacementString = prefix.getText().substring(0, replacementLength) + textProposal.getReplacementString();
+ int cursorPosition = replacementString.length();
+
+ if (!prefix.isELClosed()) {
+ replacementString += "}"; //$NON-NLS-1$
+ }
+
+ Image image = textProposal.getImage();
+
+ // JBIDE-512, JBIDE-2541 related changes ===>>>
+// String displayString = prefix.getText().substring(0, replacementLength) + textProposal.getReplacementString();
+ String displayString = textProposal.getLabel();
+ if (displayString == null)
+ displayString = textProposal.getReplacementString() == null ? replacementString : textProposal.getReplacementString();
+
+ // <<<=== JBIDE-512, JBIDE-2541 related changes
+ int relevance = textProposal.getRelevance();
+ if (relevance == TextProposal.R_NONE) {
+ relevance = TextProposal.R_JSP_JSF_EL_VARIABLE_ATTRIBUTE_VALUE;
+ }
+
+ AutoContentAssistantProposal proposal = null;
+ if (textProposal instanceof ELTextProposal) {
+ IJavaElement[] javaElements = ((ELTextProposal)textProposal).getAllJavaElements();
+
+ proposal = new AutoELContentAssistantProposal(replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ null, javaElements, relevance);
+ } else {
+ String additionalProposalInfo = (textProposal.getContextInfo() == null ? "" : textProposal.getContextInfo()); //$NON-NLS-1$
+
+ proposal = new AutoContentAssistantProposal(replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ null, additionalProposalInfo, relevance);
+ }
+
+ contentAssistRequest.addProposal(proposal);
+ }
+
+ if (prefix.isELStarted() && !prefix.isELClosed()) {
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal("}", //$NON-NLS-1$
+ getOffset(), 0, 1, JSF_EL_PROPOSAL_IMAGE, JstUIMessages.JspContentAssistProcessor_CloseELExpression,
+ null, JstUIMessages.JspContentAssistProcessor_CloseELExpressionInfo, TextProposal.R_XML_ATTRIBUTE_VALUE_TEMPLATE);
+
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+
+ @Override
+ protected String getTagName(Node tag) {
+ String tagName = tag.getNodeName();
+ if(replaceJsfcTags) {
+ // Only HTML tags
+ if(tagName.indexOf(':')>0) {
+ return tagName;
+ }
+ if (!(tag instanceof Element))
+ return tagName;
+
+ Element element = (Element)tag;
+
+ NamedNodeMap attributes = element.getAttributes();
+ Node jsfC = attributes.getNamedItem(JSFC_ATTRIBUTE_NAME);
+ if(jsfC==null || (!(jsfC instanceof Attr))) {
+ return tagName;
+ }
+ Attr jsfCAttribute = (Attr)jsfC;
+ String jsfTagName = jsfCAttribute.getValue();
+ if(jsfTagName==null || jsfTagName.indexOf(':')<1) {
+ return tagName;
+ }
+ tagName = jsfTagName;
+ }
+ return tagName;
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsELCompletionProposalComputer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsTagCompletionProposalComputer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsTagCompletionProposalComputer.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsTagCompletionProposalComputer.java 2010-08-10 14:13:05 UTC (rev 24020)
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.contentassist.computers;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.html.core.internal.contentmodel.HTMLCMDocument;
+import org.eclipse.wst.html.core.internal.provisional.HTMLCMProperties;
+import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
+import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.ssemodelquery.ModelQueryAdapter;
+import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.jst.web.kb.IFaceletPageContext;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * Tag Proposal computer for XHTML pages
+ *
+ * @author Jeremy
+ *
+ */
+@SuppressWarnings("restriction")
+public class FaceletsTagCompletionProposalComputer extends JspTagCompletionProposalComputer {
+ private static final String JSFC_ATTRIBUTE_NAME = "jsfc"; //$NON-NLS-1$
+ private boolean replaceJsfcTags;
+
+ /** <code>true</code> if the document the proposal request is on is XHTML */
+ protected boolean isXHTML = false;
+
+ /**
+ * <p>Determine if the document is XHTML or not, then compute the proposals</p>
+ * @TODO: move the XHTML determination to XHTML computer
+ *
+ * @see org.eclipse.wst.xml.ui.internal.contentassist.AbstractXMLCompletionProposalComputer#computeCompletionProposals(org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @SuppressWarnings("rawtypes")
+ public List computeCompletionProposals(
+ CompletionProposalInvocationContext context,
+ IProgressMonitor monitor) {
+
+ try {
+ //determine if the content is XHTML or not
+ IndexedRegion treeNode = ContentAssistUtils.getNodeAt(context.getViewer(),
+ context.getInvocationOffset());
+ IDOMNode node = (IDOMNode) treeNode;
+ boolean isXHTMLNode = isXHTMLNode(node);
+ if(this.isXHTML != isXHTMLNode) {
+ this.isXHTML = isXHTMLNode;
+ }
+
+ //compute the completion proposals
+ return super.computeCompletionProposals(context, monitor);
+ } finally {
+ fCurrentContext = null;
+ }
+ }
+
+ /**
+ * Determine if this Document is an XHTML Document. Operates solely off of
+ * the Document Type declaration
+ */
+ @SuppressWarnings("deprecation")
+ private static boolean isXHTMLNode(Node node) {
+ if (node == null) {
+ return false;
+ }
+
+ Document doc = null;
+ if (node.getNodeType() != Node.DOCUMENT_NODE)
+ doc = node.getOwnerDocument();
+ else
+ doc = ((Document) node);
+
+ if (doc instanceof IDOMDocument) {
+ return ((IDOMDocument) doc).isXMLType();
+ }
+
+ if (doc instanceof INodeNotifier) {
+ ModelQueryAdapter adapter = (ModelQueryAdapter) ((INodeNotifier) doc).getAdapterFor(ModelQueryAdapter.class);
+ CMDocument cmdoc = null;
+ if (adapter != null && adapter.getModelQuery() != null)
+ cmdoc = adapter.getModelQuery().getCorrespondingCMDocument(doc);
+ if (cmdoc != null) {
+ // treat as XHTML unless we've got the in-code HTML content
+ // model
+ if (cmdoc instanceof HTMLCMDocument)
+ return false;
+ if (cmdoc.supports(HTMLCMProperties.IS_XHTML))
+ return Boolean.TRUE.equals(cmdoc.getProperty(HTMLCMProperties.IS_XHTML));
+ }
+ }
+ // this should never be reached
+ DocumentType docType = doc.getDoctype();
+ return docType != null && docType.getPublicId() != null && docType.getPublicId().indexOf("-//W3C//DTD XHTML ") == 0; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor#createContext()
+ */
+ @Override
+ protected ELContext createContext() {
+ return PageContextFactory.createPageContext(getResource(), PageContextFactory.FACELETS_PAGE_CONTEXT_TYPE);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.JspContentAssistProcessor#getContext()
+ */
+ @Override
+ public IFaceletPageContext getContext() {
+ return (IFaceletPageContext)super.getContext();
+ }
+
+ /**
+ * Calculates and adds the tag proposals to the Content Assist Request object
+ * The method is to be overridden here because xhtml allows to use EL-s inside a text region
+ *
+ * @param contentAssistRequest Content Assist Request object
+ * @param childPosition the
+ */
+
+ @Override
+ protected void addTagInsertionProposals(
+ ContentAssistRequest contentAssistRequest, int childPosition,
+ CompletionProposalInvocationContext context) {
+
+ // Need to check if an EL Expression is opened here.
+ // If it is true we don't need to start any new tag proposals
+ TextRegion prefix = getELPrefix(contentAssistRequest);
+ if (prefix != null && prefix.isELStarted()) {
+ return;
+ }
+
+ addTagNameProposals(contentAssistRequest, childPosition, true, context);
+ }
+
+ /**
+ * Calculates and adds the EL proposals to the Content Assist Request object
+ */
+ @Override
+ protected void addTextELProposals(ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context) {
+ // No EL proposals are to be added here
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.JspContentAssistProcessor#addAttributeNameProposals(org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest)
+ */
+ @Override
+ protected void addAttributeNameProposals(
+ ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context) {
+ super.addAttributeNameProposals(contentAssistRequest, context);
+ if (isExistingAttribute(JSFC_ATTRIBUTE_NAME)) {
+ this.replaceJsfcTags = true;
+ super.addAttributeNameProposals(contentAssistRequest, context);
+ this.replaceJsfcTags = false;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.JspContentAssistProcessor#addAttributeValueProposals(org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest)
+ */
+ @Override
+ protected void addAttributeValueProposals(ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context) {
+ super.addAttributeValueProposals(contentAssistRequest, context);
+ if (isExistingAttribute(JSFC_ATTRIBUTE_NAME)) {
+ this.replaceJsfcTags = true;
+ super.addAttributeValueProposals(contentAssistRequest, context);
+ this.replaceJsfcTags = false;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor#getTagName(org.w3c.dom.Node)
+ */
+ @Override
+ protected String getTagName(Node tag) {
+ String tagName = tag.getNodeName();
+ if(replaceJsfcTags) {
+ // Only HTML tags
+ if(tagName.indexOf(':')>0) {
+ return tagName;
+ }
+ if (!(tag instanceof Element))
+ return tagName;
+
+ Element element = (Element)tag;
+
+ NamedNodeMap attributes = element.getAttributes();
+ Node jsfC = attributes.getNamedItem(JSFC_ATTRIBUTE_NAME);
+ if(jsfC==null || (!(jsfC instanceof Attr))) {
+ return tagName;
+ }
+ Attr jsfCAttribute = (Attr)jsfC;
+ String jsfTagName = jsfCAttribute.getValue();
+ if(jsfTagName==null || jsfTagName.indexOf(':')<1) {
+ return tagName;
+ }
+ tagName = jsfTagName;
+ }
+ return tagName;
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsTagCompletionProposalComputer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/JspELCompletionProposalComputer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/JspELCompletionProposalComputer.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/JspELCompletionProposalComputer.java 2010-08-10 14:13:05 UTC (rev 24020)
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.contentassist.computers;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Region;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
+import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.parser.ELParserFactory;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.el.core.resolver.ELCompletionEngine;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.el.core.resolver.ELContextImpl;
+import org.jboss.tools.common.el.core.resolver.ELResolution;
+import org.jboss.tools.common.el.core.resolver.ELResolutionImpl;
+import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
+import org.jboss.tools.common.el.core.resolver.Var;
+import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.jboss.tools.jst.web.kb.taglib.INameSpace;
+
+/**
+ * EL Proposal computer for JSP pages
+ *
+ * @author Jeremy
+ *
+ */
+@SuppressWarnings("restriction")
+public class JspELCompletionProposalComputer extends XmlELCompletionProposalComputer {
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor#createContext()
+ */
+ @Override
+ protected ELContext createContext() {
+ return PageContextFactory.createPageContext(getResource(), PageContextFactory.JSP_PAGE_CONTEXT_TYPE);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.JspContentAssistProcessor#getContext()
+ */
+ @Override
+ public IPageContext getContext() {
+ return (IPageContext)super.getContext();
+ }
+
+ /**
+ * Returns URI string for the prefix specified using the namespaces collected for
+ * the {@link IPageContext} context.
+ * Important: The context must be created using createContext() method before using this method.
+ *
+ * @param prefix
+ * @return
+ */
+ @Override
+ public String getUri(String prefix) {
+ if (prefix == null)
+ return null;
+
+ Map<String, List<INameSpace>> nameSpaces = getContext().getNameSpaces(getOffset());
+ if (nameSpaces == null || nameSpaces.isEmpty())
+ return null;
+
+ for (List<INameSpace> nameSpace : nameSpaces.values()) {
+ for (INameSpace n : nameSpace) {
+ if (prefix.equals(n.getPrefix())) {
+ return n.getURI();
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected void addTextELProposals(
+ ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context) {
+ // Do not return any EL proposals for the TEXT regions
+ }
+
+ protected void setVars(ELContextImpl context, IFile file) {
+ ELCompletionEngine fakeEngine = new ELCompletionEngine() {
+
+ public ELResolution resolveELOperand(IFile file,
+ ELExpression operand, boolean returnEqualedVariablesOnly,
+ List<Var> vars, ElVarSearcher varSearcher)
+ throws BadLocationException, StringIndexOutOfBoundsException {
+ return new ELResolutionImpl(operand);
+ }
+
+ public ELParserFactory getParserFactory() {
+ return ELParserUtil.getJbossFactory();
+ }
+
+ public List<TextProposal> getProposals(ELContext context, String el, int offset) {
+ return Collections.emptyList();
+ }
+
+ public ELResolution resolve(ELContext context, ELExpression operand, int offset) {
+ return new ELResolutionImpl(operand);
+ }
+
+ public List<TextProposal> getProposals(ELContext context, int offset) {
+ return Collections.emptyList();
+ }
+ };
+ ElVarSearcher varSearcher = new ElVarSearcher(file, fakeEngine);
+ List<Var> vars = varSearcher.findAllVars(file, getOffset());
+
+ if (vars != null) {
+ for (Var var : vars) {
+ context.addVar(new Region(getOffset(), 0), var);
+ }
+ }
+ }
+
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/JspELCompletionProposalComputer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/JspTagCompletionProposalComputer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/JspTagCompletionProposalComputer.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/JspTagCompletionProposalComputer.java 2010-08-10 14:13:05 UTC (rev 24020)
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.contentassist.computers;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Region;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
+import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.parser.ELParserFactory;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.el.core.resolver.ELCompletionEngine;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.el.core.resolver.ELContextImpl;
+import org.jboss.tools.common.el.core.resolver.ELResolution;
+import org.jboss.tools.common.el.core.resolver.ELResolutionImpl;
+import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
+import org.jboss.tools.common.el.core.resolver.Var;
+import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.jboss.tools.jst.web.kb.taglib.INameSpace;
+
+/**
+ * Tag Proposal computer for JSP pages
+ *
+ * @author Jeremy
+ *
+ */
+@SuppressWarnings("restriction")
+public class JspTagCompletionProposalComputer extends XmlTagCompletionProposalComputer {
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor#createContext()
+ */
+ @Override
+ protected ELContext createContext() {
+ return PageContextFactory.createPageContext(getResource(), PageContextFactory.JSP_PAGE_CONTEXT_TYPE);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.JspContentAssistProcessor#getContext()
+ */
+ @Override
+ public IPageContext getContext() {
+ return (IPageContext)super.getContext();
+ }
+
+ /**
+ * Returns URI string for the prefix specified using the namespaces collected for
+ * the {@link IPageContext} context.
+ * Important: The context must be created using createContext() method before using this method.
+ *
+ * @param prefix
+ * @return
+ */
+ @Override
+ public String getUri(String prefix) {
+ if (prefix == null)
+ return null;
+
+ Map<String, List<INameSpace>> nameSpaces = getContext().getNameSpaces(getOffset());
+ if (nameSpaces == null || nameSpaces.isEmpty())
+ return null;
+
+ for (List<INameSpace> nameSpace : nameSpaces.values()) {
+ for (INameSpace n : nameSpace) {
+ if (prefix.equals(n.getPrefix())) {
+ return n.getURI();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Calculates and adds the tag proposals to the Content Assist Request object
+ * The method is to be overridden here because jsp disallows to use EL-s inside a text region
+ *
+ * @param contentAssistRequest Content Assist Request object
+ * @param childPosition the
+ */
+
+ @Override
+ protected void addTagInsertionProposals(
+ ContentAssistRequest contentAssistRequest, int childPosition,
+ CompletionProposalInvocationContext context) {
+
+ // Need to check if an EL Expression is opened here.
+ // If it is true we don't need to start any new tag proposals
+ TextRegion prefix = getELPrefix(contentAssistRequest);
+ if (prefix != null && prefix.isELStarted()) {
+ return;
+ }
+
+ addTagNameProposals(contentAssistRequest, childPosition, true, context);
+ }
+
+ /**
+ * Calculates and adds the EL proposals to the Content Assist Request object
+ */
+ @Override
+ protected void addTextELProposals(ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context) {
+ // No EL proposals are to be added here
+ }
+
+ protected void setVars(ELContextImpl context, IFile file) {
+ ELCompletionEngine fakeEngine = new ELCompletionEngine() {
+
+ public ELResolution resolveELOperand(IFile file,
+ ELExpression operand, boolean returnEqualedVariablesOnly,
+ List<Var> vars, ElVarSearcher varSearcher)
+ throws BadLocationException, StringIndexOutOfBoundsException {
+ return new ELResolutionImpl(operand);
+ }
+
+ public ELParserFactory getParserFactory() {
+ return ELParserUtil.getJbossFactory();
+ }
+
+ public List<TextProposal> getProposals(ELContext context, String el, int offset) {
+ return Collections.emptyList();
+ }
+
+ public ELResolution resolve(ELContext context, ELExpression operand, int offset) {
+ return new ELResolutionImpl(operand);
+ }
+
+ public List<TextProposal> getProposals(ELContext context, int offset) {
+ return Collections.emptyList();
+ }
+ };
+ ElVarSearcher varSearcher = new ElVarSearcher(file, fakeEngine);
+ List<Var> vars = varSearcher.findAllVars(file, getOffset());
+
+ if (vars != null) {
+ for (Var var : vars) {
+ context.addVar(new Region(getOffset(), 0), var);
+ }
+ }
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/JspTagCompletionProposalComputer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java 2010-08-10 14:13:05 UTC (rev 24020)
@@ -0,0 +1,1090 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.contentassist.computers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.internal.contentmodel.DTDImpl.DTDBaseAdapter;
+import org.eclipse.wst.dtd.core.internal.contentmodel.DTDImpl.DTDElementReferenceContentAdapter;
+import org.eclipse.wst.html.core.internal.contentmodel.HTMLPropertyDeclaration;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
+import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
+import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentModelGenerator;
+import org.eclipse.wst.xml.ui.internal.contentassist.XMLRelevanceConstants;
+import org.jboss.tools.common.el.core.ca.ELTextProposal;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.model.ELUtil;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.el.core.resolver.ELResolver;
+import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
+import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor.TextRegion;
+import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
+import org.jboss.tools.jst.jsp.contentassist.AutoELContentAssistantProposal;
+import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.KbQuery;
+import org.jboss.tools.jst.web.kb.KbQuery.Type;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.jboss.tools.jst.web.kb.PageProcessor;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * EL Proposal computer for XML pages
+ *
+ * @author Jeremy
+ *
+ */
+@SuppressWarnings("restriction")
+public class XmlELCompletionProposalComputer extends AbstractXmlCompletionProposalComputer {
+ protected static final ICompletionProposal[] EMPTY_PROPOSAL_LIST = new ICompletionProposal[0];
+ private static final String[] EMPTY_TAGS = new String[0];
+ protected static final Image JSF_EL_PROPOSAL_IMAGE = JspEditorPlugin.getDefault().getImage(JspEditorPlugin.CA_JSF_EL_IMAGE_PATH);
+
+ @Override
+ protected XMLContentModelGenerator getContentGenerator() {
+ return new XMLContentModelGenerator();
+ }
+
+ @Override
+ protected boolean validModelQueryNode(CMNode node) {
+ boolean isValid = false;
+ if(node instanceof DTDElementReferenceContentAdapter) {
+ DTDElementReferenceContentAdapter content = (DTDElementReferenceContentAdapter)node;
+ if(content.getCMDocument() instanceof DTDBaseAdapter) {
+ DTDBaseAdapter dtd = (DTDBaseAdapter)content.getCMDocument();
+ //this maybe a little hacky, but it works, if you have a better idea go for it
+ String spec = dtd.getSpec();
+ isValid = spec.indexOf("html") != -1; //$NON-NLS-1$
+ }
+ } else if(node instanceof HTMLPropertyDeclaration) {
+ HTMLPropertyDeclaration propDec = (HTMLPropertyDeclaration)node;
+ isValid = !propDec.isJSP();
+ } else if (node instanceof CMAttributeDeclaration) {
+ isValid = true;
+ }
+ return isValid;
+ }
+
+
+ /**
+ * Calculates and adds the tag proposals to the Content Assist Request object
+ *
+ * @param contentAssistRequest Content Assist Request object
+ * @param childPosition the
+ */
+
+ @Override
+ protected void addTagInsertionProposals(
+ ContentAssistRequest contentAssistRequest, int childPosition, CompletionProposalInvocationContext context) {
+
+ // Need to check if an EL Expression is opened here.
+ // If it is true we don't need to start any new tag proposals
+ TextRegion prefix = getELPrefix(contentAssistRequest);
+ if (prefix != null && prefix.isELStarted()) {
+ return;
+ }
+
+ addELPredicateProposals(contentAssistRequest, TextProposal.R_TAG_INSERTION, true);
+ }
+
+ @Override
+ protected void addAttributeValueProposals(
+ ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context) {
+
+ fCurrentContext = context;
+
+ // Need to check if an EL Expression is opened here.
+ // If it is true we don't need to start any new tag proposals
+ TextRegion prefix = getELPrefix(contentAssistRequest);
+ if (prefix != null && prefix.isELStarted()) {
+ return;
+ }
+
+ addELPredicateProposals(contentAssistRequest, TextProposal.R_JSP_ATTRIBUTE_VALUE, false);
+ }
+
+ protected void addTagNameProposals(ContentAssistRequest contentAssistRequest, int childPosition,
+ CompletionProposalInvocationContext context) {
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ protected void addAttributeValueELProposals(ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context) {
+
+ if (!isELCAToBeShown())
+ return;
+
+ TextRegion prefix = getELPrefix(contentAssistRequest);
+ if (prefix == null) {
+ return;
+ }
+
+ if(!prefix.isELStarted()) {
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true,
+ "#{}" + (prefix.isAttributeValue() && prefix.hasOpenQuote() && !prefix.hasCloseQuote() ? String.valueOf(prefix.getQuoteChar()) : ""), //$NON-NLS-1$ //$NON-NLS-2$
+ getOffset(), 0, 2, JSF_EL_PROPOSAL_IMAGE, JstUIMessages.JspContentAssistProcessor_NewELExpression,
+ null, JstUIMessages.JspContentAssistProcessor_NewELExpressionAttrInfo, TextProposal.R_XML_ATTRIBUTE_VALUE_TEMPLATE);
+
+ contentAssistRequest.addProposal(proposal);
+ return;
+ }
+ String matchString = "#{" + prefix.getText(); //$NON-NLS-1$
+ String query = matchString;
+ if (query == null)
+ query = ""; //$NON-NLS-1$
+ String stringQuery = matchString;
+
+ int beginChangeOffset = prefix.getStartOffset() + prefix.getOffset();
+
+ KbQuery kbQuery = createKbQuery(Type.ATTRIBUTE_VALUE, query, stringQuery);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+
+ if (proposals == null || proposals.length == 0)
+ return;
+
+ for (TextProposal textProposal : proposals) {
+ int replacementOffset = beginChangeOffset;
+ int replacementLength = prefix.getLength();
+ String replacementString = prefix.getText().substring(0, replacementLength) + textProposal.getReplacementString();
+
+ char quoteChar = prefix.isAttributeValue() && prefix.hasOpenQuote() ? prefix.getQuoteChar() : '"';
+// if (prefix.isAttributeValue() && !prefix.hasOpenQuote()) {
+// replacementString = String.valueOf(quoteChar) + replacementString;
+// }
+ int cursorPosition = replacementString.length();
+
+ if (!prefix.isELClosed()) {
+ replacementString += "}"; //$NON-NLS-1$
+ }
+
+ if (prefix.isAttributeValue() && prefix.hasOpenQuote() && !prefix.hasCloseQuote()) {
+ replacementString += String.valueOf(quoteChar);
+ }
+
+ Image image = textProposal.getImage();
+
+ // JBIDE-512, JBIDE-2541 related changes ===>>>
+// String displayString = prefix.getText().substring(0, replacementLength) + textProposal.getReplacementString();
+ String displayString = textProposal.getLabel();
+ if (displayString == null)
+ displayString = textProposal.getReplacementString() == null ? replacementString : textProposal.getReplacementString();
+ // <<<=== JBIDE-512, JBIDE-2541 related changes
+
+ int relevance = textProposal.getRelevance();
+ if (relevance == TextProposal.R_NONE) {
+ relevance = TextProposal.R_JSP_JSF_EL_VARIABLE_ATTRIBUTE_VALUE;
+ }
+
+ AutoContentAssistantProposal proposal = null;
+ if (textProposal instanceof ELTextProposal) {
+ IJavaElement[] javaElements = ((ELTextProposal)textProposal).getAllJavaElements();
+
+ proposal = new AutoELContentAssistantProposal(replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ null, javaElements, relevance);
+ } else {
+ String additionalProposalInfo = (textProposal.getContextInfo() == null ? "" : textProposal.getContextInfo()); //$NON-NLS-1$
+
+ proposal = new AutoContentAssistantProposal(replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ null, additionalProposalInfo, relevance);
+ }
+ contentAssistRequest.addProposal(proposal);
+ }
+
+ if (prefix.isELStarted() && !prefix.isELClosed()) {
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(
+ "}" + (prefix.isAttributeValue() && prefix.hasOpenQuote() && !prefix.hasCloseQuote() ? String.valueOf(prefix.getQuoteChar()) : ""), //$NON-NLS-1$ //$NON-NLS-2$
+ getOffset(), 0, 0, JSF_EL_PROPOSAL_IMAGE, JstUIMessages.JspContentAssistProcessor_CloseELExpression,
+ null, JstUIMessages.JspContentAssistProcessor_CloseELExpressionInfo, TextProposal.R_XML_ATTRIBUTE_VALUE + 1); //
+
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ protected void addTextELProposals(ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context) {
+ if (!isELCAToBeShown())
+ return;
+
+ TextRegion prefix = getELPrefix(contentAssistRequest);
+ if (prefix == null || !prefix.isELStarted()) {
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true, "#{}", //$NON-NLS-1$
+ contentAssistRequest.getReplacementBeginPosition(),
+ 0, 2, JSF_EL_PROPOSAL_IMAGE, JstUIMessages.JspContentAssistProcessor_NewELExpression, null,
+ JstUIMessages.FaceletPageContectAssistProcessor_NewELExpressionTextInfo, TextProposal.R_TAG_INSERTION + 1);
+
+ contentAssistRequest.addProposal(proposal);
+ return;
+ }
+ String matchString = "#{" + prefix.getText(); //$NON-NLS-1$
+ String query = matchString;
+ if (query == null)
+ query = ""; //$NON-NLS-1$
+ String stringQuery = matchString;
+
+ int beginChangeOffset = prefix.getStartOffset() + prefix.getOffset();
+
+ KbQuery kbQuery = createKbQuery(Type.TEXT, query, stringQuery);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+
+ if (proposals == null || proposals.length == 0)
+ return;
+
+ for (TextProposal textProposal : proposals) {
+ int replacementOffset = beginChangeOffset;
+ int replacementLength = prefix.getLength();
+ String replacementString = prefix.getText().substring(0, replacementLength) + textProposal.getReplacementString();
+ int cursorPosition = replacementString.length();
+
+ if (!prefix.isELClosed()) {
+ replacementString += "}"; //$NON-NLS-1$
+ }
+
+ Image image = textProposal.getImage();
+
+ // JBIDE-512, JBIDE-2541 related changes ===>>>
+// String displayString = prefix.getText().substring(0, replacementLength) + textProposal.getReplacementString();
+ String displayString = textProposal.getLabel();
+ if (displayString == null)
+ displayString = textProposal.getReplacementString() == null ? replacementString : textProposal.getReplacementString();
+
+ // <<<=== JBIDE-512, JBIDE-2541 related changes
+ int relevance = textProposal.getRelevance();
+ if (relevance == TextProposal.R_NONE) {
+ relevance = TextProposal.R_JSP_JSF_EL_VARIABLE_ATTRIBUTE_VALUE;
+ }
+
+ AutoContentAssistantProposal proposal = null;
+ if (textProposal instanceof ELTextProposal) {
+ IJavaElement[] javaElements = ((ELTextProposal)textProposal).getAllJavaElements();
+
+ proposal = new AutoELContentAssistantProposal(replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ null, javaElements, relevance);
+ } else {
+ String additionalProposalInfo = (textProposal.getContextInfo() == null ? "" : textProposal.getContextInfo()); //$NON-NLS-1$
+
+ proposal = new AutoContentAssistantProposal(replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ null, additionalProposalInfo, relevance);
+ }
+ contentAssistRequest.addProposal(proposal);
+ }
+
+ if (prefix.isELStarted() && !prefix.isELClosed()) {
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal("}", //$NON-NLS-1$
+ getOffset(), 0, 1, JSF_EL_PROPOSAL_IMAGE, JstUIMessages.JspContentAssistProcessor_CloseELExpression,
+ null, JstUIMessages.JspContentAssistProcessor_CloseELExpressionInfo, TextProposal.R_XML_ATTRIBUTE_VALUE_TEMPLATE);
+
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+
+ /**
+ * Calculates and adds EL predicate proposals based on the last word typed
+ * To be used only outside the EL.
+ *
+ * @param contentAssistRequest
+ */
+ @SuppressWarnings("unused")
+ protected void addELPredicateProposals(ContentAssistRequest contentAssistRequest, int baseRelevance, boolean shiftRelevanceAgainstTagNameProposals) {
+ if (!isELCAToBeShown())
+ return;
+
+ // Need to check if the cursor is placed right after a word part.
+ // If there is no word part found then just quit
+ TextRegion prefix = getELPredicatePrefix(contentAssistRequest);
+ if (prefix == null || prefix.isELStarted()) {
+ return;
+ }
+ String matchString = "#{" + prefix.getText(); //$NON-NLS-1$
+ String query = matchString;
+ if (query == null)
+ query = ""; //$NON-NLS-1$
+ String stringQuery = matchString;
+ int relevanceShift = -2; // Fix for JBIDE-5987: Relevance for predicate proposals is shifted down by default to show EL proposals lower than attr-value proposals
+ if (shiftRelevanceAgainstTagNameProposals) {
+ relevanceShift += prefix.getText() != null && prefix.getText().trim().length() > 0 ? (XMLRelevanceConstants.R_STRICTLY_VALID_TAG_INSERTION - baseRelevance + 2): -2;
+ }
+
+ int beginChangeOffset = prefix.getStartOffset() + prefix.getOffset();
+
+ KbQuery kbQuery = createKbQuery(Type.ATTRIBUTE_VALUE, query, stringQuery);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+
+ if (proposals == null || proposals.length == 0)
+ return;
+
+ for (TextProposal textProposal : proposals) {
+ int replacementOffset = beginChangeOffset;
+ int replacementLength = prefix.getLength();
+ String replacementString = "#{" + prefix.getText().substring(0, replacementLength) + textProposal.getReplacementString(); //$NON-NLS-1$
+
+ char quoteChar = prefix.isAttributeValue() && prefix.hasOpenQuote() ? prefix.getQuoteChar() : '"';
+ int cursorPosition = replacementString.length();
+
+ if (!prefix.isELClosed()) {
+ replacementString += "}"; //$NON-NLS-1$
+ }
+
+ if (prefix.isAttributeValue() && prefix.hasOpenQuote() && !prefix.hasCloseQuote()) {
+ replacementString += String.valueOf(quoteChar);
+ }
+
+ Image image = textProposal.getImage();
+
+ // JBIDE-512, JBIDE-2541 related changes ===>>>
+// String displayString = prefix.getText().substring(0, replacementLength) + textProposal.getReplacementString();
+ String displayString = textProposal.getLabel();
+ if (displayString == null)
+ displayString = textProposal.getReplacementString() == null ? replacementString : textProposal.getReplacementString();
+ // <<<=== JBIDE-512, JBIDE-2541 related changes
+
+ int relevance = textProposal.getRelevance();
+ if (relevance == TextProposal.R_NONE) {
+ relevance = baseRelevance;
+ }
+ relevance += relevanceShift;
+
+ AutoContentAssistantProposal proposal = null;
+ if (textProposal instanceof ELTextProposal) {
+ IJavaElement[] javaElements = ((ELTextProposal)textProposal).getAllJavaElements();
+
+ proposal = new AutoELContentAssistantProposal(replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ null, javaElements, relevance);
+ } else {
+ String additionalProposalInfo = (textProposal.getContextInfo() == null ? "" : textProposal.getContextInfo()); //$NON-NLS-1$
+
+ proposal = new AutoContentAssistantProposal(replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ null, additionalProposalInfo, relevance);
+ }
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+
+ /**
+ * Checks is we need to show EL proposals
+ *
+ * @return
+ */
+ protected boolean isELCAToBeShown() {
+ ELResolver[] resolvers = getContext().getElResolvers();
+ return (resolvers != null && resolvers.length > 0);
+ }
+
+ protected ELContext createContext() {
+ return PageContextFactory.createPageContext(getResource(), PageContextFactory.XML_PAGE_CONTEXT_TYPE);
+ }
+
+ protected KbQuery createKbQuery(Type type, String query, String stringQuery) {
+ return createKbQuery(type, query, stringQuery, getTagPrefix(), getTagUri());
+ }
+
+ protected KbQuery createKbQuery(Type type, String query, String stringQuery, String prefix, String uri) {
+ KbQuery kbQuery = new KbQuery();
+
+ String[] parentTags = getParentTags(type == Type.ATTRIBUTE_NAME || type == Type.ATTRIBUTE_VALUE);
+ String parent = getParent(type == Type.ATTRIBUTE_VALUE, type == Type.ATTRIBUTE_NAME);
+ String queryValue = query;
+ String queryStringValue = stringQuery;
+
+ kbQuery.setPrefix(prefix);
+ kbQuery.setUri(uri);
+ kbQuery.setParentTags(parentTags);
+ kbQuery.setParent(parent);
+ kbQuery.setMask(true);
+ kbQuery.setType(type);
+ kbQuery.setOffset(fCurrentContext.getInvocationOffset());
+ kbQuery.setValue(queryValue);
+ kbQuery.setStringQuery(queryStringValue);
+
+ return kbQuery;
+ }
+
+ /**
+ * this is the position the cursor should be in after the proposal is
+ * applied
+ *
+ * @param proposedText
+ * @return the position the cursor should be in after the proposal is
+ * applied
+ */
+ protected static int getCursorPositionForProposedText(String proposedText) {
+ int cursorAdjustment;
+ cursorAdjustment = proposedText.indexOf("\"\"") + 1; //$NON-NLS-1$
+ // otherwise, after the first tag
+ if (cursorAdjustment == 0) {
+ cursorAdjustment = proposedText.indexOf('>') + 1;
+ }
+ if (cursorAdjustment == 0) {
+ cursorAdjustment = proposedText.length();
+ }
+
+ return cursorAdjustment;
+ }
+
+ /**
+ * Returns array of the <code>org.jboss.tools.common.el.core.resolver.ELResolver</code>
+ * instances.
+ *
+ * @param resource
+ * @return
+ */
+ protected ELResolver[] getELResolvers(IResource resource) {
+ if (resource == null)
+ return null;
+
+ ELResolverFactoryManager elrfm = ELResolverFactoryManager.getInstance();
+ return elrfm.getResolvers(resource);
+ }
+
+ /**
+ * Returns array of the parent tags
+ *
+ * @return
+ */
+ public String[] getParentTags(boolean includeThisTag) {
+ List<String> parentTags = new ArrayList<String>();
+
+ IStructuredModel sModel = StructuredModelManager
+ .getModelManager()
+ .getExistingModelForRead(getDocument());
+ try {
+ if (sModel == null)
+ return EMPTY_TAGS;
+
+ Document xmlDocument = (sModel instanceof IDOMModel)
+ ? ((IDOMModel) sModel).getDocument()
+ : null;
+
+ if (xmlDocument == null)
+ return EMPTY_TAGS;
+
+
+ Node n = null;
+ if (includeThisTag) {
+ n = findNodeForOffset(xmlDocument, getOffset());
+ } else {
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
+ if (sdFixedRegion == null)
+ return EMPTY_TAGS;
+
+ n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
+ }
+ if (n == null)
+ return EMPTY_TAGS;
+
+ // Find the first parent tag
+ if (!(n instanceof Element)) {
+ if (n instanceof Attr) {
+ n = ((Attr) n).getOwnerElement();
+ } else {
+ n = n.getParentNode();
+ }
+ } else if (!includeThisTag) {
+ n = n.getParentNode();
+ }
+
+ // Store all the parents
+ while (n != null && n instanceof Element) {
+ String tagName = getTagName(n);
+ parentTags.add(0, tagName);
+ n = n.getParentNode();
+ }
+
+ return (String[])parentTags.toArray(new String[parentTags.size()]);
+ } finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+ }
+
+ protected String getTagName(Node tag) {
+ return tag.getNodeName();
+ }
+
+ /**
+ * Returns name of the parent attribute/tag name
+ *
+ * @return
+ */
+ protected String getParent(boolean returnAttributeName, boolean returnThisElement) {
+ IStructuredModel sModel = StructuredModelManager
+ .getModelManager()
+ .getExistingModelForRead(getDocument());
+ try {
+ if (sModel == null)
+ return null;
+
+ Document xmlDocument = (sModel instanceof IDOMModel)
+ ? ((IDOMModel) sModel).getDocument()
+ : null;
+
+ if (xmlDocument == null)
+ return null;
+
+ Node n = null;
+ if (returnAttributeName) {
+ n = findNodeForOffset(xmlDocument, getOffset());
+ } else {
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
+ if (sdFixedRegion == null)
+ return null;
+
+ n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
+ }
+
+ if (n == null)
+ return null;
+
+ // Find the first parent tag
+ if (!(n instanceof Element)) {
+ if (n instanceof Attr) {
+ if (returnAttributeName) {
+ String parentAttrName = n.getNodeName();
+ return parentAttrName;
+ }
+ n = ((Attr) n).getOwnerElement();
+ } else {
+ n = n.getParentNode();
+ }
+ } else {
+ if (!returnThisElement)
+ n = n.getParentNode();
+ }
+ if (n == null)
+ return null;
+
+ String parentTagName = getTagName(n);
+ return parentTagName;
+ } finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+ }
+
+ /**
+ * Returns URI for the current/parent tag
+ * @return
+ */
+ public String getTagPrefix() {
+ IStructuredModel sModel = StructuredModelManager
+ .getModelManager()
+ .getExistingModelForRead(getDocument());
+ try {
+ if (sModel == null)
+ return null;
+
+ Document xmlDocument = (sModel instanceof IDOMModel)
+ ? ((IDOMModel) sModel).getDocument()
+ : null;
+
+ if (xmlDocument == null)
+ return null;
+
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
+ if (sdFixedRegion == null)
+ return null;
+
+ Node n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
+ if (n == null)
+ return null;
+
+
+ if (!(n instanceof Element) && !(n instanceof Attr))
+ return null;
+
+ if (n instanceof Attr) {
+ n = ((Attr) n).getOwnerElement();
+ }
+
+ if (n == null)
+ return null;
+
+ String nodePrefix = ((Element)n).getPrefix();
+ return nodePrefix;
+ } finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+ }
+
+ /**
+ * Returns URI for the current/parent tag
+ * @return
+ */
+ public String getTagUri() {
+ String nodePrefix = getTagPrefix();
+ return getUri(nodePrefix);
+ }
+
+ /**
+ * Returns URI string for the prefix specified using the namespaces collected for
+ * the {@link IPageContext} context.
+ *
+ * @Override org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor#getUri(String)
+ */
+ protected String getUri(String prefix) {
+ return null;
+ }
+
+ /**
+ * Returns the document position where the CA is invoked
+ * @return
+ */
+ protected int getOffset() {
+ return fCurrentContext.getInvocationOffset();
+ }
+
+
+ /**
+ * Returns the document
+ *
+ * @return
+ */
+ protected IDocument getDocument() {
+ return fCurrentContext.getDocument();
+ }
+
+ /**
+ * Returns IFile resource of the document
+ *
+ * @return
+ */
+ protected IFile getResource() {
+ IStructuredModel sModel = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
+ try {
+ if (sModel != null) {
+ String baseLocation = sModel.getBaseLocation();
+ IPath location = new Path(baseLocation).makeAbsolute();
+ return FileBuffers.getWorkspaceFileAtLocation(location);
+ }
+ }
+ finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the <code>org.jboss.tools.common.el.core.resolver.ELContext</code> instance
+ *
+ * @return
+ */
+ protected ELContext getContext() {
+ return this.fContext;
+ }
+
+
+ /**
+ * Returns EL Prefix Text Region Information Object
+ *
+ * @return
+ */
+ protected TextRegion getELPrefix(ContentAssistRequest request) {
+ if (!DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(request.getRegion().getType()) &&
+ !DOMRegionContext.XML_CONTENT.equals(request.getRegion().getType()) &&
+ !DOMRegionContext.BLOCK_TEXT.equals(request.getRegion().getType()))
+ return null;
+
+ String text = request.getDocumentRegion().getFullText(request.getRegion());
+ int startOffset = request.getDocumentRegion().getStartOffset() + request.getRegion().getStart();
+
+ boolean isAttributeValue = false;
+ boolean hasOpenQuote = false;
+ boolean hasCloseQuote = false;
+ char quoteChar = (char)0;
+ if (DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(request.getRegion().getType())) {
+ isAttributeValue = true;
+ if (text.startsWith("\"") || text.startsWith("'")) {//$NON-NLS-1$ //$NON-NLS-2$
+ quoteChar = text.charAt(0);
+ hasOpenQuote = true;
+ }
+ if (hasOpenQuote && text.trim().endsWith(String.valueOf(quoteChar))) {
+ hasCloseQuote = true;
+ }
+ }
+
+ int inValueOffset = getOffset() - startOffset;
+ if (text != null && text.length() < inValueOffset) { // probably, the attribute value ends before the document position
+ return null;
+ }
+ if (inValueOffset<0) {
+ return null;
+ }
+
+// String matchString = text.substring(0, inValueOffset);
+
+ ELParser p = ELParserUtil.getJbossFactory().createParser();
+ ELModel model = p.parse(text);
+
+ ELInstance is = ELUtil.findInstance(model, inValueOffset);// ELInstance
+ ELInvocationExpression ie = ELUtil.findExpression(model, inValueOffset);// ELExpression
+
+ boolean isELStarted = (model != null && is != null && (model.toString().startsWith("#{") || //$NON-NLS-1$
+ model.toString().startsWith("${"))); //$NON-NLS-1$
+ boolean isELClosed = (model != null && is != null && model.toString().endsWith("}")); //$NON-NLS-1$
+
+// boolean insideEL = startOffset + model.toString().length()
+ TextRegion tr = new TextRegion(startOffset, ie == null ? inValueOffset : ie.getStartPosition(),
+ ie == null ? 0 : inValueOffset - ie.getStartPosition(), ie == null ? "" : ie.getText(), //$NON-NLS-1$
+ isELStarted, isELClosed,
+ isAttributeValue, hasOpenQuote, hasCloseQuote, quoteChar);
+
+ return tr;
+ }
+
+ /**
+ * Returns EL Predicate Text Region Information Object
+ *
+ *
+ * @return
+ */
+ protected TextRegion getELPredicatePrefix(ContentAssistRequest request) {
+ if (request == null || request.getRegion() == null)
+ return null;
+
+ IStructuredDocumentRegion documentRegion = request.getDocumentRegion();
+ ITextRegion completionRegion = request.getRegion();
+ String regionType = completionRegion.getType();
+
+ if (DOMRegionContext.XML_END_TAG_OPEN.equals(regionType) || DOMRegionContext.XML_TAG_OPEN.equals(regionType)) {
+ documentRegion = documentRegion.getPrevious();
+ completionRegion = getCompletionRegion(request.getDocumentRegion().getStartOffset() + request.getRegion().getStart() - 1, request.getParent());
+ }
+ if (!DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(completionRegion.getType()) &&
+ !DOMRegionContext.XML_CONTENT.equals(completionRegion.getType()) &&
+ !DOMRegionContext.BLOCK_TEXT.equals(completionRegion.getType())) {
+ return null;
+ }
+ String text = documentRegion.getFullText(completionRegion);
+ int startOffset = documentRegion.getStartOffset() + completionRegion.getStart();
+
+ boolean isAttributeValue = false;
+ boolean hasOpenQuote = false;
+ boolean hasCloseQuote = false;
+ char quoteChar = (char)0;
+ if (DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(request.getRegion().getType())) {
+ isAttributeValue = true;
+ if (text.startsWith("\"") || text.startsWith("'")) {//$NON-NLS-1$ //$NON-NLS-2$
+ quoteChar = text.charAt(0);
+ hasOpenQuote = true;
+ }
+ if (hasOpenQuote && text.trim().endsWith(String.valueOf(quoteChar))) {
+ hasCloseQuote = true;
+ }
+ }
+
+ int inValueOffset = getOffset() - startOffset;
+ if (inValueOffset<0 || // There is no a word part before cursor
+ (text != null && text.length() < inValueOffset)) { // probably, the attribute value ends before the document position
+ return null;
+ }
+
+ String matchString = getELPredicateMatchString(text, inValueOffset);
+ if (matchString == null)
+ return null;
+
+ TextRegion tr = new TextRegion(startOffset, getOffset() - matchString.length() - startOffset,
+ matchString.length(), matchString, false, false,
+ isAttributeValue, hasOpenQuote, hasCloseQuote, quoteChar);
+
+ return tr;
+ }
+
+ /**
+ * Returns predicate string for the EL-related query.
+ * The predicate string is the word/part of word right before the cursor position, including the '.' and '_' characters,
+ * which is to be replaced by the EL CA proposal ('#{' and '}' character sequences are to be inserted too)
+ *
+ * @param text
+ * @param offset
+ * @return
+ */
+ protected String getELPredicateMatchString(String text, int offset) {
+ int beginningOffset = offset - 1;
+ while(beginningOffset >=0 &&
+ (Character.isJavaIdentifierPart(text.charAt(beginningOffset)) ||
+ '.' == text.charAt(beginningOffset) ||
+ '_' == text.charAt(beginningOffset))) {
+ beginningOffset--;
+ }
+ beginningOffset++; // move it to point the first valid character
+ return text.substring(beginningOffset, offset);
+ }
+
+ /**
+ * The reason of overriding is that the method returns wrong region in case of incomplete tag (a tag with no '>'-closing char)
+ * In this case we have to return that previous incomplete tag instead of the current tag)
+ */
+ public IStructuredDocumentRegion getStructuredDocumentRegion(int pos) {
+ IStructuredDocumentRegion sdRegion = null;
+
+ int lastOffset = pos;
+ IStructuredDocument doc = (IStructuredDocument) getDocument();
+ if (doc == null)
+ return null;
+
+ do {
+ sdRegion = doc.getRegionAtCharacterOffset(lastOffset);
+ if (sdRegion != null) {
+ ITextRegion region = sdRegion.getRegionAtCharacterOffset(lastOffset);
+ if (region != null && region.getType() == DOMRegionContext.XML_TAG_OPEN &&
+ sdRegion.getStartOffset(region) == lastOffset) {
+ // The offset is at the beginning of the region
+ if ((sdRegion.getStartOffset(region) == sdRegion.getStartOffset()) && (sdRegion.getPrevious() != null) && (!sdRegion.getPrevious().isEnded())) {
+ // Is the region also the start of the node? If so, the
+ // previous IStructuredDocumentRegion is
+ // where to look for a useful region.
+// sdRegion = sdRegion.getPrevious();
+ sdRegion = null;
+ }
+ else {
+ // Is there no separating whitespace from the previous region?
+ // If not,
+ // then that region is the important one
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(lastOffset - 1);
+ if ((previousRegion != null) && (previousRegion != region) && (previousRegion.getTextLength() == previousRegion.getLength())) {
+// sdRegion = sdRegion.getPrevious();
+ sdRegion = null;
+ }
+ }
+ }
+ }
+ lastOffset--;
+ } while (sdRegion == null && lastOffset >= 0);
+ return sdRegion;
+ }
+
+ /**
+ * The reason of overriding is that the method returns wrong region in case of incomplete tag (a tag with no '>'-closing char)
+ * In this case we have to return that previous incomplete tag instead of the current tag)
+ */
+ protected ITextRegion getCompletionRegion(int documentPosition, Node domnode) {
+ if (domnode == null) {
+ return null;
+ }
+ // Get the original WTP Structured Document Region
+ IStructuredDocumentRegion sdNormalRegion = ContentAssistUtils.getStructuredDocumentRegion(fCurrentContext.getViewer(), documentPosition);
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(documentPosition);
+
+ // If original and fixed regions are different we have to replace domnode with its parent node
+ if (sdFixedRegion != null && !sdFixedRegion.equals(sdNormalRegion)) {
+ Node prevnode = domnode.getParentNode();
+ if (prevnode != null) {
+ domnode = prevnode;
+ }
+ }
+
+ return getSuperCompletionRegion(documentPosition, domnode);
+ }
+
+ /**
+ * Return the region whose content's require completion. This is something
+ * of a misnomer as sometimes the user wants to be prompted for contents
+ * of a non-existant ITextRegion, such as for enumerated attribute values
+ * following an '=' sign.
+ */
+ private ITextRegion getSuperCompletionRegion(int documentPosition, Node domnode) {
+ if (domnode == null) {
+ return null;
+ }
+
+ ITextRegion region = null;
+ int offset = documentPosition;
+ IStructuredDocumentRegion flatNode = null;
+ IDOMNode node = (IDOMNode) domnode;
+
+ if (node.getNodeType() == Node.DOCUMENT_NODE) {
+ if (node.getStructuredDocument().getLength() == 0) {
+ return null;
+ }
+ ITextRegion result = node.getStructuredDocument().getRegionAtCharacterOffset(offset).getRegionAtCharacterOffset(offset);
+ while (result == null) {
+ offset--;
+ result = node.getStructuredDocument().getRegionAtCharacterOffset(offset).getRegionAtCharacterOffset(offset);
+ }
+ return result;
+ }
+
+ IStructuredDocumentRegion startTag = node.getStartStructuredDocumentRegion();
+ IStructuredDocumentRegion endTag = node.getEndStructuredDocumentRegion();
+
+ // Determine if the offset is within the start
+ // IStructuredDocumentRegion, end IStructuredDocumentRegion, or
+ // somewhere within the Node's XML content.
+ if ((startTag != null) && (startTag.getStartOffset() <= offset) && (offset < startTag.getStartOffset() + startTag.getLength())) {
+ flatNode = startTag;
+ }
+ else if ((endTag != null) && (endTag.getStartOffset() <= offset) && (offset < endTag.getStartOffset() + endTag.getLength())) {
+ flatNode = endTag;
+ }
+
+ if (flatNode != null) {
+ // the offset is definitely within the start or end tag, continue
+ // on and find the region
+ region = getCompletionRegion(offset, flatNode);
+ }
+ else {
+ // the docPosition is neither within the start nor the end, so it
+ // must be content
+ flatNode = node.getStructuredDocument().getRegionAtCharacterOffset(offset);
+ // (pa) ITextRegion refactor
+ // if (flatNode.contains(documentPosition)) {
+ if ((flatNode.getStartOffset() <= documentPosition) && (flatNode.getEndOffset() >= documentPosition)) {
+ // we're interesting in completing/extending the previous
+ // IStructuredDocumentRegion if the current
+ // IStructuredDocumentRegion isn't plain content or if it's
+ // preceded by an orphan '<'
+ if ((offset == flatNode.getStartOffset()) &&
+ (flatNode.getPrevious() != null) &&
+ (((flatNode.getRegionAtCharacterOffset(documentPosition) != null) &&
+ (flatNode.getRegionAtCharacterOffset(documentPosition).getType() != DOMRegionContext.XML_CONTENT)) ||
+ (flatNode.getPrevious().getLastRegion().getType() == DOMRegionContext.XML_TAG_OPEN) ||
+ (flatNode.getPrevious().getLastRegion().getType() == DOMRegionContext.XML_END_TAG_OPEN))) {
+
+ // Is the region also the start of the node? If so, the
+ // previous IStructuredDocumentRegion is
+ // where to look for a useful region.
+ region = flatNode.getPrevious().getLastRegion();
+ }
+ else if (flatNode.getEndOffset() == documentPosition) {
+ region = flatNode.getLastRegion();
+ }
+ else {
+ region = flatNode.getFirstRegion();
+ }
+ }
+ else {
+ // catch end of document positions where the docPosition isn't
+ // in a IStructuredDocumentRegion
+ region = flatNode.getLastRegion();
+ }
+ }
+
+ return region;
+ }
+
+
+ protected ITextRegion getCompletionRegion(int offset, IStructuredDocumentRegion sdRegion) {
+ ITextRegion region = getSuperCompletionRegion(offset, sdRegion);
+ if (region != null && region.getType() == DOMRegionContext.UNDEFINED) {
+ // FIX: JBIDE-2332 CA with proposal list for comonent's atributes doesn't work before double quotes.
+ // Sometimes, especially if we have a broken XML node, the region returned has UNDEFINED type.
+ // If so, we're try to use the prevoius region, which probably will be the region of type XML_TAG_NAME.
+
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(offset - 1);
+ if ((previousRegion != null) && (previousRegion != region) && (previousRegion.getTextLength() < previousRegion.getLength())) {
+ region = previousRegion;
+ }
+ }
+ return region;
+ }
+
+ private ITextRegion getSuperCompletionRegion(int offset, IStructuredDocumentRegion sdRegion) {
+ ITextRegion region = sdRegion.getRegionAtCharacterOffset(offset);
+ if (region == null) {
+ return null;
+ }
+
+ if (sdRegion.getStartOffset(region) == offset) {
+ // The offset is at the beginning of the region
+ if ((sdRegion.getStartOffset(region) == sdRegion.getStartOffset()) && (sdRegion.getPrevious() != null) && (!sdRegion.getPrevious().isEnded())) {
+ // Is the region also the start of the node? If so, the
+ // previous IStructuredDocumentRegion is
+ // where to look for a useful region.
+ region = sdRegion.getPrevious().getRegionAtCharacterOffset(offset - 1);
+ }
+ else {
+ // Is there no separating whitespace from the previous region?
+ // If not,
+ // then that region is the important one
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(offset - 1);
+ if ((previousRegion != null) && (previousRegion != region) && (previousRegion.getTextLength() == previousRegion.getLength())) {
+ region = previousRegion;
+ }
+ }
+ }
+ else {
+ // The offset is NOT at the beginning of the region
+ if (offset > sdRegion.getStartOffset(region) + region.getTextLength()) {
+ // Is the offset within the whitespace after the text in this
+ // region?
+ // If so, use the next region
+ ITextRegion nextRegion = sdRegion.getRegionAtCharacterOffset(sdRegion.getStartOffset(region) + region.getLength());
+ if (nextRegion != null) {
+ region = nextRegion;
+ }
+ }
+ else {
+ // Is the offset within the important text for this region?
+ // If so, then we've already got the right one.
+ }
+ }
+
+ // valid WHITE_SPACE region handler (#179924)
+ if ((region != null) && (region.getType() == DOMRegionContext.WHITE_SPACE)) {
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(sdRegion.getStartOffset(region) - 1);
+ if (previousRegion != null) {
+ region = previousRegion;
+ }
+ }
+
+ return region;
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java 2010-08-10 14:13:05 UTC (rev 24020)
@@ -0,0 +1,683 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.contentassist.computers;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.internal.contentmodel.DTDImpl.DTDBaseAdapter;
+import org.eclipse.wst.dtd.core.internal.contentmodel.DTDImpl.DTDElementReferenceContentAdapter;
+import org.eclipse.wst.html.core.internal.contentmodel.HTMLPropertyDeclaration;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
+import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentModelGenerator;
+import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImageHelper;
+import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.model.ELUtil;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.el.core.resolver.ELResolver;
+import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
+import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
+import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.KbQuery;
+import org.jboss.tools.jst.web.kb.KbQuery.Type;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.jboss.tools.jst.web.kb.PageProcessor;
+import org.jboss.tools.jst.web.kb.taglib.INameSpace;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Tag Proposal computer for XML pages
+ *
+ * @author Jeremy
+ *
+ */
+@SuppressWarnings("restriction")
+public class XmlTagCompletionProposalComputer extends AbstractXmlCompletionProposalComputer {
+ protected static final ICompletionProposal[] EMPTY_PROPOSAL_LIST = new ICompletionProposal[0];
+
+ @Override
+ protected XMLContentModelGenerator getContentGenerator() {
+ return new ELXMLContentModelGenerator();
+ }
+
+ @Override
+ protected boolean validModelQueryNode(CMNode node) {
+ boolean isValid = false;
+ if(node instanceof DTDElementReferenceContentAdapter) {
+ DTDElementReferenceContentAdapter content = (DTDElementReferenceContentAdapter)node;
+ if(content.getCMDocument() instanceof DTDBaseAdapter) {
+ DTDBaseAdapter dtd = (DTDBaseAdapter)content.getCMDocument();
+ //this maybe a little hacky, but it works, if you have a better idea go for it
+ String spec = dtd.getSpec();
+ isValid = spec.indexOf("html") != -1; //$NON-NLS-1$
+ }
+ } else if(node instanceof HTMLPropertyDeclaration) {
+ HTMLPropertyDeclaration propDec = (HTMLPropertyDeclaration)node;
+ isValid = !propDec.isJSP();
+ } else if (node instanceof CMAttributeDeclaration) {
+ isValid = true;
+ }
+ return isValid;
+ }
+
+
+ /**
+ * Calculates and adds the tag proposals to the Content Assist Request object
+ *
+ * @param contentAssistRequest Content Assist Request object
+ * @param childPosition the
+ */
+
+ @Override
+ protected void addTagInsertionProposals(
+ ContentAssistRequest contentAssistRequest, int childPosition, CompletionProposalInvocationContext context) {
+
+ // Need to check if an EL Expression is opened here.
+ // If it is true we don't need to start any new tag proposals
+ TextRegion prefix = getELPrefix(contentAssistRequest);
+ if (prefix != null && prefix.isELStarted()) {
+ return;
+ }
+
+ addTagNameProposals(contentAssistRequest, childPosition, true, context);
+ }
+
+ @Override
+ protected void addAttributeNameProposals(ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context) {
+ String matchString = contentAssistRequest.getMatchString();
+ String query = matchString;
+ if (query == null)
+ query = ""; //$NON-NLS-1$
+ String stringQuery = matchString;
+
+ KbQuery kbQuery = createKbQuery(Type.ATTRIBUTE_NAME, query, stringQuery);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+
+ for (int i = 0; proposals != null && i < proposals.length; i++) {
+ TextProposal textProposal = proposals[i];
+
+ if (isExistingAttribute(textProposal.getLabel()))
+ continue;
+
+ String replacementString = textProposal.getReplacementString() + "=\"\""; //$NON-NLS-1$
+
+ int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
+ int replacementLength = contentAssistRequest.getReplacementLength();
+ int cursorPosition = getCursorPositionForProposedText(replacementString);
+ Image image = textProposal.getImage();
+ if (image == null) {
+ image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_ATTRIBUTE);
+ }
+
+ String displayString = textProposal.getLabel() == null ?
+ replacementString :
+ textProposal.getLabel();
+ IContextInformation contextInformation = null;
+ String additionalProposalInfo = textProposal.getContextInfo();
+ int relevance = textProposal.getRelevance();
+
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true, replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ contextInformation, additionalProposalInfo, relevance);
+
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+
+ /*
+ * Checks if the specified attribute exists
+ *
+ * @param attrName Name of attribute to check
+ */
+ protected boolean isExistingAttribute(String attrName) {
+ IStructuredModel sModel = StructuredModelManager.getModelManager()
+ .getExistingModelForRead(getDocument());
+ try {
+ if (sModel == null)
+ return false;
+
+ Document xmlDocument = (sModel instanceof IDOMModel) ? ((IDOMModel) sModel)
+ .getDocument()
+ : null;
+
+ if (xmlDocument == null)
+ return false;
+
+ // Get Fixed Structured Document Region
+ IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
+ if (sdFixedRegion == null)
+ return false;
+
+ Node n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
+ if (n == null)
+ return false;
+
+ // Find the first parent tag
+ if (!(n instanceof Element)) {
+ if (n instanceof Attr) {
+ n = ((Attr) n).getOwnerElement();
+ } else {
+ return false;
+ }
+ }
+
+ if (n == null)
+ return false;
+
+ String existingAttributeName = ((Element)n).getAttribute(attrName);
+ return (existingAttributeName != null && existingAttributeName.length() > 0);
+ } finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+ }
+
+ @Override
+ protected void addAttributeValueProposals(
+ ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context) {
+
+ fCurrentContext = context;
+
+ // Need to check if an EL Expression is opened here.
+ // If it is true we don't need to start any new tag proposals
+ TextRegion prefix = getELPrefix(contentAssistRequest);
+ if (prefix != null && prefix.isELStarted()) {
+ return;
+ }
+
+ String matchString = contentAssistRequest.getMatchString();
+ String query = matchString;
+ if (query == null)
+ query = ""; //$NON-NLS-1$
+ String stringQuery = matchString;
+
+ KbQuery kbQuery = createKbQuery(Type.ATTRIBUTE_VALUE, query, stringQuery);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+
+ for (int i = 0; proposals != null && i < proposals.length; i++) {
+ TextProposal textProposal = proposals[i];
+ int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
+ int replacementLength = contentAssistRequest.getReplacementLength();
+ if(textProposal.getStart() >= 0 && textProposal.getEnd() >= 0) {
+ replacementOffset += textProposal.getStart() + 1;
+ replacementLength = textProposal.getEnd() - textProposal.getStart();
+ }
+ String replacementString = "\"" + textProposal.getReplacementString() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ if(textProposal.getStart() >= 0 && textProposal.getEnd() >= 0) {
+ replacementString = textProposal.getReplacementString();
+ }
+ int cursorPosition = getCursorPositionForProposedText(replacementString);
+ Image image = textProposal.getImage();
+ String displayString = textProposal.getLabel() == null ?
+ replacementString :
+ textProposal.getLabel();
+ IContextInformation contextInformation = null;
+ String additionalProposalInfo = textProposal.getContextInfo();
+ int relevance = textProposal.getRelevance();
+ if (relevance == TextProposal.R_NONE) {
+ relevance = TextProposal.R_JSP_ATTRIBUTE_VALUE;
+ }
+
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ contextInformation, additionalProposalInfo, relevance);
+
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+
+ protected void addTagNameProposals(ContentAssistRequest contentAssistRequest, int childPosition,
+ CompletionProposalInvocationContext context) {
+ addTagNameProposals(contentAssistRequest, childPosition, false, context);
+ }
+ /**
+ * Calculates and adds the tag name proposals to the Content Assist Request object
+ *
+ * @param contentAssistRequest Content Assist Request object
+ * @param childPosition the
+ */
+ protected void addTagNameProposals(
+ ContentAssistRequest contentAssistRequest,
+ int childPosition, boolean insertTagOpenningCharacter,
+ CompletionProposalInvocationContext context) {
+
+ String mainPrefix = getTagPrefix();
+ String mainURI = getTagUri();
+
+ String query = contentAssistRequest.getMatchString();
+ addTagNameProposalsForPrefix(contentAssistRequest, childPosition, query, mainPrefix, mainURI, TextProposal.R_TAG_INSERTION, insertTagOpenningCharacter);
+
+ if (query == null || query.length() == 0 || query.contains(":")) //$NON-NLS-1$
+ return;
+
+ // Make an additional proposals to allow prefixed tags to be entered with no prefix typed
+ ELContext elContext = getContext();
+ if (elContext instanceof IPageContext) {
+ IPageContext pageContext = (IPageContext)elContext;
+ Map<String, List<INameSpace>> nsMap = pageContext.getNameSpaces(contentAssistRequest.getReplacementBeginPosition());
+ if (nsMap == null) return;
+
+ for (List<INameSpace> namespaces : nsMap.values()) {
+ if (namespaces == null) continue;
+
+ for (INameSpace namespace : namespaces) {
+ String possiblePrefix = namespace.getPrefix();
+ if (possiblePrefix == null || possiblePrefix.length() == 0)
+ continue; // Don't query proposals for the default value here
+
+ String possibleURI = namespace.getURI();
+ String possibleQuery = namespace.getPrefix() + ":" + query; //$NON-NLS-1$
+ addTagNameProposalsForPrefix(contentAssistRequest, childPosition,
+ possibleQuery, possiblePrefix, possibleURI,
+ TextProposal.R_TAG_INSERTION - 1,
+ insertTagOpenningCharacter);
+ }
+ }
+ }
+ }
+
+ private void addTagNameProposalsForPrefix(
+ ContentAssistRequest contentAssistRequest,
+ int childPosition,
+ String query,
+ String prefix,
+ String uri,
+ int defaultRelevance,
+ boolean insertTagOpenningCharacter) {
+ if (query == null)
+ query = ""; //$NON-NLS-1$
+ String stringQuery = "<" + query; //$NON-NLS-1$
+
+ KbQuery kbQuery = createKbQuery(Type.TAG_NAME, query, stringQuery, prefix, uri);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
+
+ for (int i = 0; proposals != null && i < proposals.length; i++) {
+ TextProposal textProposal = proposals[i];
+
+ String replacementString = textProposal.getReplacementString();
+ String closingTag = textProposal.getLabel();
+ if (closingTag != null && closingTag.startsWith("<")) { //$NON-NLS-1$
+ closingTag = closingTag.substring(1);
+ }
+
+ if (!insertTagOpenningCharacter && replacementString.startsWith("<")) { //$NON-NLS-1$
+ // Because the tag starting char is already in the text
+ replacementString = replacementString.substring(1);
+ }
+ if (!replacementString.endsWith("/>")) { //$NON-NLS-1$
+ replacementString += "</" + closingTag + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+
+ int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
+ int replacementLength = contentAssistRequest.getReplacementLength();
+ int cursorPosition = getCursorPositionForProposedText(replacementString);
+ Image image = textProposal.getImage();
+ if (image == null) {
+ image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
+ }
+
+ String displayString = closingTag;
+ IContextInformation contextInformation = null;
+ String additionalProposalInfo = textProposal.getContextInfo();
+ int relevance = textProposal.getRelevance();
+ if (relevance == TextProposal.R_NONE) {
+ relevance = defaultRelevance == TextProposal.R_NONE? TextProposal.R_TAG_INSERTION : defaultRelevance;
+ }
+
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true, replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ contextInformation, additionalProposalInfo, relevance);
+
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+
+ @Override
+ protected void addAttributeValueELProposals(ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context) {
+ // No EL proposals are to be added here
+ }
+
+
+ protected void addTextELProposals(ContentAssistRequest contentAssistRequest,
+ CompletionProposalInvocationContext context) {
+ // No EL proposals are to be added here
+ }
+
+ protected ELContext createContext() {
+ return PageContextFactory.createPageContext(getResource(), PageContextFactory.XML_PAGE_CONTEXT_TYPE);
+ }
+
+ protected KbQuery createKbQuery(Type type, String query, String stringQuery) {
+ return createKbQuery(type, query, stringQuery, getTagPrefix(), getTagUri());
+ }
+
+ protected KbQuery createKbQuery(Type type, String query, String stringQuery, String prefix, String uri) {
+ KbQuery kbQuery = new KbQuery();
+
+ String[] parentTags = getParentTags(type == Type.ATTRIBUTE_NAME || type == Type.ATTRIBUTE_VALUE);
+ String parent = getParent(type == Type.ATTRIBUTE_VALUE, type == Type.ATTRIBUTE_NAME);
+ String queryValue = query;
+ String queryStringValue = stringQuery;
+
+ kbQuery.setPrefix(prefix);
+ kbQuery.setUri(uri);
+ kbQuery.setParentTags(parentTags);
+ kbQuery.setParent(parent);
+ kbQuery.setMask(true);
+ kbQuery.setType(type);
+ kbQuery.setOffset(fCurrentContext.getInvocationOffset());
+ kbQuery.setValue(queryValue);
+ kbQuery.setStringQuery(queryStringValue);
+
+ return kbQuery;
+ }
+
+
+ /**
+ * this is the position the cursor should be in after the proposal is
+ * applied
+ *
+ * @param proposedText
+ * @return the position the cursor should be in after the proposal is
+ * applied
+ */
+ protected static int getCursorPositionForProposedText(String proposedText) {
+ int cursorAdjustment;
+ cursorAdjustment = proposedText.indexOf("\"\"") + 1; //$NON-NLS-1$
+ // otherwise, after the first tag
+ if (cursorAdjustment == 0) {
+ cursorAdjustment = proposedText.indexOf('>') + 1;
+ }
+ if (cursorAdjustment == 0) {
+ cursorAdjustment = proposedText.length();
+ }
+
+ return cursorAdjustment;
+ }
+
+ /**
+ * Returns array of the <code>org.jboss.tools.common.el.core.resolver.ELResolver</code>
+ * instances.
+ *
+ * @param resource
+ * @return
+ */
+ protected ELResolver[] getELResolvers(IResource resource) {
+ if (resource == null)
+ return null;
+
+ ELResolverFactoryManager elrfm = ELResolverFactoryManager.getInstance();
+ return elrfm.getResolvers(resource);
+ }
+
+ /**
+ * Returns URI for the current/parent tag
+ * @return
+ */
+ public String getTagUri() {
+ String nodePrefix = getTagPrefix();
+ return getUri(nodePrefix);
+ }
+
+ /**
+ * Returns URI string for the prefix specified using the namespaces collected for
+ * the {@link IPageContext} context.
+ *
+ * @Override org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor#getUri(String)
+ */
+ protected String getUri(String prefix) {
+ return null;
+ }
+
+ /**
+ * Returns EL Prefix Text Region Information Object
+ *
+ * @return
+ */
+ protected TextRegion getELPrefix(ContentAssistRequest request) {
+ if (!DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(request.getRegion().getType()) &&
+ !DOMRegionContext.XML_CONTENT.equals(request.getRegion().getType()) &&
+ !DOMRegionContext.BLOCK_TEXT.equals(request.getRegion().getType()))
+ return null;
+
+ String text = request.getDocumentRegion().getFullText(request.getRegion());
+ int startOffset = request.getDocumentRegion().getStartOffset() + request.getRegion().getStart();
+
+ boolean isAttributeValue = false;
+ boolean hasOpenQuote = false;
+ boolean hasCloseQuote = false;
+ char quoteChar = (char)0;
+ if (DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(request.getRegion().getType())) {
+ isAttributeValue = true;
+ if (text.startsWith("\"") || text.startsWith("'")) {//$NON-NLS-1$ //$NON-NLS-2$
+ quoteChar = text.charAt(0);
+ hasOpenQuote = true;
+ }
+ if (hasOpenQuote && text.trim().endsWith(String.valueOf(quoteChar))) {
+ hasCloseQuote = true;
+ }
+ }
+
+ int inValueOffset = getOffset() - startOffset;
+ if (text != null && text.length() < inValueOffset) { // probably, the attribute value ends before the document position
+ return null;
+ }
+ if (inValueOffset<0) {
+ return null;
+ }
+
+// String matchString = text.substring(0, inValueOffset);
+
+ ELParser p = ELParserUtil.getJbossFactory().createParser();
+ ELModel model = p.parse(text);
+
+ ELInstance is = ELUtil.findInstance(model, inValueOffset);// ELInstance
+ ELInvocationExpression ie = ELUtil.findExpression(model, inValueOffset);// ELExpression
+
+ boolean isELStarted = (model != null && is != null && (model.toString().startsWith("#{") || //$NON-NLS-1$
+ model.toString().startsWith("${"))); //$NON-NLS-1$
+ boolean isELClosed = (model != null && is != null && model.toString().endsWith("}")); //$NON-NLS-1$
+
+// boolean insideEL = startOffset + model.toString().length()
+ TextRegion tr = new TextRegion(startOffset, ie == null ? inValueOffset : ie.getStartPosition(),
+ ie == null ? 0 : inValueOffset - ie.getStartPosition(), ie == null ? "" : ie.getText(), //$NON-NLS-1$
+ isELStarted, isELClosed,
+ isAttributeValue, hasOpenQuote, hasCloseQuote, quoteChar);
+
+ return tr;
+ }
+
+ /**
+ * Returns EL Predicate Text Region Information Object
+ *
+ *
+ * @return
+ */
+ protected TextRegion getELPredicatePrefix(ContentAssistRequest request) {
+ if (request == null || request.getRegion() == null)
+ return null;
+
+ IStructuredDocumentRegion documentRegion = request.getDocumentRegion();
+ ITextRegion completionRegion = request.getRegion();
+ String regionType = completionRegion.getType();
+
+ if (DOMRegionContext.XML_END_TAG_OPEN.equals(regionType) || DOMRegionContext.XML_TAG_OPEN.equals(regionType)) {
+ documentRegion = documentRegion.getPrevious();
+ completionRegion = getCompletionRegion(request.getDocumentRegion().getStartOffset() + request.getRegion().getStart() - 1, request.getParent());
+ }
+ if (!DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(completionRegion.getType()) &&
+ !DOMRegionContext.XML_CONTENT.equals(completionRegion.getType()) &&
+ !DOMRegionContext.BLOCK_TEXT.equals(completionRegion.getType())) {
+ return null;
+ }
+ String text = documentRegion.getFullText(completionRegion);
+ int startOffset = documentRegion.getStartOffset() + completionRegion.getStart();
+
+ boolean isAttributeValue = false;
+ boolean hasOpenQuote = false;
+ boolean hasCloseQuote = false;
+ char quoteChar = (char)0;
+ if (DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(request.getRegion().getType())) {
+ isAttributeValue = true;
+ if (text.startsWith("\"") || text.startsWith("'")) {//$NON-NLS-1$ //$NON-NLS-2$
+ quoteChar = text.charAt(0);
+ hasOpenQuote = true;
+ }
+ if (hasOpenQuote && text.trim().endsWith(String.valueOf(quoteChar))) {
+ hasCloseQuote = true;
+ }
+ }
+
+ int inValueOffset = getOffset() - startOffset;
+ if (inValueOffset<0 || // There is no a word part before cursor
+ (text != null && text.length() < inValueOffset)) { // probably, the attribute value ends before the document position
+ return null;
+ }
+
+ String matchString = getELPredicateMatchString(text, inValueOffset);
+ if (matchString == null)
+ return null;
+
+ TextRegion tr = new TextRegion(startOffset, getOffset() - matchString.length() - startOffset,
+ matchString.length(), matchString, false, false,
+ isAttributeValue, hasOpenQuote, hasCloseQuote, quoteChar);
+
+ return tr;
+ }
+
+ /**
+ * Returns predicate string for the EL-related query.
+ * The predicate string is the word/part of word right before the cursor position, including the '.' and '_' characters,
+ * which is to be replaced by the EL CA proposal ('#{' and '}' character sequences are to be inserted too)
+ *
+ * @param text
+ * @param offset
+ * @return
+ */
+ protected String getELPredicateMatchString(String text, int offset) {
+ int beginningOffset = offset - 1;
+ while(beginningOffset >=0 &&
+ (Character.isJavaIdentifierPart(text.charAt(beginningOffset)) ||
+ '.' == text.charAt(beginningOffset) ||
+ '_' == text.charAt(beginningOffset))) {
+ beginningOffset--;
+ }
+ beginningOffset++; // move it to point the first valid character
+ return text.substring(beginningOffset, offset);
+ }
+
+ public static class ELXMLContentModelGenerator extends XMLContentModelGenerator {
+
+ }
+
+ public static class TextRegion {
+ private int startOffset;
+ private int offset;
+ private int length;
+ private String text;
+ private boolean isELStarted;
+ private boolean isELClosed;
+ private boolean isAttributeValue;
+ private boolean hasOpenQuote;
+ private boolean hasCloseQuote;
+ private char quoteChar;
+
+ TextRegion(int startOffset, int offset, int length, String text, boolean isELStarted, boolean isELClosed) {
+ this(startOffset, offset, length, text, isELStarted, isELClosed, false, false, false, (char)0);
+ }
+
+ public TextRegion(int startOffset, int offset, int length, String text, boolean isELStarted, boolean isELClosed,
+ boolean isAttributeValue, boolean hasOpenQuote, boolean hasCloseQuote, char quoteChar) {
+ this.startOffset = startOffset;
+ this.offset = offset;
+ this.length = length;
+ this.text = text;
+ this.isELStarted = isELStarted;
+ this.isELClosed = isELClosed;
+ this.isAttributeValue = isAttributeValue;
+ this.hasOpenQuote = hasOpenQuote;
+ this.hasCloseQuote = hasCloseQuote;
+ this.quoteChar = quoteChar;
+ }
+
+ public int getStartOffset() {
+ return startOffset;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ public String getText() {
+ StringBuffer sb = new StringBuffer(length);
+ sb = sb.append(text.substring(0, length));
+ sb.setLength(length);
+ return sb.toString();
+ }
+
+ public boolean isELStarted() {
+ return isELStarted;
+ }
+
+ public boolean isELClosed() {
+ return isELClosed;
+ }
+
+ public boolean isAttributeValue() {
+ return isAttributeValue;
+ }
+
+ public char getQuoteChar() {
+ return quoteChar;
+ }
+
+ public boolean hasOpenQuote() {
+ return hasOpenQuote;
+ }
+
+ public boolean hasCloseQuote() {
+ return hasCloseQuote;
+ }
+ }
+
+}
+
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 5 months
JBoss Tools SVN: r24019 - in trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui: utils and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: bfitzpat
Date: 2010-08-10 10:09:52 -0400 (Tue, 10 Aug 2010)
New Revision: 24019
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java
Log:
OPEN - issue JBIDE-6660: [tester] does not handle password protected services
https://jira.jboss.org/browse/JBIDE-6660
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2010-08-10 13:54:22 UTC (rev 24018)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2010-08-10 14:09:52 UTC (rev 24019)
@@ -108,6 +108,7 @@
JAXRSWSTestView_Set_Sample_Data_Label=Set Sample Data
JAXRSWSTestView_Web_Service_Type_Label=Web Service Type:
JAXRSWSTestView2_BodyText_Section=Body Text
+JAXRSWSTestView2_Checkbox_Basic_Authentication=Prompt for Basic Authentication
JAXRSWSTestView2_GetFromWSDL_Tooltip=Get from WSDL
JAXRSWSTestView2_Go_Tooltip=Invoke
JAXRSWSTestView2_Headers_Section=Headers
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2010-08-10 13:54:22 UTC (rev 24018)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2010-08-10 14:09:52 UTC (rev 24019)
@@ -139,6 +139,7 @@
public static String JAXRSWSTestView_Set_Sample_Data_Label;
public static String JAXRSWSTestView_Web_Service_Type_Label;
public static String JAXRSWSTestView2_BodyText_Section;
+ public static String JAXRSWSTestView2_Checkbox_Basic_Authentication;
public static String JAXRSWSTestView2_GetFromWSDL_Tooltip;
public static String JAXRSWSTestView2_Go_Tooltip;
public static String JAXRSWSTestView2_Headers_Section;
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java 2010-08-10 13:54:22 UTC (rev 24018)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java 2010-08-10 14:09:52 UTC (rev 24019)
@@ -111,14 +111,23 @@
}
if (uid != null && pwd != null) {
- Map<String, Object> requestContext = d.getRequestContext();
- requestContext.put(BindingProvider.USERNAME_PROPERTY, uid);
- requestContext.put(BindingProvider.PASSWORD_PROPERTY, pwd);
+ d.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, uid);
+ d.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, pwd);
}
SOAPMessage m = mf.createMessage( null, new ByteArrayInputStream(body.getBytes()));
m.saveChanges();
+ // this is a different method of passing along security details
+// if (uid != null && pwd != null) {
+// String authStr = uid + ':' + pwd;
+// byte[] authEncByte = Base64.encodeBase64(authStr.getBytes());
+// String authStringEnc = new String(authEncByte);
+//
+// MimeHeaders hd = m.getMimeHeaders();
+// hd.addHeader("Authorization", "Basic " + authStringEnc); //$NON-NLS-1$//$NON-NLS-2$
+// }
+
Response<SOAPMessage> response = d.invokeAsync(m);
while (!response.isDone()){
//go off and do some work
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java 2010-08-10 13:54:22 UTC (rev 24018)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java 2010-08-10 14:09:52 UTC (rev 24019)
@@ -75,6 +75,7 @@
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.CoolBar;
@@ -182,6 +183,7 @@
private TestHistory history = new TestHistory();
private TestHistoryEntry currentHistoryEntry = null;
+ private Button useBasicAuthCB;
/**
* The constructor.
@@ -702,6 +704,11 @@
gd9.minimumHeight = 200;
ec5.setLayoutData(gd9);
ec5.addExpansionListener(new FormExpansionAdapter());
+
+ useBasicAuthCB = toolkit.createButton(sectionClient,
+ JBossWSUIMessages.JAXRSWSTestView2_Checkbox_Basic_Authentication, SWT.CHECK);
+ GridData gd10 = new GridData(SWT.FILL, SWT.NONE, true, false);
+ useBasicAuthCB.setLayoutData(gd10);
section.addExpansionListener(new FormExpansionAdapter());
section.setClient(sectionClient);
@@ -1163,8 +1170,8 @@
String tempUID = null;
String tempPwd = null;
- // temp workaround to handle JAX-RS authenticated services
- if (wsTech.contentEquals(JAX_RS) && url.startsWith("https")) { //$NON-NLS-1$
+ // If basic authorization checkbox is checked, use the uid/pwd
+ if (useBasicAuthCB.getSelection()) {
UidPwdDialog authDialog = new UidPwdDialog(getSite().getShell());
int rtnCode = authDialog.open();
if (rtnCode == Window.OK) {
15 years, 5 months
JBoss Tools SVN: r24018 - trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2010-08-10 09:54:22 -0400 (Tue, 10 Aug 2010)
New Revision: 24018
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java
Log:
https://jira.jboss.org/browse/JBIDE-6647 :
Research of firing Drag&Drop events in XULRunner 1.9
- now the events are fired by XULRunner 1.9
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java 2010-08-10 08:57:23 UTC (rev 24017)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java 2010-08-10 13:54:22 UTC (rev 24018)
@@ -100,8 +100,10 @@
setBoolRootPref(PREFERENCE_DISABLEOPENDURINGLOAD, true);
setBoolRootPref(PREFERENCE_DISABLEWINDOWSTATUSCHANGE, true);
- nsIWebBrowserSetup setup = XPCOM.queryInterface(webBrowser, nsIWebBrowserSetup.class);
- setup.setProperty(nsIWebBrowserSetup.SETUP_IS_CHROME_WRAPPER, 1);
+ /* yradtsevich: the following two lines are commented due to JBIDE-6647.
+ * By some reason they were preventing of handling of Drag&Drop events. */
+// nsIWebBrowserSetup setup = XPCOM.queryInterface(webBrowser, nsIWebBrowserSetup.class);
+// setup.setProperty(nsIWebBrowserSetup.SETUP_IS_CHROME_WRAPPER, 1);
// JBIDE-1329 Solution was contributed by Snjezana Peco
// webBrowser.addWebBrowserListener(this,
15 years, 5 months
JBoss Tools SVN: r24017 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE: 6600 and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-08-10 04:57:23 -0400 (Tue, 10 Aug 2010)
New Revision: 24017
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/6600/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/6600/jbide6600.html
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/6600/jbide6600.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/6600/jbide6600.xml.xml
Log:
https://jira.jboss.org/browse/JBIDE-6600, missed junit test folder commited
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/6600/jbide6600.html
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/6600/jbide6600.html (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/6600/jbide6600.html 2010-08-10 08:57:23 UTC (rev 24017)
@@ -0,0 +1,5 @@
+<html>
+<head>
+<title id="title"">Test JBIDE-6600 Title</title>
+</head>
+</html>
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/6600/jbide6600.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/6600/jbide6600.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/6600/jbide6600.xml 2010-08-10 08:57:23 UTC (rev 24017)
@@ -0,0 +1,10 @@
+<article xmlns='http://docbook.org/ns/docbook'>
+<title>Example title</title>
+
+<section>
+ <title id="title">A Top Level Section</title>
+
+ <para>Actual content.</para>
+</section>
+
+</article>
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/6600/jbide6600.xml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/6600/jbide6600.xml.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/6600/jbide6600.xml.xml 2010-08-10 08:57:23 UTC (rev 24017)
@@ -0,0 +1,7 @@
+<tests>
+ <test id="title">
+ <H1 STYLE="-moz-user-modify: read-write;">
+ A Top Level Section
+ </H1>
+ </test>
+</tests>
\ No newline at end of file
15 years, 5 months