Author: sdzmitrovich
Date: 2009-06-30 07:43:09 -0400 (Tue, 30 Jun 2009)
New Revision: 16281
Added:
trunk/jst/plugins/org.jboss.tools.jst.css/.classpath
trunk/jst/plugins/org.jboss.tools.jst.css/.project
trunk/jst/plugins/org.jboss.tools.jst.css/.settings/
trunk/jst/plugins/org.jboss.tools.jst.css/.settings/org.eclipse.jdt.core.prefs
trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/
trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.css/build.properties
trunk/jst/plugins/org.jboss.tools.jst.css/plugin.properties
trunk/jst/plugins/org.jboss.tools.jst.css/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.css/src/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CssPlugin.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/
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/
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/properties/TypeMapper.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/
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
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSViewUtil.java
Log:
Added: trunk/jst/plugins/org.jboss.tools.jst.css/.classpath
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/.classpath (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/.classpath 2009-06-30 11:43:09 UTC (rev
16281)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.css/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.css/.project
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/.project (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/.project 2009-06-30 11:43:09 UTC (rev
16281)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.jst.css</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.css/.project
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.css/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/.settings/org.eclipse.jdt.core.prefs 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,8 @@
+#Tue Jun 09 11:54:10 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/MANIFEST.MF 2009-06-30 11:43:09 UTC
(rev 16281)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.jboss.tools.jst.css;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.tools.jst.css.CssPlugin
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.tools.jst.jsp;bundle-version="2.0.0",
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.0",
+ org.eclipse.ui.views.log;bundle-version="1.0.100",
+ org.eclipse.core.databinding;bundle-version="1.2.0",
+ org.eclipse.wst.css.core;bundle-version="1.1.300",
+ org.eclipse.core.resources;bundle-version="3.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Eclipse-LazyStart: true
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.css/build.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/build.properties
(rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/build.properties 2009-06-30 11:43:09 UTC
(rev 16281)
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ plugin.properties
+jars.compile.order = .
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.css/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.css/plugin.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/plugin.properties
(rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/plugin.properties 2009-06-30 11:43:09 UTC
(rev 16281)
@@ -0,0 +1,9 @@
+Bundle-Vendor = JBoss, a division of Red Hat
+Bundle-Name = CSS Test Plug-in
+css.tabs.textFont.label=Text/Font
+css.tabs.background.label=Background
+css.tabs.boxes.label=Boxes
+css.tabs.property.label=Property Sheet
+css.tabs.quickEdit.label=Edited Properties
+css.editor_name=CSS Editor View
+css.preview_name=CSS Preview View
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.css/plugin.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.css/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/plugin.xml (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/plugin.xml 2009-06-30 11:43:09 UTC (rev
16281)
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
+ <propertyContributor
contributorId="org.eclipse.wst.css.core.csssource.source"
+ typeMapper="org.jboss.tools.jst.css.properties.TypeMapper">
+ <propertyCategory category="general">
+ </propertyCategory>
+ </propertyContributor>
+ </extension>
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ <propertyTabs
contributorId="org.eclipse.wst.css.core.csssource.source">
+ <propertyTab category="general"
+ id="org.jboss.tools.jst.css.textFontTab"
label="%css.tabs.textFont.label">
+ </propertyTab>
+ <propertyTab category="general"
+ id="org.jboss.tools.jst.css.backgroundTab"
label="%css.tabs.background.label"
+ afterTab="org.jboss.tools.jst.css.textFontTab">
+ </propertyTab>
+ <propertyTab category="general"
id="org.jboss.tools.jst.css.boxesTab"
+ label="%css.tabs.boxes.label"
afterTab="org.jboss.tools.jst.css.backgroundTab">
+ </propertyTab>
+ <propertyTab category="general"
+ id="org.jboss.tools.jst.css.propertyTab"
label="%css.tabs.property.label"
+ afterTab="org.jboss.tools.jst.css.boxesTab">
+ </propertyTab>
+ <propertyTab category="general"
+ id="org.jboss.tools.jst.css.quickEditTab"
label="%css.tabs.quickEdit.label"
+ afterTab="org.jboss.tools.jst.css.propertyTab">
+ </propertyTab>
+ </propertyTabs>
+ </extension>
+ <extension
point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ <propertySections
contributorId="org.eclipse.wst.css.core.csssource.source">
+ <propertySection class="org.jboss.tools.jst.css.properties.TextSection"
+ id="org.jboss.tools.jst.css.textFontTab"
tab="org.jboss.tools.jst.css.textFontTab">
+ <input
+ type="org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule">
+ </input>
+ </propertySection>
+
+ <propertySection
+ class="org.jboss.tools.jst.css.properties.BackgroundSection"
id="org.jboss.tools.jst.css.backgroundTab"
+ tab="org.jboss.tools.jst.css.backgroundTab" >
+ <input
+ type="org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule">
+ </input>
+ </propertySection>
+ <propertySection class="org.jboss.tools.jst.css.properties.BoxesSection"
+ id="org.jboss.tools.jst.css.boxesTab"
tab="org.jboss.tools.jst.css.boxesTab">
+ <input
+ type="org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule">
+ </input>
+ </propertySection>
+ <propertySection
+ class="org.jboss.tools.jst.css.properties.PropertiesSection"
id="org.jboss.tools.jst.css.propertyTab"
+ tab="org.jboss.tools.jst.css.propertyTab">
+ <input
+ type="org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule">
+ </input>
+ </propertySection>
+ <propertySection
+ class="org.jboss.tools.jst.css.properties.QuickEditSection"
id="org.jboss.tools.jst.css.quickEditTab"
+ tab="org.jboss.tools.jst.css.quickEditTab">
+ <input
+ type="org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule">
+ </input>
+ </propertySection>
+ </propertySections>
+
+ </extension>
+ <extension point="org.eclipse.ui.views">
+ <view class="org.jboss.tools.jst.css.view.CSSEditorView"
id="org.jboss.tools.jst.css.view.editor"
+ name="%css.editor_name" restorable="true">
+ </view>
+ <view
+ class="org.jboss.tools.jst.css.view.CSSPreview"
+ id="org.jboss.tools.jst.css.view.preview"
+ name="%css.preview_name"
+ restorable="true">
+ </view>
+ </extension>
+</plugin>
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.css/plugin.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CssPlugin.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CssPlugin.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CssPlugin.java 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class CssPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.jst.css";
+
+ // The shared instance
+ private static CssPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public CssPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static CssPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CssPlugin.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/CSSUIMessages.java 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,15 @@
+package org.jboss.tools.jst.css.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+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;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, CSSUIMessages.class);
+ }
+
+ private CSSUIMessages() {
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/CSSUIMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/messages.properties 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1 @@
+CSSViewDefaultPreviewText=Double click to edit preview. To save changes press Enter
button.
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/AbstractCssSection.java 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.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;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public abstract class AbstractCssSection extends AbstractPropertySection {
+ private DataBindingContext bindingContext;
+ private StyleAttributes styleAttributes;
+
+ @Override
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ if (aTabbedPropertySheetPage instanceof CSSPropertyPage) {
+ bindingContext = ((CSSPropertyPage) aTabbedPropertySheetPage)
+ .getBindingContext();
+ styleAttributes = ((CSSPropertyPage) aTabbedPropertySheetPage)
+ .getStyleAttributes();
+ }
+ createTabControl(parent);
+ }
+
+ abstract public void createTabControl(Composite parent);
+
+ public DataBindingContext getBindingContext() {
+ return bindingContext;
+ }
+
+ public StyleAttributes getStyleAttributes() {
+ return styleAttributes;
+ }
+
+ @Override
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ super.setInput(part, selection);
+
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/AbstractCssSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BackgroundSection.java 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css.properties;
+
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabBackgroundControl;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class BackgroundSection extends AbstractCssSection {
+
+ @Override
+ public void createTabControl(Composite parent) {
+ new TabBackgroundControl(parent, getStyleAttributes(),
+ getBindingContext());
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BackgroundSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BoxesSection.java 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css.properties;
+
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabBoxesControl;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class BoxesSection extends AbstractCssSection {
+
+ @Override
+ public void createTabControl(Composite parent) {
+
+ new TabBoxesControl(parent, getStyleAttributes(),
+ getBindingContext());
+
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BoxesSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css.properties;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.IPageSite;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
+import org.jboss.tools.jst.css.view.CSSEditorView;
+import org.jboss.tools.jst.css.view.CSSViewUtil;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
+import org.w3c.dom.css.CSSStyleDeclaration;
+import org.w3c.dom.css.CSSStyleRule;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class CSSPropertyPage extends TabbedPropertySheetPage implements
+ IChangeListener {
+
+ private DataBindingContext bindingContext;
+
+ private StyleAttributes styleAttributes;
+
+ private CSSEditorView part;
+
+ private Object selectedObject;
+
+ public CSSPropertyPage(
+ ITabbedPropertySheetPageContributor tabbedPropertySheetPageContributor,
+ CSSEditorView part) {
+ super(tabbedPropertySheetPageContributor);
+ bindingContext = new DataBindingContext();
+ styleAttributes = new StyleAttributes();
+ ((IObservable) styleAttributes.getAttributeMap())
+ .addChangeListener(this);
+ this.part = part;
+
+ }
+
+ @Override
+ public void init(IPageSite pageSite) {
+ super.init(pageSite);
+ pageSite.getWorkbenchWindow().getSelectionService()
+ .addPostSelectionListener(this);
+ }
+
+ @Override
+ public void dispose() {
+ getSite().getWorkbenchWindow().getSelectionService()
+ .removePostSelectionListener(this);
+ super.dispose();
+ }
+
+ @Override
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+
+ if ((this.part != part) && (selection instanceof IStructuredSelection)) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ Object newSelectedObject = structuredSelection.getFirstElement();
+ if (structuredSelection.getFirstElement() instanceof ICSSNode) {
+
+ CSSStyleRule styleRule = CSSViewUtil
+ .getStyleRule((ICSSNode) structuredSelection
+ .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);
+ selectedObject = newSelectedObject;
+ // }
+
+ }
+
+ }
+
+ private void updateStyleAttributes(CSSStyleRule styleRule) {
+
+ getStyleAttributes().setStyleProperties(
+ CSSViewUtil.getStyleAttributes(styleRule));
+
+ }
+
+ public void handleChange(ChangeEvent event) {
+
+ if (selectedObject instanceof CSSStyleRule) {
+
+ final CSSStyleDeclaration declaration = ((CSSStyleRule) selectedObject)
+ .getStyle();
+
+ // set properties
+ final Set<Entry<String, String>> set = styleAttributes.entrySet();
+
+ if ((set.size() == 0) && (declaration.getLength() > 0)) {
+ declaration.setCssText(Constants.EMPTY);
+ } else {
+ for (final Map.Entry<String, String> me : set) {
+ if ((me.getValue() == null)
+ || (me.getValue().length() == 0)) {
+ declaration.removeProperty(me.getKey());
+ } else {
+ declaration.setProperty(me.getKey(), me.getValue(),
+ Constants.EMPTY);
+ }
+ }
+ }
+ }
+
+ StructuredSelection selection = new StructuredSelection(
+ new Object[] { selectedObject });
+ part.postSelectionChanged(new SelectionChangedEvent(part
+ .getSelectionProvider(), selection));
+
+ }
+
+ /**
+ *
+ * @return
+ */
+ public DataBindingContext getBindingContext() {
+ return bindingContext;
+ }
+
+ public StyleAttributes getStyleAttributes() {
+ return styleAttributes;
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/PropertiesSection.java 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css.properties;
+
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabPropertySheetControl;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class PropertiesSection extends AbstractCssSection {
+
+ @Override
+ public void createTabControl(Composite parent) {
+
+ new TabPropertySheetControl(parent, getStyleAttributes(),
+ getBindingContext());
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/PropertiesSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/QuickEditSection.java 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css.properties;
+
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabQuickEditControl;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class QuickEditSection extends AbstractCssSection {
+
+ @Override
+ public void createTabControl(Composite parent) {
+ new TabQuickEditControl(parent, getStyleAttributes(),
+ getBindingContext());
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/QuickEditSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TextSection.java 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css.properties;
+
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabTextControl;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class TextSection extends AbstractCssSection {
+
+ @Override
+ public void createTabControl(Composite parent) {
+ new TabTextControl(parent, getStyleAttributes(),
+ getBindingContext());
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TextSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TypeMapper.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TypeMapper.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TypeMapper.java 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css.properties;
+
+import org.eclipse.ui.views.properties.tabbed.ITypeMapper;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class TypeMapper implements ITypeMapper {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.views.properties.tabbed.ITypeMapper#mapType(java.lang.
+ * Object)
+ */
+ public Class mapType(Object object) {
+
+ while (object instanceof ICSSNode) {
+ if ((object instanceof ICSSStyleRule)
+ || (((ICSSNode) object).getParentNode() == null)) {
+ break;
+ } else {
+ object = ((ICSSNode) object).getParentNode();
+ }
+ }
+ return object.getClass();
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TypeMapper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css.view;
+
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.IPageBookViewPage;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.PropertySheet;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+import org.jboss.tools.jst.css.properties.CSSPropertyPage;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class CSSEditorView extends PropertySheet {
+
+ static public String CONTRIBUTOR_ID =
"org.eclipse.wst.css.core.csssource.source"; //$NON-NLS-1$
+
+ @Override
+ protected PageRec doCreatePage(final IWorkbenchPart part) {
+ if (part instanceof PropertySheet) {
+ return null;
+ }
+ IPropertySheetPage page = new CSSPropertyPage(
+ new ITabbedPropertySheetPageContributor() {
+
+ public String getContributorId() {
+ return CONTRIBUTOR_ID;
+ }
+ }, this);
+ if (page != null) {
+ if (page instanceof IPageBookViewPage) {
+ initPage((IPageBookViewPage) page);
+ }
+ page.createControl(getPageBook());
+ 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){
+ getSelectionProvider().postSelectionChanged(event);
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css.view;
+
+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;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
+import org.jboss.tools.jst.css.messages.CSSUIMessages;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.w3c.dom.css.CSSStyleRule;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class CSSPreview extends ViewPart implements ISelectionListener {
+
+ private Browser browser;
+
+ private Text previewText;
+
+ private String previewContent = CSSUIMessages.CSSViewDefaultPreviewText;
+
+ private Map<String, String> styleAttributes = new HashMap<String,
String>();
+
+// private String location;
+// private String selectorName;
+
+ @Override
+ public void init(IViewSite site) throws PartInitException {
+ super.init(site);
+ site.getWorkbenchWindow().getSelectionService()
+ .addPostSelectionListener(this);
+ }
+
+ @Override
+ public void dispose() {
+ getSite().getWorkbenchWindow().getSelectionService()
+ .removePostSelectionListener(this);
+ super.dispose();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
+ * .Composite)
+ */
+ @Override
+ public void createPartControl(Composite parent) {
+ final SashForm previewComposite = new SashForm(parent, SWT.None);
+ previewComposite.setLayout(new GridLayout());
+ GridData gridData = new GridData(GridData.FILL, GridData.FILL, true,
+ true);
+ previewComposite.setLayoutData(gridData);
+
+ browser = new Browser(previewComposite, SWT.BORDER | SWT.MOZILLA);
+ browser.setText(generateBrowserPage());
+ browser.setLayoutData(gridData);
+ browser.addMouseListener(new MouseAdapter() {
+ public void mouseDoubleClick(MouseEvent e) {
+ if (e.widget == browser) {
+ browser.setEnabled(false);
+ previewComposite.setMaximizedControl(previewText);
+ previewText.setFocus();
+ }
+ }
+ });
+
+ previewText = new Text(previewComposite, SWT.NONE | SWT.H_SCROLL);
+ previewText.setLayoutData(gridData);
+ previewText.setText(getPreviewContent());
+ previewText.addFocusListener(new FocusAdapter() {
+ public void focusLost(FocusEvent e) {
+ if (e.widget == previewText) {
+ String text = previewText.getText();
+ if (text == null || text.equals(Constants.EMPTY)) {
+ setPreviewContent(CSSUIMessages.CSSViewDefaultPreviewText);
+ } else {
+ setPreviewContent(text);
+ }
+
+ browser.setEnabled(true);
+ browser.setText(generateBrowserPage());
+ previewComposite.setMaximizedControl(browser);
+ }
+ }
+ });
+
+ previewComposite.setMaximizedControl(browser);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+ */
+ @Override
+ public void setFocus() {
+ browser.setFocus();
+ }
+
+ /**
+ * /** Method is used to build html body that is appropriate to browse.
+ *
+ * @return String html text representation
+ */
+ 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$
+
+// String html = "<html><head><link type=\"text/css\"
rel=\"stylesheet\" href=\""
+// + location
+// + "\" /></head><body > <span class=\""
+// + selectorName
+// + "\" >"
+// + getPreviewContent() + "</span></body></html>";
+
+ return html.toString();
+ }
+
+ public String getPreviewContent() {
+ return previewContent;
+ }
+
+ public void setPreviewContent(String previewContent) {
+ this.previewContent = previewContent;
+ }
+
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ if (structuredSelection.getFirstElement() instanceof ICSSNode) {
+
+ CSSStyleRule styleRule = CSSViewUtil
+ .getStyleRule((ICSSNode) structuredSelection
+ .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();
+
+ }
+
+ }
+ }
+
+ public void updateBrowser() {
+ browser.setText(generateBrowserPage());
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSViewUtil.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSViewUtil.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSViewUtil.java 2009-06-30
11:43:09 UTC (rev 16281)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css.view;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
+import org.w3c.dom.css.CSSStyleDeclaration;
+import org.w3c.dom.css.CSSStyleRule;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class CSSViewUtil {
+
+ public static CSSStyleRule getStyleRule(ICSSNode node) {
+
+ while (node != null) {
+
+ if (node instanceof CSSStyleRule)
+ return (CSSStyleRule) node;
+
+ node = node.getParentNode();
+ }
+
+ return null;
+ }
+
+ public static Map<String, String> getStyleAttributes(CSSStyleRule styleRule) {
+
+ CSSStyleDeclaration declaration = styleRule.getStyle();
+ Map<String, String> styleMap = new HashMap<String, String>();
+ for (int i = 0; i < declaration.getLength(); i++) {
+ String propperty = declaration.item(i);
+ String value = declaration.getPropertyValue(propperty);
+ styleMap.put(propperty, value);
+ }
+
+ return styleMap;
+
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSViewUtil.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native