JBoss Tools SVN: r12260 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp: contentassist and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-12-03 14:13:19 -0500 (Wed, 03 Dec 2008)
New Revision: 12260
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JspEditorPlugin.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/ExtendedJSPContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletsHtmlContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogCellEditorContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdActionResource.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBundleNameResource.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBundlePropertyResource.java
Log:
JBIDE-3133 New icons for proposals in JSF/Seam Code Assist.
The icons support and a set of common icons are added to the JSF CA.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JspEditorPlugin.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JspEditorPlugin.java 2008-12-03 19:05:51 UTC (rev 12259)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JspEditorPlugin.java 2008-12-03 19:13:19 UTC (rev 12260)
@@ -13,6 +13,7 @@
import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.util.HashMap;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -23,10 +24,14 @@
import org.eclipse.jdt.ui.text.JavaTextTools;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jst.jsp.ui.internal.JSPUIPlugin;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
import org.jboss.tools.common.text.xml.XmlEditorPlugin;
@@ -44,6 +49,15 @@
public static final String RESOURCES_PATH = "/resources";
+ // A Map to save a descriptor for each image
+ private HashMap fImageDescRegistry = null;
+
+ public static final String CA_JSF_ACTION_IMAGE_PATH = "images/ca/icons_JSF_Actions.gif";
+ public static final String CA_JSF_EL_IMAGE_PATH = "images/ca/icons_JSF_EL.gif";
+ public static final String CA_RESOURCES_IMAGE_PATH = "images/ca/icons_Resource_path.gif";
+ public static final String CA_JSF_MESSAGES_IMAGE_PATH = "images/ca/icons_Message_Bundles.gif";
+
+
/**
* The constructor.
*/
@@ -165,4 +179,105 @@
}
return (url == null) ? null : url.getPath();
}
+
+ /**
+ * Creates an image from the given resource and adds the image to the
+ * image registry.
+ *
+ * @param resource
+ * @return Image
+ */
+ private Image createImage(String resource) {
+ ImageDescriptor desc = getImageDescriptorFromRegistry(resource);
+ Image image = null;
+
+ if (desc != null) {
+ image = desc.createImage();
+ // dont add the missing image descriptor image to the image
+ // registry
+ if (!desc.equals(ImageDescriptor.getMissingImageDescriptor())) {
+ getImageRegistry().put(resource, image);
+ }
+ }
+ return image;
+ }
+
+ /**
+ * Creates an image descriptor from the given imageFilePath and adds the
+ * image descriptor to the image descriptor registry. If an image
+ * descriptor could not be created, the default "missing" image descriptor
+ * is returned but not added to the image descriptor registry.
+ *
+ * @param imageFilePath
+ * @return ImageDescriptor image descriptor for imageFilePath or default
+ * "missing" image descriptor if resource could not be found
+ */
+ private ImageDescriptor createImageDescriptor(String imageFilePath) {
+ ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, imageFilePath);
+ if (imageDescriptor != null) {
+ getImageDescriptorRegistry().put(imageFilePath, imageDescriptor);
+ }
+ else {
+ imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
+ }
+
+ return imageDescriptor;
+ }
+
+ /**
+ * Retrieves the image associated with resource from the image registry.
+ * If the image cannot be retrieved, attempt to find and load the image at
+ * the location specified in resource.
+ *
+ * @param resource
+ * the image to retrieve
+ * @return Image the image associated with resource or null if one could
+ * not be found
+ */
+ public Image getImage(String resource) {
+ Image image = getImageRegistry().get(resource);
+ if (image == null) {
+ // create an image
+ image = createImage(resource);
+ }
+ return image;
+ }
+
+ /**
+ * Retrieves the image descriptor associated with resource from the image
+ * descriptor registry. If the image descriptor cannot be retrieved,
+ * attempt to find and load the image descriptor at the location specified
+ * in resource.
+ *
+ * @param resource
+ * the image descriptor to retrieve
+ * @return ImageDescriptor the image descriptor assocated with resource or
+ * the default "missing" image descriptor if one could not be
+ * found
+ */
+ public ImageDescriptor getImageDescriptorFromRegistry(String resource) {
+ ImageDescriptor imageDescriptor = null;
+ Object o = getImageDescriptorRegistry().get(resource);
+ if (o == null) {
+ // create a descriptor
+ imageDescriptor = createImageDescriptor(resource);
+ }
+ else {
+ imageDescriptor = (ImageDescriptor) o;
+ }
+ return imageDescriptor;
+ }
+
+ /**
+ * Returns the image descriptor registry for this plugin.
+ *
+ * @return HashMap - image descriptor registry for this plugin
+ */
+ private HashMap getImageDescriptorRegistry() {
+ if (fImageDescRegistry == null) {
+ fImageDescRegistry = new HashMap();
+ }
+ return fImageDescRegistry;
+ }
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/ExtendedJSPContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/ExtendedJSPContentAssistProcessor.java 2008-12-03 19:05:51 UTC (rev 12259)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/ExtendedJSPContentAssistProcessor.java 2008-12-03 19:13:19 UTC (rev 12260)
@@ -300,7 +300,8 @@
}
String proposedInfo = getAdditionalInfo(parentDecl, childType);
for (int i = 0; i < childStrings.length; i++) {
- CustomCompletionProposal textProposal = new AutoContentAssistantProposal(childStrings[i].indexOf("=")>-1, childStrings[i], begin, length, childStrings[i].length(), XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_ENUM), childStrings[i], null, proposedInfo, XMLRelevanceConstants.R_TAG_INSERTION);
+ Image image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_ENUM);
+ CustomCompletionProposal textProposal = new AutoContentAssistantProposal(childStrings[i].indexOf("=")>-1, childStrings[i], begin, length, childStrings[i].length(), image, childStrings[i], null, proposedInfo, XMLRelevanceConstants.R_TAG_INSERTION);
contentAssistRequest.addProposal(textProposal);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletsHtmlContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletsHtmlContentAssistProcessor.java 2008-12-03 19:05:51 UTC (rev 12259)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletsHtmlContentAssistProcessor.java 2008-12-03 19:13:19 UTC (rev 12260)
@@ -236,8 +236,14 @@
int replacementBeginPosition = start + kbProposal.getStart();
int replacementLength = kbProposal.getEnd() - kbProposal.getStart();
int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
+
+ // JBIDE-3133: New icons for proposals in JSF/Seam Code Assist
+ Image image = kbProposal.hasImage() ? kbProposal.getImage() :
+ JspEditorPlugin.getDefault().getImage(JspEditorPlugin.CA_JSF_EL_IMAGE_PATH);
+
AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
- replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
+ replacementBeginPosition, replacementLength, cursorPosition,
+ image,
label, null, kbProposal.getContextInfo(), relevance);
contentAssistRequest.addProposal(proposal);
continue;
@@ -265,8 +271,14 @@
}
int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
+
+ // JBIDE-3133: New icons for proposals in JSF/Seam Code Assist
+ Image image = kbProposal.hasImage() ? kbProposal.getImage() :
+ JspEditorPlugin.getDefault().getImage(JspEditorPlugin.CA_JSF_EL_IMAGE_PATH);
+
AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
- replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
+ replacementBeginPosition, replacementLength, cursorPosition,
+ image,
label, null, kbProposal.getContextInfo(), relevance);
contentAssistRequest.addProposal(proposal);
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java 2008-12-03 19:05:51 UTC (rev 12259)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java 2008-12-03 19:13:19 UTC (rev 12260)
@@ -14,6 +14,7 @@
import java.util.Iterator;
import java.util.List;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.sse.core.utils.StringUtils;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
@@ -40,7 +41,6 @@
* @author Igels
*/
public class JSPActiveContentAssistProcessor extends JSPBaseContentAssistProcessor {
-
private WtpKbConnector wtpKbConnector;
private boolean isFacelets = false;
@@ -161,8 +161,15 @@
String replacementString = replacementStringBuffer.toString();
int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
+
+ // JBIDE-3133: New icons for proposals in JSF/Seam Code Assist
+ Image image = kbProposal.hasImage() ?
+ kbProposal.getImage() :
+ SharedXMLEditorPluginImageHelper
+ .getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE);
+
AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
- replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
+ replacementBeginPosition, replacementLength, cursorPosition, image,
kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
contentAssistRequest.addProposal(proposal);
@@ -231,11 +238,16 @@
if ('#' == displayString.charAt(0) || '$' == displayString.charAt(0))
displayString = elStartChar + displayString.substring(1);
+ // JBIDE-3133: New icons for proposals in JSF/Seam Code Assist
+ Image image = kbProposal.hasImage() ?
+ kbProposal.getImage() :
+ JspEditorPlugin.getDefault().getImage(JspEditorPlugin.CA_JSF_EL_IMAGE_PATH);
+
AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(
kbProposal.autoActivationContentAssistantAfterApplication(),
replacementString,
replacementBeginPosition, replacementLength, cursorPosition,
- SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
+ image,
displayString, null, kbProposal.getContextInfo(), relevance);
contentAssistRequest.addProposal(proposal);
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogCellEditorContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogCellEditorContentAssistProcessor.java 2008-12-03 19:05:51 UTC (rev 12259)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogCellEditorContentAssistProcessor.java 2008-12-03 19:13:19 UTC (rev 12260)
@@ -22,6 +22,7 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.xml.ui.internal.contentassist.XMLRelevanceConstants;
import org.eclipse.wst.xml.ui.internal.util.SharedXMLEditorPluginImageHelper;
import org.jboss.tools.common.kb.KbException;
@@ -123,10 +124,17 @@
int replacementLength = kbProposal.getEnd() - kbProposal.getStart();
int cursorPositionDelta = 0;
int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
+
+ Image image = kbProposal.hasImage() ?
+ kbProposal.getImage() :
+ SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE);
+
AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
- replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
+ replacementBeginPosition, replacementLength, cursorPosition,
+ image,
kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
- proposalsList.add(proposal);
+
+ proposalsList.add(proposal);
} else {
StringBuffer replacementStringBuffer = new StringBuffer(kbProposal.getReplacementString());
int replacementBeginPosition = 0;
@@ -134,9 +142,16 @@
int cursorPositionDelta = 0;
String replacementString = replacementStringBuffer.toString();
int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
+
+ Image image = kbProposal.hasImage() ?
+ kbProposal.getImage() :
+ SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE);
+
AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
- replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
+ replacementBeginPosition, replacementLength, cursorPosition,
+ image,
kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
+
proposalsList.add(proposal);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java 2008-12-03 19:05:51 UTC (rev 12259)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java 2008-12-03 19:13:19 UTC (rev 12260)
@@ -126,6 +126,7 @@
}
proposal.setReplacementString(replacementString);
proposal.setPosition(replacementString.length());
+ proposal.setImage(JspEditorPlugin.getDefault().getImage(JspEditorPlugin.CA_RESOURCES_IMAGE_PATH));
proposals.add(proposal);
}
return proposals;
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdActionResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdActionResource.java 2008-12-03 19:05:51 UTC (rev 12259)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdActionResource.java 2008-12-03 19:13:19 UTC (rev 12260)
@@ -23,6 +23,7 @@
import org.jboss.tools.common.kb.KbDinamicResource;
import org.jboss.tools.common.kb.KbProposal;
import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.web.project.list.IWebPromptingProvider;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
@@ -68,6 +69,7 @@
proposal.setLabel(text);
proposal.setReplacementString(text);
proposal.setPosition(text.length());
+ proposal.setImage(JspEditorPlugin.getDefault().getImage(JspEditorPlugin.CA_JSF_ACTION_IMAGE_PATH));
proposals.add(proposal);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java 2008-12-03 19:05:51 UTC (rev 12259)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java 2008-12-03 19:13:19 UTC (rev 12260)
@@ -19,6 +19,7 @@
import java.util.Set;
import java.util.TreeSet;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorInput;
import org.jboss.tools.common.el.core.model.ELExpression;
import org.jboss.tools.common.el.core.model.ELInstance;
@@ -41,7 +42,6 @@
* @author Jeremy
*/
public class WTPKbdBeanPropertyResource extends WTPKbAbstractModelResource {
-
public static String SUPPORTED_ID = WebPromptingProvider.JSF_BEAN_PROPERTIES;
public Properties type = new Properties();
protected String query;
@@ -96,7 +96,8 @@
Iterator<String> it = sorted.iterator();
while(it.hasNext()) {
String text = it.next();
- process(proposals, "", "", -1, query.length() - "".length(), query.length(), text, restQuery);
+ process(proposals, "", "", -1, query.length() - "".length(), query.length(), text, restQuery,
+ JspEditorPlugin.getDefault().getImage(JspEditorPlugin.CA_JSF_EL_IMAGE_PATH));
}
} catch (Exception x) {
JspEditorPlugin.getPluginLog().logError(x);
@@ -125,7 +126,7 @@
return BEAN_PROPERTY_WRAPPERS;
}
- protected boolean process(Collection<KbProposal> proposals, String prefix, String suffix, int start, int cursor, int end, String text, String query) {
+ protected boolean process(Collection<KbProposal> proposals, String prefix, String suffix, int start, int cursor, int end, String text, String query, Image image) {
if ((prefix + text).toLowerCase().startsWith((prefix + query).toLowerCase())) {
KbProposal proposal = new KbProposal();
proposal.setLabel(prefix + text + suffix);
@@ -134,6 +135,7 @@
proposal.setPosition(cursor);
proposal.setPostProcessing(postProcessing);
proposal.setRelevance(getKbProposalRelevance());
+ proposal.setImage(image);
return true;
} else {
return false;
@@ -211,7 +213,6 @@
proposal.setReplacementString("#{" + proposal.getReplacementString() + "}");
proposal.setLabel("#{" + proposal.getLabel() + "}");
-
// JBIDE-2334: JSPAciveContentAssistProcessor (a class which calls this method)
// is to process opening and closing EL charachers
/*
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBundleNameResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBundleNameResource.java 2008-12-03 19:05:51 UTC (rev 12259)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBundleNameResource.java 2008-12-03 19:13:19 UTC (rev 12260)
@@ -22,6 +22,7 @@
import org.jboss.tools.common.kb.KbDinamicResource;
import org.jboss.tools.common.kb.KbProposal;
import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
/**
@@ -59,6 +60,7 @@
proposal.setLabel(text);
proposal.setReplacementString(text);
proposal.setPosition(text.length());
+ proposal.setImage(JspEditorPlugin.getDefault().getImage(JspEditorPlugin.CA_JSF_MESSAGES_IMAGE_PATH));
proposals.add(proposal);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBundlePropertyResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBundlePropertyResource.java 2008-12-03 19:05:51 UTC (rev 12259)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBundlePropertyResource.java 2008-12-03 19:13:19 UTC (rev 12260)
@@ -136,7 +136,8 @@
Iterator it = sorted.iterator();
while(it.hasNext()) {
String text = (String)it.next();
- process(proposals, "", "", -1, query.length() - "".length(), query.length(), text, restQuery);
+ process(proposals, "", "", -1, query.length() - "".length(), query.length(), text, restQuery,
+ JspEditorPlugin.getDefault().getImage(JspEditorPlugin.CA_JSF_MESSAGES_IMAGE_PATH));
}
} catch (Exception x) {
JspEditorPlugin.getPluginLog().logError("Error in executing query " + query, x);
17 years, 1 month
JBoss Tools SVN: r12259 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/images: ca and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-12-03 14:05:51 -0500 (Wed, 03 Dec 2008)
New Revision: 12259
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/images/ca/
trunk/jst/plugins/org.jboss.tools.jst.jsp/images/ca/icons_JSF_Actions.gif
trunk/jst/plugins/org.jboss.tools.jst.jsp/images/ca/icons_JSF_EL.gif
trunk/jst/plugins/org.jboss.tools.jst.jsp/images/ca/icons_Message_Bundles.gif
trunk/jst/plugins/org.jboss.tools.jst.jsp/images/ca/icons_Resource_path.gif
Log:
JBIDE-3133 New icons for proposals in JSF/Seam Code Assist.
The icons support and a set of common icons are added to the JSF CA.
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/images/ca/icons_JSF_Actions.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/images/ca/icons_JSF_Actions.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/images/ca/icons_JSF_EL.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/images/ca/icons_JSF_EL.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/images/ca/icons_Message_Bundles.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/images/ca/icons_Message_Bundles.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/images/ca/icons_Resource_path.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/images/ca/icons_Resource_path.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 1 month
JBoss Tools SVN: r12258 - in trunk/common/plugins/org.jboss.tools.common.el.core: src/org/jboss/tools/common/el/core/resolver and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-12-03 14:03:24 -0500 (Wed, 03 Dec 2008)
New Revision: 12258
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELOperandResolveStatus.java
Log:
JBIDE-3133 New icons for proposals in JSF/Seam Code Assist.
The icons support is added to the resolver.
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2008-12-03 18:55:59 UTC (rev 12257)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2008-12-03 19:03:24 UTC (rev 12258)
@@ -19,4 +19,5 @@
org.eclipse.wst.sse.ui,
org.jboss.tools.common,
org.jboss.tools.common.model,
- org.jboss.tools.common.resref.core;reprovide=true
+ org.jboss.tools.common.resref.core;reprovide=true,
+ org.jboss.tools.common.kb;bundle-version="2.0.0"
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELOperandResolveStatus.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELOperandResolveStatus.java 2008-12-03 18:55:59 UTC (rev 12257)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELOperandResolveStatus.java 2008-12-03 19:03:24 UTC (rev 12258)
@@ -16,6 +16,7 @@
import java.util.TreeSet;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.kb.KbProposal;
/**
* Status of EL resolving.
@@ -24,7 +25,7 @@
public class ELOperandResolveStatus {
private ELInvocationExpression tokens;
Map<String, TypeInfoCollector.MethodInfo> unpairedGettersOrSetters;
- Set<String> proposals;
+ Set<KbProposal> proposals;
private ELInvocationExpression lastResolvedToken;
private boolean isMapOrCollectionOrBundleAmoungTheTokens = false;
private TypeInfoCollector.MemberInfo memberOfResolvedOperand;
@@ -68,6 +69,7 @@
* @return true if EL is resolved.
*/
public boolean isOK() {
+// return !getProposals().isEmpty() || isMapOrCollectionOrBundleAmoungTheTokens();
return !getProposals().isEmpty() || isMapOrCollectionOrBundleAmoungTheTokens();
}
@@ -129,16 +131,17 @@
}
/**
- * @return Set of proposals for EL.
+ *
+ * @return Set of proposals for EL
*/
- public Set<String> getProposals() {
- return proposals == null ? new TreeSet<String>() : proposals;
+ public Set<KbProposal> getProposals() {
+ return proposals == null ? new TreeSet<KbProposal>() : proposals;
}
/**
- * @param proposals Set of proposals.
+ * @param proposals Set of KbProposal proposals.
*/
- public void setProposals(Set<String> proposals) {
+ public void setProposals(Set<KbProposal> proposals) {
this.proposals = proposals;
}
17 years, 1 month
JBoss Tools SVN: r12257 - trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-12-03 13:55:59 -0500 (Wed, 03 Dec 2008)
New Revision: 12257
Modified:
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbProposal.java
Log:
JBIDE-3133 New icons for proposals in JSF/Seam Code Assist.
The icons support and a set of common icons are added to the KB.
Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbProposal.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbProposal.java 2008-12-03 18:50:50 UTC (rev 12256)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbProposal.java 2008-12-03 18:55:59 UTC (rev 12257)
@@ -11,6 +11,7 @@
package org.jboss.tools.common.kb;
import java.io.Serializable;
+import java.util.Comparator;
import org.eclipse.swt.graphics.Image;
@@ -287,4 +288,29 @@
if(postProcessing != null) postProcessing.process(this, value, offset);
}
+ public static final Comparator<KbProposal> KB_PROPOSAL_ORDER
+ = new KbProposalComparator();
+
+ private static class KbProposalComparator implements Comparator<KbProposal> {
+
+ public int compare(KbProposal p1, KbProposal p2) {
+ int n1=p1.replacementString.length(), n2=p2.replacementString.length();
+ for (int i1=0, i2=0; i1<n1 && i2<n2; i1++, i2++) {
+ char c1 = p1.replacementString.charAt(i1);
+ char c2 = p2.replacementString.charAt(i2);
+ if (c1 != c2) {
+ c1 = Character.toUpperCase(c1);
+ c2 = Character.toUpperCase(c2);
+ if (c1 != c2) {
+ c1 = Character.toLowerCase(c1);
+ c2 = Character.toLowerCase(c2);
+ if (c1 != c2) {
+ return c1 - c2;
+ }
+ }
+ }
+ }
+ return n1 - n2;
+ }
+ }
}
\ No newline at end of file
17 years, 1 month
JBoss Tools SVN: r12256 - documentation/trunk/movies/seam_demo.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-12-03 13:50:50 -0500 (Wed, 03 Dec 2008)
New Revision: 12256
Modified:
documentation/trunk/movies/seam_demo/seam_demo_part1.wnk
documentation/trunk/movies/seam_demo/seam_demo_part2.wnk
Log:
https://jira.jboss.org/jira/browse/JBDS-426
time on frames is corrected, demos are speed-up a bit
Modified: documentation/trunk/movies/seam_demo/seam_demo_part1.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/seam_demo/seam_demo_part2.wnk
===================================================================
(Binary files differ)
17 years, 1 month
JBoss Tools SVN: r12255 - documentation/trunk/movies/seam_demo.
by jbosstools-commits@lists.jboss.org
Author: msorokin
Date: 2008-12-03 13:11:54 -0500 (Wed, 03 Dec 2008)
New Revision: 12255
Added:
documentation/trunk/movies/seam_demo/seam_demo_part1.wnk
Log:
The movie was corrected.
https://jira.jboss.org/jira/browse/JBDS-426
Copied: documentation/trunk/movies/seam_demo/seam_demo_part1.wnk (from rev 12219, documentation/trunk/movies/seam_demo/seam_demo_part1.wnk)
===================================================================
(Binary files differ)
17 years, 1 month
JBoss Tools SVN: r12253 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog: tabs and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: izhukov
Date: 2008-12-03 12:38:15 -0500 (Wed, 03 Dec 2008)
New Revision: 12253
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBackgroundControl.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBoxesControl.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabTextControl.java
Log:
JBIDE-3340 fixed
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java 2008-12-03 17:35:01 UTC (rev 12252)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java 2008-12-03 17:38:15 UTC (rev 12253)
@@ -194,20 +194,15 @@
((CSSStyleRule) list.item(i)).getSelectorText().equals(selector)) {
CSSStyleRule rule = (CSSStyleRule) list.item(i);
+ styleSheet.deleteRule(i);
+
+ i = styleSheet.insertRule(selector + startBraces + styleAttributes.getStyle() + endBraces, i);
+ rule = (CSSStyleRule) list.item(i);
CSSStyleDeclaration declaration = rule.getStyle();
- // previously before updating remove all existing properties
- while (declaration.getLength() > 0) {
- declaration.removeProperty(declaration.item(0));
- }
// set properties
Set<Entry<String, String>> set = styleAttributes.entrySet();
for (Map.Entry<String, String> me : set) {
-// try {
- declaration.setProperty(me.getKey(), me.getValue(), Constants.EMPTY);
-// } catch (Exception e) {
-// declaration.removeProperty(me.getKey());
-// e.printStackTrace();
-// }
+ declaration.setProperty(me.getKey(), me.getValue(), Constants.EMPTY);
}
formatProcessorCSS.formatModel(model);
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBackgroundControl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBackgroundControl.java 2008-12-03 17:35:01 UTC (rev 12252)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBackgroundControl.java 2008-12-03 17:38:15 UTC (rev 12253)
@@ -90,18 +90,10 @@
colorCombo = new ImageCombo(this, SWT.BORDER);
colorCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
colorCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String tmp = colorCombo.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- styleAttributes.addAttribute(CSSConstants.BACKGROUND_COLOR, tmp.trim());
- } else {
- styleAttributes.removeAttribute(CSSConstants.BACKGROUND_COLOR);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyAttribute(colorCombo.getText(), CSSConstants.BACKGROUND_COLOR);
+ }
+ });
Set<Entry<String, String>> set = ColorParser.getInstance().getMap().entrySet();
for (Map.Entry<String, String> me : set) {
RGB rgb = Util.getColor(me.getKey());
@@ -151,7 +143,7 @@
backgroundImageCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String tmp = backgroundImageCombo.getText();
- if (tmp != null && tmp.trim().length() > 0) {
+ if (tmp != null && !tmp.trim().equals(Constants.EMPTY)) {
tmp = adjustBackgroundURL(tmp);
styleAttributes.addAttribute(CSSConstants.BACKGROUND_IMAGE, tmp.trim());
} else {
@@ -210,15 +202,7 @@
backgroundRepeatCombo.setLayoutData(gridData);
backgroundRepeatCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
- String tmp = backgroundRepeatCombo.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- styleAttributes.addAttribute(CSSConstants.BACKGROUND_REPEAT, tmp.trim());
- } else {
- styleAttributes.removeAttribute(CSSConstants.BACKGROUND_REPEAT);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
+ modifyAttribute(backgroundRepeatCombo.getText(), CSSConstants.BACKGROUND_REPEAT);
}
});
ArrayList<String> list = comboMap.get(CSSConstants.BACKGROUND_REPEAT);
@@ -253,6 +237,23 @@
updateDataFromStyleAttributes = false;
}
+ /**
+ * Method is used to correctly process modify event occurred on specify CSS attribute control.
+ *
+ * @param attributeValue changed value of control were action takes place
+ * @param attributeName CSS name of the first parameter
+ */
+ private void modifyAttribute(String attributeValue, String attributeName) {
+ if (attributeValue != null && !attributeValue.trim().equals(Constants.EMPTY)) {
+ styleAttributes.addAttribute(attributeName, attributeValue.trim());
+ } else {
+ styleAttributes.removeAttribute(attributeName);
+ }
+ if (!updateDataFromStyleAttributes) {
+ notifyListeners();
+ }
+ }
+
// Fix for JBIDE-3084
// in css background image should always be wrapped into url(*);
private static String adjustBackgroundURL(String backgroundURL) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBoxesControl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBoxesControl.java 2008-12-03 17:35:01 UTC (rev 12252)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBoxesControl.java 2008-12-03 17:38:15 UTC (rev 12253)
@@ -102,42 +102,17 @@
widthText = new Text(this, SWT.BORDER | SWT.SINGLE);
widthText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
widthText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String tmp = widthText.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- String extWidth = extWidthCombo.getText();
- if (extWidth != null) {
- tmp += extWidth;
- }
- styleAttributes.addAttribute(CSSConstants.WIDTH, tmp);
- } else {
- styleAttributes.removeAttribute(CSSConstants.WIDTH);
- extWidthCombo.select(0);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent e) {
+ modifyAttribute(widthText.getText(), extWidthCombo, CSSConstants.WIDTH);
+ }
+ });
extWidthCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
extWidthCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
extWidthCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String width = widthText.getText();
- if (width != null && !width.trim().equals(Constants.EMPTY)) {
- String tmp = extWidthCombo.getText();
- if (tmp != null) {
- styleAttributes.addAttribute(CSSConstants.WIDTH, width + tmp);
- }
- } else {
- extWidthCombo.select(0);
- return;
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyExtAttribute(widthText.getText(), extWidthCombo, CSSConstants.WIDTH);
+ }
+ });
for (int i = 0; i < Constants.extSizes.length; i++) {
extWidthCombo.add(Constants.extSizes[i]);
}
@@ -152,42 +127,17 @@
heightText = new Text(this, SWT.BORDER | SWT.SINGLE);
heightText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
heightText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String tmp = heightText.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- String extHeight = extHeightCombo.getText();
- if (extHeight != null) {
- tmp += extHeight;
- }
- styleAttributes.addAttribute(CSSConstants.HEIGHT, tmp);
- } else {
- styleAttributes.removeAttribute(CSSConstants.HEIGHT);
- extHeightCombo.select(0);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent e) {
+ modifyAttribute(heightText.getText(), extHeightCombo, CSSConstants.HEIGHT);
+ }
+ });
extHeightCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
extHeightCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
extHeightCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String height = heightText.getText();
- if (height != null && !height.trim().equals(Constants.EMPTY)) {
- String tmp = extHeightCombo.getText();
- if (tmp != null) {
- styleAttributes.addAttribute(CSSConstants.HEIGHT, height + tmp);
- }
- } else {
- extHeightCombo.select(0);
- return;
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyExtAttribute(heightText.getText(), extHeightCombo, CSSConstants.HEIGHT);
+ }
+ });
for (int i = 0; i < Constants.extSizes.length; i++) {
extHeightCombo.add(Constants.extSizes[i]);
}
@@ -209,18 +159,10 @@
borderStyleCombo = new Combo(this, SWT.BORDER);
borderStyleCombo.setLayoutData(gridData);
borderStyleCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String tmp = borderStyleCombo.getText();
- if (tmp != null && !tmp.trim().equals(Constants.EMPTY)) {
- styleAttributes.addAttribute(CSSConstants.BORDER_STYLE, tmp.trim());
- } else {
- styleAttributes.removeAttribute(CSSConstants.BORDER_STYLE);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyAttribute(borderStyleCombo.getText(), CSSConstants.BORDER_STYLE);
+ }
+ });
list = comboMap.get(CSSConstants.BORDER_STYLE);
for (String str : list) {
borderStyleCombo.add(str);
@@ -237,18 +179,10 @@
borderColorCombo = new ImageCombo(tmpComposite, SWT.BORDER);
borderColorCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
borderColorCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String tmp = borderColorCombo.getText().trim();
- if (tmp != null && !tmp.trim().equals(Constants.EMPTY)) {
- styleAttributes.addAttribute(CSSConstants.BORDER_COLOR, tmp.trim());
- } else {
- styleAttributes.removeAttribute(CSSConstants.BORDER_COLOR);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyAttribute(borderColorCombo.getText(), CSSConstants.BORDER_COLOR);
+ }
+ });
Set<Entry<String, String>> set = ColorParser.getInstance().getMap().entrySet();
for (Map.Entry<String, String> me : set) {
RGB rgb = Util.getColor(me.getKey());
@@ -307,20 +241,7 @@
}
}
extBorderWidthCombo.setEnabled(true);
- String tmp = borderWidthCombo.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- String extBorderWidth = extBorderWidthCombo.getText();
- if (extBorderWidth != null) {
- tmp += extBorderWidth;
- }
- styleAttributes.addAttribute(CSSConstants.BORDER_WIDTH, tmp);
- } else {
- styleAttributes.removeAttribute(CSSConstants.BORDER_WIDTH);
- extBorderWidthCombo.select(0);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
+ modifyAttribute(borderWidthCombo.getText(), extBorderWidthCombo, CSSConstants.BORDER_WIDTH);
}
});
list = comboMap.get(CSSConstants.BORDER_WIDTH);
@@ -330,22 +251,10 @@
extBorderWidthCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
extBorderWidthCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
extBorderWidthCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String borderWidth = borderWidthCombo.getText();
- if (borderWidth != null && !borderWidth.trim().equals(Constants.EMPTY)) {
- String tmp = extBorderWidthCombo.getText();
- if (tmp != null) {
- styleAttributes.addAttribute(CSSConstants.BORDER_WIDTH, borderWidth + tmp);
- }
- } else {
- extBorderWidthCombo.select(0);
- return;
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyExtAttribute(borderWidthCombo.getText(), extBorderWidthCombo, CSSConstants.BORDER_WIDTH);
+ }
+ });
for (int i = 0; i < Constants.extSizes.length; i++) {
extBorderWidthCombo.add(Constants.extSizes[i]);
}
@@ -365,42 +274,18 @@
marginText = new Text(this, SWT.BORDER | SWT.SINGLE);
marginText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
marginText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String tmp = marginText.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- String extMargin = extMarginCombo.getText();
- if (extMargin != null) {
- tmp += extMargin;
- }
- styleAttributes.addAttribute(CSSConstants.MARGIN, tmp);
- } else {
- styleAttributes.removeAttribute(CSSConstants.MARGIN);
- extMarginCombo.select(0);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent e) {
+ modifyAttribute(marginText.getText(), extMarginCombo, CSSConstants.MARGIN);
+ }
+ });
+
extMarginCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
extMarginCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
extMarginCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String margin = marginText.getText();
- if (margin != null && !margin.trim().equals(Constants.EMPTY)) {
- String tmp = extMarginCombo.getText();
- if (tmp != null) {
- styleAttributes.addAttribute(CSSConstants.MARGIN, margin + tmp);
- }
- } else {
- extMarginCombo.select(0);
- return;
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyExtAttribute(marginText.getText(), extMarginCombo, CSSConstants.MARGIN);
+ }
+ });
for (int i = 0; i < Constants.extSizes.length; i++) {
extMarginCombo.add(Constants.extSizes[i]);
}
@@ -415,42 +300,17 @@
paddingText = new Text(this, SWT.BORDER | SWT.SINGLE);
paddingText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
paddingText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String tmp = paddingText.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- String extPadding = extPaddingCombo.getText();
- if (extPadding != null) {
- tmp += extPadding;
- }
- styleAttributes.addAttribute(CSSConstants.PADDING, tmp);
- } else {
- styleAttributes.removeAttribute(CSSConstants.PADDING);
- extPaddingCombo.select(0);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent e) {
+ modifyAttribute(paddingText.getText(), extPaddingCombo, CSSConstants.PADDING);
+ }
+ });
extPaddingCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
extPaddingCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
extPaddingCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String padding = paddingText.getText();
- if (padding != null && !padding.trim().equals(Constants.EMPTY)) {
- String tmp = extPaddingCombo.getText();
- if (tmp != null) {
- styleAttributes.addAttribute(CSSConstants.PADDING, padding + tmp);
- }
- } else {
- extPaddingCombo.select(0);
- return;
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyExtAttribute(paddingText.getText(), extPaddingCombo, CSSConstants.PADDING);
+ }
+ });
for (int i = 0; i < Constants.extSizes.length; i++) {
extPaddingCombo.add(Constants.extSizes[i]);
}
@@ -543,6 +403,70 @@
}
/**
+ * Method is used to correctly process modify event occurred on specify CSS attribute control.
+ *
+ * @param attributeValue changed value of control were action takes place
+ * @param extAttribute the attribute extension control that might be also affected
+ * @param attributeName CSS name of the first parameter
+ */
+ private void modifyAttribute(String attributeValue, Combo extAttribute, String attributeName) {
+ if (attributeValue != null && !attributeValue.trim().equals(Constants.EMPTY)) {
+ String extWidth = extAttribute.getText();
+ if (extWidth != null) {
+ attributeValue += extWidth;
+ }
+ styleAttributes.addAttribute(attributeName, attributeValue);
+ } else {
+ styleAttributes.removeAttribute(attributeName);
+ extAttribute.select(0);
+ }
+ if (!updateDataFromStyleAttributes) {
+ notifyListeners();
+ }
+ }
+
+ /**
+ * Method is used to correctly process modify event occurred on specify CSS extension attribute control.
+ *
+ * @param attributeValue current value of attribute control
+ * @param extAttribute the attribute extension control were action takes place
+ * @param attributeName CSS name of the first parameter
+ */
+ private void modifyExtAttribute(String attributeValue, Combo extAttribute, String attributeName) {
+ if (attributeValue != null && !attributeValue.trim().equals(Constants.EMPTY)) {
+ String tmp = extAttribute.getText();
+ if (tmp != null) {
+ styleAttributes.addAttribute(attributeName, attributeValue + tmp);
+ }
+ } else {
+ if (extAttribute.getSelectionIndex() > 0) {
+ extAttribute.select(0);
+ }
+ return;
+ }
+ if (!updateDataFromStyleAttributes) {
+ notifyListeners();
+ }
+ }
+
+ /**
+ * Method is used to correctly process modify event occurred on specify CSS attribute control.
+ *
+ * @param attributeValue changed value of control were action takes place
+ * @param attributeName CSS name of the first parameter
+ */
+ private void modifyAttribute(String attributeValue, String attributeName) {
+ if (attributeValue != null && !attributeValue.trim().equals(Constants.EMPTY)) {
+ styleAttributes.addAttribute(attributeName, attributeValue.trim());
+ } else {
+ styleAttributes.removeAttribute(attributeName);
+ }
+ if (!updateDataFromStyleAttributes) {
+ notifyListeners();
+ }
+ }
+
+ /**
* Add ManualChangeStyleListener object.
*
* @param listener ManualChangeStyleListener object to be added
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java 2008-12-03 17:35:01 UTC (rev 12252)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java 2008-12-03 17:38:15 UTC (rev 12253)
@@ -305,7 +305,9 @@
styleAttributes.addAttribute(key, tmpCombo + tmpExt);
}
} else {
- extCombo.select(0);
+ if (extCombo.getSelectionIndex() > 0) {
+ extCombo.select(0);
+ }
return;
}
if (!updateDataFromStyleAttributes) {
@@ -455,7 +457,9 @@
styleAttributes.addAttribute(key, tmpCombo + tmpExt);
}
} else {
- extCombo.select(0);
+ if (extCombo.getSelectionIndex() > 0) {
+ extCombo.select(0);
+ }
return;
}
if (!updateDataFromStyleAttributes) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabTextControl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabTextControl.java 2008-12-03 17:35:01 UTC (rev 12252)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabTextControl.java 2008-12-03 17:38:15 UTC (rev 12253)
@@ -94,19 +94,10 @@
fontFamilyText = new Text(this, SWT.BORDER | SWT.SINGLE);
fontFamilyText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
fontFamilyText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String tmp = fontFamilyText.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- styleAttributes.addAttribute(CSSConstants.FONT_FAMILY, tmp.trim());
- } else {
- styleAttributes.removeAttribute(CSSConstants.FONT_FAMILY);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
-
+ public void modifyText(ModifyEvent event) {
+ modifyAttribute(fontFamilyText.getText(), CSSConstants.FONT_FAMILY);
+ }
+ });
Button button = new Button(this, SWT.PUSH);
button.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
button.setToolTipText(JstUIMessages.FONT_FAMILY_TIP);
@@ -139,18 +130,10 @@
colorCombo = new ImageCombo(this, SWT.BORDER);
colorCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
colorCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String tmp = colorCombo.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- styleAttributes.addAttribute(CSSConstants.COLOR, tmp.trim());
- } else {
- styleAttributes.removeAttribute(CSSConstants.COLOR);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyAttribute(colorCombo.getText(), CSSConstants.COLOR);
+ }
+ });
Set<Entry<String, String>> set = ColorParser.getInstance().getMap().entrySet();
for (Map.Entry<String, String> me : set) {
RGB rgb = Util.getColor(me.getKey());
@@ -202,22 +185,10 @@
extFontSizeCombo = new Combo(tmpComposite, SWT.BORDER | SWT.READ_ONLY);
extFontSizeCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
extFontSizeCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String fontSize = fontSizeCombo.getText();
- if (fontSize != null && !fontSize.trim().equals(Constants.EMPTY)) {
- String tmp = extFontSizeCombo.getText();
- if (tmp != null) {
- styleAttributes.addAttribute(CSSConstants.FONT_SIZE, fontSize + tmp);
- }
- } else {
- extFontSizeCombo.select(0);
- return;
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyExtAttribute(fontSizeCombo.getText(), extFontSizeCombo, CSSConstants.FONT_SIZE);
+ }
+ });
for (int i = 0; i < Constants.extSizes.length; i++) {
extFontSizeCombo.add(Constants.extSizes[i]);
}
@@ -239,19 +210,7 @@
}
extFontSizeCombo.setEnabled(true);
- String tmp = fontSizeCombo.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- String extFont = extFontSizeCombo.getText();
- if (extFont != null) {
- tmp += extFont;
- }
- styleAttributes.addAttribute(CSSConstants.FONT_SIZE, tmp);
- } else {
- styleAttributes.removeAttribute(CSSConstants.FONT_SIZE);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
+ modifyAttribute(fontSizeCombo.getText(), extFontSizeCombo, CSSConstants.BORDER_WIDTH);
}
});
list = comboMap.get(CSSConstants.FONT_SIZE);
@@ -271,18 +230,10 @@
fontStyleCombo = new Combo(this, SWT.BORDER);
fontStyleCombo.setLayoutData(gridData);
fontStyleCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String tmp = fontStyleCombo.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- styleAttributes.addAttribute(CSSConstants.FONT_STYLE, tmp.trim());
- } else {
- styleAttributes.removeAttribute(CSSConstants.FONT_STYLE);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyAttribute(fontStyleCombo.getText(), CSSConstants.FONT_STYLE);
+ }
+ });
list = comboMap.get(CSSConstants.FONT_STYLE);
for (String str : list) {
fontStyleCombo.add(str);
@@ -300,18 +251,10 @@
fontWeigthCombo = new Combo(this, SWT.BORDER);
fontWeigthCombo.setLayoutData(gridData);
fontWeigthCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String tmp = fontWeigthCombo.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- styleAttributes.addAttribute(CSSConstants.FONT_WEIGHT, tmp.trim());
- } else {
- styleAttributes.removeAttribute(CSSConstants.FONT_WEIGHT);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyAttribute(fontWeigthCombo.getText(), CSSConstants.FONT_WEIGHT);
+ }
+ });
list = comboMap.get(CSSConstants.FONT_WEIGHT);
for (String str : list) {
fontWeigthCombo.add(str);
@@ -329,18 +272,10 @@
textDecorationCombo = new Combo(this, SWT.BORDER);
textDecorationCombo.setLayoutData(gridData);
textDecorationCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String tmp = textDecorationCombo.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- styleAttributes.addAttribute(CSSConstants.TEXT_DECORATION, tmp.trim());
- } else {
- styleAttributes.removeAttribute(CSSConstants.TEXT_DECORATION);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyAttribute(textDecorationCombo.getText(), CSSConstants.TEXT_DECORATION);
+ }
+ });
list = comboMap.get(CSSConstants.TEXT_DECORATION);
for (String str : list) {
textDecorationCombo.add(str);
@@ -358,18 +293,10 @@
textAlignCombo = new Combo(this, SWT.BORDER);
textAlignCombo.setLayoutData(gridData);
textAlignCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- String tmp = textAlignCombo.getText();
- if (tmp != null && tmp.trim().length() > 0) {
- styleAttributes.addAttribute(CSSConstants.TEXT_ALIGN, tmp.trim());
- } else {
- styleAttributes.removeAttribute(CSSConstants.TEXT_ALIGN);
- }
- if (!updateDataFromStyleAttributes) {
- notifyListeners();
- }
- }
- });
+ public void modifyText(ModifyEvent event) {
+ modifyAttribute(textAlignCombo.getText(), CSSConstants.TEXT_ALIGN);
+ }
+ });
list = comboMap.get(CSSConstants.TEXT_ALIGN);
for (String str : list) {
textAlignCombo.add(str);
@@ -443,6 +370,70 @@
}
/**
+ * Method is used to correctly process modify event occurred on specify CSS attribute control.
+ *
+ * @param attributeValue changed value of control were action takes place
+ * @param extAttribute the attribute extension control that might be also affected
+ * @param attributeName CSS name of the first parameter
+ */
+ private void modifyAttribute(String attributeValue, Combo extAttribute, String attributeName) {
+ if (attributeValue != null && !attributeValue.trim().equals(Constants.EMPTY)) {
+ String extWidth = extAttribute.getText();
+ if (extWidth != null) {
+ attributeValue += extWidth;
+ }
+ styleAttributes.addAttribute(attributeName, attributeValue);
+ } else {
+ styleAttributes.removeAttribute(attributeName);
+ extAttribute.select(0);
+ }
+ if (!updateDataFromStyleAttributes) {
+ notifyListeners();
+ }
+ }
+
+ /**
+ * Method is used to correctly process modify event occurred on specify CSS extension attribute control.
+ *
+ * @param attributeValue current value of attribute control
+ * @param extAttribute the attribute extension control were action takes place
+ * @param attributeName CSS name of the first parameter
+ */
+ private void modifyExtAttribute(String attributeValue, Combo extAttribute, String attributeName) {
+ if (attributeValue != null && !attributeValue.trim().equals(Constants.EMPTY)) {
+ String tmp = extAttribute.getText();
+ if (tmp != null) {
+ styleAttributes.addAttribute(attributeName, attributeValue + tmp);
+ }
+ } else {
+ if (extAttribute.getSelectionIndex() > 0) {
+ extAttribute.select(0);
+ }
+ return;
+ }
+ if (!updateDataFromStyleAttributes) {
+ notifyListeners();
+ }
+ }
+
+ /**
+ * Method is used to correctly process modify event occurred on specify CSS attribute control.
+ *
+ * @param attributeValue changed value of control were action takes place
+ * @param attributeName CSS name of the first parameter
+ */
+ private void modifyAttribute(String attributeValue, String attributeName) {
+ if (attributeValue != null && !attributeValue.trim().equals(Constants.EMPTY)) {
+ styleAttributes.addAttribute(attributeName, attributeValue.trim());
+ } else {
+ styleAttributes.removeAttribute(attributeName);
+ }
+ if (!updateDataFromStyleAttributes) {
+ notifyListeners();
+ }
+ }
+
+ /**
* Add ManualChangeStyleListener object.
*
* @param listener ManualChangeStyleListener object to be added
17 years, 1 month
JBoss Tools SVN: r12252 - documentation/trunk/movies/seam_demo.
by jbosstools-commits@lists.jboss.org
Author: msorokin
Date: 2008-12-03 12:35:01 -0500 (Wed, 03 Dec 2008)
New Revision: 12252
Removed:
documentation/trunk/movies/seam_demo/seam_demo_part1.wnk
Log:
The demo was corrected
Deleted: documentation/trunk/movies/seam_demo/seam_demo_part1.wnk
===================================================================
(Binary files differ)
17 years, 1 month
JBoss Tools SVN: r12251 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog: common and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: izhukov
Date: 2008-12-03 10:01:57 -0500 (Wed, 03 Dec 2008)
New Revision: 12251
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabPreviewControl.java
Log:
JBIDE-3328 fixed
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java 2008-12-03 14:48:09 UTC (rev 12250)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java 2008-12-03 15:01:57 UTC (rev 12251)
@@ -555,10 +555,7 @@
styleComposite.revertPreview();
updateStyleComposite();
styleAttributes.setCssSelector(currentClassStyle);
- if (currentClassStyle != null && !currentClassStyle.equals(Constants.EMPTY)) {
-// cssModel.setCSS(currentClassStyle, styleAttributes);
- styleComposite.updatePreview();
- }
+ styleComposite.updatePreview(currentClassStyle);
updateOKButtonState();
} else {
currentClassStyle = classCombo.getText().trim();
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java 2008-12-03 14:48:09 UTC (rev 12250)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java 2008-12-03 15:01:57 UTC (rev 12251)
@@ -25,6 +25,7 @@
import org.eclipse.swt.widgets.TabItem;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSModel;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
import org.jboss.tools.jst.jsp.outline.cssdialog.events.ManualChangeStyleListener;
import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.BaseListener;
@@ -444,11 +445,13 @@
/**
* Method is used to update preview selection area.
+ *
+ * @param selector CSS selector
*/
- public void updatePreview() {
+ public void updatePreview(String selector) {
if (tabPreviewControl != null && lastSelectedTab == tabPreview) {
- cssModel.setCSS(styleAttributes.getCssSelector(), styleAttributes);
- tabPreviewControl.selectEditorArea(styleAttributes.getCssSelector(), 0);
+ cssModel.setCSS(selector, styleAttributes);
+ tabPreviewControl.selectEditorArea(selector, 0);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java 2008-12-03 14:48:09 UTC (rev 12250)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java 2008-12-03 15:01:57 UTC (rev 12251)
@@ -184,7 +184,7 @@
* @param styleAttribute the style to be set
*/
public void setCSS(String selector, StyleAttributes styleAttributes) {
- if (styleSheet != null) {
+ if (styleSheet != null && selector != null && !selector.equals(Constants.EMPTY)) {
CSSRuleList list = styleSheet.getCssRules();
if (list != null) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabPreviewControl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabPreviewControl.java 2008-12-03 14:48:09 UTC (rev 12250)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabPreviewControl.java 2008-12-03 15:01:57 UTC (rev 12251)
@@ -105,8 +105,12 @@
public void selectEditorArea(String selector, int index) {
if (cssModel != null) {
IndexedRegion indexedRegion = cssModel.getSelectorRegion(selector, index);
- if (editor != null && indexedRegion != null) {
- editor.selectAndReveal(indexedRegion.getStartOffset(), indexedRegion.getLength());
+ if (editor != null) {
+ if (indexedRegion != null) {
+ editor.selectAndReveal(indexedRegion.getStartOffset(), indexedRegion.getLength());
+ } else {
+ editor.selectAndReveal(0, 0);
+ }
}
}
}
17 years, 1 month