JBoss Tools SVN: r10579 - trunk/tests/features/org.jboss.tools.test.feature.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-09-30 16:50:41 -0400 (Tue, 30 Sep 2008)
New Revision: 10579
Modified:
trunk/tests/features/org.jboss.tools.test.feature/feature.xml
Log:
add test for el parser into build
Modified: trunk/tests/features/org.jboss.tools.test.feature/feature.xml
===================================================================
--- trunk/tests/features/org.jboss.tools.test.feature/feature.xml 2008-09-30 19:29:16 UTC (rev 10578)
+++ trunk/tests/features/org.jboss.tools.test.feature/feature.xml 2008-09-30 20:50:41 UTC (rev 10579)
@@ -375,4 +375,10 @@
install-size="0"
version="0.0.0"/>
+ <plugin
+ id="org.jboss.tools.common.el.core.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
</feature>
16 years, 2 months
JBoss Tools SVN: r10578 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-09-30 15:29:16 -0400 (Tue, 30 Sep 2008)
New Revision: 10578
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeEditAnyDialog.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2530
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeEditAnyDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeEditAnyDialog.java 2008-09-30 19:15:18 UTC (rev 10577)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeEditAnyDialog.java 2008-09-30 19:29:16 UTC (rev 10578)
@@ -28,7 +28,7 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.outline.cssdialog.CSSDialog;
+import org.jboss.tools.jst.jsp.outline.cssdialog.CSSStyleDialog;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.MessageUtil;
import org.jboss.tools.vpe.messages.VpeUIMessages;
@@ -126,7 +126,7 @@
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
- CSSDialog cssDialog = new CSSDialog(composite.getShell(),txtStyle.getText());
+ CSSStyleDialog cssDialog = new CSSStyleDialog(composite.getShell(),txtStyle.getText());
if (cssDialog.open() == Window.OK) {
txtStyle.setText(cssDialog.getNewStyle());
}
16 years, 2 months
JBoss Tools SVN: r10577 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline: cssdialog and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-09-30 15:15:18 -0400 (Tue, 30 Sep 2008)
New Revision: 10577
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSStyleDialog.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/FileExtensionFilter.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/ChangeStyleEvent.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/ChangeStyleListener.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/StyleAttributes.java
Removed:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSDialog.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/ImageSelectionDialog.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Util.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/messages.properties
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/TabPropertySheetMouseAdapter.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/parsers/ParserListener.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBackgroundControl.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBoxesControl.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabPropertySheetControl.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabTextControl.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2530
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java 2008-09-30 18:45:39 UTC (rev 10576)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -26,7 +26,8 @@
import org.jboss.tools.jst.jsp.contentassist.FaceletsHtmlContentAssistProcessor;
import org.jboss.tools.jst.jsp.contentassist.JSPDialogCellEditorContentAssistProcessor;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.RootElement;
-import org.jboss.tools.jst.jsp.outline.cssdialog.CSSDialog;
+import org.jboss.tools.jst.jsp.outline.cssdialog.CSSClassDialog;
+import org.jboss.tools.jst.jsp.outline.cssdialog.CSSStyleDialog;
/**
* @author Kabanovich Cell Editor for JSP attributes, of which values can be
@@ -116,15 +117,22 @@
: "";
context.put("value", value);
- if (attributeName.equals("style")) {
- CSSDialog dialog = new CSSDialog(cellEditorWindow.getShell(), (value == null ? ""
+ if (attributeName.equals("style") || attributeName.endsWith("Style")) {
+ CSSStyleDialog dialog = new CSSStyleDialog(cellEditorWindow.getShell(), (value == null ? ""
: value));
if (dialog.open() == Window.OK) {
externalEditing = false;
return dialog.getNewStyle();
}
- } else {
+ } else if (attributeName.endsWith("Class") || attributeName.endsWith("class") ) {
+ CSSClassDialog dialog = new CSSClassDialog(cellEditorWindow.getShell());
+ if (dialog.open() == Window.OK) {
+ externalEditing = false;
+ return dialog.getSelectorName();
+ }
+ }
+ else {
JSPTreeDialog dialog = new JSPTreeDialog();
dialog.setObject(context);
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -0,0 +1,246 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.cssdialog;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.model.BaseWorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSModel;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.FileExtensionFilter;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.MessageUtil;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.ChangeStyleEvent;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.ChangeStyleListener;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
+
+public class CSSClassDialog extends Dialog {
+
+ private Browser browser = null;
+ private StyleComposite styleComposite = null;
+ private StyleAttributes styleAttributes = null;
+ private Text text;
+ private IFile file;
+ private Combo classCombo;
+ private CSSModel cssModel;
+ private String selectorName;
+
+ final static int MIN_HEIGHT_FOR_BROWSER = 60;
+ final static String[] fileExtensions = { "css" };
+ final static String CSS_FILE_SELECT_DIALOG_TITLE = "CSS File Selection";
+ final static String CSS_FILE_SELECT_DIALOG = "Select CSS file from the tree:";
+ final static String CSS_FILE_SELECT_DIALOG_EMPTY_MESSAGE = "No CSS file in the current project";
+ final static String SKIP_FIRST_CHAR = ".";
+
+ public CSSClassDialog(Shell parentShell) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX
+ | SWT.APPLICATION_MODAL);
+ styleAttributes = new StyleAttributes();
+ }
+
+ /**
+ * Method for creating dialog area
+ *
+ * @param parent
+ */
+ protected Control createDialogArea(final Composite parent) {
+
+ final Composite composite = (Composite) super.createDialogArea(parent);
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ composite.setLayout(layout);
+ browser = new Browser(composite, SWT.BORDER);
+
+ /* ============================================= */
+ Composite classComposite = new Composite(composite, SWT.BORDER);
+ GridData gridData = new GridData(GridData.FILL, GridData.FILL, true,
+ false);
+ classComposite.setLayoutData(gridData);
+
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 3;
+ classComposite.setLayout(gridLayout);
+
+ Label label = new Label(classComposite, SWT.LEFT);
+ label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false,
+ false));
+ label.setText("CSS file :");
+
+ text = new Text(classComposite, SWT.BORDER);
+ text.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true,
+ false));
+ text.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+
+ IProject project = Util.getCurrentProject();
+ IResource res = project.findMember(text.getText());
+ if (res != null) {
+ if (res instanceof IFile) {
+ file = (IFile) res;
+ cssModel = new CSSModel(file);
+ classCombo.removeAll();
+ List<String> selectors = cssModel.getSelectors();
+ for (String selector : selectors) {
+ classCombo.add(selector);
+ }
+ }
+ }
+ }
+
+ });
+
+ Button button = new Button(classComposite, SWT.PUSH);
+ button.setLayoutData(new GridData(GridData.END, GridData.CENTER, false,
+ false));
+
+ ImageDescriptor imageDesc = JspEditorPlugin
+ .getImageDescriptor(Constants.IMAGE_FOLDERLARGE_FILE_LOCATION);
+ Image image = imageDesc.createImage();
+ button.setImage(image);
+ button.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ Button button = (Button) e.getSource();
+ button.getImage().dispose();
+ }
+ });
+
+ label = new Label(classComposite, SWT.LEFT);
+ label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false,
+ false));
+ label.setText("Style class :");
+
+ gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ gridData.horizontalSpan = 2;
+ classCombo = new Combo(classComposite, SWT.BORDER);
+ classCombo.setLayoutData(gridData);
+ classCombo.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ String style = cssModel.getStyle(classCombo.getText());
+ styleComposite.recreateStyleComposite(style);
+ }
+
+ });
+
+
+
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+
+ IProject project = Util.getCurrentProject();
+
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
+ getShell(), new WorkbenchLabelProvider(),
+ new BaseWorkbenchContentProvider());
+ dialog.addFilter(new FileExtensionFilter(fileExtensions));
+ dialog.setTitle(CSS_FILE_SELECT_DIALOG_TITLE);
+ dialog.setMessage(CSS_FILE_SELECT_DIALOG);
+ dialog.setInput(project);
+ dialog.setAllowMultiple(false);
+ dialog
+ .setEmptyListMessage(CSS_FILE_SELECT_DIALOG_EMPTY_MESSAGE);
+ dialog.open();
+ IResource res = (IResource) dialog.getFirstResult();
+ text.setText(res.getProjectRelativePath().toOSString());
+
+ }
+ });
+
+ /* ============================================ */
+ styleAttributes.addChangeStyleListener(new ChangeStyleListener() {
+ public void styleChanged(ChangeStyleEvent event) {
+ String styleForSpan = "";
+ String html = "";
+
+ Set<String> keySet = styleAttributes.keySet();
+
+ for (String key : keySet)
+ styleForSpan += key + Constants.COLON_STRING
+ + styleAttributes.getAttribute(key)
+ + Constants.SEMICOLON_STRING;
+
+ html = Constants.OPEN_SPAN_TAG + styleForSpan
+ + Constants.TEXT_FOR_PREVIEW + Constants.CLOSE_SPAN_TAG;
+ browser.setText(html);
+ }
+ });
+ styleComposite = new StyleComposite(composite, styleAttributes, "");
+
+ gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
+ gridData.minimumHeight = MIN_HEIGHT_FOR_BROWSER;
+ browser.setLayoutData(gridData);
+
+ return composite;
+ }
+
+ /**
+ * Method for setting title for dialog
+ *
+ * @param newShell
+ */
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(MessageUtil.getString("CSS_STYLE_CLASS_DIALOG_TITLE"));
+ }
+
+ protected void okPressed() {
+ styleComposite.updateStyle();
+ String newStyle = styleComposite.getNewStyle();
+ cssModel.setCSS(classCombo.getText(), newStyle);
+ cssModel.saveModel();
+ String sel = classCombo.getText();
+ if (sel.trim().startsWith(SKIP_FIRST_CHAR)) {
+ sel = sel.substring(1);
+ }
+ selectorName = sel;
+ super.okPressed();
+ }
+
+ public String getSelectorName() {
+ return selectorName;
+ }
+
+}
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSDialog.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSDialog.java 2008-09-30 18:45:39 UTC (rev 10576)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSDialog.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -1,419 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-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.common.MessageUtil;
-import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.BaseListener;
-import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.CSSElementsParser;
-import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.ComboParser;
-import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.Parser;
-import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.ParserListener;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabBackgroundControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabBoxesControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabPropertySheetControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabQuickEditControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabTextControl;
-import org.xml.sax.Attributes;
-
-/**
- * Class for CSS editor dialog
- *
- * @author Dzmitry Sakovich (dsakovich(a)exadel.com)
- */
-public class CSSDialog extends Dialog {
-
- private static int MIN_HEIGHT_FOR_BROWSER = 60;
-
- private static int TAB_TEXT_FONT_NUMBER = 0;
- private static int TAB_QUICK_EDIT_NUMBER = 4;
-
- private static int SIZE_NULL = 0;
-
- private static int FIRST_SELECTION = 0;
-
- private static String NODE_NAME_ELEMENTS = "elements";
- private static String NODE_NAME_VALUE = "value";
- private static String NODE_NAME_ELEMENT = "element";
- private static String NODE_ATTRIBUTE_NAME = "name";
-
- private Browser browser = null;
-
- private String oldStyle;
- private String newStyle;
-
- private TabItem lastSelectedTab = null;
-
- private TabTextControl tabTextControl;
- private TabBackgroundControl tabBackgroundControl;
- private TabBoxesControl tabBoxesControl;
- private TabPropertySheetControl tabPropertySheetControl;
- private TabQuickEditControl tabQuickEditControl;
-
- private TabItem tabTextFont;
- private TabItem tabBackground;
- private TabItem tabBoxes;
- private TabItem tabPropertySheet;
- private TabItem tabQuickEdit;
-
- private HashMap<String, ArrayList<String>> comboMap = new HashMap<String, ArrayList<String>>();
- private HashMap<String, ArrayList<String>> elementsMap = new HashMap<String, ArrayList<String>>();
- private HashMap<String, String> attributesMap = new HashMap<String, String>();
-
- public CSSDialog(final Shell parentShell, String oldStyle) {
- super(parentShell);
- setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX
- | SWT.APPLICATION_MODAL);
- this.oldStyle = oldStyle;
-
- ComboParser comboParser = new ComboParser();
- comboParser.setListener(new BaseListener(comboMap) {
-
- private ArrayList<String> list = null;
-
- public void startElement(String uri, String localName,
- String nodeName, Attributes attrs) {
-
- if (nodeName.trim().equalsIgnoreCase(NODE_NAME_ELEMENTS))
- return;
-
- if (!nodeName.trim().equalsIgnoreCase(NODE_NAME_VALUE)) {
- String name = nodeName;
- list = new ArrayList<String>();
- map.put(name, list);
- } else {
- list.add(attrs.getValue(NODE_ATTRIBUTE_NAME));
- }
- }
-
- });
- comboParser.parse();
-
- CSSElementsParser cssParser = new CSSElementsParser();
- cssParser.setListener(new BaseListener(elementsMap) {
-
- private ArrayList<String> list = null;
-
- public void startElement(String uri, String localName,
- String nodeName, Attributes attrs) {
-
- if (nodeName.trim().equalsIgnoreCase(NODE_NAME_ELEMENTS))
- return;
-
- if (!nodeName.trim().equalsIgnoreCase(NODE_NAME_ELEMENT)) {
- String name = nodeName;
- list = new ArrayList<String>();
- map.put(name, list);
- } else {
- list.add(attrs.getValue(NODE_ATTRIBUTE_NAME));
- }
- }
-
- });
- cssParser.parse();
-
- }
-
- /**
- * Getter for newStyle attribute
- *
- * @return
- */
- public String getNewStyle() {
- return newStyle;
- }
-
- /**
- * Setter for newStyle attribute
- *
- * @param newStyle
- */
- public void setNewStyle(String newStyle) {
- this.newStyle = newStyle;
- }
-
- /**
- * Method for creating dialog area
- *
- * @param parent
- */
- protected Control createDialogArea(final Composite parent) {
-
- ParserListener listener = new ParserListener(attributesMap);
- Parser parser = new Parser(elementsMap);
- parser.addListener(listener);
- parser.parse(oldStyle);
-
- final Composite composite = (Composite) super.createDialogArea(parent);
-
- final GridData gridData = new GridData(GridData.FILL, GridData.FILL,
- true, true);
-
- composite.setLayoutData(gridData);
- GridData gd = new GridData(GridData.FILL_BOTH
- | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
-
- final TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
- tabFolder.setLayoutData(gd);
-
- // ------------------------Browser-----------------------------------
-
- browser = new Browser(composite, SWT.BORDER);
- GridData gridBrowser = new GridData(GridData.FILL_BOTH);
- gridBrowser.minimumHeight = MIN_HEIGHT_FOR_BROWSER;
- browser.setLayoutData(gridBrowser);
- //browser.se
- setStyleForPreview();
- // ------------------------------------------------------------------
-
- // Create each tab and set its text, tool tip text,
- tabTextFont = new TabItem(tabFolder, SWT.NONE);
- tabTextFont.setText(MessageUtil.getString("TEXT_FONT_TAB_NAME"));
- tabTextFont.setToolTipText(MessageUtil.getString("TEXT_FONT_TAB_NAME"));
- tabTextFont.setControl(createTabTextControl(tabFolder));
- lastSelectedTab = tabTextFont;
-
- tabBackground = new TabItem(tabFolder, SWT.NONE);
- tabBackground.setText(MessageUtil.getString("BACKGROUND_TAB_NAME"));
- tabBackground.setToolTipText(MessageUtil
- .getString("BACKGROUND_TAB_NAME"));
- tabBackground.setControl(createTabBackgroundControl(tabFolder));
-
- tabBoxes = new TabItem(tabFolder, SWT.NONE);
- tabBoxes.setText(MessageUtil.getString("BOXES_TAB_NAME"));
- tabBoxes.setToolTipText(MessageUtil.getString("BOXES_TAB_NAME"));
- tabBoxes.setControl(createTabBoxesControl(tabFolder));
-
- tabPropertySheet = new TabItem(tabFolder, SWT.NONE);
- tabPropertySheet.setText(MessageUtil
- .getString("PROPERTY_SHEET_TAB_NAME"));
- tabPropertySheet.setToolTipText(MessageUtil
- .getString("PROPERTY_SHEET_TAB_NAME"));
- tabPropertySheet.setControl(createTabPropertySheetControl(tabFolder));
-
- tabFolder.setSelection(TAB_TEXT_FONT_NUMBER);
- if (attributesMap.size() > SIZE_NULL) {
- tabQuickEdit = new TabItem(tabFolder, SWT.NONE);
- tabQuickEdit.setText(MessageUtil.getString("QUICK_EDIT_TAB-NAME"));
- tabQuickEdit.setToolTipText(MessageUtil
- .getString("QUICK_EDIT_TAB-NAME"));
- tabQuickEdit.setControl(createTabQuickEditContol(tabFolder));
- tabFolder.setSelection(TAB_QUICK_EDIT_NUMBER);
- lastSelectedTab = tabQuickEdit;
- }
- tabFolder.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent se) {
-
-
- if (tabFolder.getSelection()[FIRST_SELECTION] == tabQuickEdit) {
- tabQuickEditControl.dispose();
- tabQuickEdit
- .setControl(createTabQuickEditContol(tabFolder));
- lastSelectedTab = tabQuickEdit;
- } else if (tabFolder.getSelection()[FIRST_SELECTION] == tabTextFont) {
- tabTextControl.updateData(false);
- lastSelectedTab = tabTextFont;
- } else if (tabFolder.getSelection()[FIRST_SELECTION] == tabBackground) {
- tabBackgroundControl.updateData(false);
- lastSelectedTab = tabBackground;
- } else if (tabFolder.getSelection()[FIRST_SELECTION] == tabBoxes) {
- tabBoxesControl.updateData(false);
- lastSelectedTab = tabBoxes;
- } else if (tabFolder.getSelection()[FIRST_SELECTION] == tabPropertySheet) {
- tabPropertySheetControl.updateData(false);
- lastSelectedTab = tabPropertySheet;
- }
- }
- });
-
- return composite;
- }
-
- /**
- * Method for setting title for dialog
- *
- * @param newShell
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(MessageUtil.getString("CSS_DIALOG_TITLE"));
- }
-
- protected void okPressed() {
-
- if (lastSelectedTab == tabTextFont) {
- tabTextControl.updateData(true);
- } else if (lastSelectedTab == tabBackground) {
- tabBackgroundControl.updateData(true);
- } else if (lastSelectedTab == tabBoxes) {
- tabBoxesControl.updateData(true);
- } else if (lastSelectedTab == tabPropertySheet) {
- tabPropertySheetControl.updateData(true);
- }
- StringBuffer buf = new StringBuffer();
- Set<Entry<String, String>> set = attributesMap.entrySet();
- for (Map.Entry<String, String> me : set) {
- buf.append(me.getKey() + Constants.COLON_STRING + me.getValue()
- + Constants.SEMICOLON_STRING);
- }
- setNewStyle(buf.toString());
- super.okPressed();
- }
-
- /**
- * Method for creating text tab
- *
- * @param tabFolder
- * @return composite
- */
- private Control createTabTextControl(TabFolder tabFolder) {
-
- ScrolledComposite sc = new ScrolledComposite(tabFolder, SWT.H_SCROLL
- | SWT.V_SCROLL);
-
- sc.setExpandHorizontal(true);
- sc.setExpandVertical(true);
-
- tabTextControl = new TabTextControl(sc, comboMap, attributesMap, this);
- sc.setContent(tabTextControl);
-
- sc.setMinSize(tabTextControl.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- return sc;
- }
-
- /**
- * Method for creating background tab
- *
- * @param tabFolder
- * @return composite
- */
- private Control createTabBackgroundControl(TabFolder tabFolder) {
- ScrolledComposite sc = new ScrolledComposite(tabFolder, SWT.H_SCROLL
- | SWT.V_SCROLL);
-
- sc.setExpandHorizontal(true);
- sc.setExpandVertical(true);
-
- tabBackgroundControl = new TabBackgroundControl(sc, comboMap,
- attributesMap, this);
- sc.setContent(tabBackgroundControl);
- sc.setMinSize(tabBackgroundControl
- .computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- return sc;
- }
-
- /**
- * Method for creating boxes tab
- *
- * @param tabFolder
- * @return composite
- */
- private Control createTabBoxesControl(TabFolder tabFolder) {
-
- ScrolledComposite sc = new ScrolledComposite(tabFolder, SWT.H_SCROLL
- | SWT.V_SCROLL);
-
- sc.setExpandHorizontal(true);
- sc.setExpandVertical(true);
-
- tabBoxesControl = new TabBoxesControl(sc, comboMap, attributesMap, this);
- sc.setContent(tabBoxesControl);
- sc.setMinSize(tabBoxesControl.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- return sc;
- }
-
- /**
- *
- * Method for creating property sheet tab
- *
- * @param tabFolder
- * @return
- */
- private Control createTabPropertySheetControl(TabFolder tabFolder) {
- tabPropertySheetControl = new TabPropertySheetControl(tabFolder,
- elementsMap, comboMap, attributesMap, this);
- return tabPropertySheetControl;
- }
-
- /**
- *
- * Method for creating quick edit tab
- *
- * @param tabFolder
- * @return
- */
- private Control createTabQuickEditContol(TabFolder tabFolder) {
-
- ScrolledComposite sc = new ScrolledComposite(tabFolder, SWT.H_SCROLL
- | SWT.V_SCROLL);
-
- sc.setExpandHorizontal(true);
- sc.setExpandVertical(true);
-
- tabQuickEditControl = new TabQuickEditControl(sc, comboMap,
- attributesMap, this);
- sc.setContent(tabQuickEditControl);
-
- sc
- .setMinSize(tabQuickEditControl.computeSize(SWT.DEFAULT,
- SWT.DEFAULT));
- return sc;
- }
-
- @Override
- protected IDialogSettings getDialogBoundsSettings() {
- return JspEditorPlugin.getDefault().getDialogSettings();
- }
-
- /**
- *
- * Set style for preview
- */
- public void setStyleForPreview() {
-
- String styleForSpan = "";
- String html = "";
-
- Set<String> keySet = attributesMap.keySet();
-
- for (String key : keySet)
- styleForSpan += key + Constants.COLON_STRING
- + attributesMap.get(key) + Constants.SEMICOLON_STRING;
-
- html = Constants.OPEN_SPAN_TAG + styleForSpan
- + Constants.TEXT_FOR_PREVIEW + Constants.CLOSE_SPAN_TAG;
- browser.setText(html);
- }
-}
\ No newline at end of file
Copied: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSStyleDialog.java (from rev 10421, trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSDialog.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSStyleDialog.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSStyleDialog.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.cssdialog;
+
+import java.util.Set;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+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.common.MessageUtil;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.ChangeStyleEvent;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.ChangeStyleListener;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
+
+/**
+ * Class for CSS editor dialog
+ *
+ * @author Dzmitry Sakovich (dsakovich(a)exadel.com)
+ */
+public class CSSStyleDialog extends Dialog {
+
+
+ //TODO Dzmitry Sakovich
+ private Browser browser = null;
+ private StyleComposite styleComposite = null;
+ private String oldStyle;
+ private StyleAttributes styleAttributes = new StyleAttributes();
+
+
+ final static int MIN_HEIGHT_FOR_BROWSER = 60;
+
+ public CSSStyleDialog(final Shell parentShell, String oldStyle) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX
+ | SWT.APPLICATION_MODAL);
+ this.oldStyle = oldStyle;
+ }
+
+ /**
+ * Getter for newStyle attribute
+ *
+ * @return
+ */
+ public String getNewStyle() {
+ return styleComposite==null?oldStyle:styleComposite.getNewStyle();
+ }
+
+ /**
+ * Method for creating dialog area
+ *
+ * @param parent
+ */
+ protected Control createDialogArea(final Composite parent) {
+
+
+ final Composite composite = (Composite) super.createDialogArea(parent);
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ browser = new Browser(composite,SWT.BORDER);
+
+ composite.setLayout(layout);
+
+ styleAttributes.addChangeStyleListener(new ChangeStyleListener() {
+ public void styleChanged(ChangeStyleEvent event) {
+ String styleForSpan = "";
+ String html = "";
+
+ Set<String> keySet = styleAttributes.keySet();
+
+ for (String key : keySet)
+ styleForSpan += key + Constants.COLON_STRING
+ + styleAttributes.getAttribute(key) + Constants.SEMICOLON_STRING;
+
+ html = Constants.OPEN_SPAN_TAG + styleForSpan
+ + Constants.TEXT_FOR_PREVIEW + Constants.CLOSE_SPAN_TAG;
+ browser.setText(html);
+ }
+ });
+ styleComposite = new StyleComposite(composite,styleAttributes,oldStyle);
+
+ GridData gridData = new GridData(GridData.FILL, GridData.FILL, true,
+ true);
+ gridData.minimumHeight = MIN_HEIGHT_FOR_BROWSER;
+ browser.setLayoutData(gridData);
+
+ return composite;
+ }
+
+ /**
+ * Method for setting title for dialog
+ *
+ * @param newShell
+ */
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(MessageUtil.getString("CSS_STYLE_DIALOG_TITLE"));
+ }
+
+ protected void okPressed() {
+ styleComposite.updateStyle();
+ super.okPressed();
+ }
+
+ @Override
+ protected IDialogSettings getDialogBoundsSettings() {
+ return JspEditorPlugin.getDefault().getDialogSettings();
+ }
+}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/ImageSelectionDialog.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/ImageSelectionDialog.java 2008-09-30 18:45:39 UTC (rev 10576)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/ImageSelectionDialog.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -18,12 +18,8 @@
import java.util.List;
import java.util.Set;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -37,7 +33,6 @@
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.viewers.ViewerSorter;
@@ -70,7 +65,7 @@
import org.eclipse.ui.dialogs.ISelectionStatusValidator;
import org.eclipse.ui.dialogs.SelectionStatusDialog;
import org.eclipse.ui.internal.WorkbenchMessages;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.FileExtensionFilter;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.MessageUtil;
/**
@@ -687,45 +682,4 @@
}
return elements.length == 0;
}
-
- /**
- * Class for creates filter by file extensions
- *
- * @author dsakovich
- */
- private class FileExtensionFilter extends ViewerFilter {
-
- private String[] fTargetExtension;
-
- public FileExtensionFilter(String[] targetExtension) {
- fTargetExtension = targetExtension;
- }
-
- public boolean select(Viewer viewer, Object parent, Object element) {
- if (element instanceof IFile) {
- for (int i = 0; i < fTargetExtension.length; i++) {
- if (((IFile) element).getName().toLowerCase().endsWith(
- "." + fTargetExtension[i])) {
- return true;
- }
- }
- return false;
- }
- if (element instanceof IProject && ((IProject) element).isOpen())
- return true;
- if (element instanceof IContainer) { // i.e. IProject, IFolder
- try {
- IResource[] resources = ((IContainer) element).members();
- for (int i = 0; i < resources.length; i++) {
- if (select(viewer, parent, resources[i]))
- return true;
- }
- } catch (CoreException e) {
- JspEditorPlugin.getPluginLog().logError(e);
- }
- }
- return false;
- }
- }
-
}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -0,0 +1,375 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.cssdialog;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.MessageUtil;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
+import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.BaseListener;
+import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.CSSElementsParser;
+import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.ComboParser;
+import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.Parser;
+import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.ParserListener;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabBackgroundControl;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabBoxesControl;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabPropertySheetControl;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabQuickEditControl;
+import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabTextControl;
+import org.xml.sax.Attributes;
+
+/**
+ * Class for creating style tabs
+ *
+ * @author Dzmitry Sakovich (dsakovich(a)exadel.com)
+ */
+public class StyleComposite extends Composite {
+
+ private String newStyle;
+ private String oldStyle;
+
+ private TabTextControl tabTextControl;
+ private TabBackgroundControl tabBackgroundControl;
+ private TabBoxesControl tabBoxesControl;
+ private TabPropertySheetControl tabPropertySheetControl;
+ private TabQuickEditControl tabQuickEditControl;
+
+ private TabFolder tabFolder;
+ private TabItem tabTextFont;
+ private TabItem tabBackground;
+ private TabItem tabBoxes;
+ private TabItem tabPropertySheet;
+ private TabItem tabQuickEdit;
+
+ private TabItem lastSelectedTab = null;
+
+ private StyleAttributes styleAttributes;
+ private Parser parser;
+ private HashMap<String, ArrayList<String>> comboMap = new HashMap<String, ArrayList<String>>();
+ private HashMap<String, ArrayList<String>> elementsMap = new HashMap<String, ArrayList<String>>();
+
+ private static String NODE_NAME_ELEMENTS = "elements";
+ private static String NODE_NAME_VALUE = "value";
+ private static String NODE_NAME_ELEMENT = "element";
+ private static String NODE_ATTRIBUTE_NAME = "name";
+ private static int TAB_TEXT_FONT_NUMBER = 0;
+ private static int TAB_QUICK_EDIT_NUMBER = 4;
+ private static int FIRST_SELECTION = 0;
+ private static int SIZE_NULL = 0;
+
+ public StyleComposite(Composite parent, StyleAttributes styleAttributes,
+ String oldStyle) {
+ super(parent, SWT.NONE);
+ this.oldStyle = oldStyle;
+ this.styleAttributes = styleAttributes;
+ createTabs();
+
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getNewStyle() {
+ return newStyle;
+ }
+
+ public void updateStyle() {
+ if (lastSelectedTab == tabTextFont) {
+ tabTextControl.updateData(true);
+ } else if (lastSelectedTab == tabBackground) {
+ tabBackgroundControl.updateData(true);
+ } else if (lastSelectedTab == tabBoxes) {
+ tabBoxesControl.updateData(true);
+ } else if (lastSelectedTab == tabPropertySheet) {
+ tabPropertySheetControl.updateData(true);
+ }
+ StringBuffer buf = new StringBuffer();
+ Set<Entry<String, String>> set = styleAttributes.entrySet();
+ for (Map.Entry<String, String> me : set) {
+ buf.append(me.getKey() + Constants.COLON_STRING + me.getValue()
+ + Constants.SEMICOLON_STRING);
+ }
+ newStyle = buf.toString();
+ }
+
+ /**
+ * Method for creating text tab
+ *
+ * @param tabFolder
+ * @return composite
+ */
+ private Control createTabTextControl(TabFolder tabFolder) {
+
+ ScrolledComposite sc = new ScrolledComposite(tabFolder, SWT.H_SCROLL
+ | SWT.V_SCROLL);
+
+ sc.setExpandHorizontal(true);
+ sc.setExpandVertical(true);
+
+ tabTextControl = new TabTextControl(sc, comboMap, styleAttributes);
+ sc.setContent(tabTextControl);
+
+ sc.setMinSize(tabTextControl.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+
+ return sc;
+ }
+
+ /**
+ * Method for creating background tab
+ *
+ * @param tabFolder
+ * @return composite
+ */
+ private Control createTabBackgroundControl(TabFolder tabFolder) {
+ ScrolledComposite sc = new ScrolledComposite(tabFolder, SWT.H_SCROLL
+ | SWT.V_SCROLL);
+
+ sc.setExpandHorizontal(true);
+ sc.setExpandVertical(true);
+
+ tabBackgroundControl = new TabBackgroundControl(sc, comboMap,
+ styleAttributes);
+ sc.setContent(tabBackgroundControl);
+ sc.setMinSize(tabBackgroundControl
+ .computeSize(SWT.DEFAULT, SWT.DEFAULT));
+
+ return sc;
+ }
+
+ /**
+ * Method for creating boxes tab
+ *
+ * @param tabFolder
+ * @return composite
+ */
+ private Control createTabBoxesControl(TabFolder tabFolder) {
+
+ ScrolledComposite sc = new ScrolledComposite(tabFolder, SWT.H_SCROLL
+ | SWT.V_SCROLL);
+
+ sc.setExpandHorizontal(true);
+ sc.setExpandVertical(true);
+
+ tabBoxesControl = new TabBoxesControl(sc, comboMap, styleAttributes);
+ sc.setContent(tabBoxesControl);
+ sc.setMinSize(tabBoxesControl.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+
+ return sc;
+ }
+
+ private void createTabs() {
+ ComboParser comboParser = new ComboParser();
+ comboParser.setListener(new BaseListener(comboMap) {
+
+ private ArrayList<String> list = null;
+
+ public void startElement(String uri, String localName,
+ String nodeName, Attributes attrs) {
+
+ if (nodeName.trim().equalsIgnoreCase(NODE_NAME_ELEMENTS))
+ return;
+
+ if (!nodeName.trim().equalsIgnoreCase(NODE_NAME_VALUE)) {
+ String name = nodeName;
+ list = new ArrayList<String>();
+ map.put(name, list);
+ } else {
+ list.add(attrs.getValue(NODE_ATTRIBUTE_NAME));
+ }
+ }
+
+ });
+ comboParser.parse();
+
+ CSSElementsParser cssParser = new CSSElementsParser();
+ cssParser.setListener(new BaseListener(elementsMap) {
+
+ private ArrayList<String> list = null;
+
+ public void startElement(String uri, String localName,
+ String nodeName, Attributes attrs) {
+
+ if (nodeName.trim().equalsIgnoreCase(NODE_NAME_ELEMENTS))
+ return;
+
+ if (!nodeName.trim().equalsIgnoreCase(NODE_NAME_ELEMENT)) {
+ String name = nodeName;
+ list = new ArrayList<String>();
+ map.put(name, list);
+ } else {
+ list.add(attrs.getValue(NODE_ATTRIBUTE_NAME));
+ }
+ }
+
+ });
+ cssParser.parse();
+
+ // HashMap<String, String> attributesMap = new HashMap<String,
+ // String>();
+ ParserListener listener = new ParserListener(styleAttributes);
+ parser = new Parser(elementsMap);
+ parser.addListener(listener);
+ parser.parse(this.oldStyle);
+
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 1;
+ setLayout(gridLayout);
+ setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+
+ tabFolder = new TabFolder(this, SWT.NONE);
+ tabFolder.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
+ true, true));
+
+ // Create each tab and set its text, tool tip text,
+ tabTextFont = new TabItem(tabFolder, SWT.NONE);
+ tabTextFont.setText(MessageUtil.getString("TEXT_FONT_TAB_NAME"));
+ tabTextFont.setToolTipText(MessageUtil.getString("TEXT_FONT_TAB_NAME"));
+ tabTextFont.setControl(createTabTextControl(tabFolder));
+ lastSelectedTab = tabTextFont;
+
+ tabBackground = new TabItem(tabFolder, SWT.NONE);
+ tabBackground.setText(MessageUtil.getString("BACKGROUND_TAB_NAME"));
+ tabBackground.setToolTipText(MessageUtil
+ .getString("BACKGROUND_TAB_NAME"));
+ tabBackground.setControl(createTabBackgroundControl(tabFolder));
+
+ tabBoxes = new TabItem(tabFolder, SWT.NONE);
+ tabBoxes.setText(MessageUtil.getString("BOXES_TAB_NAME"));
+ tabBoxes.setToolTipText(MessageUtil.getString("BOXES_TAB_NAME"));
+ tabBoxes.setControl(createTabBoxesControl(tabFolder));
+
+ tabPropertySheet = new TabItem(tabFolder, SWT.NONE);
+ tabPropertySheet.setText(MessageUtil
+ .getString("PROPERTY_SHEET_TAB_NAME"));
+ tabPropertySheet.setToolTipText(MessageUtil
+ .getString("PROPERTY_SHEET_TAB_NAME"));
+ tabPropertySheet.setControl(createTabPropertySheetControl(tabFolder));
+
+ tabFolder.setSelection(TAB_TEXT_FONT_NUMBER);
+ if (styleAttributes.getAttributeMap().size() > SIZE_NULL) {
+ tabQuickEdit = new TabItem(tabFolder, SWT.NONE);
+ tabQuickEdit.setText(MessageUtil.getString("QUICK_EDIT_TAB-NAME"));
+ tabQuickEdit.setToolTipText(MessageUtil
+ .getString("QUICK_EDIT_TAB-NAME"));
+ tabQuickEdit.setControl(createTabQuickEditContol(tabFolder));
+ tabFolder.setSelection(TAB_QUICK_EDIT_NUMBER);
+ lastSelectedTab = tabQuickEdit;
+ }
+ tabFolder.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent se) {
+
+ if (tabFolder.getSelection()[FIRST_SELECTION] == tabQuickEdit) {
+ tabQuickEditControl.dispose();
+ tabQuickEdit
+ .setControl(createTabQuickEditContol(tabFolder));
+ lastSelectedTab = tabQuickEdit;
+ } else if (tabFolder.getSelection()[FIRST_SELECTION] == tabTextFont) {
+ tabTextControl.updateData(false);
+ lastSelectedTab = tabTextFont;
+ } else if (tabFolder.getSelection()[FIRST_SELECTION] == tabBackground) {
+ tabBackgroundControl.updateData(false);
+ lastSelectedTab = tabBackground;
+ } else if (tabFolder.getSelection()[FIRST_SELECTION] == tabBoxes) {
+ tabBoxesControl.updateData(false);
+ lastSelectedTab = tabBoxes;
+ } else if (tabFolder.getSelection()[FIRST_SELECTION] == tabPropertySheet) {
+ tabPropertySheetControl.updateData(false);
+ lastSelectedTab = tabPropertySheet;
+ }
+ }
+ });
+ }
+
+ /**
+ *
+ * Method for creating property sheet tab
+ *
+ * @param tabFolder
+ * @return
+ */
+ private Control createTabPropertySheetControl(TabFolder tabFolder) {
+ tabPropertySheetControl = new TabPropertySheetControl(tabFolder,
+ elementsMap, comboMap, styleAttributes);
+ return tabPropertySheetControl;
+ }
+
+ public void recreateStyleComposite(String style) {
+ styleAttributes.clear();
+ parser.parse(style);
+
+ tabBackgroundControl.updateData(false);
+ tabBoxesControl.updateData(false);
+ tabPropertySheetControl.updateData(false);
+ tabTextControl.updateData(false);
+ if (styleAttributes.getAttributeMap().size() > SIZE_NULL) {
+ if (tabQuickEdit == null || tabQuickEdit.isDisposed()) {
+ tabQuickEdit = new TabItem(tabFolder, SWT.NONE);
+ tabQuickEdit.setText(MessageUtil
+ .getString("QUICK_EDIT_TAB-NAME"));
+ tabQuickEdit.setToolTipText(MessageUtil
+ .getString("QUICK_EDIT_TAB-NAME"));
+ tabQuickEdit.setControl(createTabQuickEditContol(tabFolder));
+ } else {
+ // update quick edit
+ tabQuickEditControl.updateData();
+ }
+ tabFolder.setSelection(TAB_QUICK_EDIT_NUMBER);
+ lastSelectedTab = tabQuickEdit;
+ } else {
+ if (tabQuickEdit != null || !tabQuickEdit.isDisposed()) {
+ tabQuickEdit.dispose();
+ tabFolder.redraw();
+ }
+ }
+ }
+
+ /**
+ *
+ * Method for creating quick edit tab
+ *
+ * @param tabFolder
+ * @return
+ */
+ private Control createTabQuickEditContol(TabFolder tabFolder) {
+
+ ScrolledComposite sc = new ScrolledComposite(tabFolder, SWT.H_SCROLL
+ | SWT.V_SCROLL);
+
+ sc.setExpandHorizontal(true);
+ sc.setExpandVertical(true);
+
+ tabQuickEditControl = new TabQuickEditControl(sc, comboMap,
+ styleAttributes);
+ sc.setContent(tabQuickEditControl);
+
+ sc
+ .setMinSize(tabQuickEditControl.computeSize(SWT.DEFAULT,
+ SWT.DEFAULT));
+ return sc;
+ }
+}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.cssdialog.common;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.css.core.internal.format.FormatProcessorCSS;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.w3c.dom.css.CSSRuleList;
+import org.w3c.dom.css.CSSStyleDeclaration;
+import org.w3c.dom.css.CSSStyleRule;
+import org.w3c.dom.css.CSSStyleSheet;
+
+
+public class CSSModel {
+
+ private FormatProcessorCSS formatProcessorCSS = null;
+ private CSSStyleSheet styleSheet = null;
+ private IStructuredModel model = null;
+
+ private static String startBraces = "{";
+ private static String endBraces = "}";
+
+ public CSSModel(IFile styleFile) {
+
+ try {
+ formatProcessorCSS = new FormatProcessorCSS();
+ IModelManager modelManager = StructuredModelManager
+ .getModelManager();
+ model = modelManager.getModelForEdit(styleFile);
+ if (model instanceof ICSSModel) {
+ ICSSModel cssModel = (ICSSModel) model;
+ ICSSDocument document = cssModel.getDocument();
+ if (document instanceof CSSStyleSheet) {
+ styleSheet = (CSSStyleSheet) document;
+ }
+ }
+
+ } catch (IOException e) {
+ JspEditorPlugin.getPluginLog().logError(e.getMessage());
+ } catch (CoreException e) {
+ JspEditorPlugin.getPluginLog().logError(e.getMessage());
+ }
+ }
+
+ /**
+ * Get selectors
+ *
+ * @return List<String>
+ */
+ public List<String> getSelectors() {
+ List<String> selectors = new ArrayList<String>();
+ if (styleSheet != null) {
+ CSSRuleList list = styleSheet.getCssRules();
+ if (list != null) {
+ for (int i = 0; i < list.getLength(); i++) {
+ if (list.item(i) instanceof CSSStyleRule) {
+ selectors.add(((CSSStyleRule)list.item(i)).getSelectorText());
+ }
+ }
+ }
+ }
+ return selectors;
+ }
+
+ /**
+ * Get style by selectorName
+ *
+ * @param selectorName
+ * @return style
+ */
+ public String getStyle(String selectorName) {
+ if (styleSheet != null) {
+ CSSRuleList list = styleSheet.getCssRules();
+ if (list != null) {
+ for (int i = 0; i < list.getLength(); i++) {
+ if (list.item(i) instanceof CSSStyleRule && ((CSSStyleRule)list.item(i)).getSelectorText().equals(selectorName)) {
+ return ((CSSStyleRule)list.item(i)).getStyle().getCssText();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param selector
+ * @param style
+ */
+ public void setCSS(String selector,String style) {
+ if (styleSheet != null) {
+ CSSRuleList list = styleSheet.getCssRules();
+ if (list != null) {
+ for (int i = 0; i < list.getLength(); i++) {
+ if (list.item(i) instanceof CSSStyleRule && ((CSSStyleRule)list.item(i)).getSelectorText().equals(selector)) {
+ CSSStyleRule rule = (CSSStyleRule) list.item(i);
+ CSSStyleDeclaration declaration = rule.getStyle();
+ declaration.setCssText(style);
+ return;
+ }
+ }
+ styleSheet.insertRule(selector+startBraces+style+endBraces, list.getLength());
+ }
+ }
+ }
+
+ /**
+ * Save model to file
+ */
+ public void saveModel() {
+ if (formatProcessorCSS!=null)
+ formatProcessorCSS.formatModel(model);
+ try {
+ model.save();
+ } catch (UnsupportedEncodingException e) {
+ JspEditorPlugin.getPluginLog().logError(e.getMessage());
+ } catch (IOException e) {
+ JspEditorPlugin.getPluginLog().logError(e.getMessage());
+ } catch (CoreException e) {
+ JspEditorPlugin.getPluginLog().logError(e.getMessage());
+ }
+ }
+
+}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/FileExtensionFilter.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/FileExtensionFilter.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/FileExtensionFilter.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.cssdialog.common;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+
+/**
+ * Class for creates filter by file extensions
+ *
+ * @author dsakovich
+ */
+public class FileExtensionFilter extends ViewerFilter {
+
+ private String[] fTargetExtension;
+
+ public FileExtensionFilter(String[] targetExtension) {
+ fTargetExtension = targetExtension;
+ }
+
+ public boolean select(Viewer viewer, Object parent, Object element) {
+ if (element instanceof IFile) {
+ for (int i = 0; i < fTargetExtension.length; i++) {
+ if (((IFile) element).getName().toLowerCase().endsWith(
+ "." + fTargetExtension[i])) {
+ return true;
+ }
+ }
+ return false;
+ }
+ if (element instanceof IProject && ((IProject) element).isOpen())
+ return true;
+ if (element instanceof IContainer) { // i.e. IProject, IFolder
+ try {
+ IResource[] resources = ((IContainer) element).members();
+ for (int i = 0; i < resources.length; i++) {
+ if (select(viewer, parent, resources[i]))
+ return true;
+ }
+ } catch (CoreException e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ }
+ return false;
+ }
+}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Util.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Util.java 2008-09-30 18:45:39 UTC (rev 10576)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Util.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -7,14 +7,21 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.jst.jsp.outline.cssdialog.common;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
import org.eclipse.swt.graphics.RGB;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.ColorParser;
/**
@@ -65,7 +72,7 @@
* Method for checking contain or not css attribute folder
*
* @param name
- * Name css attribute
+ * Name css attribute
* @return true - contain, or else - dont contain
*/
public static boolean containFolder(String name) {
@@ -80,9 +87,9 @@
* Method for search css attribute in block elements (Aural, Boxes,....)
*
* @param name
- * Name css attribute
+ * Name css attribute
* @param set
- * Set of block elemnts
+ * Set of block elemnts
* @return true - find, or else - dont find
*/
public static boolean searchOnBlock(String name, Set<String> set) {
@@ -99,9 +106,9 @@
* font-weight,....)
*
* @param name
- * Name css attribute
+ * Name css attribute
* @param set
- * Set of combo elemnts
+ * Set of combo elemnts
* @return true - find, or else - dont find
*/
public static boolean searchInCombo(String name, Set<String> set) {
@@ -117,9 +124,9 @@
* Method for search string into css attributes
*
* @param name
- * Name
+ * Name
* @param elementMap
- * Map of css attributes
+ * Map of css attributes
* @return true - find, or else - dont find
*/
public static boolean searchInElement(String name,
@@ -142,7 +149,7 @@
* Method for get RGB from string
*
* @param color
- * Color string
+ * Color string
* @return RGB color, or null, if color invalid
*/
public static RGB getColor(String color) {
@@ -189,7 +196,8 @@
if (j == COUNT_COLORS)
return convertColorRGB(color);
} else {
- HashMap<String, String> colorMap = ColorParser.getInstance().getMap();
+ HashMap<String, String> colorMap = ColorParser.getInstance()
+ .getMap();
for (String key : colorMap.keySet())
if (colorMap.get(key).equalsIgnoreCase(color))
@@ -203,7 +211,7 @@
* Method for convert string(123px) into two string (123 and px)
*
* @param str
- * String for convert
+ * String for convert
* @return Array two strings, or null, if str uncorrect
*/
public static String[] convertExtString(String str) {
@@ -241,7 +249,7 @@
* Method for search css attribute into extElements
*
* @param name
- * Name of css attribute
+ * Name of css attribute
* @return true - find, or else - dont find
*/
public static boolean searchInExtElement(String name) {
@@ -256,7 +264,7 @@
* Method for getting RGB color from string color
*
* @param color
- * String color
+ * String color
* @return RGB color
*/
public static RGB convertColorRGB(String color) {
@@ -280,7 +288,7 @@
* Method for getting RGB color from hex string
*
* @param color
- * String color
+ * String color
* @return RGB color
*/
public static RGB convertColorHEX(String color) {
@@ -302,7 +310,7 @@
* Method for convert RGB to String
*
* @param rgb
- * RGB color
+ * RGB color
* @return String color
*/
public static String createColorString(RGB rgb) {
@@ -322,4 +330,25 @@
return ColorParser.getInstance().getMap().get(colorStr);
return colorStr;
}
+
+ /**
+ * Get current project
+ *
+ * @return
+ */
+ public static IProject getCurrentProject() {
+ IEditorPart editor = JspEditorPlugin.getDefault().getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorInput input = editor.getEditorInput();
+ IFile file = null;
+ if (input instanceof IFileEditorInput) {
+ file = ((IFileEditorInput) input).getFile();
+ }
+ if (file == null)
+ return null;
+
+ IProject project = file.getProject();
+ return project;
+
+ }
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/messages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/messages.properties 2008-09-30 18:45:39 UTC (rev 10576)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/messages.properties 2008-09-30 19:15:18 UTC (rev 10577)
@@ -1,4 +1,5 @@
-CSS_DIALOG_TITLE=CSS Editor
+CSS_STYLE_DIALOG_TITLE=CSS Style Dialog
+CSS_STYLE_CLASS_DIALOG_TITLE=CSS Style Class Dialog
TEXT_FONT_TAB_NAME=Text/Font
BOXES_TAB_NAME=Boxes
BACKGROUND_TAB_NAME=Background
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/ChangeStyleEvent.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/ChangeStyleEvent.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/ChangeStyleEvent.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.cssdialog.events;
+
+import java.util.EventObject;
+
+public class ChangeStyleEvent extends EventObject {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3260787731782837929L;
+
+ public ChangeStyleEvent(Object source) {
+ super(source);
+ }
+}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/ChangeStyleListener.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/ChangeStyleListener.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/ChangeStyleListener.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.cssdialog.events;
+
+public interface ChangeStyleListener {
+ public void styleChanged(ChangeStyleEvent event);
+}
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/StyleAttributes.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/StyleAttributes.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/StyleAttributes.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.cssdialog.events;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.Map.Entry;
+
+public class StyleAttributes {
+
+ private HashMap<String, String> attributeMap;
+ private ArrayList<ChangeStyleListener> listeners = new ArrayList<ChangeStyleListener>();
+
+ public StyleAttributes() {
+ this.attributeMap = new HashMap<String, String>();
+ }
+
+ public HashMap<String, String> getAttributeMap() {
+ return attributeMap;
+ }
+
+ public void setAttributeMap(HashMap<String, String> attributeMap) {
+ this.attributeMap = attributeMap;
+ addNewListener();
+ }
+
+ public void addChangeStyleListener(ChangeStyleListener listener) {
+ listeners.add(listener);
+ }
+
+ public ChangeStyleListener[] getChangeStyleListeners() {
+ return listeners.toArray(new ChangeStyleListener[listeners.size()]);
+ }
+
+ public void removeChangeStyleListener(ChangeStyleListener listener) {
+ listeners.remove(listener);
+ }
+
+ private void addNewListener() {
+ ChangeStyleEvent event = new ChangeStyleEvent(this);
+ for (ChangeStyleListener listener : listeners)
+ listener.styleChanged(event);
+ }
+
+ public void addAttribute(String name, String value) {
+ attributeMap.put(name, value);
+ addNewListener();
+ }
+
+ public void removeAttribute(String name) {
+ attributeMap.remove(name);
+ addNewListener();
+ }
+
+ public Set<Entry<String, String>> entrySet() {
+ return attributeMap.entrySet();
+ }
+
+ public String getAttribute(String name) {
+ return attributeMap.get(name);
+ }
+
+ public Set<String> keySet() {
+ return attributeMap.keySet();
+ }
+
+ public void clear() {
+ attributeMap.clear();
+ addNewListener();
+ }
+
+}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/TabPropertySheetMouseAdapter.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/TabPropertySheetMouseAdapter.java 2008-09-30 18:45:39 UTC (rev 10576)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/TabPropertySheetMouseAdapter.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -40,13 +40,9 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.outline.cssdialog.CSSDialog;
import org.jboss.tools.jst.jsp.outline.cssdialog.FontFamilyDialog;
import org.jboss.tools.jst.jsp.outline.cssdialog.ImageSelectionDialog;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
@@ -81,18 +77,18 @@
private static int GRID_MARGIN_WIDTH = 0;
private static int GRID_HORIZONTAL_SPASING = 0;
- private CSSDialog cssDialog;
+ //Dzmitry Sakovich
+ //private CSSDialog cssDialog;
private TabPropertySheetControl tabPropertySheetControl;
public TabPropertySheetMouseAdapter(Tree tree,
HashMap<String, ArrayList<String>> elementsMap,
HashMap<String, ArrayList<String>> comboMap,
- TabPropertySheetControl tabPropertySheetControl,
- CSSDialog dialog) {
+ TabPropertySheetControl tabPropertySheetControl) {
this.tabPropertySheetControl = tabPropertySheetControl;
- this.cssDialog = dialog;
+ //this.cssDialog = dialog;
this.tree = tree;
this.comboMap = comboMap;
this.elementsMap = elementsMap;
@@ -183,7 +179,8 @@
item.setText(Constants.SECOND_COLUMN, colorCombo.getText());
panel.dispose();
tabPropertySheetControl.updateData(true);
- cssDialog.setStyleForPreview();
+ //Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
@@ -191,7 +188,8 @@
public void modifyText(ModifyEvent event) {
item.setText(Constants.SECOND_COLUMN, colorCombo.getText());
tabPropertySheetControl.updateData(true);
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
@@ -235,7 +233,8 @@
item.setText(Constants.SECOND_COLUMN, str);
tabPropertySheetControl.updateData(true);
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
panel.dispose();
}
@@ -261,7 +260,7 @@
btn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
- IProject project = getCurrentProject();
+ IProject project = Util.getCurrentProject();
ImageSelectionDialog dialog = new ImageSelectionDialog(tree
.getShell(), new WorkbenchLabelProvider(),
@@ -281,7 +280,8 @@
item.setText(Constants.SECOND_COLUMN, value);
panel.dispose();
tabPropertySheetControl.updateData(true);
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
}
});
@@ -320,7 +320,8 @@
item.setText(col, combo.getText());
panel.dispose();
tabPropertySheetControl.updateData(true);
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
@@ -328,7 +329,8 @@
public void modifyText(ModifyEvent event) {
item.setText(col, combo.getText());
tabPropertySheetControl.updateData(true);
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
} else {
@@ -400,7 +402,8 @@
.getFontFamily());
panel.dispose();
tabPropertySheetControl.updateData(true);
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
}
});
@@ -439,28 +442,9 @@
// into the cell
item.setText(col, text.getText());
tabPropertySheetControl.updateData(true);
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
}
-
- /**
- * Method for get current project
- *
- * @return IProject
- */
- public static IProject getCurrentProject() {
- IEditorPart editor = JspEditorPlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- IEditorInput input = editor.getEditorInput();
- IFile file = null;
- if (input instanceof IFileEditorInput) {
- file = ((IFileEditorInput) input).getFile();
- }
- if (file == null)
- return null;
-
- IProject project = file.getProject();
- return project;
- }
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/parsers/ParserListener.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/parsers/ParserListener.java 2008-09-30 18:45:39 UTC (rev 10576)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/parsers/ParserListener.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.outline.cssdialog.parsers;
-import java.util.HashMap;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
/**
*
@@ -21,17 +21,17 @@
*/
public class ParserListener implements IListener {
- private HashMap<String, String> map;
+ private StyleAttributes attributes;
- public ParserListener(HashMap<String, String> map) {
- this.map = map;
+ public ParserListener(StyleAttributes styleAttributes) {
+ this.attributes = styleAttributes;
}
public void nextElement(String name, String value) {
- map.put(name, value);
+ attributes.addAttribute(name, value);
}
- public HashMap<String, String> getMap() {
- return map;
+ public StyleAttributes getStyleAttributes() {
+ return attributes;
}
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBackgroundControl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBackgroundControl.java 2008-09-30 18:45:39 UTC (rev 10576)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBackgroundControl.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -15,6 +15,7 @@
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -34,19 +35,16 @@
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.outline.cssdialog.CSSDialog;
import org.jboss.tools.jst.jsp.outline.cssdialog.ImageSelectionDialog;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.ImageCombo;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.MessageUtil;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.ColorParser;
@@ -63,18 +61,20 @@
private Combo backgroundImageCombo;
private Combo backgroundRepeatCombo;
- private HashMap<String, String> attributesMap;
+ private StyleAttributes styleAttributes;
private static final int numColumns = 3;
- private CSSDialog cssDialog;
+ //TODO Dzmitry Sakovich
+ //private CSSDialog cssDialog;
public TabBackgroundControl(final Composite composite,
HashMap<String, ArrayList<String>> comboMap,
- final HashMap<String, String> attributesMap, CSSDialog dialog) {
+ final StyleAttributes styleAttributes) {
super(composite, SWT.NONE);
- this.attributesMap = attributesMap;
- this.cssDialog = dialog;
+ this.styleAttributes = styleAttributes;
+ //TODO Dzmitry Sakovich
+ //this.cssDialog = dialog;
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = numColumns;
@@ -102,11 +102,12 @@
String tmp = colorCombo.getText();
if (tmp != null) {
if (tmp.trim().length() > 0)
- attributesMap.put(CSSConstants.BACKGROUND_COLOR, tmp);
+ styleAttributes.addAttribute(CSSConstants.BACKGROUND_COLOR, tmp);
else
- attributesMap.remove(CSSConstants.BACKGROUND_COLOR);
+ styleAttributes.removeAttribute(CSSConstants.BACKGROUND_COLOR);
}
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
@@ -157,11 +158,12 @@
String tmp = backgroundImageCombo.getText();
if (tmp != null) {
if (tmp.trim().length() > 0)
- attributesMap.put(CSSConstants.BACKGROUND_IMAGE, tmp);
+ styleAttributes.addAttribute(CSSConstants.BACKGROUND_IMAGE, tmp);
else
- attributesMap.remove(CSSConstants.BACKGROUND_IMAGE);
+ styleAttributes.removeAttribute(CSSConstants.BACKGROUND_IMAGE);
}
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
@@ -181,7 +183,7 @@
});
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
- IProject project = getCurrentProject();
+ IProject project = Util.getCurrentProject();
ImageSelectionDialog dialog = new ImageSelectionDialog(
getShell(), new WorkbenchLabelProvider(),
new WorkbenchContentProvider());
@@ -216,11 +218,12 @@
String tmp = backgroundRepeatCombo.getText();
if (tmp != null) {
if (tmp.trim().length() > 0)
- attributesMap.put(CSSConstants.BACKGROUND_REPEAT, tmp);
+ styleAttributes.addAttribute(CSSConstants.BACKGROUND_REPEAT, tmp);
else
- attributesMap.remove(CSSConstants.BACKGROUND_REPEAT);
+ styleAttributes.removeAttribute(CSSConstants.BACKGROUND_REPEAT);
}
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
@@ -240,22 +243,8 @@
*
* @return IProject
*/
- public static IProject getCurrentProject() {
- IEditorPart editor = JspEditorPlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- IEditorInput input = editor.getEditorInput();
- IFile file = null;
- if (input instanceof IFileEditorInput) {
- file = ((IFileEditorInput) input).getFile();
- }
- if (file == null)
- return null;
+
- IProject project = file.getProject();
- return project;
-
- }
-
/**
* Method for get data in controls (if param equal true ), or set data (if
* param equal false).
@@ -264,15 +253,15 @@
*/
public void updateData(boolean param) {
String tmp;
- if ((tmp = attributesMap.get(CSSConstants.BACKGROUND_COLOR)) != null)
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.BACKGROUND_COLOR)) != null)
colorCombo.setText(tmp);
else
colorCombo.setText(Constants.EMPTY_STRING);
- if ((tmp = attributesMap.get(CSSConstants.BACKGROUND_IMAGE)) != null)
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.BACKGROUND_IMAGE)) != null)
backgroundImageCombo.setText(tmp);
else
backgroundImageCombo.setText(Constants.EMPTY_STRING);
- if ((tmp = attributesMap.get(CSSConstants.BACKGROUND_REPEAT)) != null)
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.BACKGROUND_REPEAT)) != null)
backgroundRepeatCombo.setText(tmp);
else
backgroundRepeatCombo.setText(Constants.EMPTY_STRING);
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBoxesControl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBoxesControl.java 2008-09-30 18:45:39 UTC (rev 10576)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBoxesControl.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -15,6 +15,7 @@
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
+
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
@@ -35,15 +36,14 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.outline.cssdialog.CSSDialog;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.ImageCombo;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.MessageUtil;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.ColorParser;
-
/**
* Class for creating control in Box tab
*
@@ -68,11 +68,12 @@
private Text paddingText;
private ArrayList<String> list;
- private HashMap<String, String> attributesMap;
+ private StyleAttributes styleAttributes;
private static final int numColumns = 3;
- private CSSDialog cssDialog;
+ // TODO Dzmitry Sakovich
+ // private CSSDialog cssDialog;
/**
* Constructor for creating controls
@@ -81,11 +82,13 @@
*/
public TabBoxesControl(final Composite composite,
final HashMap<String, ArrayList<String>> comboMap,
- final HashMap<String, String> attributesMap, CSSDialog dialog) {
+ final StyleAttributes styleAttributes) {
super(composite, SWT.NONE);
- this.attributesMap = attributesMap;
- this.cssDialog = dialog;
+ this.styleAttributes = styleAttributes;
+ // TODO Dzmitry Sakovich
+ // this.cssDialog = dialog;
+
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = numColumns;
setLayout(gridLayout);
@@ -113,15 +116,18 @@
if (tmp.trim().length() > 0) {
String extWidth = extWidthCombo.getText().trim();
if (extWidth != null)
- attributesMap.put(CSSConstants.WIDTH, tmp
- + extWidth);
+ styleAttributes.addAttribute(CSSConstants.WIDTH,
+ tmp + extWidth);
else
- attributesMap.put(CSSConstants.WIDTH, tmp);
+ styleAttributes.addAttribute(CSSConstants.WIDTH,
+ tmp);
} else
- attributesMap.remove(CSSConstants.WIDTH);
+ styleAttributes.removeAttribute(CSSConstants.WIDTH);
} else
- attributesMap.remove(CSSConstants.WIDTH);
- cssDialog.setStyleForPreview();
+ styleAttributes.removeAttribute(CSSConstants.WIDTH);
+
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
}
});
@@ -141,8 +147,10 @@
String tmp = extWidthCombo.getText();
if (tmp != null) {
- attributesMap.put(CSSConstants.WIDTH, width + tmp);
- cssDialog.setStyleForPreview();
+ styleAttributes.addAttribute(CSSConstants.WIDTH, width
+ + tmp);
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
}
}
});
@@ -168,15 +176,17 @@
if (tmp.trim().length() > 0) {
String extHeight = extHeightCombo.getText().trim();
if (extHeight != null)
- attributesMap.put(CSSConstants.HEIGHT, tmp
- + extHeight);
+ styleAttributes.addAttribute(CSSConstants.HEIGHT,
+ tmp + extHeight);
else
- attributesMap.put(CSSConstants.HEIGHT, tmp);
+ styleAttributes.addAttribute(CSSConstants.HEIGHT,
+ tmp);
} else
- attributesMap.remove(CSSConstants.HEIGHT);
+ styleAttributes.removeAttribute(CSSConstants.HEIGHT);
} else
- attributesMap.remove(CSSConstants.HEIGHT);
- cssDialog.setStyleForPreview();
+ styleAttributes.removeAttribute(CSSConstants.HEIGHT);
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
}
});
@@ -196,8 +206,10 @@
String tmp = extHeightCombo.getText();
if (tmp != null) {
- attributesMap.put(CSSConstants.HEIGHT, height + tmp);
- cssDialog.setStyleForPreview();
+ styleAttributes.addAttribute(CSSConstants.HEIGHT, height
+ + tmp);
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
}
}
});
@@ -228,12 +240,15 @@
String tmp = borderStyleCombo.getText().trim();
if (tmp != null)
if (!tmp.equals(Constants.EMPTY_STRING)) {
- attributesMap.put(CSSConstants.BORDER_STYLE, tmp);
- cssDialog.setStyleForPreview();
+ styleAttributes.addAttribute(CSSConstants.BORDER_STYLE,
+ tmp);
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
return;
}
- attributesMap.remove(CSSConstants.BORDER_STYLE);
- cssDialog.setStyleForPreview();
+ styleAttributes.removeAttribute(CSSConstants.BORDER_STYLE);
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
}
});
@@ -262,12 +277,16 @@
String tmp = borderColorCombo.getText().trim();
if (tmp != null)
if (!tmp.equals(Constants.EMPTY_STRING)) {
- attributesMap.put(CSSConstants.BORDER_COLOR, tmp);
- cssDialog.setStyleForPreview();
+ styleAttributes.addAttribute(CSSConstants.BORDER_COLOR,
+ tmp);
+
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
return;
}
- attributesMap.remove(CSSConstants.BORDER_COLOR);
- cssDialog.setStyleForPreview();
+ styleAttributes.removeAttribute(CSSConstants.BORDER_COLOR);
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
}
});
@@ -329,9 +348,10 @@
if (currentText.equals(str)) {
extBorderWidthCombo.select(0);
extBorderWidthCombo.setEnabled(false);
- attributesMap.put(CSSConstants.BORDER_WIDTH,
+ styleAttributes.addAttribute(CSSConstants.BORDER_WIDTH,
currentText);
- cssDialog.setStyleForPreview();
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
return;
}
}
@@ -344,15 +364,20 @@
String extBorderWidth = extBorderWidthCombo.getText()
.trim();
if (extBorderWidth != null)
- attributesMap.put(CSSConstants.BORDER_WIDTH, tmp
- + extBorderWidth);
+ styleAttributes.addAttribute(
+ CSSConstants.BORDER_WIDTH, tmp
+ + extBorderWidth);
else
- attributesMap.put(CSSConstants.BORDER_WIDTH, tmp);
+ styleAttributes.addAttribute(
+ CSSConstants.BORDER_WIDTH, tmp);
} else
- attributesMap.remove(CSSConstants.BORDER_WIDTH);
+ styleAttributes
+ .removeAttribute(CSSConstants.BORDER_WIDTH);
} else
- attributesMap.remove(CSSConstants.BORDER_WIDTH);
- cssDialog.setStyleForPreview();
+ styleAttributes.removeAttribute(CSSConstants.BORDER_WIDTH);
+
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
}
});
@@ -377,9 +402,10 @@
String tmp = extBorderWidthCombo.getText();
if (tmp != null) {
- attributesMap.put(CSSConstants.BORDER_WIDTH, borderWidth
- + tmp);
- cssDialog.setStyleForPreview();
+ styleAttributes.addAttribute(CSSConstants.BORDER_WIDTH,
+ borderWidth + tmp);
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
}
}
});
@@ -430,15 +456,17 @@
if (tmp.trim().length() > 0) {
String extMargin = extMarginCombo.getText().trim();
if (extMargin != null)
- attributesMap.put(CSSConstants.MARGIN, tmp
- + extMargin);
+ styleAttributes.addAttribute(CSSConstants.MARGIN,
+ tmp + extMargin);
else
- attributesMap.put(CSSConstants.MARGIN, tmp);
+ styleAttributes.addAttribute(CSSConstants.MARGIN,
+ tmp);
} else
- attributesMap.remove(CSSConstants.MARGIN);
+ styleAttributes.removeAttribute(CSSConstants.MARGIN);
} else
- attributesMap.remove(CSSConstants.MARGIN);
- cssDialog.setStyleForPreview();
+ styleAttributes.removeAttribute(CSSConstants.MARGIN);
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
}
});
@@ -458,8 +486,10 @@
String tmp = extMarginCombo.getText();
if (tmp != null) {
- attributesMap.put(CSSConstants.MARGIN, margin + tmp);
- cssDialog.setStyleForPreview();
+ styleAttributes.addAttribute(CSSConstants.MARGIN, margin
+ + tmp);
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
}
}
});
@@ -486,15 +516,17 @@
if (tmp.trim().length() > 0) {
String extPadding = extPaddingCombo.getText().trim();
if (extPadding != null)
- attributesMap.put(CSSConstants.PADDING, tmp
- + extPadding);
+ styleAttributes.addAttribute(CSSConstants.PADDING,
+ tmp + extPadding);
else
- attributesMap.put(CSSConstants.PADDING, tmp);
+ styleAttributes.addAttribute(CSSConstants.PADDING,
+ tmp);
} else
- attributesMap.remove(CSSConstants.PADDING);
+ styleAttributes.removeAttribute(CSSConstants.PADDING);
} else
- attributesMap.remove(CSSConstants.PADDING);
- cssDialog.setStyleForPreview();
+ styleAttributes.removeAttribute(CSSConstants.PADDING);
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
}
});
@@ -514,8 +546,10 @@
String tmp = extPaddingCombo.getText();
if (tmp != null) {
- attributesMap.put(CSSConstants.PADDING, padding + tmp);
- cssDialog.setStyleForPreview();
+ styleAttributes.addAttribute(CSSConstants.PADDING, padding
+ + tmp);
+ // TODO Dzmitry Sakovich
+ // cssDialog.setStyleForPreview();
}
}
});
@@ -535,7 +569,7 @@
*/
public void updateData(boolean param) {
String tmp;
- if ((tmp = attributesMap.get(CSSConstants.WIDTH)) != null) {
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.WIDTH)) != null) {
String[] str = Util.convertExtString(tmp);
widthText.setText(str[0]);
if (extWidthCombo.indexOf(str[1]) != -1) {
@@ -547,7 +581,7 @@
widthText.setText(Constants.EMPTY_STRING);
extWidthCombo.select(0);
}
- if ((tmp = attributesMap.get(CSSConstants.HEIGHT)) != null) {
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.HEIGHT)) != null) {
String[] str = Util.convertExtString(tmp);
heightText.setText(str[0]);
if (extHeightCombo.indexOf(str[1]) != -1) {
@@ -559,15 +593,15 @@
heightText.setText(Constants.EMPTY_STRING);
extHeightCombo.select(0);
}
- if ((tmp = attributesMap.get(CSSConstants.BORDER_STYLE)) != null)
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.BORDER_STYLE)) != null)
borderStyleCombo.setText(tmp);
else
borderStyleCombo.setText(Constants.EMPTY_STRING);
- if ((tmp = attributesMap.get(CSSConstants.BORDER_COLOR)) != null)
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.BORDER_COLOR)) != null)
borderColorCombo.setText(tmp);
else
borderColorCombo.setText(Constants.EMPTY_STRING);
- if ((tmp = attributesMap.get(CSSConstants.BORDER_WIDTH)) != null) {
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.BORDER_WIDTH)) != null) {
String[] str = Util.convertExtString(tmp);
borderWidthCombo.setText(str[0]);
if (extBorderWidthCombo.indexOf(str[1]) != -1) {
@@ -579,7 +613,7 @@
borderWidthCombo.setText(Constants.EMPTY_STRING);
extBorderWidthCombo.select(0);
}
- if ((tmp = attributesMap.get(CSSConstants.MARGIN)) != null) {
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.MARGIN)) != null) {
String[] str = Util.convertExtString(tmp);
marginText.setText(str[0]);
if (extMarginCombo.indexOf(str[1]) != -1) {
@@ -591,7 +625,7 @@
marginText.setText(Constants.EMPTY_STRING);
extMarginCombo.select(0);
}
- if ((tmp = attributesMap.get(CSSConstants.PADDING)) != null) {
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.PADDING)) != null) {
String[] str = Util.convertExtString(tmp);
paddingText.setText(str[0]);
if (extPaddingCombo.indexOf(str[1]) != -1) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabPropertySheetControl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabPropertySheetControl.java 2008-09-30 18:45:39 UTC (rev 10576)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabPropertySheetControl.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -22,8 +22,8 @@
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
-import org.jboss.tools.jst.jsp.outline.cssdialog.CSSDialog;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
import org.jboss.tools.jst.jsp.outline.cssdialog.events.TabPropertySheetMouseAdapter;
/**
@@ -39,8 +39,8 @@
private Tree tree;
- private HashMap<String, String> attributesMap;
-
+ private StyleAttributes styleAttributes;
+
/**
* Constructor for creating controls
*
@@ -50,11 +50,10 @@
public TabPropertySheetControl(TabFolder tabFolder,
HashMap<String, ArrayList<String>> elementMap,
HashMap<String, ArrayList<String>> comboMap,
- HashMap<String, String> attributesMap,
- CSSDialog dialog) {
+ StyleAttributes styleAttributes) {
super(tabFolder, SWT.NONE);
- this.attributesMap = attributesMap;
+ this.styleAttributes = styleAttributes;
setLayout(new FillLayout());
@@ -87,7 +86,7 @@
updateData(false);
tree.addMouseListener(new TabPropertySheetMouseAdapter(tree,
- elementMap, comboMap, this, dialog));
+ elementMap, comboMap, this));
for (int i = 0; i < tree.getColumnCount(); i++)
tree.getColumn(i).pack();
@@ -106,15 +105,15 @@
for (int j = 0; j < tree.getItem(i).getItemCount(); j++) {
if (tree.getItem(i).getItem(j).getText(
Constants.SECOND_COLUMN) == null) {
- attributesMap.remove(tree.getItem(i).getItem(j)
+ styleAttributes.removeAttribute(tree.getItem(i).getItem(j)
.getText(Constants.FIRST_COLUMN));
} else if (tree.getItem(i).getItem(j).getText(
Constants.SECOND_COLUMN).trim().equals(
Constants.EMPTY_STRING)) {
- attributesMap.remove(tree.getItem(i).getItem(j)
+ styleAttributes.removeAttribute(tree.getItem(i).getItem(j)
.getText(Constants.FIRST_COLUMN));
} else {
- attributesMap.put(tree.getItem(i).getItem(j).getText(
+ styleAttributes.addAttribute(tree.getItem(i).getItem(j).getText(
Constants.FIRST_COLUMN), tree.getItem(i)
.getItem(j).getText(Constants.SECOND_COLUMN));
}
@@ -127,7 +126,7 @@
tree.getItem(i).getItem(j).setText(Constants.SECOND_COLUMN,
Constants.EMPTY_STRING);
- Set<String> set = attributesMap.keySet();
+ Set<String> set = styleAttributes.keySet();
for (String str : set) {
for (int i = 0; i < tree.getItemCount(); i++)
@@ -136,7 +135,7 @@
Constants.FIRST_COLUMN).equals(str))
tree.getItem(i).getItem(j).setText(
Constants.SECOND_COLUMN,
- attributesMap.get(str));
+ styleAttributes.getAttribute(str));
}
setExpanded();
}
@@ -153,7 +152,7 @@
for (int i = 0; i < tree.getItemCount(); i++)
tree.getItem(i).setExpanded(false);
- Set<String> set = attributesMap.keySet();
+ Set<String> set = styleAttributes.keySet();
for (String attr : set)
if ((item = find(attr)) != null) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java 2008-09-30 18:45:39 UTC (rev 10576)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -14,6 +14,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.StringTokenizer;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -33,15 +34,12 @@
import org.eclipse.swt.widgets.ColorDialog;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.outline.cssdialog.CSSDialog;
import org.jboss.tools.jst.jsp.outline.cssdialog.FontFamilyDialog;
import org.jboss.tools.jst.jsp.outline.cssdialog.ImageSelectionDialog;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
@@ -49,6 +47,7 @@
import org.jboss.tools.jst.jsp.outline.cssdialog.common.ImageCombo;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.MessageUtil;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.ColorParser;
@@ -77,10 +76,11 @@
private Label label = null;
private HashMap<String, ArrayList<String>> comboMap;
- private HashMap<String, String> attributesMap;
+ private StyleAttributes styleAttributes;
+
+ //TODO Dzmitry Sakovich
+ //private CSSDialog dialog;
- private CSSDialog dialog;
-
/**
* Constructor for creating controls
*
@@ -89,11 +89,12 @@
*/
public TabQuickEditControl(Composite sc,
HashMap<String, ArrayList<String>> comboMap,
- HashMap<String, String> attributesMap, CSSDialog dialog) {
+ StyleAttributes styleAttributes) {
super(sc, SWT.NONE);
- this.dialog = dialog;
- this.attributesMap = attributesMap;
+ //TODO Dzmitry Sakovich
+ //this.dialog = dialog;
+ this.styleAttributes = styleAttributes;
this.comboMap = comboMap;
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = GRID_NUM_COLUMNS;
@@ -101,7 +102,7 @@
ArrayList<String> listKeys = new ArrayList<String>();
- for (String key : attributesMap.keySet())
+ for (String key : styleAttributes.keySet())
listKeys.add(key);
Collections.sort(listKeys);
@@ -113,12 +114,45 @@
label.setLayoutData(new GridData(GridData.END, GridData.CENTER,
false, false));
if (Util.searchInCombo(key, comboMap.keySet()))
- createCombo(this, key, attributesMap.get(key));
+ createCombo(this, key, styleAttributes.getAttribute(key));
else
- createText(this, key, attributesMap.get(key));
+ createText(this, key, styleAttributes.getAttribute(key));
}
}
+
+ public void updateData() {
+
+ Control[] controls = this.getChildren();
+ if (controls!= null) {
+ for (int i=0; i<controls.length; i++) {
+ if (!controls[i].isDisposed()) {
+ controls[i].dispose();
+ }
+ }
+ }
+
+
+ ArrayList<String> listKeys = new ArrayList<String>();
+ for (String key : styleAttributes.keySet())
+ listKeys.add(key);
+
+ Collections.sort(listKeys);
+
+ for (String key : listKeys) {
+
+ label = new Label(this, SWT.LEFT);
+ label.setText(format(key));
+ label.setLayoutData(new GridData(GridData.END, GridData.CENTER,
+ false, false));
+ if (Util.searchInCombo(key, comboMap.keySet()))
+ createCombo(this, key, styleAttributes.getAttribute(key));
+ else
+ createText(this, key, styleAttributes.getAttribute(key));
+ }
+ this.layout();
+ }
+
/**
* Method for creating combo controls
*
@@ -192,11 +226,11 @@
if (!colorCombo.getText().trim().equals(
Constants.EMPTY_STRING))
- attributesMap.put(key, colorCombo.getText().trim());
+ styleAttributes.addAttribute(key, colorCombo.getText().trim());
else
- attributesMap.remove(key);
-
- dialog.setStyleForPreview();
+ styleAttributes.removeAttribute(key);
+ //TODO Dzmitry Sakovich
+ //dialog.setStyleForPreview();
}
});
@@ -238,7 +272,7 @@
btn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
- IProject project = getCurrentProject();
+ IProject project = Util.getCurrentProject();
ImageSelectionDialog dialog = new ImageSelectionDialog(
composite.getShell(), new WorkbenchLabelProvider(),
new WorkbenchContentProvider());
@@ -266,11 +300,12 @@
public void modifyText(ModifyEvent event) {
if (!combo.getText().trim().equals(Constants.EMPTY_STRING))
- attributesMap.put(key, combo.getText().trim());
+ styleAttributes.addAttribute(key, combo.getText().trim());
else
- attributesMap.remove(key);
+ styleAttributes.removeAttribute(key);
- dialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //dialog.setStyleForPreview();
}
});
@@ -310,8 +345,9 @@
String tmpExt = extCombo.getText();
if (tmpExt != null) {
- attributesMap.put(key, tmpCombo + tmpExt);
- dialog.setStyleForPreview();
+ styleAttributes.addAttribute(key, tmpCombo + tmpExt);
+ //TODO Dzmitry Sakovich
+ //dialog.setStyleForPreview();
}
}
});
@@ -330,8 +366,9 @@
if (currentText.equalsIgnoreCase(items[i])) {
extCombo.select(VALUE_NUMBER);
extCombo.setEnabled(false);
- attributesMap.put(key, currentText);
- dialog.setStyleForPreview();
+ styleAttributes.addAttribute(key, currentText);
+ //TODO Dzmitry Sakovich
+ //dialog.setStyleForPreview();
return;
}
}
@@ -342,15 +379,16 @@
if (!tmp.equals(Constants.EMPTY_STRING)) {
String extTmp = extCombo.getText().trim();
if (extTmp != null)
- attributesMap.put(key, tmp + extTmp);
+ styleAttributes.addAttribute(key, tmp + extTmp);
else
- attributesMap.put(key, tmp);
+ styleAttributes.addAttribute(key, tmp);
} else
- attributesMap.remove(key);
+ styleAttributes.removeAttribute(key);
} else
- attributesMap.remove(key);
- dialog.setStyleForPreview();
+ styleAttributes.removeAttribute(key);
+ //TODO Dzmitry Sakovich
+ //dialog.setStyleForPreview();
}
});
@@ -365,11 +403,12 @@
if (!combo.getText().trim().equals(
Constants.EMPTY_STRING))
- attributesMap.put(key, combo.getText().trim());
+ styleAttributes.addAttribute(key, combo.getText().trim());
else
- attributesMap.remove(key);
+ styleAttributes.removeAttribute(key);
- dialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //dialog.setStyleForPreview();
}
});
}
@@ -432,11 +471,12 @@
public void modifyText(ModifyEvent event) {
if (!text.getText().trim().equals(Constants.EMPTY_STRING))
- attributesMap.put(key, text.getText().trim());
+ styleAttributes.addAttribute(key, text.getText().trim());
else
- attributesMap.remove(key);
+ styleAttributes.removeAttribute(key);
- dialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //dialog.setStyleForPreview();
}
});
}
@@ -469,8 +509,9 @@
String tmpExt = extCombo.getText();
if (tmpExt != null) {
- attributesMap.put(key, tmpCombo + tmpExt);
- dialog.setStyleForPreview();
+ styleAttributes.addAttribute(key, tmpCombo + tmpExt);
+ //TODO Dzmitry Sakovich
+ //dialog.setStyleForPreview();
}
}
});
@@ -486,15 +527,16 @@
if (!tmp.equals(Constants.EMPTY_STRING)) {
String extTmp = extCombo.getText().trim();
if (extTmp != null)
- attributesMap.put(key, tmp + extTmp);
+ styleAttributes.addAttribute(key, tmp + extTmp);
else
- attributesMap.put(key, tmp);
+ styleAttributes.addAttribute(key, tmp);
} else
- attributesMap.remove(key);
+ styleAttributes.removeAttribute(key);
} else
- attributesMap.remove(key);
- dialog.setStyleForPreview();
+ styleAttributes.removeAttribute(key);
+ //TODO Dzmitry Sakovich
+ //dialog.setStyleForPreview();
}
});
@@ -510,11 +552,12 @@
if (!text.getText().trim().equals(
Constants.EMPTY_STRING))
- attributesMap.put(key, text.getText().trim());
+ styleAttributes.addAttribute(key, text.getText().trim());
else
- attributesMap.remove(key);
+ styleAttributes.removeAttribute(key);
- dialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //dialog.setStyleForPreview();
}
});
@@ -528,27 +571,6 @@
}
/**
- * Method for get current project
- *
- * @return IProject
- */
- public static IProject getCurrentProject() {
- IEditorPart editor = JspEditorPlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- IEditorInput input = editor.getEditorInput();
- IFile file = null;
- if (input instanceof IFileEditorInput) {
- file = ((IFileEditorInput) input).getFile();
- }
- if (file == null)
- return null;
-
- IProject project = file.getProject();
- return project;
-
- }
-
- /**
* Method for format css names (text-decoration : Text Decoration)
*
* @param str
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabTextControl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabTextControl.java 2008-09-30 18:45:39 UTC (rev 10576)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabTextControl.java 2008-09-30 19:15:18 UTC (rev 10577)
@@ -15,6 +15,7 @@
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
+
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
@@ -35,13 +36,13 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.outline.cssdialog.CSSDialog;
import org.jboss.tools.jst.jsp.outline.cssdialog.FontFamilyDialog;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.ImageCombo;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.MessageUtil;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
+import org.jboss.tools.jst.jsp.outline.cssdialog.events.StyleAttributes;
import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.ColorParser;
@@ -65,12 +66,15 @@
private ArrayList<String> list;
- private HashMap<String, String> attributesMap;
+
+ private StyleAttributes styleAttributes;
+ //private HashMap<String, String> attributesMap;
private static final int numColumns = 3;
+
+ //TODO Dzmitry Sakovich
+ //private Browser browser = null;
- private CSSDialog cssDialog;
-
/**
* Constructor for creating controls
*
@@ -78,10 +82,11 @@
*/
public TabTextControl(final Composite composite,
final HashMap<String, ArrayList<String>> comboMap,
- final HashMap<String, String> attributesMap, CSSDialog dialog) {
+ final StyleAttributes styleAttributes) {
super(composite, SWT.NONE);
- this.attributesMap = attributesMap;
- this.cssDialog = dialog;
+ this.styleAttributes = styleAttributes;
+ //TODO Dzmitry Sakovich
+ //this.browser = dialog;
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = numColumns;
@@ -101,11 +106,12 @@
String tmp = fontFamilyText.getText();
if (tmp != null) {
if (tmp.trim().length() > 0)
- attributesMap.put(CSSConstants.FONT_FAMILY, tmp);
+ styleAttributes.addAttribute(CSSConstants.FONT_FAMILY, tmp);
else
- attributesMap.remove(CSSConstants.FONT_FAMILY);
+ styleAttributes.removeAttribute(CSSConstants.FONT_FAMILY);
}
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
@@ -146,11 +152,12 @@
String tmp = colorCombo.getText();
if (tmp != null) {
if (tmp.trim().length() > 0)
- attributesMap.put(CSSConstants.COLOR, tmp);
+ styleAttributes.addAttribute(CSSConstants.COLOR, tmp);
else
- attributesMap.remove(CSSConstants.COLOR);
+ styleAttributes.removeAttribute(CSSConstants.COLOR);
}
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
@@ -225,8 +232,9 @@
String tmp = extFontSizeCombo.getText();
if (tmp != null) {
- attributesMap.put(CSSConstants.FONT_SIZE, fontSize + tmp);
- cssDialog.setStyleForPreview();
+ styleAttributes.addAttribute(CSSConstants.FONT_SIZE, fontSize + tmp);
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
}
});
@@ -247,8 +255,9 @@
if (currentText.equals(str)) {
extFontSizeCombo.select(0);
extFontSizeCombo.setEnabled(false);
- attributesMap.put(CSSConstants.FONT_SIZE, currentText);
- cssDialog.setStyleForPreview();
+ styleAttributes.addAttribute(CSSConstants.FONT_SIZE, currentText);
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
return;
}
}
@@ -260,15 +269,16 @@
if (tmp.trim().length() > 0) {
String extFont = extFontSizeCombo.getText().trim();
if (extFont != null)
- attributesMap.put(CSSConstants.FONT_SIZE, tmp
+ styleAttributes.addAttribute(CSSConstants.FONT_SIZE, tmp
+ extFont);
else
- attributesMap.put(CSSConstants.FONT_SIZE, tmp);
+ styleAttributes.addAttribute(CSSConstants.FONT_SIZE, tmp);
} else
- attributesMap.remove(CSSConstants.FONT_SIZE);
+ styleAttributes.removeAttribute(CSSConstants.FONT_SIZE);
} else
- attributesMap.remove(CSSConstants.FONT_SIZE);
- cssDialog.setStyleForPreview();
+ styleAttributes.removeAttribute(CSSConstants.FONT_SIZE);
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
@@ -284,11 +294,12 @@
String tmp = fontStyleCombo.getText();
if (tmp != null) {
if (tmp.trim().length() > 0)
- attributesMap.put(CSSConstants.FONT_STYLE, tmp);
+ styleAttributes.addAttribute(CSSConstants.FONT_STYLE, tmp);
else
- attributesMap.remove(CSSConstants.FONT_STYLE);
+ styleAttributes.removeAttribute(CSSConstants.FONT_STYLE);
}
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
@@ -317,11 +328,12 @@
String tmp = fontWeigthCombo.getText();
if (tmp != null) {
if (tmp.trim().length() > 0)
- attributesMap.put(CSSConstants.FONT_WEIGHT, tmp);
+ styleAttributes.addAttribute(CSSConstants.FONT_WEIGHT, tmp);
else
- attributesMap.remove(CSSConstants.FONT_WEIGHT);
+ styleAttributes.removeAttribute(CSSConstants.FONT_WEIGHT);
}
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
@@ -350,11 +362,12 @@
String tmp = textDecorationCombo.getText();
if (tmp != null) {
if (tmp.trim().length() > 0)
- attributesMap.put(CSSConstants.TEXT_DECORATION, tmp);
+ styleAttributes.addAttribute(CSSConstants.TEXT_DECORATION, tmp);
else
- attributesMap.remove(CSSConstants.TEXT_DECORATION);
+ styleAttributes.removeAttribute(CSSConstants.TEXT_DECORATION);
}
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
@@ -383,11 +396,12 @@
String tmp = textAlignCombo.getText();
if (tmp != null) {
if (tmp.trim().length() > 0)
- attributesMap.put(CSSConstants.TEXT_ALIGN, tmp);
+ styleAttributes.addAttribute(CSSConstants.TEXT_ALIGN, tmp);
else
- attributesMap.remove(CSSConstants.TEXT_ALIGN);
+ styleAttributes.removeAttribute(CSSConstants.TEXT_ALIGN);
}
- cssDialog.setStyleForPreview();
+ //TODO Dzmitry Sakovich
+ //cssDialog.setStyleForPreview();
}
});
@@ -415,15 +429,15 @@
public void updateData(boolean param) {
String tmp;
- if ((tmp = attributesMap.get(CSSConstants.FONT_FAMILY)) != null)
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.FONT_FAMILY)) != null)
fontFamilyText.setText(tmp);
else
fontFamilyText.setText(Constants.EMPTY_STRING);
- if ((tmp = attributesMap.get(CSSConstants.COLOR)) != null)
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.COLOR)) != null)
colorCombo.setText(tmp);
else
colorCombo.setText(Constants.EMPTY_STRING);
- if ((tmp = attributesMap.get(CSSConstants.FONT_SIZE)) != null) {
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.FONT_SIZE)) != null) {
String[] str = Util.convertExtString(tmp);
fontSizeCombo.setText(str[0]);
if (extFontSizeCombo.indexOf(str[1]) != -1) {
@@ -435,19 +449,19 @@
fontSizeCombo.setText(Constants.EMPTY_STRING);
extFontSizeCombo.select(0);
}
- if ((tmp = attributesMap.get(CSSConstants.TEXT_DECORATION)) != null)
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.TEXT_DECORATION)) != null)
textDecorationCombo.setText(tmp);
else
textDecorationCombo.setText(Constants.EMPTY_STRING);
- if ((tmp = attributesMap.get(CSSConstants.FONT_STYLE)) != null)
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.FONT_STYLE)) != null)
fontStyleCombo.setText(tmp);
else
fontStyleCombo.setText(Constants.EMPTY_STRING);
- if ((tmp = attributesMap.get(CSSConstants.FONT_WEIGHT)) != null)
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.FONT_WEIGHT)) != null)
fontWeigthCombo.setText(tmp);
else
fontWeigthCombo.setText(Constants.EMPTY_STRING);
- if ((tmp = attributesMap.get(CSSConstants.TEXT_ALIGN)) != null)
+ if ((tmp = styleAttributes.getAttribute(CSSConstants.TEXT_ALIGN)) != null)
textAlignCombo.setText(tmp);
else
textAlignCombo.setText(Constants.EMPTY_STRING);
16 years, 2 months
JBoss Tools SVN: r10576 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-09-30 14:45:39 -0400 (Tue, 30 Sep 2008)
New Revision: 10576
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
Log:
fix compilation problems. Several private methods those have references to ELParser and ELParser.Token classes where commented out to keep build running. to rollback changes use Fisheye or SVN history Get content context menu for previous revision
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2008-09-30 17:01:27 UTC (rev 10575)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2008-09-30 18:45:39 UTC (rev 10576)
@@ -33,11 +33,11 @@
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.jboss.tools.common.el.core.parser.ELParser;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.event.XModelTreeEvent;
import org.jboss.tools.common.model.event.XModelTreeListener;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
-import org.jboss.tools.common.model.util.ELParser;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.jst.web.project.WebProject;
@@ -122,53 +122,53 @@
}
public boolean openBundle(String expression, String locale){
- ELParser.Token token = parseJSFExpression(expression);
- if(token == null) return false;
- ELParser.Token t = token;
- String prefix = null;
- String propertyName = null;
- while(t != null) {
- if(t.kind == ELParser.OPEN) {
- String[] values = getCall(expression, t);
- if(values != null) {
- prefix = values[0];
- propertyName = values[1];
- break;
- }
- }
- t = t.next;
- }
- if(prefix == null) return false;
-
- BundleEntry entry = getBundle(prefix);
-
- if(entry == null){
- if (hasJsfProjectNatureType()) {
- IProject project = ((IFileEditorInput)editor.getEditorInput()).getFile().getProject();
- XModel model = EclipseResourceUtil.getModelNature(project).getModel();
- String prefix2 = prefix;
- if(propertyName != null && prefix != null) {
- prefix2 = prefix + "." + propertyName;
- }
- WebPromptingProvider.getInstance().getList(model, WebPromptingProvider.JSF_BEAN_OPEN, prefix2, null);
- }
- return false;
- }
-
- if (hasJsfProjectNatureType()) {
- Properties p = new Properties();
- p.put(WebPromptingProvider.BUNDLE, entry.uri);
- p.put(WebPromptingProvider.KEY, propertyName);
- if (locale != null) p.put(WebPromptingProvider.LOCALE, locale);
- p.put(WebPromptingProvider.FILE, ((IFileEditorInput)editor.getEditorInput()).getFile().getProject());
-
- IProject project = ((IFileEditorInput)editor.getEditorInput()).getFile().getProject();
- XModel model = EclipseResourceUtil.getModelNature(project).getModel();
-
- WebPromptingProvider.getInstance().getList(model, WebPromptingProvider.JSF_OPEN_KEY, entry.uri, p);
- String error = p.getProperty(WebPromptingProvider.ERROR);
- return (error == null || error.length() == 0);
- }
+// ELParser.Token token = parseJSFExpression(expression);
+// if(token == null) return false;
+// ELParser.Token t = token;
+// String prefix = null;
+// String propertyName = null;
+// while(t != null) {
+// if(t.kind == ELParser.OPEN) {
+// String[] values = getCall(expression, t);
+// if(values != null) {
+// prefix = values[0];
+// propertyName = values[1];
+// break;
+// }
+// }
+// t = t.next;
+// }
+// if(prefix == null) return false;
+//
+// BundleEntry entry = getBundle(prefix);
+//
+// if(entry == null){
+// if (hasJsfProjectNatureType()) {
+// IProject project = ((IFileEditorInput)editor.getEditorInput()).getFile().getProject();
+// XModel model = EclipseResourceUtil.getModelNature(project).getModel();
+// String prefix2 = prefix;
+// if(propertyName != null && prefix != null) {
+// prefix2 = prefix + "." + propertyName;
+// }
+// WebPromptingProvider.getInstance().getList(model, WebPromptingProvider.JSF_BEAN_OPEN, prefix2, null);
+// }
+// return false;
+// }
+//
+// if (hasJsfProjectNatureType()) {
+// Properties p = new Properties();
+// p.put(WebPromptingProvider.BUNDLE, entry.uri);
+// p.put(WebPromptingProvider.KEY, propertyName);
+// if (locale != null) p.put(WebPromptingProvider.LOCALE, locale);
+// p.put(WebPromptingProvider.FILE, ((IFileEditorInput)editor.getEditorInput()).getFile().getProject());
+//
+// IProject project = ((IFileEditorInput)editor.getEditorInput()).getFile().getProject();
+// XModel model = EclipseResourceUtil.getModelNature(project).getModel();
+//
+// WebPromptingProvider.getInstance().getList(model, WebPromptingProvider.JSF_OPEN_KEY, entry.uri, p);
+// String error = p.getProperty(WebPromptingProvider.ERROR);
+// return (error == null || error.length() == 0);
+// }
return false;
}
@@ -340,87 +340,89 @@
}
}
- private ELParser.Token parseJSFExpression(String expression){
- ELParser parser = new ELParser();
- ELParser.Token token = parser.parse(expression);
- return token;
- }
+// private ELParser.Token parseJSFExpression(String expression){
+// ELParser parser = new ELParser();
+// ELParser.Token token = parser.parse(expression);
+// return token;
+// return null;
+// }
public String getBundleValue(String name, int offset){
- if(isShowBundleUsageAsEL) return name;
- ELParser.Token token = parseJSFExpression(name);
- if(token == null) return null;
- ELParser.Token t = token;
- StringBuffer sb = new StringBuffer();
- while(t != null) {
- if(t.kind == ELParser.OPEN) {
- String[] values = getCall(name, t);
- ELParser.Token te = t;
- while(te.next != null && te.kind != ELParser.CLOSE) te = te.next;
- String dv = name.substring(t.start, te.end);
- String value = (values == null) ? null : getBundleValue(values[0], values[1], offset);
- if(value == null) {
- sb.append(dv);
- } else {
- sb.append(value);
- }
- t = te;
- } else {
- sb.append(name.substring(t.start, t.end));
- }
- t = t.next;
- }
- return sb.toString();
+// if(isShowBundleUsageAsEL) return name;
+// ELParser.Token token = parseJSFExpression(name);
+// if(token == null) return null;
+// ELParser.Token t = token;
+// StringBuffer sb = new StringBuffer();
+// while(t != null) {
+// if(t.kind == ELParser.OPEN) {
+// String[] values = getCall(name, t);
+// ELParser.Token te = t;
+// while(te.next != null && te.kind != ELParser.CLOSE) te = te.next;
+// String dv = name.substring(t.start, te.end);
+// String value = (values == null) ? null : getBundleValue(values[0], values[1], offset);
+// if(value == null) {
+// sb.append(dv);
+// } else {
+// sb.append(value);
+// }
+// t = te;
+// } else {
+// sb.append(name.substring(t.start, t.end));
+// }
+// t = t.next;
+// }
+// return sb.toString();
+ return "";
}
- private ELParser.Token next(ELParser.Token t) {
- if(t == null) return null;
- t = t.next;
- if(t != null && t.kind == ELParser.SPACES) t = t.next;
- return t;
- }
+// private ELParser.Token next(ELParser.Token t) {
+// if(t == null) return null;
+// t = t.next;
+// if(t != null && t.kind == ELParser.SPACES) t = t.next;
+// return t;
+// }
+//
+// String[] getCall(String expression, ELParser.Token t) {
+// if(t == null || t.kind != ELParser.OPEN) return null;
+// t = next(t);
+// if(t == null || t.kind != ELParser.NAME) return null;
+// String prefix = expression.substring(t.start, t.end);
+// String propName = null;
+// t = next(t);
+// if(t != null && t.kind == ELParser.DOT) {
+// t = next(t);
+// if(t == null || t.kind != ELParser.NAME) return null;
+// propName = expression.substring(t.start, t.end);
+// } else if(t != null && t.kind == ELParser.OPEN_ARG) {
+// t = next(t);
+// if(t == null || t.kind != ELParser.ARGUMENT) return null;
+// propName = expression.substring(t.start, t.end);
+// t = next(t);
+// if(t == null || t.kind != ELParser.CLOSE_ARG) return null;
+// }
+// t = next(t);
+// if(t == null || t.kind != ELParser.CLOSE) return null;
+// return propName == null ? null : new String[]{prefix, propName};
+// }
+//
+// private String getBundleValue(String prefix, String propertyName, int offset) {
+// BundleEntry entry = getBundle(prefix);
+// if(entry != null) {
+// //Added by estherbin fix JBIDE-2010 (issue with resources).
+// if(offset!=0 && (entry.offset > offset))return null;
+// String name = prefix + "." + propertyName;
+// try{
+// String value = (String)entry.bundle.getObject(propertyName);
+// if(!usedKeys.containsKey(name))
+// usedKeys.put(name, new UsedKey(entry.uri, prefix, propertyName, value, entry.hashCode, entry.offset));
+// return value;
+// }catch(MissingResourceException ex){
+// return null;
+// }
+// }
+// return null;
+// }
- String[] getCall(String expression, ELParser.Token t) {
- if(t == null || t.kind != ELParser.OPEN) return null;
- t = next(t);
- if(t == null || t.kind != ELParser.NAME) return null;
- String prefix = expression.substring(t.start, t.end);
- String propName = null;
- t = next(t);
- if(t != null && t.kind == ELParser.DOT) {
- t = next(t);
- if(t == null || t.kind != ELParser.NAME) return null;
- propName = expression.substring(t.start, t.end);
- } else if(t != null && t.kind == ELParser.OPEN_ARG) {
- t = next(t);
- if(t == null || t.kind != ELParser.ARGUMENT) return null;
- propName = expression.substring(t.start, t.end);
- t = next(t);
- if(t == null || t.kind != ELParser.CLOSE_ARG) return null;
- }
- t = next(t);
- if(t == null || t.kind != ELParser.CLOSE) return null;
- return propName == null ? null : new String[]{prefix, propName};
- }
-
- private String getBundleValue(String prefix, String propertyName, int offset) {
- BundleEntry entry = getBundle(prefix);
- if(entry != null) {
- //Added by estherbin fix JBIDE-2010 (issue with resources).
- if(offset!=0 && (entry.offset > offset))return null;
- String name = prefix + "." + propertyName;
- try{
- String value = (String)entry.bundle.getObject(propertyName);
- if(!usedKeys.containsKey(name))
- usedKeys.put(name, new UsedKey(entry.uri, prefix, propertyName, value, entry.hashCode, entry.offset));
- return value;
- }catch(MissingResourceException ex){
- return null;
- }
- }
- return null;
- }
-
public void addBundleMapListener(BundleMapListener listener) {
if (listener != null) {
BundleMapListener[] newBundleMapListener = new BundleMapListener[bundleMapListeners.length + 1];
16 years, 2 months
JBoss Tools SVN: r10575 - in trunk/seam/plugins: org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-09-30 13:01:27 -0400 (Tue, 30 Sep 2008)
New Revision: 10575
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam1ProjectCreator.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2731 Moved EJB/EAR project creation from seam facet to wizard.
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam1ProjectCreator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam1ProjectCreator.java 2008-09-30 16:51:41 UTC (rev 10574)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam1ProjectCreator.java 2008-09-30 17:01:27 UTC (rev 10575)
@@ -1,115 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2008 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.seam.internal.core.project.facet;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.tools.ant.types.FilterSet;
-import org.apache.tools.ant.types.FilterSetCollection;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.jboss.tools.seam.core.SeamCorePlugin;
-
-/**
- * @author Alexey Kazakov
- * This class helps New Seam Wizard Page to create EJB, EAR and test projects for seam 1.2 WAR project.
- */
-public class Seam1ProjectCreator extends SeamProjectCreator {
-
- protected static AntCopyUtils.FileSet JBOSS_TEST_LIB_FILESET = new AntCopyUtils.FileSet()
- .include("testng-.*-jdk15\\.jar") //$NON-NLS-1$
- .include("myfaces-api-.*\\.jar") //$NON-NLS-1$
- .include("myfaces-impl-.*\\.jar") //$NON-NLS-1$
- .include("servlet-api\\.jar") //$NON-NLS-1$
- .include("hibernate-all\\.jar") //$NON-NLS-1$
- .include("jboss-ejb3-all\\.jar") //$NON-NLS-1$
- .include("thirdparty-all\\.jar") //$NON-NLS-1$
- .exclude(".*/CVS") //$NON-NLS-1$
- .exclude(".*/\\.svn"); //$NON-NLS-1$
-
- /**
- * @param model Seam facet data model
- * @param seamWebProject Seam web project
- */
- public Seam1ProjectCreator(IDataModel model, IProject seamWebProject) {
- super(model, seamWebProject);
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.seam.internal.core.project.facet.SeamProjectCreator#createTestProject()
- */
- @Override
- protected void createTestProject() {
- File testProjectDir = new File(seamWebProject.getLocation().removeLastSegments(1).toFile(), testProjectName); //$NON-NLS-1$
- testProjectDir.mkdir();
-
- IVirtualComponent component = ComponentCore.createComponent(seamWebProject);
- IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
-
- File testLibDir = new File(testProjectDir, "lib"); //$NON-NLS-1$
- File embededEjbDir = new File(testProjectDir, "embedded-ejb"); //$NON-NLS-1$
- File testSrcDir = new File(testProjectDir, "test-src"); //$NON-NLS-1$
- FilterSet filterSet = new FilterSet();
- filterSet.addFilter("projectName", seamWebProject.getName()); //$NON-NLS-1$
- filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(seamWebProject)); //$NON-NLS-1$
- filterSet.addFilter("webRootFolder", webRootVirtFolder.getUnderlyingFolder().getFullPath().removeFirstSegments(1).toString()); //$NON-NLS-1$
-
- AntCopyUtils.FileSet includeLibs = new AntCopyUtils.FileSet(JBOSS_TEST_LIB_FILESET).dir(new File(seamRuntime.getHomeDir(), "lib")); //$NON-NLS-1$
- File[] libs = includeLibs.getDir().listFiles(new AntCopyUtils.FileSetFileFilter(includeLibs));
- StringBuffer testLibraries = new StringBuffer();
-
- for (File file : libs) {
- testLibraries.append("\t<classpathentry kind=\"lib\" path=\"lib/" + file.getName() + "\"/>\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- StringBuffer requiredProjects = new StringBuffer();
- requiredProjects.append("\t<classpathentry combineaccessrules=\"false\" kind=\"src\" path=\"/" + seamWebProject.getName() + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
- if (!SeamFacetAbstractInstallDelegate.isWarConfiguration(model)) {
- requiredProjects.append("\n\t<classpathentry combineaccessrules=\"false\" kind=\"src\" path=\"/" + ejbProjectName + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- filterSet.addFilter("testLibraries", testLibraries.toString()); //$NON-NLS-1$
- filterSet.addFilter("requiredProjects", requiredProjects.toString()); //$NON-NLS-1$
- File testTemplateDir = null;
- try {
- testTemplateDir = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "test"); //$NON-NLS-1$
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- return;
- }
- AntCopyUtils.FileSet excludeCvsSvn
- = new AntCopyUtils.FileSet(SeamFacetAbstractInstallDelegate.CVS_SVN).dir(testTemplateDir);
-
- AntCopyUtils.copyFilesAndFolders(
- testTemplateDir,
- testProjectDir,
- new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
- new FilterSetCollection(filterSet), true);
-
- excludeCvsSvn.dir(new File(seamRuntime.getHomeDir(), "embedded-ejb/conf")); //$NON-NLS-1$
- AntCopyUtils.copyFiles(
- new File(seamRuntime.getHomeDir(), "embedded-ejb/conf"), //$NON-NLS-1$
- embededEjbDir,
- new AntCopyUtils.FileSetFileFilter(excludeCvsSvn));
-
- AntCopyUtils.copyFiles(
- new File(seamRuntime.getHomeDir(), "lib"), //$NON-NLS-1$
- testLibDir,
- new AntCopyUtils.FileSetFileFilter(includeLibs));
-
- SeamFacetAbstractInstallDelegate.createComponentsProperties(testSrcDir, "", Boolean.TRUE); //$NON-NLS-1$
- }
-}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2008-09-30 16:51:41 UTC (rev 10574)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2008-09-30 17:01:27 UTC (rev 10575)
@@ -11,17 +11,12 @@
package org.jboss.tools.seam.internal.core.project.facet;
import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.Set;
import org.apache.tools.ant.types.FilterSet;
import org.apache.tools.ant.types.FilterSetCollection;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -29,27 +24,18 @@
import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
import org.eclipse.jst.javaee.web.WebApp;
import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.util.ResourcesUtils;
import org.jboss.tools.seam.core.ISeamProject;
-import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
// TODO: why not just *one* global filter set to avoid any missing names ? (assert for it in our unittests!
public class Seam2FacetInstallDelegate extends SeamFacetAbstractInstallDelegate{
- public static String DEV_WAR_PROFILE = "dev-war"; //$NON-NLS-1$
- public static String DEV_EAR_PROFILE = "dev"; //$NON-NLS-1$
-
public static AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_WAR_CONFIG = new AntCopyUtils.FileSet()
.include("ajax4jsf.*\\.jar") //$NON-NLS-1$
.include("richfaces.*\\.jar")
@@ -90,67 +76,11 @@
.include("jboss-seam-ui\\.jar") //$NON-NLS-1$
.include("jsf-facelets\\.jar"); //$NON-NLS-1$
- public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT = new AntCopyUtils.FileSet()
- .include("antlr-runtime.jar") //$NON-NLS-1$
- .include("drools-compiler.*\\.jar") //$NON-NLS-1$
- .include("drools-core.*\\.jar") //$NON-NLS-1$
- .include("jboss-seam.jar") //$NON-NLS-1$
- .include("jboss-el.*.jar") //$NON-NLS-1$
- .include("mvel14.*.jar") //$NON-NLS-1$
- .include("jbpm-jpdl.*\\.jar") //$NON-NLS-1$
- .include("richfaces-api.*\\.jar"); //$NON-NLS-1$
-
- /*public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT_META_INF = new AntCopyUtils.FileSet()
- .include("META-INF/application\\.xml") //$NON-NLS-1$
- .include("META-INF/jboss-app\\.xml"); //$NON-NLS-1$
- */
-
- public static AntCopyUtils.FileSet VIEW_FILESET = new AntCopyUtils.FileSet()
- .include("home\\.xhtml") //$NON-NLS-1$
- .include("error\\.xhtml") //$NON-NLS-1$
- .include("login\\.xhtml") //$NON-NLS-1$
- .include("login\\.page.xml") //$NON-NLS-1$
- .include("index\\.html") //$NON-NLS-1$
- .include("layout") //$NON-NLS-1$
- .include("layout/.*") //$NON-NLS-1$
- .include("stylesheet") //$NON-NLS-1$
- .include("stylesheet/.*") //$NON-NLS-1$
- .include("img/.*") //$NON-NLS-1$
- .include("img") //$NON-NLS-1$
- .exclude(".*/.*\\.ftl") //$NON-NLS-1$
- .exclude(".*/CVS") //$NON-NLS-1$
- .exclude(".*/\\.svn"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet JBOOS_WAR_WEBINF_SET = new AntCopyUtils.FileSet()
- .include("WEB-INF") //$NON-NLS-1$
- //.include("WEB-INF/web\\.xml") //$NON-NLS-1$
- .include("WEB-INF/pages\\.xml") //$NON-NLS-1$
- .include("WEB-INF/jboss-web\\.xml") //$NON-NLS-1$
- .include("WEB-INF/faces-config\\.xml") //$NON-NLS-1$
- .include("WEB-INF/componets\\.xml"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet JBOOS_WAR_WEB_INF_CLASSES_SET = new AntCopyUtils.FileSet()
- .include("import\\.sql") //$NON-NLS-1$
- .include("security\\.drl") //$NON-NLS-1$
- .include("seam\\.properties") //$NON-NLS-1$
- .include("messages_en\\.properties"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet JBOOS_EJB_WEB_INF_CLASSES_SET = new AntCopyUtils.FileSet()
- .include("import\\.sql") //$NON-NLS-1$
- .include("seam\\.properties")
- .exclude(".*/WEB-INF"); //$NON-NLS-1$
-
public static String DROOLS_LIB_SEAM_RELATED_PATH = "lib"; //$NON-NLS-1$
- public static String SEAM_LIB_RELATED_PATH = "lib"; //$NON-NLS-1$
-
- public static String WEB_LIBRARIES_RELATED_PATH = "WEB-INF/lib"; //$NON-NLS-1$
-
public void doExecute(final IProject project, IProjectFacetVersion fv,
Object config, IProgressMonitor monitor) throws CoreException {
final IDataModel model = (IDataModel)config;
- IFacetedProjectWorkingCopy fc = (IFacetedProjectWorkingCopy)model.getProperty(IFacetDataModelProperties.FACETED_PROJECT_WORKING_COPY);
- Set<IProjectFacetVersion> fvd = fc.getProjectFacets();
// get WebContents folder path from DWP model
IVirtualComponent component = ComponentCore.createComponent(project);
@@ -170,8 +100,6 @@
model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO,"create-drop"); //$NON-NLS-1$
}
- final String consoleName = isWarConfiguration(model)?project.getName():project.getName()+"-ejb";
-
final File webContentFolder = webRootFolder.getLocation().toFile();
final File webInfFolder = new File(webContentFolder,"WEB-INF"); //$NON-NLS-1$
final File webInfClasses = new File(webInfFolder,"classes"); //$NON-NLS-1$
@@ -179,7 +107,6 @@
webInfClassesMetaInf.mkdirs();
final File webLibFolder = new File(webContentFolder,WEB_LIBRARIES_RELATED_PATH);
final File srcFolder = isWarConfiguration(model)?new File(srcRootFolder.getUnderlyingFolder().getLocation().toFile(),"model"):srcRootFolder.getUnderlyingFolder().getLocation().toFile(); //$NON-NLS-1$
- final File webMetaInf = new File(webContentFolder, "META-INF"); //$NON-NLS-1$
final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
final String seamHomePath = selectedRuntime.getHomeDir();
@@ -187,7 +114,6 @@
final File seamHomeFolder = new File(seamHomePath);
final File seamLibFolder = new File(seamHomePath,SEAM_LIB_RELATED_PATH);
final File seamGenResFolder = new File(seamHomePath,"seam-gen/resources"); //$NON-NLS-1$
- final File seamGenResMetainfFolder = new File(seamGenResFolder,"META-INF"); //$NON-NLS-1$
final File droolsLibFolder = new File(seamHomePath,DROOLS_LIB_SEAM_RELATED_PATH);
final File seamGenHomeFolder = new File(seamHomePath,"seam-gen"); //$NON-NLS-1$
@@ -242,10 +168,8 @@
hibernateDialectFilterSet.addFilterSet(projectFilterSet);
hibernateDialectFilterSet.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
-// createTestProject(model,project,selectedRuntime);
-
// ********************************************************************************************
- // Handle WAR/EAR configurations
+ // Handle WAR configurations
// ********************************************************************************************
if(isWarConfiguration(model)) {
AntCopyUtils.FileSet webInfClassesSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
@@ -318,165 +242,21 @@
WtpUtils.setClasspathEntryAsExported(project, new Path("org.eclipse.jst.j2ee.internal.web.container"), monitor); //$NON-NLS-1$
} else {
- model.setProperty(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT, project.getName()+"-ejb"); //$NON-NLS-1$
- model.setProperty(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT, project.getName()+"-ear"); //$NON-NLS-1$
-
// In case of EAR configuration
- AntCopyUtils.copyFiles(seamHomeFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamHomeFolder)));
- AntCopyUtils.copyFiles(seamLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(droolsLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(droolsLibFolder)));
- AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"messages_en.properties"),srcFolder, true); //$NON-NLS-1$
-
- File ear = new File(project.getLocation().removeLastSegments(1).toFile(),model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ear"); //$NON-NLS-1$
- File ejb = new File(project.getLocation().removeLastSegments(1).toFile(),model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ejb"); //$NON-NLS-1$
- ear.mkdir();
- ejb.mkdir();
-
- try {
- FilterSet filterSet = new FilterSet();
- filterSet.addFilter("projectName", project.getName()); //$NON-NLS-1$
- filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(project)); //$NON-NLS-1$
- if(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH)!=null) {
- File driver = new File(((String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH))[0]);
- filterSet.addFilter("driverJar"," " + driver.getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } else {
- filterSet.addFilter("driverJar",""); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- File ejbTemplateDir = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ejb");
- AntCopyUtils.FileSet excludeCvsSvn = new AntCopyUtils.FileSet(CVS_SVN).dir(ejbTemplateDir);
-
- AntCopyUtils.copyFilesAndFolders(
- ejbTemplateDir, //$NON-NLS-1$
- ejb, new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
- new FilterSetCollection(filterSet), true);
-
- // *******************************************************************************************
- // Copy sources to ejb project in case of EAR configuration
- // *******************************************************************************************
- AntCopyUtils.copyFileToFile(
- new File(seamGenHomeFolder,"src/Authenticator.java"), //$NON-NLS-1$
- new File(ejb,"ejbModule/" + model.getProperty(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME).toString().replace('.', '/')+"/"+"Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new FilterSetCollection(filtersFilterSet), true);
- AntCopyUtils.copyFileToFile(
- persistenceFile,
- new File(ejb,"ejbModule/META-INF/persistence.xml"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- createComponentsProperties(new File(ejb,"ejbModule"), isWarConfiguration(model)?"":project.getName()+"-ear", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- AntCopyUtils.FileSet ejbSrcResourcesSet = new AntCopyUtils.FileSet(JBOOS_EJB_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
- AntCopyUtils.copyFilesAndFolders(
- seamGenResFolder,new File(ejb,"ejbModule"),new AntCopyUtils.FileSetFileFilter(ejbSrcResourcesSet), viewFilterSetCollection, true); //$NON-NLS-1$
-
- // ********************************************************************************************
- // Copy security.drl to source folder
- // ********************************************************************************************
- AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"security.drl"), new File(ejb,"ejbModule/"), true); //$NON-NLS-1$ //$NON-NLS-2$
-
- File resources = new File(ear,"resources");
- AntCopyUtils.copyFileToFile(
- dataSourceDsFile,
- new File(resources,project.getName()+"-ds.xml"), //$NON-NLS-1$ //$NON-NLS-2$
- viewFilterSetCollection, true);
-
- AntCopyUtils.copyFileToFolder(
- new File(seamGenResFolder,"META-INF/ejb-jar.xml"), //$NON-NLS-1$
- new File(ejb,"ejbModule/META-INF/"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- /*AntCopyUtils.copyFileToFolder(
- hibernateConsolePref,
- new File(ejb,".settings"), //$NON-NLS-1$
- new FilterSetCollection(projectFilterSet), true);*/
-
- FilterSet ejbFilterSet = new FilterSet();
- ejbFilterSet.addFilter("projectName",ejb.getName()); //$NON-NLS-1$
-
- AntCopyUtils.copyFileToFile(
- hibernateConsoleLaunchFile,
- new File(ejb,ejb.getName()+".launch"), //$NON-NLS-1$
- new FilterSetCollection(ejbFilterSet), true);
-
- AntCopyUtils.copyFileToFolder(
- hibernateConsolePropsFile,
- ejb,
- hibernateDialectFilterSet, true);
-
- File earContentsFolder = new File(ear,"EarContent"); //$NON-NLS-1$
-
- FilterSet earFilterSet = new FilterSet();
- earFilterSet.addFilter("projectName",ear.getName()+".ear"); //$NON-NLS-1$ //$NON-NLS-2$
-
- AntCopyUtils.copyFileToFolder(
- new File(seamGenResFolder,"META-INF/jboss-app.xml"), //$NON-NLS-1$
- new File(earContentsFolder,"META-INF"), //$NON-NLS-1$
- new FilterSetCollection(earFilterSet),true);
-
- // Copy configuration files from template
- AntCopyUtils.copyFilesAndFolders(
- new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ear-seam2"), //$NON-NLS-1$
- ear, new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
- new FilterSetCollection(filterSet), true);
-
- // Fill ear contents
- AntCopyUtils.copyFiles(seamHomeFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamHomeFolder)));
- AntCopyUtils.copyFiles(seamLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(droolsLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(droolsLibFolder)));
- AntCopyUtils.copyFiles(seamLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(seamGenResFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamGenResFolder)));
-
- File[] earJars = earContentsFolder.listFiles(new FilenameFilter() {
- /* (non-Javadoc)
- * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
- */
- public boolean accept(File dir, String name) {
- if(name.lastIndexOf(".jar")>0) return true; //$NON-NLS-1$
- return false;
- }
- });
- String earJarsStr = ""; //$NON-NLS-1$
- for (File file : earJars) {
- earJarsStr +=" " + file.getName() +" \n"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- FilterSetCollection manifestFilterCol = new FilterSetCollection(projectFilterSet);
- FilterSet manifestFilter = new FilterSet();
- manifestFilter.addFilter("earLibs",earJarsStr); //$NON-NLS-1$
- manifestFilterCol.addFilterSet(manifestFilter);
- AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"war/META-INF/MANIFEST.MF"), webMetaInf, manifestFilterCol, true); //$NON-NLS-1$
- File ejbMetaInf = new File(ejb,"ejbModule/META-INF"); //$NON-NLS-1$
- AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ejb/ejbModule/META-INF/MANIFEST.MF"), ejbMetaInf, manifestFilterCol, true); //$NON-NLS-1$
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
+ AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(droolsLibFolder)));
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "messages_en.properties"), srcFolder, true); //$NON-NLS-1$
}
ClasspathHelper.addClasspathEntries(project, fv);
+ // TODO
createSeamProjectPreferenes(project, model);
EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
- toggleHibernateOnProject(project, consoleName);
-
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- String wsPath = project.getLocation().removeLastSegments(1)
- .toFile().getAbsoluteFile().getPath();
-
- IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
-
- if(!isWarConfiguration(model)) {
- IProject ejbProjectToBeImported = wsRoot.getProject(project.getName()+"-ejb");
- ResourcesUtils.importExistingProject(ejbProjectToBeImported, wsPath+"/"+project.getName()+"-ejb", project.getName()+"-ejb", monitor, false);
- toggleHibernateOnProject(ejbProjectToBeImported, consoleName);
- IProjectFacet sf = ProjectFacetsManager.getProjectFacet("jst.ejb");
- IProjectFacetVersion pfv = ProjectFacetsManager.create(ejbProjectToBeImported).getInstalledVersion(sf);
- ClasspathHelper.addClasspathEntries(ejbProjectToBeImported, pfv);
-
- IProject earProjectToBeImported = wsRoot.getProject(project.getName()+"-ear");
- ResourcesUtils.importExistingProject(earProjectToBeImported, wsPath+"/"+project.getName()+"-ear", project.getName()+"-ear", monitor, false);
- }
}
/*
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2008-09-30 16:51:41 UTC (rev 10574)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2008-09-30 17:01:27 UTC (rev 10575)
@@ -32,7 +32,7 @@
public class Seam2ProjectCreator extends SeamProjectCreator {
// test/*.jar are duplicated here since the filtering seem to be assymetric when matching
- protected static AntCopyUtils.FileSet JBOSS_TEST_LIB_FILESET = new AntCopyUtils.FileSet()
+ private static AntCopyUtils.FileSet JBOSS_TEST_LIB_FILESET = new AntCopyUtils.FileSet()
.include("testng\\.jar") //$NON-NLS-1$
.include("test/hibernate-all\\.jar") //$NON-NLS-1$
.include("hibernate-all\\.jar") //$NON-NLS-1$
@@ -48,12 +48,24 @@
.exclude(".*/CVS") //$NON-NLS-1$
.exclude(".*/\\.svn"); //$NON-NLS-1$
+ private static AntCopyUtils.FileSet JBOSS_EAR_CONTENT = new AntCopyUtils.FileSet()
+ .include("antlr-runtime.jar") //$NON-NLS-1$
+ .include("drools-compiler.*\\.jar") //$NON-NLS-1$
+ .include("drools-core.*\\.jar") //$NON-NLS-1$
+ .include("jboss-seam.jar") //$NON-NLS-1$
+ .include("jboss-el.*.jar") //$NON-NLS-1$
+ .include("mvel14.*.jar") //$NON-NLS-1$
+ .include("jbpm-jpdl.*\\.jar") //$NON-NLS-1$
+ .include("richfaces-api.*\\.jar"); //$NON-NLS-1$
+
/**
* @param model Seam facet data model
* @param seamWebProject Seam web project
*/
public Seam2ProjectCreator(IDataModel model, IProject seamWebProject) {
super(model, seamWebProject);
+ viewFilterSetCollection.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
+ droolsLibFolder = new File(seamHomePath, Seam2FacetInstallDelegate.DROOLS_LIB_SEAM_RELATED_PATH);
}
@Override
@@ -80,8 +92,8 @@
// TODO: why are these filters not shared!?
filterSet.addConfiguredFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
- AntCopyUtils.FileSet includeLibs = new AntCopyUtils.FileSet(JBOSS_TEST_LIB_FILESET).dir(new File(seamRuntime.getHomeDir(),"lib")); //$NON-NLS-1$
- AntCopyUtils.FileSet secondSetincludeLibs = new AntCopyUtils.FileSet(JBOSS_TEST_LIB_FILESET).dir(new File(seamRuntime.getHomeDir(),"lib/test")); //$NON-NLS-1$
+ AntCopyUtils.FileSet includeLibs = new AntCopyUtils.FileSet(getJBossTestLibFileset()).dir(new File(seamRuntime.getHomeDir(),"lib")); //$NON-NLS-1$
+ AntCopyUtils.FileSet secondSetincludeLibs = new AntCopyUtils.FileSet(getJBossTestLibFileset()).dir(new File(seamRuntime.getHomeDir(),"lib/test")); //$NON-NLS-1$
File[] firstlibs = includeLibs.getDir().listFiles(new AntCopyUtils.FileSetFileFilter(includeLibs));
File[] secondLibs = secondSetincludeLibs.getDir().listFiles(new AntCopyUtils.FileSetFileFilter(secondSetincludeLibs));
@@ -161,4 +173,19 @@
SeamFacetAbstractInstallDelegate.createComponentsProperties(testSrcDir, "", true); //$NON-NLS-1$
}
+
+ @Override
+ protected void createEjbProject() {
+ super.createEjbProject();
+ // Copy security.drl to source folder
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "security.drl"), new File(ejbProjectFolder, "ejbModule/"), true); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ protected AntCopyUtils.FileSet getJBossTestLibFileset() {
+ return JBOSS_TEST_LIB_FILESET;
+ }
+
+ protected AntCopyUtils.FileSet getJbossEarContent() {
+ return JBOSS_EAR_CONTENT;
+ }
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-09-30 16:51:41 UTC (rev 10574)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-09-30 17:01:27 UTC (rev 10575)
@@ -84,7 +84,42 @@
public static String RESTRICT_RAW_XHTML = "Restrict raw XHTML Documents";
public static String XHTML = "XHTML";
public static String WEB_RESOURCE_COLLECTION_PATTERN = "*.xhtml";
+ public static String SEAM_LIB_RELATED_PATH = "lib"; //$NON-NLS-1$
+ public static final String DEV_WAR_PROFILE = "dev-war"; //$NON-NLS-1$
+ public static final String DEV_EAR_PROFILE = "dev"; //$NON-NLS-1$
+ public static AntCopyUtils.FileSet VIEW_FILESET = new AntCopyUtils.FileSet()
+ .include("home\\.xhtml") //$NON-NLS-1$
+ .include("error\\.xhtml") //$NON-NLS-1$
+ .include("login\\.xhtml") //$NON-NLS-1$
+ .include("login\\.page.xml") //$NON-NLS-1$
+ .include("index\\.html") //$NON-NLS-1$
+ .include("layout") //$NON-NLS-1$
+ .include("layout/.*") //$NON-NLS-1$
+ .include("stylesheet") //$NON-NLS-1$
+ .include("stylesheet/.*") //$NON-NLS-1$
+ .include("img/.*") //$NON-NLS-1$
+ .include("img") //$NON-NLS-1$
+ .exclude(".*/.*\\.ftl") //$NON-NLS-1$
+ .exclude(".*/CVS") //$NON-NLS-1$
+ .exclude(".*/\\.svn"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOOS_WAR_WEBINF_SET = new AntCopyUtils.FileSet()
+ .include("WEB-INF") //$NON-NLS-1$
+ //.include("WEB-INF/web\\.xml") //$NON-NLS-1$
+ .include("WEB-INF/pages\\.xml") //$NON-NLS-1$
+ .include("WEB-INF/jboss-web\\.xml") //$NON-NLS-1$
+ .include("WEB-INF/faces-config\\.xml") //$NON-NLS-1$
+ .include("WEB-INF/componets\\.xml"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOOS_WAR_WEB_INF_CLASSES_SET = new AntCopyUtils.FileSet()
+ .include("import\\.sql") //$NON-NLS-1$
+ .include("security\\.drl") //$NON-NLS-1$
+ .include("seam\\.properties") //$NON-NLS-1$
+ .include("messages_en\\.properties"); //$NON-NLS-1$
+
+ public static String WEB_LIBRARIES_RELATED_PATH = "WEB-INF/lib"; //$NON-NLS-1$
+
static AntCopyUtils.FileSet CVS_SVN = new AntCopyUtils.FileSet()
.include(".*") //$NON-NLS-1$
.exclude(".*/CVS") //$NON-NLS-1$
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2008-09-30 16:51:41 UTC (rev 10574)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2008-09-30 17:01:27 UTC (rev 10575)
@@ -11,18 +11,12 @@
package org.jboss.tools.seam.internal.core.project.facet;
import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.Properties;
import org.apache.tools.ant.types.FilterSet;
import org.apache.tools.ant.types.FilterSetCollection;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -36,13 +30,9 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.util.ResourcesUtils;
import org.jboss.tools.seam.core.ISeamProject;
-import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
@@ -63,19 +53,6 @@
private static final String ORG_AJAX4JSF_SKIN = "org.ajax4jsf.SKIN";
- /**
- *
- **/
- public static final String DEV_WAR_PROFILE = "dev-war"; //$NON-NLS-1$
-
- /**
- *
- */
- public static final String DEV_EAR_PROFILE = "dev"; //$NON-NLS-1$
-
- /**
- *
- */
public static final AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_WAR_CONFIG = new AntCopyUtils.FileSet()
.include("ajax4jsf.*\\.jar") //$NON-NLS-1$
.include("richfaces.*\\.jar") //$NON-NLS-1$
@@ -102,21 +79,6 @@
// el-ri needed for JBIDE-939
.include("el-ri.*\\.jar"); //$NON-NLS-1$
- private static final String ORG_AJAX4JSF_FILTER_NAME = "ajax4jsf";
-
- private static final String ORG_AJAX4JSF_FILTER_CLASS = "org.ajax4jsf.Filter";
-
- private static final String ORG_AJAX4JSF_FILTER_DISPLAY_NAME = "Ajax4jsf Filter";
-
- private static final String ORG_AJAX4JSF_FILTER_MAPPING = "*.seam";
-
- private static final String ORG_JBOSS_SEAM_UI_SEAMFACELETVIEWHANDLER = "org.jboss.seam.ui.facelet.SeamFaceletViewHandler";
-
- private static final String ORG_AJAX4JSF_VIEW_HANDLERS = "org.ajax4jsf.VIEW_HANDLERS";
-
- /**
- *
- */
public static AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_EAR_CONFIG = new AntCopyUtils.FileSet()
.include("ajax4jsf.*\\.jar") //$NON-NLS-1$
.include("richfaces.*\\.jar") //$NON-NLS-1$
@@ -132,98 +94,20 @@
.include("jsf-facelets\\.jar") //$NON-NLS-1$
.include("oscache.*\\.jar"); //$NON-NLS-1$
- /**
- *
- */
- public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT = new AntCopyUtils.FileSet()
- .include("antlr.*\\.jar") //$NON-NLS-1$
- .include("commons-jci-core.*\\.jar") //$NON-NLS-1$
- .include("commons-jci-janino.*\\.jar") //$NON-NLS-1$
- .include("drools-compiler.*\\.jar") //$NON-NLS-1$
- .include("drools-core.*\\.jar") //$NON-NLS-1$
- .include("janino.*\\.jar") //$NON-NLS-1$
- .include("jboss-seam.jar") //$NON-NLS-1$
- .include("jbpm.*\\.jar") //$NON-NLS-1$
- .include("security\\.drl") //$NON-NLS-1$
- .include("stringtemplate.*\\.jar") //$NON-NLS-1$
- // el-ri needed for JBIDE-939
- .include("el-ri.*\\.jar"); //$NON-NLS-1$
+ private static final String ORG_AJAX4JSF_FILTER_NAME = "ajax4jsf";
- /**
- *
- */
- public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT_META_INF = new AntCopyUtils.FileSet()
- .include("META-INF/application\\.xml") //$NON-NLS-1$
- .include("META-INF/jboss-app\\.xml"); //$NON-NLS-1$
+ private static final String ORG_AJAX4JSF_FILTER_CLASS = "org.ajax4jsf.Filter";
- /**
- *
- */
- public static AntCopyUtils.FileSet VIEW_FILESET = new AntCopyUtils.FileSet()
- .include("home\\.xhtml") //$NON-NLS-1$
- .include("error\\.xhtml") //$NON-NLS-1$
- .include("login\\.xhtml") //$NON-NLS-1$
- .include("login\\.page.xml") //$NON-NLS-1$
- .include("index\\.html") //$NON-NLS-1$
- .include("layout") //$NON-NLS-1$
- .include("layout/.*") //$NON-NLS-1$
- .include("stylesheet") //$NON-NLS-1$
- .include("stylesheet/.*") //$NON-NLS-1$
- .include("img/.*") //$NON-NLS-1$
- .include("img") //$NON-NLS-1$
- .exclude(".*/.*\\.ftl") //$NON-NLS-1$
- .exclude(".*/CVS") //$NON-NLS-1$
- .exclude(".*/\\.svn"); //$NON-NLS-1$
+ private static final String ORG_AJAX4JSF_FILTER_DISPLAY_NAME = "Ajax4jsf Filter";
- /**
- *
- */
- public static AntCopyUtils.FileSet JBOOS_WAR_WEBINF_SET = new AntCopyUtils.FileSet()
- .include("WEB-INF") //$NON-NLS-1$
- //.include("WEB-INF/web\\.xml") //$NON-NLS-1$
- .include("WEB-INF/pages\\.xml") //$NON-NLS-1$
- .include("WEB-INF/jboss-web\\.xml") //$NON-NLS-1$
- .include("WEB-INF/faces-config\\.xml") //$NON-NLS-1$
- .include("WEB-INF/componets\\.xml"); //$NON-NLS-1$
+ private static final String ORG_AJAX4JSF_FILTER_MAPPING = "*.seam";
- /**
- *
- */
- public static AntCopyUtils.FileSet JBOOS_WAR_WEB_INF_CLASSES_SET = new AntCopyUtils.FileSet()
- .include("import\\.sql") //$NON-NLS-1$
- .include("security\\.drl") //$NON-NLS-1$
- .include("seam\\.properties") //$NON-NLS-1$
- .include("messages_en\\.properties"); //$NON-NLS-1$
+ private static final String ORG_JBOSS_SEAM_UI_SEAMFACELETVIEWHANDLER = "org.jboss.seam.ui.facelet.SeamFaceletViewHandler";
- /**
- *
- */
- public static AntCopyUtils.FileSet JBOOS_EJB_WEB_INF_CLASSES_SET = new AntCopyUtils.FileSet()
- .include("import\\.sql") //$NON-NLS-1$
- .include("seam\\.properties")
- .exclude(".*/WEB-INF"); //$NON-NLS-1$
+ private static final String ORG_AJAX4JSF_VIEW_HANDLERS = "org.ajax4jsf.VIEW_HANDLERS";
- /**
- *
- */
- public static AntCopyUtils.FileSet JBOSS_EAR_META_INF_SET = new AntCopyUtils.FileSet()
- .include("META-INF/jboss-app\\.xml"); //$NON-NLS-1$
-
- /**
- *
- */
public static String DROOLS_LIB_SEAM_RELATED_PATH = "drools/lib"; //$NON-NLS-1$
- /**
- *
- */
- public static String SEAM_LIB_RELATED_PATH = "lib"; //$NON-NLS-1$
-
- /**
- *
- */
- public static String WEB_LIBRARIES_RELATED_PATH = "WEB-INF/lib"; //$NON-NLS-1$
-
private void doExecuteForWar(final IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException {
@@ -245,8 +129,6 @@
model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO, "create-drop"); //$NON-NLS-1$
}
- final String consoleName = isWarConfiguration(model) ? project.getName() : project.getName() + "-ejb";
-
final File webContentFolder = webRootFolder.getLocation().toFile();
final File webInfFolder = new File(webContentFolder, "WEB-INF"); //$NON-NLS-1$
final File webInfClasses = new File(webInfFolder, "classes"); //$NON-NLS-1$
@@ -254,7 +136,6 @@
webInfClassesMetaInf.mkdirs();
final File webLibFolder = new File(webContentFolder, WEB_LIBRARIES_RELATED_PATH);
final File srcFolder = isWarConfiguration(model) ? new File(srcRootFolder.getUnderlyingFolder().getLocation().toFile(), "model") : srcRootFolder.getUnderlyingFolder().getLocation().toFile(); //$NON-NLS-1$
- final File webMetaInf = new File(webContentFolder, "META-INF"); //$NON-NLS-1$
final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
final String seamHomePath = selectedRuntime.getHomeDir();
@@ -313,17 +194,15 @@
hibernateDialectFilterSet.addFilterSet(projectFilterSet);
hibernateDialectFilterSet.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
-// createTestProject(model, project, selectedRuntime);
-
// ********************************************************************************************
- // Handle WAR/EAR configurations
+ // Handle WAR configurations
// ********************************************************************************************
if (isWarConfiguration(model)) {
AntCopyUtils.FileSet webInfClassesSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
AntCopyUtils.copyFilesAndFolders(
seamGenResFolder, srcFolder, new AntCopyUtils.FileSetFileFilter(webInfClassesSet), viewFilterSetCollection, true);
- createComponentsProperties(srcFolder, isWarConfiguration(model) ? "" : project.getName() + "-ear", false); //$NON-NLS-1$ //$NON-NLS-2$
+ createComponentsProperties(srcFolder, "", false); //$NON-NLS-1$ //$NON-NLS-2$
/*AntCopyUtils.copyFileToFolder(
hibernateConsolePref,
@@ -383,163 +262,21 @@
WtpUtils.setClasspathEntryAsExported(project, new Path("org.eclipse.jst.j2ee.internal.web.container"), monitor); //$NON-NLS-1$
} else {
- model.setProperty(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT, project.getName() + "-ejb"); //$NON-NLS-1$
- model.setProperty(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT, project.getName() + "-ear"); //$NON-NLS-1$
-
// In case of EAR configuration
AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamHomeFolder)));
AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamLibFolder)));
AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(droolsLibFolder)));
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "messages_en.properties"), srcFolder, true); //$NON-NLS-1$
-
- File ear = new File(project.getLocation().removeLastSegments(1).toFile(), model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME) + "-ear"); //$NON-NLS-1$
- File ejb = new File(project.getLocation().removeLastSegments(1).toFile(), model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME) + "-ejb"); //$NON-NLS-1$
- ear.mkdir();
- ejb.mkdir();
-
- try {
- FilterSet filterSet = new FilterSet();
- filterSet.addFilter("projectName", project.getName()); //$NON-NLS-1$
- filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(project)); //$NON-NLS-1$
- if (model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH) != null) {
- File driver = new File(((String[]) model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH))[0]);
- filterSet.addFilter("driverJar", " " + driver.getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } else {
- filterSet.addFilter("driverJar", ""); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- File ejbTemplateDir = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ejb");
- AntCopyUtils.FileSet excludeCvsSvn = new AntCopyUtils.FileSet(CVS_SVN).dir(ejbTemplateDir);
-
- AntCopyUtils.copyFilesAndFolders(
- ejbTemplateDir, //$NON-NLS-1$
- ejb, new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
- new FilterSetCollection(filterSet), true);
-
- // *******************************************************************************************
- // Copy sources to ejb project in case of EAR configuration
- // *******************************************************************************************
- AntCopyUtils.copyFileToFile(
- new File(seamGenHomeFolder, "src/Authenticator.java"), //$NON-NLS-1$
- new File(ejb, "ejbModule/" + model.getProperty(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME).toString().replace('.', '/') + "/" + "Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new FilterSetCollection(filtersFilterSet), true);
- AntCopyUtils.copyFileToFile(
- persistenceFile,
- new File(ejb, "ejbModule/META-INF/persistence.xml"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- createComponentsProperties(new File(ejb, "ejbModule"), isWarConfiguration(model) ? "" : project.getName() + "-ear", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- AntCopyUtils.FileSet ejbSrcResourcesSet = new AntCopyUtils.FileSet(JBOOS_EJB_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
- AntCopyUtils.copyFilesAndFolders(
- seamGenResFolder, new File(ejb, "ejbModule"), new AntCopyUtils.FileSetFileFilter(ejbSrcResourcesSet), viewFilterSetCollection, true); //$NON-NLS-1$
-
- AntCopyUtils.copyFileToFolder(
- new File(seamGenResFolder, "META-INF/ejb-jar.xml"), //$NON-NLS-1$
- new File(ejb, "ejbModule/META-INF/"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- /*AntCopyUtils.copyFileToFolder(
- hibernateConsolePref,
- new File(ejb,".settings"), //$NON-NLS-1$
- new FilterSetCollection(projectFilterSet), true);*/
-
- FilterSet ejbFilterSet = new FilterSet();
- ejbFilterSet.addFilter("projectName", ejb.getName()); //$NON-NLS-1$
-
- AntCopyUtils.copyFileToFile(
- hibernateConsoleLaunchFile,
- new File(ejb, ejb.getName() + ".launch"), //$NON-NLS-1$
- new FilterSetCollection(ejbFilterSet), true);
-
- AntCopyUtils.copyFileToFolder(
- hibernateConsolePropsFile,
- ejb,
- hibernateDialectFilterSet, true);
-
- File earContentsFolder = new File(ear, "EarContent"); //$NON-NLS-1$
-
- FilterSet earFilterSet = new FilterSet();
- earFilterSet.addFilter("projectName", ear.getName() + ".ear"); //$NON-NLS-1$ //$NON-NLS-2$
-
- AntCopyUtils.copyFileToFolder(
- new File(seamGenResFolder, "META-INF/jboss-app.xml"), //$NON-NLS-1$
- new File(earContentsFolder, "META-INF"), //$NON-NLS-1$
- new FilterSetCollection(earFilterSet), true);
-
- // Copy configuration files from template
- AntCopyUtils.copyFilesAndFolders(
- new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "ear"), //$NON-NLS-1$
- ear, new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
- new FilterSetCollection(filterSet), true);
-
- // Fill ear contents
- AntCopyUtils.copyFiles(seamHomeFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamHomeFolder)));
- AntCopyUtils.copyFiles(seamLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(droolsLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(droolsLibFolder)));
- AntCopyUtils.copyFiles(seamLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(seamGenResFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamGenResFolder)));
-
- File resources = new File(ear, "resources");
- AntCopyUtils.copyFileToFile(
- dataSourceDsFile,
- new File(resources, project.getName() + "-ds.xml"), //$NON-NLS-1$ //$NON-NLS-2$
- viewFilterSetCollection, true);
-
- try {
- File[] earJars = earContentsFolder.listFiles(new FilenameFilter() {
- /* (non-Javadoc)
- * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
- */
- public boolean accept(File dir, String name) {
- return name.lastIndexOf(".jar") > 0; //$NON-NLS-1$
- }
- });
- String earJarsStr = ""; //$NON-NLS-1$
- for (File file : earJars) {
- earJarsStr += " " + file.getName() + " \n"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- FilterSetCollection manifestFilterCol = new FilterSetCollection(projectFilterSet);
- FilterSet manifestFilter = new FilterSet();
- manifestFilter.addFilter("earLibs", earJarsStr); //$NON-NLS-1$
- manifestFilterCol.addFilterSet(manifestFilter);
- AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "war/META-INF/MANIFEST.MF"), webMetaInf, manifestFilterCol, true); //$NON-NLS-1$
- File ejbMetaInf = new File(ejb, "ejbModule/META-INF"); //$NON-NLS-1$
- AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "ejb/ejbModule/META-INF/MANIFEST.MF"), ejbMetaInf, manifestFilterCol, true); //$NON-NLS-1$
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
}
ClasspathHelper.addClasspathEntries(project, fv);
+ // TODO
createSeamProjectPreferenes(project, model);
EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
- toggleHibernateOnProject(project, consoleName);
-
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- String wsPath = project.getLocation().removeLastSegments(1)
- .toFile().getAbsoluteFile().getPath();
-
- IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
-
- if (!isWarConfiguration(model)) {
- IProject ejbProjectToBeImported = wsRoot.getProject(project.getName() + "-ejb");
- ResourcesUtils.importExistingProject(ejbProjectToBeImported, wsPath + "/" + project.getName() + "-ejb", project.getName() + "-ejb", monitor, false);
- toggleHibernateOnProject(ejbProjectToBeImported, consoleName);
- IProjectFacet sf = ProjectFacetsManager.getProjectFacet("jst.ejb");
- IProjectFacetVersion pfv = ProjectFacetsManager.create(ejbProjectToBeImported).getInstalledVersion(sf);
- ClasspathHelper.addClasspathEntries(ejbProjectToBeImported, pfv);
-
- IProject earProjectToBeImported = wsRoot.getProject(project.getName() + "-ear");
- ResourcesUtils.importExistingProject(earProjectToBeImported, wsPath + "/" + project.getName() + "-ear", project.getName() + "-ear", monitor, false);
- }
}
/*
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2008-09-30 16:51:41 UTC (rev 10574)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2008-09-30 17:01:27 UTC (rev 10575)
@@ -10,13 +10,29 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.project.facet;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.FilterSetCollection;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.common.util.ResourcesUtils;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
@@ -24,18 +40,80 @@
* @author Alexey Kazakov
* This is basic class that helps New Seam Wizard Page to create EJB, EAR and test projects for seam WAR project.
*/
-abstract public class SeamProjectCreator {
+public class SeamProjectCreator {
protected static final String TEST_WAR_PROFILE = "test-war"; //$NON-NLS-1$
protected static final String TEST_EAR_PROFILE = "test"; //$NON-NLS-1$
+ protected static final String DEV_WAR_PROFILE = "dev-war"; //$NON-NLS-1$
+ protected static final String DEV_EAR_PROFILE = "dev"; //$NON-NLS-1$
+ protected static AntCopyUtils.FileSet JBOOS_EJB_WEB_INF_CLASSES_SET = new AntCopyUtils.FileSet()
+ .include("import\\.sql") //$NON-NLS-1$
+ .include("seam\\.properties")
+ .exclude(".*/WEB-INF"); //$NON-NLS-1$
+
+ private static AntCopyUtils.FileSet JBOSS_TEST_LIB_FILESET = new AntCopyUtils.FileSet()
+ .include("testng-.*-jdk15\\.jar") //$NON-NLS-1$
+ .include("myfaces-api-.*\\.jar") //$NON-NLS-1$
+ .include("myfaces-impl-.*\\.jar") //$NON-NLS-1$
+ .include("servlet-api\\.jar") //$NON-NLS-1$
+ .include("hibernate-all\\.jar") //$NON-NLS-1$
+ .include("jboss-ejb3-all\\.jar") //$NON-NLS-1$
+ .include("thirdparty-all\\.jar") //$NON-NLS-1$
+ .exclude(".*/CVS") //$NON-NLS-1$
+ .exclude(".*/\\.svn"); //$NON-NLS-1$
+
+ private static AntCopyUtils.FileSet JBOSS_EAR_CONTENT = new AntCopyUtils.FileSet()
+ .include("antlr.*\\.jar") //$NON-NLS-1$
+ .include("commons-jci-core.*\\.jar") //$NON-NLS-1$
+ .include("commons-jci-janino.*\\.jar") //$NON-NLS-1$
+ .include("drools-compiler.*\\.jar") //$NON-NLS-1$
+ .include("drools-core.*\\.jar") //$NON-NLS-1$
+ .include("janino.*\\.jar") //$NON-NLS-1$
+ .include("jboss-seam.jar") //$NON-NLS-1$
+ .include("jbpm.*\\.jar") //$NON-NLS-1$
+ .include("security\\.drl") //$NON-NLS-1$
+ .include("stringtemplate.*\\.jar") //$NON-NLS-1$
+ // el-ri needed for JBIDE-939
+ .include("el-ri.*\\.jar"); //$NON-NLS-1$
+
protected IDataModel model;
protected IProject seamWebProject;
protected SeamRuntime seamRuntime;
+ protected String seamHomePath;
+ protected File seamHomeFolder;
+ protected File seamLibFolder;
+ protected File seamGenHomeFolder;
+
protected String earProjectName;
protected String ejbProjectName;
protected String testProjectName;
+ protected File earProjectFolder;
+ protected File ejbProjectFolder;
+ protected File earContentsFolder;
+
+ protected FilterSet filtersFilterSet;
+ protected File seamGenResFolder;
+ protected File persistenceFile;
+ protected File hibernateConsoleLaunchFile;
+ protected File hibernateConsolePropsFile;
+
+ protected FilterSet jdbcFilterSet;
+ protected FilterSet projectFilterSet;
+ protected FilterSetCollection viewFilterSetCollection;
+ protected FilterSetCollection hibernateDialectFilterSet;
+ protected File dataSourceDsFile;
+
+ protected File ejbTemplateDir;
+ protected AntCopyUtils.FileSet excludeCvsSvn;
+ protected FilterSet ejbFilterSet;
+
+ protected File webMetaInf;
+ protected File ejbMetaInf;
+
+ protected File droolsLibFolder;
+
/**
* @param model Seam facet data model
* @param seamWebProject Seam web project
@@ -44,15 +122,67 @@
this.model = model;
this.seamWebProject = seamWebProject;
+ // Set default project names
+ earProjectName = seamWebProject.getName() + "-ear";
+ ejbProjectName = seamWebProject.getName() + "-ejb";
+ testProjectName = seamWebProject.getName() + "-test";
+
seamRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
if(seamRuntime==null) {
throw new RuntimeException("Can't get seam runtime " + model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
}
+ seamHomePath = seamRuntime.getHomeDir();
+ seamHomeFolder = new File(seamHomePath);
+ seamLibFolder = new File(seamHomePath, SeamFacetAbstractInstallDelegate.SEAM_LIB_RELATED_PATH);
+ seamGenHomeFolder = new File(seamHomePath, "seam-gen"); //$NON-NLS-1$
- // Set default project names
- earProjectName = seamWebProject.getName() + "-ear";
- ejbProjectName = seamWebProject.getName() + "-ejb";
- testProjectName = seamWebProject.getName() + "-test";
+ filtersFilterSet = SeamFacetFilterSetFactory.createFiltersFilterSet(model);
+ seamGenResFolder = new File(seamGenHomeFolder, "resources"); //$NON-NLS-1$
+ persistenceFile = new File(seamGenResFolder, "META-INF/persistence-" + (SeamFacetAbstractInstallDelegate.isWarConfiguration(model) ? DEV_WAR_PROFILE : DEV_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
+ hibernateConsoleLaunchFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.launch"); //$NON-NLS-1$
+ hibernateConsolePropsFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.properties"); //$NON-NLS-1$
+ dataSourceDsFile = new File(seamGenResFolder, "datasource-ds.xml"); //$NON-NLS-1$
+
+ IVirtualComponent component = ComponentCore.createComponent(seamWebProject);
+ IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
+ IContainer webRootFolder = webRootVirtFolder.getUnderlyingFolder();
+ File webContentFolder = webRootFolder.getLocation().toFile();
+ webMetaInf = new File(webContentFolder, "META-INF"); //$NON-NLS-1$
+ earProjectFolder = new File(seamWebProject.getLocation().removeLastSegments(1).toFile(), earProjectName);
+ earContentsFolder = new File(earProjectFolder, "EarContent"); //$NON-NLS-1$
+ ejbProjectFolder = new File(seamWebProject.getLocation().removeLastSegments(1).toFile(), ejbProjectName);
+ ejbMetaInf = new File(ejbProjectFolder, "ejbModule/META-INF"); //$NON-NLS-1$
+
+ jdbcFilterSet = SeamFacetFilterSetFactory.createJdbcFilterSet(model);
+ projectFilterSet = SeamFacetFilterSetFactory.createProjectFilterSet(model);
+
+ viewFilterSetCollection = new FilterSetCollection();
+ viewFilterSetCollection.addFilterSet(jdbcFilterSet);
+ viewFilterSetCollection.addFilterSet(projectFilterSet);
+
+ hibernateDialectFilterSet = new FilterSetCollection();
+ hibernateDialectFilterSet.addFilterSet(jdbcFilterSet);
+ hibernateDialectFilterSet.addFilterSet(projectFilterSet);
+ hibernateDialectFilterSet.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
+
+ try {
+ ejbTemplateDir = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "ejb");
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ excludeCvsSvn = new AntCopyUtils.FileSet(SeamFacetAbstractInstallDelegate.CVS_SVN).dir(ejbTemplateDir);
+
+ ejbFilterSet = new FilterSet();
+ ejbFilterSet.addFilter("projectName", seamWebProject.getName()); //$NON-NLS-1$
+ ejbFilterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(seamWebProject)); //$NON-NLS-1$
+ if (model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH) != null) {
+ File driver = new File(((String[]) model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH))[0]);
+ ejbFilterSet.addFilter("driverJar", " " + driver.getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } else {
+ ejbFilterSet.addFilter("driverJar", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ droolsLibFolder = new File(seamHomePath, SeamFacetInstallDelegate.DROOLS_LIB_SEAM_RELATED_PATH);
}
public IDataModel getModel() {
@@ -63,6 +193,14 @@
this.model = model;
}
+ protected AntCopyUtils.FileSet getJBossTestLibFileset() {
+ return JBOSS_TEST_LIB_FILESET;
+ }
+
+ protected AntCopyUtils.FileSet getJbossEarContent() {
+ return JBOSS_EAR_CONTENT;
+ }
+
/**
* Creates test project for seam web project in case of WAR deployment and test, EAR and EJB projects in case of EAR deployment.
* @param monitor
@@ -72,8 +210,54 @@
createTestProject();
final String consoleName = SeamFacetAbstractInstallDelegate.isWarConfiguration(model) ? seamWebProject.getName() : ejbProjectName;
+ if(!SeamFacetAbstractInstallDelegate.isWarConfiguration(model)) {
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT, ejbProjectName);
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT, testProjectName);
+ createEjbProject();
+ createEarProject();
+
+ try {
+ File[] earJars = earContentsFolder.listFiles(new FilenameFilter() {
+ /* (non-Javadoc)
+ * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
+ */
+ public boolean accept(File dir, String name) {
+ return name.lastIndexOf(".jar") > 0; //$NON-NLS-1$
+ }
+ });
+ String earJarsStr = ""; //$NON-NLS-1$
+ for (File file : earJars) {
+ earJarsStr += " " + file.getName() + " \n"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ FilterSetCollection manifestFilterCol = new FilterSetCollection(projectFilterSet);
+ FilterSet manifestFilter = new FilterSet();
+ manifestFilter.addFilter("earLibs", earJarsStr); //$NON-NLS-1$
+ manifestFilterCol.addFilterSet(manifestFilter);
+ AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "war/META-INF/MANIFEST.MF"), webMetaInf, manifestFilterCol, true); //$NON-NLS-1$
+ AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "ejb/ejbModule/META-INF/MANIFEST.MF"), ejbMetaInf, manifestFilterCol, true); //$NON-NLS-1$
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ SeamFacetAbstractInstallDelegate.toggleHibernateOnProject(seamWebProject, consoleName);
+
String wsPath = seamWebProject.getLocation().removeLastSegments(1).toFile().getAbsoluteFile().getPath();
IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+
+ if (!SeamFacetAbstractInstallDelegate.isWarConfiguration(model)) {
+ IProject ejbProjectToBeImported = wsRoot.getProject(ejbProjectName);
+ ResourcesUtils.importExistingProject(ejbProjectToBeImported, wsPath + "/" + ejbProjectName, ejbProjectName, monitor, false);
+ SeamFacetAbstractInstallDelegate.toggleHibernateOnProject(ejbProjectToBeImported, consoleName);
+ IProjectFacet sf = ProjectFacetsManager.getProjectFacet("jst.ejb");
+ IProjectFacetVersion pfv = ProjectFacetsManager.create(ejbProjectToBeImported).getInstalledVersion(sf);
+ ClasspathHelper.addClasspathEntries(ejbProjectToBeImported, pfv);
+
+ IProject earProjectToBeImported = wsRoot.getProject(earProjectName);
+ ResourcesUtils.importExistingProject(earProjectToBeImported, wsPath + "/" + earProjectName, earProjectName, monitor, false);
+ }
+
IProject testProjectToBeImported = wsRoot.getProject(testProjectName);
ResourcesUtils.importExistingProject(testProjectToBeImported, wsPath + "/" + testProjectName, testProjectName, monitor, true);
@@ -83,8 +267,66 @@
/**
* Creates test project for given seam web project.
*/
- abstract protected void createTestProject();
+ protected void createTestProject() {
+ File testProjectDir = new File(seamWebProject.getLocation().removeLastSegments(1).toFile(), testProjectName); //$NON-NLS-1$
+ testProjectDir.mkdir();
+ IVirtualComponent component = ComponentCore.createComponent(seamWebProject);
+ IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
+
+ File testLibDir = new File(testProjectDir, "lib"); //$NON-NLS-1$
+ File embededEjbDir = new File(testProjectDir, "embedded-ejb"); //$NON-NLS-1$
+ File testSrcDir = new File(testProjectDir, "test-src"); //$NON-NLS-1$
+ FilterSet filterSet = new FilterSet();
+ filterSet.addFilter("projectName", seamWebProject.getName()); //$NON-NLS-1$
+ filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(seamWebProject)); //$NON-NLS-1$
+ filterSet.addFilter("webRootFolder", webRootVirtFolder.getUnderlyingFolder().getFullPath().removeFirstSegments(1).toString()); //$NON-NLS-1$
+
+ AntCopyUtils.FileSet includeLibs = new AntCopyUtils.FileSet(getJBossTestLibFileset()).dir(new File(seamRuntime.getHomeDir(), "lib")); //$NON-NLS-1$
+ File[] libs = includeLibs.getDir().listFiles(new AntCopyUtils.FileSetFileFilter(includeLibs));
+ StringBuffer testLibraries = new StringBuffer();
+
+ for (File file : libs) {
+ testLibraries.append("\t<classpathentry kind=\"lib\" path=\"lib/" + file.getName() + "\"/>\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ StringBuffer requiredProjects = new StringBuffer();
+ requiredProjects.append("\t<classpathentry combineaccessrules=\"false\" kind=\"src\" path=\"/" + seamWebProject.getName() + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!SeamFacetAbstractInstallDelegate.isWarConfiguration(model)) {
+ requiredProjects.append("\n\t<classpathentry combineaccessrules=\"false\" kind=\"src\" path=\"/" + ejbProjectName + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ filterSet.addFilter("testLibraries", testLibraries.toString()); //$NON-NLS-1$
+ filterSet.addFilter("requiredProjects", requiredProjects.toString()); //$NON-NLS-1$
+ File testTemplateDir = null;
+ try {
+ testTemplateDir = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "test"); //$NON-NLS-1$
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ return;
+ }
+ AntCopyUtils.FileSet excludeCvsSvn
+ = new AntCopyUtils.FileSet(SeamFacetAbstractInstallDelegate.CVS_SVN).dir(testTemplateDir);
+
+ AntCopyUtils.copyFilesAndFolders(
+ testTemplateDir,
+ testProjectDir,
+ new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
+ new FilterSetCollection(filterSet), true);
+
+ excludeCvsSvn.dir(new File(seamRuntime.getHomeDir(), "embedded-ejb/conf")); //$NON-NLS-1$
+ AntCopyUtils.copyFiles(
+ new File(seamRuntime.getHomeDir(), "embedded-ejb/conf"), //$NON-NLS-1$
+ embededEjbDir,
+ new AntCopyUtils.FileSetFileFilter(excludeCvsSvn));
+
+ AntCopyUtils.copyFiles(
+ new File(seamRuntime.getHomeDir(), "lib"), //$NON-NLS-1$
+ testLibDir,
+ new AntCopyUtils.FileSetFileFilter(includeLibs));
+
+ SeamFacetAbstractInstallDelegate.createComponentsProperties(testSrcDir, "", Boolean.TRUE); //$NON-NLS-1$
+ }
+
/**
* Creates test project for given seam web project.
* @param testProjectName
@@ -96,4 +338,103 @@
this.testProjectName = testProjectName;
createTestProject();
}
+
+ /**
+ * Creates EJB project for given seam web project.
+ * @param ejbProjectName
+ */
+ protected void createEjbProject(String ejbProjectName) {
+ if(ejbProjectName==null) {
+ throw new IllegalArgumentException("EJB project name must not be null");
+ }
+ this.ejbProjectName = ejbProjectName;
+ createEjbProject();
+ }
+
+ protected void createEjbProject() {
+ ejbProjectFolder.mkdir();
+
+ AntCopyUtils.copyFilesAndFolders(
+ ejbTemplateDir,
+ ejbProjectFolder, new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
+ new FilterSetCollection(ejbFilterSet), true);
+
+ // *******************************************************************************************
+ // Copy sources to EJB project in case of EAR configuration
+ // *******************************************************************************************
+ AntCopyUtils.copyFileToFile(
+ new File(seamGenHomeFolder, "src/Authenticator.java"), //$NON-NLS-1$
+ new File(ejbProjectFolder, "ejbModule/" + model.getProperty(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME).toString().replace('.', '/') + "/" + "Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FilterSetCollection(filtersFilterSet), true);
+ AntCopyUtils.copyFileToFile(
+ persistenceFile,
+ new File(ejbProjectFolder, "ejbModule/META-INF/persistence.xml"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ SeamFacetAbstractInstallDelegate.createComponentsProperties(new File(ejbProjectFolder, "ejbModule"), earProjectName, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ AntCopyUtils.FileSet ejbSrcResourcesSet = new AntCopyUtils.FileSet(JBOOS_EJB_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder, new File(ejbProjectFolder, "ejbModule"), new AntCopyUtils.FileSetFileFilter(ejbSrcResourcesSet), viewFilterSetCollection, true); //$NON-NLS-1$
+
+ AntCopyUtils.copyFileToFolder(
+ new File(seamGenResFolder, "META-INF/ejb-jar.xml"), //$NON-NLS-1$
+ new File(ejbProjectFolder, "ejbModule/META-INF/"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ /*AntCopyUtils.copyFileToFolder(
+ hibernateConsolePref,
+ new File(ejbProjectFolder,".settings"), //$NON-NLS-1$
+ new FilterSetCollection(projectFilterSet), true);*/
+
+ FilterSet ejbFilterSet = new FilterSet();
+ ejbFilterSet.addFilter("projectName", ejbProjectFolder.getName()); //$NON-NLS-1$
+
+ AntCopyUtils.copyFileToFile(
+ hibernateConsoleLaunchFile,
+ new File(ejbProjectFolder, ejbProjectFolder.getName() + ".launch"), //$NON-NLS-1$
+ new FilterSetCollection(ejbFilterSet), true);
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePropsFile,
+ ejbProjectFolder,
+ hibernateDialectFilterSet, true);
+ }
+
+ protected void createEarProject() {
+ earProjectFolder.mkdir();
+
+ File earContentsFolder = new File(earProjectFolder, "EarContent"); //$NON-NLS-1$
+
+ FilterSet earFilterSet = new FilterSet();
+ earFilterSet.addFilter("projectName", earProjectFolder.getName() + ".ear"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ AntCopyUtils.copyFileToFolder(
+ new File(seamGenResFolder, "META-INF/jboss-app.xml"), //$NON-NLS-1$
+ new File(earContentsFolder, "META-INF"), //$NON-NLS-1$
+ new FilterSetCollection(earFilterSet), true);
+
+ // Copy configuration files from template
+ try {
+ AntCopyUtils.copyFilesAndFolders(
+ new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "ear"), //$NON-NLS-1$
+ earProjectFolder, new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
+ new FilterSetCollection(ejbFilterSet), true);
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+
+ // Fill ear contents
+ AntCopyUtils.copyFiles(seamHomeFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(getJbossEarContent()).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(getJbossEarContent()).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(getJbossEarContent()).dir(droolsLibFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(getJbossEarContent()).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(seamGenResFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(getJbossEarContent()).dir(seamGenResFolder)));
+
+ File resources = new File(earProjectFolder, "resources");
+ AntCopyUtils.copyFileToFile(
+ dataSourceDsFile,
+ new File(resources, seamWebProject.getName() + "-ds.xml"), //$NON-NLS-1$ //$NON-NLS-2$
+ viewFilterSetCollection, true);
+ }
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2008-09-30 16:51:41 UTC (rev 10574)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2008-09-30 17:01:27 UTC (rev 10575)
@@ -53,7 +53,6 @@
import org.jboss.tools.seam.core.project.facet.SeamProjectPreferences;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
-import org.jboss.tools.seam.internal.core.project.facet.Seam1ProjectCreator;
import org.jboss.tools.seam.internal.core.project.facet.Seam2ProjectCreator;
import org.jboss.tools.seam.internal.core.project.facet.SeamFacetProjectCreationDataModelProvider;
import org.jboss.tools.seam.internal.core.project.facet.SeamProjectCreator;
@@ -210,7 +209,7 @@
SeamVersion seamVersion = SeamVersion.parseFromString(seamVersionString);
SeamProjectCreator creator = null;
if(seamVersion == SeamVersion.SEAM_1_2) {
- creator = new Seam1ProjectCreator(model, project);
+ creator = new SeamProjectCreator(model, project);
} else if(seamVersion == SeamVersion.SEAM_2_0) {
creator = new Seam2ProjectCreator(model, project);
} else {
16 years, 2 months
JBoss Tools SVN: r10574 - trunk/documentation/guides/GettingStartedGuide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-09-30 12:51:41 -0400 (Tue, 30 Sep 2008)
New Revision: 10574
Modified:
trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml
trunk/documentation/guides/GettingStartedGuide/en/modules/gsg_faq.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-359
FAQ from the first section is moved to the FAQ chapter
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml 2008-09-30 16:44:20 UTC (rev 10573)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml 2008-09-30 16:51:41 UTC (rev 10574)
@@ -550,151 +550,7 @@
</orderedlist>
</section>
- <section id="FAQ">
- <?dbhtml filename="FAQ.html"?>
- <title>FAQ</title>
- <para>For easy reference to JBoss Developer Studio related questions, our FAQ provides answers to
- the most "popular" questions. The sections of questions are organized by type. </para>
- <!-- <section id="Before_Installing">
- <title>Before Installing, Tutorials, Examples, Readme Files</title>
- <para><emphasis role="bold">I'm looking for examples, do you have any?</emphasis></para>
- <para>Yes, simply go to our <ulink url="http://exadel.com/web/portal/products/Tutorials">tutorials page</ulink></para>
- <para><emphasis role="bold">Where can I find the JBoss Developer Studio readme file?</emphasis></para>
- <para>It's located at this page: <ulink url="http://www.exadel.com/web/portal/products/ReleaseNotes">Release Notes</ulink></para>
- <para><emphasis role="bold">Where can I find some documentation for JBoss Developer Studio?</emphasis></para>
- <para>Try these resources: <ulink url="http://www.exadel.com/exadelstudio/help/">User Guide</ulink></para>
- <para><emphasis role="bold">What version of Eclipse does JBoss Developer Studio support?</emphasis></para>
- <para>JBoss Developer Studio works with Eclipse 3.3</para>
- </section> -->
- <!--<section id="Downloading">
- <title>Downloading</title>
- <para><emphasis role="bold">Where can I download a copy of JBoss Developer Studio?</emphasis></para>
- <para>Go to <ulink url="http://www.redhat.com/developers/jbds/index.html">Download Page</ulink></para>
- </section>-->
- <section id="Installation_Issues">
- <title>Installation Issues</title>
- <para>
- <emphasis role="bold">Visual Editor does not start under Linux</emphasis>
- </para>
- <para>Linux users may need to do the following to get the visual editor to work correctly on
- their machines.</para>
-
- <orderedlist>
- <listitem>
- <para>On Red Hat based Linux distributions install the xpLib.i386 package</para>
- </listitem>
- <listitem>
- <para>Type</para>
- <programlisting role="JAVA"><![CDATA[ln -s libstdc++.so.5.0.7 libstdc++.so.5
-]]></programlisting>
- </listitem>
- <listitem>
- <para>and/or use</para>
- <programlisting role="JAVA"><![CDATA[yum install libXp
-]]></programlisting>
- </listitem>
- <listitem>
- <para>Open the JBDS perspective. If you see the Help view open, close it and restart
- JBDS</para>
- </listitem>
- <listitem>
- <para>If none of these work, do the following:</para>
- <itemizedlist>
- <listitem>
- <para>Clear the Eclipse log file,
- <emphasis><workspace>\.metadata\.log</emphasis></para>
- </listitem>
- <listitem>
- <para>Start Eclipse with the -debug option:</para>
- <programlisting role="JAVA"><![CDATA[eclipse -debug
-]]></programlisting>
- </listitem>
- <listitem>
- <para>Post the Eclipse log file
- (<emphasis><workspace>\.metadata\.log</emphasis>) on the forums.</para>
- </listitem>
- </itemizedlist>
- </listitem>
- </orderedlist>
-
-
- <para>
- <emphasis role="bold">Do I need to have JBoss server installed to run JBoss Developer
- Studio?</emphasis>
- </para>
- <para>No. JBoss Developer Studio already comes bundled with JBoss server. We bundle it together
- so that you don't need to download any additional software and can test your
- application in a Web browser right away.</para>
- <para>If you want to use a different JBoss server installation, after JBoss Developer Studio is
- installed open Servers View (select <emphasis><property>Window > Show View >
- Others > Server > Servers</property>),</emphasis> then right click on this <emphasis>
- <property>view > New > Server</property>
- </emphasis> and follow the wizards steps to point to another Jboss server installation.</para>
- <para>JBoss Developer Studio works with any servlet container, not just JBoss. For more
- information on deployment, please see the Deploying Your Application section.</para>
- </section>
- <section id="Importing_Projects">
- <title>Importing Projects</title>
- <para>
- <emphasis role="bold">I have an existing Seam 1.2.1 project. Can I migrate/import the project to
- a JBDS Seam project?</emphasis>
- </para>
- <para>We highly recommend you to create Seam 1.2.1 project using the JBDS. In other case try to
- do manually:</para>
- <itemizedlist>
- <listitem>
- <para>Create a Seam Web project to get the JBoss tools structure</para>
- </listitem>
- </itemizedlist>
- <para>Then from your Seam 1.2.1 seam-gen project start doing the following:</para>
- <itemizedlist>
- <listitem>
- <para>Copy <property>src</property> to <property>src</property></para>
- </listitem>
- <listitem>
- <para>Copy <property>view</property> to <property>Web content</property></para>
- </listitem>
- <listitem>
- <para>Copy resources individual files to where they are in the seam web project etc.</para>
- </listitem>
- </itemizedlist>
- <para>
- <emphasis role="bold">I have an existing Struts or JSF project. Can I open the project in
- JBDS?</emphasis>
- </para>
- <para>Yes. From main menu select <emphasis>
- <property>File > Import > Other > JSF Project (or Struts
- Project)</property>
- </emphasis> and follow wizards steps.</para>
- <para>
- <emphasis role="bold">Can I import a .war file?</emphasis>
- </para>
- <para>Yes. Select <emphasis><property>File > Import > Web > WAR
- file</property>, </emphasis> then follow importing steps.</para>
- </section>
- <section id="Troubleshooting">
- <title>Troubleshooting, Problems, Configuration, Error Messages</title>
- <para>
- <emphasis role="bold">Is it possible to increase the performance of Eclipse after installing
- your product?</emphasis>
- </para>
- <para>JBoss Developer Studio preconfigures eclipse via the eclipse.ini file to allocate extra
- memory, but if you for some reason need more memory then by default, you can manually make
- adjustments in this file. For example:</para>
- <programlisting role="XML">
- <![CDATA[-vmargs -Xms128m -Xmx512m -XX:MaxPermSize=128m
-]]></programlisting>
-
-
- <para>
- <emphasis role="bold">How can I add my own tag library to the JBoss Tools Palette?</emphasis>
- </para>
- <para>See <ulink url="&jsflink;#AddingCustomJSFTagsToTheRedHatPalette7433">Adding Tag
- Libraries</ulink> in Visual Web Tools Guide.</para>
-
- </section>
- </section>
-
+
<section id="OtherRelevantResourcesOnTheTopic33">
<?dbhtml filename="OtherRelevantResourcesOnTheTopic33.html"?>
<title>Other relevant resources on the topic</title>
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/gsg_faq.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/gsg_faq.xml 2008-09-30 16:44:20 UTC (rev 10573)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/gsg_faq.xml 2008-09-30 16:51:41 UTC (rev 10574)
@@ -13,8 +13,132 @@
<title>FAQ</title>
<para>For more information on <property>JBoss Developer Studio</property> features, refer to the following
- FAQ to get the answers on the most "popular" questions.</para>
+ FAQ to get the answers on the most "popular" questions.</para>
+ <section id="Installation_Issues">
+ <title>Installation Issues</title>
+ <para>
+ <emphasis role="bold">Visual Editor does not start under Linux</emphasis>
+ </para>
+ <para>Linux users may need to do the following to get the visual editor to work correctly on
+ their machines.</para>
+
+ <orderedlist>
+ <listitem>
+ <para>On Red Hat based Linux distributions install the xpLib.i386 package</para>
+ </listitem>
+ <listitem>
+ <para>Type</para>
+ <programlisting role="JAVA"><![CDATA[ln -s libstdc++.so.5.0.7 libstdc++.so.5
+]]></programlisting>
+ </listitem>
+ <listitem>
+ <para>and/or use</para>
+ <programlisting role="JAVA"><![CDATA[yum install libXp
+]]></programlisting>
+ </listitem>
+ <listitem>
+ <para>Open the JBDS perspective. If you see the Help view open, close it and restart
+ JBDS</para>
+ </listitem>
+ <listitem>
+ <para>If none of these work, do the following:</para>
+ <itemizedlist>
+ <listitem>
+ <para>Clear the Eclipse log file,
+ <emphasis><workspace>\.metadata\.log</emphasis></para>
+ </listitem>
+ <listitem>
+ <para>Start Eclipse with the -debug option:</para>
+ <programlisting role="JAVA"><![CDATA[eclipse -debug
+]]></programlisting>
+ </listitem>
+ <listitem>
+ <para>Post the Eclipse log file
+ (<emphasis><workspace>\.metadata\.log</emphasis>) on the forums.</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </orderedlist>
+
+
+ <para>
+ <emphasis role="bold">Do I need to have JBoss server installed to run JBoss Developer
+ Studio?</emphasis>
+ </para>
+ <para>No. JBoss Developer Studio already comes bundled with JBoss server. We bundle it together
+ so that you don't need to download any additional software and can test your
+ application in a Web browser right away.</para>
+ <para>If you want to use a different JBoss server installation, after JBoss Developer Studio is
+ installed open Servers View (select <emphasis><property>Window > Show View >
+ Others > Server > Servers</property>),</emphasis> then right click on this <emphasis>
+ <property>view > New > Server</property>
+ </emphasis> and follow the wizards steps to point to another Jboss server installation.</para>
+ <para>JBoss Developer Studio works with any servlet container, not just JBoss. For more
+ information on deployment, please see the Deploying Your Application section.</para>
+ </section>
+ <section id="Importing_Projects">
+ <title>Importing Projects</title>
+ <para>
+ <emphasis role="bold">I have an existing Seam 1.2.1 project. Can I migrate/import the project to
+ a JBDS Seam project?</emphasis>
+ </para>
+ <para>We highly recommend you to create Seam 1.2.1 project using the JBDS. In other case try to
+ do manually:</para>
+ <itemizedlist>
+ <listitem>
+ <para>Create a Seam Web project to get the JBoss tools structure</para>
+ </listitem>
+ </itemizedlist>
+ <para>Then from your Seam 1.2.1 seam-gen project start doing the following:</para>
+ <itemizedlist>
+ <listitem>
+ <para>Copy <property>src</property> to <property>src</property></para>
+ </listitem>
+ <listitem>
+ <para>Copy <property>view</property> to <property>Web content</property></para>
+ </listitem>
+ <listitem>
+ <para>Copy resources individual files to where they are in the seam web project etc.</para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ <emphasis role="bold">I have an existing Struts or JSF project. Can I open the project in
+ JBDS?</emphasis>
+ </para>
+ <para>Yes. From main menu select <emphasis>
+ <property>File > Import > Other > JSF Project (or Struts
+ Project)</property>
+ </emphasis> and follow wizards steps.</para>
+ <para>
+ <emphasis role="bold">Can I import a .war file?</emphasis>
+ </para>
+ <para>Yes. Select <emphasis><property>File > Import > Web > WAR
+ file</property>, </emphasis> then follow importing steps.</para>
+ </section>
+ <section id="Troubleshooting">
+ <title>Troubleshooting, Problems, Configuration, Error Messages</title>
+ <para>
+ <emphasis role="bold">Is it possible to increase the performance of Eclipse after installing
+ your product?</emphasis>
+ </para>
+ <para>JBoss Developer Studio preconfigures eclipse via the eclipse.ini file to allocate extra
+ memory, but if you for some reason need more memory then by default, you can manually make
+ adjustments in this file. For example:</para>
+ <programlisting role="XML">
+ <![CDATA[-vmargs -Xms128m -Xmx512m -XX:MaxPermSize=128m
+]]></programlisting>
+
+
+ <para>
+ <emphasis role="bold">How can I add my own tag library to the JBoss Tools Palette?</emphasis>
+ </para>
+ <para>See <ulink url="&jsflink;#AddingCustomJSFTagsToTheRedHatPalette7433">Adding Tag
+ Libraries</ulink> in Visual Web Tools Guide.</para>
+
+ </section>
+
+
<section id="question1">
<title>How to get Code Assist for Seam specific resources in an externally
generated project?</title>
16 years, 2 months
JBoss Tools SVN: r10573 - trunk/birt/docs/en/modules.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2008-09-30 12:44:20 -0400 (Tue, 30 Sep 2008)
New Revision: 10573
Modified:
trunk/birt/docs/en/modules/birt_support.xml
Log:
New report creation added
Modified: trunk/birt/docs/en/modules/birt_support.xml
===================================================================
--- trunk/birt/docs/en/modules/birt_support.xml 2008-09-30 16:36:33 UTC (rev 10572)
+++ trunk/birt/docs/en/modules/birt_support.xml 2008-09-30 16:44:20 UTC (rev 10573)
@@ -55,36 +55,88 @@
<para>We will show you how to use the Creation wizard for creating a new BIRT report.</para>
- <para>First create a Report project. Select <emphasis><property>File >New > Project...</property>
- </emphasis> in the main menu bar or context menu. The new project dialog appears. Choose <emphasis><property>Business Intelligence and Reporting Tools > Report Project</property></emphasis>. Click on the Next button.</para>
-
- <figure>
- <title>New Dialog</title>
+ <para>First create a Report project. Select <emphasis><property>File > New > Project...</property>
+ </emphasis> in the main menu bar or context menu. The new project dialog appears. Choose <emphasis><property>Business Intelligence and Reporting Tools > Report Project</property></emphasis>:
+
+ <figure>
+ <title>New Report Project Creation</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/esb_support/01_create_esb.png"/>
+ <imagedata fileref="images/BirtSupport/01ReportProjectWizard.png"/>
</imageobject>
</mediaobject>
- </figure>
+ </figure>
+
+ Click on the <emphasis><property>Next</property></emphasis> button. Specify a name for the project and change location if necessary:</para>
- <para> Clicking <emphasis><property>Next</property></emphasis> brings us to the wizard page where it's necessary to specify the
- folder, name and version for the file. We choose, for example, <emphasis><property>jboss-esb.xml</property>
- </emphasis> as the name and accept the selected projects folder and default version.</para>
- <figure>
- <title>Folder, Name and Version</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/esb_support/02_create_esb.png"/>
- </imageobject>
- </mediaobject>
- </figure>
+ <figure>
+ <title>Specify a Name for the Report Project</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/BirtSupport/02ProjectName.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
- <para>Thus, our file will be created in the selected projects folder by default. If you want to change the folder
- for your future file click <emphasis><property>Browse...</property></emphasis> button to set needed folder or simply type it.</para>
-
- <para>Clicking on <emphasis><property>Finish</property>
- </emphasis> results in the file being generated. The wizard creates one xml file.</para>
+ <para>Click on the <emphasis><property>Finish</property></emphasis> button. Click <emphasis><property>Ok</property></emphasis> to switch to the Report Design perspective. Your Report Project is now created:</para>
+
+
+ <figure>
+ <title>New Report Project Created</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/BirtSupport/03NewProjectCreated.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Now you can create a Report. Go to <emphasis><property>File > New > Report...</property></emphasis>:</para>
+
+ <figure>
+ <title>Create a New Report</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/BirtSupport/04NewReport.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>The new report dialog appears. Select the created project as a parent folder in the tree view:</para>
+ <figure>
+ <title>Select a Parent Folder</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/BirtSupport/05SelectingParentFolder.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Click on the <emphasis><property>Next</property></emphasis> button. Then select the type of the template to use for your report. Each template is shown in the Preview window and is described below. Tick off the "Show Report Creation Cheat Sheet" checkbox if you don't need the Cheat Sheets view to be displayed. The Cheat Sheets view can walk you though the process of creating a report based on the template you selected.
+
+ <figure>
+ <title>Choose a Report Template</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/BirtSupport/06ReportTemplate.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+
+ Click on the <emphasis><property>Finish</property></emphasis> button to open the newly created report in the workspace:</para>
+
+ <figure>
+ <title>Report Opened in the Workspace</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/BirtSupport/07SimpleListingReport.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+
+
</section>
</chapter>
16 years, 2 months
JBoss Tools SVN: r10572 - trunk/documentation/guides/GettingStartedGuide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-09-30 12:36:33 -0400 (Tue, 30 Sep 2008)
New Revision: 10572
Modified:
trunk/documentation/guides/GettingStartedGuide/en/modules/further_reading.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-359
list of guides for further reading is marked with bullets
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/further_reading.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/further_reading.xml 2008-09-30 16:25:48 UTC (rev 10571)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/further_reading.xml 2008-09-30 16:36:33 UTC (rev 10572)
@@ -24,28 +24,35 @@
find out, how to create and register a custom converter, custom validator and referenced beans
in a JSF project. </para>
+<itemizedlist>
+ <listitem>
<para>
<emphasis role="bold">JSF Tools Tutorial</emphasis>
<ulink url="&jsftutoriallink;">(html)</ulink>
</para>
<para> This tutorial will describe how to deal with classic/old style of JSF development and how
to create a simple JSF application using the JBoss Developer Studio. </para>
-
- <para>
+ </listitem>
+
+ <listitem> <para>
<emphasis role="bold">Struts Tools Reference Guide</emphasis>
<ulink url="&strutsreflink;">(html)</ulink>
</para>
<para> In Struts Tools Reference Guide you will learn how to create and work with a new struts
project. This guide also provides information about graphical editor for struts configuration
files, tiles files, and struts validation files. </para>
+ </listitem>
+<listitem>
<para>
<emphasis role="bold">Struts Tools Tutorial</emphasis>
<ulink url="&strutstutoriallink;">(html)</ulink>
</para>
<para> This tutorial will describe the classical style of Struts development, and will
- step-by-step show you how to create a simple Struts application in JBoss Developer Studio.</para>
+ step-by-step show you how to create a simple Struts application in JBoss Developer Studio.</para>
+</listitem>
+<listitem>
<para>
<emphasis role="bold">Seam Dev Tools Reference Guide</emphasis>
<ulink url="&seamlink;">(html)</ulink>
@@ -54,12 +61,16 @@
Eclipse. It tells you the necessary steps to start working with Seam Framework and assists in a
simple Seam Project creation. Also you will learn how to create and run the CRUD Database
Application with Seam as well as find out what Seam Editors Features and Seam Components are. </para>
-
+ </listitem>
+
+ <listitem>
<para>
<emphasis role="bold">Visual Web Tools Reference Guide</emphasis>
<ulink url="&jsflink;">(html)</ulink>
</para>
-
+ </listitem>
+
+ <listitem>
<para>
<emphasis role="bold">JBoss Server Manager Reference Guide</emphasis>
<ulink url="&aslink;">(html)</ulink>
@@ -68,7 +79,9 @@
install runtimes and servers and quickly learn how to configure, start, stop the server and know
how deployment and archiving process. You will find out how to manage installed JBoss Servers
via JBoss AS Perspective. You will also read how to deploy modules onto the server. </para>
-
+ </listitem>
+
+ <listitem>
<para>
<emphasis role="bold">jBPM Tools Reference Guide</emphasis>
<ulink url="&jbpmlink;">(html)</ulink>
@@ -77,7 +90,9 @@
learning and know how you can speed your development using special editors and visual designers.
We'll also guide you through the steps on how to create a simple process and test it
within jBPM jPDL perspective.</para>
-
+ </listitem>
+
+ <listitem>
<para>
<emphasis role="bold">Hibernate Tools Reference Guide</emphasis>
<ulink url="&hibernatelink;">(html)</ulink>
@@ -87,32 +102,42 @@
configuration file as well as a file for controlling reverse engineering by using specific
wizards that Hibernate tooling provides. Also you will know about Code Generation and
peculiarities of work within Hibernate Console Perspective.</para>
+ </listitem>
- <para>
+ <listitem>
+ <para>
<emphasis role="bold">ESB Editor Reference Guide</emphasis>
<ulink url="&esblink;">(html)</ulink>
</para>
<para>This guide provides you with the information on ESB Editor which allows you to develop ESB
- file.</para>
-
+ file.</para>
+ </listitem>
+
+ <listitem>
<para>
<emphasis role="bold">JBoss Portal Tools Reference Guide</emphasis>
<ulink url="&jbossportallink;">(html)</ulink>
</para>
<para>The guide gives a detail look at how you can easily build a Portlet Web Application with
JBoss Tools and deploy it onto JBoss Portal.</para>
-
- <para>
+ </listitem>
+
+ <listitem>
+ <para>
<emphasis role="bold">JBoss WS User Guide</emphasis>
<ulink url="&wslink;">(html)</ulink>
</para>
<para>This guide gives you practical help on JBossWS usage.</para>
-
+ </listitem>
+
+ <listitem>
<para>
<emphasis role="bold">Exadel Studio Migration Guide</emphasis>
<ulink url="&migrationlink;">(html)</ulink>
</para>
<para>This document is intended to help you to migrate an existing Exadel JSF or Struts projects
from Exadel Studio into JBoss Developer Studio. </para>
-
+ </listitem>
+
+</itemizedlist>
</chapter>
16 years, 2 months
JBoss Tools SVN: r10570 - in trunk/documentation/guides/GettingStartedGuide/en: modules and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-09-30 11:59:35 -0400 (Tue, 30 Sep 2008)
New Revision: 10570
Modified:
trunk/documentation/guides/GettingStartedGuide/en/master.xml
trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
trunk/documentation/guides/GettingStartedGuide/en/modules/further_reading.xml
trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-418
links are fixed
Modified: trunk/documentation/guides/GettingStartedGuide/en/master.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/master.xml 2008-09-30 15:49:06 UTC (rev 10569)
+++ trunk/documentation/guides/GettingStartedGuide/en/master.xml 2008-09-30 15:59:35 UTC (rev 10570)
@@ -24,6 +24,7 @@
<!ENTITY strutstutoriallink "../../struts_tools_tutorial/html_single/index.html">
<!ENTITY jbossportallink "../../jboss_portal_tools_ref_guide/html_single/index.html">
<!ENTITY migrationlink "../../Exadel-migration/html_single/index.html">
+<!ENTITY wslink "../../ws_ref_guide/html_single/index.html">
]>
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2008-09-30 15:49:06 UTC (rev 10569)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2008-09-30 15:59:35 UTC (rev 10570)
@@ -23,7 +23,7 @@
<section id="start_dev_db">
<title>Start Development Database</title>
- <para>Before opening the JBoss Developer studio you need to <ulink url="../../../database.zip"
+ <para>Before opening the JBoss Developer studio you need to <ulink url="http://anonsvn.jboss.org/repos/jbosstools/trunk/documentation/guides/Gett..."
>download</ulink> and start a Workshop Database.</para>
<para>To start the database just run <property>./runDBServer.sh</property> or
<property>runDBServer.bat</property> from the database directory.</para>
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/further_reading.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/further_reading.xml 2008-09-30 15:49:06 UTC (rev 10569)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/further_reading.xml 2008-09-30 15:59:35 UTC (rev 10570)
@@ -100,7 +100,13 @@
<ulink url="&jbossportallink;">(html)</ulink>
</para>
<para>The guide gives a detail look at how you can easily build a Portlet Web Application with
- JBoss Tools and deploy it onto JBoss Portal.</para>
+ JBoss Tools and deploy it onto JBoss Portal.</para>
+
+ <para>
+ <emphasis role="bold">JBoss WS User Guide</emphasis>
+ <ulink url="&wslink;">(html)</ulink>
+ </para>
+ <para>This guide gives you practical help on JBossWS usage.</para>
<para>
<emphasis role="bold">Exadel Studio Migration Guide</emphasis>
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml 2008-09-30 15:49:06 UTC (rev 10569)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/getting_started.xml 2008-09-30 15:59:35 UTC (rev 10570)
@@ -193,11 +193,11 @@
<itemizedlist>
<listitem>
- <para>Download the appropriate installation file for your platform from <ulink
- url="http://www.jboss.com/products/devstudio">Red Hat website</ulink>.</para>
+ <para>First of all you need the appropriate installation file for your platform from <ulink
+ url="https://www.redhat.com/apps/store/developers/jboss_developer_studio.html">Red Hat website</ulink>.</para>
</listitem>
<listitem>
- <para>Run in console:</para>
+ <para>Then run in console:</para>
<programlisting role="JAVA"><![CDATA[java -jar jbdevstudio-linux-gtk-1.1.0.GA.jar
]]></programlisting>
</listitem>
16 years, 2 months