Author: sdzmitrovich
Date: 2009-06-30 11:34:05 -0400 (Tue, 30 Jun 2009)
New Revision: 16297
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/CSSUIMessages.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/messages.properties
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/AbstractCssSection.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BackgroundSection.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BoxesSection.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/PropertiesSection.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/QuickEditSection.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TextSection.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3445
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/CSSUIMessages.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/CSSUIMessages.java 2009-06-30
14:11:39 UTC (rev 16296)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/CSSUIMessages.java 2009-06-30
15:34:05 UTC (rev 16297)
@@ -4,7 +4,7 @@
public class CSSUIMessages extends NLS {
private static final String BUNDLE_NAME =
"org.jboss.tools.jst.css.messages.messages"; //$NON-NLS-1$
- public static String CSSViewDefaultPreviewText;
+ public static String CSSPreview_DefaultBrowserText;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, CSSUIMessages.class);
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/messages.properties
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/messages.properties 2009-06-30
14:11:39 UTC (rev 16296)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/messages.properties 2009-06-30
15:34:05 UTC (rev 16297)
@@ -1 +1 @@
-CSSViewDefaultPreviewText=Double click to edit preview. To save changes press Enter
button.
+CSSPreview_DefaultBrowserText=Double click to edit preview. To save changes press Enter
button.
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/AbstractCssSection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/AbstractCssSection.java 2009-06-30
14:11:39 UTC (rev 16296)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/AbstractCssSection.java 2009-06-30
15:34:05 UTC (rev 16297)
@@ -11,20 +11,12 @@
package org.jboss.tools.jst.css.properties;
-import java.util.HashMap;
-import java.util.Map;
-
import org.eclipse.core.databinding.DataBindingContext;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
-import org.w3c.dom.css.CSSStyleDeclaration;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
/**
* @author Sergey Dzmitrovich
@@ -33,6 +25,7 @@
public abstract class AbstractCssSection extends AbstractPropertySection {
private DataBindingContext bindingContext;
private StyleAttributes styleAttributes;
+ protected BaseTabControl control;
@Override
public void createControls(Composite parent,
@@ -44,10 +37,10 @@
styleAttributes = ((CSSPropertyPage) aTabbedPropertySheetPage)
.getStyleAttributes();
}
- createTabControl(parent);
+ control = createTabControl(parent);
}
- abstract public void createTabControl(Composite parent);
+ abstract public BaseTabControl createTabControl(Composite parent);
public DataBindingContext getBindingContext() {
return bindingContext;
@@ -57,9 +50,7 @@
return styleAttributes;
}
- @Override
- public void setInput(IWorkbenchPart part, ISelection selection) {
- super.setInput(part, selection);
-
+ public BaseTabControl getTabControl() {
+ return control;
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BackgroundSection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BackgroundSection.java 2009-06-30
14:11:39 UTC (rev 16296)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BackgroundSection.java 2009-06-30
15:34:05 UTC (rev 16297)
@@ -12,6 +12,7 @@
package org.jboss.tools.jst.css.properties;
import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabBackgroundControl;
/**
@@ -21,8 +22,8 @@
public class BackgroundSection extends AbstractCssSection {
@Override
- public void createTabControl(Composite parent) {
- new TabBackgroundControl(parent, getStyleAttributes(),
+ public BaseTabControl createTabControl(Composite parent) {
+ return new TabBackgroundControl(parent, getStyleAttributes(),
getBindingContext());
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BoxesSection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BoxesSection.java 2009-06-30
14:11:39 UTC (rev 16296)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BoxesSection.java 2009-06-30
15:34:05 UTC (rev 16297)
@@ -12,6 +12,7 @@
package org.jboss.tools.jst.css.properties;
import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabBoxesControl;
/**
@@ -21,9 +22,9 @@
public class BoxesSection extends AbstractCssSection {
@Override
- public void createTabControl(Composite parent) {
+ public BaseTabControl createTabControl(Composite parent) {
- new TabBoxesControl(parent, getStyleAttributes(),
+ return new TabBoxesControl(parent, getStyleAttributes(),
getBindingContext());
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java 2009-06-30
14:11:39 UTC (rev 16296)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java 2009-06-30
15:34:05 UTC (rev 16297)
@@ -89,21 +89,19 @@
.getFirstElement());
if (styleRule != null) {
- // if (styleRule != selectedObject) {
((IObservable) styleAttributes.getAttributeMap())
.removeChangeListener(this);
updateStyleAttributes(styleRule);
((IObservable) styleAttributes.getAttributeMap())
.addChangeListener(this);
- // }
newSelectedObject = styleRule;
}
}
- // if (newSelectedObject != selectedObject) {
- super.selectionChanged(part, selection);
+
+ if (selectedObject != newSelectedObject)
+ super.selectionChanged(part, selection);
selectedObject = newSelectedObject;
- // }
}
@@ -141,11 +139,13 @@
}
}
- StructuredSelection selection = new StructuredSelection(
- new Object[] { selectedObject });
+ notifySelectionChanged(new StructuredSelection(selectedObject));
+
+ }
+
+ protected void notifySelectionChanged(StructuredSelection selection) {
part.postSelectionChanged(new SelectionChangedEvent(part
.getSelectionProvider(), selection));
-
}
/**
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/PropertiesSection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/PropertiesSection.java 2009-06-30
14:11:39 UTC (rev 16296)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/PropertiesSection.java 2009-06-30
15:34:05 UTC (rev 16297)
@@ -12,6 +12,7 @@
package org.jboss.tools.jst.css.properties;
import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabPropertySheetControl;
/**
@@ -21,9 +22,9 @@
public class PropertiesSection extends AbstractCssSection {
@Override
- public void createTabControl(Composite parent) {
+ public BaseTabControl createTabControl(Composite parent) {
- new TabPropertySheetControl(parent, getStyleAttributes(),
+ return new TabPropertySheetControl(parent, getStyleAttributes(),
getBindingContext());
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/QuickEditSection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/QuickEditSection.java 2009-06-30
14:11:39 UTC (rev 16296)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/QuickEditSection.java 2009-06-30
15:34:05 UTC (rev 16297)
@@ -11,7 +11,10 @@
package org.jboss.tools.jst.css.properties;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchPart;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabQuickEditControl;
/**
@@ -21,9 +24,21 @@
public class QuickEditSection extends AbstractCssSection {
@Override
- public void createTabControl(Composite parent) {
- new TabQuickEditControl(parent, getStyleAttributes(),
+ public BaseTabControl createTabControl(Composite parent) {
+ return new TabQuickEditControl(parent, getStyleAttributes(),
getBindingContext());
}
+ @Override
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ getTabControl().update();
+ // TODO find better way
+ getTabControl().getParent().getParent().layout(true);
+ super.setInput(part, selection);
+ }
+
+ @Override
+ public void aboutToBeShown() {
+ super.aboutToBeShown();
+ }
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TextSection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TextSection.java 2009-06-30
14:11:39 UTC (rev 16296)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TextSection.java 2009-06-30
15:34:05 UTC (rev 16297)
@@ -12,6 +12,7 @@
package org.jboss.tools.jst.css.properties;
import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabTextControl;
/**
@@ -21,8 +22,8 @@
public class TextSection extends AbstractCssSection {
@Override
- public void createTabControl(Composite parent) {
- new TabTextControl(parent, getStyleAttributes(),
+ public BaseTabControl createTabControl(Composite parent) {
+ return new TabTextControl(parent, getStyleAttributes(),
getBindingContext());
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java 2009-06-30
14:11:39 UTC (rev 16296)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java 2009-06-30
15:34:05 UTC (rev 16297)
@@ -47,13 +47,11 @@
return new PageRec(part, page);
}
- // Use the default page
return null;
}
@Override
public SelectionProvider getSelectionProvider() {
- // TODO Auto-generated method stub
return super.getSelectionProvider();
}
public void postSelectionChanged(SelectionChangedEvent event){
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java 2009-06-30
14:11:39 UTC (rev 16296)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java 2009-06-30
15:34:05 UTC (rev 16297)
@@ -14,7 +14,6 @@
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
@@ -48,12 +47,12 @@
private Text previewText;
- private String previewContent = CSSUIMessages.CSSViewDefaultPreviewText;
+ private String previewContent = CSSUIMessages.CSSPreview_DefaultBrowserText;
private Map<String, String> styleAttributes = new HashMap<String,
String>();
-// private String location;
-// private String selectorName;
+ // private String location;
+ // private String selectorName;
@Override
public void init(IViewSite site) throws PartInitException {
@@ -105,7 +104,7 @@
if (e.widget == previewText) {
String text = previewText.getText();
if (text == null || text.equals(Constants.EMPTY)) {
- setPreviewContent(CSSUIMessages.CSSViewDefaultPreviewText);
+ setPreviewContent(CSSUIMessages.CSSPreview_DefaultBrowserText);
} else {
setPreviewContent(text);
}
@@ -137,24 +136,16 @@
*/
public String generateBrowserPage() {
- StringBuffer html = new StringBuffer(Constants.OPEN_DIV_TAG);
-
- for (Map.Entry<String, String> styleItem :
- styleAttributes.entrySet()) {
-
- html.append(styleItem.getKey() + Constants.COLON
- + styleItem.getValue() + Constants.SEMICOLON);
- }
-
- html.append("\">" + getPreviewContent() + Constants.CLOSE_DIV_TAG);
//$NON-NLS-1$
+ StringBuffer html = new StringBuffer(Constants.OPEN_DIV_TAG);
-// String html = "<html><head><link type=\"text/css\"
rel=\"stylesheet\" href=\""
-// + location
-// + "\" /></head><body > <span class=\""
-// + selectorName
-// + "\" >"
-// + getPreviewContent() + "</span></body></html>";
+ for (Map.Entry<String, String> styleItem : styleAttributes.entrySet()) {
+ html.append(styleItem.getKey() + Constants.COLON
+ + styleItem.getValue() + Constants.SEMICOLON);
+ }
+
+ html.append("\">" + getPreviewContent() + Constants.CLOSE_DIV_TAG);
//$NON-NLS-1$
+
return html.toString();
}
@@ -177,23 +168,16 @@
.getFirstElement());
if (styleRule != null) {
-// selectorName = styleRule.getSelectorText();
-// location = ResourcesPlugin.getWorkspace().getRoot()
-// .getLocation().toString()
-// + styleRule.getParentStyleSheet().getHref();
styleAttributes = CSSViewUtil.getStyleAttributes(styleRule);
} else {
-// selectorName = null;
-// location = null;
styleAttributes.clear();
}
- updateBrowser();
-
}
-
+ updateBrowser();
}
+
}
public void updateBrowser() {