# HG changeset patch # User Frank Benoit # Date 1207811579 -7200 # Node ID 3b18f03b2f4141b78d9021bc05aeae9de98425cc # Parent d7e6c648cb57a40b06ac7f56a895af395606e707 images into the res folder, first working jface example diff -r d7e6c648cb57 -r 3b18f03b2f41 .hgignore --- a/.hgignore Thu Apr 10 10:36:33 2008 +0900 +++ b/.hgignore Thu Apr 10 09:12:59 2008 +0200 @@ -22,3 +22,5 @@ ^user/drawingboard/DrawingBoard$ ^user/dragdrop/texttolabel$ +^jface/ActionAndStatusbar$ + diff -r d7e6c648cb57 -r 3b18f03b2f41 dsss.conf --- a/dsss.conf Thu Apr 10 10:36:33 2008 +0900 +++ b/dsss.conf Thu Apr 10 09:12:59 2008 +0200 @@ -4,7 +4,7 @@ #used for dwtsnippets/text/Snippet258 #dwtsnippets/expandbar/Snippet223 -buildflags+=-Jdwtsnippets/images +buildflags+=-Jres version(Windows){ #buildflags+= -L/SUBSYSTEM:windows:5 @@ -20,7 +20,6 @@ #buildflags+= -L-lDD-tango-util #} -#[jfacesimple.d] [dwtexamples/simple.d] [dwtexamples/clipboard/ClipboardExample.d] [dwtexamples/helloworld/HelloWorld1.d] @@ -119,3 +118,8 @@ buildflags+= -L/rc:dwt } buildflags+=-Jdwtexamples/texteditor + + +[jface/ActionAndStatusbar.d] + + diff -r d7e6c648cb57 -r 3b18f03b2f41 dwtexamples/controlexample/ControlExample.d --- a/dwtexamples/controlexample/ControlExample.d Thu Apr 10 10:36:33 2008 +0900 +++ b/dwtexamples/controlexample/ControlExample.d Thu Apr 10 09:12:59 2008 +0200 @@ -57,6 +57,7 @@ import tango.text.convert.Format; import tango.io.Stdout; import Math = tango.math.Math; +import dwt.dwthelper.utils; version(JIVE){ import jive.stacktrace; @@ -215,6 +216,8 @@ char[] res; try { res = resourceBundle.getString(key); + } catch (MissingResourceException e) { + return key; } catch (NoSuchElementException e) { return key; } diff -r d7e6c648cb57 -r 3b18f03b2f41 dwtsnippets/images/cancel.gif Binary file dwtsnippets/images/cancel.gif has changed diff -r d7e6c648cb57 -r 3b18f03b2f41 dwtsnippets/images/eclipse.png Binary file dwtsnippets/images/eclipse.png has changed diff -r d7e6c648cb57 -r 3b18f03b2f41 dwtsnippets/images/region_shell.gif Binary file dwtsnippets/images/region_shell.gif has changed diff -r d7e6c648cb57 -r 3b18f03b2f41 dwtsnippets/spinner/Snippet190.d --- a/dwtsnippets/spinner/Snippet190.d Thu Apr 10 10:36:33 2008 +0900 +++ b/dwtsnippets/spinner/Snippet190.d Thu Apr 10 09:12:59 2008 +0200 @@ -25,10 +25,10 @@ /* * Floating point values in Spinner - * + * * For a list of all DWT example snippets see * http://www.eclipse.org/swt/snippets/ - * + * * @since 3.1 */ diff -r d7e6c648cb57 -r 3b18f03b2f41 dwtsnippets/table/Snippet38.d --- a/dwtsnippets/table/Snippet38.d Thu Apr 10 10:36:33 2008 +0900 +++ b/dwtsnippets/table/Snippet38.d Thu Apr 10 09:12:59 2008 +0200 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -34,10 +34,11 @@ table.setLinesVisible (true); table.setHeaderVisible (true); char[][] titles = [" ", "C", "!", "Description", "Resource", "In Folder", "Location"]; - foreach (title; titles) { - auto column = new TableColumn (table, DWT.NONE); + int[] styles = [DWT.NONE, DWT.LEFT, DWT.RIGHT, DWT.CENTER, DWT.NONE, DWT.NONE, DWT.NONE]; + foreach (i,title; titles) { + auto column = new TableColumn (table, styles[i]); column.setText (title); - } + } int count = 128; for (int i=0; i +*/ +module jfacestatusbar; + +import dwtx.jface.action.Action; +import dwtx.jface.action.ActionContributionItem; +import dwtx.jface.action.MenuManager; +import dwtx.jface.action.StatusLineManager; +import dwtx.jface.action.ToolBarManager; +import dwtx.jface.resource.ImageDescriptor; +import dwtx.jface.window.ApplicationWindow; +import dwtx.core.runtime.IProgressMonitor; +import dwt.DWT; +import dwt.widgets.Composite; +import dwt.widgets.Control; +import dwt.widgets.Display; + +import tango.text.convert.Format; +import jive.stacktrace; +import dwt.dwthelper.utils; +import dwt.dwthelper.Runnable; + +void main() { + Ch4_Contributions swin = new Ch4_Contributions(); + swin.setBlockOnOpen(true); + swin.open(); + Display.getCurrent().dispose(); +} + +public class Ch4_Contributions : ApplicationWindow { + StatusLineManager slm; + + Ch4_StatusAction status_action; + + ActionContributionItem aci; + + public this() { + super(null); + slm = new StatusLineManager(); + status_action = new Ch4_StatusAction(slm); + aci = new ActionContributionItem(status_action); + addStatusLine(); + addMenuBar(); + addToolBar(DWT.FLAT | DWT.WRAP); + } + + protected Control createContents(Composite parent) { + getShell().setText("Action/Contribution Example"); + parent.setSize(290, 150); + aci.fill(parent); + return parent; + } + + protected MenuManager createMenuManager() { + MenuManager main_menu = new MenuManager(null); + MenuManager action_menu = new MenuManager("Menu"); + main_menu.add(action_menu); + action_menu.add(status_action); + return main_menu; + } + + protected ToolBarManager createToolBarManager(int style) { + ToolBarManager tool_bar_manager = new ToolBarManager(style); + tool_bar_manager.add(status_action); + return tool_bar_manager; + } + + protected StatusLineManager createStatusLineManager() { + return slm; + } +} + +class Ch4_StatusAction : Action { + StatusLineManager statman; + + short triggercount = 0; + + public this(StatusLineManager sm) { + super("&Trigger@Ctrl+T", AS_PUSH_BUTTON); + statman = sm; + setToolTipText("Trigger the Action"); + setImageDescriptor(ImageDescriptor.createFromFile( + getImportData!("eclipse-icon-red-16.png"))); + //getImportData!("cancel.gif"))); + } + + public void run() { + triggercount++; + statman.setMessage( Format("The status action has fired. Count: {}", triggercount)); + + if( triggercount % 5 == 0 ){ + statman.setCancelEnabled(true); + auto pm = statman.getProgressMonitor(); + pm.setCanceled(false); + pm.beginTask( "Task", 100 ); + auto runner = new class(pm) Runnable { + IProgressMonitor pm; + int w; + this(IProgressMonitor a){ + this.pm = a; + } + void run(){ + const incr = 2; + this.pm.worked( incr ); + w += incr; + if( w < 100 && !this.pm.isCanceled() ){ + Display.getCurrent().timerExec( 100, this); + } + else{ + this.pm.done(); + } + } + }; + Display.getCurrent().syncExec(runner); + } + } +} \ No newline at end of file diff -r d7e6c648cb57 -r 3b18f03b2f41 res/cancel.gif Binary file res/cancel.gif has changed diff -r d7e6c648cb57 -r 3b18f03b2f41 res/eclipse.png Binary file res/eclipse.png has changed diff -r d7e6c648cb57 -r 3b18f03b2f41 res/region_shell.gif Binary file res/region_shell.gif has changed