Browse Source

Added simple ASPX syntax highlighting, added Web application project template by Tom Schröter.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1262 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
1a6fa98461
  1. 100
      data/templates/file/CSharp/CSharp.Web.WebControl.xft
  2. 194
      data/templates/file/CSharp/CSharp.Web.WebForm.xft
  3. 82
      data/templates/file/CSharp/CSharp.Web.WebService.xft
  4. 512
      data/templates/project/CSharp/WebpageProject.xpt
  5. 54
      src/Libraries/ICSharpCode.TextEditor/Project/Resources/ASPX.xshd
  6. 4
      src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd
  7. 4
      src/Libraries/ICSharpCode.TextEditor/Project/Resources/SyntaxModes.xml
  8. 223
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs
  9. 24
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightRuleSet.cs
  10. 26
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingDefinitionParser.cs
  11. 28
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingManager.cs
  12. 10
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/FileSyntaxModeProvider.cs
  13. 4
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/ISyntaxModeFileProvider.cs
  14. 8
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/ResourceSyntaxModeProvider.cs
  15. 6
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/SyntaxMode.cs
  16. 2
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/TextWord.cs
  17. 7
      src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs
  18. 3
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/FolderNodeCommands.cs
  19. 12
      src/Main/Base/Project/Src/Internal/Templates/Project/ProjectCreateInformation.cs
  20. 6
      src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs
  21. 8
      src/Main/Base/Project/Src/Project/MSBuildProject.cs
  22. 12
      src/Main/Base/Project/Src/TextEditor/Codons/AddInTreeSyntaxModeProvider.cs

100
data/templates/file/CSharp/CSharp.Web.WebControl.xft

