- This topic has 4 replies, 2 voices, and was last updated 16 years, 10 months ago by
rroy.
-
AuthorPosts
-
rroyMemberIn MyEclipse 6.0.1 GA, I have set up color preferences for both JSP and Javascript files, dark blue background, white text, color code comments, tags, etc. I have a file containing mostly Javascript with some JSP content. The file has a .jsp extension so it is opened in the JSP editor. The problem is that the JSP editor does not take into account the Javascript color syntax preferences or at least provide its own Javascript color preference settings. Not only that but when creating a string of HTML the escaped double quotes appear black on my dark blue background and make it hard to see.
Loyal WaterMemberCan you please point out where you have made these changes under preferences?
Also, could you please paste a sample file here for me and point out the lines where the issue is occurring.
rroyMemberfunction trace( message ) { if ( console == null ) return; try { console.document.all("output").insertAdjacentText("BeforeEnd", "\n" + message); console.document.all("output").scrollTop = console.document.all("output").scrollHeight; } catch( e ) { console = null; } } function testSend(option) { window.open('<%=request.getContextPath()%>/testSendMailing.do?id='+parent.currentMailingId+"&campaignID="+parent.currentCampaignId+'&testSendOption='+option,'TestSend','menubar=no,width=505,height=350,scrollbars=yes,resizable=yes'); }
This is a piece of a .jsp file. It’s all Javascript except for a few <%= %> peices. The background is dark blue. The quoted strings, i.e. “output” should be a bright green. The only thing that got colored was the JSP opening and closing tags <%= and %> (a redish orange color).
In another function this piece of code displays the operators and escaped double quotes in black.
document.getElementById("mailingprogress").innerHTML += "<span style=\"width:"+newFailedPercent+"%\" class=red> </span>"+ "<span style=\"width:"+newSentPercent+"%\" class=green> </span>";
I just set the colors I wanted by going to the Preferences dialog and go down to MyEclipse/Files and Editors and then set the colors under JavaScript/JavaScript Styles. I did the same for JSP. The JSP Content Type drop down has no entries for JavaScript comments or Operators, etc. so the JSP editor should use the ones in JavaScript.
Loyal WaterMemberYou seem to be setting the property at the right place. I got the color changes reflected in my java script code when I tested this at my end.
Can you switch to a new workspace (File > Switch Workspace > Temp), create a new project and test this again. Do you still face the same issue?
rroyMemberA new workspace did not work for me. Maybe you created the jsp file differently. Here’s a copy of the entire file. It has a .jsp extension but resides under the js folder.
<%@ page import="com.unicacorp.Campaign.ui.UIMessageKeys, com.unica.afc.utils.i18n.I18nUtility, org.apache.commons.lang.StringEscapeUtils, com.unicacorp.Campaign.ui.web.Constants, com.unicacorp.Campaign.ui.view.mailing.MailingControlView"%> var console = null; function trace( message ) { if ( console == null ) return; try { console.document.all("output").insertAdjacentText("BeforeEnd", "\n" + message); console.document.all("output").scrollTop = console.document.all("output").scrollHeight; } catch( e ) { console = null; } } function testSend(option) { window.open('<%=request.getContextPath()%>/testSendMailing.do?id='+parent.currentMailingId+"&campaignID="+parent.currentCampaignId+'&testSendOption='+option,'TestSend','menubar=no,width=505,height=350,scrollbars=yes,resizable=yes'); } function sendMailing() { SetCookie("<%=Constants.OK_TO_SUBMIT_MAILING_COMMAND%>","true",1); callURL("<%=request.getContextPath()%>/sendProductionMailing.do?"); } function pauseMailing(params) { SetCookie("<%=Constants.OK_TO_SUBMIT_MAILING_COMMAND%>","true",1); callURL("<%=request.getContextPath()%>/pauseMailing.do?"+params+"&"); } function continueMailing(params) { SetCookie("<%=Constants.OK_TO_SUBMIT_MAILING_COMMAND%>","true",1); callURL("<%=request.getContextPath()%>/continueMailing.do?"+params+"&"); } function abortMailing(params) { SetCookie("<%=Constants.OK_TO_SUBMIT_MAILING_COMMAND%>","true",1); callURL("<%=request.getContextPath()%>/abortMailing.do?"+params+"&"); } function refreshMailingControlIFrame() { //alert("refresh:"+parent.currentMailingId); callURL("<%=request.getContextPath()%>/viewMailingControl.do?refresh=true&"); } function refreshMailingControl(doIrefreshAutomatically) { if(doIrefreshAutomatically=="true") callURL2("<%=request.getContextPath()%>/jsp/mailing/updateMailingState.jsp?"); else callURLJustOnce("<%=request.getContextPath()%>/jsp/mailing/updateMailingState.jsp?"); } function callURL(baseURL) { var url=baseURL+"id=" + parent.currentMailingId+"&campaignID="+parent.currentCampaignId; parent.viewMailingControlFrame.location.href=url; } function handleRunningPageLoad() { // EC_TODO make configurable setTimeout('refreshMailingControl("true")',parent.refreshInterval); } function updateMailingProgress(sentCount, failedCount, mailingState) { if (document.getElementById("mailingprogress") == null) return; var newSentCount = sentCount - parent.currentSentCount; var newFailedCount = failedCount - parent.currentFailedCount; if (newSentCount == 0 && newFailedCount == 0) return false; trace( "mailing state: " + mailingState ); trace( "sentCount: " + sentCount ); // Because we can't deal with fractional pixels, fractional percentages compounds // the loss of precision in painting, therefore, we use rounding and adjust at the end var newSentPercent = Math.round( (newSentCount/parent.totalCount) * 100 ); var newFailedPercent = Math.round( (newFailedCount/parent.totalCount) * 100 ); // Keep track of the accumulated percentage so we can determine if we're not // at 100% when the mailing is completed parent.accum += newSentPercent + newFailedPercent; trace( "Initial newSentPercent: " + newSentPercent + " newFailedPercent: " + newFailedPercent + " accumulated: " + parent.accum ); // If the mailing is in the completed state check if we're over/under 100% if ( mailingState == <%=MailingControlView.COMPLETED_STATE%> ) { var excess = parent.accum - 100; if ( excess > 0 ) { newSentPercent = newSentPercent - Math.ceil( ((newSentPercent / (newSentPercent + newFailedPercent)) * excess) ); newFailedPercent = newFailedPercent - Math.ceil( ((newFailedPercent / (newSentPercent + newFailedPercent)) * excess) ); trace( "Excess called, reducing to newSentPercent: " + newSentPercent + " newFailedPercent: " + newFailedPercent ); } else if ( parent.accum < 100 ) { var deficit = 100 - parent.accum; newSentPercent = newSentPercent + Math.ceil( ((newSentPercent / (newSentPercent + newFailedPercent)) * deficit) ); newFailedPercent = newFailedPercent + Math.ceil( ((newFailedPercent / (newSentPercent + newFailedPercent)) * deficit) ); trace( "Deficit called, increasing to newSentPercent: " + newSentPercent + " newFailedPercent: " + newFailedPercent ); } } parent.currentSentCount = sentCount; parent.currentFailedCount = failedCount; document.getElementById("mailingprogress").innerHTML += "<span style=\"width:"+newFailedPercent+"%\" class=red> </span>"+ "<span style=\"width:"+newSentPercent+"%\" class=green> </span>"; if ( parent.accum >= 99) trace( "ProgressBar innerHTML: " + document.getElementById("mailingprogress").innerHTML ); } function callURL2(baseURL) { xmlHttp=MyCreateXmlHttpObject(); if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return; } var url=baseURL+"id=" + parent.currentMailingId+"&campaignID="+parent.currentCampaignId;; xmlHttp.onreadystatechange=processMailingStateChangeAndRefresh; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function callURLJustOnce(baseURL) { xmlHttp=MyCreateXmlHttpObject(); if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return; } var url=baseURL+"id=" + parent.currentMailingId+"&campaignID="+parent.currentCampaignId;; xmlHttp.onreadystatechange=processMailingStateChange; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function processMailingStateChangeAndRefresh() { processAjaxResponse("true"); } function processMailingStateChange() { processAjaxResponse("false"); } function processAjaxResponse(doIrefreshAutomatically) { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { try { // get new data var response=xmlHttp.responseXML.documentElement; var messageStatus=response.getElementsByTagName('messageStatus')[0].firstChild.data; if(messageStatus!="OK") throw messageStatus; var mailing_state=response.getElementsByTagName('status')[0].firstChild.data; var statusDescription=response.getElementsByTagName('statusDescription')[0].firstChild.data; var sentCount=response.getElementsByTagName('sentCount')[0].firstChild.data; var sentCountUnformatted=response.getElementsByTagName('sentCountUnformatted')[0].firstChild.data; var progress=response.getElementsByTagName('progress')[0].firstChild.data; var percentageComplete=response.getElementsByTagName('percentageComplete')[0].firstChild.data; var failedCount=response.getElementsByTagName('failedCount')[0].firstChild.data; var failedCountUnformatted=response.getElementsByTagName('failedCountUnformatted')[0].firstChild.data; var endTime=response.getElementsByTagName('endTime')[0].firstChild.data; var duration=response.getElementsByTagName('duration')[0].firstChild.data; var throughput=response.getElementsByTagName('throughput')[0].firstChild.data; var consoleErrorMessageCount=response.getElementsByTagName('consoleErrorMessageCount')[0].firstChild.data; var consoleWarningMessageCount=response.getElementsByTagName('consoleWarningMessageCount')[0].firstChild.data; var statusmessagelist=response.getElementsByTagName('statusmessagelist')[0].firstChild.data; var statusmessagelistcount=response.getElementsByTagName('statusmessagelistcount')[0].firstChild.data; var mmestatuslist=response.getElementsByTagName('mmestatuslist')[0].firstChild.data; var mmestatuslistcount=response.getElementsByTagName('mmestatuslistcount')[0].firstChild.data; if(parent.lastMailingState==mailing_state || mailing_state == <%=MailingControlView.COMPLETED_STATE%>) { // update mailingControlFrame - check for nulls if(document.getElementById("mailstate_sentcount") != null) document.getElementById("mailstate_sentcount").innerHTML=sentCount; if(document.getElementById("mailstate_progress") != null) document.getElementById("mailstate_progress").innerHTML=progress; if(document.getElementById("mailstate_percentagecomplete") != null) document.getElementById("mailstate_percentagecomplete").innerHTML=percentageComplete; if(document.getElementById("mailstate_failedcount") != null) document.getElementById("mailstate_failedcount").innerHTML=failedCount; if(document.getElementById("mailstate_endtime") != null) document.getElementById("mailstate_endtime").innerHTML=endTime; if(document.getElementById("mailstate_duration") != null) document.getElementById("mailstate_duration").innerHTML=duration; if(document.getElementById("mailstate_throughput") != null) document.getElementById("mailstate_throughput").innerHTML=throughput; if(document.getElementById("mailstate_consoleerrorcount") != null) document.getElementById("mailstate_consoleerrorcount").innerHTML=consoleErrorMessageCount; if(document.getElementById("mailstate_consolewarningcount") != null) document.getElementById("mailstate_consolewarningcount").innerHTML=consoleWarningMessageCount; if(document.getElementById("mailstate_statusmessagelist") != null) document.getElementById("mailstate_statusmessagelist").innerHTML=statusmessagelist; if(document.getElementById("mailstate_statusmessagelistcount") != null) document.getElementById("mailstate_statusmessagelistcount").innerHTML=statusmessagelistcount; if(document.getElementById("mailstate_mmestatuslist") != null) document.getElementById("mailstate_mmestatuslist").innerHTML=mmestatuslist; if(document.getElementById("mailstate_mmestatuslistcount") != null) document.getElementById("mailstate_mmestatuslistcount").innerHTML=mmestatuslistcount; // update the progress bar if(document.getElementById("mailingprogress") != null) { updateMailingProgress(sentCountUnformatted, failedCountUnformatted, mailing_state); } } // refresh if the gui state hasn't change from before if(parent.lastMailingState==mailing_state) { // update status description document.getElementById("mailingstate_description").innerHTML=statusDescription; parent.lastMailingState=mailing_state; if(doIrefreshAutomatically=="true") handleRunningPageLoad(); else // don't wipe out any errors unless user explicitly refresh screen. document.getElementById("errorMessage").innerHTML=""; return false; } // this handles the case if the user is observing the run, and then it finishes - we dont want to refresh control completely which // gets rid of the pretty graph.. we just disable the refresh and lose the pause option else if(mailing_state == <%=MailingControlView.COMPLETED_STATE%> ) { // update status description document.getElementById("mailingstate_description").innerHTML=statusDescription; parent.lastMailingState=mailing_state; document.getElementById("mailing_nextoption").innerHTML=""; document.getElementById("refresh_link").innerHTML=""; document.getElementById("errorMessage").innerHTML=""; return false; } else { parent.lastMailingState=mailing_state; refreshMailingControlIFrame(); return false; } } catch(ex) { refreshMailingControlIFrame(); } } } function MyCreateXmlHttpObject() { var objXMLHttp=null objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") return objXMLHttp } // to be called by each of the controlpages for the mailing on body init function initControlPage(guistate,mailingId, campaignId, totalCountUnformatted, sentCount, failedCount) { // by setting this cookie to false, we protect ourselves from any automatic refresh causing unintentional resends - see DEF20563 SetCookie("<%=Constants.OK_TO_SUBMIT_MAILING_COMMAND%>","false",1); // set some globals parent.currentMailingId=mailingId; parent.currentCampaignId=campaignId; parent.lastMailingState=guistate; // if guistate==init or completed state, then no need to go further if(guistate == '<%=MailingControlView.COMPLETED_STATE%>' || guistate=='<%=MailingControlView.INITIAL_STATE%>') return false; // do following only for screens with the graph parent.currentSentCount=0; parent.currentFailedCount=0; parent.totalCount = totalCountUnformatted; updateMailingProgress(sentCount, failedCount, guistate); // Open debug window if ( (document.getElementById("mailingprogress") != null) && (console == null) ) console = window.open( "html/debugConsole.html" ); // this should make the current page refresh automatically handleRunningPageLoad(); return false; } function SetCookie(cookieName,cookieValue,nDays) { var today = new Date(); var expire = new Date(); if (nDays==null || nDays==0) nDays=1; expire.setTime(today.getTime() + 3600000*24*nDays); document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString(); }
All the “function” key words should appear in bold yellow, they don’t. All the code is white on dark blue except for the jsp tags and the code between the tags. The jsp tags are a light orange-red and the code in between is showing as black on dark blue. The code should be white on dark blue.
-
AuthorPosts