JBoss Tools SVN: r20731 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector: dnd and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: yzhishko
Date: 2010-03-10 08:09:11 -0500 (Wed, 10 Mar 2010)
New Revision: 20731
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPreview.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragListener.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragListener.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSContainer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSRuleContainer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSStyleSheetContainer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSClassSelectionChangedEvent.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectorEventManager.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSTableSelectionChangedEvent.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSTreeSelectionChangedEvent.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/ICSSClassSelectionChangedListener.java
Removed:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSTableDragListener.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSTreeDragListener.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTransfer.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPartComposite.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSStyleClassSelector.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTreeModel.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSTreeNode.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableViewer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeLabelProvider.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeViewer.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5964 , https://jira.jboss.org/jira/browse/JBIDE-3288 . Preview was added.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPartComposite.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPartComposite.java 2010-03-10 13:06:00 UTC (rev 20730)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPartComposite.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -13,12 +13,15 @@
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetAdapter;
@@ -27,8 +30,6 @@
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
@@ -47,14 +48,19 @@
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd.CSSTableDragListener;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd.CSSTreeDragListener;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSJSPRecognizer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTableModel;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.CSSClassSelectionChangedEvent;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.CSSSelectorEventManager;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.ICSSClassSelectionChangedListener;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorFilter;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTableViewer;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTreeViewer;
-import org.w3c.dom.css.CSSRule;
/**
*
@@ -65,9 +71,9 @@
public class CSSSelectorPartComposite extends Composite implements
SelectionListener {
- private static final int LIST_HEIGHT = 500;
+ private static final int VIEWER_HEIGHT = 500;
private static final int BUTTOND_WIDTH = 50;
- private static final int LIST_WIDTH = 175;
+ private static final int VIEWER_WIDTH = 175;
/** Existing font family */
Composite buttonsContainer;
@@ -80,13 +86,24 @@
private StyleAttributes styleAttributes;
private CSSSelectorTreeModel styleClassTreeModel;
private CSSSelectorFilter filter;
+ private List<ICSSClassSelectionChangedListener> changedListeners = new ArrayList<ICSSClassSelectionChangedListener>(
+ 0);
public CSSSelectorPartComposite(StyleAttributes styleAttributes,
Composite parentComposite, String setClasses) {
- super(parentComposite, SWT.NONE);
+ super(parentComposite, SWT.BORDER);
this.setClasses = setClasses;
this.styleAttributes = styleAttributes;
creatSelectorPart();
+ addDisposeListener(new DisposeListener() {
+
+ public void widgetDisposed(DisposeEvent e) {
+ for (int i = 0; i < changedListeners.size(); i++) {
+ removeCSSClassSelectionChangedListener(changedListeners
+ .get(i));
+ }
+ }
+ });
}
private void creatSelectorPart() {
@@ -103,6 +120,9 @@
if (!(editorPart instanceof JSPMultiPageEditor)) {
return;
}
+ String[] selectedClasses = parseSetClasses();
+ selectedClassesTableViewer.setModel(new CSSSelectorTableModel(
+ selectedClasses));
CSSJSPRecognizer recognizer = new CSSJSPRecognizer(
(JSPMultiPageEditor) editorPart);
if (recognizer.parseCSS() == CSSJSPRecognizer.VOID_RESULT) {
@@ -111,15 +131,12 @@
styleClassTreeModel = recognizer.getCssStyleClassTreeModel();
allCSSClassStyles = recognizer.getCSSStyleMap();
allCSSStyleClassViewer.setModel(styleClassTreeModel);
- String[] selectedClasses = parseSetClasses();
- selectedClassesTableViewer.setModel(new CSSSelectorTableModel(
- selectedClasses));
updateStyles();
}
private void initDND() {
Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
-
+
allCSSStyleClassViewer.addDragSupport(DND.DROP_MOVE, types,
new CSSTreeDragListener(this, allCSSStyleClassViewer,
selectedClassesTableViewer));
@@ -127,27 +144,33 @@
selectedClassesTableViewer.addDragSupport(DND.DROP_MOVE, types,
new CSSTableDragListener(this, allCSSStyleClassViewer,
selectedClassesTableViewer));
-
- allCSSStyleClassViewer.addDropSupport(DND.DROP_MOVE, types, new DropTargetAdapter(){
- @Override
- public void drop(DropTargetEvent event) {
- if (event.data == null || event.data.equals(CSSSelectorTreeViewer.CSS_SELECTOR_TREE_VIWER_ID)) {
- event.detail = DND.DROP_NONE;
- return;
- }
- }
- });
-
- selectedClassesTableViewer.addDropSupport(DND.DROP_MOVE, types, new DropTargetAdapter(){
- @Override
- public void drop(DropTargetEvent event) {
- if (event.data == null || event.data.equals(CSSSelectorTableViewer.CSS_SELECTOR_TABLE_VIWER_ID)) {
- event.detail = DND.DROP_NONE;
- return;
- }
- }
- });
+ allCSSStyleClassViewer.addDropSupport(DND.DROP_MOVE, types,
+ new DropTargetAdapter() {
+ @Override
+ public void drop(DropTargetEvent event) {
+ if (event.data == null
+ || event.data
+ .equals(CSSSelectorTreeViewer.CSS_SELECTOR_TREE_VIWER_ID)) {
+ event.detail = DND.DROP_NONE;
+ return;
+ }
+ }
+ });
+
+ selectedClassesTableViewer.addDropSupport(DND.DROP_MOVE, types,
+ new DropTargetAdapter() {
+ @Override
+ public void drop(DropTargetEvent event) {
+ if (event.data == null
+ || event.data
+ .equals(CSSSelectorTableViewer.CSS_SELECTOR_TABLE_VIWER_ID)) {
+ event.detail = DND.DROP_NONE;
+ return;
+ }
+ }
+ });
+
}
private void initListeners() {
@@ -163,7 +186,7 @@
TreeItem selectedItem = selectedItems[selectedItems.length - 1];
CSSTreeNode treeNode = (CSSTreeNode) selectedItem
.getData();
- if (!(treeNode.getCssResource() instanceof CSSRule)) {
+ if (!(treeNode.getCSSContainer() instanceof CSSRuleContainer)) {
if (allCSSStyleClassViewer
.getExpandedState(treeNode)) {
allCSSStyleClassViewer.collapseToLevel(
@@ -179,18 +202,7 @@
}
}
});
-
- tree.addMouseListener(new MouseAdapter() {
-
- public void mouseDown(MouseEvent e) {
- if (tree.getSelectionCount() > 0) {
- selectedClassesTableViewer.getTable().deselectAll();
- leftButton.setEnabled(false);
- rightButton.setEnabled(true);
- }
- }
- });
-
+
selectedClassesTableViewer
.addDoubleClickListener(new IDoubleClickListener() {
@@ -206,19 +218,53 @@
});
- table.addMouseListener(new MouseAdapter() {
+ allCSSStyleClassViewer
+ .addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void mouseDown(MouseEvent e) {
- if (table.getSelectionCount() > 0) {
- tree.deselectAll();
- rightButton.setEnabled(false);
- leftButton.setEnabled(true);
- }
- }
+ public void selectionChanged(
+ final SelectionChangedEvent event) {
+ if (!event.getSelection().isEmpty()) {
+ rightButton.setEnabled(true);
+ leftButton.setEnabled(false);
+ } else {
+ rightButton.setEnabled(false);
+ leftButton.setEnabled(false);
+ }
+ Thread thread = new Thread("TreeSelectorWorker") { //$NON-NLS-1$
+ @Override
+ public void run() {
+ fireClassSelectionChanged(CSSSelectorEventManager
+ .getInstance().createTreeSelectionChangedEvent(
+ event, allCSSStyleClassViewer.getModel()));
+ }
+ };
+ thread.start();
+ }
+ });
- });
+ selectedClassesTableViewer
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(final SelectionChangedEvent event) {
+ if (!event.getSelection().isEmpty()) {
+ rightButton.setEnabled(false);
+ leftButton.setEnabled(true);
+ } else {
+ rightButton.setEnabled(false);
+ leftButton.setEnabled(false);
+ }
+ Thread thread = new Thread("TableSelectorWorker") { //$NON-NLS-1$
+ @Override
+ public void run() {
+ fireClassSelectionChanged(CSSSelectorEventManager
+ .getInstance().createTableSelectionChangedEvent(
+ event, allCSSStyleClassViewer.getModel()));
+ }
+ };
+ thread.start();
+ }
+ });
+
rightButton.addSelectionListener(this);
leftButton.addSelectionListener(this);
}
@@ -317,7 +363,7 @@
if (selectedItems != null && selectedItems.length > 0) {
for (int i = 0; i < selectedItems.length; i++) {
TreeItem item = selectedItems[i];
- if (!(((CSSTreeNode) item.getData()).getCssResource() instanceof CSSRule)) {
+ if (!(((CSSTreeNode) item.getData()).getCSSContainer() instanceof CSSRuleContainer)) {
continue;
}
selectedClassesTableViewer.add(((CSSTreeNode) item.getData())
@@ -335,13 +381,13 @@
setLayoutData(gridData);
gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.heightHint = LIST_HEIGHT;
- gridData.widthHint = LIST_WIDTH;
+ gridData.heightHint = VIEWER_HEIGHT;
+ gridData.widthHint = VIEWER_WIDTH;
allCSSStyleClassViewer.getTree().setLayoutData(gridData);
gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.heightHint = LIST_HEIGHT;
- gridData.widthHint = LIST_WIDTH;
+ gridData.heightHint = VIEWER_HEIGHT;
+ gridData.widthHint = VIEWER_WIDTH;
selectedClassesTableViewer.getTable().setLayoutData(gridData);
final GridLayout btmContGridLayout = new GridLayout();
@@ -358,7 +404,7 @@
}
- void updateStyles() {
+ public void updateStyles() {
String[] selectedItems = getItemsFromSelectedTable();
styleAttributes.clear();
if (filter == null) {
@@ -427,4 +473,20 @@
return selectedItemsList.toArray(new String[0]);
}
+ private void fireClassSelectionChanged(CSSClassSelectionChangedEvent event) {
+ for (int i = 0; i < changedListeners.size(); i++) {
+ changedListeners.get(i).classSelectionChanged(event);
+ }
+ }
+
+ public synchronized void addCSSClassSelectionChangedListener(
+ ICSSClassSelectionChangedListener listener) {
+ changedListeners.add(listener);
+ }
+
+ public synchronized void removeCSSClassSelectionChangedListener(
+ ICSSClassSelectionChangedListener listener) {
+ changedListeners.remove(listener);
+ }
+
}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPreview.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPreview.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPreview.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -0,0 +1,84 @@
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector;
+
+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.Display;
+import org.eclipse.wst.css.core.internal.modelhandler.CSSModelLoader;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet;
+import org.eclipse.wst.css.ui.StructuredTextViewerConfigurationCSS;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
+import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.CSSClassSelectionChangedEvent;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.ICSSClassSelectionChangedListener;
+import org.w3c.dom.css.CSSRuleList;
+
+@SuppressWarnings("restriction")
+public class CSSSelectorPreview extends Composite implements
+ ICSSClassSelectionChangedListener {
+
+ private StructuredTextViewer viewer;
+ private ICSSModel model;
+ private ICSSStyleSheet styleSheet;
+
+ public CSSSelectorPreview(Composite parent) {
+ super(parent, SWT.BORDER);
+ setLayout(new FillLayout());
+ initPreview();
+ }
+
+ private void initPreview() {
+ StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationCSS();
+
+ viewer = new StructuredTextViewer(this, null, null, false, SWT.BORDER
+ | SWT.V_SCROLL | SWT.H_SCROLL);
+ ((StructuredTextViewer) viewer).getTextWidget().setFont(
+ JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+
+ viewer.configure(baseConfiguration);
+ CSSModelLoader cssModelLoader = new CSSModelLoader();
+ IStructuredModel model = cssModelLoader.createModel();
+ this.model = (ICSSModel) model;
+ viewer.setDocument(model.getStructuredDocument());
+ viewer.setEditable(false);
+ }
+
+ public void classSelectionChanged(final CSSClassSelectionChangedEvent event) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ styleSheet = (ICSSStyleSheet) model.getDocument();
+ CSSRuleContainer[] containers = event
+ .getSelectedRuleContainers();
+ if (containers.length != 0) {
+ clearPreview();
+ for (int i = 0; i < containers.length; i++) {
+ appendRuleFromContainer(containers[i]);
+ }
+ }
+ }
+ });
+
+ }
+
+ private void appendRuleFromContainer(CSSRuleContainer container) {
+ StringBuilder builder = new StringBuilder(""); //$NON-NLS-1$
+ ICSSStyleRule rule = (ICSSStyleRule) container.getRule();
+ String text = rule.getCssText();
+ String styleDef = text.substring(text.indexOf('{'));
+ builder.append("." + container.getSelectorName() + styleDef); //$NON-NLS-1$
+ styleSheet.appendRule(styleSheet.createCSSRule(builder.toString()));
+ }
+
+ private void clearPreview() {
+ CSSRuleList ruleList = styleSheet.getCssRules();
+ for (int i = 0; i < ruleList.getLength(); i++) {
+ styleSheet.removeRule(ruleList.item(i));
+ }
+ }
+
+}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSStyleClassSelector.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSStyleClassSelector.java 2010-03-10 13:06:00 UTC (rev 20730)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSStyleClassSelector.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -16,21 +16,23 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.common.model.ui.widgets.Split;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
import org.jboss.tools.jst.jsp.outline.cssdialog.AbstractCSSDialog;
/**
*
* @author yzhishko
- *
+ *
*/
-public class CSSStyleClassSelector extends AbstractCSSDialog{
+public class CSSStyleClassSelector extends AbstractCSSDialog {
private String currentCSSStyleClass;
private CSSSelectorPartComposite cssClassComposite;
private String selectesCSSStylesClasses;
-
+ private CSSSelectorPreview preview;
+
public CSSStyleClassSelector(Shell shell) {
super(shell);
setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX
@@ -40,29 +42,32 @@
@Override
protected Composite createControlComposite(Composite parent) {
// Create down splitter container
- Composite controlsContainer = new Composite(parent, SWT.NONE);
+ Split controlsContainer = new Split(parent, SWT.VERTICAL);
controlsContainer.setLayout(new GridLayout());
controlsContainer.setLayoutData(new GridData(GridData.FILL,
GridData.FILL, true, true));
cssClassComposite = createCSSClassComposite(controlsContainer);
+ preview = createPreviewComposite(controlsContainer);
+ cssClassComposite.addCSSClassSelectionChangedListener(preview);
return controlsContainer;
}
-
+
@Override
protected Control createContents(Composite parent) {
- Composite composite = (Composite)super.createContents(parent);
+ Composite composite = (Composite) super.createContents(parent);
return composite;
}
-
+
private CSSSelectorPartComposite createCSSClassComposite(Composite parent) {
- return new CSSSelectorPartComposite(getStyleAttributes(), parent, currentCSSStyleClass);
+ return new CSSSelectorPartComposite(getStyleAttributes(), parent,
+ currentCSSStyleClass);
}
public void setCurrentStyleClass(String value) {
currentCSSStyleClass = value;
}
-
- public String getCSSStyleClasses (){
+
+ public String getCSSStyleClasses() {
return selectesCSSStylesClasses;
}
@@ -73,17 +78,21 @@
}
super.buttonPressed(buttonId);
}
-
+
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(JstUIMessages.CSS_SELECTOR_TITLE);
}
-
+
@Override
protected Control createDialogArea(Composite parent) {
setTitle(JstUIMessages.CSS_SELECTOR_TITLE);
return super.createDialogArea(parent);
}
+
+ private CSSSelectorPreview createPreviewComposite(Composite parent) {
+ return new CSSSelectorPreview(parent);
+ }
}
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSTableDragListener.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSTableDragListener.java 2010-03-10 13:06:00 UTC (rev 20730)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSTableDragListener.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Tree;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTableViewer;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-@SuppressWarnings("unused")
-public class CSSTableDragListener implements DragSourceListener {
-
- private Table table;
- private Tree tree;
- private CSSSelectorPartComposite parent;
- private TreeViewer treeViewer;
- private TableViewer tableViewer;
-
- public CSSTableDragListener (CSSSelectorPartComposite parent, TreeViewer treeViewer, TableViewer tableViewer){
- this.table = tableViewer.getTable();
- this.tree = treeViewer.getTree();
- this.treeViewer = treeViewer;
- this.tableViewer = tableViewer;
- this.parent = parent;
- }
-
- public void dragStart(DragSourceEvent event) {
- event.doit = table.getSelectionCount() > 0;
- }
-
- public void dragSetData(DragSourceEvent event) {
- List<String> selectedItems = new ArrayList<String>(0);
- TableItem[] selectedTableItems = table.getSelection();
- if (selectedTableItems != null) {
- for (int i = 0; i < selectedTableItems.length; i++) {
- selectedItems.add(selectedTableItems[i].getData()
- .toString());
- }
- }
- event.data = CSSSelectorTableViewer.CSS_SELECTOR_TABLE_VIWER_ID;
- }
-
- public void dragFinished(DragSourceEvent event) {
- if (event.detail == DND.DROP_MOVE) {
- TableItem[] selectedTableItems = table.getSelection();
- if (selectedTableItems != null && selectedTableItems.length > 0) {
- for (int i = 0; i < selectedTableItems.length; i++) {
- tableViewer.remove(selectedTableItems[i].getData());
- }
- }
- parent.updateStyles();
- }
- }
-
-}
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSTreeDragListener.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSTreeDragListener.java 2010-03-10 13:06:00 UTC (rev 20730)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSTreeDragListener.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTreeViewer;
-import org.w3c.dom.css.CSSRule;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-@SuppressWarnings("unused")
-public class CSSTreeDragListener implements DragSourceListener {
-
- private Table table;
- private Tree tree;
- private CSSSelectorPartComposite parent;
- private TreeViewer treeViewer;
- private TableViewer tableViewer;
-
- public CSSTreeDragListener (CSSSelectorPartComposite parent, TreeViewer treeViewer, TableViewer tableViewer){
- this.table = tableViewer.getTable();
- this.tree = treeViewer.getTree();
- this.treeViewer = treeViewer;
- this.tableViewer = tableViewer;
- this.parent = parent;
- }
-
-
- public void dragStart(DragSourceEvent event) {
- event.doit = tree.getSelectionCount() > 0;
- }
-
- public void dragSetData(DragSourceEvent event) {
- List<String> selectedItems = new ArrayList<String>(0);
- TreeItem[] selectedTreeItems = tree.getSelection();
- if (selectedTreeItems != null) {
- for (int i = 0; i < selectedTreeItems.length; i++) {
- selectedItems.add(selectedTreeItems[i].getData()
- .toString());
- }
- }
-
- event.data = CSSSelectorTreeViewer.CSS_SELECTOR_TREE_VIWER_ID;
- }
-
- public void dragFinished(DragSourceEvent event) {
- if (event.detail == DND.DROP_MOVE) {
- List<String> selectedItems = new ArrayList<String>(0);
- TreeItem[] selectedTreeItems = tree.getSelection();
- if (selectedTreeItems != null) {
- for (int i = 0; i < selectedTreeItems.length; i++) {
- if (((CSSTreeNode) selectedTreeItems[i].getData())
- .getCssResource() instanceof CSSRule) {
- selectedItems.add(selectedTreeItems[i]
- .getData().toString());
- }
- }
- }
- for (int i = 0; i < selectedItems.size(); i++) {
- tableViewer.add(selectedItems.get(i));
- }
- parent.updateStyles();
- }
- }
-
-}
Copied: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragListener.java (from rev 20684, trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSTableDragListener.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragListener.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragListener.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.DragSourceListener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Tree;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.CSSSelectorPartComposite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTableViewer;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("unused")
+public class CSSTableDragListener implements DragSourceListener {
+
+ private Table table;
+ private Tree tree;
+ private CSSSelectorPartComposite parent;
+ private TreeViewer treeViewer;
+ private TableViewer tableViewer;
+
+ public CSSTableDragListener (CSSSelectorPartComposite parent, TreeViewer treeViewer, TableViewer tableViewer){
+ this.table = tableViewer.getTable();
+ this.tree = treeViewer.getTree();
+ this.treeViewer = treeViewer;
+ this.tableViewer = tableViewer;
+ this.parent = parent;
+ }
+
+ public void dragStart(DragSourceEvent event) {
+ event.doit = table.getSelectionCount() > 0;
+ }
+
+ public void dragSetData(DragSourceEvent event) {
+ List<String> selectedItems = new ArrayList<String>(0);
+ TableItem[] selectedTableItems = table.getSelection();
+ if (selectedTableItems != null) {
+ for (int i = 0; i < selectedTableItems.length; i++) {
+ selectedItems.add(selectedTableItems[i].getData()
+ .toString());
+ }
+ }
+ event.data = CSSSelectorTableViewer.CSS_SELECTOR_TABLE_VIWER_ID;
+ }
+
+ public void dragFinished(DragSourceEvent event) {
+ if (event.detail == DND.DROP_MOVE) {
+ TableItem[] selectedTableItems = table.getSelection();
+ if (selectedTableItems != null && selectedTableItems.length > 0) {
+ for (int i = 0; i < selectedTableItems.length; i++) {
+ tableViewer.remove(selectedTableItems[i].getData());
+ }
+ }
+ parent.updateStyles();
+ }
+ }
+
+}
Copied: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragListener.java (from rev 20684, trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSTreeDragListener.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragListener.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragListener.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.DragSourceListener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.CSSSelectorPartComposite;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTreeViewer;
+import org.w3c.dom.css.CSSRule;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("unused")
+public class CSSTreeDragListener implements DragSourceListener {
+
+ private Table table;
+ private Tree tree;
+ private CSSSelectorPartComposite parent;
+ private TreeViewer treeViewer;
+ private TableViewer tableViewer;
+
+ public CSSTreeDragListener(CSSSelectorPartComposite parent,
+ TreeViewer treeViewer, TableViewer tableViewer) {
+ this.table = tableViewer.getTable();
+ this.tree = treeViewer.getTree();
+ this.treeViewer = treeViewer;
+ this.tableViewer = tableViewer;
+ this.parent = parent;
+ }
+
+ public void dragStart(DragSourceEvent event) {
+ event.doit = tree.getSelectionCount() > 0;
+ }
+
+ public void dragSetData(DragSourceEvent event) {
+ List<String> selectedItems = new ArrayList<String>(0);
+ TreeItem[] selectedTreeItems = tree.getSelection();
+ if (selectedTreeItems != null) {
+ for (int i = 0; i < selectedTreeItems.length; i++) {
+ selectedItems.add(selectedTreeItems[i].getData().toString());
+ }
+ }
+
+ event.data = CSSSelectorTreeViewer.CSS_SELECTOR_TREE_VIWER_ID;
+ }
+
+ public void dragFinished(DragSourceEvent event) {
+ if (event.detail == DND.DROP_MOVE) {
+ List<String> selectedItems = new ArrayList<String>(0);
+ TreeItem[] selectedTreeItems = tree.getSelection();
+ if (selectedTreeItems != null) {
+ for (int i = 0; i < selectedTreeItems.length; i++) {
+ if (((CSSTreeNode) selectedTreeItems[i].getData())
+ .getCSSContainer() instanceof CSSRuleContainer) {
+ selectedItems.add(selectedTreeItems[i].getData()
+ .toString());
+ }
+ }
+ }
+ for (int i = 0; i < selectedItems.size(); i++) {
+ tableViewer.add(selectedItems.get(i));
+ }
+ parent.updateStyles();
+ }
+ }
+
+}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSContainer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSContainer.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSContainer.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public abstract class CSSContainer {
+
+ private String styleSheetPath;
+
+ public CSSContainer(String styleSheetPath) {
+ this.setStyleSheetPath(styleSheetPath);
+ }
+
+ public void setStyleSheetPath(String styleSheetPath) {
+ this.styleSheetPath = styleSheetPath;
+ }
+
+ public String getStyleSheetPath() {
+ return styleSheetPath;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof CSSContainer)) {
+ return false;
+ }
+ return styleSheetPath.equals(((CSSContainer)obj).getStyleSheetPath());
+ }
+
+}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSRuleContainer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSRuleContainer.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSRuleContainer.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model;
+
+import org.w3c.dom.css.CSSRule;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class CSSRuleContainer extends CSSContainer {
+
+ private CSSRule rule;
+ private String selectorName;
+
+ public CSSRuleContainer(String selectorName, CSSRule rule,
+ String styleSheetPath) {
+ super(styleSheetPath);
+ setRule(rule);
+ setSelectorName(selectorName);
+ }
+
+ public void setRule(CSSRule rule) {
+ this.rule = rule;
+ }
+
+ public CSSRule getRule() {
+ return rule;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ boolean eq = super.equals(obj);
+ if (eq == false) {
+ return false;
+ }
+ if (!(obj instanceof CSSRuleContainer)) {
+ return false;
+ }
+ return eq
+ && selectorName.equals(((CSSRuleContainer) obj)
+ .getSelectorName())
+ && rule.equals(((CSSRuleContainer) obj).getRule());
+ }
+
+ public void setSelectorName(String selectorName) {
+ this.selectorName = selectorName;
+ }
+
+ public String getSelectorName() {
+ return selectorName;
+ }
+}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTreeModel.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTreeModel.java 2010-03-10 13:06:00 UTC (rev 20730)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTreeModel.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -11,6 +11,8 @@
package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model;
+import java.util.ArrayList;
+import java.util.List;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
import org.jboss.tools.jst.web.kb.PageContextFactory.CSSStyleSheetDescriptor;
import org.w3c.dom.css.CSSRule;
@@ -20,7 +22,7 @@
/**
*
* @author yzhishko
- *
+ *
*/
@SuppressWarnings("restriction")
@@ -29,29 +31,30 @@
private CSSStyleSheetDescriptor[] cssSheets;
private CSSTreeNode invisibleRoot;
- public CSSSelectorTreeModel(CSSStyleSheet[] cssSheets) {
- }
-
public CSSSelectorTreeModel(CSSStyleSheetDescriptor[] cssSheets) {
this.cssSheets = cssSheets;
setInvisibleRoot(new CSSTreeNode("")); //$NON-NLS-1$
initModel(this.cssSheets);
}
- private void initModel(CSSStyleSheetDescriptor[] cssStyleSheets){
+ private void initModel(CSSStyleSheetDescriptor[] cssStyleSheets) {
for (int i = 0; i < cssStyleSheets.length; i++) {
CSSStyleSheet styleSheet = cssStyleSheets[i].sheet;
CSSTreeNode parentSheet = new CSSTreeNode(cssStyleSheets[i].source);
parentSheet.setStyleSheetSource(parentSheet.toString());
invisibleRoot.addChild(parentSheet);
- parentSheet.setCssResource(styleSheet);
+ parentSheet.setCSSContainer(new CSSStyleSheetContainer(styleSheet,
+ cssStyleSheets[i].source));
CSSRuleList cssRuleList = styleSheet.getCssRules();
for (int j = 0; j < cssRuleList.getLength(); j++) {
CSSRule cssRule = cssRuleList.item(j);
- String[] selectors = CSSSelectorUtils.parseSelectorName(((ICSSStyleRule)cssRule).getSelectorText());
+ String[] selectors = CSSSelectorUtils
+ .parseSelectorName(((ICSSStyleRule) cssRule)
+ .getSelectorText());
for (int k = 0; k < selectors.length; k++) {
CSSTreeNode ruleNode = new CSSTreeNode(selectors[k]);
- ruleNode.setCssResource(cssRule);
+ ruleNode.setCSSContainer(new CSSRuleContainer(selectors[k], cssRule,
+ cssStyleSheets[i].source));
ruleNode.setStyleSheetSource(cssStyleSheets[i].source);
parentSheet.addChild(ruleNode);
}
@@ -66,6 +69,29 @@
public CSSTreeNode getInvisibleRoot() {
return invisibleRoot;
}
-
-
+
+ public CSSTreeNode[] findCSSNodesByName(String name) {
+ List<CSSTreeNode> treeNodes = new ArrayList<CSSTreeNode>(0);
+ findCSSNodesRecursivly(invisibleRoot, name, treeNodes);
+ return treeNodes.toArray(new CSSTreeNode[0]);
+ }
+
+ private void findCSSNodesRecursivly(CSSTreeNode parentNode, String name,
+ List<CSSTreeNode> nodeCollection) {
+ if (parentNode == null) {
+ return;
+ }
+ List<CSSTreeNode> treeNodes = parentNode.getChildren();
+ if (treeNodes == null) {
+ return;
+ }
+ for (int i = 0; i < treeNodes.size(); i++) {
+ CSSTreeNode node = treeNodes.get(i);
+ if (name.equals(node.toString())) {
+ nodeCollection.add(node);
+ }
+ findCSSNodesRecursivly(node, name, nodeCollection);
+ }
+ }
+
}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSStyleSheetContainer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSStyleSheetContainer.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSStyleSheetContainer.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model;
+
+import org.w3c.dom.css.CSSStyleSheet;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class CSSStyleSheetContainer extends CSSContainer {
+
+ private CSSStyleSheet sheet;
+
+ public CSSStyleSheetContainer(CSSStyleSheet sheet, String styleSheetPath) {
+ super(styleSheetPath);
+ this.setSheet(sheet);
+ }
+
+ public void setSheet(CSSStyleSheet sheet) {
+ this.sheet = sheet;
+ }
+
+ public CSSStyleSheet getSheet() {
+ return sheet;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ boolean eq = super.equals(obj);
+ if (eq == false) {
+ return false;
+ }
+ if (!(obj instanceof CSSStyleSheetContainer)) {
+ return false;
+ }
+ return eq && sheet.equals(((CSSStyleSheetContainer) obj).getSheet());
+ }
+
+}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSTreeNode.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSTreeNode.java 2010-03-10 13:06:00 UTC (rev 20730)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSTreeNode.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -25,7 +25,7 @@
private String name;
private List<CSSTreeNode> children = new ArrayList<CSSTreeNode>(0);
private CSSTreeNode parent;
- private Object cssResource;
+ private CSSContainer cssResource;
private String styleSheetSource;
public CSSTreeNode(String n) {
@@ -54,11 +54,11 @@
return name;
}
- public void setCssResource(Object cssResource) {
+ public void setCSSContainer(CSSContainer cssResource) {
this.cssResource = cssResource;
}
- public Object getCssResource() {
+ public CSSContainer getCSSContainer() {
return cssResource;
}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSClassSelectionChangedEvent.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSClassSelectionChangedEvent.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSClassSelectionChangedEvent.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
+
+/**
+ * yzhishko
+ */
+
+@SuppressWarnings("serial")
+public abstract class CSSClassSelectionChangedEvent extends
+ SelectionChangedEvent {
+
+ protected CSSSelectorTreeModel model;
+
+ public CSSClassSelectionChangedEvent(ISelectionProvider source,
+ ISelection selection) {
+ super(source, selection);
+ }
+
+ public CSSRuleContainer[] getRuleContainersForName(String cssClassName) {
+ if (model == null) {
+ return null;
+ }
+ return findContainers(model.getInvisibleRoot(), cssClassName);
+ }
+
+ public abstract String[] getSelectedClassNames();
+
+ public CSSRuleContainer[] getSelectedRuleContainers() {
+ List<CSSRuleContainer> containers = new ArrayList<CSSRuleContainer>();
+ String[] classNames = getSelectedClassNames();
+ if (classNames != null) {
+ for (int i = 0; i < classNames.length; i++) {
+ CSSRuleContainer[] cssContainers = getRuleContainersForName(classNames[i]);
+ if (cssContainers != null) {
+ for (int j = 0; j < cssContainers.length; j++) {
+ containers.add(cssContainers[j]);
+ }
+ }
+ }
+ }
+ return containers.toArray(new CSSRuleContainer[0]);
+ }
+
+ private CSSRuleContainer[] findContainers(CSSTreeNode parentRoot,
+ String className) {
+ List<CSSRuleContainer> ruleContainers = new ArrayList<CSSRuleContainer>(
+ 0);
+ List<CSSTreeNode> styleSheetList = parentRoot.getChildren();
+ for (Iterator<CSSTreeNode> iterator = styleSheetList.iterator(); iterator
+ .hasNext();) {
+ CSSTreeNode styleSheetNode = (CSSTreeNode) iterator.next();
+ List<CSSTreeNode> styleClassList = styleSheetNode.getChildren();
+ for (Iterator<CSSTreeNode> iterator2 = styleClassList.iterator(); iterator2
+ .hasNext();) {
+ CSSTreeNode styleClassNode = (CSSTreeNode) iterator2.next();
+ if (className.equals(styleClassNode.toString())) {
+ ruleContainers.add((CSSRuleContainer) styleClassNode
+ .getCSSContainer());
+ }
+ }
+ }
+ return ruleContainers.toArray(new CSSRuleContainer[0]);
+ }
+
+ public CSSSelectorTreeModel getModel() {
+ return model;
+ }
+
+}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectorEventManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectorEventManager.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectorEventManager.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection;
+
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class CSSSelectorEventManager {
+
+ private static CSSSelectorEventManager instance = new CSSSelectorEventManager();
+
+ private CSSSelectorEventManager() {
+
+ }
+
+ public static CSSSelectorEventManager getInstance() {
+ return instance;
+ }
+
+ public CSSTreeSelectionChangedEvent createTreeSelectionChangedEvent(
+ SelectionChangedEvent event, CSSSelectorTreeModel model) {
+ return new CSSTreeSelectionChangedEvent(event.getSelectionProvider(),
+ event.getSelection(), model);
+ }
+
+ public CSSTableSelectionChangedEvent createTableSelectionChangedEvent(
+ SelectionChangedEvent event, CSSSelectorTreeModel model) {
+ return new CSSTableSelectionChangedEvent(event.getSelectionProvider(),
+ event.getSelection(), model);
+ }
+
+}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSTableSelectionChangedEvent.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSTableSelectionChangedEvent.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSTableSelectionChangedEvent.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("serial")
+public class CSSTableSelectionChangedEvent extends
+ CSSClassSelectionChangedEvent {
+
+ public CSSTableSelectionChangedEvent(ISelectionProvider source,
+ ISelection selection, CSSSelectorTreeModel model) {
+ super(source, selection);
+ this.model = model;
+ }
+
+ @Override
+ public String[] getSelectedClassNames() {
+ StructuredSelection structuredSelection = (StructuredSelection) selection;
+ Object[] selectedObjects = structuredSelection.toArray();
+ String[] selectedNames = new String[selectedObjects.length];
+ for (int i = 0; i < selectedObjects.length; i++) {
+ selectedNames[i] = selectedObjects[i].toString();
+ }
+ return selectedNames;
+ }
+
+}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSTreeSelectionChangedEvent.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSTreeSelectionChangedEvent.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSTreeSelectionChangedEvent.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection;
+
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSStyleSheetContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("serial")
+public class CSSTreeSelectionChangedEvent extends CSSClassSelectionChangedEvent {
+
+ public CSSTreeSelectionChangedEvent(ISelectionProvider source,
+ ISelection selection, CSSSelectorTreeModel model) {
+ super(source, selection);
+ this.model = model;
+ }
+
+ @Override
+ public String[] getSelectedClassNames() {
+ Set<String> selectedNames = new LinkedHashSet<String>(0);
+ TreeSelection treeSelection = (TreeSelection) selection;
+ Object[] selectedItems = treeSelection.toArray();
+ for (int i = 0; i < selectedItems.length; i++) {
+ CSSTreeNode treeNode = (CSSTreeNode) selectedItems[i];
+ CSSContainer container = treeNode.getCSSContainer();
+ if (container instanceof CSSStyleSheetContainer) {
+ List<CSSTreeNode> childNodes = treeNode.getChildren();
+ for (Iterator<CSSTreeNode> iterator = childNodes.iterator(); iterator
+ .hasNext();) {
+ CSSTreeNode cssTreeNode = (CSSTreeNode) iterator.next();
+ selectedNames.add(cssTreeNode.toString());
+ }
+ } else {
+ selectedNames.add(treeNode.toString());
+ }
+ }
+ return selectedNames.toArray(new String[0]);
+ }
+
+ @Override
+ public CSSRuleContainer[] getSelectedRuleContainers() {
+ Set<CSSRuleContainer> ruleContainers = new LinkedHashSet<CSSRuleContainer>(
+ 0);
+ TreeSelection treeSelection = (TreeSelection) selection;
+ Object[] selectedItems = treeSelection.toArray();
+ for (int i = 0; i < selectedItems.length; i++) {
+ CSSTreeNode treeNode = (CSSTreeNode) selectedItems[i];
+ CSSContainer container = treeNode.getCSSContainer();
+ if (container instanceof CSSStyleSheetContainer) {
+ List<CSSTreeNode> childNodes = treeNode.getChildren();
+ for (Iterator<CSSTreeNode> iterator = childNodes.iterator(); iterator
+ .hasNext();) {
+ CSSTreeNode cssTreeNode = (CSSTreeNode) iterator.next();
+ ruleContainers.add((CSSRuleContainer) cssTreeNode
+ .getCSSContainer());
+ }
+ } else {
+ ruleContainers.add((CSSRuleContainer) treeNode
+ .getCSSContainer());
+ }
+ }
+ return ruleContainers.toArray(new CSSRuleContainer[0]);
+ }
+
+}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/ICSSClassSelectionChangedListener.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/ICSSClassSelectionChangedListener.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/ICSSClassSelectionChangedListener.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public interface ICSSClassSelectionChangedListener {
+
+ void classSelectionChanged(CSSClassSelectionChangedEvent event);
+
+}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableViewer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableViewer.java 2010-03-10 13:06:00 UTC (rev 20730)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableViewer.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -11,11 +11,15 @@
package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TableItem;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTableModel;
@@ -30,6 +34,8 @@
public final static String CSS_SELECTOR_TABLE_VIWER_ID = "css_selector_table_viwer"; //$NON-NLS-1$
private final static ImageDescriptor CSS_STYLE_CLASS_DESCR = JspEditorPlugin.getImageDescriptor(Constants.IMAGE_STYLE_CLASS_LOCATION);
+
+ private CSSSelectorTableModel model;
public CSSSelectorTableViewer(Composite parent, int style) {
super(parent, style);
@@ -44,6 +50,46 @@
public void setModel(CSSSelectorTableModel model){
setInput(model.getContainerList());
+ this.model = model;
}
+ public CSSSelectorTableModel getModel(){
+ return model;
+ }
+
+ @Override
+ public void add(Object element) {
+ if (element != null) {
+ if (isContain(element)) {
+ return;
+ }
+ }
+ super.add(element);
+ }
+
+ @Override
+ public void add(Object[] elements) {
+ List<Object> objects = new ArrayList<Object>(0);
+ if (elements != null) {
+ for (int i = 0; i < elements.length; i++) {
+ if (!isContain(elements[i])) {
+ objects.add(elements[i]);
+ }
+ }
+ }
+ super.add(objects.toArray());
+ }
+
+ private boolean isContain(Object element){
+ TableItem[] items = getTable().getItems();
+ if (items != null) {
+ for (int i = 0; i < items.length; i++) {
+ if (element.equals(items[i].getData())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
}
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTransfer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTransfer.java 2010-03-10 13:06:00 UTC (rev 20730)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTransfer.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -1,94 +0,0 @@
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-import org.eclipse.swt.dnd.ByteArrayTransfer;
-import org.eclipse.swt.dnd.TransferData;
-
-public class CSSSelectorTransfer extends ByteArrayTransfer {
-
- private static CSSSelectorTransfer instance = new CSSSelectorTransfer();
- private static final String TYPE_NAME = "selector-transfer-format"; //$NON-NLS-1$
- private static final int TYPEID = registerType(TYPE_NAME);
-
- private CSSSelectorTransfer() {
-
- }
-
- public static CSSSelectorTransfer getInstance(){
- return instance;
- }
-
- @Override
- protected int[] getTypeIds() {
- return new int[] { TYPEID };
- }
-
- @Override
- protected String[] getTypeNames() {
- return new String[] { TYPE_NAME };
- }
-
- @Override
- protected Object nativeToJava(TransferData transferData) {
- byte[] bytes = (byte[]) super.nativeToJava(transferData);
- return fromByteArray(bytes);
- }
-
- @Override
- protected void javaToNative(Object object, TransferData transferData) {
- byte[] bytes = toByteArray((String[]) object);
- if (bytes != null)
- super.javaToNative(bytes, transferData);
- }
-
- protected byte[] toByteArray(String[] strings) {
-
- ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
- DataOutputStream out = new DataOutputStream(byteOut);
-
- byte[] bytes = null;
-
- try {
- /* write number of markers */
- out.writeInt(strings.length);
-
- /* write markers */
- for (int i = 0; i < strings.length; i++) {
- out.writeUTF(strings[i]);
- }
- out.close();
- bytes = byteOut.toByteArray();
- } catch (IOException e) {
- // when in doubt send nothing
- }
- return bytes;
- }
-
- protected String[] fromByteArray(byte[] bytes) {
- DataInputStream in = new DataInputStream(
- new ByteArrayInputStream(bytes));
-
- try {
- /* read number of gadgets */
- int n = in.readInt();
- /* read gadgets */
- String[] strings = new String[n];
- for (int i = 0; i < n; i++) {
- String string = in.readUTF();
- if (string == null) {
- return null;
- }
- strings[i] = string;
- }
- return strings;
- } catch (IOException e) {
- return null;
- }
- }
-
-}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeLabelProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeLabelProvider.java 2010-03-10 13:06:00 UTC (rev 20730)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeLabelProvider.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -16,9 +16,9 @@
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
+import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSStyleSheetContainer;
import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
-import org.w3c.dom.css.CSSRule;
-import org.w3c.dom.css.CSSStyleSheet;
/**
*
@@ -33,10 +33,10 @@
@Override
public Image getImage(Object element) {
- if (((CSSTreeNode) element).getCssResource() instanceof CSSStyleSheet) {
+ if (((CSSTreeNode) element).getCSSContainer() instanceof CSSStyleSheetContainer) {
return CSS_STYLE_SHEET_DESCR.createImage();
}
- if (((CSSTreeNode) element).getCssResource() instanceof CSSRule) {
+ if (((CSSTreeNode) element).getCSSContainer() instanceof CSSRuleContainer) {
return CSS_STYLE_CLASS_DESCR.createImage();
}
return super.getImage(element);
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeViewer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeViewer.java 2010-03-10 13:06:00 UTC (rev 20730)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeViewer.java 2010-03-10 13:09:11 UTC (rev 20731)
@@ -24,6 +24,7 @@
public class CSSSelectorTreeViewer extends TreeViewer {
public final static String CSS_SELECTOR_TREE_VIWER_ID = "css_selector_tree_viwer"; //$NON-NLS-1$
+ private CSSSelectorTreeModel model;
public CSSSelectorTreeViewer(Composite parent, int style) {
super(parent, style);
@@ -34,7 +35,12 @@
public void setModel(CSSSelectorTreeModel model){
if (model != null) {
setInput(model.getInvisibleRoot());
+ this.model = model;
}
}
+
+ public CSSSelectorTreeModel getModel(){
+ return model;
+ }
}
14 years, 10 months
JBoss Tools SVN: r20730 - trunk/jsf/docs/userguide/en-US/images/editors_features.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2010-03-10 08:06:00 -0500 (Wed, 10 Mar 2010)
New Revision: 20730
Modified:
trunk/jsf/docs/userguide/en-US/images/editors_features/editors_features_26.png
Log:
JBDS-1020 Code assist for class and style Class attributes for html and jsf tags is implemented
Modified: trunk/jsf/docs/userguide/en-US/images/editors_features/editors_features_26.png
===================================================================
(Binary files differ)
14 years, 10 months
JBoss Tools SVN: r20729 - in trunk/jst/plugins/org.jboss.tools.jst.jsp: src/org/jboss/tools/jst/jsp/jspeditor/info and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2010-03-10 07:57:29 -0500 (Wed, 10 Mar 2010)
New Revision: 20729
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java
Log:
JBIDE-4947: Tool tip for EL in XHTML/JSP/XML editors.
Tool tips are added for JSP/XHTML/Java editors
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties 2010-03-10 12:48:01 UTC (rev 20728)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties 2010-03-10 12:57:29 UTC (rev 20729)
@@ -8,4 +8,7 @@
occurrenceStructureProvidersExtensionPoint= Occurrence Structure Providers
defaultOccurrenceStructureProviderName= Default Occurrence Provider
-Bundle-Name.0 = Jsp Editor Plug-in
\ No newline at end of file
+Bundle-Name.0 = Jsp Editor Plug-in
+
+javaStringELHover= EL in Java String
+javaStringELHoverDescription= Shows the Javadoc of the selected EL-operand.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2010-03-10 12:48:01 UTC (rev 20728)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2010-03-10 12:57:29 UTC (rev 20729)
@@ -112,9 +112,24 @@
<documentationTextHover class="org.jboss.tools.jst.jsp.jspeditor.info.FaceletTagInfoHoverProcessor" target="org.eclipse.wst.html.HTML_DEFAULT" />
-
+ <documentationTextHover class="org.jboss.tools.jst.jsp.jspeditor.info.FaceletTagInfoHoverProcessor" target="org.eclipse.wst.xml.XML_DEFAULT" />
+ <documentationTextHover class="org.jboss.tools.jst.jsp.jspeditor.info.FaceletTagInfoHoverProcessor" target="org.eclipse.wst.sse.ST_DEFAULT" />
+ <documentationTextHover class="org.jboss.tools.jst.jsp.jspeditor.info.FaceletTagInfoHoverProcessor" target="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
+ <documentationTextHover class="org.jboss.tools.jst.jsp.jspeditor.info.FaceletTagInfoHoverProcessor" target="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" />
+
</extension>
+ <extension
+ point="org.eclipse.jdt.ui.javaEditorTextHovers">
+ <hover
+ label="%javaStringELHover"
+ description="%javaStringELHoverDescription"
+ class="org.jboss.tools.jst.jsp.jspeditor.info.JavaStringELInfoHover"
+ id="org.jboss.tools.jst.jsp.jspeditor.info.JavaStringELInfoHover"
+ activate="true">
+ </hover>
+ </extension>
+
<extension point="org.eclipse.ui.preferencePages">
<!-- Additional JSP/HTML PREFERENCE PAGES -->
<page
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java 2010-03-10 12:48:01 UTC (rev 20728)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java 2010-03-10 12:57:29 UTC (rev 20729)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
+ * Copyright (c) 2010 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -18,22 +18,36 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.Region;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
import org.eclipse.wst.xml.ui.internal.taginfo.XMLTagInfoHoverProcessor;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.model.ELUtil;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.jsp.contentassist.Utils;
+import org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor.TextRegion;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.PageContextFactory;
import org.jboss.tools.jst.web.kb.PageProcessor;
import org.jboss.tools.jst.web.kb.KbQuery.Type;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
+import org.w3c.dom.Node;
/**
*
@@ -63,7 +77,30 @@
if (fContext == null)
return null;
- return super.computeHoverHelp(textViewer, documentPosition);
+ IStructuredDocumentRegion flatNode = ((IStructuredDocument) textViewer.getDocument()).getRegionAtCharacterOffset(fDocumentPosition);
+ ITextRegion region = null;
+
+ if (flatNode != null) {
+ region = flatNode.getRegionAtCharacterOffset(fDocumentPosition);
+ }
+
+ String hoverHelp = null;
+ if (region != null) {
+ TextRegion elPrefix = getELPrefix(flatNode, region, fDocumentPosition);
+ if (elPrefix != null && elPrefix.isELStarted()) {
+ IndexedRegion treeNode = ContentAssistUtils.getNodeAt(textViewer, fDocumentPosition);
+ if (treeNode == null) {
+ return null;
+ }
+ Node node = (Node) treeNode;
+
+ while ((node != null) && (node.getNodeType() == Node.TEXT_NODE) && (node.getParentNode() != null)) {
+ node = node.getParentNode();
+ }
+ return computeELHelp((IDOMNode) treeNode, (IDOMNode) node, flatNode, region, elPrefix);
+ }
+ }
+ return hoverHelp != null ? hoverHelp : super.computeHoverHelp(textViewer, documentPosition);
}
@Override
@@ -80,7 +117,7 @@
String[] parentTags = Utils.getParentTags(xmlnode, true, true);
String parent = Utils.getParent(xmlnode, true, true, true);
- KbQuery kbQuery = Utils.createKbQuery(Type.ATTRIBUTE_NAME, fDocumentPosition, query, query, //$NON-NLS-1$
+ KbQuery kbQuery = Utils.createKbQuery(Type.ATTRIBUTE_NAME, fDocumentPosition, query, query,
prefix, uri, parentTags, parent, false);
TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, fContext);
@@ -133,7 +170,79 @@
return null;
}
+
+ protected String computeELHelp(IDOMNode xmlnode, IDOMNode parentNode,
+ IStructuredDocumentRegion flatNode, ITextRegion region, TextRegion elPrefix) {
+ if (fContext == null)
+ return null;
+
+ String query = "#{" + elPrefix.getText(); //$NON-NLS-1$
+ String prefix = getPrefix(query);
+ String uri = getUri(prefix);
+ String[] parentTags = Utils.getParentTags(xmlnode, false, true);
+ String parent = Utils.getParent(xmlnode, false, false, true);
+
+ KbQuery kbQuery = Utils.createKbQuery(Type.TEXT, fDocumentPosition, query, query,
+ prefix, uri, parentTags, parent, false);
+
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, fContext);
+ if (proposals == null)
+ return null;
+
+ for(TextProposal proposal : proposals) {
+ String label = proposal == null ? null : proposal.getLabel();
+ label = (label == null || label.indexOf(':') == -1) ? label : label.substring(0, label.indexOf(':')).trim();
+ if (label != null && query.endsWith(label) &&
+ proposal != null && proposal.getContextInfo() != null &&
+ proposal.getContextInfo().trim().length() > 0) {
+ return proposal.getContextInfo();
+ }
+ }
+
+ return null;
+ }
+
/**
+ * Returns the region to hover the text over based on the offset.
+ * Overrides the base method enabling the TEXT regions to the supported
+ *
+ * @param textViewer
+ * @param offset
+ *
+ * @return IRegion region to hover over if offset is within tag name,
+ * attribute name, or attribute value and if offset is not over
+ * invalid whitespace. otherwise, returns <code>null</code>
+ *
+ * @see org.eclipse.jface.text.ITextHover#getHoverRegion(ITextViewer, int)
+ */
+ @Override
+ public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
+ if ((textViewer == null) || (textViewer.getDocument() == null)) {
+ return null;
+ }
+
+ IStructuredDocumentRegion flatNode = ((IStructuredDocument) textViewer.getDocument()).getRegionAtCharacterOffset(offset);
+ ITextRegion region = null;
+
+ if (flatNode != null) {
+ region = flatNode.getRegionAtCharacterOffset(offset);
+ }
+
+ if (region != null) {
+ // Supply hoverhelp for text
+ String regionType = region.getType();
+ if (DOMRegionContext.XML_CONTENT.equals(regionType) ||
+ DOMRegionContext.BLOCK_TEXT.equals(regionType) ||
+ DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(regionType)) {
+ TextRegion elPrefix = getELPrefix(flatNode, region, offset);
+ if (elPrefix != null && elPrefix.isELStarted()) {
+ return new Region(elPrefix.getStartOffset() + elPrefix.getOffset() + elPrefix.getLength(), 0);
+ }
+ }
+ }
+ return super.getHoverRegion(textViewer, offset);
+ }
+ /**
* Returns IFile resource of the document
*
* @return
@@ -190,4 +299,61 @@
}
return null;
}
+
+ /**
+ * Returns EL Prefix Text Region Information Object
+ *
+ * @return
+ */
+ private TextRegion getELPrefix(IStructuredDocumentRegion sdRegion, ITextRegion region, int offset) {
+ if (sdRegion == null || region == null)
+ return null;
+
+ String text = sdRegion.getFullText(region);
+ int startOffset = sdRegion.getStartOffset() + region.getStart();
+
+ boolean isAttributeValue = false;
+ boolean hasOpenQuote = false;
+ boolean hasCloseQuote = false;
+ char quoteChar = (char)0;
+ if (DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(region.getType())) {
+ isAttributeValue = true;
+ if (text.startsWith("\"") || text.startsWith("'")) {//$NON-NLS-1$ //$NON-NLS-2$
+ quoteChar = text.charAt(0);
+ hasOpenQuote = true;
+ }
+ if (hasOpenQuote && text.endsWith(String.valueOf(quoteChar))) {
+ hasCloseQuote = true;
+ }
+ }
+
+ int inValueOffset = offset - startOffset;
+ if (text != null && text.length() < inValueOffset) { // probably, the attribute value ends before the document position
+ return null;
+ }
+ if (inValueOffset<0) {
+ return null;
+ }
+
+// String matchString = text.substring(0, inValueOffset);
+
+ ELParser p = ELParserUtil.getJbossFactory().createParser();
+ ELModel model = p.parse(text);
+
+ ELInstance is = ELUtil.findInstance(model, inValueOffset);// ELInstance
+ ELInvocationExpression ie = ELUtil.findExpression(model, inValueOffset);// ELExpression
+
+ boolean isELStarted = (model != null && is != null && (model.toString().startsWith("#{") || //$NON-NLS-1$
+ model.toString().startsWith("${"))); //$NON-NLS-1$
+ boolean isELClosed = (model != null && is != null && model.toString().endsWith("}")); //$NON-NLS-1$
+
+// boolean insideEL = startOffset + model.toString().length()
+ TextRegion tr = new TextRegion(startOffset, ie == null ? inValueOffset : ie.getStartPosition(),
+ ie == null ? 0 : ie.getLength(), ie == null ? "" : ie.getText(), //$NON-NLS-1$
+ isELStarted, isELClosed,
+ isAttributeValue, hasOpenQuote, hasCloseQuote, quoteChar);
+
+ return tr;
+ }
+
}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java 2010-03-10 12:57:29 UTC (rev 20729)
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.jspeditor.info;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.ITypeRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
+import org.eclipse.jdt.internal.ui.text.JavaWordFinder;
+import org.eclipse.jdt.internal.ui.text.java.hover.AbstractJavaEditorTextHover;
+import org.eclipse.jdt.ui.text.IJavaPartitions;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.DefaultInformationControl;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlCreator;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.wst.sse.ui.internal.derived.HTMLTextPresenter;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.model.ELUtil;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.contentassist.Utils;
+import org.jboss.tools.jst.web.kb.KbQuery;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.jboss.tools.jst.web.kb.PageProcessor;
+import org.jboss.tools.jst.web.kb.KbQuery.Type;
+
+/**
+ *
+ * @author Victor Rubezhny
+ *
+ */
+@SuppressWarnings("restriction")
+public class JavaStringELInfoHover extends AbstractJavaEditorTextHover {
+
+ /*
+ * @see ITextHover#getHoverRegion(ITextViewer, int)
+ */
+ public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
+ return JavaWordFinder.findWord(textViewer.getDocument(), offset);
+ }
+
+ /*
+ * @see JavaElementHover
+ */
+ public String getHoverInfo(ITextViewer textViewer, IRegion region) {
+ // find a region of __java_string, if we're in it - use it
+ IDocument document = textViewer == null ? null : textViewer.getDocument();
+ if (document == null)
+ return null;
+
+ int rangeStart = -1;
+ int rangeLength = 0;
+ IToken rangeToken = null;
+ FastJavaPartitionScanner scanner = new FastJavaPartitionScanner();
+ scanner.setRange(document, 0, document.getLength());
+ while(true) {
+ IToken token = scanner.nextToken();
+ if(token == null || token.isEOF()) break;
+ int start = scanner.getTokenOffset();
+ int length = scanner.getTokenLength();
+ int end = start + length;
+ if(start <= region.getOffset() && end >= region.getOffset()) {
+ rangeStart = start;
+ rangeLength = length;
+ rangeToken = token;
+ break;
+ }
+ if(start > region.getOffset()) break;
+ }
+
+ if (rangeToken == null || rangeStart == -1 || rangeLength <=0 ||
+ !IJavaPartitions.JAVA_STRING.equals(rangeToken.getData()))
+ return null;
+
+ // OK. We've found JAVA_STRING token
+ // Check that the position is in the EL
+ if (!checkStartPosition(document, region.getOffset()))
+ return null;
+
+ // Calculate and prepare KB-query parameters
+ String text = null;
+ try {
+ text = document.get(rangeStart, rangeLength);
+ } catch (BadLocationException e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ int inValueOffset = region.getOffset() - rangeStart;
+
+ ELParser p = ELParserUtil.getJbossFactory().createParser();
+ ELModel model = p.parse(text);
+
+ ELInvocationExpression ie = ELUtil.findExpression(model, inValueOffset);// ELExpression
+ if (ie == null)
+ return null;
+
+ String query = "#{" + ie.getText(); //$NON-NLS-1$
+
+ KbQuery kbQuery = Utils.createKbQuery(Type.ATTRIBUTE_VALUE, region.getOffset() + region.getLength(),
+ query, query, "", "", null, null, false); //$NON-NLS-1$ //$NON-NLS-2$
+
+ ITypeRoot input= getEditorInputJavaElement();
+ if (input == null)
+ return null;
+
+ IFile file = null;
+
+ try {
+ IResource resource = input.getCorrespondingResource();
+ if (resource instanceof IFile)
+ file = (IFile) resource;
+ } catch (JavaModelException e) {
+ // Ignore. It is probably because of Java element's resource is not found
+ }
+
+ ELContext context = PageContextFactory.createPageContext(file, JavaCore.JAVA_SOURCE_CONTENT_TYPE);
+
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, context);
+ if (proposals == null)
+ return null;
+
+ for(TextProposal proposal : proposals) {
+ String label = proposal == null ? null : proposal.getLabel();
+ label = (label == null || label.indexOf(':') == -1) ? label : label.substring(0, label.indexOf(':')).trim();
+ if (label != null && query.endsWith(label) &&
+ proposal != null && proposal.getContextInfo() != null &&
+ proposal.getContextInfo().trim().length() > 0) {
+ return proposal.getContextInfo();
+ }
+ }
+
+ return null;
+ }
+
+ /*
+ * Checks if the EL start starting characters are present
+ * @param viewer
+ * @param offset
+ * @return
+ * @throws BadLocationException
+ */
+ private boolean checkStartPosition(IDocument document, int offset) {
+ try {
+ while (--offset >= 0) {
+ if ('}' == document.getChar(offset))
+ return false;
+
+
+ if ('"' == document.getChar(offset) &&
+ (offset - 1) >= 0 && '\\' != document.getChar(offset - 1)) {
+ return false;
+ }
+
+
+ if ('{' == document.getChar(offset) &&
+ (offset - 1) >= 0 &&
+ ('#' == document.getChar(offset - 1) ||
+ '$' == document.getChar(offset - 1))) {
+ return true;
+ }
+ }
+ } catch (BadLocationException e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ return false;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.ITextHoverExtension#getHoverControlCreator()
+ * @since 3.0
+ */
+ public IInformationControlCreator getHoverControlCreator() {
+ return new IInformationControlCreator() {
+ public IInformationControl createInformationControl(Shell parent) {
+ return new DefaultInformationControl(parent, new HTMLTextPresenter(true));
+ }
+ };
+ }
+
+ /*
+ * @see org.eclipse.jface.text.ITextHoverExtension2#getInformationPresenterControlCreator()
+ * @since 3.0
+ */
+ public IInformationControlCreator getInformationPresenterControlCreator() {
+ return new IInformationControlCreator() {
+ public IInformationControl createInformationControl(Shell parent) {
+ return new DefaultInformationControl(parent, new HTMLTextPresenter(true));
+ }
+ };
+ }
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 10 months
JBoss Tools SVN: r20728 - in trunk/cdi: tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-03-10 07:48:01 -0500 (Wed, 10 Mar 2010)
New Revision: 20728
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/NameDefinitionTest.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BeanDefinitionTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5808
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2010-03-10 12:39:27 UTC (rev 20727)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2010-03-10 12:48:01 UTC (rev 20728)
@@ -15,9 +15,6 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IType;
-import org.jboss.tools.cdi.internal.core.impl.InterceptorBindingElement;
-import org.jboss.tools.cdi.internal.core.impl.QualifierElement;
-import org.jboss.tools.cdi.internal.core.impl.ScopeElement;
import org.jboss.tools.common.text.INodeReference;
/**
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java 2010-03-10 12:39:27 UTC (rev 20727)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java 2010-03-10 12:48:01 UTC (rev 20728)
@@ -14,6 +14,7 @@
import junit.framework.TestSuite;
import org.jboss.tools.cdi.core.test.tck.BeanDefinitionTest;
+import org.jboss.tools.cdi.core.test.tck.NameDefinitionTest;
import org.jboss.tools.cdi.core.test.tck.ValidationTest;
/**
@@ -24,6 +25,7 @@
public static Test suite() {
TestSuite suite = new TestSuite("CDI Core Tests");
suite.addTestSuite(BeanDefinitionTest.class);
+ suite.addTestSuite(NameDefinitionTest.class);
suite.addTestSuite(ValidationTest.class);
return suite;
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BeanDefinitionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BeanDefinitionTest.java 2010-03-10 12:39:27 UTC (rev 20727)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BeanDefinitionTest.java 2010-03-10 12:48:01 UTC (rev 20728)
@@ -208,27 +208,4 @@
IBean bean = beans.iterator().next();
assertEquals("Wrong Bean Class type of org.jboss.jsr299.tck.tests.definition.bean.Horse bean", "org.jboss.jsr299.tck.tests.definition.bean.Horse", bean.getBeanClass().getFullyQualifiedName());
}
-
- /**
- * e) A bean comprises of an optional bean EL name.
- */
- public void testNonDefaultNamed() {
- IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/name/Moose.java");
- Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
- assertEquals("org.jboss.jsr299.tck.tests.definition.name.Moose should have the only bean.", 1, beans.size());
- IBean bean = beans.iterator().next();
- assertEquals("Wrong EL name of org.jboss.jsr299.tck.tests.definition.name.Moose bean.", "aMoose", bean.getName());
- assertLocationEquals(bean.getNameLocation(), 918, 16);
- }
-
- /**
- * e) A bean comprises of an optional bean EL name (continue).
- */
- public void testNotNamedInJava() {
- IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/name/SeaBass.java");
- Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
- assertEquals("org.jboss.jsr299.tck.tests.definition.name.SeaBass should have the only bean.", 1, beans.size());
- IBean bean = beans.iterator().next();
- assertNull("org.jboss.jsr299.tck.tests.definition.name.Moose bean should not have any EL name.", bean.getName());
- }
}
\ No newline at end of file
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/NameDefinitionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/NameDefinitionTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/NameDefinitionTest.java 2010-03-10 12:48:01 UTC (rev 20728)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.core.test.tck;
+
+import java.util.Set;
+
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.cdi.core.IBean;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class NameDefinitionTest extends TCKTest {
+
+ /**
+ * Section 2 - Concepts
+ * e) A bean comprises of an optional bean EL name.
+ *
+ * @throws JavaModelException
+ */
+ public void testNonDefaultNamed() throws JavaModelException {
+// IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/name/Moose.java");
+// Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
+ Set<IBean> beans = getBeans("org.jboss.jsr299.tck.tests.definition.name.Moose");
+ assertEquals("org.jboss.jsr299.tck.tests.definition.name.Moose should have the only bean.", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertEquals("Wrong EL name of org.jboss.jsr299.tck.tests.definition.name.Moose bean.", "aMoose", bean.getName());
+ assertLocationEquals(bean.getNameLocation(), 918, 16);
+ }
+
+ /**
+ * Section 2 - Concepts
+ * e) A bean comprises of an optional bean EL name (continue).
+ *
+ * @throws JavaModelException
+ */
+ public void testNotNamedInJava() throws JavaModelException {
+ Set<IBean> beans = getBeans("org.jboss.jsr299.tck.tests.definition.name.SeaBass");
+ assertEquals("org.jboss.jsr299.tck.tests.definition.name.SeaBass should have the only bean.", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertNull("org.jboss.jsr299.tck.tests.definition.name.SeaBass bean should not have any EL name.", bean.getName());
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/NameDefinitionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 10 months
JBoss Tools SVN: r20727 - trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-03-10 07:39:27 -0500 (Wed, 10 Mar 2010)
New Revision: 20727
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BeanDefinitionTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5808
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BeanDefinitionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BeanDefinitionTest.java 2010-03-10 12:23:15 UTC (rev 20726)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BeanDefinitionTest.java 2010-03-10 12:39:27 UTC (rev 20727)
@@ -186,6 +186,30 @@
}
/**
+ * section 3.1.3 c)
+ *
+ * @throws JavaModelException
+ */
+ public void testBeanExtendsAnotherBean() throws JavaModelException {
+ Set<IBean> beans = getBeans("org.jboss.jsr299.tck.tests.definition.bean.Spider");
+ assertFalse("No beans found for org.jboss.jsr299.tck.tests.definition.bean.Spider type", beans.isEmpty());
+ beans = getBeans("org.jboss.jsr299.tck.tests.definition.bean.Tarantula");
+ assertFalse("No beans found for org.jboss.jsr299.tck.tests.definition.bean.Tarantula type", beans.isEmpty());
+ }
+
+ /**
+ * section 11.1 bb)
+ *
+ * @throws JavaModelException
+ */
+ public void testBeanClassOnSimpleBean() throws JavaModelException {
+ Set<IBean> beans = getBeans("org.jboss.jsr299.tck.tests.definition.bean.Horse");
+ assertEquals("There should be the only bean with org.jboss.jsr299.tck.tests.definition.bean.Horse type", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertEquals("Wrong Bean Class type of org.jboss.jsr299.tck.tests.definition.bean.Horse bean", "org.jboss.jsr299.tck.tests.definition.bean.Horse", bean.getBeanClass().getFullyQualifiedName());
+ }
+
+ /**
* e) A bean comprises of an optional bean EL name.
*/
public void testNonDefaultNamed() {
14 years, 10 months
JBoss Tools SVN: r20726 - trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-03-10 07:23:15 -0500 (Wed, 10 Mar 2010)
New Revision: 20726
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BeanDefinitionTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5808
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BeanDefinitionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BeanDefinitionTest.java 2010-03-10 12:09:58 UTC (rev 20725)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BeanDefinitionTest.java 2010-03-10 12:23:15 UTC (rev 20726)
@@ -35,7 +35,7 @@
Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
assertEquals("There should be the only bean in org.jboss.jsr299.tck.tests.definition.bean.RedSnapper", 1, beans.size());
beans = cdiProject.getBeans(true, "org.jboss.jsr299.tck.tests.definition.bean.RedSnapper");
- assertEquals("There should be the only bean in org.jboss.jsr299.tck.tests.definition.bean.RedSnapper", 1, beans.size());
+ assertEquals("There should be the only bean with org.jboss.jsr299.tck.tests.definition.bean.RedSnapper type", 1, beans.size());
IBean bean = beans.iterator().next();
assertTrue("No legal types were found for org.jboss.jsr299.tck.tests.definition.bean.RedSnapper bean.", bean.getLegalTypes().size() > 0);
Set<ITypeDeclaration> declarations = bean.getAllTypeDeclarations();
@@ -52,10 +52,8 @@
* @throws JavaModelException
*/
public void testQualifiersNonEmpty() throws JavaModelException {
-// IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/bean/RedSnapper.java");
-// Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
Set<IBean> beans = getBeans("org.jboss.jsr299.tck.tests.definition.bean.RedSnapper");
- assertEquals("There should be the only bean in org.jboss.jsr299.tck.tests.definition.bean.RedSnapper", 1, beans.size());
+ assertEquals("There should be the only bean with org.jboss.jsr299.tck.tests.definition.bean.RedSnapper type", 1, beans.size());
Set<IQualifier> qs = beans.iterator().next().getQualifiers();
assertTrue("No qualifiers were found for org.jboss.jsr299.tck.tests.definition.bean.RedSnapper bean.", qs.size() > 0);
@@ -92,10 +90,8 @@
*
*/
public void testHasScopeType() throws JavaModelException {
-// IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/bean/RedSnapper.java");
-// Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
Set<IBean> beans = getBeans("org.jboss.jsr299.tck.tests.definition.bean.RedSnapper");
- assertEquals("There should be the only bean in org.jboss.jsr299.tck.tests.definition.bean.RedSnapper", 1, beans.size());
+ assertEquals("There should be the only bean with org.jboss.jsr299.tck.tests.definition.bean.RedSnapper type", 1, beans.size());
IBean bean = beans.iterator().next();
IScope scope = bean.getScope();
assertNotNull("org.jboss.jsr299.tck.tests.definition.bean.RedSnapper bean desn't have a scope.", scope);
@@ -125,7 +121,7 @@
*/
public void testBeanTypes() throws JavaModelException {
Set<IBean> beans = getBeans("org.jboss.jsr299.tck.tests.definition.bean.Tarantula");
- assertEquals("There should be the only bean in org.jboss.jsr299.tck.tests.definition.bean.Tarantula", 1, beans.size());
+ assertEquals("There should be the only bean with org.jboss.jsr299.tck.tests.definition.bean.Tarantula type", 1, beans.size());
IBean bean = beans.iterator().next();
Set<IParametedType> types = bean.getLegalTypes();
assertEquals("Wrong number of legal types were found for org.jboss.jsr299.tck.tests.definition.bean.Tarantula bean.", 6, types.size());
@@ -150,7 +146,7 @@
*/
public void testAbstractApiType() throws JavaModelException {
Set<IBean> beans = getBeans("org.jboss.jsr299.tck.tests.definition.bean.FriendlyAntelope");
- assertEquals("There should be the only bean in org.jboss.jsr299.tck.tests.definition.bean.FriendlyAntelope", 1, beans.size());
+ assertEquals("There should be the only bean with org.jboss.jsr299.tck.tests.definition.bean.FriendlyAntelope type", 1, beans.size());
IBean bean = beans.iterator().next();
Set<IParametedType> types = bean.getLegalTypes();
assertEquals("Wrong number of legal types were found for org.jboss.jsr299.tck.tests.definition.bean.FriendlyAntelope bean.", 4, types.size());
@@ -166,6 +162,30 @@
}
/**
+ * section 2.2.1, d)
+ *
+ * @throws JavaModelException
+ */
+ public void testFinalApiType() throws JavaModelException {
+ Set<IBean> beans = getBeans("org.jboss.jsr299.tck.tests.definition.bean.DependentFinalTuna");
+ assertFalse("No beans found for org.jboss.jsr299.tck.tests.definition.bean.DependentFinalTuna type", beans.isEmpty());
+ }
+
+ /**
+ * section 3.1.3, bd)
+ * section 11.1, ba)
+ *
+ * @throws JavaModelException
+ */
+ public void testMultipleStereotypes() throws JavaModelException {
+ Set<IBean> beans = getBeans("org.jboss.jsr299.tck.tests.definition.bean.ComplicatedTuna");
+ assertEquals("There should be the only bean with org.jboss.jsr299.tck.tests.definition.bean.ComplicatedTuna type", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertEquals("Wrong scope type of org.jboss.jsr299.tck.tests.definition.bean.ComplicatedTuna bean", "javax.enterprise.context.RequestScoped", bean.getScope().getSourceType().getFullyQualifiedName());
+ assertEquals("Wrong EL name of org.jboss.jsr299.tck.tests.definition.bean.ComplicatedTuna bean", "complicatedTuna", bean.getName());
+ }
+
+ /**
* e) A bean comprises of an optional bean EL name.
*/
public void testNonDefaultNamed() {
14 years, 10 months
JBoss Tools SVN: r20725 - trunk/jbpm/docs/converter_ref/en-US.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2010-03-10 07:09:58 -0500 (Wed, 10 Mar 2010)
New Revision: 20725
Modified:
trunk/jbpm/docs/converter_ref/en-US/bpmn2jpdl.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-1133 - corrected the issue of BPMN Convert User Guide reported by Jiri Peterka
Modified: trunk/jbpm/docs/converter_ref/en-US/bpmn2jpdl.xml
===================================================================
--- trunk/jbpm/docs/converter_ref/en-US/bpmn2jpdl.xml 2010-03-10 11:11:24 UTC (rev 20724)
+++ trunk/jbpm/docs/converter_ref/en-US/bpmn2jpdl.xml 2010-03-10 12:09:58 UTC (rev 20725)
@@ -46,7 +46,7 @@
<itemizedlist>
<listitem>
<para>Select 'test.bpmn' file and right-click it. Open the export wizard by
- <emphasis><property>Export... > BPMN Export > BPMN -> JPDL</property></emphasis>
+ <emphasis><property>Export... -> BPMN -> BPMN to jPDL</property></emphasis>
.
</para>
<figure>
14 years, 10 months
JBoss Tools SVN: r20724 - trunk/smooks/docs/reference/en-US.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2010-03-10 06:11:24 -0500 (Wed, 10 Mar 2010)
New Revision: 20724
Modified:
trunk/smooks/docs/reference/en-US/references.xml
trunk/smooks/docs/reference/en-US/tasks.xml
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-1133 - corrected the issues of Smooks guide reported by Jiri Peterka.Updated "Apply Template" section and "Smooks Configuration testing using Smooks Run Configuration" section.</p>
</body></html>
Modified: trunk/smooks/docs/reference/en-US/references.xml
===================================================================
--- trunk/smooks/docs/reference/en-US/references.xml 2010-03-10 10:37:57 UTC (rev 20723)
+++ trunk/smooks/docs/reference/en-US/references.xml 2010-03-10 11:11:24 UTC (rev 20724)
@@ -208,27 +208,29 @@
<listitem><para><emphasis>CSV</emphasis></para><itemizedlist>
<listitem><para><emphasis>Fields</emphasis> - Comma separated list of CSV record field names
</para></listitem>
- <listitem><para><emphasis>Separator Character</emphasis> - Field separator character. Default of ','.
+ <listitem><para><emphasis>Separator Character</emphasis> - Field separator character.
</para></listitem>
- <listitem><para><emphasis>Quote Character</emphasis> - Quote character. Default of '"'.
+ <listitem><para><emphasis>Quote Character</emphasis> - Quote character.
</para></listitem>
- <listitem><para><emphasis>Record Name</emphasis> - Name of csv record element.Default:csv-record</para></listitem>
- <listitem><para><emphasis>Root Name</emphasis> - Name of csv root element.Default:csv-set</para></listitem>
- <listitem><para><emphasis>indent</emphasis> - Add indentation character data to the generated event stream. This simply makes
+ <listitem><para><emphasis>Record Name</emphasis> - Name of csv record element.</para></listitem>
+ <listitem><para><emphasis>Root Name</emphasis> - Name of csv root element.</para></listitem>
+ <listitem><para><emphasis>indent</emphasis> - Add indentation character data to
+ the generated event stream. This simply makes
the generated event stream easier to read in its serialized form. Useful for
- testing etc.Default:true
+ testing etc.
</para></listitem>
- <listitem><para><emphasis>Skip Lines</emphasis> - Number of lines to skip before processing starts. Default of 0.
-
+ <listitem><para><emphasis>Skip Lines</emphasis> - Number of lines to skip before processing starts.
</para></listitem>
</itemizedlist>
</listitem>
<listitem><para><emphasis>EDI</emphasis></para>
<itemizedlist>
- <listitem><para><emphasis>Target Profile</emphasis> - Defines the target profile
+ <listitem><para><emphasis>Target Profile</emphasis> - Defines the output
+ transformation profile
</para></listitem>
- <listitem><para><emphasis>Encoding</emphasis> - The character encoding. Default "UTF-8"</para></listitem>
- <listitem><para><emphasis>Mapping Model</emphasis> - Defines the EDI Mapping Model configuration for processing the
+ <listitem><para><emphasis>Encoding</emphasis> - The character encoding.</para></listitem>
+ <listitem><para><emphasis>Mapping Model</emphasis> - Defines the EDI Mapping Model
+ configuration for processing the
EDI message stream to a stream of SAX events that can be processed by Smooks.</para></listitem>
<listitem><para><emphasis>Validate</emphasis> - This attribute turns on/off datatype validation in the EDI Parser.
Validation is on by default.
@@ -240,16 +242,16 @@
<listitem><para><emphasis>JSON</emphasis></para>
<itemizedlist>
<listitem><para><emphasis>Target Profile</emphasis> - Defines the output transformation profile</para></listitem>
- <listitem><para><emphasis>Array Element Name</emphasis> - The element name of a array element. Default of 'element'.
+ <listitem><para><emphasis>Array Element Name</emphasis> - The element name of an array element.
</para></listitem>
<listitem><para><emphasis>Encoding</emphasis> - encoding: The default encoding of any JSON message
- InputStream processed by this Reader. Default of 'UTF-8'.</para></listitem>
+ InputStream processed by this Reader.</para></listitem>
<listitem><para><emphasis>Illegal Element Name Char Replacement</emphasis> - If illegal characters are encountered in a JSON element name then they are replaced with this value.
By default this is not defined, so that the reader doesn't doesn't search for illegal characters.
</para></listitem>
<listitem><para><emphasis>Indent</emphasis> - Add indentation character data to the generated event stream. This simply makes
the generated event stream easier to read in its serialized form. Useful for
- testing etc.Default:false.
+ testing etc.
</para></listitem>
<listitem><para><emphasis>Key Prefix on Numeric</emphasis> - The prefix character to add if the JSON node name starts with a number.
By default this is not defined, so that the reader doesn't search for element names that start with a number.
@@ -257,8 +259,8 @@
<listitem><para><emphasis>Key Whitespace Replacement</emphasis> - The replacement character for whitespaces in a JSON map key.
By default this not defined, so that the reader doesn't search for whitespaces.
</para></listitem>
- <listitem><para><emphasis>Null Value Replacement</emphasis> - The replacement string for JSON NULL values. Default is ""(an empty string). </para></listitem>
- <listitem><para><emphasis>Root Name</emphasis> - The element name of the document root. Default of 'json'.
+ <listitem><para><emphasis>Null Value Replacement</emphasis> - The replacement string for JSON NULL values.</para></listitem>
+ <listitem><para><emphasis>Root Name</emphasis> - The element name of the document root.
</para></listitem>
<listitem><para><emphasis>Key Maps</emphasis> - Defines a JSON element name mapping
The "from" key will be replaced with the "to" key or the contents of the element.
Modified: trunk/smooks/docs/reference/en-US/tasks.xml
===================================================================
--- trunk/smooks/docs/reference/en-US/tasks.xml 2010-03-10 10:37:57 UTC (rev 20723)
+++ trunk/smooks/docs/reference/en-US/tasks.xml 2010-03-10 11:11:24 UTC (rev 20724)
@@ -10,7 +10,9 @@
</chapterinfo>
<title>Tasks</title>
<para>This chapter describes the main tasks a user can be faced during Smooks tools usage.
- Here we use the example that can be downloaded from <ulink url="http://sourceforge.net/projects/smooks/files/Smooks%20v1.2/Smooks%20v1.2/...">here</ulink> </para>
+ In this chapter we use the example that can be downloaded from
+ <ulink url="http://anonsvn.jboss.org/repos/jbosstools/trunk/smooks/docs/reference/xml...">
+ here</ulink>. </para>
<section id="config_file_wizzard">
<title>New Smooks Configuration File Creation</title>
<para>Select the project where you want to create new Smooks Configuration File and right-click on it,
@@ -180,7 +182,7 @@
</mediaobject>
</figure>
<para>
- On the next wizard page put the following string into the Fields,select Output fields Names and click <property>Finish</property>.</para>
+ On the next wizard page put the following string into the Fields,select <property>Output Fields Names</property> and click <property>Finish</property>.</para>
<figure>
<title>CSV output message configuration</title>
<mediaobject>
@@ -190,11 +192,15 @@
</mediaobject>
</figure>
<para>
- After these steps "Apply Template" task will appear to the right, connected to the task you created it from.
+ After these steps <property>"Apply Template"</property>
+ task will appear to the right, connected to the task you created it from.
To continue the process of configuration you should click on it and find <emphasis>CSV Template</emphasis>
- item with entered fields on the canvas.Now you can click and drag from various input elements to corresponding output elements
- in the template. Make sure to connect collection elements to corresponding <emphasis>csv-record</emphasis>
- In our example we transfer into CSV output only the elements of orderItems collection(see picture below)
+ item with entered fields on the canvas.Now you can click and drag from various
+ input elements to corresponding output elements
+ in the template. Make sure to connect collection elements to the c
+ orresponding <emphasis>csv-record</emphasis>.
+ In our example we transfer into CSV output only the elements
+ of <property>orderItems</property> collection (see the picture below):
</para>
<figure>
<title>Relations between input and output models</title>
14 years, 10 months
JBoss Tools SVN: r20723 - trunk/smooks/docs/reference.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2010-03-10 05:37:57 -0500 (Wed, 10 Mar 2010)
New Revision: 20723
Added:
trunk/smooks/docs/reference/xml-to-java.zip
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-1133 - corrected the issues of Smooks guide reported by Jiri Peterka.Updated "Apply Template" section and "Smooks Configuration testing using Smooks Run Configuration" section.Added test project to the doc folder.</p>
</body></html>
Added: trunk/smooks/docs/reference/xml-to-java.zip
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/docs/reference/xml-to-java.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 10 months
JBoss Tools SVN: r20722 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-03-10 02:50:09 -0500 (Wed, 10 Mar 2010)
New Revision: 20722
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
Log:
JBIDE-6024 to trunk
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2010-03-10 04:11:50 UTC (rev 20721)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2010-03-10 07:50:09 UTC (rev 20722)
@@ -92,7 +92,11 @@
if (publishType == FULL_PUBLISH ) {
status = fullPublish(module, module[module.length-1], monitor);
} else if (publishType == INCREMENTAL_PUBLISH) {
- status = incrementalPublish(module, module[module.length-1], monitor);
+ if(getDeployPath(module, this.server).toFile().isDirectory()) {
+ status = incrementalPublish(module, module[module.length-1], monitor);
+ } else {
+ status =fullPublish(module, module[module.length-1], monitor);
+ }
}
}
}
14 years, 10 months