JBoss Tools SVN: r37943 - trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2012-01-18 10:57:06 -0500 (Wed, 18 Jan 2012)
New Revision: 37943
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/Messages.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/messages.properties
Log:
https://issues.jboss.org/browse/JBIDE-10555 : Browsersim should have a "open in default browser" action
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-01-18 13:48:58 UTC (rev 37942)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-01-18 15:57:06 UTC (rev 37943)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.vpe.browsersim.ui;
+import java.awt.Desktop;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
@@ -120,13 +121,7 @@
try {
skin.createControls(display);
} catch (SWTError e) {
- System.err.println(Messages.BrowserSim_COULD_NOT_INSTANTIATE_WEBKIT_BROWSER + e.getMessage());
-
- MessageBox messageBox = new MessageBox(new Shell(display), SWT.OK | SWT.ICON_ERROR);
- messageBox.setText("Error");
- messageBox.setMessage(Messages.BrowserSim_COULD_NOT_INSTANTIATE_WEBKIT_BROWSER + e.getMessage());
- messageBox.open();
-
+ showErrorMessage(new Shell(display), Messages.BrowserSim_COULD_NOT_INSTANTIATE_WEBKIT_BROWSER + e.getMessage());
display.dispose();
return;
}
@@ -265,8 +260,10 @@
});
}
- private void addFileMenuItems(Menu file) {
- MenuItem exit = new MenuItem(file, SWT.PUSH);
+ private void addFileMenuItems(Menu menu) {
+ addOpenInDefaultBrowserItem(menu);
+
+ MenuItem exit = new MenuItem(menu, SWT.PUSH);
exit.setText(Messages.BrowserSim_EXIT);
exit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -293,6 +290,33 @@
});
}
+ public void addOpenInDefaultBrowserItem(Menu menu) {
+ if (Desktop.isDesktopSupported()) {
+ if (Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
+ MenuItem openInDefaultBrowser = new MenuItem(menu, SWT.PUSH);
+ openInDefaultBrowser.setText(Messages.BrowserSim_OPEN_IN_DEFAULT_BROWSER);
+ openInDefaultBrowser.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ Desktop.getDesktop().browse(new URI(skin.getBrowser().getUrl()));
+ } catch (Exception e1) {
+ showErrorMessage(skin.getShell(), Messages.BrowserSim_COULD_NOT_OPEN_DEFAULT_BROWSER + e1.getMessage());
+ }
+ }
+ });
+ }
+ }
+ }
+
+ private void showErrorMessage(Shell shell, String message) {
+ System.err.println(message);
+
+ MessageBox messageBox = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
+ messageBox.setText(Messages.BrowserSim_ERROR);
+ messageBox.setMessage(message);
+ messageBox.open();
+ }
+
private void addDevicesListForMenu(final DevicesList devicesList, Menu devicesMenu) {
List<Device> devices = devicesList.getDevices();
for (int i = 0; i < devices.size(); i++) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/Messages.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/Messages.java 2012-01-18 13:48:58 UTC (rev 37942)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/Messages.java 2012-01-18 15:57:06 UTC (rev 37943)
@@ -20,11 +20,13 @@
public static String BrowserSim_ADDRESS;
public static String BrowserSim_BROWSER_SIM;
public static String BrowserSim_COULD_NOT_INSTANTIATE_WEBKIT_BROWSER;
+ public static String BrowserSim_COULD_NOT_OPEN_DEFAULT_BROWSER;
public static String BrowserSim_DEVICES;
public static String BrowserSim_ERROR;
public static String BrowserSim_EXIT;
public static String BrowserSim_FILE;
public static String BrowserSim_MORE;
+ public static String BrowserSim_OPEN_IN_DEFAULT_BROWSER;
public static String BrowserSim_TURN_LEFT;
public static String BrowserSim_TURN_RIGHT;
public static String EditDeviceDialog_CANCEL;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/messages.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/messages.properties 2012-01-18 13:48:58 UTC (rev 37942)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/messages.properties 2012-01-18 15:57:06 UTC (rev 37943)
@@ -1,11 +1,13 @@
BrowserSim_ADDRESS=Address
BrowserSim_BROWSER_SIM=BrowserSim
-BrowserSim_COULD_NOT_INSTANTIATE_WEBKIT_BROWSER=Could not instantiate WebKit Browser:
+BrowserSim_COULD_NOT_INSTANTIATE_WEBKIT_BROWSER=Could not instantiate WebKit Browser:
+BrowserSim_COULD_NOT_OPEN_DEFAULT_BROWSER=Could not open default browser:
BrowserSim_DEVICES=Devices
BrowserSim_ERROR=Error
BrowserSim_EXIT=Exit
BrowserSim_FILE=File
BrowserSim_MORE=More...
+BrowserSim_OPEN_IN_DEFAULT_BROWSER=Open in default browser
BrowserSim_TURN_LEFT=Turn Left
BrowserSim_TURN_RIGHT=Turn Right
EditDeviceDialog_CANCEL=Cancel
12 years, 12 months
JBoss Tools SVN: r37942 - trunk/download.jboss.org/jbosstools/examples.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-01-18 08:48:58 -0500 (Wed, 18 Jan 2012)
New Revision: 37942
Modified:
trunk/download.jboss.org/jbosstools/examples/project-examples-jbds50.xml
Log:
JBIDE-10629 : restored category name to JBDS 5 examples
Modified: trunk/download.jboss.org/jbosstools/examples/project-examples-jbds50.xml
===================================================================
--- trunk/download.jboss.org/jbosstools/examples/project-examples-jbds50.xml 2012-01-18 13:27:48 UTC (rev 37941)
+++ trunk/download.jboss.org/jbosstools/examples/project-examples-jbds50.xml 2012-01-18 13:48:58 UTC (rev 37942)
@@ -1,6 +1,6 @@
<projects>
<project>
- <category>JBoss Quickstarts</category>
+ <category>JBoss AS 7 Quickstarts</category>
<name>helloworld</name>
<included-projects>jboss-as-helloworld</included-projects>
<shortDescription>Helloworld</shortDescription>
@@ -43,7 +43,7 @@
</project>
<project>
- <category>JBoss Quickstarts</category>
+ <category>JBoss AS 7 Quickstarts</category>
<name>helloworld-osgi</name>
<included-projects>jboss-as-helloworld-osgi</included-projects>
<shortDescription>Helloworld OSGi Example</shortDescription>
@@ -89,7 +89,7 @@
<project>
- <category>JBoss Quickstarts</category>
+ <category>JBoss AS 7 Quickstarts</category>
<name>login</name>
<included-projects>jboss-as-login</included-projects>
<shortDescription>Login</shortDescription>
@@ -132,7 +132,7 @@
</project>
<project>
- <category>JBoss Quickstarts</category>
+ <category>JBoss AS 7 Quickstarts</category>
<name>numberguess</name>
<included-projects>jboss-as-numberguess</included-projects>
<shortDescription>Numberguess</shortDescription>
@@ -175,7 +175,7 @@
</project>
<project>
- <category>JBoss Quickstarts</category>
+ <category>JBoss AS 7 Quickstarts</category>
<name>kitchensink</name>
<included-projects>jboss-as-kitchensink</included-projects>
<shortDescription>Kitchensink</shortDescription>
@@ -218,7 +218,7 @@
<icon path="icons/jbossas7.png" />
</project>
<project>
- <category>JBoss Quickstarts</category>
+ <category>JBoss AS 7 Quickstarts</category>
<name>poh5-helloworld</name>
<included-projects>poh5-helloworld</included-projects>
<shortDescription>HTML5</shortDescription>
12 years, 12 months
JBoss Tools SVN: r37941 - trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-01-18 08:27:48 -0500 (Wed, 18 Jan 2012)
New Revision: 37941
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/XHTMLDetectorAndValidatorTest.java
Log:
JBIDE-10472
CLONE - XHTML Validator hangs eclipse
JUnit Test org.jboss.tools.jsf.test.validation.XHTMLDetectorAndValidatorTest is updated
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/XHTMLDetectorAndValidatorTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/XHTMLDetectorAndValidatorTest.java 2012-01-18 13:24:53 UTC (rev 37940)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/XHTMLDetectorAndValidatorTest.java 2012-01-18 13:27:48 UTC (rev 37941)
@@ -17,6 +17,7 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.wst.validation.ValidationResult;
import org.eclipse.wst.validation.ValidationState;
+import org.eclipse.wst.validation.internal.core.Message;
import org.jboss.tools.common.base.test.validation.TestUtil;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.jsf.JSFModelPlugin;
@@ -34,24 +35,6 @@
protected static final String XHTML_FILE_NAME = "/XHTMLDetectorAndValidatorTest.xhtml";
protected static final String HTML_FILE_NAME = "/XHTMLDetectorAndValidatorTest.html";
- /*
- protected static Set<String> LOCALIZED_ERROR_MESSAGES = new HashSet<String>();
- static {
- LOCALIZED_ERROR_MESSAGES.add(MessageFormat.format(JSFValidationMessage.XHTML_VALIDATION_NO_END_TAG,
- XHTMLValidationTestMessages.XHTML_GOOD_TAGNAME));
- LOCALIZED_ERROR_MESSAGES.add(MessageFormat.format(JSFValidationMessage.XHTML_VALIDATION_NO_START_TAG,
- XHTMLValidationTestMessages.XHTML_WRONG_TAGNAME));
- }
- protected static Set<String> LOCALIZED_LARGE_ERROR_MESSAGES = new HashSet<String>();
- static {
- LOCALIZED_LARGE_ERROR_MESSAGES.add(MessageFormat.format(JSFValidationMessage.XHTML_VALIDATION_NO_END_TAG,
- XHTMLValidationTestMessages.XHTML_LARGE_GOOD_TAGNAME));
- LOCALIZED_LARGE_ERROR_MESSAGES.add(MessageFormat.format(JSFValidationMessage.XHTML_VALIDATION_NO_START_TAG,
- XHTMLValidationTestMessages.XHTML_LARGE_WRONG_TAGNAME));
- }
- protected static String LOCALIZED_BROKEN_ERROR_MESSAGE = XHTMLValidationTestMessages.XHTML_MARKUP_IS_BROKEN_ERROR;
- */
-
// "Bad" file validation time should be not greater than "Good" file validation time multiplied by 10
protected static final double NOT_BAD_DIFF_PERCENTAGE = 1000.0;
@@ -108,6 +91,12 @@
assertNotNull("No validation result is returned", result.getReporter(null));
List messages = result.getReporter(null).getMessages();
System.out.println("Total error messages reported by XHTML file [Source: " + source + "] validation: " + (messages == null ? 0 : messages.size()));
+ int i = 0;
+ for (Object m : messages) {
+ assertTrue("Wrong type of validation message is returned", (m instanceof Message));
+ Message message = (Message)m;
+ System.out.println("Message #" + (++i) + ": " + message.getText());
+ }
}
} finally {
removeTestFile(XHTML_FILE_NAME);
@@ -139,83 +128,6 @@
} finally {
removeTestFile(HTML_FILE_NAME);
}
-
- /*
-
- long start = System.currentTimeMillis();
- ValidationResult result = validator.validate(file, IResourceDelta.CHANGED, state, new NullProgressMonitor());
- long goodValidationTime = System.currentTimeMillis() - start;
- System.out.println("XHTML file with good DOCTYPE declaration and no XHTML Syntax errors validation time: " + goodValidationTime + " ms");
- assertTrue("XHTML file with good DOCTYPE declaration and no XHTML Syntax errors validation takes too much time (more than " + MAX_VALIDATION_TIME + " ms)", (goodValidationTime < MAX_VALIDATION_TIME));
- assertNotNull("No validation result is returned", result);
- assertNotNull("No validation result is returned", result.getReporter(null));
- List messages = result.getReporter(null).getMessages();
- assertEquals("Wrong number of error messages reported", 0, messages == null ? 0 : messages.size());
-
- // Validate file with bad DOCTYPE declaration and no XHTML Syntax errors
- file = createTestFile(XHTMLValidationTestMessages.XHTML_CONTENT_TEMPLATE,
- XHTMLValidationTestMessages.XHTML_WRONG_PUBLIC_ID, XHTMLValidationTestMessages.XHTML_WRONG_URI,
- XHTMLValidationTestMessages.XHTML_GOOD_TAGNAME, XHTMLValidationTestMessages.XHTML_GOOD_TAGNAME);
- start = System.currentTimeMillis();
- result = validator.validate(file, IResourceDelta.CHANGED, state, new NullProgressMonitor());
- long badValidationTime = System.currentTimeMillis() - start;
- System.out.println("XHTML file with bad DOCTYPE declaration and no XHTML Syntax errors validation time: " + badValidationTime + " ms");
- assertTrue("XHTML file with bad DOCTYPE declaration and no XHTML Syntax errors validation takes too much time (more than " + MAX_VALIDATION_TIME + " ms)", (badValidationTime < MAX_VALIDATION_TIME));
- assertNotNull("No validation result is returned", result);
- assertNotNull("No validation result is returned", result.getReporter(null));
- messages = result.getReporter(null).getMessages();
- assertEquals("Wrong number of error messages reported", 0, messages == null ? 0 : messages.size());
-
- // Check that the difference between good and bad files validation time is not greater that NOT_BAD_DIFF_PERCENTAGE (%) of a good value
- double diff = 100*badValidationTime/goodValidationTime;
- System.out.println("(With no errors) Validation time difference: " + diff + "%");
- assertTrue("Validation time difference between good and wrong content is greater than " + NOT_BAD_DIFF_PERCENTAGE + "%", (diff < NOT_BAD_DIFF_PERCENTAGE));
-
- // Validate file with good DOCTYPE declaration and XHTML Syntax errors
- file = createTestFile(XHTMLValidationTestMessages.XHTML_CONTENT_TEMPLATE,
- XHTMLValidationTestMessages.XHTML_GOOD_PUBLIC_ID, XHTMLValidationTestMessages.XHTML_GOOD_URI,
- XHTMLValidationTestMessages.XHTML_GOOD_TAGNAME, XHTMLValidationTestMessages.XHTML_WRONG_TAGNAME);
- start = System.currentTimeMillis();
- result = validator.validate(file, IResourceDelta.CHANGED, state, new NullProgressMonitor());
- goodValidationTime = System.currentTimeMillis() - start;
- System.out.println("XHTML file with good DOCTYPE declaration and XHTML Syntax errors validation time: " + goodValidationTime + " ms");
- assertTrue("XHTML file with good DOCTYPE declaration and XHTML Syntax errors validation takes too much time (more than " + MAX_VALIDATION_TIME + " ms)", (goodValidationTime < MAX_VALIDATION_TIME));
- assertNotNull("No validation result is returned", result);
- assertNotNull("No validation result is returned", result.getReporter(null));
- messages = result.getReporter(null).getMessages();
- assertEquals("Wrong number of error messages reported", 2, messages == null ? 0 : messages.size());
- for (Object m : messages) {
- assertTrue("Wrong type of validation message is returned", (m instanceof Message));
- Message message = (Message)m;
- assertTrue("Unexpected error message found: " + message.getText(), LOCALIZED_ERROR_MESSAGES.contains(message.getText()));
- }
-
- // Validate file with bad DOCTYPE declaration and XHTML Syntax errors
- file = createTestFile(XHTMLValidationTestMessages.XHTML_CONTENT_TEMPLATE,
- XHTMLValidationTestMessages.XHTML_WRONG_PUBLIC_ID, XHTMLValidationTestMessages.XHTML_WRONG_URI,
- XHTMLValidationTestMessages.XHTML_GOOD_TAGNAME, XHTMLValidationTestMessages.XHTML_WRONG_TAGNAME);
- start = System.currentTimeMillis();
- result = validator.validate(file, IResourceDelta.CHANGED, state, new NullProgressMonitor());
- badValidationTime = System.currentTimeMillis() - start;
- System.out.println("XHTML file with bad DOCTYPE declaration and XHTML Syntax errors validation time: " + badValidationTime + " ms");
- assertTrue("XHTML file with bad DOCTYPE declaration and XHTML Syntax errors validation takes too much time (more than " + MAX_VALIDATION_TIME + " ms)", (badValidationTime < MAX_VALIDATION_TIME));
- assertNotNull("No validation result is returned", result);
- assertNotNull("No validation result is returned", result.getReporter(null));
- messages = result.getReporter(null).getMessages();
- assertEquals("Wrong number of error messages reported", 2, messages == null ? 0 : messages.size());
- for (Object m : messages) {
- assertTrue("Wrong type of validation message is returned", (m instanceof Message));
- Message message = (Message)m;
- assertTrue("Unexpected error message found: " + message.getText(), LOCALIZED_ERROR_MESSAGES.contains(message.getText()));
- }
- // Check that the difference between good and bad files validation time is not greater that NOT_BAD_DIFF_PERCENTAGE (%) of a good value
- diff = 100*badValidationTime/goodValidationTime;
- System.out.println("(With errors) Validation time difference: " + diff + "%");
- assertTrue("Validation time difference between good and wrong content is greater than " + NOT_BAD_DIFF_PERCENTAGE + "%", (diff < NOT_BAD_DIFF_PERCENTAGE));
- } finally {
- removeTestFile();
- }
- */
}
private static final String SOURCE_FOLDER = "/resources/pages2validate";
12 years, 12 months
JBoss Tools SVN: r37940 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-01-18 08:24:53 -0500 (Wed, 18 Jan 2012)
New Revision: 37940
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/XHTMLDetector.java
Log:
JBIDE-10472
CLONE - XHTML Validator hangs eclipse
The detector for XHTML documents is improved
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/XHTMLDetector.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/XHTMLDetector.java 2012-01-18 13:23:50 UTC (rev 37939)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/XHTMLDetector.java 2012-01-18 13:24:53 UTC (rev 37940)
@@ -87,11 +87,18 @@
return false;
if (!hasOneOfTokens(docTypePublicId, VALID_DOCTYPE_DTD_DECLARATION_ONE_OF_TOKENS))
return false;
+ return true;
}
}
if (ELEMENT_TOKEN.equals(token.getType())) {
- if (docTypeFound) {
- if (elementName == null)
+
+/*
+ * These checks are removed because of many pages (many of them I've found at www.oracle.com)
+ * which aren't define xmlns="http://www.w3.org/1999/xhtml" attribute, but normally parsed by browsers
+ * So, we'll just use doctype/root name check to see if it is the XHTML
+ */
+ if (docTypeFound) {
+ if (elementName == null)
return false;
String name = elementName.substring(elementName.indexOf(':') + 1); // Cut the prefix off
@@ -106,7 +113,7 @@
if (!VALID_ELEMENT_XMLNS_ATTRIBUTE_VALUE.equals(Utils.trimQuotes(value).toLowerCase()))
return false;
return true;
- } else {
+/* } else {
if (!elementAttributes.containsKey(VALID_ELEMENT_XMLNS_ATTRIBUTE))
continue;
@@ -115,7 +122,9 @@
if (!VALID_ELEMENT_XMLNS_ATTRIBUTE_VALUE.equals(Utils.trimQuotes(value).toLowerCase()))
continue;
return true;
+*/
}
+ return false;
}
}
return false;
@@ -124,8 +133,13 @@
private boolean hasAllTokens(String publicId, String[] reqiured) {
if (publicId == null) return false;
for (String r : reqiured) {
- if (publicId.indexOf(r) == -1)
+ int idx = publicId.indexOf(r);
+ if (idx == -1)
return false;
+ if (publicId.length() < idx + r.length() + 1)
+ return false;
+ if (Character.isJavaIdentifierPart(publicId.charAt(idx + r.length())))
+ return false;
}
return true;
}
@@ -133,7 +147,13 @@
if (publicId == null) return false;
boolean found = false;
for (String r : oneOf) {
- if (publicId.indexOf(r) != -1) {
+ int idx = publicId.indexOf(r);
+ if (idx != -1) {
+ if (publicId.length() >= idx + r.length() + 1) {
+ if (Character.isJavaIdentifierPart(publicId.charAt(idx + r.length())))
+ continue;
+ }
+
if (found)
return false; // Contains more than one token
found = true;
@@ -142,26 +162,13 @@
return found;
}
- private static final int STATE_START = 0;
+ private static final int STATE_START = 0;
private static final int STATE_ELEMENT = 1;
- private static final int STATE_ELEMENT_END = 2;
-
- private static final int STATE_XML_DECL = 3;
- private static final int STATE_XML_DECL_END = 4;
-
- private static final int STATE_DECL = 5;
- private static final int STATE_DECL_NAME = 6;
- private static final int STATE_DECL_ROOT = 7;
- private static final int STATE_DECL_PUBLIC = 8;
- private static final int STATE_DECL_SYSTEM = 9;
- private static final int STATE_DECL_PUBLIC_ID = 10;
- private static final int STATE_DECL_SYSTEM_ID = 11;
- private static final int STATE_DECL_END = 12;
+ private static final int STATE_XML_DECL = 2;
+ private static final int STATE_DECL = 3;
+ private static final int STATE_COMMENT = 4;
+ private static final int STATE_END = 5;
- private static final int STATE_COMMENT = 13;
- private static final int STATE_COMMENT_END = 14;
- private static final int STATE_END = 15;
-
private int state;
private String declName;
12 years, 12 months
JBoss Tools SVN: r37939 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-01-18 08:23:50 -0500 (Wed, 18 Jan 2012)
New Revision: 37939
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFValidationMessage.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/messages.properties
Log:
JBIDE-10472
CLONE - XHTML Validator hangs eclipse
JUnit Test org.jboss.tools.jsf.test.validation.XHTMLValidatorTest is made up-to-date according to new XHTML/Non-XHTML file detection algorithm and XHTML validator
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFValidationMessage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFValidationMessage.java 2012-01-18 13:23:21 UTC (rev 37938)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFValidationMessage.java 2012-01-18 13:23:50 UTC (rev 37939)
@@ -16,6 +16,7 @@
public static String XHTML_VALIDATION;
public static String XHTML_VALIDATION_NO_START_TAG;
public static String XHTML_VALIDATION_NO_END_TAG;
+ public static String XHTML_VALIDATION_BAD_ENTITY;
public static String VIEW_ID_NO_SLASH;
public static String TO_VIEW_ID_EMPTY;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/messages.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/messages.properties 2012-01-18 13:23:21 UTC (rev 37938)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/messages.properties 2012-01-18 13:23:50 UTC (rev 37939)
@@ -9,7 +9,9 @@
XHTML_VALIDATION=XHTML Syntax Validation: {0}
XHTML_VALIDATION_NO_START_TAG=No start tag for element "{0}"
-XHTML_VALIDATION_NO_END_TAG=No end tag for element "{0}"
+#XHTML_VALIDATION_NO_END_TAG=No end tag for element "{0}"
+XHTML_VALIDATION_NO_END_TAG=The element type "{0}" must be terminated by the matching end-tag "</{0}>".
+XHTML_VALIDATION_BAD_ENTITY=The entity name must immediately follow the '&' in the entity reference.
VIEW_ID_NO_SLASH=Attribute {0} must start with \/
TO_VIEW_ID_EMPTY=Attribute {0} must not be empty
12 years, 12 months
JBoss Tools SVN: r37938 - trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-01-18 08:23:21 -0500 (Wed, 18 Jan 2012)
New Revision: 37938
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/XHTMLValidatorTest.java
Log:
JBIDE-10472
CLONE - XHTML Validator hangs eclipse
JUnit Test org.jboss.tools.jsf.test.validation.XHTMLValidatorTest is made up-to-date according to new XHTML/Non-XHTML file detection algorithm and XHTML validator
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/XHTMLValidatorTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/XHTMLValidatorTest.java 2012-01-18 12:44:14 UTC (rev 37937)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/XHTMLValidatorTest.java 2012-01-18 13:23:21 UTC (rev 37938)
@@ -58,14 +58,15 @@
XHTMLValidationTestMessages.XHTML_LARGE_GOOD_TAGNAME));
LOCALIZED_LARGE_ERROR_MESSAGES.add(MessageFormat.format(JSFValidationMessage.XHTML_VALIDATION_NO_START_TAG,
XHTMLValidationTestMessages.XHTML_LARGE_WRONG_TAGNAME));
+ LOCALIZED_LARGE_ERROR_MESSAGES.add(JSFValidationMessage.XHTML_VALIDATION_BAD_ENTITY);
}
protected static String LOCALIZED_BROKEN_ERROR_MESSAGE = XHTMLValidationTestMessages.XHTML_MARKUP_IS_BROKEN_ERROR;
// "Bad" file validation time should be not greater than "Good" file validation time multiplied by 10
- protected static final double NOT_BAD_DIFF_PERCENTAGE = 1000.0;
+ protected static final double NOT_BAD_DIFF_PERCENTAGE = 2000.0;
// Each validation session should take less that 1 second (1000ms)
- protected static final long MAX_VALIDATION_TIME = 1000;
+ protected static final long MAX_VALIDATION_TIME = 2000;
IProject project;
@@ -130,7 +131,7 @@
assertNotNull("No validation result is returned", result);
assertNotNull("No validation result is returned", result.getReporter(null));
messages = result.getReporter(null).getMessages();
- assertEquals("Wrong number of error messages reported", 2, messages == null ? 0 : messages.size());
+ assertEquals("Wrong number of error messages reported", 1, messages == null ? 0 : messages.size());
for (Object m : messages) {
assertTrue("Wrong type of validation message is returned", (m instanceof Message));
Message message = (Message)m;
@@ -149,7 +150,7 @@
assertNotNull("No validation result is returned", result);
assertNotNull("No validation result is returned", result.getReporter(null));
messages = result.getReporter(null).getMessages();
- assertEquals("Wrong number of error messages reported", 2, messages == null ? 0 : messages.size());
+ assertEquals("Wrong number of error messages reported", 0, messages == null ? 0 : messages.size());
for (Object m : messages) {
assertTrue("Wrong type of validation message is returned", (m instanceof Message));
Message message = (Message)m;
@@ -198,7 +199,7 @@
assertNotNull("No validation result is returned", result);
assertNotNull("No validation result is returned", result.getReporter(null));
messages = result.getReporter(null).getMessages();
- assertEquals("Wrong number of error messages reported", 1, messages == null ? 0 : messages.size());
+ assertEquals("Wrong number of error messages reported", 0, messages == null ? 0 : messages.size());
for (Object m : messages) {
assertTrue("Wrong type of validation message is returned", (m instanceof Message));
Message message = (Message)m;
@@ -207,7 +208,7 @@
}
// Check that the difference between good and bad files validation time is not greater that NOT_BAD_DIFF_PERCENTAGE (%) of a good value
- double diff = 100*badValidationTime/goodValidationTime;
+ double diff = 100*(badValidationTime+1)/(goodValidationTime + 1);
System.out.println("(With broken content) Validation time difference: " + diff + "%");
assertTrue("Validation time difference between good and wrong DOCTYPE declaration is greater than " + NOT_BAD_DIFF_PERCENTAGE + "%", (diff < NOT_BAD_DIFF_PERCENTAGE));
} finally {
@@ -231,7 +232,7 @@
assertNotNull("No validation result is returned", result);
assertNotNull("No validation result is returned", result.getReporter(null));
List messages = result.getReporter(null).getMessages();
- assertEquals("Wrong number of error messages reported", 0, messages == null ? 0 : messages.size());
+ assertEquals("Wrong number of error messages reported", 1, messages == null ? 0 : messages.size());
// Validate file with bad DOCTYPE declaration and no XHTML Syntax errors
file = createTestFile(XHTMLValidationTestMessages.XHTML_LARGE_CONTENT_TEMPLATE,
@@ -248,7 +249,7 @@
assertEquals("Wrong number of error messages reported", 0, messages == null ? 0 : messages.size());
// Check that the difference between good and bad files validation time is not greater that NOT_BAD_DIFF_PERCENTAGE (%) of a good value
- double diff = 100*badValidationTime/goodValidationTime;
+ double diff = 100*(badValidationTime+1)/(goodValidationTime + 1);
System.out.println("(Large With no errors) Validation time difference: " + diff + "%");
assertTrue("Validation time difference between good and wrong content is greater than " + NOT_BAD_DIFF_PERCENTAGE + "%", (diff < NOT_BAD_DIFF_PERCENTAGE));
@@ -264,7 +265,7 @@
assertNotNull("No validation result is returned", result);
assertNotNull("No validation result is returned", result.getReporter(null));
messages = result.getReporter(null).getMessages();
- assertEquals("Wrong number of error messages reported", 180, messages == null ? 0 : messages.size());
+ assertEquals("Wrong number of error messages reported", 1, messages == null ? 0 : messages.size());
for (Object m : messages) {
assertTrue("Wrong type of validation message is returned", (m instanceof Message));
Message message = (Message)m;
@@ -284,7 +285,7 @@
assertNotNull("No validation result is returned", result);
assertNotNull("No validation result is returned", result.getReporter(null));
messages = result.getReporter(null).getMessages();
- assertEquals("Wrong number of error messages reported", 180, messages == null ? 0 : messages.size());
+ assertEquals("Wrong number of error messages reported", 0, messages == null ? 0 : messages.size());
for (Object m : messages) {
assertTrue("Wrong type of validation message is returned", (m instanceof Message));
Message message = (Message)m;
@@ -292,7 +293,7 @@
assertTrue("Unexpected error message found: " + message.getText(), LOCALIZED_LARGE_ERROR_MESSAGES.contains(message.getText()));
}
// Check that the difference between good and bad files validation time is not greater that NOT_BAD_DIFF_PERCENTAGE (%) of a good value
- diff = 100*badValidationTime/goodValidationTime;
+ diff = 100*(badValidationTime+1)/(goodValidationTime + 1);
System.out.println("(Large With errors) Validation time difference: " + diff + "%");
assertTrue("Validation time difference between good and wrong content is greater than " + NOT_BAD_DIFF_PERCENTAGE + "%", (diff < NOT_BAD_DIFF_PERCENTAGE));
} finally {
12 years, 12 months
JBoss Tools SVN: r37937 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-01-18 07:44:14 -0500 (Wed, 18 Jan 2012)
New Revision: 37937
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java
Log:
JBIDE-10490 - further fix after a UI test
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java 2012-01-18 12:30:42 UTC (rev 37936)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java 2012-01-18 12:44:14 UTC (rev 37937)
@@ -41,6 +41,7 @@
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.Messages;
/**
@@ -79,7 +80,7 @@
Label username = toolkit.createLabel(composite, Messages.swf_Username);
username.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
String n = helper.getAttribute(IJBossToolingConstants.SERVER_USERNAME, ""); //$NON-NLS-1$
- String p = helper.getAttribute(IJBossToolingConstants.SERVER_PASSWORD, ""); //$NON-NLS-1$
+ String p = ServerConverter.getJBossServer(server.getOriginal()).getPassword();
nameText = toolkit.createText(composite, n);
Label password = toolkit.createLabel(composite, Messages.swf_Password);
password.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
@@ -140,6 +141,8 @@
* @param monitor the progress monitor for the save operation.
*/
public void doSave(IProgressMonitor monitor) {
+ JBossServer jbs = ServerConverter.getJBossServer(server.getOriginal());
+ jbs.setPassword(passwordString);
monitor.worked(100);
}
12 years, 12 months
JBoss Tools SVN: r37936 - trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2012-01-18 07:30:42 -0500 (Wed, 18 Jan 2012)
New Revision: 37936
Modified:
trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java
Log:
JBIDE-9999: Forge Launch Configurations Don't Get Deleted
Modified: trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java 2012-01-18 09:24:06 UTC (rev 37935)
+++ trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java 2012-01-18 12:30:42 UTC (rev 37936)
@@ -32,7 +32,8 @@
ILaunchConfiguration[] configurations = LAUNCH_MANAGER.getLaunchConfigurations(JAVA_LAUNCH_CONFIGURATION_TYPE);
for (int i = 0; i < configurations.length; i++) {
ILaunchConfiguration configuration = configurations[i];
- if (configuration.getName().equals(name)) {
+ String configName = configuration.getName();
+ if (configName.startsWith(name)) {
configuration.delete();
break;
}
12 years, 12 months
JBoss Tools SVN: r37935 - in trunk: central/plugins/org.jboss.tools.central/src/org/jboss/tools/central and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-01-18 04:24:06 -0500 (Wed, 18 Jan 2012)
New Revision: 37935
Removed:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/Tutorial.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/TutorialCategory.java
Modified:
trunk/central/plugins/org.jboss.tools.central/plugin.xml
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossTutorialsHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshTutorialsJob.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Category.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
Log:
JBIDE-10641 : Replace hard coded tutorials in central with a tag-based search
Modified: trunk/central/plugins/org.jboss.tools.central/plugin.xml
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/plugin.xml 2012-01-18 09:20:13 UTC (rev 37934)
+++ trunk/central/plugins/org.jboss.tools.central/plugin.xml 2012-01-18 09:24:06 UTC (rev 37935)
@@ -221,58 +221,5 @@
commandId="org.jboss.tools.central.newProjectExamplesWizard"
icon="icons/examples_wiz.gif">
</image>
- </extension>
-
- <extension
- point="org.jboss.tools.central.tutorials">
- <category
- id="org.jboss.tools.central.javaee6.quickstart"
- name="Java EE Archetypes"
- priority="1" />
- <tutorial
- id="org.jboss.tools.central.jbossas.quickstart.jbossJavaee6Webapp"
- categoryId="org.jboss.tools.central.javaee6.quickstart"
- name="Java EE Web Project"
- type="projectExample"
- priority="1"
- icon="icons/newwebprj_wiz.gif"
- reference="Java EE 6 Quickstarts::jboss-javaee6-webapp"/>
-
- <tutorial
- id="org.jboss.tools.central.jbossas.quickstart.jbossJavaee6Ear"
- categoryId="org.jboss.tools.central.javaee6.quickstart"
- name="Java EE Project"
- type="projectExample"
- priority="2"
- icon="icons/ear-wiz-icon.gif"
- reference="Java EE 6 Quickstarts::multi-javaee6-archetype"/>
-
- <tutorial
- id="org.jboss.tools.central.jbossas.quickstart.jbossJavaee6Poh5"
- categoryId="org.jboss.tools.central.javaee6.quickstart"
- name="HTML5 Project"
- type="projectExample"
- priority="3"
- icon="icons/html5.png"
- reference="Java EE 6 Quickstarts::jboss-javaee6-poh5-archetype"/>
-
- <tutorial
- id="org.jboss.tools.central.jbossas.quickstart.jbossJavaee6SpringMvc"
- categoryId="org.jboss.tools.central.javaee6.quickstart"
- name="Spring MVC Project"
- type="projectExample"
- priority="4"
- icon="icons/spring_wiz.gif"
- reference="Java EE 6 Quickstarts::spring-mvc-webapp"/>
-
- <tutorial
- id="org.jboss.tools.central.jbossas.quickstart.jbossJavaee6Richfaces"
- categoryId="org.jboss.tools.central.javaee6.quickstart"
- name="RichFaces Project"
- type="projectExample"
- priority="5"
- icon="icons/rf_logo.png"
- reference="Java EE 6 Quickstarts::richfaces-archetype-simpleapp"/>
- </extension>
-
+ </extension>
</plugin>
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java 2012-01-18 09:20:13 UTC (rev 37934)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java 2012-01-18 09:24:06 UTC (rev 37935)
@@ -12,9 +12,7 @@
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.ArrayList;
import java.util.Dictionary;
-import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
@@ -59,8 +57,7 @@
import org.jboss.tools.central.configurators.IJBossCentralConfigurator;
import org.jboss.tools.central.editors.JBossCentralEditor;
import org.jboss.tools.central.editors.JBossCentralEditorInput;
-import org.jboss.tools.central.model.Tutorial;
-import org.jboss.tools.central.model.TutorialCategory;
+import org.jboss.tools.project.examples.model.Category;
import org.jboss.tools.project.examples.model.Project;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -133,10 +130,10 @@
public static final String SEARCH_RED_HAT_CUSTOMER_PORTAL = "Search Red Hat Customer Portal ";
- public Map<String, TutorialCategory> tutorialCategories;
-
private BundleContext bundleContext;
+ private Map<Category, List<Project>> tutorialCategories;
+
public static final int MAX_FEEDS = 100;
private static final Object CONFIGURATOR = "configurator";
@@ -180,7 +177,6 @@
plugin = null;
bundleContext = null;
- tutorialCategories = null;
super.stop(context);
}
@@ -405,92 +401,6 @@
return configurator;
}
- public Map<String, TutorialCategory> getTutorialCategories() {
- if (tutorialCategories == null) {
- tutorialCategories = new HashMap<String, TutorialCategory>();
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint extensionPoint = registry
- .getExtensionPoint(TUTORIALS_EXTENSION_ID);
- IExtension[] extensions = extensionPoint.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IExtension extension = extensions[i];
- IConfigurationElement[] configurationElements = extension
- .getConfigurationElements();
- for (int j = 0; j < configurationElements.length; j++) {
- IConfigurationElement configurationElement = configurationElements[j];
- if (CATEGORY.equals(configurationElement.getName())) {
- String name = configurationElement.getAttribute(NAME);
- String id = configurationElement.getAttribute(ID);
- String description = configurationElement
- .getAttribute(DESCRIPTION);
- String priorityString = configurationElement
- .getAttribute(PRIORITY);
- int priority = Integer.MAX_VALUE;
- if (priorityString != null) {
- try {
- priority = new Integer(priorityString)
- .intValue();
- } catch (NumberFormatException e) {
- log(e);
- }
- }
- TutorialCategory category = new TutorialCategory(id,
- name, priority, description);
- tutorialCategories.put(id, category);
- }
- }
- for (int j = 0; j < configurationElements.length; j++) {
- IConfigurationElement configurationElement = configurationElements[j];
- if (TUTORIAL.equals(configurationElement.getName())) {
- String name = configurationElement.getAttribute(NAME);
- String id = configurationElement.getAttribute(ID);
- String type = configurationElement.getAttribute(TYPE);
- String reference = configurationElement
- .getAttribute(REFERENCE);
- String priorityString = configurationElement
- .getAttribute(PRIORITY);
- String description = configurationElement
- .getAttribute(DESCRIPTION);
- String iconPath = configurationElement
- .getAttribute(ICON);
- int priority = Integer.MAX_VALUE;
- if (priorityString != null) {
- try {
- priority = new Integer(priorityString)
- .intValue();
- } catch (NumberFormatException e) {
- log(e);
- }
- }
- String categoryId = configurationElement
- .getAttribute(CATEGORY_ID);
- TutorialCategory category = tutorialCategories
- .get(categoryId);
- if (category == null) {
- log("Invalid tutorial: id=" + id);
- continue;
- }
- Tutorial tutorial = new Tutorial(id, name, type,
- reference, priority, category, description,
- iconPath);
- category.getTutorials().add(tutorial);
- }
- }
- }
- List<TutorialCategory> emptyCategories = new ArrayList<TutorialCategory>();
- for (TutorialCategory category : tutorialCategories.values()) {
- if (category.getTutorials().size() == 0) {
- emptyCategories.add(category);
- }
- }
- for (TutorialCategory category : emptyCategories) {
- tutorialCategories.remove(category.getId());
- }
- }
-
- return tutorialCategories;
- }
-
public Image getImage(String imagePath) {
ImageRegistry registry = getImageRegistry();
Image image = registry.get(imagePath);
@@ -503,23 +413,15 @@
return image;
}
- public void setTutorialCategories(
- Map<String, TutorialCategory> tutorialCategories) {
- this.tutorialCategories = tutorialCategories;
- }
-
- public String getDescription(Tutorial tutorial) {
- String description = tutorial.getDescription();
- Project project = tutorial.getProjectExamples();
- if (project.getDescription() != null) {
- description = project.getDescription();
- }
- StringBuffer buffer = new StringBuffer();
- buffer.append(description);
+ public String getDescription(Project project) {
+ StringBuilder buffer = new StringBuilder();
+ if (project.getDescription() != null) {
+ buffer.append(project.getDescription());
+ }
buffer.append("\n\n");
buffer.append("Size: ");
buffer.append(project.getSizeAsText());
- if (project.getUnsatisfiedFixes().size() > 0) {
+ if (project.getUnsatisfiedFixes() != null && project.getUnsatisfiedFixes().size() > 0) {
buffer.append("\n\n");
}
return buffer.toString();
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossTutorialsHandler.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossTutorialsHandler.java 2012-01-18 09:20:13 UTC (rev 37934)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/RefreshJBossTutorialsHandler.java 2012-01-18 09:24:06 UTC (rev 37935)
@@ -15,7 +15,6 @@
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.jobs.Job;
-import org.jboss.tools.central.JBossCentralActivator;
import org.jboss.tools.central.jobs.RefreshTutorialsJob;
/**
@@ -28,7 +27,6 @@
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
if (RefreshTutorialsJob.INSTANCE.getState() == Job.NONE) {
- JBossCentralActivator.getDefault().setTutorialCategories(null);
RefreshTutorialsJob.INSTANCE.schedule();
}
return null;
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java 2012-01-18 09:20:13 UTC (rev 37934)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java 2012-01-18 09:24:06 UTC (rev 37935)
@@ -12,6 +12,7 @@
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -62,7 +63,6 @@
import org.jboss.tools.central.JBossCentralActivator;
import org.jboss.tools.central.actions.JBossRuntimeDetectionPreferencesHandler;
import org.jboss.tools.central.editors.DescriptionToolTip;
-import org.jboss.tools.central.model.Tutorial;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.model.Project;
import org.jboss.tools.project.examples.model.ProjectFix;
@@ -76,7 +76,7 @@
*/
public class ProjectExamplesDialog extends FormDialog implements IRunnableContext {
- private Tutorial tutorial;
+ private Project tutorial;
private FormToolkit toolkit;
private ScrolledForm form;
private Composite fixesComposite;
@@ -85,11 +85,11 @@
private Control fLastControl;
private Set<Button> controls = new HashSet<Button>();
- public ProjectExamplesDialog(Shell parentShell, Tutorial tutorial) {
+ public ProjectExamplesDialog(Shell parentShell, Project project) {
super(parentShell);
setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
| SWT.RESIZE | getDefaultOrientation());
- this.tutorial = tutorial;
+ this.tutorial = project;
//setHelpAvailable(false);
}
@@ -100,7 +100,7 @@
toolkit = mform.getToolkit();
toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER);
form.getBody().setLayout(new GridLayout());
- form.setText(tutorial.getName());
+ form.setText(tutorial.getShortDescription());
Section descSection = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR|ExpandableComposite.EXPANDED);
descSection.setText("Description");
descSection.setLayout(new GridLayout());
@@ -140,16 +140,15 @@
controls.clear();
addButtons();
- Project project = tutorial.getProjectExamples();
- List<ProjectFix> fixes = project.getFixes();
+ List<ProjectFix> fixes = tutorial.getFixes();
List<ProjectFix> unsatisfiedFixes = new ArrayList<ProjectFix>();
- project.setUnsatisfiedFixes(unsatisfiedFixes);
+ tutorial.setUnsatisfiedFixes(unsatisfiedFixes);
for (ProjectFix fix:fixes) {
- if (!ProjectExamplesActivator.canFix(project, fix)) {
+ if (!ProjectExamplesActivator.canFix(tutorial, fix)) {
unsatisfiedFixes.add(fix);
}
}
- fixes = project.getUnsatisfiedFixes();
+ fixes = tutorial.getUnsatisfiedFixes();
disposeChildren(fixesComposite);
reqSection.setVisible(fixes.size() > 0);
if (fixes.size() > 0) {
@@ -511,9 +510,7 @@
@Override
protected void okPressed() {
super.okPressed();
- List<Project> selectedProjects = new ArrayList<Project>();
- selectedProjects.add(tutorial.getProjectExamples());
- ProjectExamplesActivator.importProjectExamples(selectedProjects, true);
+ ProjectExamplesActivator.importProjectExamples(Arrays.asList(tutorial), true);
}
}
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2012-01-18 09:20:13 UTC (rev 37934)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2012-01-18 09:24:06 UTC (rev 37935)
@@ -99,11 +99,8 @@
import org.jboss.tools.central.jobs.RefreshNewsJob;
import org.jboss.tools.central.jobs.RefreshTutorialsJob;
import org.jboss.tools.central.model.FeedsEntry;
-import org.jboss.tools.central.model.Tutorial;
-import org.jboss.tools.central.model.TutorialCategory;
-import org.jboss.tools.project.examples.ProjectExamplesActivator;
+import org.jboss.tools.project.examples.model.Category;
import org.jboss.tools.project.examples.model.Project;
-import org.jboss.tools.project.examples.model.ProjectFix;
import org.osgi.framework.Bundle;
/**
@@ -113,7 +110,6 @@
*/
public class GettingStartedPage extends AbstractJBossCentralPage {
- private static final String ORG_JBOSS_TOOLS_CENTRAL_JAVAEE6_QUICKSTART = "org.jboss.tools.central.javaee6.quickstart";
private static final String NEWS_WARNING_ID = "org.jboss.tools.central.newsWarning";
private static final String BLOGS_WARNING_ID = "org.jboss.tools.central.blogsWarning";
@@ -145,7 +141,7 @@
private Composite projectsComposite;
private Composite documentationComposite;
- private Set<TutorialCategory> expandedCategories = new HashSet<TutorialCategory>();
+ private Set<Category> expandedCategories = new HashSet<Category>();
private Section newsSection;
private ScrolledComposite newsScrollComposite;
private PageBook newsPageBook;
@@ -656,13 +652,8 @@
}
}
- private void displayTutorialLinks(final TutorialCategory category, final Composite composite, boolean addTooltips) {
- for (final Tutorial tutorial:category.getTutorials()) {
- Project project = tutorial.getProjectExamples();
- if (project == null) {
- continue;
- }
-
+ private void displayTutorialLinks(final Collection<Project> tutorials, final Composite composite, boolean addTooltips) {
+ for (final Project tutorial : tutorials) {
FormText tutorialText = toolkit.createFormText(composite, true);
configureTutorialText(tutorialText, tutorial);
if (addTooltips) {
@@ -879,7 +870,7 @@
showException(tutorialPageBook, tutorialsExceptionText, job.getException());
return;
}
- Map<String, TutorialCategory> categories = job.getTutorialCategories();
+ Map<Category, List<Project>> categories = job.getTutorialCategories();
if (categories == null || categories.size() == 0) {
showNote(tutorialPageBook, tutorialsNoteText, tutorialScrollComposite);
return;
@@ -889,26 +880,21 @@
@Deprecated
//This method should be removed once the EE6 archetypes are wizardified
- private void updateNewProjects(TutorialCategory tutorialCategory) {
+ private void updateNewProjects(List<Project> wizardProjects) {
if (!newProjectsInitialized) {
- if (tutorialCategory != null) {
+ if (wizardProjects != null) {
newProjectsInitialized = true;
- displayTutorialLinks(tutorialCategory, projectsComposite, false);
+ displayTutorialLinks(wizardProjects, projectsComposite, false);
resize(true);
}
}
}
- private void showTutorials(Map<String, TutorialCategory> categories) {
+ private void showTutorials(Map<Category, List<Project>> categories) {
disposeChildren(tutorialsComposite);
- List<TutorialCategory> sortedCategories = getSortedCategories(categories);
- for (final TutorialCategory category:sortedCategories) {
- //TEMPORARY HACK FOR JBIDE-10053 (Java EE6 archetypes in the project section)
- //Should be removed once these archetype tutorials are changed to use wizards as per JBIDE-10264
- if (ORG_JBOSS_TOOLS_CENTRAL_JAVAEE6_QUICKSTART.equals(category.getId())) {
- //bail
- continue;
- }
+ List<Category> sortedCategories = new ArrayList<Category>(categories.keySet());
+ Collections.sort(sortedCategories);
+ for (final Category category : sortedCategories) {
int style = ExpandableComposite.TITLE_BAR|ExpandableComposite.TWISTIE;
if (expandedCategories.contains(category)) {
style|=ExpandableComposite.EXPANDED;
@@ -941,7 +927,7 @@
}
});
- displayTutorialLinks(category, composite, true);
+ displayTutorialLinks(categories.get(category), composite, true);
categoryComposite.setClient(composite);
String description = category.getDescription();
if (description != null && !description.isEmpty() && categoryComposite.getControl() != null) {
@@ -958,16 +944,7 @@
//recomputeScrollComposite(tutorialScrollComposite, tutorialPageBook);
}
- private List<TutorialCategory> getSortedCategories(
- Map<String, TutorialCategory> categories) {
- Collection<TutorialCategory> tempCategories = categories.values();
- List<TutorialCategory> sortedCategories = new ArrayList<TutorialCategory>();
- sortedCategories.addAll(tempCategories);
- Collections.sort(sortedCategories);
- return sortedCategories;
- }
-
- private Font getBoldFont(Font font) {
+ private Font getBoldFont(Font font) {
if (categoryFont != null) {
return categoryFont;
}
@@ -979,7 +956,7 @@
return categoryFont;
}
- private void hookTooltip(FormText tutorialText, Tutorial tutorial) {
+ private void hookTooltip(FormText tutorialText, Project tutorial) {
final String description = JBossCentralActivator.getDefault().getDescription(tutorial);
if (description != null && !description.isEmpty()) {
ToolTip toolTip = new DescriptionToolTip(tutorialText, description);
@@ -987,33 +964,26 @@
}
}
- protected void configureTutorialText(FormText tutorialText, final Tutorial tutorial) {
+ protected void configureTutorialText(FormText tutorialText, final Project tutorial) {
StringBuilder buffer = new StringBuilder();
buffer.append(JBossCentralActivator.FORM_START_TAG);
buffer.append("<img href=\"image\"/> ");
buffer.append("<a href=\"link\">");
- buffer.append(tutorial.getName());
+ buffer.append(tutorial.getShortDescription());
buffer.append("</a> ");
buffer.append(JBossCentralActivator.FORM_END_TAG);
- String text = buffer.toString();
- tutorialText.setText(text , true, false);
- Image image;
- Project project = tutorial.getProjectExamples();
- List<ProjectFix> fixes = project.getFixes();
- List<ProjectFix> unsatisfiedFixes = new ArrayList<ProjectFix>();
- project.setUnsatisfiedFixes(unsatisfiedFixes);
- for (ProjectFix fix:fixes) {
- if (!ProjectExamplesActivator.canFix(project, fix)) {
- unsatisfiedFixes.add(fix);
- }
+ tutorialText.setText(buffer.toString() , true, false);
+
+ String iconPath = tutorial.getIconPath();
+ if (iconPath != null) {
+ Image image = JBossCentralActivator.getDefault().getImage(tutorial.getIconPath());
+ if (image != null) {
+ tutorialText.setImage("image", image);
+ }
}
- //JBIDE-10303 : never display a warning image
- image = JBossCentralActivator.getDefault().getImage(tutorial.getIconPath());
- tutorialText.setImage("image", image);
tutorialText.addHyperlinkListener(new HyperlinkAdapter() {
-
@Override
public void linkActivated(HyperlinkEvent e) {
Object object = e.data;
@@ -1288,9 +1258,9 @@
//TEMPORARY HACK FOR JBIDE-10053 (Java EE6 archetypes in the project section)
//Should be removed once these archetype tutorials are changed to use wizards as per JBIDE-10264
RefreshTutorialsJob job = RefreshTutorialsJob.INSTANCE;
- Map<String, TutorialCategory> categories = job.getTutorialCategories();
- if (categories != null){
- updateNewProjects(categories.get(ORG_JBOSS_TOOLS_CENTRAL_JAVAEE6_QUICKSTART));
+ List<Project> wizardProjects = job.getWizardProjects();
+ if (wizardProjects != null){
+ updateNewProjects(wizardProjects);
}
}
});
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java 2012-01-18 09:20:13 UTC (rev 37934)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java 2012-01-18 09:24:06 UTC (rev 37935)
@@ -47,10 +47,6 @@
import org.jboss.tools.central.JBossCentralActivator;
import org.jboss.tools.central.actions.OpenJBossBlogsHandler;
import org.jboss.tools.central.editors.xpl.TextSearchControl;
-import org.jboss.tools.central.jobs.RefreshBlogsJob;
-import org.jboss.tools.central.jobs.RefreshDiscoveryJob;
-import org.jboss.tools.central.jobs.RefreshNewsJob;
-import org.jboss.tools.central.jobs.RefreshTutorialsJob;
/**
*
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshTutorialsJob.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshTutorialsJob.java 2012-01-18 09:20:13 UTC (rev 37934)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshTutorialsJob.java 2012-01-18 09:24:06 UTC (rev 37935)
@@ -11,18 +11,15 @@
package org.jboss.tools.central.jobs;
import java.util.ArrayList;
-import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.jboss.tools.central.JBossCentralActivator;
-import org.jboss.tools.central.model.Tutorial;
-import org.jboss.tools.central.model.TutorialCategory;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.model.Category;
import org.jboss.tools.project.examples.model.Project;
@@ -37,7 +34,10 @@
public class RefreshTutorialsJob extends Job {
private Exception exception;
- private Map<String, TutorialCategory> tutorialCategories;
+ private Map<Category,List<Project>> tutorialCategories;
+
+ private List<Project> wizardProjects;
+
public static RefreshTutorialsJob INSTANCE = new RefreshTutorialsJob();
private RefreshTutorialsJob() {
@@ -50,52 +50,32 @@
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
- tutorialCategories = JBossCentralActivator.getDefault().getTutorialCategories();
List<Category> categories = ProjectUtil.getProjects(monitor);
- Collection<TutorialCategory> values = tutorialCategories.values();
- for (TutorialCategory category:values) {
- for (Tutorial tutorial:category.getTutorials()) {
- if (JBossCentralActivator.PROJECT_EXAMPLE_TYPE.equals(tutorial.getType())) {
- String reference = tutorial.getReference();
- String[] projectExamples = reference.split("::");
- Assert.isNotNull(projectExamples);
- Assert.isTrue(projectExamples.length == 2);
- String projectExampleCategory = projectExamples[0];
- String projectExampleName = projectExamples[1];
- Project projectTutorial = null;
- for (Category peCategory : categories) {
- if (projectExampleCategory.equals(peCategory.getName())) {
- for (Project project : peCategory.getProjects()) {
- if (projectExampleName.equals(project.getName())
- && canBeImported(project)){
- projectTutorial = project;
- break;
- }
- }
- }
- if (projectTutorial != null) {
- List<ProjectFix> unsatisfiedFixes = new ArrayList<ProjectFix>();
- if (projectTutorial != null) {
- List<ProjectFix> fixes = projectTutorial.getFixes();
- projectTutorial.setUnsatisfiedFixes(unsatisfiedFixes);
- for (ProjectFix fix : fixes) {
- if (!ProjectExamplesActivator.canFix(projectTutorial, fix)) {
- unsatisfiedFixes.add(fix);
- }
- }
- }
-
- break;
- }
+ wizardProjects = ProjectUtil.getProjectsByTags(categories, "wizard");
+ List<Project> tutorials = ProjectUtil.getProjectsByTags(categories, "central");
+ if (tutorialCategories == null) {
+ tutorialCategories = new HashMap<Category, List<Project>>();
+ } else {
+ tutorialCategories.clear();
+ }
+
+ for (Project project : tutorials) {
+ if (canBeImported(project)){
+ List<ProjectFix> unsatisfiedFixes = new ArrayList<ProjectFix>();
+ List<ProjectFix> fixes = project.getFixes();
+ project.setUnsatisfiedFixes(unsatisfiedFixes);
+ for (ProjectFix fix : fixes) {
+ if (!ProjectExamplesActivator.canFix(project, fix)) {
+ unsatisfiedFixes.add(fix);
}
- if (projectTutorial != null) {
- tutorial.setProjectExamples(projectTutorial);
- } else {
- JBossCentralActivator.logWarning("The " + tutorial.getId() + " project example not found");
- }
- } else {
- // FIXME
}
+ Category category = project.getCategory();
+ List<Project> projects = tutorialCategories.get(category);
+ if (projects == null) {
+ projects = new ArrayList<Project>();
+ tutorialCategories.put(category, projects);
+ }
+ projects.add(project);
}
}
@@ -115,10 +95,14 @@
this.exception = exception;
}
- public Map<String, TutorialCategory> getTutorialCategories() {
+ public Map<Category,List<Project>> getTutorialCategories() {
return tutorialCategories;
}
+ public List<Project> getWizardProjects() {
+ return wizardProjects;
+ }
+
@Override
public boolean belongsTo(Object family) {
return family == JBossCentralActivator.JBOSS_CENTRAL_FAMILY;
Deleted: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/Tutorial.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/Tutorial.java 2012-01-18 09:20:13 UTC (rev 37934)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/Tutorial.java 2012-01-18 09:24:06 UTC (rev 37935)
@@ -1,172 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2008-2011 Red Hat, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * JBoss by Red Hat - Initial implementation.
- ************************************************************************************/
-package org.jboss.tools.central.model;
-
-import org.jboss.tools.project.examples.model.Project;
-
-/**
- *
- * @author snjeza
- *
- */
-public class Tutorial implements Comparable<Tutorial> {
- private String id;
- private String name;
- private String type;
- private String reference;
- private int priority;
- private TutorialCategory category;
- private Project projectExamples;
- private String description;
- private String iconPath;
-
- public Tutorial(String id, String name, String type, String reference,
- int priority, TutorialCategory category, String description, String iconPath) {
- this.id = id;
- this.name = name;
- this.type = type;
- this.reference = reference;
- this.priority = priority;
- this.category = category;
- this.description = description;
- this.iconPath = iconPath;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getReference() {
- return reference;
- }
-
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- public int getPriority() {
- return priority;
- }
-
- public void setPriority(int priority) {
- this.priority = priority;
- }
-
- public TutorialCategory getCategory() {
- return category;
- }
-
- public void setCategory(TutorialCategory category) {
- this.category = category;
- }
-
- public Project getProjectExamples() {
- return projectExamples;
- }
-
- public void setProjectExamples(Project projectExamples) {
- this.projectExamples = projectExamples;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getIconPath() {
- return iconPath;
- }
-
- public void setIconPath(String iconPath) {
- this.iconPath = iconPath;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Tutorial other = (Tutorial) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- return true;
- }
-
- @Override
- public int compareTo(Tutorial o) {
- if (o == null) {
- return -1;
- }
- TutorialCategory otherCategory = o.getCategory();
- if (otherCategory == null && this.category == null) {
- return 0;
- }
- if (this.category != null) {
- if (this.category.compareTo(otherCategory) != 0) {
- return this.category.compareTo(otherCategory);
- }
- int other = o.getPriority();
- if (other < this.priority)
- return 1;
- else if (other > this.priority)
- return -1;
- return this.getId().compareTo(o.getId());
- }
- return -1;
- }
-
- @Override
- public String toString() {
- return "Tutorial [id=" + id + ", name=" + name + ", type=" + type
- + ", reference=" + reference + ", priority=" + priority
- + ", category=" + category + ", projectExamples="
- + projectExamples + ", description=" + description
- + ", iconPath=" + iconPath + "]";
- }
-
-}
Deleted: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/TutorialCategory.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/TutorialCategory.java 2012-01-18 09:20:13 UTC (rev 37934)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/model/TutorialCategory.java 2012-01-18 09:24:06 UTC (rev 37935)
@@ -1,118 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2008-2011 Red Hat, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * JBoss by Red Hat - Initial implementation.
- ************************************************************************************/
-package org.jboss.tools.central.model;
-
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- *
- * @author snjeza
- *
- */
-public class TutorialCategory implements Comparable<TutorialCategory> {
-
- private String id;
- private String name;
- private int priority;
- private String description;
- private Set<Tutorial> tutorials = new TreeSet<Tutorial>();
-
- public TutorialCategory() {
- }
-
- public TutorialCategory(String id, String name, int priority, String description) {
- this.id = id;
- this.name = name;
- this.priority = priority;
- this.description = description;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getPriority() {
- return priority;
- }
-
- public void setPriority(int priority) {
- this.priority = priority;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- TutorialCategory other = (TutorialCategory) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- return true;
- }
-
- @Override
- public int compareTo(TutorialCategory o) {
- if (o == null)
- return 1;
- int other = o.getPriority();
- if (other < this.priority)
- return 1;
- else if (other > this.priority)
- return -1;
- return id.compareTo(o.getId());
- }
-
- public Set<Tutorial> getTutorials() {
- return tutorials;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- @Override
- public String toString() {
- return "TutorialCategory [id=" + id + ", name=" + name + ", priority="
- + priority + ", description=" + description + "]";
- }
-
-}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Category.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Category.java 2012-01-18 09:20:13 UTC (rev 37934)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Category.java 2012-01-18 09:24:06 UTC (rev 37935)
@@ -19,7 +19,7 @@
* @author snjeza
*
*/
-public class Category implements ProjectModelElement {
+public class Category implements ProjectModelElement, Comparable<Category> {
private String name;
private List<Project> projects = new ArrayList<Project>();
@@ -99,4 +99,23 @@
public String toString() {
return getName();
}
+
+ @Override
+ public int compareTo(Category o) {
+ if (o == null) {
+ return 1;
+ }
+ //TODO use priorities
+ String otherName = o.getName();
+ if (name == otherName) {
+ return 0;
+ }
+ if (name == null) {
+ return -1;
+ }
+ if (otherName == null) {
+ return 1;
+ }
+ return name.compareTo(otherName);
+ }
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2012-01-18 09:20:13 UTC (rev 37934)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2012-01-18 09:24:06 UTC (rev 37935)
@@ -48,6 +48,7 @@
private IProjectExampleSite site;
private String defaultProfiles =""; //$NON-NLS-1$
private Set<String> tags;
+ private String iconPath;
public Project() {
name=""; //$NON-NLS-1$
@@ -273,11 +274,31 @@
this.tags = tags;
}
- public Set<String> setTags() {
+ public Set<String> getTags() {
if (tags == null) {
tags = new HashSet<String>();
}
return tags;
}
+ public boolean hasTags(String ... tags) {
+ if (!getTags().isEmpty()
+ && tags != null && tags.length > 0) {
+ for (String tag : tags) {
+ if (!getTags().contains(tag)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public void setIconPath(String path) {
+ this.iconPath = path;
+ }
+
+ public String getIconPath() {
+ return iconPath;
+ }
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2012-01-18 09:20:13 UTC (rev 37934)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2012-01-18 09:24:06 UTC (rev 37935)
@@ -23,8 +23,11 @@
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
@@ -221,8 +224,8 @@
invalidSites.clear();
Category other = Category.OTHER;
try {
+ boolean showExperimentalSites = ProjectExamplesActivator.getDefault().getPreferenceStore().getBoolean(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES);
for (IProjectExampleSite site : sites) {
- boolean showExperimentalSites = ProjectExamplesActivator.getDefault().getPreferenceStore().getBoolean(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES);
if (!showExperimentalSites && site.isExperimental()) {
continue;
}
@@ -242,8 +245,7 @@
continue;
}
- DocumentBuilderFactory dbf = DocumentBuilderFactory
- .newInstance();
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(file);
NodeList projects = doc.getElementsByTagName("project"); //$NON-NLS-1$
@@ -356,6 +358,12 @@
else if (nodeName.equals("tags")) { //$NON-NLS-1$
parseTags(project, child);
}
+ else if (nodeName.equals("icon")) { //$NON-NLS-1$
+ String path = child.getAttribute("path");
+ if (path != null) {
+ project.setIconPath(path);
+ }
+ }
}
}
}
@@ -368,7 +376,7 @@
return list;
}
- private static void parseTags(Project project, Element tagElement) {
+ private static void parseTags(Project project, Element tagElement) {
String tagsValue = tagElement.getTextContent();
if (tagsValue != null) {
StringTokenizer tokenizer = new StringTokenizer(tagsValue.trim(), ",");//$NON-NLS-1$
@@ -646,4 +654,19 @@
public static HashSet<IProjectExampleSite> getInvalidSites() {
return invalidSites;
}
+
+ public static List<Project> getProjectsByTags(Collection<Category> categories, String ... tags) {
+ if (categories == null) {
+ return null;
+ }
+ List<Project> selection = new ArrayList<Project>();
+ for (Category c : categories) {
+ for (Project p : c.getProjects()) {
+ if (p.hasTags(tags) && !selection.contains(p)) {
+ selection.add(p);
+ }
+ }
+ }
+ return selection;
+ }
}
12 years, 12 months
JBoss Tools SVN: r37934 - in trunk: common/plugins/org.jboss.tools.common.projecttemplates/src/org/jboss/tools/common/projecttemplates and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-01-18 04:20:13 -0500 (Wed, 18 Jan 2012)
New Revision: 37934
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/FeedsToolTip.java
trunk/common/plugins/org.jboss.tools.common.projecttemplates/src/org/jboss/tools/common/projecttemplates/ProjectTemplatesPlugin.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/xpl/QuickFixPage.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/fixes/WTPRuntimeFix.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizard.java
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardPage.java
Log:
Organize imports
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/FeedsToolTip.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/FeedsToolTip.java 2012-01-18 08:59:34 UTC (rev 37933)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/FeedsToolTip.java 2012-01-18 09:20:13 UTC (rev 37934)
@@ -16,27 +16,14 @@
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.LocationAdapter;
import org.eclipse.swt.browser.LocationEvent;
-import org.eclipse.swt.browser.LocationListener;
import org.eclipse.swt.browser.OpenWindowListener;
import org.eclipse.swt.browser.WindowEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.widgets.FormText;
import org.jboss.tools.central.JBossCentralActivator;
Modified: trunk/common/plugins/org.jboss.tools.common.projecttemplates/src/org/jboss/tools/common/projecttemplates/ProjectTemplatesPlugin.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/src/org/jboss/tools/common/projecttemplates/ProjectTemplatesPlugin.java 2012-01-18 08:59:34 UTC (rev 37933)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/src/org/jboss/tools/common/projecttemplates/ProjectTemplatesPlugin.java 2012-01-18 09:20:13 UTC (rev 37934)
@@ -13,7 +13,6 @@
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
-import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/xpl/QuickFixPage.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/xpl/QuickFixPage.java 2012-01-18 08:59:34 UTC (rev 37933)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/xpl/QuickFixPage.java 2012-01-18 09:20:13 UTC (rev 37934)
@@ -58,13 +58,11 @@
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
import org.eclipse.ui.internal.views.markers.ExtendedMarkersView;
-import org.eclipse.ui.internal.views.markers.MarkerSupportInternalUtilities;
import org.eclipse.ui.statushandlers.StatusAdapter;
import org.eclipse.ui.statushandlers.StatusManager;
import org.eclipse.ui.views.markers.WorkbenchMarkerResolution;
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/fixes/WTPRuntimeFix.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/fixes/WTPRuntimeFix.java 2012-01-18 08:59:34 UTC (rev 37933)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/fixes/WTPRuntimeFix.java 2012-01-18 09:20:13 UTC (rev 37934)
@@ -38,7 +38,6 @@
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.internal.RuntimeType;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java 2012-01-18 08:59:34 UTC (rev 37933)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java 2012-01-18 09:20:13 UTC (rev 37934)
@@ -36,7 +36,6 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
Modified: trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizard.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizard.java 2012-01-18 08:59:34 UTC (rev 37933)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizard.java 2012-01-18 09:20:13 UTC (rev 37934)
@@ -10,7 +10,6 @@
************************************************************************************/
package org.jboss.tools.maven.project.examples.wizard;
-import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
Modified: trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardPage.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardPage.java 2012-01-18 08:59:34 UTC (rev 37933)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardPage.java 2012-01-18 09:20:13 UTC (rev 37934)
@@ -26,7 +26,6 @@
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridDataFactory;
12 years, 12 months