@ -0,0 +1,100 @@ @@ -0,0 +1,100 @@
<?xml version="1.0"?>
<Template author="Tom Schroeter" version="1.0">
<Config
name = "ASP.NET Web Control"
icon = "C#.File.NewClass"
category = "C#"
subcategory = "ASP.NET"
defaultname = "WebControl"
language = "C#"
/>
<Description>Custom Web Control. Enter the name of a new control.</Description>
<!--
Special new file templates:
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension
${FullName} -> Full generated path name
${FileName} -> File name with extension
${FileNameWithoutExtension} -> File name without extension
${Extension} -> Extension in the form ".cs"
${Path} -> Full path of the file
-->
<Files>
<File name="${Path}\Source\${FileNameWithoutExtension}.cs" language="C#"><![CDATA[${StandardHeader.C#}
using System;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace ${StandardNamespace}
{
//**************************************************************************
#region Class ${ClassName}
/// <summary>
/// Description of ${ClassName}
/// </summary>
public class ${ClassName} : Control
{
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Data
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Constructor
public ${ClassName}()
{
Init += new EventHandler( OnInit );
Load += new EventHandler( OnLoad );
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region OnInit
private void OnInit(object sender, EventArgs e)
{
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region OnLoad
private void OnLoad(object sender, EventArgs e)
{
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Properties
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Render
override
protected void Render(HtmlTextWriter Writer)
{
Writer.Write( "${ClassName} Control" );
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region More...
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region More...
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
#endregion
//**************************************************************************
}
]]></File>
</Files>
<AdditionalOptions/>
</Template>

194
data/templates/file/CSharp/CSharp.Web.WebForm.xft

@ -0,0 +1,194 @@ @@ -0,0 +1,194 @@
<?xml version="1.0"?>
<Template author="Tom Schroeter" version="1.0">
<Config
name = "ASP.NET Web Form"
icon = "C#.File.NewClass"
category = "C#"
subcategory = "ASP.NET"
defaultname = "WebForm${Number}.aspx"
language = "C#"
/>
<Description>Component Frame for ASPX Code Behind. Enter the name of a new page.</Description>
<!--
Special new file templates:
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension
${FullName} -> Full generated path name
${FileName} -> File name with extension
${FileNameWithoutExtension} -> File name without extension
${Extension} -> Extension in the form ".cs"
${Path} -> Full path of the file
-->
<Files>
<File name="${Path}\Source\${FileNameWithoutExtension}.cs" language="C#"><![CDATA[${StandardHeader.C#}
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace ${StandardNamespace}
{
/// <summary>
/// Description of ${ClassName}
/// </summary>
public class ${ClassName} : Page
{
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Data
protected HtmlInputButton _Button_Ok;
protected HtmlInputText _Input_Name;
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Page Init & Exit (Open/Close DB connections here...)
protected void PageInit(object sender, System.EventArgs e)
{
}
//----------------------------------------------------------------------
protected void PageExit(object sender, System.EventArgs e)
{
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Page Load
private void Page_Load(object sender, System.EventArgs e)
{
Response.Write(@"Hello #Develop<br>");
//------------------------------------------------------------------
if(IsPostBack)
{
}
//------------------------------------------------------------------
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Click_Button_OK
//----------------------------------------------------------------------
protected void Click_Button_Ok(object sender, System.EventArgs e)
{
Response.Write( _Button_Ok.Value + " was cklicked!<br>");
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Change_Input_Name
//----------------------------------------------------------------------
protected void Changed_Input_Name(object sender, System.EventArgs e)
{
Response.Write( _Input_Name.Value + " has changed!<br>");
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Add more events here...
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Initialize Component
protected override void OnInit(EventArgs e)
{ InitializeComponent();
base.OnInit(e);
}
//----------------------------------------------------------------------
private void InitializeComponent()
{ //------------------------------------------------------------------
this.Load += new System.EventHandler(Page_Load);
this.Init += new System.EventHandler(PageInit);
this.Unload += new System.EventHandler(PageExit);
//------------------------------------------------------------------
_Button_Ok.ServerClick += new EventHandler(Click_Button_Ok);
_Input_Name.ServerChange += new EventHandler(Changed_Input_Name);
//------------------------------------------------------------------
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
}
]]></File>
<File name="${FullName}" language="HTML"><![CDATA[<%@ Page
language="c#"
Codebehind="${FileNameWithoutExtension}.cs"
AutoEventWireup="false"
Inherits="${StandardNamespace}.${ClassName}"
validateRequest="false"
EnableSessionState="false"
debug="true"
trace="false"
%>
<!--
<--%@ Register TagPrefix="???" Namespace="${StandardNamespace}" Assembly="${StandardNamespace}" %>
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmls="http://www.w3.org/1999/xhtml">
<Html>
<Head>
<Title>${ClassName}</Title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<LINK href="${StandardNamespace}.css" type="text/css" rel="stylesheet">
</Head>
<Body>
<form id="Form_${ClassName}" method="post" runat="server">
<table>
<tr>
<td colspan="2">
Table
</td>
</tr>
<tr>
<td>
Name:
</td>
<td>
<input id="_Input_Name" runat="server">
</td>
</tr>
<tr>
<td colspan="2">
<input id="_Button_No" type="submit" value="Oh No!" runat="server">
<input id="_Button_Ok" type="submit" value="Ok" runat="server">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<a href="?" >Click Here</a>
</td>
</tr>
</table>
</form>
</Body>
</Html>
]]> </File>
</Files>
<AdditionalOptions/>
</Template>

82
data/templates/file/CSharp/CSharp.Web.WebService.xft

@ -0,0 +1,82 @@ @@ -0,0 +1,82 @@
<?xml version="1.0"?>
<Template author="Tom Schroeter" version="1.0">
<Config
name = "ASP.NET Web Service"
icon = "C#.File.NewClass"
category = "C#"
subcategory = "ASP.NET"
defaultname = "WebService.asmx"
language = "C#"
/>
<Description>Component Frame for ASMX Web Service. Enter the name of a new service.</Description>
<!--
Special new file templates:
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension
${FullName} -> Full generated path name
${FileName} -> File name with extension
${FileNameWithoutExtension} -> File name without extension
${Extension} -> Extension in the form ".cs"
${Path} -> Full path of the file
-->
<Files>
<File name="${Path}\Source\${FileNameWithoutExtension}.cs" language="C#"><![CDATA[${StandardHeader.C#}
using System;
using System.Web.Services;
namespace ${StandardNamespace}
{
/// <summary>
/// Description of ${ClassName}
/// </summary>
[WebService
( Name = "${ClassName}",
Description = "${ClassName}",
Namespace = "http://www.${ClassName}.example"
)
]
public class ${ClassName} : WebService
{
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Data
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Constructor
public ${ClassName}()
{
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Status
[WebMethod]
public string Status()
{
string s = string.Format("Time: {0}", DateTime.Now);
return s;
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region More...
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region More...
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
}
]]></File>
<File name="${FullName}"><![CDATA[
<%@ WebService Class="${StandardNamespace}.${ClassName}" Language="C#" Debug="true" %>
]]> </File>
</Files>
<AdditionalOptions/>
</Template>

512
data/templates/project/CSharp/WebpageProject.xpt

@ -0,0 +1,512 @@ @@ -0,0 +1,512 @@
<?xml version="1.0"?>
<Template originator = "Tom Schroeter"
created = "24/03/2006"
lastModified = "24/03/2006">
<!-- Template Header -->
<TemplateConfiguration>
<Name>ASP.net webpage project</Name>
<Category>C#</Category>
<Subcategory>ASP.NET</Subcategory>
<Icon>C#.Project.Form</Icon>
<LanguageName>C#</LanguageName>
<Description>ASP.net web application</Description>
</TemplateConfiguration>
<!-- Actions -->
<Actions>
<Open filename = ".\Source\Main.cs"/>
</Actions>
<Combine name = "${ProjectName}" directory = ".">
<Options>
<StartupProject>${ProjectName}</StartupProject>
</Options>
<Project name = "${ProjectName}" directory = ".">
<Options OutputType = "Library" />
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Web" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web.Services" />
</ProjectItems>
<PropertyGroup>
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<Files>
<!--*************************************************************************-->
<File name=".\Source\Main.cs"><![CDATA[${StandardHeader.C#}
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace ${StandardNamespace}
{
/// <summary>
/// Description of MainForm.
/// </summary>
public class Main : Page
{
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Data
protected HtmlInputButton _Button_Ok;
protected HtmlInputText _Input_Name;
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Page Init & Exit (Open/Close DB connections here...)
protected void PageInit(object sender, EventArgs e)
{
}
//----------------------------------------------------------------------
protected void PageExit(object sender, EventArgs e)
{
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Page Load
private void Page_Load(object sender, EventArgs e)
{
Response.Write(@"Hello #Develop<br>");
//------------------------------------------------------------------
if(IsPostBack)
{
}
//------------------------------------------------------------------
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Click_Button_OK
//----------------------------------------------------------------------
protected void Click_Button_Ok(object sender, EventArgs e)
{
Response.Write( _Button_Ok.Value + " was cklicked!<br>");
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Changed_Input_Name
//----------------------------------------------------------------------
protected void Changed_Input_Name(object sender, EventArgs e)
{
Response.Write( _Input_Name.Value + " has changed!<br>");
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region More...
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region Initialize Component
protected override void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
//----------------------------------------------------------------------
private void InitializeComponent()
{
this.Load += new System.EventHandler(Page_Load);
this.Init += new System.EventHandler(PageInit);
this.Unload += new System.EventHandler(PageExit);
_Button_Ok.ServerClick += new EventHandler(Click_Button_Ok);
_Input_Name.ServerChange += new EventHandler(Changed_Input_Name);
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
}]]></File>
<!--*************************************************************************-->
<File name=".\Source\AssemblyInfo.cs">
<![CDATA[using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.0.0")]
]]></File>
<!--*************************************************************************-->
<File name="Global.asax" language="HTML">
<![CDATA[<%@ Application Codebehind="Global.cs"
Inherits="${ProjectName}.Global"
%>
]]></File>
<!--*************************************************************************-->
<File name=".\Source\Global.cs">
<![CDATA[
using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;
namespace ${StandardNamespace}
{
/// <summary>
/// Summary description for Global.
/// </summary>
public class Global : HttpApplication
{
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#region global
/// <summary>
/// Required designer variable.
/// </summary>
//private System.ComponentModel.IContainer components = null;
public Global()
{
InitializeComponent();
}
#endregion
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
protected void Application_Start(Object sender, EventArgs e)
{
}
protected void Session_Start(Object sender, EventArgs e)
{
}
protected void Application_BeginRequest(Object sender, EventArgs e)
{
}
protected void Application_EndRequest(Object sender, EventArgs e)
{
}
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
}
protected void Application_Error(Object sender, EventArgs e)
{
}
protected void Session_End(Object sender, EventArgs e)
{
}
protected void Application_End(Object sender, EventArgs e)
{
}
#region Web Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
}
}
]]></File>
<!--*************************************************************************-->
<File name="Main.aspx" language="HTML"><![CDATA[<%@ Page
language="c#"
Codebehind="Main.cs"
AutoEventWireup="false"
Inherits="${ProjectName}.Main"
validateRequest="false"
EnableSessionState="false"
debug="true"
trace="false"
%>
<!--
<--%@ Register TagPrefix="???" Namespace="${StandardNamespace}" Assembly="${StandardNamespace}" %>
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmls="http://www.w3.org/1999/xhtml">
<Html>
<Head>
<title>Main</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<LINK href="${ProjectName}.css" type="text/css" rel="stylesheet">
</Head>
<Body>
<form id="Form1" method="post" runat="server">
<!-- Site Code goes here! -->
<table>
<tr>
<td colspan="2">
Table
</td>
</tr>
<tr>
<td>
Name:
</td>
<td>
<input id="_Input_Name" runat="server">
</td>
</tr>
<tr>
<td colspan="2">
<input id="_Button_No" type="submit" value="Oh No!" runat="server">
<input id="_Button_Ok" type="submit" value="Ok" runat="server">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<a href="?" >Click Here</a>
</td>
</tr>
</table>
</form>
</Body>
</Html>
]]></File>
<!--*************************************************************************-->
<File name="${ProjectName}.css" language="HTML">
<![CDATA[/*----------------------------------------------*/
BODY
{ font-family: Verdana, Arial;
font-weight: normal;
font-size: 11px;
color: Black;
background-color: #F0F0F0;
}
/*----------------------------------------------*/
TABLE
{ font-size: 11px;
background-color: #000000;
border-width: 1px;
border-color: #000000;
border-collapse: collapse;
margin: 0;
}
/*----------------------------------------------*/
TD
{ background-color: #FFFFFF;
border-color: #FF0000;
border-width: 0px;
padding: 4;
margin: 0;
}
/*----------------------------------------------*/
DIV
{ width:120px;
height:120px;
border:solid 1px black;
padding:8px;
background-color:#F0F0FF;
}
/*----------------------------------------------*/
SELECT
{ font-family: Verdana;
font-weight: normal;
font-size: 11px;
color: #000000;
background-color: #FFFFFF;
}
/*----------------------------------------------*/
INPUT
{ font-family: Verdana;
font-weight: normal;
font-size: 11px;
color: #000000;
}
/*----------------------------------------------*/
TEXTAREA
{ font-family: Verdana;
font-weight: normal;
font-size: 11px;
color: #000000;
background-color: #FFFFFF;
}
/*----------------------------------------------*/
A
{ FONT-WEIGHT: normal;
COLOR: #004080;
font-style: normal;
text-decoration: none;
}
A:hover
{ FONT-WEIGHT: bold;
COLOR: #FF5357;
}
/*----------------------------------------------*/
]]></File>
<!--*************************************************************************-->
<File name="Web.config" language="XML"><![CDATA[<configuration>
<system.web>
<!-- DYNAMIC DEBUG COMPILATION
Set compilation debug="true" to enable ASPX debugging. Otherwise, setting this value to
false will improve runtime performance of this application.
Set compilation debug="true" to insert debugging symbols (.pdb information)
into the compiled page. Because this creates a larger file that executes
more slowly, you should set this value to true only when debugging and to
false at all other times. For more information, refer to the documentation about
debugging ASP.NET files.
-->
<compilation
defaultLanguage="c#"
debug="true"
/>
<!-- CUSTOM ERROR MESSAGES
Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
Add <error> tags for each of the errors you want to handle.
"On" Always display custom (friendly) messages.
"Off" Always display detailed ASP.NET error information.
"RemoteOnly" Display custom (friendly) messages only to users not running
on the local Web server. This setting is recommended for security purposes, so
that you do not display application detail information to remote clients.
-->
<customErrors mode="RemoteOnly" />
<!-- AUTHENTICATION
This section sets the authentication policies of the application. Possible modes are "Windows",
"Forms", "Passport" and "None"
"None" No authentication is performed.
"Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to
its settings for the application. Anonymous access must be disabled in IIS.
"Forms" You provide a custom form (Web page) for users to enter their credentials, and then
you authenticate them in your application. A user credential token is stored in a cookie.
"Passport" Authentication is performed via a centralized authentication service provided
by Microsoft that offers a single logon and core profile services for member sites.
-->
<authentication mode="None" />
<!-- AUTHORIZATION
This section sets the authorization policies of the application. You can allow or deny access
to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
(unauthenticated) users.
-->
<authorization>
<allow users="*" /> <!-- Allow all users -->
<!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
<deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
-->
</authorization>
<!-- APPLICATION-LEVEL TRACE LOGGING
Application-level tracing enables trace log output for every page within an application.
Set trace enabled="true" to enable application trace logging. If pageOutput="true", the
trace information will be displayed at the bottom of each page. Otherwise, you can view the
application trace log by browsing the "trace.axd" page from your web application
root.
-->
<trace
enabled="false"
requestLimit="10"
pageOutput="false"
traceMode="SortByTime"
localOnly="true"
/>
<!-- SESSION STATE SETTINGS
By default ASP.NET uses cookies to identify which requests belong to a particular session.
If cookies are not available, a session can be tracked by adding a session identifier to the URL.
To disable cookies, set sessionState cookieless="true".
-->
<sessionState
mode="InProc"
cookieless="true"
timeout="20"
/>
<!-- GLOBALIZATION
This section sets the globalization settings of the application.
-->
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/>
</system.web>
<appSettings>
<add key="SqlConnectionString"
value="Server=localhost; Database=; Uid=root; Pwd=;"
/>
</appSettings>
</configuration>
]]></File>
<!--*************************************************************************-->
</Files>
</Project>
</Combine>
</Template>

54
src/Libraries/ICSharpCode.TextEditor/Project/Resources/ASPX.xshd

@ -1,49 +1,17 @@ @@ -1,49 +1,17 @@
<?xml version="1.0"?>
<SyntaxDefinition name = "ASP3/XHTML" extensions = ".asp">
<Environment>
<Default color = "SystemColors.WindowText" bgcolor = "SystemColors.Window"/>
<Selection color = "SystemColors.HighlightText" bgcolor = "SystemColors.Highlight"/>
<!-- <Selection bgcolor = "LightBlue"/> -->
<VRuler color = "SystemColors.ControlLight"/>
<InvalidLines color = "Red"/>
<CaretMarker color = "Yellow"/>
<LineNumbers color = "SystemColors.ControlDark" bgcolor = "SystemColors.Window"/>
<FoldLine color = "#808080" bgcolor="Black"/>
<FoldMarker color = "#808080" bgcolor="White"/>
<SelectedFoldLine color = "Black" bgcolor="Black"/>
<EOLMarkers color = "#E0E0E5"/>
<SpaceMarkers color = "#E0E0E5"/>
<TabMarkers color = "#E0E0E5"/>
</Environment>
<Digits name = "Digits" bold = "false" italic = "false" color = "Black"/>
<SyntaxDefinition name = "ASP/XHTML" extensions = ".asp;.aspx;.asax;.asmx" extends = "HTML">
<RuleSets>
<RuleSet ignorecase = "false">
<Delimiters>&lt;&gt; </Delimiters>
<Span name = "ASPCode" rule = "ASP" bold = "false" italic = "false" color = "Green" bgcolor = "#E7E2D3" stopateol = "false">
<Begin>&lt;%</Begin>
<End>%&gt;</End>
</Span>
<Span name= "HTMLCode" rule = "HTML" bold = "false" italic = "false" color = "Blue" stopateol = "false">
<Begin>&lt;</Begin>
<End>&gt;</End>
</Span>
</RuleSet>
<RuleSet name="ASP" ignorecase = "false">
<Span name = "COMMENT" bold = "false" italic = "true" color = "SlateGray" stopateol = "true">
<Begin>'</Begin>
</Span>
</RuleSet>
<RuleSet ignorecase = "true" noescapesequences="true">
<Span name = "ASPCode" rule = "ASP" bold = "false" italic = "false" color = "Black" bgcolor = "#F7F2E3" stopateol = "false">
<Begin color="Black" bgcolor="Yellow">&lt;%</Begin>
<End color="Black" bgcolor="Yellow">%&gt;</End>
</Span>
</RuleSet>
<RuleSet name="HTML" ignorecase = "false" reference="HTML">
<RuleSet name="ASP" ignorecase = "false">
<Span name = "COMMENT" bold = "false" italic = "false" color = "Green" bgcolor = "#F7F2E3" stopateol = "true">
<Begin>//</Begin>
</Span>
</RuleSet>
</RuleSets>
</SyntaxDefinition>

4
src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd

@ -320,7 +320,7 @@ @@ -320,7 +320,7 @@
<xsd:element name="Properties" type="Properties" minOccurs="0" maxOccurs="1" />
<!-- The Digits tag defines the color for rendering Digits-->
<xsd:element name="Digits" type="Digits" />
<xsd:element name="Digits" type="Digits" minOccurs="0" maxOccurs="1"/>
<!-- The RuleSets tag defines the rule sets that are used in the mode. Note that all modes are defined in
a flat structture even if they are used recursively. For an example of a mode that uses
@ -335,6 +335,8 @@ @@ -335,6 +335,8 @@
<!-- The file extensions that the mode is applicable for. Extensions must be written with lower case and
should include the ., as in .txt. If several extensions are applicable they should be separeated with | -->
<xsd:attribute name="extensions" type="xsd:string" />
<!-- Name of a syntax mode where rulesets, spans, keywords and other settings are imported from -->
<xsd:attribute name="extends" type="xsd:string" />
</xsd:complexType>
</xsd:element>

4
src/Libraries/ICSharpCode.TextEditor/Project/Resources/SyntaxModes.xml

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<SyntaxModes version="1.0">
<Mode file = "ASPX.xshd"
name = "ASP3/XHTML"
extensions = ".asp"/>
name = "ASP/XHTML"
extensions = ".asp;.aspx;.asax;.asmx"/>
<Mode file = "BAT-Mode.xshd"
name = "BAT"

223
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs

@ -109,7 +109,12 @@ namespace ICSharpCode.TextEditor.Document @@ -109,7 +109,12 @@ namespace ICSharpCode.TextEditor.Document
public void AddRuleSet(HighlightRuleSet aRuleSet)
{
rules.Add(aRuleSet);
HighlightRuleSet existing = FindHighlightRuleSet(aRuleSet.Name);
if (existing != null) {
existing.MergeFrom(aRuleSet);
} else {
rules.Add(aRuleSet);
}
}
internal void ResolveReferences()
@ -490,140 +495,140 @@ namespace ICSharpCode.TextEditor.Document @@ -490,140 +495,140 @@ namespace ICSharpCode.TextEditor.Document
PushCurWord(document, ref markNext, words);
++i;
continue;
default: {
// highlight digits
if (!inSpan && (Char.IsDigit(ch) || (ch == '.' && i + 1 < currentLine.Length && Char.IsDigit(document.GetCharAt(currentLine.Offset + i + 1)))) && currentLength == 0) {
bool ishex = false;
bool isfloatingpoint = false;
if (ch == '0' && i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'X') { // hex digits
const string hex = "0123456789ABCDEF";
++currentLength;
++i; // skip 'x'
++currentLength;
ishex = true;
while (i + 1 < currentLine.Length && hex.IndexOf(Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1))) != -1) {
++i;
++currentLength;
}
} else {
++currentLength;
while (i + 1 < currentLine.Length && Char.IsDigit(document.GetCharAt(currentLine.Offset + i + 1))) {
++i;
default: {
// highlight digits
if (!inSpan && (Char.IsDigit(ch) || (ch == '.' && i + 1 < currentLine.Length && Char.IsDigit(document.GetCharAt(currentLine.Offset + i + 1)))) && currentLength == 0) {
bool ishex = false;
bool isfloatingpoint = false;
if (ch == '0' && i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'X') { // hex digits
const string hex = "0123456789ABCDEF";
++currentLength;
}
}
if (!ishex && i + 1 < currentLine.Length && document.GetCharAt(currentLine.Offset + i + 1) == '.') {
isfloatingpoint = true;
++i;
++currentLength;
while (i + 1 < currentLine.Length && Char.IsDigit(document.GetCharAt(currentLine.Offset + i + 1))) {
++i;
++i; // skip 'x'
++currentLength;
}
}
if (i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'E') {
isfloatingpoint = true;
++i;
++currentLength;
if (i + 1 < currentLine.Length && (document.GetCharAt(currentLine.Offset + i + 1) == '+' || document.GetCharAt(currentLine.Offset + i + 1) == '-')) {
++i;
ishex = true;
while (i + 1 < currentLine.Length && hex.IndexOf(Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1))) != -1) {
++i;
++currentLength;
}
} else {
++currentLength;
while (i + 1 < currentLine.Length && Char.IsDigit(document.GetCharAt(currentLine.Offset + i + 1))) {
++i;
++currentLength;
}
}
while (i + 1 < currentLine.Length && Char.IsDigit(document.GetCharAt(currentLine.Offset + i + 1))) {
if (!ishex && i + 1 < currentLine.Length && document.GetCharAt(currentLine.Offset + i + 1) == '.') {
isfloatingpoint = true;
++i;
++currentLength;
while (i + 1 < currentLine.Length && Char.IsDigit(document.GetCharAt(currentLine.Offset + i + 1))) {
++i;
++currentLength;
}
}
}
if (i + 1 < currentLine.Length) {
char nextch = Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1));
if (nextch == 'F' || nextch == 'M' || nextch == 'D') {
if (i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'E') {
isfloatingpoint = true;
++i;
++currentLength;
if (i + 1 < currentLine.Length && (document.GetCharAt(currentLine.Offset + i + 1) == '+' || document.GetCharAt(currentLine.Offset + i + 1) == '-')) {
++i;
++currentLength;
}
while (i + 1 < currentLine.Length && Char.IsDigit(document.GetCharAt(currentLine.Offset + i + 1))) {
++i;
++currentLength;
}
}
}
if (!isfloatingpoint) {
bool isunsigned = false;
if (i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'U') {
++i;
++currentLength;
isunsigned = true;
if (i + 1 < currentLine.Length) {
char nextch = Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1));
if (nextch == 'F' || nextch == 'M' || nextch == 'D') {
isfloatingpoint = true;
++i;
++currentLength;
}
}
if (i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'L') {
++i;
++currentLength;
if (!isunsigned && i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'U') {
if (!isfloatingpoint) {
bool isunsigned = false;
if (i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'U') {
++i;
++currentLength;
isunsigned = true;
}
if (i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'L') {
++i;
++currentLength;
if (!isunsigned && i + 1 < currentLine.Length && Char.ToUpper(document.GetCharAt(currentLine.Offset + i + 1)) == 'U') {
++i;
++currentLength;
}
}
}
words.Add(new TextWord(document, currentLine, currentOffset, currentLength, DigitColor, false));
currentOffset += currentLength;
currentLength = 0;
continue;
}
words.Add(new TextWord(document, currentLine, currentOffset, currentLength, DigitColor, false));
currentOffset += currentLength;
currentLength = 0;
continue;
}
// Check for SPAN ENDs
if (inSpan) {
if (activeSpan.End != null && !activeSpan.End.Equals("")) {
if (currentLine.MatchExpr(activeSpan.End, i, document)) {
PushCurWord(document, ref markNext, words);
string regex = currentLine.GetRegString(activeSpan.End, i, document);
currentLength += regex.Length;
words.Add(new TextWord(document, currentLine, currentOffset, currentLength, activeSpan.EndColor, false));
currentOffset += currentLength;
currentLength = 0;
i += regex.Length - 1;
currentSpanStack.Pop();
UpdateSpanStateVariables();
continue;
// Check for SPAN ENDs
if (inSpan) {
if (activeSpan.End != null && !activeSpan.End.Equals("")) {
if (currentLine.MatchExpr(activeSpan.End, i, document)) {
PushCurWord(document, ref markNext, words);
string regex = currentLine.GetRegString(activeSpan.End, i, document);
currentLength += regex.Length;
words.Add(new TextWord(document, currentLine, currentOffset, currentLength, activeSpan.EndColor, false));
currentOffset += currentLength;
currentLength = 0;
i += regex.Length - 1;
currentSpanStack.Pop();
UpdateSpanStateVariables();
continue;
}
}
}
}
// check for SPAN BEGIN
if (activeRuleSet != null) {
foreach (Span span in activeRuleSet.Spans) {
if (currentLine.MatchExpr(span.Begin, i, document)) {
PushCurWord(document, ref markNext, words);
string regex = currentLine.GetRegString(span.Begin, i, document);
currentLength += regex.Length;
words.Add(new TextWord(document, currentLine, currentOffset, currentLength, span.BeginColor, false));
currentOffset += currentLength;
currentLength = 0;
i += regex.Length - 1;
if (currentSpanStack == null) {
currentSpanStack = new Stack<Span>();
// check for SPAN BEGIN
if (activeRuleSet != null) {
foreach (Span span in activeRuleSet.Spans) {
if (currentLine.MatchExpr(span.Begin, i, document)) {
PushCurWord(document, ref markNext, words);
string regex = currentLine.GetRegString(span.Begin, i, document);
currentLength += regex.Length;
words.Add(new TextWord(document, currentLine, currentOffset, currentLength, span.BeginColor, false));
currentOffset += currentLength;
currentLength = 0;
i += regex.Length - 1;
if (currentSpanStack == null) {
currentSpanStack = new Stack<Span>();
}
currentSpanStack.Push(span);
UpdateSpanStateVariables();
goto skip;
}
currentSpanStack.Push(span);
UpdateSpanStateVariables();
goto skip;
}
}
}
// check if the char is a delimiter
if (activeRuleSet != null && (int)ch < 256 && activeRuleSet.Delimiters[(int)ch]) {
PushCurWord(document, ref markNext, words);
if (currentOffset + currentLength +1 < currentLine.Length) {
++currentLength;
// check if the char is a delimiter
if (activeRuleSet != null && (int)ch < 256 && activeRuleSet.Delimiters[(int)ch]) {
PushCurWord(document, ref markNext, words);
goto skip;
if (currentOffset + currentLength +1 < currentLine.Length) {
++currentLength;
PushCurWord(document, ref markNext, words);
goto skip;
}
}
++currentLength;
skip: continue;
}
++currentLength;
skip: continue;
}
}
}

24
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightRuleSet.cs

@ -107,7 +107,7 @@ namespace ICSharpCode.TextEditor.Document @@ -107,7 +107,7 @@ namespace ICSharpCode.TextEditor.Document
public HighlightRuleSet(XmlElement el)
{
XmlNodeList nodes = el.GetElementsByTagName("KeyWords");
XmlNodeList nodes;
if (el.Attributes["name"] != null) {
Name = el.Attributes["name"].InnerText;
@ -126,13 +126,13 @@ namespace ICSharpCode.TextEditor.Document @@ -126,13 +126,13 @@ namespace ICSharpCode.TextEditor.Document
}
for (int i = 0; i < Delimiters.Length; ++i) {
Delimiters[i] = false;
delimiters[i] = false;
}
if (el["Delimiters"] != null) {
string delimiterString = el["Delimiters"].InnerText;
foreach (char ch in delimiterString) {
Delimiters[(int)ch] = true;
delimiters[(int)ch] = true;
}
}
@ -142,6 +142,7 @@ namespace ICSharpCode.TextEditor.Document @@ -142,6 +142,7 @@ namespace ICSharpCode.TextEditor.Document
prevMarkers = new LookupTable(!IgnoreCase);
nextMarkers = new LookupTable(!IgnoreCase);
nodes = el.GetElementsByTagName("KeyWords");
foreach (XmlElement el2 in nodes) {
HighlightColor color = new HighlightColor(el2);
@ -171,5 +172,22 @@ namespace ICSharpCode.TextEditor.Document @@ -171,5 +172,22 @@ namespace ICSharpCode.TextEditor.Document
nextMarkers[next.What] = next;
}
}
/// <summary>
/// Merges spans etc. from the other rule set into this rule set.
/// </summary>
public void MergeFrom(HighlightRuleSet ruleSet)
{
for (int i = 0; i < delimiters.Length; i++) {
delimiters[i] |= ruleSet.delimiters[i];
}
// insert merged spans in front of old spans
ArrayList oldSpans = spans;
spans = (ArrayList)ruleSet.spans.Clone();
spans.AddRange(oldSpans);
//keyWords.MergeFrom(ruleSet.keyWords);
//prevMarkers.MergeFrom(ruleSet.prevMarkers);
//nextMarkers.MergeFrom(ruleSet.nextMarkers);
}
}
}

26
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingDefinitionParser.cs

@ -11,6 +11,7 @@ using System.Xml; @@ -11,6 +11,7 @@ using System.Xml;
using System.Xml.Schema;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Reflection;
@ -24,8 +25,13 @@ namespace ICSharpCode.TextEditor.Document @@ -24,8 +25,13 @@ namespace ICSharpCode.TextEditor.Document
}
static ArrayList errors = null;
public static DefaultHighlightingStrategy Parse(SyntaxMode syntaxMode, XmlTextReader xmlTextReader)
{
return Parse(null, syntaxMode, xmlTextReader);
}
public static DefaultHighlightingStrategy Parse(DefaultHighlightingStrategy highlighter, SyntaxMode syntaxMode, XmlTextReader xmlTextReader)
{
if (syntaxMode == null)
throw new ArgumentNullException("syntaxMode");
@ -48,10 +54,20 @@ namespace ICSharpCode.TextEditor.Document @@ -48,10 +54,20 @@ namespace ICSharpCode.TextEditor.Document
XmlDocument doc = new XmlDocument();
doc.Load(validatingReader);
DefaultHighlightingStrategy highlighter = new DefaultHighlightingStrategy(doc.DocumentElement.Attributes["name"].InnerText);
if (highlighter == null)
highlighter = new DefaultHighlightingStrategy(doc.DocumentElement.Attributes["name"].InnerText);
if (doc.DocumentElement.Attributes["extensions"]!= null) {
highlighter.Extensions = doc.DocumentElement.Attributes["extensions"].InnerText.Split(new char[] { ';', '|' });
if (doc.DocumentElement.HasAttribute("extends")) {
KeyValuePair<SyntaxMode, ISyntaxModeFileProvider> entry = HighlightingManager.Manager.FindHighlighterEntry(doc.DocumentElement.GetAttribute("extends"));
if (entry.Key == null) {
MessageBox.Show("Cannot find referenced highlighting source " + doc.DocumentElement.GetAttribute("extends"));
} else {
highlighter = Parse(highlighter, entry.Key, entry.Value.GetSyntaxModeFile(entry.Key));
if (highlighter == null) return null;
}
}
if (doc.DocumentElement.HasAttribute("extensions")) {
highlighter.Extensions = doc.DocumentElement.GetAttribute("extensions").Split(new char[] { ';', '|' });
}
XmlElement environment = doc.DocumentElement["Environment"];
@ -90,7 +106,7 @@ namespace ICSharpCode.TextEditor.Document @@ -90,7 +106,7 @@ namespace ICSharpCode.TextEditor.Document
return highlighter;
}
} catch (Exception e) {
MessageBox.Show("Could not load mode definition file.\n" + e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
MessageBox.Show("Could not load mode definition file '" + syntaxMode.FileName + "'.\n" + e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
return null;
}
}

28
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingManager.cs

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
@ -84,19 +85,40 @@ namespace ICSharpCode.TextEditor.Document @@ -84,19 +85,40 @@ namespace ICSharpCode.TextEditor.Document
ISyntaxModeFileProvider syntaxModeFileProvider = (ISyntaxModeFileProvider)entry.Value;
DefaultHighlightingStrategy highlightingStrategy = HighlightingDefinitionParser.Parse(syntaxMode, syntaxModeFileProvider.GetSyntaxModeFile(syntaxMode));
if (highlightingStrategy == null) {
highlightingStrategy = DefaultHighlighting;
}
highlightingDefs[syntaxMode.Name] = highlightingStrategy;
highlightingStrategy.ResolveReferences();
return highlightingStrategy;
}
public DefaultHighlightingStrategy DefaultHighlighting {
get {
return (DefaultHighlightingStrategy)highlightingDefs["Default"];
}
}
internal KeyValuePair<SyntaxMode, ISyntaxModeFileProvider> FindHighlighterEntry(string name)
{
foreach (ISyntaxModeFileProvider provider in syntaxModeFileProviders) {
foreach (SyntaxMode mode in provider.SyntaxModes) {
if (mode.Name == name) {
return new KeyValuePair<SyntaxMode, ISyntaxModeFileProvider>(mode, provider);
}
}
}
return new KeyValuePair<SyntaxMode, ISyntaxModeFileProvider>(null, null);
}
public IHighlightingStrategy FindHighlighter(string name)
{
object def = highlightingDefs[name];
if (def is DictionaryEntry) {
return LoadDefinition((DictionaryEntry)def);
}
return (IHighlightingStrategy)(def == null ? highlightingDefs["Default"] : def);
return def == null ? DefaultHighlighting : (IHighlightingStrategy)def;
}
public IHighlightingStrategy FindHighlighterForFile(string fileName)
@ -107,9 +129,9 @@ namespace ICSharpCode.TextEditor.Document @@ -107,9 +129,9 @@ namespace ICSharpCode.TextEditor.Document
if (def is DictionaryEntry) {
return LoadDefinition((DictionaryEntry)def);
}
return (IHighlightingStrategy)(def == null ? highlightingDefs["Default"] : def);
return def == null ? DefaultHighlighting : (IHighlightingStrategy)def;
} else {
return (IHighlightingStrategy)highlightingDefs["Default"];
return DefaultHighlighting;
}
}

10
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/FileSyntaxModeProvider.cs

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Windows.Forms;
using System.Xml;
@ -17,9 +17,9 @@ namespace ICSharpCode.TextEditor.Document @@ -17,9 +17,9 @@ namespace ICSharpCode.TextEditor.Document
public class FileSyntaxModeProvider : ISyntaxModeFileProvider
{
string directory;
ArrayList syntaxModes = null;
List<SyntaxMode> syntaxModes = null;
public ArrayList SyntaxModes {
public ICollection<SyntaxMode> SyntaxModes {
get {
return syntaxModes;
}
@ -53,10 +53,10 @@ namespace ICSharpCode.TextEditor.Document @@ -53,10 +53,10 @@ namespace ICSharpCode.TextEditor.Document
return new XmlTextReader(File.OpenRead(syntaxModeFile));
}
ArrayList ScanDirectory(string directory)
List<SyntaxMode> ScanDirectory(string directory)
{
string[] files = Directory.GetFiles(directory);
ArrayList modes = new ArrayList();
List<SyntaxMode> modes = new List<SyntaxMode>();
foreach (string file in files) {
if (Path.GetExtension(file).Equals(".XSHD", StringComparison.OrdinalIgnoreCase)) {
XmlTextReader reader = new XmlTextReader(file);

4
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/ISyntaxModeFileProvider.cs

@ -6,14 +6,14 @@ @@ -6,14 +6,14 @@
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
namespace ICSharpCode.TextEditor.Document
{
public interface ISyntaxModeFileProvider
{
ArrayList SyntaxModes {
ICollection<SyntaxMode> SyntaxModes {
get;
}

8
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/ResourceSyntaxModeProvider.cs

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Xml;
using System.IO;
@ -15,9 +15,9 @@ namespace ICSharpCode.TextEditor.Document @@ -15,9 +15,9 @@ namespace ICSharpCode.TextEditor.Document
{
public class ResourceSyntaxModeProvider : ISyntaxModeFileProvider
{
ArrayList syntaxModes = null;
List<SyntaxMode> syntaxModes = null;
public ArrayList SyntaxModes {
public ICollection<SyntaxMode> SyntaxModes {
get {
return syntaxModes;
}
@ -30,7 +30,7 @@ namespace ICSharpCode.TextEditor.Document @@ -30,7 +30,7 @@ namespace ICSharpCode.TextEditor.Document
if (syntaxModeStream != null) {
syntaxModes = SyntaxMode.GetSyntaxModes(syntaxModeStream);
} else {
syntaxModes = new ArrayList();
syntaxModes = new List<SyntaxMode>();
}
}

6
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/SyntaxMode.cs

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Xml;
@ -60,10 +60,10 @@ namespace ICSharpCode.TextEditor.Document @@ -60,10 +60,10 @@ namespace ICSharpCode.TextEditor.Document
this.extensions = extensions;
}
public static ArrayList GetSyntaxModes(Stream xmlSyntaxModeStream)
public static List<SyntaxMode> GetSyntaxModes(Stream xmlSyntaxModeStream)
{
XmlTextReader reader = new XmlTextReader(xmlSyntaxModeStream);
ArrayList syntaxModes = new ArrayList();
List<SyntaxMode> syntaxModes = new List<SyntaxMode>();
while (reader.Read()) {
switch (reader.NodeType) {
case XmlNodeType.Element:

2
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/TextWord.cs

@ -158,7 +158,7 @@ namespace ICSharpCode.TextEditor.Document @@ -158,7 +158,7 @@ namespace ICSharpCode.TextEditor.Document
return color;
}
set {
Debug.Assert(color != null);
Debug.Assert(value != null);
color = value;
}
}

7
src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs

@ -374,6 +374,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -374,6 +374,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (parsedFileName.StartsWith("/") || parsedFileName.StartsWith("\\"))
parsedFileName = parsedFileName.Substring(1);
if (newfile.IsDependentFile && Path.IsPathRooted(parsedFileName)) {
Directory.CreateDirectory(Path.GetDirectoryName(parsedFileName));
File.WriteAllText(parsedFileName, parsedContent, ParserService.DefaultFileEncoding);
ParserService.ParseFile(parsedFileName, parsedContent);
} else {
@ -438,7 +439,11 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -438,7 +439,11 @@ namespace ICSharpCode.SharpDevelop.Gui
string[] subdirs = relPath.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
StringBuilder standardNameSpace = new StringBuilder(project.RootNamespace);
foreach(string subdir in subdirs) {
if (subdir == "." || subdir == ".." || subdir == "" || subdir.Equals("src", StringComparison.OrdinalIgnoreCase))
if (subdir == "." || subdir == ".." || subdir.Length == 0)
continue;
if (subdir.Equals("src", StringComparison.OrdinalIgnoreCase))
continue;
if (subdir.Equals("source", StringComparison.OrdinalIgnoreCase))
continue;
standardNameSpace.Append('.');
standardNameSpace.Append(GenerateValidClassName(subdir));

3
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/FolderNodeCommands.cs

@ -276,6 +276,9 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -276,6 +276,9 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
bool additionalProperties = false;
foreach (KeyValuePair<string, PropertyGroup> createdFile in nfd.CreatedFiles) {
FileProjectItem item = CreateNewFile(node, createdFile.Key);
if (!FileUtility.IsEqualFileName(node.Directory, Path.GetDirectoryName(createdFile.Key))) {
additionalProperties = true;
}
if (createdFile.Value.PropertyCount > 0) {
additionalProperties = true;
item.Properties.Merge(createdFile.Value);

12
src/Main/Base/Project/Src/Internal/Templates/Project/ProjectCreateInformation.cs

@ -30,6 +30,18 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -30,6 +30,18 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
public List<string> CreatedProjects = new List<string>();
public ProjectCreateInformation()
{
SetDefaultCreateProjectOptions();
}
internal bool CreateProjectWithDefaultOutputPath;
internal void SetDefaultCreateProjectOptions()
{
CreateProjectWithDefaultOutputPath = true;
}
public string OutputProjectFileName {
get {
return outputProjectFileName;

6
src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs

@ -108,6 +108,12 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -108,6 +108,12 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
string projectLocation = FileUtility.Combine(projectCreateInformation.ProjectBasePath, newProjectName + LanguageBindingService.GetProjectFileExtension(language));
projectCreateInformation.OutputProjectFileName = projectLocation;
projectCreateInformation.SetDefaultCreateProjectOptions();
foreach (PropertyGroup pg in propertyGroups) {
if (pg.IsSet("OutputPath")) {
projectCreateInformation.CreateProjectWithDefaultOutputPath = false;
}
}
IProject project = languageinfo.CreateProject(projectCreateInformation, projectOptions);
StringBuilder standardNamespace = new StringBuilder();

8
src/Main/Base/Project/Src/Project/MSBuildProject.cs

@ -44,14 +44,18 @@ namespace ICSharpCode.SharpDevelop.Project @@ -44,14 +44,18 @@ namespace ICSharpCode.SharpDevelop.Project
BaseConfiguration.SetIsGuarded("Platform", true);
configurations["Debug|*"] = new PropertyGroup();
configurations["Debug|*"]["OutputPath"] = @"bin\Debug\";
if (information.CreateProjectWithDefaultOutputPath) {
configurations["Debug|*"]["OutputPath"] = @"bin\Debug\";
}
configurations["Debug|*"]["Optimize"] = "False";
configurations["Debug|*"]["DefineConstants"] = "DEBUG" + BuildConstantSeparator + "TRACE";
configurations["Debug|*"]["DebugSymbols"] = "True";
configurations["Debug|*"]["DebugType"] = "Full";
configurations["Release|*"] = new PropertyGroup();
configurations["Release|*"]["OutputPath"] = @"bin\Release\";
if (information.CreateProjectWithDefaultOutputPath) {
configurations["Release|*"]["OutputPath"] = @"bin\Release\";
}
configurations["Release|*"]["Optimize"] = "True";
configurations["Release|*"]["DefineConstants"] = "TRACE";
configurations["Release|*"]["DebugSymbols"] = "False";

12
src/Main/Base/Project/Src/TextEditor/Codons/AddInTreeSyntaxModeProvider.cs

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
using System;
using System.Diagnostics;
using System.Xml;
using System.Collections;
using System.Collections.Generic;
using ICSharpCode.Core;
using ICSharpCode.TextEditor.Document;
namespace ICSharpCode.SharpDevelop.DefaultEditor.Codons
@ -20,9 +20,9 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Codons @@ -20,9 +20,9 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Codons
{
const string syntaxModePath = "/SharpDevelop/ViewContent/DefaultTextEditor/SyntaxModes";
ArrayList syntaxModes;
List<SyntaxMode> syntaxModes;
public ArrayList SyntaxModes {
public ICollection<SyntaxMode> SyntaxModes {
get {
return syntaxModes;
}
@ -30,11 +30,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Codons @@ -30,11 +30,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Codons
public AddInTreeSyntaxModeProvider()
{
try {
syntaxModes = AddInTree.GetTreeNode(syntaxModePath).BuildChildItems(this);
} catch (TreePathNotFoundException) {
syntaxModes = new ArrayList();
}
syntaxModes = AddInTree.BuildItems<SyntaxMode>(syntaxModePath, this, false);
}
public XmlTextReader GetSyntaxModeFile(SyntaxMode syntaxMode)

Loading…
Cancel
Save