Author: izhukov
Date: 2008-11-11 10:46:29 -0500 (Tue, 11 Nov 2008)
New Revision: 11678
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/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/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/TabPropertySheetControl.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:
https://jira.jboss.org/jira/browse/JBIDE-3151 fixed
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties 2008-11-11
15:39:10 UTC (rev 11677)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties 2008-11-11
15:46:29 UTC (rev 11678)
@@ -4,8 +4,8 @@
CSS_STYLE_CLASS_DIALOG_TITLE=CSS Style Class Dialog
-CSS_CLASS_DIALOG_FILE_LABEL=CSS file :
-CSS_CLASS_DIALOG_STYLE_CLASS_LABEL=Style class :
+CSS_CLASS_DIALOG_FILE_LABEL=CSS file:
+CSS_CLASS_DIALOG_STYLE_CLASS_LABEL=Style class:
CSS_BROWSE_BUTTON_TOOLTIP=Browse
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-11-11
15:39:10 UTC (rev 11677)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java 2008-11-11
15:46:29 UTC (rev 11678)
@@ -194,6 +194,7 @@
gridData.horizontalSpan = 2;
classCombo = new Combo(classComposite, SWT.BORDER);
classCombo.setLayoutData(gridData);
+
classCombo.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
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-11-11
15:39:10 UTC (rev 11677)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java 2008-11-11
15:46:29 UTC (rev 11678)
@@ -52,10 +52,12 @@
private static String NODE_NAME_VALUE = "value";
private static String NODE_NAME_ELEMENT = "element";
private static String NODE_ATTRIBUTE_NAME = "name";
+
private static int TAB_TEXT_FONT_NUMBER = 0;
private static int TAB_QUICK_EDIT_NUMBER = 4;
private static int FIRST_SELECTION = 0;
private static int SIZE_NULL = 0;
+
private String newStyle;
private String oldStyle;
private TabTextControl tabTextControl;
@@ -131,7 +133,6 @@
tabTextControl = new TabTextControl(sc, comboMap, styleAttributes);
sc.setContent(tabTextControl);
-
sc.setMinSize(tabTextControl.computeSize(SWT.DEFAULT, SWT.DEFAULT));
return sc;
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-11-11
15:39:10 UTC (rev 11677)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBackgroundControl.java 2008-11-11
15:46:29 UTC (rev 11678)
@@ -10,11 +10,15 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.outline.cssdialog.tabs;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-
import org.eclipse.jface.resource.ImageDescriptor;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@@ -31,10 +35,8 @@
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
-
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
import org.jboss.tools.jst.jsp.outline.cssdialog.ImageSelectionDialog;
@@ -45,13 +47,7 @@
import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.ColorParser;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
/**
* Class for creating control in Background tab
*
@@ -67,6 +63,12 @@
//TODO Dzmitry Sakovich
//private CSSDialog cssDialog;
+
+ /**
+ * Constructor for creating controls
+ *
+ * @param composite Composite element
+ */
public TabBackgroundControl(final Composite composite, HashMap<String,
ArrayList<String>> comboMap,
final StyleAttributes styleAttributes) {
super(composite, SWT.NONE);
@@ -78,6 +80,9 @@
gridLayout.numColumns = numColumns;
setLayout(gridLayout);
+ //
=====================================================================================
+ // Add BACKGROUND_COLOR element
+ //
=====================================================================================
Label label = new Label(this, SWT.LEFT);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
label.setText(JstUIMessages.BACKGROUND_COLOR);
@@ -85,14 +90,6 @@
colorCombo = new ImageCombo(this, SWT.BORDER);
colorCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
- // ////////////////////////////////////////////////////////////////////////
- Set<Entry<String, String>> set =
ColorParser.getInstance().getMap().entrySet();
-
- for (Map.Entry<String, String> me : set) {
- RGB rgb = Util.getColor(me.getKey());
- colorCombo.add(me.getValue(), rgb);
- }
-
colorCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String tmp = colorCombo.getText();
@@ -107,6 +104,11 @@
//cssDialog.setStyleForPreview();
}
});
+ Set<Entry<String, String>> set =
ColorParser.getInstance().getMap().entrySet();
+ for (Map.Entry<String, String> me : set) {
+ RGB rgb = Util.getColor(me.getKey());
+ colorCombo.add(me.getValue(), rgb);
+ }
Button button = new Button(this, SWT.PUSH);
button.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
@@ -138,6 +140,9 @@
}
});
+ //
=====================================================================================
+ // Add BACKGROUND_IMAGE element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
label.setText(JstUIMessages.BACKGROUND_IMAGE);
@@ -199,12 +204,17 @@
}
});
+ //
=====================================================================================
+ // Add BACKGROUND_REPEAT element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
label.setText(JstUIMessages.BACKGROUND_REPEAT);
+ GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ gridData.horizontalSpan = 2;
backgroundRepeatCombo = new Combo(this, SWT.BORDER);
- backgroundRepeatCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
false, false));
+ backgroundRepeatCombo.setLayoutData(gridData);
backgroundRepeatCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
@@ -221,14 +231,10 @@
//cssDialog.setStyleForPreview();
}
});
-
ArrayList<String> list = comboMap.get(CSSConstants.BACKGROUND_REPEAT);
for (String str : list) {
backgroundRepeatCombo.add(str);
}
- label = new Label(this, SWT.LEFT);
- label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
- label.setText(Constants.EMPTY);
}
/**
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-11-11
15:39:10 UTC (rev 11677)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBoxesControl.java 2008-11-11
15:46:29 UTC (rev 11678)
@@ -91,15 +91,22 @@
Label label = new Label(this, SWT.NONE);
label.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false,
false, 3, 1));
-
label.setFont(JFaceResources.getFontRegistry().get(JFaceResources.BANNER_FONT));
label.setText(JstUIMessages.DIMENSION_TITLE);
+
+ //
=====================================================================================
+ // Add WIDTH element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
- label.setText(JstUIMessages.WIDTH);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
+ label.setText(JstUIMessages.WIDTH);
widthText = new Text(this, SWT.BORDER | SWT.SINGLE);
+ widthText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
+ extWidthCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
+ extWidthCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
+
widthText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String tmp = widthText.getText();
@@ -124,25 +131,16 @@
// cssDialog.setStyleForPreview();
}
});
-
- widthText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
-
- extWidthCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
-
extWidthCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String width = widthText.getText().trim();
-
if (width == null) {
return;
}
-
if (width.equals(Constants.EMPTY)) {
return;
}
-
String tmp = extWidthCombo.getText();
-
if (tmp != null) {
styleAttributes.addAttribute(CSSConstants.WIDTH, width + tmp);
@@ -151,27 +149,29 @@
}
}
});
-
- extWidthCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
-
for (int i = 0; i < Constants.extSizes.length; i++) {
extWidthCombo.add(Constants.extSizes[i]);
}
+ //
=====================================================================================
+ // Add HEIGHT element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
- label.setText(JstUIMessages.HEIGHT);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
+ label.setText(JstUIMessages.HEIGHT);
heightText = new Text(this, SWT.BORDER | SWT.SINGLE);
+ heightText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
+ extHeightCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
+ extHeightCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
+
heightText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String tmp = heightText.getText();
-
if (tmp != null) {
if (tmp.trim().length() > 0) {
String extHeight = extHeightCombo.getText().trim();
-
if (extHeight != null) {
styleAttributes.addAttribute(CSSConstants.HEIGHT, tmp +
extHeight);
} else {
@@ -188,36 +188,23 @@
// cssDialog.setStyleForPreview();
}
});
-
- heightText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
-
- extHeightCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
-
extHeightCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String height = heightText.getText().trim();
-
if (height == null) {
return;
}
-
if (height.equals(Constants.EMPTY)) {
return;
}
-
String tmp = extHeightCombo.getText();
-
if (tmp != null) {
styleAttributes.addAttribute(CSSConstants.HEIGHT, height + tmp);
-
// TODO Dzmitry Sakovich
// cssDialog.setStyleForPreview();
}
}
});
-
- extHeightCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
-
for (int i = 0; i < Constants.extSizes.length; i++) {
extHeightCombo.add(Constants.extSizes[i]);
}
@@ -227,81 +214,73 @@
label.setFont(JFaceResources.getFontRegistry().get(JFaceResources.BANNER_FONT));
label.setText(JstUIMessages.BORDER_TITLE);
+ //
=====================================================================================
+ // Add BORDER_STYLE element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
label.setText(JstUIMessages.BORDER_STYLE);
+ GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ gridData.horizontalSpan = 2;
borderStyleCombo = new Combo(this, SWT.BORDER);
+ borderStyleCombo.setLayoutData(gridData);
borderStyleCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String tmp = borderStyleCombo.getText().trim();
-
if (tmp != null) {
if (!tmp.equals(Constants.EMPTY)) {
styleAttributes.addAttribute(CSSConstants.BORDER_STYLE,
tmp);
-
// TODO Dzmitry Sakovich
// cssDialog.setStyleForPreview();
return;
}
}
-
styleAttributes.removeAttribute(CSSConstants.BORDER_STYLE);
-
// TODO Dzmitry Sakovich
// cssDialog.setStyleForPreview();
}
});
-
- borderStyleCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
false, false));
list = comboMap.get(CSSConstants.BORDER_STYLE);
-
for (String str : list) {
borderStyleCombo.add(str);
}
+ //
=====================================================================================
+ // Add BORDER_COLOR element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
- label.setText(Constants.EMPTY);
-
- label = new Label(this, SWT.LEFT);
- label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
label.setText(JstUIMessages.BORDER_COLOR);
- borderColorCombo = new ImageCombo(this, SWT.BORDER);
+ Composite tmpComposite = getCompositeElement();
+ 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) {
if (!tmp.equals(Constants.EMPTY)) {
styleAttributes.addAttribute(CSSConstants.BORDER_COLOR,
tmp);
-
// TODO Dzmitry Sakovich
// cssDialog.setStyleForPreview();
return;
}
}
-
styleAttributes.removeAttribute(CSSConstants.BORDER_COLOR);
-
// TODO Dzmitry Sakovich
// cssDialog.setStyleForPreview();
}
});
-
- borderColorCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
-
Set<Entry<String, String>> set =
ColorParser.getInstance().getMap().entrySet();
-
for (Map.Entry<String, String> me : set) {
RGB rgb = Util.getColor(me.getKey());
borderColorCombo.add(me.getValue(), rgb);
}
- final Button button = new Button(this, SWT.PUSH);
+ final Button button = new Button(tmpComposite, SWT.PUSH);
button.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
button.setToolTipText(JstUIMessages.BORDER_COLOR_TIP);
@@ -317,13 +296,11 @@
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
ColorDialog dlg = new ColorDialog(getShell());
-
dlg.setRGB((Util.getColor((borderColorCombo.getText().trim())) ==
null)
? Constants.RGB_BLACK :
Util.getColor((borderColorCombo.getText().trim())));
dlg.setText(JstUIMessages.COLOR_DIALOG_TITLE);
RGB rgb = dlg.open();
-
if (rgb != null) {
String colorStr = Util.createColorString(rgb);
borderColorCombo.setText(colorStr);
@@ -331,24 +308,28 @@
}
});
+ //
=====================================================================================
+ // Add BORDER_WIDTH element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
- label.setText(JstUIMessages.BORDER_WIDTH);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
+ label.setText(JstUIMessages.BORDER_WIDTH);
borderWidthCombo = new Combo(this, SWT.BORDER | SWT.SINGLE);
+ borderWidthCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
+ extBorderWidthCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
+ extBorderWidthCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
false, false));
+
borderWidthCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String currentText = borderWidthCombo.getText();
-
list = comboMap.get(CSSConstants.BORDER_WIDTH);
-
for (String str : list) {
if (currentText.equals(str)) {
extBorderWidthCombo.select(0);
extBorderWidthCombo.setEnabled(false);
styleAttributes.addAttribute(CSSConstants.BORDER_WIDTH,
currentText);
-
// TODO Dzmitry Sakovich
// cssDialog.setStyleForPreview();
return;
@@ -358,7 +339,6 @@
extBorderWidthCombo.setEnabled(true);
String tmp = borderWidthCombo.getText();
-
if (tmp != null) {
if (tmp.trim().length() > 0) {
String extBorderWidth =
extBorderWidthCombo.getText().trim();
@@ -375,81 +355,53 @@
} else {
styleAttributes.removeAttribute(CSSConstants.BORDER_WIDTH);
}
-
// TODO Dzmitry Sakovich
// cssDialog.setStyleForPreview();
}
});
-
- borderWidthCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
-
list = comboMap.get(CSSConstants.BORDER_WIDTH);
-
for (String str : list) {
borderWidthCombo.add(str);
}
-
- extBorderWidthCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
-
extBorderWidthCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String borderWidth = borderWidthCombo.getText().trim();
-
if (borderWidth == null) {
return;
}
-
if (borderWidth.equals(Constants.EMPTY)) {
return;
}
-
String tmp = extBorderWidthCombo.getText();
-
if (tmp != null) {
styleAttributes.addAttribute(CSSConstants.BORDER_WIDTH,
borderWidth + tmp);
-
// TODO Dzmitry Sakovich
// cssDialog.setStyleForPreview();
}
}
});
-
- extBorderWidthCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
false, false));
-
for (int i = 0; i < Constants.extSizes.length; i++) {
extBorderWidthCombo.add(Constants.extSizes[i]);
}
- borderWidthCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- String currentText = borderWidthCombo.getText();
-
- list = comboMap.get(CSSConstants.BORDER_WIDTH);
-
- for (String str : list) {
- if (currentText.equals(str)) {
- extBorderWidthCombo.select(0);
- extBorderWidthCombo.setEnabled(false);
-
- return;
- }
-
- extBorderWidthCombo.setEnabled(true);
- }
- }
- });
-
label = new Label(this, SWT.NONE);
label.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false,
false, 3, 1));
label.setFont(JFaceResources.getFontRegistry().get(JFaceResources.BANNER_FONT));
label.setText(JstUIMessages.MARGIN_PADDING_TITLE);
+ //
=====================================================================================
+ // Add MARGIN element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
- label.setText(JstUIMessages.MARGIN);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
+ label.setText(JstUIMessages.MARGIN);
marginText = new Text(this, SWT.BORDER | SWT.SINGLE);
+ marginText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
+ extMarginCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
+ extMarginCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
+
marginText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String tmp = marginText.getText();
@@ -474,11 +426,6 @@
// cssDialog.setStyleForPreview();
}
});
-
- marginText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
-
- extMarginCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
-
extMarginCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String margin = marginText.getText().trim();
@@ -501,19 +448,23 @@
}
}
});
-
- extMarginCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
-
for (int i = 0; i < Constants.extSizes.length; i++) {
extMarginCombo.add(Constants.extSizes[i]);
}
+ //
=====================================================================================
+ // Add PADDING element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
- label.setText(JstUIMessages.PADDING);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
+ label.setText(JstUIMessages.PADDING);
paddingText = new Text(this, SWT.BORDER | SWT.SINGLE);
+ paddingText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
+ extPaddingCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
+ extPaddingCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
+
paddingText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String tmp = paddingText.getText();
@@ -538,11 +489,6 @@
// cssDialog.setStyleForPreview();
}
});
-
- paddingText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
-
- extPaddingCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
-
extPaddingCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String padding = paddingText.getText().trim();
@@ -565,15 +511,28 @@
}
}
});
-
- extPaddingCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
-
for (int i = 0; i < Constants.extSizes.length; i++) {
extPaddingCombo.add(Constants.extSizes[i]);
}
}
/**
+ * Create container that take up 2 cells and contains fontSizeCombo and
extFontSizeCombo elements.
+ */
+ private Composite getCompositeElement() {
+ GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ gridData.horizontalSpan = 2;
+ GridLayout gridLayoutTmp = new GridLayout(2, false);
+ gridLayoutTmp.marginHeight = 0;
+ gridLayoutTmp.marginWidth = 0;
+ Composite classComposite = new Composite(this, SWT.CENTER);
+ classComposite.setLayoutData(gridData);
+ classComposite.setLayout(gridLayoutTmp);
+
+ return classComposite;
+ }
+
+ /**
* Method for get data in controls (if param equal true ), or set data (if
* param equal false).
*
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabPropertySheetControl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabPropertySheetControl.java 2008-11-11
15:39:10 UTC (rev 11677)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabPropertySheetControl.java 2008-11-11
15:46:29 UTC (rev 11678)
@@ -1,191 +1,173 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.outline.cssdialog.tabs;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Set;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
-import org.jboss.tools.jst.jsp.outline.cssdialog.events.TabPropertySheetMouseAdapter;
-
-/**
- *
- * Class for creating Property sheet tab
- *
- * @author Evgeny Zheleznyakov
- *
- */
-public class TabPropertySheetControl extends Composite {
-
- private String columns[] = new String[] { "Attribute", "Value"
};
-
- private Tree tree;
-
- private StyleAttributes styleAttributes;
-
- /**
- * Constructor for creating controls
- *
- * @param composite
- * The parent composite for tab
- */
- public TabPropertySheetControl(TabFolder tabFolder,
- HashMap<String, ArrayList<String>> elementMap,
- HashMap<String, ArrayList<String>> comboMap,
- StyleAttributes styleAttributes) {
- super(tabFolder, SWT.NONE);
-
- this.styleAttributes = styleAttributes;
-
- setLayout(new FillLayout());
-
- tree = new Tree(this, SWT.NONE);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
-
- // Create NUM columns
- for (int i = 0; i < columns.length; i++) {
- TreeColumn column = new TreeColumn(tree, SWT.LEFT | SWT.COLOR_BLACK);
- column.setText(columns[i]);
- }
-
- Set<String> set = elementMap.keySet();
-
- for (String str : set) {
-
- TreeItem item = new TreeItem(tree, SWT.NONE);
- item.setText(str);
- item.setFont(Constants.FIRST_COLUMN, JFaceResources
- .getFontRegistry().get(JFaceResources.TEXT_FONT));
- ArrayList<String> list = elementMap.get(str);
-
- for (String strList : list) {
-
- TreeItem subItem = new TreeItem(item, SWT.NONE);
- subItem.setText(Constants.FIRST_COLUMN, strList);
- }
- }
- updateData(false);
-
- tree.addMouseListener(new TabPropertySheetMouseAdapter(tree,
- elementMap, comboMap, this));
-
- for (int i = 0; i < tree.getColumnCount(); i++)
- tree.getColumn(i).pack();
- }
-
- /**
- * Method for get data in controls (if param equal true ), or set data (if
- * param equal false).
- *
- * @param update
- */
- public void updateData(boolean update) {
- if (update) {
-
- for (int i = 0; i < tree.getItemCount(); i++) {
- for (int j = 0; j < tree.getItem(i).getItemCount(); j++) {
- if (tree.getItem(i).getItem(j).getText(
- Constants.SECOND_COLUMN) == null) {
- styleAttributes.removeAttribute(tree.getItem(i).getItem(j)
- .getText(Constants.FIRST_COLUMN));
- } else if (tree.getItem(i).getItem(j).getText(
- Constants.SECOND_COLUMN).trim().equals(
- Constants.EMPTY)) {
- styleAttributes.removeAttribute(tree.getItem(i).getItem(j)
- .getText(Constants.FIRST_COLUMN));
- } else {
- styleAttributes.addAttribute(tree.getItem(i).getItem(j).getText(
- Constants.FIRST_COLUMN), tree.getItem(i)
- .getItem(j).getText(Constants.SECOND_COLUMN));
- }
- }
- }
- } else {
-
- for (int i = 0; i < tree.getItemCount(); i++)
- for (int j = 0; j < tree.getItem(i).getItemCount(); j++)
- tree.getItem(i).getItem(j).setText(Constants.SECOND_COLUMN,
- Constants.EMPTY);
-
- Set<String> set = styleAttributes.keySet();
- for (String str : set) {
-
- for (int i = 0; i < tree.getItemCount(); i++)
- for (int j = 0; j < tree.getItem(i).getItemCount(); j++)
- if (tree.getItem(i).getItem(j).getText(
- Constants.FIRST_COLUMN).equals(str))
- tree.getItem(i).getItem(j).setText(
- Constants.SECOND_COLUMN,
- styleAttributes.getAttribute(str));
- }
- setExpanded();
- }
- }
-
- /**
- *
- * Set expanded item for not empty css attributes
- */
- private void setExpanded() {
-
- TreeItem item = null;
-
- for (int i = 0; i < tree.getItemCount(); i++)
- tree.getItem(i).setExpanded(false);
-
- Set<String> set = styleAttributes.keySet();
-
- for (String attr : set)
- if ((item = find(attr)) != null) {
- item.setExpanded(true);
- }
-
- for (int i = 0; i < tree.getColumnCount(); i++)
- tree.getColumn(i).pack();
- }
-
- /**
- *
- * Find tree item for expand
- *
- * @param attr
- * Name of css attributes
- * @return Tree item which will expand
- */
- private TreeItem find(String attr) {
-
- TreeItem item = null;
- TreeItem subItem = null;
-
- for (int i = 0; i < tree.getItemCount(); i++) {
-
- item = tree.getItem(i);
- for (int j = 0; j < item.getItemCount(); j++) {
-
- subItem = item.getItem(j);
- if (subItem.getText().equals(attr))
- return item;
- }
- }
- return null;
- }
-}
\ No newline at end of file
+/*******************************************************************************
+ * Copyright (c) 2007 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.outline.cssdialog.tabs;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Set;
+
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.TabPropertySheetMouseAdapter;
+
+/**
+ * Class for creating Property sheet tab
+ *
+ * @author Evgeny Zheleznyakov
+ */
+public class TabPropertySheetControl extends Composite {
+
+ private String[] columns = new String[] { "Attribute", "Value" };
+ private Tree tree;
+ private StyleAttributes styleAttributes;
+
+ /**
+ * Constructor for creating controls
+ *
+ * @param composite The parent composite for tab
+ */
+ public TabPropertySheetControl(TabFolder tabFolder, HashMap<String,
ArrayList<String>> elementMap,
+ HashMap<String, ArrayList<String>> comboMap, StyleAttributes
styleAttributes) {
+ super(tabFolder, SWT.NONE);
+ this.styleAttributes = styleAttributes;
+ setLayout(new FillLayout());
+
+ tree = new Tree(this, SWT.NONE);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+
+ // Create NUM columns
+ for (int i = 0; i < columns.length; i++) {
+ TreeColumn column = new TreeColumn(tree, SWT.LEFT | SWT.COLOR_BLACK);
+ column.setText(columns[i]);
+ }
+
+ Set<String> set = elementMap.keySet();
+ for (String str : set) {
+ TreeItem item = new TreeItem(tree, SWT.NONE);
+ item.setText(str);
+ item.setFont(Constants.FIRST_COLUMN,
JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
+
+ ArrayList<String> list = elementMap.get(str);
+
+ for (String strList : list) {
+ TreeItem subItem = new TreeItem(item, SWT.NONE);
+ subItem.setText(Constants.FIRST_COLUMN, strList);
+ }
+ }
+
+ updateData(false);
+
+ tree.addMouseListener(new TabPropertySheetMouseAdapter(tree, elementMap,
comboMap, this));
+
+ for (int i = 0; i < tree.getColumnCount(); i++) {
+ tree.getColumn(i).pack();
+ }
+ }
+
+ /**
+ * Method for get data in controls (if param equal true ), or set data (if param
equal false).
+ *
+ * @param update
+ */
+ public void updateData(boolean update) {
+ if (update) {
+ for (int i = 0; i < tree.getItemCount(); i++) {
+ for (int j = 0; j < tree.getItem(i).getItemCount(); j++) {
+ if (tree.getItem(i).getItem(j).getText(Constants.SECOND_COLUMN) ==
null) {
+ styleAttributes.removeAttribute(tree.getItem(i).getItem(j)
+
.getText(Constants.FIRST_COLUMN));
+ } else if
(tree.getItem(i).getItem(j).getText(Constants.SECOND_COLUMN).trim()
+ .equals(Constants.EMPTY)) {
+ styleAttributes.removeAttribute(tree.getItem(i).getItem(j)
+
.getText(Constants.FIRST_COLUMN));
+ } else {
+ styleAttributes.addAttribute(tree.getItem(i).getItem(j)
+
.getText(Constants.FIRST_COLUMN),
+
tree.getItem(i).getItem(j).getText(Constants.SECOND_COLUMN));
+ }
+ }
+ }
+ } else {
+ for (int i = 0; i < tree.getItemCount(); i++)
+ for (int j = 0; j < tree.getItem(i).getItemCount(); j++)
+ tree.getItem(i).getItem(j).setText(Constants.SECOND_COLUMN,
Constants.EMPTY);
+
+ Set<String> set = styleAttributes.keySet();
+ for (String str : set) {
+ for (int i = 0; i < tree.getItemCount(); i++) {
+ for (int j = 0; j < tree.getItem(i).getItemCount(); j++) {
+ if
(tree.getItem(i).getItem(j).getText(Constants.FIRST_COLUMN).equals(str)) {
+ tree.getItem(i).getItem(j)
+ .setText(Constants.SECOND_COLUMN,
styleAttributes.getAttribute(str));
+ }
+ }
+ }
+ }
+ setExpanded();
+ }
+ }
+
+ /**
+ * Set expanded item for not empty css attributes.
+ */
+ private void setExpanded() {
+ TreeItem item = null;
+
+ for (int i = 0; i < tree.getItemCount(); i++) {
+ tree.getItem(i).setExpanded(false);
+ }
+
+ Set<String> set = styleAttributes.keySet();
+ for (String attr : set) {
+ if ((item = find(attr)) != null) {
+ item.setExpanded(true);
+ }
+ }
+
+ for (int i = 0; i < tree.getColumnCount(); i++) {
+ tree.getColumn(i).pack();
+ }
+ }
+
+ /**
+ * Find tree item for expand
+ *
+ * @param attr Name of css attributes
+ * @return Tree item which will expand
+ */
+ private TreeItem find(String attr) {
+ TreeItem item = null;
+ TreeItem subItem = null;
+
+ for (int i = 0; i < tree.getItemCount(); i++) {
+ item = tree.getItem(i);
+
+ for (int j = 0; j < item.getItemCount(); j++) {
+ subItem = item.getItem(j);
+
+ if (subItem.getText().equals(attr)) {
+ return item;
+ }
+ }
+ }
+
+ return null;
+ }
+}
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-11-11
15:39:10 UTC (rev 11677)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java 2008-11-11
15:46:29 UTC (rev 11678)
@@ -54,7 +54,6 @@
import java.util.HashMap;
import java.util.StringTokenizer;
-
/**
* Class for creating control in Quick edit tab
*
@@ -73,7 +72,6 @@
//TODO Dzmitry Sakovich
//private CSSDialog dialog;
-
/**
* Constructor for creating controls
*
@@ -93,25 +91,26 @@
setLayout(gridLayout);
ArrayList<String> listKeys = new ArrayList<String>();
-
- for (String key : styleAttributes.keySet())
+ for (String key : styleAttributes.keySet()) {
listKeys.add(key);
-
+ }
Collections.sort(listKeys);
-
for (String key : listKeys) {
label = new Label(this, SWT.LEFT);
label.setText(format(key));
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false,
false));
if (comboMap.keySet().contains(key)) {
- createCombo(this, key, styleAttributes.getAttribute(key));
+ createCombo(key, styleAttributes.getAttribute(key));
} else {
- createText(this, key, styleAttributes.getAttribute(key));
+ createText(key, styleAttributes.getAttribute(key));
}
}
}
+ /**
+ * Update data method.
+ */
public void updateData() {
Control[] controls = this.getChildren();
@@ -124,21 +123,20 @@
}
ArrayList<String> listKeys = new ArrayList<String>();
-
- for (String key : styleAttributes.keySet())
+ for (String key : styleAttributes.keySet()) {
listKeys.add(key);
+ }
Collections.sort(listKeys);
-
for (String key : listKeys) {
label = new Label(this, SWT.LEFT);
label.setText(format(key));
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false,
false));
if (comboMap.keySet().contains(key)) {
- createCombo(this, key, styleAttributes.getAttribute(key));
+ createCombo(key, styleAttributes.getAttribute(key));
} else {
- createText(this, key, styleAttributes.getAttribute(key));
+ createText(key, styleAttributes.getAttribute(key));
}
}
@@ -146,25 +144,23 @@
}
/**
- * Method for creating combo controls
+ * Method for creating combo controls.
*
- * @param composite
- * The parent composite for tab
- * @param name
- * Name of css element
- * @param value
- * Value of css element
+ * @param composite The parent composite for tab
+ * @param name Name of css element
+ * @param value Value of css element
*/
- private void createCombo(final Composite composite, final String name, final String
value) {
+ private void createCombo(final String name, final String value) {
Button btn = null;
+ // if css attribute with color combo
+ if (name.indexOf(CSSConstants.COLOR) != Constants.DONT_CONTAIN) {
+ Composite tmpComposite = getCompositeElement();
- //if css attribute with color combo
- if (name.indexOf(CSSConstants.COLOR) != Constants.DONT_CONTAIN) {
- final ImageCombo colorCombo = new ImageCombo(composite, SWT.BORDER);
+ final ImageCombo colorCombo = new ImageCombo(tmpComposite, SWT.BORDER);
colorCombo.setText(value);
colorCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
- btn = new Button(composite, SWT.NONE);
+ btn = new Button(tmpComposite, SWT.NONE);
btn.setLayoutData(new GridData(GridData.END, GridData.CENTER, false,
false));
ImageDescriptor imageDes =
JspEditorPlugin.getImageDescriptor(Constants.IMAGE_COLOR_FILE_LOCATION);
@@ -185,7 +181,7 @@
startRgb = Constants.RGB_BLACK;
}
- ColorDialog colorDialog = new ColorDialog(composite.getShell());
+ ColorDialog colorDialog = new ColorDialog(getShell());
colorDialog.setRGB(startRgb);
colorDialog.setText(JstUIMessages.COLOR_DIALOG_TITLE);
@@ -223,16 +219,18 @@
}
if (btn == null) {
- new Label(composite, SWT.NONE);
+ new Label(this, SWT.NONE);
}
colorCombo.setText(value);
//if css attribute contain choose_folder button
} else if (Util.containFolder(name)) {
- final Combo combo = new Combo(composite, SWT.NONE);
+ Composite tmpComposite = getCompositeElement();
+
+ final Combo combo = new Combo(tmpComposite, SWT.NONE);
combo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
- btn = new Button(composite, SWT.NONE);
+ btn = new Button(tmpComposite, SWT.NONE);
btn.setLayoutData(new GridData(GridData.END, GridData.CENTER, false,
false));
ImageDescriptor imageDes =
JspEditorPlugin.getImageDescriptor(Constants.IMAGE_FOLDER_FILE_LOCATION);
@@ -247,14 +245,14 @@
btn.setToolTipText(JstUIMessages.COLOR_DIALOG_TITLE);
ArrayList<String> list = comboMap.get(name);
-
- for (String str : list)
+ for (String str : list) {
combo.add(str);
+ }
btn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
IProject project = Util.getCurrentProject();
- ImageSelectionDialog dialog = new
ImageSelectionDialog(composite.getShell(),
+ ImageSelectionDialog dialog = new
ImageSelectionDialog(getShell(),
new WorkbenchLabelProvider(), new
WorkbenchContentProvider());
String title = JstUIMessages.IMAGE_DIALOG_TITLE;
dialog.setTitle(title);
@@ -286,26 +284,29 @@
}
});
} else {
- final Combo combo = new Combo(composite, SWT.CENTER);
- combo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
+ final Combo combo = new Combo(this, SWT.CENTER);
+ GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true,
false);
+ if (!Util.searchInExtElement(name)) {
+ gridData.horizontalSpan = 2;
+ }
+ combo.setLayoutData(gridData);
ArrayList<String> list = comboMap.get(name);
-
- for (String str : list)
+ for (String str : list) {
combo.add(str);
-
+ }
final Combo extCombo;
String[] values = null;
boolean ext = false;
-
if (Util.searchInExtElement(name)) {
ext = true;
values = Util.convertExtString(value);
- extCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
+ extCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
extCombo.setLayoutData(new GridData(GridData.END, GridData.CENTER, false,
false));
- for (int i = 0; i < Constants.extSizes.length; i++)
+ for (int i = 0; i < Constants.extSizes.length; i++) {
extCombo.add(Constants.extSizes[i]);
+ }
extCombo.select(extCombo.indexOf(values[EXT_VALUE_NUMBER]));
@@ -351,7 +352,6 @@
extCombo.setEnabled(true);
String tmp = combo.getText().trim();
-
if (tmp != null) {
if (!tmp.equals(Constants.EMPTY)) {
String extTmp = extCombo.getText().trim();
@@ -372,11 +372,9 @@
}
});
} else {
- new Label(composite, SWT.NONE).setLayoutData(new GridData(GridData.END,
GridData.CENTER,
- false, false));
+// new Label(this, SWT.NONE).setLayoutData(new GridData(GridData.END,
GridData.CENTER, false, false));
combo.addModifyListener(new ModifyListener() {
String key = name;
-
public void modifyText(ModifyEvent event) {
if (!combo.getText().trim().equals(Constants.EMPTY)) {
styleAttributes.addAttribute(key,
combo.getText().trim());
@@ -388,7 +386,6 @@
}
});
}
-
if (ext) {
combo.setText(values[VALUE_NUMBER]);
} else {
@@ -400,21 +397,22 @@
/**
* Method for creating text controls
*
- * @param composite
- * The parent composite for tab
- * @param name
- * Name of css element
- * @param value
- * Value of css element
+ * @param composite The parent composite for tab
+ * @param name Name of css element
+ * @param value Value of css element
*/
- private void createText(final Composite composite, final String name, final String
value) {
+ private void createText(final String name, final String value) {
Button btn = null;
- final Text text = new Text(composite, SWT.BORDER);
- text.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
+ final Text text;
+ // create "button" in case of FONT_FAMILY style property
if (name.equalsIgnoreCase(CSSConstants.FONT_FAMILY)) {
- btn = new Button(composite, SWT.NONE);
+ Composite tmpComposite = getCompositeElement();
+ text = new Text(tmpComposite, SWT.BORDER);
+ text.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
+
+ btn = new Button(tmpComposite, SWT.NONE);
btn.setLayoutData(new GridData(GridData.END, GridData.CENTER, false,
false));
ImageDescriptor imageDes =
JspEditorPlugin.getImageDescriptor(Constants.IMAGE_FONT_FILE_LOCATION);
@@ -429,8 +427,7 @@
});
btn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
- FontFamilyDialog dialog = new
FontFamilyDialog(composite.getShell(),
- text.getText());
+ FontFamilyDialog dialog = new FontFamilyDialog(getShell(),
text.getText());
if (dialog.open() == Window.OK) {
text.setText(dialog.getFontFamily());
@@ -451,21 +448,23 @@
//dialog.setStyleForPreview();
}
});
+ } else {
+ text = new Text(this, SWT.BORDER);
+ text.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
}
- final Combo extCombo;
String[] values = null;
boolean ext = false;
-
if (btn == null) {
if (Util.searchInExtElement(name)) {
values = Util.convertExtString(value);
ext = true;
- extCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
+ final Combo extCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
extCombo.setLayoutData(new GridData(GridData.END, GridData.CENTER, false,
false));
- for (int i = 0; i < Constants.extSizes.length; i++)
+ for (int i = 0; i < Constants.extSizes.length; i++) {
extCombo.add(Constants.extSizes[i]);
+ }
extCombo.select(extCombo.indexOf(values[EXT_VALUE_NUMBER]));
@@ -516,8 +515,7 @@
}
});
} else {
- new Label(composite, SWT.NONE).setLayoutData(new GridData(GridData.END,
GridData.CENTER,
- false, false));
+// new Label(this, SWT.NONE).setLayoutData(new GridData(GridData.END,
GridData.CENTER, false, false));
text.addModifyListener(new ModifyListener() {
String key = name;
@@ -543,10 +541,25 @@
}
/**
+ * Create container that take up 2 cells and contains fontSizeCombo and
extFontSizeCombo elements.
+ */
+ private Composite getCompositeElement() {
+ GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ gridData.horizontalSpan = 2;
+ GridLayout gridLayoutTmp = new GridLayout(2, false);
+ gridLayoutTmp.marginHeight = 0;
+ gridLayoutTmp.marginWidth = 0;
+ Composite classComposite = new Composite(this, SWT.CENTER);
+ classComposite.setLayoutData(gridData);
+ classComposite.setLayout(gridLayoutTmp);
+
+ return classComposite;
+ }
+
+ /**
* Method for format css names (text-decoration : Text Decoration)
*
- * @param str
- * CSS name
+ * @param str CSS name
* @return Format ss name
*/
private String format(String str) {
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-11-11
15:39:10 UTC (rev 11677)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabTextControl.java 2008-11-11
15:46:29 UTC (rev 11678)
@@ -10,9 +10,14 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.outline.cssdialog.tabs;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.window.Window;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@@ -30,7 +35,6 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
import org.jboss.tools.jst.jsp.outline.cssdialog.FontFamilyDialog;
@@ -41,12 +45,6 @@
import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.ColorParser;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
/**
* Class for creating Text tab controls
*
@@ -73,7 +71,7 @@
/**
* Constructor for creating controls
*
- * @param composite
+ * @param composite Composite element
*/
public TabTextControl(final Composite composite, final HashMap<String,
ArrayList<String>> comboMap,
final StyleAttributes styleAttributes) {
@@ -86,9 +84,12 @@
gridLayout.numColumns = numColumns;
setLayout(gridLayout);
+ //
=====================================================================================
+ // Add FONT_FAMILY element
+ //
=====================================================================================
Label label = new Label(this, SWT.LEFT);
+ label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
label.setText(JstUIMessages.FONT_FAMILY);
- label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
fontFamilyText = new Text(this, SWT.BORDER | SWT.SINGLE);
fontFamilyText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
@@ -130,6 +131,10 @@
}
}
});
+
+ //
=====================================================================================
+ // Add COLOR element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
label.setText(JstUIMessages.COLOR);
@@ -151,18 +156,12 @@
//cssDialog.setStyleForPreview();
}
});
-
- ////////////////////////////////////////////////////////////////////////
- // //
Set<Entry<String, String>> set =
ColorParser.getInstance().getMap().entrySet();
-
for (Map.Entry<String, String> me : set) {
RGB rgb = Util.getColor(me.getKey());
colorCombo.add(me.getValue(), rgb);
}
- ////////////////////////////////////////////////////////////////////////
- // /
button = new Button(this, SWT.PUSH);
button.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
button.setToolTipText(JstUIMessages.COLOR_TIP);
@@ -193,23 +192,22 @@
}
});
+ //
=====================================================================================
+ // Add FONT_SIZE element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
label.setText(JstUIMessages.FONT_SIZE);
- fontSizeCombo = new Combo(this, SWT.BORDER | SWT.SINGLE);
+ // Create container that take up 2 cells and contains fontSizeCombo and
extFontSizeCombo elements.
+ // Is created for correct layout.
+ Composite tmpComposite = getCompositeElement();
+ fontSizeCombo = new Combo(tmpComposite, SWT.BORDER | SWT.SINGLE);
+ fontSizeCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
false));
- final GridData fontSizeGridData = new GridData(GridData.FILL, GridData.CENTER,
true, false);
- fontSizeCombo.setLayoutData(fontSizeGridData);
+ extFontSizeCombo = new Combo(tmpComposite, SWT.BORDER | SWT.READ_ONLY);
+ extFontSizeCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
false, false));
- list = comboMap.get(CSSConstants.FONT_SIZE);
-
- for (String str : list) {
- fontSizeCombo.add(str);
- }
-
- extFontSizeCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
-
extFontSizeCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String fontSize = fontSizeCombo.getText().trim();
@@ -227,9 +225,6 @@
}
}
});
-
- extFontSizeCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
false, false));
-
for (int i = 0; i < Constants.extSizes.length; i++) {
extFontSizeCombo.add(Constants.extSizes[i]);
}
@@ -276,12 +271,22 @@
//cssDialog.setStyleForPreview();
}
});
+ list = comboMap.get(CSSConstants.FONT_SIZE);
+ for (String str : list) {
+ fontSizeCombo.add(str);
+ }
+ //
=====================================================================================
+ // Add FONT_STYLE element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
label.setText(JstUIMessages.FONT_STYLE);
+ GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ gridData.horizontalSpan = 2;
fontStyleCombo = new Combo(this, SWT.BORDER);
+ fontStyleCombo.setLayoutData(gridData);
fontStyleCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
@@ -297,24 +302,22 @@
//cssDialog.setStyleForPreview();
}
});
-
- fontStyleCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
-
list = comboMap.get(CSSConstants.FONT_STYLE);
-
for (String str : list) {
fontStyleCombo.add(str);
}
+ //
=====================================================================================
+ // Add FONT_WEIGHT element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
- label.setText(Constants.EMPTY);
-
- label = new Label(this, SWT.LEFT);
- label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
label.setText(JstUIMessages.FONT_WEIGHT);
+ gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ gridData.horizontalSpan = 2;
fontWeigthCombo = new Combo(this, SWT.BORDER);
+ fontWeigthCombo.setLayoutData(gridData);
fontWeigthCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
@@ -330,24 +333,22 @@
//cssDialog.setStyleForPreview();
}
});
-
- fontWeigthCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
-
list = comboMap.get(CSSConstants.FONT_WEIGHT);
-
for (String str : list) {
fontWeigthCombo.add(str);
}
+ //
=====================================================================================
+ // Add TEXT_DECORATION element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
- label.setText(Constants.EMPTY);
-
- label = new Label(this, SWT.LEFT);
- label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
label.setText(JstUIMessages.TEXT_DECORATION);
+ gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ gridData.horizontalSpan = 2;
textDecorationCombo = new Combo(this, SWT.BORDER);
+ textDecorationCombo.setLayoutData(gridData);
textDecorationCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
@@ -363,24 +364,22 @@
//cssDialog.setStyleForPreview();
}
});
-
- textDecorationCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
false, false));
-
list = comboMap.get(CSSConstants.TEXT_DECORATION);
-
for (String str : list) {
textDecorationCombo.add(str);
}
+ //
=====================================================================================
+ // Add TEXT_ALIGN element
+ //
=====================================================================================
label = new Label(this, SWT.LEFT);
label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
- label.setText(Constants.EMPTY);
-
- label = new Label(this, SWT.LEFT);
- label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
label.setText(JstUIMessages.TEXT_ALIGN);
+ gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ gridData.horizontalSpan = 2;
textAlignCombo = new Combo(this, SWT.BORDER);
+ textAlignCombo.setLayoutData(gridData);
textAlignCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
@@ -396,18 +395,26 @@
//cssDialog.setStyleForPreview();
}
});
-
- textAlignCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
-
list = comboMap.get(CSSConstants.TEXT_ALIGN);
-
for (String str : list) {
textAlignCombo.add(str);
}
+ }
- label = new Label(this, SWT.LEFT);
- label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
- label.setText(Constants.EMPTY);
+ /**
+ * Create container that take up 2 cells and contains fontSizeCombo and
extFontSizeCombo elements.
+ */
+ private Composite getCompositeElement() {
+ GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ gridData.horizontalSpan = 2;
+ GridLayout gridLayoutTmp = new GridLayout(2, false);
+ gridLayoutTmp.marginHeight = 0;
+ gridLayoutTmp.marginWidth = 0;
+ Composite classComposite = new Composite(this, SWT.CENTER);
+ classComposite.setLayoutData(gridData);
+ classComposite.setLayout(gridLayoutTmp);
+
+ return classComposite;
}
/**