add toolbar to section

You can use ImageHyperLink control. I think that's what the PDE manifest editor uses.

Section section = new Section(parent, SWT.NONE);
Composite toolbar = new Composite(section, SWT.NONE);
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
layout.marginLeft = 0;
layout.marginRight = 0;
layout.spacing = 0;
layout.marginTop = 0;
layout.marginBottom = 0;
toolbar.setLayout(layout);
parent.setTextClient(toolbar);

ImageHyperlink imageHyperLink = new ImageHyperlink(toolbar, SWT.CENTER);
imageHyperLink.setBackgroundImage(section.getBackgroundImage());
imageHyperLink.setToolTipText("Click me for help");
imageHyperLink.setImage(JFaceResources.getImage(Dialog.DLG_IMG_HELP));
imageHyperLink.addHyperlinkListener(new HyperlinkAdapter()
{
    public void linkActivated(HyperlinkEvent e)
    {
         // Show help
    }

});

Here is how they create the toolbar:

    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    ToolBar toolbar = toolBarManager.createControl(section);
    toolbar.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_HAND));

    // Add sort action to the tool bar
    fSortAction = new SortAction(fExtensionTree, PDEUIMessages.ExtensionsPage_sortAlpha, null, null, this);
    toolBarManager.add(fSortAction);
    // Add collapse action to the tool bar
    fCollapseAction = new CollapseAction(fExtensionTree, PDEUIMessages.ExtensionsPage_collapseAll);
    toolBarManager.add(fCollapseAction);

    toolBarManager.update(true);

    section.setTextClient(toolbar);

EDIT:

This seems to work very well, too:

ToolBar toolbar = new ToolBar(section, SWT.NONE);
//add the toolitems here
//...
section.setTextClient(toolbar);

Do not let Window Builder Tool adapt the toolbar with FormToolkit, or you will get a white background painted.


