Author: elvisisking
Date: 2011-06-01 17:26:56 -0400 (Wed, 01 Jun 2011)
New Revision: 31756
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/META-INF/MANIFEST.MF
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/build.properties
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ModeShapeMessageConsole.java
trunk/modeshape/tests/org.jboss.tools.modeshape.rest.test/META-INF/MANIFEST.MF
Log:
JBIDE-7223 ModeShapeMessageConsole Illegally Extends MessageConsole. Changed
ModeShapeMessageConsole now extends IOConsole.
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.java
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.java 2011-06-01
21:19:11 UTC (rev 31755)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.java 2011-06-01
21:26:56 UTC (rev 31756)
@@ -66,6 +66,7 @@
public static I18n publishedResourcePropertyErrorMsg;
public static I18n publishingConsoleName;
+ public static I18n publishingConsoleProblemMsg;
public static I18n publishingConsoleProblemCreatingHyperlinkMsg;
public static I18n publishingConsoleFilePathNotFoundMsg;
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties 2011-06-01
21:19:11 UTC (rev 31755)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/RestClientI18n.properties 2011-06-01
21:26:56 UTC (rev 31756)
@@ -62,7 +62,8 @@
publishedResourcePropertyErrorMsg = Error obtaining the "published" property
from the resource "{0}"
publishingConsoleName = ModeShape
-publishingConsoleProblemCreatingHyperlinkMsg = Unexpected problem creating hyperlink in
ModeShape Message Console view
+publishingConsoleProblemMsg = Unexpected problem writing to the ModeShape Message
Console
+publishingConsoleProblemCreatingHyperlinkMsg = Unexpected problem creating hyperlink in
ModeShape Message Console
publishingConsoleFilePathNotFoundMsg = A hyperlink could not be created in the ModeShape
Message Console because the file path of "{0}" could not be found.
preferencePageDescription = General settings for ModeShape Tools:
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ModeShapeMessageConsole.java
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ModeShapeMessageConsole.java 2011-06-01
21:19:11 UTC (rev 31755)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/views/ModeShapeMessageConsole.java 2011-06-01
21:26:56 UTC (rev 31756)
@@ -13,6 +13,8 @@
import static org.jboss.tools.modeshape.rest.IUiConstants.ModeShape_IMAGE_16x;
+import java.io.IOException;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.debug.ui.console.FileLink;
import org.eclipse.jface.text.BadLocationException;
@@ -27,8 +29,8 @@
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleManager;
-import org.eclipse.ui.console.MessageConsole;
-import org.eclipse.ui.console.MessageConsoleStream;
+import org.eclipse.ui.console.IOConsole;
+import org.eclipse.ui.console.IOConsoleOutputStream;
import org.jboss.tools.modeshape.rest.Activator;
import org.jboss.tools.modeshape.rest.RestClientI18n;
import org.modeshape.common.util.CheckArg;
@@ -39,7 +41,7 @@
* The <code>ModeShapeMessageConsole</code> is a message console view where
status of publishing operations are logged. This class
* ensures all writes to the console are done in the UI thread.
*/
-public final class ModeShapeMessageConsole extends MessageConsole {
+public final class ModeShapeMessageConsole extends IOConsole {
/**
* Start tag for adding emphasis to a message. Tag will appear in a properties file.
@@ -169,49 +171,68 @@
addDocumentListener(message, file);
}
- MessageConsoleStream stream = newMessageStream();
+ IOConsoleOutputStream stream =
ModeShapeMessageConsole.this.newOutputStream();
- for (int beginIndex = 0, endIndex = 0, msgLength =
message.length(); endIndex < msgLength;) {
- int startTagIndex = message.indexOf(EMPHASIS_START_TAG,
beginIndex);
- int endTagIndex = ((startTagIndex < 0) ? -1 :
message.indexOf(EMPHASIS_END_TAG,
-
startTagIndex
-
+ EMPHASIS_START_TAG.length()));
-
- // ignore tags if both tags are not found
- if ((endTagIndex < 0) && (startTagIndex >= 0))
{
- startTagIndex = -1;
+ try {
+ for (int beginIndex = 0, endIndex = 0, msgLength =
message.length(); endIndex < msgLength;) {
+ int startTagIndex = message.indexOf(EMPHASIS_START_TAG,
beginIndex);
+ int endTagIndex = ((startTagIndex < 0) ? -1 :
message.indexOf(EMPHASIS_END_TAG,
+
startTagIndex
+
+ EMPHASIS_START_TAG.length()));
+
+ // ignore tags if both tags are not found
+ if ((endTagIndex < 0) && (startTagIndex >=
0)) {
+ startTagIndex = -1;
+ }
+
+ // determine if in emphasize mode
+ boolean emphasize = (beginIndex == startTagIndex);
+
+ // skip over start tag and set stream to bold font style
+ if (emphasize) {
+ beginIndex += EMPHASIS_START_TAG.length();
+ stream.setFontStyle(SWT.BOLD);
+ endIndex = endTagIndex;
+ } else {
+ stream.setFontStyle(SWT.NORMAL);
+ endIndex = ((startTagIndex < 0) ? msgLength :
startTagIndex);
+ }
+
+ // print to console and close stream
+ stream.write(message.substring(beginIndex, endIndex));
+ stream.close();
+
+ // need to construct a new stream as changes to font
style seem to only work one time
+ stream = ModeShapeMessageConsole.this.newOutputStream();
+
+ // skip over end tag
+ if (emphasize) {
+ endIndex += EMPHASIS_END_TAG.length();
+ }
+
+ beginIndex = endIndex;
}
- // determine if in emphasize mode
- boolean emphasize = (beginIndex == startTagIndex);
-
- // skip over start tag and set stream to bold font style
- if (emphasize) {
- beginIndex += EMPHASIS_START_TAG.length();
- stream.setFontStyle(SWT.BOLD);
- endIndex = endTagIndex;
- } else {
- stream.setFontStyle(SWT.NORMAL);
- endIndex = ((startTagIndex < 0) ? msgLength :
startTagIndex);
+ if (doLineFeedAtEnd) {
+ stream.write("\n"); //$NON-NLS-1$
}
-
- // print to console
- stream.print(message.substring(beginIndex, endIndex));
-
- // need to construct a new stream as changes to font style
seem to only work one time
- stream = newMessageStream();
-
- // skip over end tag
- if (emphasize) {
- endIndex += EMPHASIS_END_TAG.length();
+ } catch (IOException e) {
+ Activator.getDefault().log(new Status(Severity.ERROR,
+
RestClientI18n.publishingConsoleProblemMsg.text(),
+ e));
+ } finally {
+ if (stream != null) {
+ if (!stream.isClosed()) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ Activator.getDefault().log(new
Status(Severity.ERROR,
+
RestClientI18n.publishingConsoleProblemMsg.text(),
+ e));
+ }
+ }
}
-
- beginIndex = endIndex;
}
-
- if (doLineFeedAtEnd) {
- stream.println();
- }
}
}
});
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/META-INF/MANIFEST.MF
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/META-INF/MANIFEST.MF 2011-06-01
21:19:11 UTC (rev 31755)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/META-INF/MANIFEST.MF 2011-06-01
21:26:56 UTC (rev 31756)
@@ -6,3 +6,4 @@
Bundle-Vendor: %bundleVendor
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/build.properties
===================================================================
---
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/build.properties 2011-06-01
21:19:11 UTC (rev 31755)
+++
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.doc.user/build.properties 2011-06-01
21:26:56 UTC (rev 31756)
@@ -4,10 +4,6 @@
plugin.xml,\
toc.xml,\
ModeShapeHelpContexts.xml
-src.includes = build.properties,\
- doc.zip,\
+src.includes = doc.zip,\
toc.xml,\
- plugin.xml,\
- META-INF/,\
- ModeShapeHelpContexts.xml,\
- plugin.properties
+ ModeShapeHelpContexts.xml
Modified: trunk/modeshape/tests/org.jboss.tools.modeshape.rest.test/META-INF/MANIFEST.MF
===================================================================
---
trunk/modeshape/tests/org.jboss.tools.modeshape.rest.test/META-INF/MANIFEST.MF 2011-06-01
21:19:11 UTC (rev 31755)
+++
trunk/modeshape/tests/org.jboss.tools.modeshape.rest.test/META-INF/MANIFEST.MF 2011-06-01
21:26:56 UTC (rev 31756)
@@ -4,7 +4,7 @@
Bundle-SymbolicName: org.jboss.tools.modeshape.rest.test
Bundle-Version: 1.1.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.jboss.tools.modeshape.rest;bundle-version="1.0.0",
+Require-Bundle: org.jboss.tools.modeshape.rest,
org.junit4
Bundle-ClassPath: hamcrest-core-1.1.jar,
.,