JBoss Tools SVN: r10722 - in trunk: common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor and 11 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-10-08 02:45:58 -0400 (Wed, 08 Oct 2008)
New Revision: 10722
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapper.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/AbstractBaseHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/BaseHyperlinkDetector.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/CSSTextScanner.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
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/common/Constants.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/events/TabPropertySheetMouseAdapter.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/parsers/ColorParser.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBeanNameHyperlink.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2858
JUnit tests have been added
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2008-10-08 05:39:34 UTC (rev 10721)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -770,34 +770,7 @@
* @location Absolute path on disk
*/
public static IFile getFile(String location) {
- location = new java.io.File(location).getAbsolutePath().replace('\\', '/');
- IProject[] projects = ModelPlugin.getWorkspace().getRoot().getProjects();
- for (int i = 0; projects != null && i < projects.length; i++) {
- if (!projects[i].isOpen()) continue;
- String l = projects[i].getLocation().toFile().getAbsolutePath().replace('\\', '/');
- if (!l.endsWith("/")) l += "/";
- if (location.startsWith(l)) {
- String relative = location.substring(l.length());
- return projects[i].getFile(relative);
- }
- IResource[] ms = null;
- try {
- ms = projects[i].members(true);
- } catch (CoreException e) {
- //ignore - we do not care if project can give its members here.
- }
- if(ms != null) for (int j = 0; j < ms.length; j++) {
- if(!ms[j].isLinked() || !(ms[j] instanceof IContainer)) continue;
- IContainer c = (IContainer)ms[j];
- l = c.getLocation().toFile().getAbsolutePath().replace('\\', '/');
- if (!l.endsWith("/")) l += "/";
- if (location.startsWith(l)) {
- String relative = location.substring(l.length());
- return c.getFile(new Path(relative));
- }
- }
- }
- return null;
+ return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(location).makeAbsolute());
}
public static IResource getFolder(String location) {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapper.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapper.java 2008-10-08 05:39:34 UTC (rev 10721)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapper.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -48,6 +48,9 @@
import org.jboss.tools.common.text.ext.IEditorWrapper;
public class EditorPartWrapper extends EditorPart implements IReusableEditor, IEditorWrapper {
+
+ public static final String EDITOR_ID = "org.jboss.tools.common.model.ui.editor.EditorPartWrapper";
+
IEditorPart editor;
String entity = null;
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java 2008-10-08 05:39:34 UTC (rev 10721)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -104,33 +104,6 @@
}
}
- //is never used
- IFile getFileToOpen(String fileName, String fileExt) {
- IFile documentFile = getFile();
-
- try {
- IProject project = documentFile.getProject();
-
- String name = fileName.replace('.','/')+ (fileExt != null ? "." + fileExt : "");
-
- if(project == null || !project.isOpen()) return null;
- if(!project.hasNature(JavaCore.NATURE_ID)) return null;
- IJavaProject javaProject = JavaCore.create(project);
- IClasspathEntry[] es = javaProject.getResolvedClasspath(true);
-
- for (int i = 0; i < es.length; i++) {
- if(es[i].getEntryKind() != IClasspathEntry.CPE_SOURCE) continue;
- IFile file = (IFile)project.getFile(es[i].getPath().lastSegment()+"/"+name);
- if(file != null && file.exists()) return file;
- }
- return null;
- } catch (CoreException x) {
- //ignore
- return null;
- }
-
- }
-
IRegion fLastRegion = null;
/**
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/AbstractBaseHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/AbstractBaseHyperlink.java 2008-10-08 05:39:34 UTC (rev 10721)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/AbstractBaseHyperlink.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -54,18 +54,14 @@
super();
}
- private ITextViewer fTextViewer;
+ private IDocument fDocument;
private int fOffset;
- public void setTextViewer(ITextViewer textViewer) {
- fTextViewer = textViewer;
+ public void setDocument(IDocument document) {
+ fDocument = document;
}
- public ITextViewer getTextViewer() {
- return fTextViewer;
- }
-
public void setOffset(int offset) {
fOffset = offset;
}
@@ -291,7 +287,7 @@
* @return IDocument
*/
public IDocument getDocument() {
- return (fTextViewer == null ? null : fTextViewer.getDocument());
+ return fDocument;
}
/*
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/BaseHyperlinkDetector.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/BaseHyperlinkDetector.java 2008-10-08 05:39:34 UTC (rev 10721)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/BaseHyperlinkDetector.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -72,7 +72,7 @@
IHyperlink hyperlink = defs[i].createHyperlink();
if(!hyperlinks.contains(hyperlink)) {
if (hyperlink instanceof AbstractHyperlink) {
- ((AbstractHyperlink)hyperlink).setTextViewer(textViewer);
+ ((AbstractHyperlink)hyperlink).setDocument(textViewer.getDocument());
((AbstractHyperlink)hyperlink).setOffset(region.getOffset());
}
hyperlinks.add(hyperlink);
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/CSSTextScanner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/CSSTextScanner.java 2008-10-08 05:39:34 UTC (rev 10721)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/CSSTextScanner.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -116,11 +116,6 @@
state = STATE_NAME;
return (readsCount > 0 ? getToken(CSS_CLASS_NAME_SEPARATOR) : nextNameToken());
}
- if (WS_DETECTOR.isWhitespace((char)ch)) {
- unread();
- state = STATE_NAME_SEPARATOR;
- return (readsCount > 0 ? getToken(CSS_CLASS_NAME_SEPARATOR) : nextNameSeparatorToken());
- }
if (ch == '{') {
unread();
state = STATE_BODY;
@@ -128,13 +123,19 @@
}
if (ch == '/') {
ch = read();
- if (ch == ICharacterScanner.EOF) break;
+ if (ch == ICharacterScanner.EOF) {
+ break;
+ }
if (ch == '*') {
// Comment openning
unread(); // Unread '*'-char
unread(); // Unread '/'-char
setState(STATE_COMMENT);
- return (readsCount > 0 ? getToken(CSS_CLASS_NAME_SEPARATOR) : nextCommentToken());
+ if (readsCount > 0) {
+ return getToken(CSS_CLASS_NAME_SEPARATOR);
+ } else {
+ return nextCommentToken();
+ }
}
// Broken file ??? Emulate END of text
clearText();
@@ -162,7 +163,9 @@
}
if (ch == '/') {
ch = read();
- if (ch == ICharacterScanner.EOF) break;
+ if (ch == ICharacterScanner.EOF) {
+ break;
+ }
if (ch == '*') {
// Comment openning
unread(); // Unread '*'-char
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2008-10-08 05:39:34 UTC (rev 10721)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -88,6 +88,8 @@
IReusableEditor, ITextEditorExtension, ITextEditorExtension2,
ITextEditorExtension3, INavigationLocationProvider, IMultiPageEditor {
+ public static final String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor";
+
private static final String VISUALSOURCE_TAB_LABEL = "JSPMultiPageEditor.TabLabel.VisualSource"; //$NON-NLS-1$
private static final String SOURCE_TAB_LABEL = "JSPMultiPageEditor.TabLabel.Source"; //$NON-NLS-1$
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java 2008-10-08 05:39:34 UTC (rev 10721)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -17,6 +17,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -118,10 +119,8 @@
IResource res = null;
if (allProject) {
- IWorkspace workspace = Util.getCurrentWorkspace();
- if(workspace!=null) {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
res = workspace.getRoot().findMember(text.getText());
- }
} else {
IProject project = Util.getCurrentProject();
if (project!=null)
@@ -187,7 +186,7 @@
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
- IAdaptable project = Util.getCurrentWorkspace();
+ IAdaptable project = ResourcesPlugin.getWorkspace();
if (!allProject) {
project = Util.getCurrentProject();
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Constants.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Constants.java 2008-10-08 05:39:34 UTC (rev 10721)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Constants.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -10,6 +10,11 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.outline.cssdialog.common;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
import org.eclipse.swt.graphics.RGB;
/**
@@ -24,11 +29,11 @@
public static final String extSizes[] = new String[] { "", "em", "ex",
"px", "in", "cm", "mm", "pt", "pc" };
- public static final String elemFolder[] = new String[] {
+ public static final Set elemFolder = Collections.unmodifiableSet(new HashSet(Arrays.asList(new String[] {
"background-image", "list-style-image", "cursor", "cue-after",
- "cue-before" };
+ "cue-before" })));
- public static final String extElem[] = new String[] {
+ public static final Set extElem = Collections.unmodifiableSet(new HashSet(Arrays.asList(new String[] {
"border-bottom-width", "border-left-width", "borer-right-width",
"border-top-width", "border-width", "bottom", "font-size",
"height", "left", "letter-spacing", "line-height", "margin",
@@ -37,7 +42,7 @@
"min-height", "min-width", "outline-width", "padding",
"padding-bottom", "padding-left", "padding-right", "padding-top",
"right", "size", "text-indent", "top", "vertical-align", "width",
- "word-spacing" };
+ "word-spacing" })));
public static final String NONE = "none";
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-10-08 05:39:34 UTC (rev 10721)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Util.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -17,7 +17,6 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
@@ -34,340 +33,276 @@
*/
public class Util {
- private static String RGB = "rgb"; //$NON-NLS-1$
+ private static String RGB = "rgb"; //$NON-NLS-1$
- private static String NONE = "none"; //$NON-NLS-1$
+ private static String NONE = "none"; //$NON-NLS-1$
- private static String THIN = "thin"; //$NON-NLS-1$
+ private static String THIN = "thin"; //$NON-NLS-1$
- private static String COMMA = ","; //$NON-NLS-1$
+ private static String COMMA = ","; //$NON-NLS-1$
- private static int START_INDEX_RED = 1;
- private static int END_INDEX_RED = 3;
- private static int START_INDEX_GRENN = 3;
- private static int END_INDEX_GREEN = 5;
- private static int START_INDEX_BLUE = 5;
- private static int END_INDEX_BLUE = 7;
+ private static int START_INDEX_RED = 1;
+ private static int END_INDEX_RED = 3;
+ private static int START_INDEX_GRENN = 3;
+ private static int END_INDEX_GREEN = 5;
+ private static int START_INDEX_BLUE = 5;
+ private static int END_INDEX_BLUE = 7;
- private static int MAX_VALUE_RGB = 255;
- private static int MIN_VALUE_RGB = 0;
+ private static int MAX_VALUE_RGB = 255;
+ private static int MIN_VALUE_RGB = 0;
- private static int COUNT_COLORS = 3;
+ private static int COUNT_COLORS = 3;
- private static int RADIX = 16;
+ private static int RADIX = 16;
- private static int COLOR_LENGTH = 7;
+ private static int COLOR_LENGTH = 7;
- private static int START_COLOR_INDEX = 0;
+ private static int START_COLOR_INDEX = 0;
- private static char OPEN_BRACKET = '{';
- private static char CLOSE_BRACKET = '}';
+ private static char OPEN_BRACKET = '{';
+ private static char CLOSE_BRACKET = '}';
- private static char SHARP = '#';
- private static String SHARP_STRING = "#"; //$NON-NLS-1$
+ private static char SHARP = '#';
+ private static String SHARP_STRING = "#"; //$NON-NLS-1$
- private static String ZERO_STR = "0"; //$NON-NLS-1$
- private static int NORMAL_MIN_VALUE = 10;
+ private static String ZERO_STR = "0"; //$NON-NLS-1$
+ private static int NORMAL_MIN_VALUE = 10;
- /**
- * Method for checking contain or not css attribute folder
- *
- * @param name
- * Name css attribute
- * @return true - contain, or else - dont contain
- */
- public static boolean containFolder(String name) {
+ /**
+ * Method for checking contain or not css attribute folder
+ *
+ * @param name
+ * Name css attribute
+ * @return true - contain, or else - dont contain
+ */
+ public static boolean containFolder(String name) {
+ return Constants.elemFolder.contains(name);
+ }
- for (int i = 0; i < Constants.elemFolder.length; i++)
- if (Constants.elemFolder[i].equals(name))
- return true;
- return false;
- }
+ /**
+ * Method for search string into css attributes
+ *
+ * @param name
+ * Name
+ * @param elementMap
+ * Map of css attributes
+ * @return true - find, or else - dont find
+ */
+ public static boolean searchInElement(String name,
+ HashMap<String, ArrayList<String>> elementMap) {
- /**
- * Method for search css attribute in block elements (Aural, Boxes,....)
- *
- * @param name
- * Name css attribute
- * @param set
- * Set of block elemnts
- * @return true - find, or else - dont find
- */
- public static boolean searchOnBlock(String name, Set<String> set) {
+ Set<String> set = elementMap.keySet();
- for (String str1 : set)
- if (str1.equals(name))
- return true;
+ for (String str : set) {
+ ArrayList<String> list = elementMap.get(str);
+ if(list.contains(name)) {
+ return true;
+ }
+ }
- return false;
- }
+ return false;
+ }
- /**
- * Method for search css attribute in combo elements (text-decoration,
- * font-weight,....)
- *
- * @param name
- * Name css attribute
- * @param set
- * Set of combo elemnts
- * @return true - find, or else - dont find
- */
- public static boolean searchInCombo(String name, Set<String> set) {
+ /**
+ * Method for get RGB from string
+ *
+ * @param color
+ * Color string
+ * @return RGB color, or null, if color invalid
+ */
+ public static RGB getColor(String color) {
- for (String str1 : set)
- if (str1.equals(name))
- return true;
+ if (color.equals(Constants.EMPTY_STRING) || color.equals(NONE)) {
+ return null;
+ }
- return false;
- }
+ if (color.charAt(START_COLOR_INDEX) == SHARP
+ && color.length() == COLOR_LENGTH) {
- /**
- * Method for search string into css attributes
- *
- * @param name
- * Name
- * @param elementMap
- * Map of css attributes
- * @return true - find, or else - dont find
- */
- public static boolean searchInElement(String name,
- HashMap<String, ArrayList<String>> elementMap) {
+ String strR = color.substring(START_INDEX_RED, END_INDEX_RED);
+ String strG = color.substring(START_INDEX_GRENN, END_INDEX_GREEN);
+ String strB = color.substring(START_INDEX_BLUE, END_INDEX_BLUE);
- Set<String> set = elementMap.keySet();
+ try {
+ Integer.parseInt(strR, RADIX);
+ Integer.parseInt(strG, RADIX);
+ Integer.parseInt(strB, RADIX);
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ return convertColorHEX(color);
+ } else if (color.toLowerCase().indexOf(RGB) != Constants.DONT_CONTAIN) {
- for (String str : set) {
+ int start = color.indexOf(OPEN_BRACKET);
+ int end = color.indexOf(CLOSE_BRACKET);
+ String str = color.substring(start + 1, end);
- ArrayList<String> list = elementMap.get(str);
- for (String str1 : list)
- if (str1.equals(name))
- return true;
- }
+ StringTokenizer st = new StringTokenizer(str, COMMA);
- return false;
- }
+ int j = 0;
+ while (st.hasMoreTokens()) {
+ try {
+ int i = Integer.parseInt(st.nextToken().trim());
+ if (i < MIN_VALUE_RGB || i > MAX_VALUE_RGB) {
+ return null;
+ }
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ j++;
+ }
+ if (j == COUNT_COLORS) {
+ return convertColorRGB(color);
+ }
+ } else {
+ HashMap<String, String> colorMap = ColorParser.getInstance()
+ .getMap();
- /**
- * Method for get RGB from string
- *
- * @param color
- * Color string
- * @return RGB color, or null, if color invalid
- */
- public static RGB getColor(String color) {
+ for (String key : colorMap.keySet()) {
+ if (colorMap.get(key).equalsIgnoreCase(color)) {
+ return convertColorHEX(key);
+ }
+ }
+ }
- if (color.equals(Constants.EMPTY_STRING) || color.equals(NONE))
- return null;
-
- if (color.charAt(START_COLOR_INDEX) == SHARP
- && color.length() == COLOR_LENGTH) {
-
- String strR = color.substring(START_INDEX_RED, END_INDEX_RED);
- String strG = color.substring(START_INDEX_GRENN, END_INDEX_GREEN);
- String strB = color.substring(START_INDEX_BLUE, END_INDEX_BLUE);
-
- try {
- Integer.parseInt(strR, RADIX);
- Integer.parseInt(strG, RADIX);
- Integer.parseInt(strB, RADIX);
- } catch (RuntimeException e) {
return null;
- }
- return convertColorHEX(color);
- } else if (color.toLowerCase().indexOf(RGB) != Constants.DONT_CONTAIN) {
+ }
- int start = color.indexOf(OPEN_BRACKET);
- int end = color.indexOf(CLOSE_BRACKET);
- String str = color.substring(start + 1, end);
+ /**
+ * Method for convert string(123px) into two string (123 and px)
+ *
+ * @param str
+ * String for convert
+ * @return Array two strings, or null, if str uncorrect
+ */
+ public static String[] convertExtString(String str) {
- StringTokenizer st = new StringTokenizer(str, COMMA);
+ if (str.equalsIgnoreCase(THIN))
+ return new String[] { THIN, Constants.EMPTY_STRING };
- int j = 0;
- while (st.hasMoreTokens()) {
- try {
- int i = Integer.parseInt(st.nextToken().trim());
- if (i < MIN_VALUE_RGB || i > MAX_VALUE_RGB)
+ if (str == null)
return null;
- } catch (NumberFormatException e) {
- return null;
- }
- j++;
- }
+ if (str.trim().equals(Constants.EMPTY_STRING))
+ return new String[] { Constants.EMPTY_STRING,
+ Constants.EMPTY_STRING };
- if (j == COUNT_COLORS)
- return convertColorRGB(color);
- } else {
- HashMap<String, String> colorMap = ColorParser.getInstance()
- .getMap();
+ String newStr = str.toLowerCase().trim();
- for (String key : colorMap.keySet())
- if (colorMap.get(key).equalsIgnoreCase(color))
- return convertColorHEX(key);
- }
+ int index = -1;
+ for (int i = 1; i < Constants.extSizes.length; i++) {
- return null;
- }
+ index = newStr.indexOf(Constants.extSizes[i]);
+ if (index != -1)
+ break;
+ }
- /**
- * Method for convert string(123px) into two string (123 and px)
- *
- * @param str
- * String for convert
- * @return Array two strings, or null, if str uncorrect
- */
- public static String[] convertExtString(String str) {
+ if (index == -1)
+ return new String[] { newStr, Constants.EMPTY_STRING };
- if (str.equalsIgnoreCase(THIN))
- return new String[] { THIN, Constants.EMPTY_STRING };
+ String number = newStr.substring(0, index);
+ String ext = newStr.substring(index, index + 2);
- if (str == null)
- return null;
+ return new String[] { number, ext };
+ }
- if (str.trim().equals(Constants.EMPTY_STRING))
- return new String[] { Constants.EMPTY_STRING,
- Constants.EMPTY_STRING };
-
- String newStr = str.toLowerCase().trim();
-
- int index = -1;
- for (int i = 1; i < Constants.extSizes.length; i++) {
-
- index = newStr.indexOf(Constants.extSizes[i]);
- if (index != -1)
- break;
+ /**
+ * Method for search css attribute into extElements
+ *
+ * @param name
+ * Name of css attribute
+ * @return true - find, or else - dont find
+ */
+ public static boolean searchInExtElement(String name) {
+ return Constants.extElem.contains(name);
}
- if (index == -1)
- return new String[] { newStr, Constants.EMPTY_STRING };
+ /**
+ * Method for getting RGB color from string color
+ *
+ * @param color
+ * String color
+ * @return RGB color
+ */
+ public static RGB convertColorRGB(String color) {
- String number = newStr.substring(0, index);
- String ext = newStr.substring(index, index + 2);
+ String newStr = color.trim().toLowerCase();
- return new String[] { number, ext };
- }
+ int rgb[] = new int[COUNT_COLORS];
- /**
- * Method for search css attribute into extElements
- *
- * @param name
- * Name of css attribute
- * @return true - find, or else - dont find
- */
- public static boolean searchInExtElement(String name) {
+ int start = newStr.indexOf(OPEN_BRACKET);
+ int end = newStr.indexOf(CLOSE_BRACKET);
+ String str = newStr.substring(start + 1, end);
- for (int i = 0; i < Constants.extElem.length; i++)
- if (Constants.extElem[i].equals(name))
- return true;
- return false;
- }
+ StringTokenizer st = new StringTokenizer(str, COMMA);
+ int i = 0;
+ while (st.hasMoreTokens())
+ rgb[i++] = Integer.parseInt(st.nextToken().trim());
+ return new RGB(rgb[0], rgb[1], rgb[2]);
+ }
- /**
- * Method for getting RGB color from string color
- *
- * @param color
- * String color
- * @return RGB color
- */
- public static RGB convertColorRGB(String color) {
+ /**
+ * Method for getting RGB color from hex string
+ *
+ * @param color
+ * String color
+ * @return RGB color
+ */
+ public static RGB convertColorHEX(String color) {
- String newStr = color.trim().toLowerCase();
+ String newStr = color.trim().toLowerCase();
- int rgb[] = new int[COUNT_COLORS];
+ String strR = newStr.substring(START_INDEX_RED, END_INDEX_RED);
+ String strG = newStr.substring(START_INDEX_GRENN, END_INDEX_GREEN);
+ String strB = newStr.substring(START_INDEX_BLUE, END_INDEX_BLUE);
- int start = newStr.indexOf(OPEN_BRACKET);
- int end = newStr.indexOf(CLOSE_BRACKET);
- String str = newStr.substring(start + 1, end);
+ int red = Integer.parseInt(strR, RADIX);
+ int green = Integer.parseInt(strG, RADIX);
+ int blue = Integer.parseInt(strB, RADIX);
- StringTokenizer st = new StringTokenizer(str, COMMA);
- int i = 0;
- while (st.hasMoreTokens())
- rgb[i++] = Integer.parseInt(st.nextToken().trim());
- return new RGB(rgb[0], rgb[1], rgb[2]);
- }
+ return new RGB(red, green, blue);
+ }
- /**
- * Method for getting RGB color from hex string
- *
- * @param color
- * String color
- * @return RGB color
- */
- public static RGB convertColorHEX(String color) {
-
- String newStr = color.trim().toLowerCase();
-
- String strR = newStr.substring(START_INDEX_RED, END_INDEX_RED);
- String strG = newStr.substring(START_INDEX_GRENN, END_INDEX_GREEN);
- String strB = newStr.substring(START_INDEX_BLUE, END_INDEX_BLUE);
-
- int red = Integer.parseInt(strR, RADIX);
- int green = Integer.parseInt(strG, RADIX);
- int blue = Integer.parseInt(strB, RADIX);
-
- return new RGB(red, green, blue);
- }
-
- /**
- * Method for convert RGB to String
- *
- * @param rgb
- * RGB color
- * @return String color
- */
- public static String createColorString(RGB rgb) {
- String colorStr = SHARP_STRING
- + (rgb.red < NORMAL_MIN_VALUE ? ZERO_STR
- : Constants.EMPTY_STRING)
- + Integer.toHexString(rgb.red)
- + (rgb.green < NORMAL_MIN_VALUE ? ZERO_STR
- : Constants.EMPTY_STRING)
- + Integer.toHexString(rgb.green)
- + Constants.EMPTY_STRING
- + (rgb.blue < NORMAL_MIN_VALUE ? ZERO_STR
- : Constants.EMPTY_STRING)
- + Integer.toHexString(rgb.blue);
- colorStr = colorStr.toUpperCase();
- if (ColorParser.getInstance().getMap().get(colorStr) != null)
- 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();
+ /**
+ * Method for convert RGB to String
+ *
+ * @param rgb
+ * RGB color
+ * @return String color
+ */
+ public static String createColorString(RGB rgb) {
+ String colorStr = SHARP_STRING
+ + (rgb.red < NORMAL_MIN_VALUE ? ZERO_STR
+ : Constants.EMPTY_STRING)
+ + Integer.toHexString(rgb.red)
+ + (rgb.green < NORMAL_MIN_VALUE ? ZERO_STR
+ : Constants.EMPTY_STRING)
+ + Integer.toHexString(rgb.green)
+ + Constants.EMPTY_STRING
+ + (rgb.blue < NORMAL_MIN_VALUE ? ZERO_STR
+ : Constants.EMPTY_STRING)
+ + Integer.toHexString(rgb.blue);
+ colorStr = colorStr.toUpperCase();
+ if (ColorParser.getInstance().getMap().get(colorStr) != null)
+ return ColorParser.getInstance().getMap().get(colorStr);
+ return colorStr;
}
- if (file == null)
- return null;
- IProject project = file.getProject();
- return project;
- }
-
- /**
- * Get current workspace
- *
- * @return
- */
- public static IWorkspace getCurrentWorkspace() {
- IEditorPart editor = JspEditorPlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- IEditorInput input = editor.getEditorInput();
- IFile file = null;
- if (input instanceof IFileEditorInput) {
- file = ((IFileEditorInput) input).getFile();
+ /**
+ * Get current project for opened editor
+ *
+ * @return
+ */
+ public static IProject getCurrentProject() {
+ IEditorPart editor = JspEditorPlugin.getDefault().getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorInput input = editor.getEditorInput();
+ IProject project = null;
+ if (input instanceof IFileEditorInput) {
+ IFile file = ((IFileEditorInput) input).getFile();
+ project = file.getProject();
+ }
+ return project;
}
- if (file == null)
- return null;
- IWorkspace workspace = file.getWorkspace();
- return workspace;
- }
+
}
\ No newline at end of file
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-10-08 05:39:34 UTC (rev 10721)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/events/TabPropertySheetMouseAdapter.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -103,29 +103,29 @@
*/
public void mouseDown(MouseEvent event) {
- for (int i = 0; i < tree.getColumnCount(); i++)
- tree.getColumn(i).pack();
-
- Control old = editor.getEditor();
- if (old != null)
- old.dispose();
-
- Point pt = new Point(event.x, event.y);
-
- final TreeItem item = tree.getItem(pt);
-
- if (item != null) {
-
- if (Util.searchOnBlock(item.getText(Constants.FIRST_COLUMN).trim(),
- elementsMap.keySet()))
- return;
-
- if (Util.searchInCombo(item.getText(Constants.FIRST_COLUMN).trim(),
- comboMap.keySet()))
- createCombo(item, Constants.SECOND_COLUMN);
- else
- createText(item, Constants.SECOND_COLUMN);
- }
+ for (int i = 0; i < tree.getColumnCount(); i++)
+ tree.getColumn(i).pack();
+
+ Control old = editor.getEditor();
+ if (old != null)
+ old.dispose();
+
+ Point pt = new Point(event.x, event.y);
+
+ final TreeItem item = tree.getItem(pt);
+
+ if (item != null) {
+
+ if (elementsMap.keySet().contains(item.getText(Constants.FIRST_COLUMN).trim())) {
+ return;
+ }
+
+ if (comboMap.keySet().contains(item.getText(Constants.FIRST_COLUMN).trim())) {
+ createCombo(item, Constants.SECOND_COLUMN);
+ } else {
+ createText(item, Constants.SECOND_COLUMN);
+ }
+ }
}
/**
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/parsers/ColorParser.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/parsers/ColorParser.java 2008-10-08 05:39:34 UTC (rev 10721)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/parsers/ColorParser.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -50,12 +50,8 @@
private static final String FILE_NAME = "cssdialog/colors.xml"; //$NON-NLS-1$
- public static synchronized ColorParser getInstance() {
-
- if(colorParser==null) {
- colorParser = new ColorParser();
- }
- return colorParser;
+ public static ColorParser getInstance() {
+ return ColorParserHolder.INSTANCE;
}
/**
* Constructor for Color parser
@@ -107,4 +103,8 @@
}
return map;
}
+
+ private static class ColorParserHolder {
+ private static final ColorParser INSTANCE = new ColorParser();
+ }
}
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-10-08 05:39:34 UTC (rev 10721)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -113,10 +113,11 @@
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));
+ if (comboMap.keySet().contains(key)) {
+ createCombo(this, key, styleAttributes.getAttribute(key));
+ } else {
+ createText(this, key, styleAttributes.getAttribute(key));
+ }
}
}
@@ -145,10 +146,11 @@
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));
+ if (comboMap.keySet().contains(key)) {
+ createCombo(this, key, styleAttributes.getAttribute(key));
+ } else {
+ createText(this, key, styleAttributes.getAttribute(key));
+ }
}
this.layout();
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBeanNameHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBeanNameHyperlink.java 2008-10-08 05:39:34 UTC (rev 10721)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBeanNameHyperlink.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -69,7 +69,7 @@
return;
}
StrutsFormBeanHyperlink openOn = new StrutsFormBeanHyperlink();
- openOn.setTextViewer(getTextViewer());
+ openOn.setDocument(getDocument());
openOn.setOffset(getOffset());
openOn.doHyperlink(region);
}
Modified: trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java 2008-10-08 05:39:34 UTC (rev 10721)
+++ trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -19,7 +19,6 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.ide.ResourceUtil;
import org.jboss.tools.test.util.xpl.EditorTestHelper;
/**
Modified: trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java 2008-10-08 05:39:34 UTC (rev 10721)
+++ trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java 2008-10-08 06:45:58 UTC (rev 10722)
@@ -13,17 +13,23 @@
import junit.framework.TestCase;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.wizards.IWizardDescriptor;
/**
@@ -81,4 +87,14 @@
return PreferencesUtil.createPropertyDialogOn(WorkbenchUtils
.getActiveShell(), project, pageId, new String[] {pageId}, null);
}
+
+ public static IEditorPart openEditor(IFile inputFile, String editorId) {
+ IEditorPart part = null;
+ try {
+ part = getWorkbenchActivePage().openEditor(new FileEditorInput(inputFile), editorId);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ return part;
+ }
}
\ No newline at end of file
16 years, 3 months
JBoss Tools SVN: r10721 - trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-10-08 01:39:34 -0400 (Wed, 08 Oct 2008)
New Revision: 10721
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
Log:
JBIDE-2832
fix it.
But , is it correct that more than one source node connect same one target node ?
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-10-07 20:33:24 UTC (rev 10720)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-10-08 05:39:34 UTC (rev 10721)
@@ -245,40 +245,47 @@
.getModelTargetConnections().isEmpty())
continue;
// how dispatch more than one connection???
- LineConnectionModel childConnection = (LineConnectionModel) ((IConnectableModel) child)
- .getModelTargetConnections().get(0);
- if (connectionIsUsed(childConnection))
- continue;
- Object[] properties = childConnection
- .getPropertyArray();
- JavaBeanModel jbean = (JavaBeanModel) child
- .getReferenceEntityModel();
- String currentSelectorName = getSelectorString(
- (AbstractStructuredDataModel) childConnection
- .getTarget(),
- (AbstractStructuredDataModel) childConnection
- .getSource(),
- (AbstractStructuredDataModel) source);
- AnyType binding = SmooksModelUtils
- .addBindingTypeToParamType(bindingsParam,
- jbean.getName(),
- currentSelectorName, null, null);
- for (int i = 0; i < properties.length; i++) {
- PropertyModel property = (PropertyModel) properties[i];
- String pname = property.getName();
- String pvalue = property.getValue();
- binding.getAnyAttribute().add(
- ExtendedMetaData.INSTANCE
- .demandFeature(null, pname,
- false), pvalue);
- }
+ List<Object> targetConnectionModelList = ((IConnectableModel) child)
+ .getModelTargetConnections();
+ for (Iterator iterator3 = targetConnectionModelList
+ .iterator(); iterator3.hasNext();) {
+ LineConnectionModel childConnection = (LineConnectionModel) iterator3
+ .next();
+ if (connectionIsUsed(childConnection))
+ continue;
+ Object[] properties = childConnection
+ .getPropertyArray();
+ JavaBeanModel jbean = (JavaBeanModel) child
+ .getReferenceEntityModel();
+ String currentSelectorName = getSelectorString(
+ (AbstractStructuredDataModel) childConnection
+ .getTarget(),
+ (AbstractStructuredDataModel) childConnection
+ .getSource(),
+ (AbstractStructuredDataModel) source);
+ AnyType binding = SmooksModelUtils
+ .addBindingTypeToParamType(
+ bindingsParam, jbean.getName(),
+ currentSelectorName, null, null);
+ for (int i = 0; i < properties.length; i++) {
+ PropertyModel property = (PropertyModel) properties[i];
+ String pname = property.getName();
+ String pvalue = property.getValue();
+ binding.getAnyAttribute().add(
+ ExtendedMetaData.INSTANCE
+ .demandFeature(null, pname,
+ false), pvalue);
+ }
- if (!jbean.isPrimitive()) {
- analyzeStructuredDataModel(resourceList, root,
- (AbstractStructuredDataModel) child,
- resourceConfig, currentSelectorName);
+ if (!jbean.isPrimitive()) {
+ analyzeStructuredDataModel(
+ resourceList,
+ root,
+ (AbstractStructuredDataModel) child,
+ resourceConfig, currentSelectorName);
+ }
+ this.setConnectionUsed(childConnection);
}
- this.setConnectionUsed(childConnection);
}
}
@@ -349,21 +356,19 @@
}
- /*
- * (non-Javadoc)
+ /**
+ * If root node don't connect , it will ask user to connect them .
*
- * @see org.jboss.tools.smooks.analyzer.IMappingAnalyzer#analyzeMappingGraphModel(org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext)
+ * @param context
*/
- public void analyzeMappingGraphModel(
- SmooksConfigurationFileGenerateContext context)
- throws SmooksAnalyzerException {
+ private void checkRootNodeConnected(
+ SmooksConfigurationFileGenerateContext context) {
GraphRootModel root = context.getDataMappingRootModel();
List sourceList = root.loadSourceModelList();
List targetList = root.loadTargetModelList();
JavaBeanModel rootSource = null;
JavaBeanModel rootTarget = null;
-
boolean needCheck = false;
for (Iterator iterator = sourceList.iterator(); iterator.hasNext();) {
@@ -433,8 +438,18 @@
}
}
}
+ }
- SmooksResourceListType listType = context.getSmooksResourceListModel();
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.smooks.analyzer.IMappingAnalyzer#analyzeMappingGraphModel(org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext)
+ */
+ public void analyzeMappingGraphModel(
+ SmooksConfigurationFileGenerateContext context)
+ throws SmooksAnalyzerException {
+ GraphRootModel root = context.getDataMappingRootModel();
+ checkRootNodeConnected(context);
this.analyzeGraphicalModel(root, context.getGeneratorResourceList());
}
16 years, 3 months
JBoss Tools SVN: r10720 - workspace/examples.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-10-07 16:33:24 -0400 (Tue, 07 Oct 2008)
New Revision: 10720
Added:
workspace/examples/.project
workspace/examples/projectExamples.xml
Log:
Added: workspace/examples/.project
===================================================================
--- workspace/examples/.project (rev 0)
+++ workspace/examples/.project 2008-10-07 20:33:24 UTC (rev 10720)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>examples</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
Added: workspace/examples/projectExamples.xml
===================================================================
--- workspace/examples/projectExamples.xml (rev 0)
+++ workspace/examples/projectExamples.xml 2008-10-07 20:33:24 UTC (rev 10720)
@@ -0,0 +1,48 @@
+<projects>
+ <project>
+ <category>Seam</category>
+ <name>dvdstore</name>
+ <shortDescription>Seam DVD Store Example</shortDescription>
+ <description>This example demonstrates the use of Seam with jBPM
+ pageflow and business process management. It runs on JBoss AS and
+ Tomcat.</description>
+ <size>10000000</size>
+ <url>
+ http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/seam-examples/...
+ </url>
+ </project>
+
+ <project>
+ <category>Portlet</category>
+ <name>TestJavaPortlet</name>
+ <shortDescription>JBoss Java Portlet Example</shortDescription>
+ <description>This example demonstrates the use of JBoss Java Portlet. It runs on JBoss Portal 2.7.0.</description>
+ <size>10000</size>
+ <url>
+ http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/portlet-exampl...
+ </url>
+ </project>
+
+ <project>
+ <category>Portlet</category>
+ <name>TestJSFPortlet</name>
+ <shortDescription>JBoss JSF Portlet Example</shortDescription>
+ <description>This example demonstrates the use of JBoss JSF Portlet. It runs on JBoss Portal 2.7.0.</description>
+ <size>4000000</size>
+ <url>
+ http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/portlet-exampl...
+ </url>
+ </project>
+
+ <project>
+ <category>Portlet</category>
+ <name>TestSeamPortlet</name>
+ <shortDescription>JBoss Seam Portlet Example</shortDescription>
+ <description>This example demonstrates the use of JBoss Seam Portlet. It runs on JBoss Portal 2.7.0.</description>
+ <size>10000000</size>
+ <url>
+ http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/portlet-exampl...
+ </url>
+ </project>
+
+</projects>
\ No newline at end of file
16 years, 3 months
JBoss Tools SVN: r10719 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-10-07 14:11:31 -0400 (Tue, 07 Oct 2008)
New Revision: 10719
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2731
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2008-10-07 16:44:16 UTC (rev 10718)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2008-10-07 18:11:31 UTC (rev 10719)
@@ -53,6 +53,7 @@
import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
+import org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard;
import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard;
import org.hibernate.eclipse.console.utils.DriverClassHelpers;
import org.jboss.tools.seam.core.SeamCorePlugin;
@@ -154,6 +155,27 @@
}
/**
+ * This method is useful for seam facet modify wizard.
+ */
+ private void initModel() {
+ synchEditorsAndModel(jBossHibernateDbTypeEditor);
+// synchEditorsAndModel(jBossSeamHomeEditor);
+ synchEditorsAndModel(jBossAsDeployAsEditor);
+ synchEditorsAndModel(connProfileSelEditor);
+ synchEditorsAndModel(dbSchemaName);
+ synchEditorsAndModel(dbCatalogName);
+ synchEditorsAndModel(dbTablesExists);
+ synchEditorsAndModel(recreateTablesOnDeploy);
+ synchEditorsAndModel(sessionBeanPkgNameditor);
+ synchEditorsAndModel(entityBeanPkgNameditor);
+ synchEditorsAndModel(testsPkgNameditor);
+ }
+
+ private void synchEditorsAndModel(IFieldEditor editor) {
+ model.setProperty(editor.getName(), editor.getValue());
+ }
+
+ /**
* @return
*/
private String getDefaultDbType() {
@@ -248,6 +270,10 @@
model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_DIALECT,
HIBERNATE_HELPER.getDialectClass(jBossHibernateDbTypeEditor.getValueAsString()));
+
+ if(!isNewProjectWizard()) {
+ initModel();
+ }
}
/**
@@ -410,7 +436,7 @@
private boolean isNewProjectWizard() {
// ModifyFacetedProjectWizard or NewProjectDataModelFacetWizard
- return getWizard() instanceof NewProjectDataModelFacetWizard;
+ return getWizard()==null || getWizard() instanceof NewProjectDataModelFacetWizard;
}
/**
16 years, 3 months
JBoss Tools SVN: r10718 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-10-07 12:44:16 -0400 (Tue, 07 Oct 2008)
New Revision: 10718
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2731
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-10-07 16:40:52 UTC (rev 10717)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-10-07 16:44:16 UTC (rev 10718)
@@ -289,10 +289,8 @@
if(ejbVersion!=null) {
doExecuteForEjb(project, fv, model, monitor);
} else if(webVersion!=null) {
- model.setProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS, ISeamFacetDataModelProperties.DEPLOY_AS_WAR);
doExecuteForWar(project, fv, model, monitor);
} else if(earVersion!=null) {
- model.setProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS, ISeamFacetDataModelProperties.DEPLOY_AS_WAR);
doExecuteForEar(project, fv, model, monitor);
}
}
16 years, 3 months
JBoss Tools SVN: r10717 - in trunk/seam/plugins: org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-10-07 12:40:52 -0400 (Tue, 07 Oct 2008)
New Revision: 10717
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.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2731
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-10-07 15:56:58 UTC (rev 10716)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-10-07 16:40:52 UTC (rev 10717)
@@ -221,7 +221,7 @@
* @return
*/
static boolean isWarConfiguration(IDataModel model) {
- return "war".equals(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS)); //$NON-NLS-1$
+ return ISeamFacetDataModelProperties.DEPLOY_AS_WAR.equals(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS));
}
static void createComponentsProperties(final File seamGenResFolder, String projectName, Boolean embedded) {
@@ -289,8 +289,10 @@
if(ejbVersion!=null) {
doExecuteForEjb(project, fv, model, monitor);
} else if(webVersion!=null) {
+ model.setProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS, ISeamFacetDataModelProperties.DEPLOY_AS_WAR);
doExecuteForWar(project, fv, model, monitor);
} else if(earVersion!=null) {
+ model.setProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS, ISeamFacetDataModelProperties.DEPLOY_AS_WAR);
doExecuteForEar(project, fv, model, monitor);
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2008-10-07 15:56:58 UTC (rev 10716)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2008-10-07 16:40:52 UTC (rev 10717)
@@ -17,6 +17,8 @@
import java.util.List;
import java.util.Map;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.datatools.connectivity.IConnectionProfile;
import org.eclipse.datatools.connectivity.ProfileManager;
@@ -24,7 +26,9 @@
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
@@ -33,6 +37,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
@@ -40,6 +45,7 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
import org.eclipse.wst.common.frameworks.internal.operations.ProjectCreationDataModelProviderNew;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
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;
@@ -47,7 +53,6 @@
import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
-import org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard;
import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard;
import org.hibernate.eclipse.console.utils.DriverClassHelpers;
import org.jboss.tools.seam.core.SeamCorePlugin;
@@ -63,6 +68,7 @@
import org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor;
import org.jboss.tools.seam.ui.wizard.SeamFormWizard;
import org.jboss.tools.seam.ui.wizard.SeamWizardFactory;
+import org.jboss.tools.seam.ui.wizard.SeamWizardUtils;
/**
* @author eskimo
@@ -159,8 +165,33 @@
* @return
*/
private Object getDeployAsDefaultValue() {
- return SeamProjectPreferences.getStringPreference(
- SeamProjectPreferences.JBOSS_AS_DEFAULT_DEPLOY_AS);
+ String result = SeamProjectPreferences.getStringPreference(SeamProjectPreferences.JBOSS_AS_DEFAULT_DEPLOY_AS);
+ if(!isNewProjectWizard()) {
+ ISelection sel = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ IProject project = SeamWizardUtils.getInitialProject(sel);
+ if(project == null) {
+ SeamCorePlugin.getPluginLog().logError("Can't get project name to initialize SeamInstallWizardPage for ModifyFacetedProjectWizard");
+ return result;
+ }
+ IFacetedProject facetedProject;
+ try {
+ facetedProject = ProjectFacetsManager.create(project);
+ if(facetedProject==null) {
+ SeamCorePlugin.getPluginLog().logError("Can't get faceted project to initialize SeamInstallWizardPage for ModifyFacetedProjectWizard");
+ return result;
+ }
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ return result;
+ }
+ IProjectFacetVersion webVersion = facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.DYNAMIC_WEB_FACET);
+ if(webVersion!=null) {
+ return ISeamFacetDataModelProperties.DEPLOY_AS_WAR;
+ } else {
+ return ISeamFacetDataModelProperties.DEPLOY_AS_EAR;
+ }
+ }
+ return result;
}
/**
@@ -353,11 +384,13 @@
validatorDelegate.addValidatorForProperty(sessionBeanPkgNameditor
.getName(), new PackageNameValidator(
sessionBeanPkgNameditor.getName(), "session beans")); //$NON-NLS-1$
+ if(isNewProjectWizard()) {
+ validatorDelegate.addValidatorForProperty(
+ IFacetDataModelProperties.FACET_PROJECT_NAME,
+ new ProjectNamesDuplicationValidator(
+ IFacetDataModelProperties.FACET_PROJECT_NAME));
+ }
validatorDelegate.addValidatorForProperty(
- IFacetDataModelProperties.FACET_PROJECT_NAME,
- new ProjectNamesDuplicationValidator(
- IFacetDataModelProperties.FACET_PROJECT_NAME));
- validatorDelegate.addValidatorForProperty(
ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
getDeploymentTypeValidator(getWizard()));
}
@@ -375,6 +408,11 @@
initDefaultWizardProperties();
}
+ private boolean isNewProjectWizard() {
+ // ModifyFacetedProjectWizard or NewProjectDataModelFacetWizard
+ return getWizard() instanceof NewProjectDataModelFacetWizard;
+ }
+
/**
*
*/
@@ -542,15 +580,14 @@
IValidator getDeploymentTypeValidator(IWizard wizard) {
if(wizard instanceof NewProjectDataModelFacetWizard) {
return new DeploymentTypeValidator(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS, ((NewProjectDataModelFacetWizard)wizard).getDataModel());
- } else if(wizard instanceof ModifyFacetedProjectWizard) {
- ModifyFacetedProjectWizard mfpw = (ModifyFacetedProjectWizard)wizard;
}
- return new IValidator() {
- public Map<String, String> validate(Object value, Object context) {
- SeamInstallWizardPage.this.validate();
- return ValidatorFactory.NO_ERRORS;
- }
- };
+ return new DeploymentTypeValidator(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS, model);
+// return new IValidator() {
+// public Map<String, String> validate(Object value, Object context) {
+// SeamInstallWizardPage.this.validate();
+// return ValidatorFactory.NO_ERRORS;
+// }
+// };
}
static class DeploymentTypeValidator implements IValidator {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2008-10-07 15:56:58 UTC (rev 10716)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2008-10-07 16:40:52 UTC (rev 10717)
@@ -7,7 +7,7 @@
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.seam.ui.internal.project.facet;
import java.io.File;
@@ -34,12 +34,8 @@
import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.core.SeamPreferences;
-import org.jboss.tools.seam.core.project.facet.SeamProjectPreferences;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
@@ -55,8 +51,7 @@
/**
*
*/
- static public Map<String, IValidator> validators
- = new HashMap<String, IValidator>();
+ static public Map<String, IValidator> validators = new HashMap<String, IValidator>();
/**
*
@@ -107,8 +102,8 @@
* @param text
* @return
*/
- public static Map<String, String> createErrormessage(String propertyName,
- String text) {
+ public static Map<String, String> createErrormessage(String propertyName,
+ String text) {
Map<String, String> map = createErrorMap();
map.put(propertyName, text);
return map;
@@ -127,10 +122,12 @@
File folder = new File(folderPath);
if (!folder.exists())
- return createErrormessage(SeamUIMessages.VALIDATOR_FACTORY_FOLDER + folderPath
+ return createErrormessage(SeamUIMessages.VALIDATOR_FACTORY_FOLDER
+ + folderPath
+ SeamUIMessages.VALIDATOR_FACTORY_DOES_NOT_EXISTS);
if (!folder.isDirectory())
- return createErrormessage(SeamUIMessages.VALIDATOR_FACTORY_PATH + folderPath
+ return createErrormessage(SeamUIMessages.VALIDATOR_FACTORY_PATH
+ + folderPath
+ SeamUIMessages.VALIDATOR_FACTORY_POINTS_TO_FILE);
return NO_ERRORS;
}
@@ -145,29 +142,36 @@
value, context);
if (errors.size() > 0) {
errors = createErrorMap();
- errors.put(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
- SeamUIMessages.VALIDATOR_FACTORY_SEAM_HOME_FOLDER_DOES_NOT_EXISTS);
+ errors
+ .put(
+ ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
+ SeamUIMessages.VALIDATOR_FACTORY_SEAM_HOME_FOLDER_DOES_NOT_EXISTS);
return errors;
}
String version = (String) context;
- if(version.startsWith("2.")) { //$NON-NLS-1$
- File seamJarFile = new File(value.toString(), "lib/jboss-seam.jar"); //$NON-NLS-1$
+ if (version.startsWith("2.")) { //$NON-NLS-1$
+ File seamJarFile = new File(value.toString(),
+ "lib/jboss-seam.jar"); //$NON-NLS-1$
if (!seamJarFile.isFile()) {
errors = createErrorMap();
- errors.put(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
- SeamUIMessages.VALIDATOR_FACTORY_HOME_FOLDER_POINTS_TO +
- SeamUIMessages.VALIDATOR_FACTORY_LOCATION_THAT_DOES_NOT_LOOK_LIKE_SEAM_HOME_FOLDER);
- }
+ errors
+ .put(
+ ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
+ SeamUIMessages.VALIDATOR_FACTORY_HOME_FOLDER_POINTS_TO
+ + SeamUIMessages.VALIDATOR_FACTORY_LOCATION_THAT_DOES_NOT_LOOK_LIKE_SEAM_HOME_FOLDER);
+ }
} else {
File seamJarFile = new File(value.toString(), "jboss-seam.jar"); //$NON-NLS-1$
if (!seamJarFile.isFile()) {
errors = createErrorMap();
- errors.put(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
- SeamUIMessages.VALIDATOR_FACTORY_HOME_FOLDER_POINTS_TO +
- SeamUIMessages.VALIDATOR_FACTORY_LOCATION_THAT_DOES_NOT_LOOK_LIKE_SEAM_HOME_FOLDER);
- }
- }
+ errors
+ .put(
+ ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
+ SeamUIMessages.VALIDATOR_FACTORY_HOME_FOLDER_POINTS_TO
+ + SeamUIMessages.VALIDATOR_FACTORY_LOCATION_THAT_DOES_NOT_LOOK_LIKE_SEAM_HOME_FOLDER);
+ }
+ }
return errors;
}
@@ -182,15 +186,18 @@
value, context);
if (errors.size() > 0) {
errors = createErrorMap();
- errors.put(ISeamFacetDataModelProperties.JBOSS_AS_HOME,
- SeamUIMessages.VALIDATOR_FACTORY_JBOSS_AS_HOME_FOLDER_DOES_NOT_EXIST);
+ errors
+ .put(
+ ISeamFacetDataModelProperties.JBOSS_AS_HOME,
+ SeamUIMessages.VALIDATOR_FACTORY_JBOSS_AS_HOME_FOLDER_DOES_NOT_EXIST);
return errors;
}
if (!new File(value.toString(), "bin/twiddle.jar").isFile()) { //$NON-NLS-1$
- errors.put(
- ISeamFacetDataModelProperties.JBOSS_AS_HOME,
- SeamUIMessages.VALIDATOR_FACTORY_JBOSS_AS_HOME_FOLDER_POINT_TO_LOCATION_THAT_DOES_NOT +
- SeamUIMessages.VALIDATOR_FACTORY_LOOK_LIKE_JBOSS_AS_HOME_FOLDER);
+ errors
+ .put(
+ ISeamFacetDataModelProperties.JBOSS_AS_HOME,
+ SeamUIMessages.VALIDATOR_FACTORY_JBOSS_AS_HOME_FOLDER_POINT_TO_LOCATION_THAT_DOES_NOT
+ + SeamUIMessages.VALIDATOR_FACTORY_LOOK_LIKE_JBOSS_AS_HOME_FOLDER);
}
return errors;
}
@@ -209,9 +216,10 @@
.createAST(null);
IProblem[] problems = compilationUnit.getProblems();
if (problems.length > 0) {
- return createErrormessage(Messages.format(
- SeamUIMessages.VALIDATOR_FACTORY_COMPONENT_NAME_IS_NOT_VALID, problems[0]
- .getMessage()));
+ return createErrormessage(Messages
+ .format(
+ SeamUIMessages.VALIDATOR_FACTORY_COMPONENT_NAME_IS_NOT_VALID,
+ problems[0].getMessage()));
}
return ValidatorFactory.NO_ERRORS;
}
@@ -223,7 +231,10 @@
.toString(), CompilerOptions.VERSION_1_5,
CompilerOptions.VERSION_1_5);
if (status.getSeverity() == IStatus.ERROR) {
- return createErrormessage((Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, status.getMessage())));
+ return createErrormessage((Messages
+ .format(
+ NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName,
+ status.getMessage())));
}
return ValidatorFactory.NO_ERRORS;
@@ -248,13 +259,13 @@
public static final IValidator SEAM_COMPONENT_NAME_VALIDATOR = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
- IStatus status = JavaConventions.validateClassFileName(
- value.toString()+".class", "5.0", "5.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ IStatus status = JavaConventions.validateClassFileName(value
+ .toString()
+ + ".class", "5.0", "5.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (status.isOK()) {
return NO_ERRORS;
} else {
- return createErrormessage(
- SeamUIMessages.VALIDATOR_FACTORY_NAME_IS_NOT_VALID);
+ return createErrormessage(SeamUIMessages.VALIDATOR_FACTORY_NAME_IS_NOT_VALID);
}
}
};
@@ -267,7 +278,7 @@
public static final IValidator SEAM_JAVA_INTEFACE_NAME_CONVENTION_VALIDATOR = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
- if(!(context instanceof Object[])) {
+ if (!(context instanceof Object[])) {
throw new IllegalArgumentException(
"Context parameter should be instance of Object[]"); //$NON-NLS-1$
}
@@ -294,7 +305,7 @@
public static final IValidator SEAM_METHOD_NAME_VALIDATOR = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
- if(!(context instanceof Object[])) {
+ if (!(context instanceof Object[])) {
throw new IllegalArgumentException(
"Context parameter should be instance of Object[]"); //$NON-NLS-1$
}
@@ -305,12 +316,13 @@
CompilationUnit compilationUnit = createCompilationUnit(
"class ClassName {public void " //$NON-NLS-1$
- + value.toString() + "() {}}",project); //$NON-NLS-1$
+ + value.toString() + "() {}}", project); //$NON-NLS-1$
IProblem[] problems = compilationUnit.getProblems();
if (problems.length > 0) {
- return createErrormessage(targetName + SeamUIMessages.VALIDATOR_FACTORY_NAME_IS_NOT_VALID2);
+ return createErrormessage(targetName
+ + SeamUIMessages.VALIDATOR_FACTORY_NAME_IS_NOT_VALID2);
}
return NO_ERRORS;
@@ -320,7 +332,7 @@
public static final IValidator FILE_NAME_VALIDATOR = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
- if(!(context instanceof Object[])) {
+ if (!(context instanceof Object[])) {
throw new IllegalArgumentException(
"Context parameter should be instance of Object[]"); //$NON-NLS-1$
}
@@ -331,7 +343,8 @@
if ("".equals(value) //$NON-NLS-1$
|| !project.getLocation().isValidSegment(value.toString()))
- return createErrormessage(targetName + SeamUIMessages.VALIDATOR_FACTORY_NAME_IS_NOT_VALID2);
+ return createErrormessage(targetName
+ + SeamUIMessages.VALIDATOR_FACTORY_NAME_IS_NOT_VALID2);
return NO_ERRORS;
}
@@ -340,7 +353,7 @@
public static final IValidator SEAM_PROJECT_NAME_VALIDATOR = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
- if(value==null || "".equals(value)) { //$NON-NLS-1$
+ if (value == null || "".equals(value)) { //$NON-NLS-1$
return createErrormessage(SeamUIMessages.VALIDATOR_FACTORY_PRJ_NOT_SELECTED);
}
IResource project = ResourcesPlugin.getWorkspace().getRoot()
@@ -348,90 +361,129 @@
if (project == null || !(project instanceof IProject)
|| !project.exists()) {
- return createErrormessage(
- SeamUIMessages.VALIDATOR_FACTORY_PROJECT + value + SeamUIMessages.VALIDATOR_FACTORY_DOES_NOT_EXIST);
+ return createErrormessage(SeamUIMessages.VALIDATOR_FACTORY_PROJECT
+ + value
+ + SeamUIMessages.VALIDATOR_FACTORY_DOES_NOT_EXIST);
} else {
- IProject selection = (IProject)project;
+ IProject selection = (IProject) project;
try {
- if (!selection.hasNature(ISeamProject.NATURE_ID)
- || SeamCorePlugin.getSeamPreferences(selection)==null
-// || selection.getAdapter(IFacetedProject.class)==null
-// || !((IFacetedProject)selection.getAdapter(IFacetedProject.class)).hasProjectFacet(ProjectFacetsManager.getProjectFacet("jst.web"))
- || "".equals(SeamCorePlugin.getSeamPreferences(selection).get(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS, ""))) { //$NON-NLS-1$
- return createErrormessage(
- SeamUIMessages.VALIDATOR_FACTORY_SELECTED_PROJECT + project.getName() + SeamUIMessages.VALIDATOR_FACTORY_IS_NOT_A_SEAM_WEB_PROJECT);
- } else {
- //TODO validate project(s) structure
+ if (!selection.hasNature(ISeamProject.NATURE_ID)
+ || SeamCorePlugin.getSeamPreferences(selection) == null
+ // ||
+ // selection.getAdapter(IFacetedProject.class)==null
+ // || !((IFacetedProject)selection.getAdapter(
+ // IFacetedProject
+ // .class)).hasProjectFacet(ProjectFacetsManager
+ // .getProjectFacet("jst.web"))
+ || "" .equals(SeamCorePlugin.getSeamPreferences(selection).get(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS, ""))) { //$NON-NLS-1$
+ return createErrormessage(SeamUIMessages.VALIDATOR_FACTORY_SELECTED_PROJECT
+ + project.getName()
+ + SeamUIMessages.VALIDATOR_FACTORY_IS_NOT_A_SEAM_WEB_PROJECT);
+ } else {
+ // TODO validate project(s) structure
}
} catch (CoreException e) {
- // it might happen only if project is closed and project
+ // it might happen only if project is closed and project
// name typed by hand
- return createErrormessage(NLS.bind(SeamUIMessages.VALIDATOR_FACTORY_SELECTED_PRJ_IS_CLOSED, project.getName()));
+ return createErrormessage(NLS
+ .bind(
+ SeamUIMessages.VALIDATOR_FACTORY_SELECTED_PRJ_IS_CLOSED,
+ project.getName()));
}
}
return NO_ERRORS;
}
};
- public static final IValidator CONNECTION_PROFILE_VALIDATOR =
- new IValidator() {
+ private static class ConnectionProfileValidator implements IValidator {
+
+ private boolean allowEmptyConnection;
+
+ public ConnectionProfileValidator(boolean allowEmptyConnection) {
+ this.allowEmptyConnection = allowEmptyConnection;
+ }
+
public Map<String, String> validate(Object value, Object context) {
- if (value == null || "".equals(value.toString().trim())) { //$NON-NLS-1$
+ if (!allowEmptyConnection && (value == null || "".equals(value.toString().trim()))) { //$NON-NLS-1$
return createErrormessage(
ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
SeamUIMessages.VALIDATOR_FACTORY_CONNECTION_PROFILE_IS_NOT_SELECTED);
} else {
- IConnectionProfile connProfile
- = ProfileManager.getInstance().getProfileByName(value.toString());
+ IConnectionProfile connProfile = ProfileManager.getInstance()
+ .getProfileByName(value.toString());
Properties props = connProfile.getBaseProperties();
- Object driverClass
- = props.get("org.eclipse.datatools.connectivity.db.driverClass"); //$NON-NLS-1$
+ Object driverClass = props
+ .get("org.eclipse.datatools.connectivity.db.driverClass"); //$NON-NLS-1$
- if(driverClass==null || "".equals(driverClass)) { //$NON-NLS-1$
+ if (driverClass == null || "".equals(driverClass)) { //$NON-NLS-1$
return createErrormessage(
ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
- SeamUIMessages.VALIDATOR_FACTORY_DRIVER_CLASS_PROPERTY_IS_EMPTY_FOR_SELECTED
- + value + SeamUIMessages.VALIDATOR_FACTORY_CONNECTION_PROFILE);
+ SeamUIMessages.VALIDATOR_FACTORY_DRIVER_CLASS_PROPERTY_IS_EMPTY_FOR_SELECTED
+ + value
+ + SeamUIMessages.VALIDATOR_FACTORY_CONNECTION_PROFILE);
}
}
return NO_ERRORS;
}
- };
+ }
+ public static final IValidator CONNECTION_PROFILE_VALIDATOR = new ConnectionProfileValidator(false);
+
+ public static final IValidator CONNECTION_DRIVER_VALIDATOR = new ConnectionProfileValidator(true);
+
public static final IValidator SEAM_RUNTIME_NAME_VALIDATOR = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
- Map<String,String> errors = NO_ERRORS;
+ Map<String, String> errors = NO_ERRORS;
if (value == null || "".equals(value.toString().trim())) { //$NON-NLS-1$
errors = createErrormessage(
ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
SeamUIMessages.VALIDATOR_FACTORY_SEAM_RUNTIME_IS_NOT_SELECTED);
- } else {
+ } else {
SeamRuntime rt = SeamRuntimeManager.getInstance()
- .findRuntimeByName(value.toString());
+ .findRuntimeByName(value.toString());
if (rt == null) {
- errors = createErrormessage(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
- NLS.bind(SeamUIMessages.VALIDATOR_FACTORY_CANNOT_FIND_SEAM_RUNTIME, value));
+ errors = createErrormessage(
+ ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
+ NLS
+ .bind(
+ SeamUIMessages.VALIDATOR_FACTORY_CANNOT_FIND_SEAM_RUNTIME,
+ value));
} else if (!new File(rt.getHomeDir()).exists()) {
- errors = createErrormessage(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
- NLS.bind(
- SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_HOME_DIR_IS_MISSING,value));
+ errors = createErrormessage(
+ ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
+ NLS
+ .bind(
+ SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_HOME_DIR_IS_MISSING,
+ value));
} else if (!new File(rt.getSeamGenDir()).exists()) {
- errors = createErrormessage(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
- NLS.bind(
- SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_TEMPLATES_DIR_IS_MISSING,value));
+ errors = createErrormessage(
+ ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
+ NLS
+ .bind(
+ SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_TEMPLATES_DIR_IS_MISSING,
+ value));
} else if (!new File(rt.getSrcTemplatesDir()).exists()) {
- errors = createErrormessage(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
- NLS.bind(
- SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_SRC_DIR_IS_MISSING,value));
+ errors = createErrormessage(
+ ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
+ NLS
+ .bind(
+ SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_SRC_DIR_IS_MISSING,
+ value));
} else if (!new File(rt.getViewTemplatesDir()).exists()) {
- errors = createErrormessage(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
- NLS.bind(
- SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_VIEW_DIR_IS_MISSING,value));
- } else if(!new File(rt.getResourceTemplatesDir()).exists()) {
- errors = createErrormessage(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
- NLS.bind(
- SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_RESOURCES_DIR_IS_MISSING,value));
+ errors = createErrormessage(
+ ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
+ NLS
+ .bind(
+ SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_VIEW_DIR_IS_MISSING,
+ value));
+ } else if (!new File(rt.getResourceTemplatesDir()).exists()) {
+ errors = createErrormessage(
+ ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
+ NLS
+ .bind(
+ SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_RESOURCES_DIR_IS_MISSING,
+ value));
}
}
return errors;
@@ -441,39 +493,52 @@
public static final IValidator SEAM_RUNTIME_VALIDATOR = new IValidator() {
public java.util.Map<String, String> validate(Object value,
Object context) {
- Map<String,String> errors = NO_ERRORS;
+ Map<String, String> errors = NO_ERRORS;
String rtName = value.toString();
- if(value==null || "".equals(value)) { //$NON-NLS-1$
+ if (value == null || "".equals(value)) { //$NON-NLS-1$
errors = createErrormessage(SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_NOT_CONFIGURED);
} else {
SeamRuntime rt = SeamRuntimeManager.getInstance()
.findRuntimeByName(value.toString());
if (rt == null) {
- errors = createErrormessage(NLS.bind(SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_CANNOT_BE_FOUND, value));
+ errors = createErrormessage(NLS
+ .bind(
+ SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_CANNOT_BE_FOUND,
+ value));
} else if (!new File(rt.getHomeDir()).exists()) {
- errors = createErrormessage(NLS.bind(
- SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_HOME_DIR_DOES_NOT_EXIST,value));
+ errors = createErrormessage(NLS
+ .bind(
+ SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_HOME_DIR_DOES_NOT_EXIST,
+ value));
} else if (!new File(rt.getSeamGenDir()).exists()) {
- errors = createErrormessage(NLS.bind(
- SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_TEMPLATES_DIR_DOES_NOT_EXIST,value));
+ errors = createErrormessage(NLS
+ .bind(
+ SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_TEMPLATES_DIR_DOES_NOT_EXIST,
+ value));
} else if (!new File(rt.getSrcTemplatesDir()).exists()) {
- errors = createErrormessage(NLS.bind(
- SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_SOURCE_TEMPLATES_DIR_DOES_NOT_EXIST,value));
+ errors = createErrormessage(NLS
+ .bind(
+ SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_SOURCE_TEMPLATES_DIR_DOES_NOT_EXIST,
+ value));
} else if (!new File(rt.getViewTemplatesDir()).exists()) {
- errors = createErrormessage(NLS.bind(
- SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_VIE_TEMPLATE_DIR_DOES_NOT_EXIST,value));
-// } else if(!new File(rt.getResourceTemplatesDir()).exists()) {
-// errors = createErrormessage(NLS.bind(
-// "Seam Runtime '{0)' resource templates directory doesn't exist for selected Seam Web Project",value));
+ errors = createErrormessage(NLS
+ .bind(
+ SeamUIMessages.VALIDATOR_FACTORY_SEAM_RT_VIE_TEMPLATE_DIR_DOES_NOT_EXIST,
+ value));
+ // } else if(!new
+ // File(rt.getResourceTemplatesDir()).exists()) {
+ // errors = createErrormessage(NLS.bind(
+ // "Seam Runtime '{0)' resource templates directory doesn't exist for selected Seam Web Project"
+ // ,value));
}
}
return errors;
}
};
- public static CompilationUnit createCompilationUnit(String classDecl,
- IProject project) {
+ public static CompilationUnit createCompilationUnit(String classDecl,
+ IProject project) {
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(classDecl.toCharArray());
parser.setProject(JavaCore.create(project));
16 years, 3 months
JBoss Tools SVN: r10716 - trunk/seam/plugins/org.jboss.tools.seam.xml.ui/src/org/jboss/tools/seam/xml/ui/editor/form/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-10-07 11:56:58 -0400 (Tue, 07 Oct 2008)
New Revision: 10716
Modified:
trunk/seam/plugins/org.jboss.tools.seam.xml.ui/src/org/jboss/tools/seam/xml/ui/editor/form/core/PropertyListFormLayoutData.java
trunk/seam/plugins/org.jboss.tools.seam.xml.ui/src/org/jboss/tools/seam/xml/ui/editor/form/core/SeamComponentsCoreFormLayoutData.java
Log:
JBIDE-2855
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml.ui/src/org/jboss/tools/seam/xml/ui/editor/form/core/PropertyListFormLayoutData.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml.ui/src/org/jboss/tools/seam/xml/ui/editor/form/core/PropertyListFormLayoutData.java 2008-10-07 15:56:50 UTC (rev 10715)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml.ui/src/org/jboss/tools/seam/xml/ui/editor/form/core/PropertyListFormLayoutData.java 2008-10-07 15:56:58 UTC (rev 10716)
@@ -27,6 +27,7 @@
static String ENT_FILTERS = "SeamCoreFilters"; //$NON-NLS-1$
static String ENT_FILTERS_20 = "SeamPersistenceFilters"; //$NON-NLS-1$
static String ENT_RULE_FILES = "SeamDroolsRuleFiles"; //$NON-NLS-1$
+ static String ENT_INTERCEPTORS = "SeamCoreInterceptors"; //$NON-NLS-1$
static String ENT_RESTRICTIONS = "SeamFrameworkRestrictions"; //$NON-NLS-1$
static String ENT_HINTS = "SeamFrameworkHints"; //$NON-NLS-1$
@@ -113,6 +114,13 @@
final static IFormData BUNDLE_NAMES_FORM_DEFINITION = new FormData(
ENT_BUNDLE_NAMES, new String[]{null}, BUNDLE_NAMES_DEFINITIONS);
+ private final static IFormData[] INTERCEPTORS_DEFINITIONS = new IFormData[] {
+ createListDefinition("Interceptors") //$NON-NLS-1$
+ };
+
+ final static IFormData INTERCEPTORS_DEFINITION = new FormData(
+ ENT_INTERCEPTORS, new String[]{null}, INTERCEPTORS_DEFINITIONS);
+
private final static IFormData[] FILTERS_DEFINITIONS = new IFormData[] {
createListDefinition("Filters") //$NON-NLS-1$
};
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml.ui/src/org/jboss/tools/seam/xml/ui/editor/form/core/SeamComponentsCoreFormLayoutData.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml.ui/src/org/jboss/tools/seam/xml/ui/editor/form/core/SeamComponentsCoreFormLayoutData.java 2008-10-07 15:56:50 UTC (rev 10715)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml.ui/src/org/jboss/tools/seam/xml/ui/editor/form/core/SeamComponentsCoreFormLayoutData.java 2008-10-07 15:56:58 UTC (rev 10716)
@@ -33,6 +33,7 @@
PropertyListFormLayoutData.PROCESS_20_DEFS_FORM_DEFINITION,
PropertyListFormLayoutData.PAGEFLOW_20_DEFS_FORM_DEFINITION,
PropertyListFormLayoutData.BUNDLE_NAMES_FORM_DEFINITION,
+ PropertyListFormLayoutData.INTERCEPTORS_DEFINITION,
PropertyListFormLayoutData.FILTERS_FORM_DEFINITION,
PropertyListFormLayoutData.FILTERS_20_FORM_DEFINITION,
16 years, 3 months
JBoss Tools SVN: r10715 - in trunk/seam/plugins/org.jboss.tools.seam.xml: META-INF and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-10-07 11:56:50 -0400 (Tue, 07 Oct 2008)
New Revision: 10715
Added:
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/ELConstraint.java
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/IntELConstraint.java
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/ListELConstraint.java
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/ListIntELConstraint.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.xml/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.xml/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-components.meta
trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-core.meta
Log:
JBIDE-2855
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/META-INF/MANIFEST.MF 2008-10-07 15:55:01 UTC (rev 10714)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/META-INF/MANIFEST.MF 2008-10-07 15:56:50 UTC (rev 10715)
@@ -8,7 +8,8 @@
Bundle-SymbolicName: org.jboss.tools.seam.xml;singleton:=true
Bundle-Localization: plugin
Provide-Package: org.jboss.tools.seam.xml,
- org.jboss.tools.seam.xml.components.model
+ org.jboss.tools.seam.xml.components.model,
+ org.jboss.tools.seam.xml.components.model.constraint
Require-Bundle: org.jboss.tools.jst.web;visibility:=reexport,
org.eclipse.ui.ide,
org.eclipse.ui.views,
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/plugin.xml 2008-10-07 15:55:01 UTC (rev 10714)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/plugin.xml 2008-10-07 15:56:50 UTC (rev 10715)
@@ -41,6 +41,14 @@
class="org.jboss.tools.seam.xml.components.model.SeamComponents11FileLoader"/>
<xclass id="org.jboss.tools.seam.xml.components.model.SeamComponentsEntityRecognizer"
class="org.jboss.tools.seam.xml.components.model.SeamComponentsEntityRecognizer"/>
+
+ <xclass id="org.jboss.tools.seam.xml.components.model.constraint.ListELConstraint"
+ class="org.jboss.tools.seam.xml.components.model.constraint.ListELConstraint"/>
+ <xclass id="org.jboss.tools.seam.xml.components.model.constraint.IntELConstraint"
+ class="org.jboss.tools.seam.xml.components.model.constraint.IntELConstraint"/>
+ <xclass id="org.jboss.tools.seam.xml.components.model.constraint.ListIntELConstraint"
+ class="org.jboss.tools.seam.xml.components.model.constraint.ListIntELConstraint"/>
+
</extension>
<extension point="org.eclipse.wst.xml.core.catalogContributions">
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-components.meta
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-components.meta 2008-10-07 15:55:01 UTC (rev 10714)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-components.meta 2008-10-07 15:56:50 UTC (rev 10715)
@@ -4,6 +4,11 @@
<XModelEntityGroup>
<VERSION DEPENDS="Model:1.0" MODULE="Struts Editor" VERSION="1.0"/>
<MAPPINGS>
+ <MAPPING name="AttributeConstraints">
+ <PAIR name="IntEL" value="org.jboss.tools.seam.xml.components.model.constraint.IntELConstraint"/>
+ <PAIR name="ListEL" value="org.jboss.tools.seam.xml.components.model.constraint.ListELConstraint"/>
+ <PAIR name="ListIntEL" value="org.jboss.tools.seam.xml.components.model.constraint.ListIntELConstraint"/>
+ </MAPPING>
<MAPPING name="FileVersions">
<PAIR name="SeamComponents1.1" value="FileSeamComponents11"/>
<PAIR name="SeamComponents1.2" value="FileSeamComponents12"/>
@@ -1112,9 +1117,40 @@
name="EditActions" path="EditActions"/>
<XActionItemReference entity="FileSeamComponents20"
name="SaveActions" path="SaveActions"/>
+ <XActionItem ICON="action.empty" displayName="New" group="1"
+ kind="list" name="CreateActions">
+ <XActionItem HandlerClassName="%Create%"
+ ICON="action.new.struts.webapp.res_ref"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Component..." kind="action" name="AddComponent">
+ <EntityData EntityName="SeamComponent20">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="class" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%"
+ ICON="action.new.struts.webapp.res_ref"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Factory..." kind="action" name="AddFactory">
+ <EntityData EntityName="SeamFactory20">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="value" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ WizardClassName="%Default%" displayName="Event..." kind="action" name="AddEvent">
+ <EntityData EntityName="SeamEvent20">
+ <AttributeData AttributeName="type"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ WizardClassName="%Default%" displayName="Import..." kind="action" name="AddImport">
+ <EntityData EntityName="SeamImport">
+ <AttributeData AttributeName="import"/>
+ </EntityData>
+ </XActionItem>
+ </XActionItem>
<XActionItemReference entity="FileSeamComponents20"
- name="CreateActions" path="CreateActions"/>
- <XActionItemReference entity="FileSeamComponents20"
name="CopyActions" path="CopyActions"/>
<XActionItemReference entity="FileSeamComponents20"
name="DeleteActions" path="DeleteActions"/>
@@ -1366,7 +1402,7 @@
<Editor name="AccessibleJava"/>
</XModelAttribute>
<XModelAttribute PROPERTIES="category=general" name="scope" xmlname="scope">
- <Constraint loader="List">
+ <Constraint loader="%ListEL%">
<value/>
<value name="stateless"/>
<value name="event"/>
@@ -1385,10 +1421,19 @@
</Constraint>
<Editor name="List"/>
</XModelAttribute>
- <XModelAttribute PROPERTIES="category=advanced" name="precedence" xmlname="precedence"/>
+ <XModelAttribute PROPERTIES="category=advanced" name="precedence" xmlname="precedence">
+ <Constraint loader="%ListIntEL%">
+ <value name=""/>
+ <value name="BUILT_IN"/>
+ <value name="FRAMEWORK"/>
+ <value name="APPLICATION"/>
+ <value name="DEPLOYMENT"/>
+ <value name="MOCK"/>
+ </Constraint>
+ </XModelAttribute>
<XModelAttribute PROPERTIES="category=advanced"
default="default(true)" name="installed" xmlname="installed">
- <Constraint loader="ListString">
+ <Constraint loader="%ListEL%">
<value name="default(true)"/>
<value name="true"/>
<value name="false"/>
@@ -1397,7 +1442,7 @@
</XModelAttribute>
<XModelAttribute PROPERTIES="category=advanced"
default="default(false)" name="auto-create" xmlname="auto-create">
- <Constraint loader="ListString">
+ <Constraint loader="%ListEL%">
<value name="default(false)"/>
<value name="true"/>
<value name="false"/>
@@ -1406,7 +1451,7 @@
</XModelAttribute>
<XModelAttribute PROPERTIES="category=advanced"
default="default(false)" name="startup" xmlname="startup">
- <Constraint loader="ListString">
+ <Constraint loader="%ListEL%">
<value name="default(false)"/>
<value name="true"/>
<value name="false"/>
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-core.meta
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-core.meta 2008-10-07 15:55:01 UTC (rev 10714)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-core.meta 2008-10-07 15:56:50 UTC (rev 10715)
@@ -747,6 +747,77 @@
</XModelEntity>
<XModelEntity ImplementingClass="%Custom%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.seam.xml.ui.editor.form.core.SeamComponentsCoreFormLayoutData"
+ XMLSUBPATH="core:init" name="SeamCoreInit21">
+ <XChildrenEntities>
+ <XChildEntity maxCount="1" name="SeamCoreInterceptors" required="yes"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.seam.core.init" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="init" loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="id=true;category=general"
+ default="org.jboss.seam.core.init" name="name" xmlname="name"/>
+ <XModelAttributeReference
+ attributes="class,scope,precedence,installed,auto-create,startup"
+ entity="SeamComponent20" name="component"/>
+ <XModelAttributeReference
+ attributes="debug,jndi-pattern,transaction-management-enabled,user-transaction-name"
+ entity="SeamCoreInit20" name="init"/>
+ <XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem kind="list" name="CreateActions"/>
+ <XActionItem ICON="action.empty" displayName="Create" kind="list" name="EditActions"/>
+ <XActionItemReference entity="SeamCoreInit20" name="CopyActions" path="CopyActions"/>
+ <XActionItemReference entity="SeamCoreInit20" name="DeleteActions" path="DeleteActions"/>
+ <XActionItemReference entity="SeamCoreInit20" name="Properties" path="Properties"/>
+ <XActionItemReference entity="SeamCoreInit20" name="MoveActions" path="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%Custom%"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.seam.xml.ui.editor.form.core.SeamComponentsCoreFormLayoutData;children=%Ordered%;childrenLoader=list;saveDefault=false"
+ XMLSUBPATH="core:interceptors" name="SeamCoreInterceptors">
+ <XChildrenEntities>
+ <XChildEntity name="SeamListEntry"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.seam.property" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="interceptors" loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="id=true;category=general"
+ default="interceptors" name="name">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItemReference entity="SeamCoreBundleNames"
+ name="CreateActions" path="CreateActions"/>
+ <XActionItemReference entity="SeamCoreBundleNames" name="CopyActions" path="CopyActions"/>
+ <XActionItemReference entity="SeamCoreBundleNames"
+ name="DeleteActions" path="DeleteActions"/>
+ <XActionItemReference entity="SeamCoreBundleNames" name="Properties" path="Properties"/>
+ <XActionItemReference entity="SeamCoreBundleNames" name="MoveActions" path="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%Custom%"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.seam.xml.ui.editor.form.core.SeamComponentsCoreFormLayoutData"
XMLSUBPATH="core:jbpm" name="SeamCoreJBPM">
<XChildrenEntities>
<XChildEntity maxCount="1" name="SeamCoreProcessDefinitions" required="yes"/>
@@ -959,6 +1030,52 @@
</XModelEntity>
<XModelEntity ImplementingClass="%Custom%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.seam.xml.ui.editor.form.core.SeamComponentsCoreFormLayoutData"
+ XMLSUBPATH="core:manager" name="SeamCoreManager21">
+ <XChildrenEntities/>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.seam.core.manager" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="manager" loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="id=true;category=general"
+ default="org.jboss.seam.core.manager" name="name" xmlname="name"/>
+ <XModelAttributeReference
+ attributes="class,scope,precedence,installed,auto-create"
+ entity="SeamComponent" name="component"/>
+ <XModelAttributeReference
+ attributes="conversation-timeout,concurrent-request-timeout,conversation-id-parameter,parent-conversation-id-parameter"
+ entity="SeamCoreManager" name="manager"/>
+ <XModelAttribute PROPERTIES="category=advanced" name="uri-encoding" xmlname="uri-encoding"/>
+ <XModelAttribute PROPERTIES="category=advanced"
+ name="default-flush-mode" xmlname="default-flush-mode">
+ <Constraint loader="List">
+ <value/>
+ <value name="MANUAL"/>
+ <value name="AUTO"/>
+ <value name="COMMIT"/>
+ </Constraint>
+ <Editor name="List"/>
+ </XModelAttribute>
+ <XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem kind="list" name="CreateActions"/>
+ <XActionItem ICON="action.empty" displayName="Create" kind="list" name="EditActions"/>
+ <XActionItemReference entity="SeamCoreManager" name="CopyActions" path="CopyActions"/>
+ <XActionItemReference entity="SeamCoreManager" name="DeleteActions" path="DeleteActions"/>
+ <XActionItemReference entity="SeamCoreManager" name="Properties" path="Properties"/>
+ <XActionItemReference entity="SeamCoreManager" name="MoveActions" path="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%Custom%"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.seam.xml.ui.editor.form.core.SeamComponentsCoreFormLayoutData"
XMLSUBPATH="core:microcontainer" name="SeamCoreMicrocontainer">
<XChildrenEntities/>
<XEntityRenderer>
@@ -1891,8 +2008,8 @@
</XEntityExtension>
<XEntityExtension name="FileSeamComponents21">
<XChildrenEntities>
- <XChildEntity name="SeamCoreInit20"/>
- <XChildEntity name="SeamCoreManager"/>
+ <XChildEntity name="SeamCoreInit21"/>
+ <XChildEntity name="SeamCoreManager21"/>
<XChildEntity name="SeamCorePojoCache"/>
<XChildEntity name="SeamCoreResourceLoader20"/>
<XChildEntity name="SeamBPMActor20"/>
@@ -1906,7 +2023,7 @@
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
displayName="Init..." kind="action" name="AddInit">
- <EntityData EntityName="SeamCoreInit20">
+ <EntityData EntityName="SeamCoreInit21">
<AttributeData AttributeName="name"/>
<AttributeData AttributeName="jndi-pattern" Mandatory="no"/>
<AttributeData AttributeName="debug" Mandatory="no"/>
@@ -1915,7 +2032,7 @@
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
displayName="Manager..." kind="action" name="AddManager">
- <EntityData EntityName="SeamCoreManager">
+ <EntityData EntityName="SeamCoreManager21">
<AttributeData AttributeName="name"/>
<AttributeData AttributeName="conversation-timeout" Mandatory="no"/>
</EntityData>
Added: trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/ELConstraint.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/ELConstraint.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/ELConstraint.java 2008-10-07 15:56:50 UTC (rev 10715)
@@ -0,0 +1,40 @@
+package org.jboss.tools.seam.xml.components.model.constraint;
+
+import org.jboss.tools.common.meta.constraint.XAttributeConstraint;
+import org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintImpl;
+
+public class ELConstraint extends XAttributeConstraintImpl {
+ public static ELConstraint INSTANCE = new ELConstraint();
+
+ public static XAttributeConstraint getInstance() {
+ return INSTANCE;
+ }
+
+ public boolean accepts(String value) {
+ if(value != null) {
+ if(value.startsWith("#{") && value.endsWith("}")) {
+ return true;
+ }
+ if(value.length() >= 2 && value.startsWith("@") && value.endsWith("@")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns not null only if value starts with EL tokens.
+ */
+ public String getError(String value) {
+ if(accepts(value)) return null;
+ if(value.startsWith("#{")) {
+ return "value is not a correct EL.";
+ }
+ if(value.startsWith("@")) {
+ return "value is not a correct property.";
+ }
+
+ return super.getError(value);
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/IntELConstraint.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/IntELConstraint.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/IntELConstraint.java 2008-10-07 15:56:50 UTC (rev 10715)
@@ -0,0 +1,23 @@
+package org.jboss.tools.seam.xml.components.model.constraint;
+
+import org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintInt;
+
+public class IntELConstraint extends XAttributeConstraintInt {
+
+ public boolean accepts(String value) {
+ if(ELConstraint.getInstance().accepts(value)) {
+ return true;
+ }
+ return super.accepts(value);
+ }
+
+ public String getError(String value) {
+ if(accepts(value)) return null;
+ String error = ELConstraint.getInstance().getError(value);
+ if(error != null) {
+ return error;
+ }
+ return super.getError(value);
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/ListELConstraint.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/ListELConstraint.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/ListELConstraint.java 2008-10-07 15:56:50 UTC (rev 10715)
@@ -0,0 +1,23 @@
+package org.jboss.tools.seam.xml.components.model.constraint;
+
+import org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintList;
+
+public class ListELConstraint extends XAttributeConstraintList {
+
+ public boolean accepts(String value) {
+ if(ELConstraint.getInstance().accepts(value)) {
+ return true;
+ }
+ return super.accepts(value);
+ }
+
+ public String getError(String value) {
+ if(accepts(value)) return null;
+ String error = ELConstraint.getInstance().getError(value);
+ if(error != null) {
+ return error;
+ }
+ return super.getError(value);
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/ListIntELConstraint.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/ListIntELConstraint.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/constraint/ListIntELConstraint.java 2008-10-07 15:56:50 UTC (rev 10715)
@@ -0,0 +1,23 @@
+package org.jboss.tools.seam.xml.components.model.constraint;
+
+import org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintListInt;
+
+public class ListIntELConstraint extends XAttributeConstraintListInt {
+
+ public boolean accepts(String value) {
+ if(ELConstraint.getInstance().accepts(value)) {
+ return true;
+ }
+ return super.accepts(value);
+ }
+
+ public String getError(String value) {
+ if(accepts(value)) return null;
+ String error = ELConstraint.getInstance().getError(value);
+ if(error != null) {
+ return error;
+ }
+ return super.getError(value);
+ }
+
+}
16 years, 3 months
JBoss Tools SVN: r10714 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-10-07 11:55:01 -0400 (Tue, 07 Oct 2008)
New Revision: 10714
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/XAttributeImpl.java
Log:
JBIDE-2855
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/XAttributeImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/XAttributeImpl.java 2008-10-07 15:41:19 UTC (rev 10713)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/XAttributeImpl.java 2008-10-07 15:55:01 UTC (rev 10714)
@@ -165,6 +165,9 @@
if(!XMetaDataLoader.hasAttribute(element, LOADER) || loader.trim().length() == 0) {
loader = "";
}
+ if(loader != null && loader.startsWith("%")) {
+ loader = expand(loader, "AttributeConstraints");
+ }
constraint.init(loader, element);
}
16 years, 3 months