只有web.config:内容如下哪里是提高画面质量的选项:<?xml version="1.0" encoding="UTF-8"?> <configuration> <!-- CAUTION! logging requires the ASP.NET IIS worker process to have write permission to the "log" folder. Among other options, you may grant the myrtille application pool ("IIS AppPool\MyrtilleAppPool") write permission to it (normally automatically set by the myrtille installer). --> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, Log4net" /> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <section name="Myrtille.Web.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </sectionGroup> </configSections> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.1.25624" newVersion="1.5.2.14234" /> </dependentAssembly> </assemblyBinding> </runtime> <log4net> <root> <level value="DEBUG" /> <appender-ref ref="LogFileAppender" /> </root> <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender"> <param name="File" value="log\Myrtille.Web.log" /> <param name="AppendToFile" value="true" /> <rollingStyle value="Size" /> <maxSizeRollBackups value="10" /> <maximumFileSize value="10MB" /> <staticLogFileName value="true" /> <layout type="log4net.Layout.PatternLayout"> <param name="ConversionPattern" value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" /> </layout> </appender> </log4net> <system.diagnostics> <trace autoflush="true" indentsize="4"> <listeners> <add name="Log4netTraceListener" type="Myrtille.Log.Log4netTraceListener, Myrtille.Common"> <!-- trace level (Information, Warning or Error). CAUTION! Information level will hinder performance --> <filter type="Myrtille.Log.Log4netTraceFilter, Myrtille.Common" initializeData="Error" /> </add> <!-- disable output window traces. CAUTION! enabling the default output window will hinder performance --> <remove name="Default" /> </listeners> </trace> <!-- enable the lines below for WCF tracing (caution as it will hinder performance). Use SvcTraceViewer.exe as viewer --> <!-- <sources> <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true"> <listeners> <add name="xml" /> </listeners> </source> <source name="System.ServiceModel.MessageLogging"> <listeners> <add name="xml" /> </listeners> </source> </sources> <sharedListeners> <add initializeData="log\Myrtille.Web.svclog" type="System.Diagnostics.XmlWriterTraceListener" name="xml" /> </sharedListeners> --> </system.diagnostics> <system.web> <compilation defaultLanguage="C#" targetFramework="4.5" /> <!-- handle file upload/download up to 1GB. maxRequestLength is measured in kilobytes and executionTimeout in seconds --> <!-- handle querystrings up to 32KB (default 2KB). this can prove useful with large XHRs in HTML4 mode --> <httpRuntime requestValidationMode="4.5" targetFramework="4.5" maxRequestLength="1048576" maxQueryStringLength="32768" executionTimeout="360000" /> <pages enableViewState="false" validateRequest="false" enableEventValidation="false" clientIDMode="AutoID" /> <authorization> <allow users="*" /> </authorization> <authentication mode="None" /> <!-- CAUTION! cookieless="UseUri" allows multiple connections/tabs but, as the http session id is passed into the url, it also implies a risk of session spoofing to mitigate that risk, an authentication cookie is stored into the browser initiating the http session; any other client accessing the http session without it will be rejected please note that, even if the http session is cookieless, this mechanism requires cookies to be enabled client side the "cookieless=" attribute is really confusing because it's in fact the method used by the browser to send the http session id... and using a cookie is the standard way to do it if using myrtille within iframe(s) on a same page, cookieless="UseUri" must be used --> <sessionState mode="InProc" cookieless="UseUri" timeout="60" /> <!--<sessionState mode="InProc" cookieless="UseCookies" cookieName="AuthSecToken" timeout="60"/>--> <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="auto" uiCulture="auto" /> </system.web> <system.webServer> <defaultDocument> <files> <clear /> <add value="Default.aspx" /> </files> </defaultDocument> <urlCompression doDynamicCompression="false" /> <staticContent> <mimeMap fileExtension=".webp" mimeType="image/webp" /> </staticContent> <security> <requestFiltering> <!-- handle file upload/download up to 1GB. maxAllowedContentLength is measured in bytes --> <!-- handle querystrings up to 32KB (default 2KB). this can prove useful with large XHRs in HTML4 mode --> <requestLimits maxAllowedContentLength="1073741824" maxQueryString="32768" /> </requestFiltering> </security> <handlers> <add path="/handlers/SocketHandler.ashx" verb="*" name="SocketHandler" type="Myrtille.Web.SocketHandler" /> <add path="/handlers/AudioSocketHandler.ashx" verb="*" name="AudioSocketHandler" type="Myrtille.Web.AudioSocketHandler" /> <add path="/handlers/EventSourceHandler.ashx" verb="*" name="EventSourceHandler" type="Myrtille.Web.EventSourceHandler" /> <add path="/handlers/LongPollingHandler.ashx" verb="*" name="LongPollingHandler" type="Myrtille.Web.LongPollingHandler" /> </handlers> </system.webServer> <system.serviceModel> <client> <endpoint address="http://localhost:8080/Myrtille/RemoteSessionProcess" binding="wsDualHttpBinding" bindingConfiguration="wsDualHttpBindingCallback" contract="Myrtille.Services.Contracts.IRemoteSessionProcess" /> <endpoint address="http://localhost:8080/Myrtille/FileStorage" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingFileStream" contract="Myrtille.Services.Contracts.IFileStorage" /> <endpoint address="http://localhost:8080/Myrtille/PrinterService" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingFileStream" contract="Myrtille.Services.Contracts.IPrinterService" /> <endpoint address="http://localhost:8080/Myrtille/MFAAuthentication" binding="basicHttpBinding" contract="Myrtille.Services.Contracts.IMFAAuthentication" /> <endpoint address="http://localhost:8080/Myrtille/EnterpriseService" binding="basicHttpBinding" contract="Myrtille.Services.Contracts.IEnterpriseService" /> <endpoint address="http://localhost:8080/Myrtille/ApplicationPoolService" binding="basicHttpBinding" contract="Myrtille.Services.Contracts.IApplicationPoolService" /> </client> <bindings> <wsDualHttpBinding> <binding name="wsDualHttpBindingCallback" receiveTimeout="infinite" maxReceivedMessageSize="2147483647"> <security mode="None" /> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <reliableSession inactivityTimeout="infinite" /> </binding> </wsDualHttpBinding> <basicHttpBinding> <!-- buffer size: 64KB; max file size: 1GB --> <binding name="basicHttpBindingFileStream" transferMode="Streamed" messageEncoding="Mtom" maxBufferSize="65536" maxReceivedMessageSize="1073741824" closeTimeout="infinite" openTimeout="infinite" receiveTimeout="infinite" sendTimeout="infinite"> <security mode="None" /> </binding> </basicHttpBinding> </bindings> <!-- enable the lines below for WCF tracing (caution as it will hinder performance). Use SvcTraceViewer.exe as viewer --> <!-- <diagnostics> <messageLogging logEntireMessage="true" maxMessagesToLog="300" logMessagesAtServiceLevel="true" logMalformedMessages="true" logMessagesAtTransportLevel="true" /> </diagnostics> --> </system.serviceModel> <applicationSettings> <Myrtille.Web.Properties.Settings> <setting name="ConnectionServiceUrl" serializeAs="String"> <value>http://localhost:8008/MyrtilleAdmin/ConnectionService/</value> </setting> </Myrtille.Web.Properties.Settings> </applicationSettings> <appSettings> <!-- disable Visual Studio SignalR --> <add key="vs:EnableBrowserLink" value="false" /> <!-- disable Visual Studio Page Inspector --> <add key="PageInspector:ServerCodeMappingSupport" value="Disabled" /> <!-- providing access to the remote clipboard could be a security issue, it can be disabled below --> <add key="AllowRemoteClipboard" value="true" /> <!-- allow file transfer (requires a domain to be specified on connect) --> <add key="AllowFileTransfer" value="true" /> <!-- allow print download (through a pdf virtual printer). requires the "Myrtille PDF" printer to be installed --> <add key="AllowPrintDownload" value="true" /> <!-- allow remote session sharing (the session is broadcasted to all guests; read/write access is granted individually) --> <add key="AllowSessionSharing" value="true" /> <!-- allow audio plaback --> <add key="AllowAudioPlayback" value="true" /> <!-- share a session by url, with owner rights. set to false to disable and provide a session url spoofing protection. requires cookieless="UseUri" session state (system.web/sessionState section above) --> <!-- if a session is shared by url between different clients, each client is identified by a unique key instead of the http session id --> <add key="AllowShareSessionUrl" value="true" /> <!-- client ip protection --> <add key="ClientIPTracking" value="false" /> <!-- if the browser window/tab of the remote session owner is closed without disconnecting first, or if the connection is lost, delay (ms) before the remote session is disconnected by the gateway. value must be greater than "browserPulseInterval" defined into config.js (default 10 secs). 0 to disable --> <!-- this comes in addition but does not replace the session idle timeout, defined at the RDS level, which will disconnect the session after no user inputs are received for a given time, independently of Myrtille --> <add key="ClientIdleTimeout" value="0" /> <!-- audio buffer. improves the audio quality at the expense of a slight latency --> <add key="AudioBuffering" value="true" /> <!-- show or hide the toolbar (you can hide it if using your own UI) --> <add key="ToolbarEnabled" value="true" /> <!-- connect from a login page or url (you can disable it if using a connection API) --> <add key="LoginEnabled" value="true" /> <!-- if login is enabled, url of the login page (change it if using your own page or leave empty to use the default page) --> <add key="LoginUrl" value="" /> <!-- recycle the application pool when there is no active remote session; not applicable if using the enterprise mode --> <add key="IdleAppPoolRecycling" value="false" /> </appSettings> </configuration>
07-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值