├── ChangeLog-Ui.txt ├── src ├── main │ ├── scripts │ │ ├── GrandUI.app │ │ │ └── Contents │ │ │ │ ├── PkgInfo │ │ │ │ ├── Resources │ │ │ │ ├── Grand.icns │ │ │ │ └── en.lproj │ │ │ │ │ └── Localizable.strings │ │ │ │ └── Info.plist │ │ ├── grand-ui.bat │ │ └── grand-ui.sh │ ├── config │ │ ├── icons.xcf │ │ ├── splash.xcf │ │ ├── icons-64.xcf │ │ └── Grand.svg │ ├── resources │ │ ├── net │ │ │ └── ggtools │ │ │ │ └── grand │ │ │ │ └── ui │ │ │ │ ├── resource │ │ │ │ ├── about.png │ │ │ │ ├── splash.png │ │ │ │ ├── link-icon.png │ │ │ │ ├── node-icon.png │ │ │ │ ├── application.png │ │ │ │ └── fonts.properties │ │ │ │ ├── log │ │ │ │ └── resource │ │ │ │ │ ├── level_info.gif │ │ │ │ │ ├── level_debug.gif │ │ │ │ │ ├── level_error.gif │ │ │ │ │ ├── level_fatal.gif │ │ │ │ │ ├── level_trace.gif │ │ │ │ │ └── level_warning.gif │ │ │ │ └── buildnum.properties │ │ ├── commons-logging.properties │ │ └── log4j.xml │ └── java │ │ └── net │ │ └── ggtools │ │ └── grand │ │ └── ui │ │ ├── log │ │ ├── LogEventListener.java │ │ ├── UILogFactory.java │ │ ├── LogEventBuffer.java │ │ └── CommonsLoggingLoggerFactory.java │ │ ├── RecentFilesListener.java │ │ ├── graph │ │ ├── FilterChainModelListener.java │ │ ├── GraphEvent.java │ │ ├── GraphModelListener.java │ │ ├── GraphControllerListener.java │ │ ├── GraphListener.java │ │ ├── GraphControllerProvider.java │ │ ├── draw2d │ │ │ ├── ConstrainedPageFlowLayout.java │ │ │ └── XYRelativeAnchor.java │ │ ├── GraphDisplayer.java │ │ └── SelectionManager.java │ │ ├── actions │ │ ├── ClearRecentFilesAction.java │ │ ├── QuitAction.java │ │ ├── ZoomInAction.java │ │ ├── ZoomOutAction.java │ │ ├── ZoomResetAction.java │ │ ├── ClearFiltersAction.java │ │ ├── AboutAction.java │ │ ├── PageSetupAction.java │ │ ├── FilterFromNodeAction.java │ │ ├── ShowSourcePanelAction.java │ │ ├── ShowOutlinePanelAction.java │ │ ├── FilterConnectedToNodeAction.java │ │ ├── FilterIsolatedNodesAction.java │ │ ├── FilterMissingNodesAction.java │ │ ├── FilterPrefixedNodesAction.java │ │ ├── FilterToNodeAction.java │ │ ├── ReloadGraphAction.java │ │ ├── PreferenceAction.java │ │ ├── EditGraphPropertiesAction.java │ │ ├── OpenFileAction.java │ │ ├── UseBusRoutingAction.java │ │ ├── PrintAction.java │ │ ├── FilterSelectedNodesAction.java │ │ └── QuickOpenFileAction.java │ │ ├── event │ │ ├── Dispatcher.java │ │ ├── SimpleDispatcherFactory.java │ │ ├── DispatcherFactory.java │ │ ├── DispatcherAdapter.java │ │ └── SimpleDispatcher.java │ │ ├── menu │ │ ├── HelpMenu.java │ │ ├── FileMenuManager.java │ │ ├── ViewMenu.java │ │ └── GraphMenu.java │ │ ├── prefs │ │ ├── GeneralPreferencePage.java │ │ ├── GrandUiPreferenceManager.java │ │ ├── GraphPreferencePage.java │ │ └── PreferenceKeys.java │ │ └── widgets │ │ ├── property │ │ ├── PropertyChangedListener.java │ │ ├── PropertyPair.java │ │ └── PropertyListLabelProvider.java │ │ ├── LogWindow.java │ │ ├── ExceptionDialog.java │ │ ├── CanvasScroller.java │ │ └── Splash.java └── test │ ├── resources │ ├── bug-79.xml │ ├── bug-79-2.xml │ ├── missing-node-filter.xml │ ├── bug-101.xml │ ├── ant-project-test.xml │ ├── seq-build.xml │ └── build-ticket-9.xml │ └── java │ └── net │ └── ggtools │ └── grand │ └── ui │ └── widgets │ └── property │ └── PropertyEditorTestApp.java ├── README.txt ├── LICENSE-Graphviz.txt ├── attic ├── jnlp │ ├── splash.jpg │ ├── grand-icon.gif │ └── grand-ui.jnlp ├── Dependencies.launch └── grand-ui-launcher.xml ├── .gitignore ├── .checkstyle ├── .settings └── org.eclipse.jdt.ui.prefs ├── .project ├── ivy.settings.xml ├── .classpath ├── .externalToolBuilders └── Dependencies.launch └── ivy.xml /ChangeLog-Ui.txt: -------------------------------------------------------------------------------- 1 | Please see site/changes.xml in Grand -------------------------------------------------------------------------------- /src/main/scripts/GrandUI.app/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPL???? -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/README.txt -------------------------------------------------------------------------------- /LICENSE-Graphviz.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/LICENSE-Graphviz.txt -------------------------------------------------------------------------------- /attic/jnlp/splash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/attic/jnlp/splash.jpg -------------------------------------------------------------------------------- /attic/jnlp/grand-icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/attic/jnlp/grand-icon.gif -------------------------------------------------------------------------------- /src/main/config/icons.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/config/icons.xcf -------------------------------------------------------------------------------- /src/main/config/splash.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/config/splash.xcf -------------------------------------------------------------------------------- /src/main/config/icons-64.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/config/icons-64.xcf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | deps/ 3 | dist/ 4 | lib/ 5 | tmp/ 6 | .settings/ 7 | .idea/ 8 | *.iml 9 | .DS_Store 10 | -------------------------------------------------------------------------------- /src/main/resources/net/ggtools/grand/ui/resource/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/resources/net/ggtools/grand/ui/resource/about.png -------------------------------------------------------------------------------- /src/main/resources/net/ggtools/grand/ui/resource/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/resources/net/ggtools/grand/ui/resource/splash.png -------------------------------------------------------------------------------- /src/main/scripts/GrandUI.app/Contents/Resources/Grand.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/scripts/GrandUI.app/Contents/Resources/Grand.icns -------------------------------------------------------------------------------- /src/main/resources/net/ggtools/grand/ui/resource/link-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/resources/net/ggtools/grand/ui/resource/link-icon.png -------------------------------------------------------------------------------- /src/main/resources/net/ggtools/grand/ui/resource/node-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/resources/net/ggtools/grand/ui/resource/node-icon.png -------------------------------------------------------------------------------- /src/main/resources/net/ggtools/grand/ui/resource/application.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/resources/net/ggtools/grand/ui/resource/application.png -------------------------------------------------------------------------------- /src/main/resources/net/ggtools/grand/ui/log/resource/level_info.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/resources/net/ggtools/grand/ui/log/resource/level_info.gif -------------------------------------------------------------------------------- /src/main/resources/net/ggtools/grand/ui/log/resource/level_debug.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/resources/net/ggtools/grand/ui/log/resource/level_debug.gif -------------------------------------------------------------------------------- /src/main/resources/net/ggtools/grand/ui/log/resource/level_error.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/resources/net/ggtools/grand/ui/log/resource/level_error.gif -------------------------------------------------------------------------------- /src/main/resources/net/ggtools/grand/ui/log/resource/level_fatal.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/resources/net/ggtools/grand/ui/log/resource/level_fatal.gif -------------------------------------------------------------------------------- /src/main/resources/net/ggtools/grand/ui/log/resource/level_trace.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/resources/net/ggtools/grand/ui/log/resource/level_trace.gif -------------------------------------------------------------------------------- /src/main/resources/net/ggtools/grand/ui/log/resource/level_warning.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ant-Grand/GrandUI/HEAD/src/main/resources/net/ggtools/grand/ui/log/resource/level_warning.gif -------------------------------------------------------------------------------- /src/main/resources/net/ggtools/grand/ui/buildnum.properties: -------------------------------------------------------------------------------- 1 | #Tue, 31 Dec 2019 21:20:37 +0100 2 | build.time=21\:20\:37 3 | build.number=312 4 | build.version.string=0.9 5 | build.date=2019-12-31 6 | -------------------------------------------------------------------------------- /src/main/resources/commons-logging.properties: -------------------------------------------------------------------------------- 1 | # Configuration for apache commons logging 2 | # Use a specific factory. 3 | org.apache.commons.logging.LogFactory=net.ggtools.grand.ui.log.UILogFactory 4 | -------------------------------------------------------------------------------- /src/main/scripts/GrandUI.app/Contents/Resources/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "JRELoadError" = "Unable to load Java Runtime Environment."; 2 | "MainClassNameRequired" = "Main class name is required."; 3 | "JavaDirectoryNotFound" = "Unable to enumerate Java directory contents."; 4 | -------------------------------------------------------------------------------- /.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/test/resources/bug-79.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | Init done 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/scripts/grand-ui.bat: -------------------------------------------------------------------------------- 1 | @set BASEDIR=%~dp0 2 | 3 | @java -version 2>&1 | findstr 64 >nul 4 | @if ERRORLEVEL 1 (echo "SWT 4.10+ requires 64-bit Java" & exit /b 1) 5 | 6 | @for /f tokens^=2^ delims^=.-+_^" %%j in ('java -fullversion 2^>^&1') do set "java.major=%%j" 7 | if %java.major%==1 ( 8 | start javaw -Djava.ext.dirs=%BASEDIR%lib;%BASEDIR%lib\win32 -jar %BASEDIR%lib\grand-ui.jar 9 | ) else ( 10 | start javaw -p %BASEDIR%lib;%BASEDIR%lib\win32 -m grand.ui 11 | ) 12 | @exit 13 | -------------------------------------------------------------------------------- /src/test/resources/bug-79-2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | Init done 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/test/resources/missing-node-filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ant build file for running the MissingNodeFilterTest JUnit tests. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/scripts/grand-ui.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## resolve links - $0 may be a link 4 | PRG="$0" 5 | 6 | # need this for relative symlinks 7 | while [ -h "$PRG" ]; do 8 | ls=`ls -ld "$PRG"` 9 | link=`expr "$ls" : '.*-> \(.*\)$'` 10 | if expr "$link" : '/.*' > /dev/null; then 11 | PRG="$link" 12 | else 13 | PRG=`dirname "$PRG"`"/$link" 14 | fi 15 | done 16 | 17 | BASEDIR=`dirname "$PRG"` 18 | 19 | if [ `java -version 2>&1 | grep -c 64` -eq 0 ]; then 20 | echo "SWT 4.10+ requires 64-bit Java" 21 | exit 1 22 | fi 23 | 24 | if [ `java -version 2>&1 | sed -n 's/.* version "\([^.]*\)\..*".*/\1/p'` -eq 1 ]; then 25 | java -Djava.ext.dirs=$BASEDIR/lib:$BASEDIR/lib/gtk -jar $BASEDIR/lib/grand-ui.jar 26 | else 27 | java -p $BASEDIR/lib:$BASEDIR/lib/gtk -m grand.ui 28 | fi 29 | -------------------------------------------------------------------------------- /src/main/resources/net/ggtools/grand/ui/resource/fonts.properties: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # Font definitions for Grand. 3 | 4 | net.ggtools.grand.ui.graphfont.0=Sans-regular-11 5 | net.ggtools.grand.ui.graphfont.1=Trebuchet-regular-11 6 | net.ggtools.grand.ui.monospacefont.0=Monospace-regular-10 7 | net.ggtools.grand.ui.monospacefont.1=Andale Mono-regular-10 8 | 9 | net.ggtools.grand.ui.nodefont.0=Sans-regular-11 10 | net.ggtools.grand.ui.nodefont.1=Trebuchet MS-regular-11 11 | 12 | net.ggtools.grand.ui.linkfont.0=Serif-regular-11 13 | net.ggtools.grand.ui.linkfont.1=Georgia-regular-11 14 | 15 | net.ggtools.grand.ui.tooltipfont.0=Serif-regular-10 16 | net.ggtools.grand.ui.tooltipfont.1=Trebuchet MS-regular-10 17 | net.ggtools.grand.ui.tooltipmonospacefont.0=Monospace-regular-9 18 | net.ggtools.grand.ui.tooltipmonospacefont.1=Andale Mono-regular-9 19 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.ui.prefs: -------------------------------------------------------------------------------- 1 | comment_clear_blank_lines=false 2 | comment_format_comments=true 3 | comment_format_header=true 4 | comment_format_html=true 5 | comment_format_source_code=true 6 | comment_indent_parameter_description=true 7 | comment_indent_root_tags=true 8 | comment_line_length=80 9 | comment_new_line_for_parameter=true 10 | comment_separate_root_tags=false 11 | eclipse.preferences.version=1 12 | formatter_settings_version=10 13 | internal.default.compliance=default 14 | org.eclipse.jdt.ui.exception.name=e 15 | org.eclipse.jdt.ui.gettersetter.use.is=true 16 | org.eclipse.jdt.ui.ignorelowercasenames=true 17 | org.eclipse.jdt.ui.importorder=java;javax;org;com; 18 | org.eclipse.jdt.ui.javadoc=false 19 | org.eclipse.jdt.ui.keywordthis=false 20 | org.eclipse.jdt.ui.ondemandthreshold=99 21 | org.eclipse.jdt.ui.overrideannotation=true 22 | org.eclipse.jdt.ui.text.custom_code_templates= 23 | -------------------------------------------------------------------------------- /src/test/resources/bug-101.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Building UNIX COE Bundle 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | GrandUi 4 | Ant build graph analyser GUI 5 | 6 | Grand 7 | 8 | 9 | 10 | org.eclipse.ui.externaltools.ExternalToolBuilder 11 | auto,clean,incremental, 12 | 13 | 14 | LaunchConfigHandle 15 | <project>/.externalToolBuilders/Dependencies.launch 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javabuilder 21 | 22 | 23 | 24 | 25 | net.sf.eclipsecs.core.CheckstyleBuilder 26 | 27 | 28 | 29 | 30 | 31 | org.eclipse.jdt.core.javanature 32 | net.sf.eclipsecs.core.CheckstyleNature 33 | org.apache.ivyde.eclipse.ivynature 34 | 35 | 36 | -------------------------------------------------------------------------------- /ivy.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/test/resources/ant-project-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ant build file for running the AntProjectTest JUnit tests. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/main/scripts/GrandUI.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | JavaAppLauncher 9 | CFBundleIconFile 10 | Grand.icns 11 | CFBundleGetInfoString 12 | Grand UI @VERSION@ for Mac OS X 13 | CFBundleIdentifier 14 | net.ggtools.grand.ui 15 | CFBundleDisplayName 16 | GrandUI 17 | CFBundleInfoDictionaryVersion 18 | 6.0 19 | CFBundleName 20 | GrandUI 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | @VERSION@ 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | 1 29 | NSHumanReadableCopyright 30 | © @YEARS@ Christophe Labouisse/@VENDOR@ 31 | LSApplicationCategoryType 32 | public.app-category.developer-tools 33 | NSHighResolutionCapable 34 | 35 | JVMMainClassName 36 | net/ggtools/grand/ui/Application 37 | JVMOptions 38 | 39 | -XstartOnFirstThread 40 | 41 | JVMArguments 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /attic/jnlp/grand-ui.jnlp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | @TITLE@ 6 | ggTools 7 | 8 | GUI for Grand 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/log/LogEventListener.java: -------------------------------------------------------------------------------- 1 | //$Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.log; 29 | 30 | 31 | /** 32 | * @author Christophe Labouisse 33 | */ 34 | public interface LogEventListener { 35 | /** 36 | * Method logEventReceived. 37 | * @param event LogEvent 38 | */ 39 | void logEventReceived(LogEvent event); 40 | } 41 | -------------------------------------------------------------------------------- /attic/Dependencies.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.externalToolBuilders/Dependencies.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /attic/grand-ui-launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | Launcher for GrandUI. The following properties can be set: 23 | libdir: location of the pure java jars (${libdir}), 24 | swtlibdir: location of the swt jar/libraries (${swtlibdir}), 25 | background: run GrandUI in background. 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/RecentFilesListener.java: -------------------------------------------------------------------------------- 1 | //$Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui; 29 | 30 | import java.util.Collection; 31 | 32 | /** 33 | * Interface for classes listening to the changes in the recent files. 34 | * 35 | * @author Christophe Labouisse 36 | */ 37 | public interface RecentFilesListener { 38 | /** 39 | * Tell the listener to update the recent files list. 40 | * @param fileList Collection<String> 41 | */ 42 | void refreshRecentFiles(Collection fileList); 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/graph/FilterChainModelListener.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* ==================================================================== 3 | * Copyright (c) 2002-2004, Christophe Labouisse 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package net.ggtools.grand.ui.graph; 33 | 34 | import net.ggtools.grand.graph.Graph; 35 | 36 | /** 37 | * Interface to be implemented by classes listening to FilterChainModel changes. 38 | * 39 | * @author Christophe Labouisse 40 | */ 41 | public interface FilterChainModelListener { 42 | 43 | /** 44 | * Method filteredGraphAvailable. 45 | * @param filteredGraph Graph 46 | */ 47 | void filteredGraphAvailable(final Graph filteredGraph); 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/graph/GraphEvent.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* ==================================================================== 3 | * Copyright (c) 2002-2003, Christophe Labouisse 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package net.ggtools.grand.ui.graph; 33 | 34 | /** 35 | * Event send by the model to the controller. 36 | * 37 | * @author Christophe Labouisse 38 | */ 39 | public class GraphEvent { 40 | /** 41 | * Field model. 42 | */ 43 | @SuppressWarnings("unused") 44 | private final GraphModel model; 45 | 46 | /** 47 | * Constructor for GraphEvent. 48 | * @param model GraphModel 49 | */ 50 | public GraphEvent(final GraphModel model) { 51 | this.model = model; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/graph/GraphModelListener.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.graph; 30 | 31 | /** 32 | * Interface to be implemented by classes listening to a graph model. 33 | * 34 | * @author Christophe Labouisse 35 | */ 36 | public interface GraphModelListener { 37 | 38 | /** 39 | * Called when a new graph has been made ready by the model. It can also be 40 | * send when the graph has undergone enough changes to need a 41 | * full reload on the listener side. 42 | * 43 | * @param event event. 44 | */ 45 | void newGraphLoaded(GraphEvent event); 46 | } 47 | -------------------------------------------------------------------------------- /ivy.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/ClearRecentFilesAction.java: -------------------------------------------------------------------------------- 1 | //$Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.actions; 29 | 30 | import net.ggtools.grand.ui.RecentFilesManager; 31 | 32 | import org.eclipse.jface.action.Action; 33 | 34 | /** 35 | * @author Christophe Labouisse 36 | */ 37 | public class ClearRecentFilesAction extends Action { 38 | /** 39 | * Constructor for ClearRecentFilesAction. 40 | */ 41 | public ClearRecentFilesAction() { 42 | super("Remove recent files"); 43 | } 44 | 45 | /** 46 | * Method run. 47 | * @see org.eclipse.jface.action.IAction#run() 48 | */ 49 | @Override 50 | public final void run() { 51 | RecentFilesManager.getInstance().clear(); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/event/Dispatcher.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.event; 30 | 31 | /** 32 | * Interface for class implementing event dispatching on the client side. 33 | * 34 | * @author Christophe Labouisse 35 | */ 36 | public interface Dispatcher { 37 | /** 38 | * Client method use to dispatch the current subscribers. 39 | * 40 | * @param eventData Object 41 | */ 42 | void dispatch(final Object eventData); 43 | 44 | /** 45 | * Method used by the manager to send one event to one subscriber. 46 | * 47 | * @param subscriber Object 48 | * @param eventData Object 49 | */ 50 | void sendEventToSubscriber(final Object subscriber, final Object eventData); 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/menu/HelpMenu.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* ==================================================================== 3 | * Copyright (c) 2002-2003, Christophe Labouisse 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package net.ggtools.grand.ui.menu; 33 | 34 | import net.ggtools.grand.ui.actions.AboutAction; 35 | import net.ggtools.grand.ui.widgets.GraphWindow; 36 | 37 | import org.eclipse.jface.action.MenuManager; 38 | import org.eclipse.swt.SWT; 39 | 40 | /** 41 | * 42 | * 43 | * @author Christophe Labouisse 44 | */ 45 | public class HelpMenu extends MenuManager { 46 | 47 | /** 48 | * Constructor for HelpMenu. 49 | * @param window GraphWindow 50 | */ 51 | public HelpMenu(final GraphWindow window) { 52 | super("Help"); 53 | if (!SWT.getPlatform().equals("cocoa")) { 54 | add(new AboutAction(window)); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/graph/GraphControllerListener.java: -------------------------------------------------------------------------------- 1 | //$Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.graph; 29 | 30 | /** 31 | * Interface to be implemented by classes listener 32 | * to GraphController availability events. 33 | * 34 | * @author Christophe Labouisse 35 | */ 36 | public interface GraphControllerListener { 37 | /** 38 | * Notify the listener that the controller has been removed and should 39 | * no longer be used. 40 | * 41 | * @param controller GraphController 42 | */ 43 | void controllerRemoved(GraphController controller); 44 | 45 | /** 46 | * Notify the listener of the new available controller. 47 | * 48 | * @param controller GraphController 49 | */ 50 | void controllerAvailable(GraphController controller); 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/log/UILogFactory.java: -------------------------------------------------------------------------------- 1 | //$Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.log; 29 | 30 | import org.apache.commons.logging.Log; 31 | import org.apache.commons.logging.impl.LogFactoryImpl; 32 | 33 | /** 34 | * @author Christophe Labouisse 35 | */ 36 | public class UILogFactory extends LogFactoryImpl { 37 | 38 | /** 39 | * 40 | */ 41 | public UILogFactory() { 42 | super(); 43 | } 44 | 45 | /** 46 | * Method newInstance. 47 | * @param name String 48 | * @return Log 49 | * @see org.apache.commons.logging.impl.LogFactoryImpl#newInstance(java.lang.String) 50 | */ 51 | @Override 52 | protected final Log newInstance(final String name) { 53 | final Log log = super.newInstance(name); 54 | return new UILogger(name, log); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/graph/GraphListener.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.graph; 30 | 31 | import java.util.Collection; 32 | 33 | import net.ggtools.grand.ui.graph.draw2d.Draw2dNode; 34 | 35 | /** 36 | * Interface to be implemented by class watch state of graph objects. 37 | * 38 | * @author Christophe Labouisse 39 | */ 40 | public interface GraphListener { 41 | /** 42 | * Method called when a graph's selection has changed. 43 | * 44 | * @param selectedNodes a read-only collection of the selected nodes. 45 | */ 46 | void selectionChanged(Collection selectedNodes); 47 | 48 | /** 49 | * Method called when a graph parameter 50 | * such as the layout algorithm has changed. 51 | * 52 | * @param controller GraphController 53 | */ 54 | void parameterChanged(GraphController controller); 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/event/SimpleDispatcherFactory.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.event; 30 | 31 | import java.lang.reflect.Method; 32 | 33 | /** 34 | * Ye old 'n faithful factory creating 35 | * {@link net.ggtools.grand.ui.event.SimpleDispatcher}. 36 | * 37 | * @author Christophe Labouisse 38 | */ 39 | class SimpleDispatcherFactory extends DispatcherFactory { 40 | 41 | /** 42 | * Method createDispatcher. 43 | * @param eventManager EventManager 44 | * @param method Method 45 | * @return Dispatcher 46 | * @see net.ggtools.grand.ui.event.DispatcherFactory#createDispatcher(net.ggtools.grand.ui.event.EventManager, 47 | * java.lang.reflect.Method) 48 | */ 49 | @Override 50 | Dispatcher createDispatcher(final EventManager eventManager, 51 | final Method method) { 52 | return new SimpleDispatcher(eventManager, method); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/log/LogEventBuffer.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.log; 29 | 30 | import java.io.Serializable; 31 | import java.util.List; 32 | 33 | /** 34 | * @author Christophe Labouisse 35 | */ 36 | public interface LogEventBuffer extends Serializable { 37 | 38 | /** 39 | * Add a new listener. 40 | * 41 | * @param newListener LogEventListener 42 | */ 43 | void addListener(final LogEventListener newListener); 44 | 45 | /** 46 | * Removed all events from the current buffer. 47 | * 48 | */ 49 | void clearLogEvents(); 50 | 51 | /** 52 | * Return an unmodifiable list of events. 53 | * 54 | * @return the list of events. 55 | */ 56 | List getEventList(); 57 | 58 | /** 59 | * Remove a specific listener. 60 | * 61 | * @param toRemove LogEventListener 62 | */ 63 | void removeListener(final LogEventListener toRemove); 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/QuitAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* ==================================================================== 3 | * Copyright (c) 2002-2003, Christophe Labouisse 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package net.ggtools.grand.ui.actions; 33 | 34 | import org.eclipse.jface.action.Action; 35 | import org.eclipse.swt.SWT; 36 | 37 | /** 38 | * 39 | * 40 | * @author Christophe Labouisse 41 | */ 42 | public class QuitAction extends Action { 43 | 44 | /** 45 | * Field DEFAULT_ACTION_NAME. 46 | * (value is {@value #DEFAULT_ACTION_NAME}) 47 | */ 48 | private static final String DEFAULT_ACTION_NAME = "Quit"; 49 | 50 | /** 51 | * Constructor for QuitAction. 52 | */ 53 | public QuitAction() { 54 | super(DEFAULT_ACTION_NAME); 55 | setAccelerator((SWT.getPlatform().equals("cocoa") ? SWT.MOD1 : SWT.CONTROL) | 'Q'); 56 | } 57 | 58 | /** 59 | * Method run. 60 | * @see org.eclipse.jface.action.IAction#run() 61 | */ 62 | @Override 63 | public final void run() { 64 | System.exit(0); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/ZoomInAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.actions; 29 | 30 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 31 | 32 | import org.eclipse.swt.SWT; 33 | 34 | /** 35 | * @author Christophe Labouisse 36 | */ 37 | public class ZoomInAction extends GraphControllerAction { 38 | 39 | /** 40 | * Field DEFAULT_ACTION_NAME. 41 | * (value is {@value #DEFAULT_ACTION_NAME}) 42 | */ 43 | private static final String DEFAULT_ACTION_NAME = "Zoom In"; 44 | 45 | /** 46 | * @param provider GraphControllerProvider 47 | */ 48 | public ZoomInAction(final GraphControllerProvider provider) { 49 | super(provider, DEFAULT_ACTION_NAME); 50 | setAccelerator(SWT.PAGE_UP); 51 | } 52 | 53 | /** 54 | * Method run. 55 | * @see org.eclipse.jface.action.IAction#run() 56 | */ 57 | @Override 58 | public final void run() { 59 | getGraphController().getDisplayer().zoomIn(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/ZoomOutAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.actions; 29 | 30 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 31 | 32 | import org.eclipse.swt.SWT; 33 | 34 | /** 35 | * @author Christophe Labouisse 36 | */ 37 | public class ZoomOutAction extends GraphControllerAction { 38 | 39 | /** 40 | * Field DEFAULT_ACTION_NAME. 41 | * (value is {@value #DEFAULT_ACTION_NAME}) 42 | */ 43 | private static final String DEFAULT_ACTION_NAME = "Zoom Out"; 44 | 45 | /** 46 | * @param provider GraphControllerProvider 47 | */ 48 | public ZoomOutAction(final GraphControllerProvider provider) { 49 | super(provider, DEFAULT_ACTION_NAME); 50 | setAccelerator(SWT.PAGE_DOWN); 51 | } 52 | 53 | /** 54 | * Method run. 55 | * @see org.eclipse.jface.action.IAction#run() 56 | */ 57 | @Override 58 | public final void run() { 59 | getGraphController().getDisplayer().zoomOut(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/ZoomResetAction.java: -------------------------------------------------------------------------------- 1 | //$Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.actions; 29 | 30 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 31 | 32 | import org.eclipse.swt.SWT; 33 | 34 | /** 35 | * @author Christophe Labouisse 36 | */ 37 | public class ZoomResetAction extends GraphControllerAction { 38 | 39 | /** 40 | * Field DEFAULT_ACTION_NAME. 41 | * (value is {@value #DEFAULT_ACTION_NAME}) 42 | */ 43 | private static final String DEFAULT_ACTION_NAME = "Reset Zoom"; 44 | 45 | /** 46 | * @param provider GraphControllerProvider 47 | */ 48 | public ZoomResetAction(final GraphControllerProvider provider) { 49 | super(provider, DEFAULT_ACTION_NAME); 50 | setAccelerator(SWT.HOME); 51 | } 52 | 53 | /** 54 | * Method run. 55 | * @see org.eclipse.jface.action.IAction#run() 56 | */ 57 | @Override 58 | public final void run() { 59 | getGraphController().getDisplayer().zoomReset(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/prefs/GeneralPreferencePage.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.prefs; 29 | 30 | import org.eclipse.jface.preference.FieldEditorPreferencePage; 31 | import org.eclipse.swt.widgets.Composite; 32 | 33 | /** 34 | * @author Christophe Labouisse 35 | */ 36 | public class GeneralPreferencePage extends FieldEditorPreferencePage 37 | implements PreferenceKeys { 38 | /** 39 | * 40 | */ 41 | GeneralPreferencePage() { 42 | super("General", GRID); 43 | } 44 | 45 | /** 46 | * Method createFieldEditors. 47 | * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() 48 | */ 49 | @Override 50 | protected final void createFieldEditors() { 51 | final Composite parent = getFieldEditorParent(); 52 | final SpinnerFieldEditor maxFiles = new SpinnerFieldEditor(MAX_RECENT_FILES_PREFS_KEY, 53 | "Max Recent Files", parent); 54 | maxFiles.setValidRange(1, 9); 55 | addField(maxFiles); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/graph/GraphControllerProvider.java: -------------------------------------------------------------------------------- 1 | //$Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.graph; 29 | 30 | /** 31 | * Interface to be implemented by classes providing GraphController instances. A 32 | * provider's goal is to inform the GraphController user whether or not 33 | * a controller is currently available. This can happen either 34 | * through a simple getGraphController method of through a listener mechanism. 35 | * 36 | * @author Christophe Labouisse 37 | */ 38 | public interface GraphControllerProvider { 39 | 40 | /** 41 | * Get the current controller. 42 | * 43 | * @return the current controller or null if none is available. 44 | */ 45 | GraphController getController(); 46 | 47 | /** 48 | * Add a new listener to the provider. 49 | * @param listener GraphControllerListener 50 | * @see GraphControllerListener 51 | */ 52 | void addControllerListener(GraphControllerListener listener); 53 | 54 | /** 55 | * Remove a listener. 56 | * @param listener GraphControllerListener 57 | */ 58 | void removeControllerListener(GraphControllerListener listener); 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/widgets/property/PropertyChangedListener.java: -------------------------------------------------------------------------------- 1 | //$Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.widgets.property; 29 | 30 | /** 31 | * @author Christophe Labouisse 32 | */ 33 | public interface PropertyChangedListener { 34 | 35 | /** 36 | * This method will be call when a significant number of properties are 37 | * changed. Listeners should reparse the complete property list. 38 | * @param fillerParameter Object 39 | */ 40 | void allPropertiesChanged(Object fillerParameter); 41 | 42 | /** 43 | * Method clearedProperties. 44 | * @param fillerParameter Object 45 | */ 46 | void clearedProperties(Object fillerParameter); 47 | 48 | /** 49 | * Method propertyAdded. 50 | * @param propertyPair PropertyPair 51 | */ 52 | void propertyAdded(PropertyPair propertyPair); 53 | 54 | /** 55 | * Method propertyChanged. 56 | * @param propertyPair PropertyPair 57 | */ 58 | void propertyChanged(PropertyPair propertyPair); 59 | 60 | /** 61 | * Method propertyRemoved. 62 | * @param propertyPair PropertyPair 63 | */ 64 | void propertyRemoved(PropertyPair propertyPair); 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/event/DispatcherFactory.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.event; 30 | 31 | import java.lang.reflect.Method; 32 | 33 | /** 34 | * Factory for Dispatcher. 35 | * 36 | * @author Christophe Labouisse 37 | */ 38 | abstract class DispatcherFactory { 39 | /** 40 | * Field instance. 41 | */ 42 | private static DispatcherFactory instance = null; 43 | 44 | /** 45 | * Constructor for DispatcherFactory. 46 | */ 47 | protected DispatcherFactory() { 48 | } 49 | 50 | /** 51 | * Get the instance of the factory. 52 | * 53 | * @return DispatcherFactory 54 | */ 55 | static final DispatcherFactory getInstance() { 56 | if (instance == null) { 57 | instance = new SimpleDispatcherFactory(); 58 | } 59 | 60 | return instance; 61 | } 62 | 63 | /** 64 | * Creates a new Dispatcher for a specific method. 65 | * 66 | * @param eventManager EventManager 67 | * @param method Method 68 | * @return Dispatcher 69 | */ 70 | abstract Dispatcher createDispatcher(final EventManager eventManager, 71 | final Method method); 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/ClearFiltersAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.actions; 30 | 31 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 32 | 33 | import org.eclipse.swt.SWT; 34 | 35 | /** 36 | * An action to remove all filters currently enabled. 37 | * 38 | * @author Christophe Labouisse 39 | */ 40 | public class ClearFiltersAction extends GraphControllerAction { 41 | 42 | /** 43 | * Field DEFAULT_ACTION_NAME. 44 | * (value is {@value #DEFAULT_ACTION_NAME}) 45 | */ 46 | private static final String DEFAULT_ACTION_NAME = "Remove filters"; 47 | 48 | /** 49 | * Method run. 50 | * @see org.eclipse.jface.action.IAction#run() 51 | */ 52 | @Override 53 | public final void run() { 54 | getGraphController().clearFilters(); 55 | } 56 | 57 | /** 58 | * Constructor for ClearFiltersAction. 59 | * @param parent GraphControllerProvider 60 | */ 61 | public ClearFiltersAction(final GraphControllerProvider parent) { 62 | super(parent, DEFAULT_ACTION_NAME); 63 | setAccelerator((SWT.getPlatform().equals("cocoa") ? SWT.MOD1 : SWT.CONTROL) | SWT.ALT | 'C'); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/log/CommonsLoggingLoggerFactory.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.log; 29 | 30 | import net.ggtools.grand.log.LoggerFactory; 31 | 32 | import org.apache.commons.logging.Log; 33 | import org.apache.commons.logging.LogFactory; 34 | 35 | /** 36 | * Logger factory used to make Grand's core log using the same mechanism than 37 | * the UI. 38 | * 39 | * @author Christophe Labouisse 40 | */ 41 | public class CommonsLoggingLoggerFactory implements LoggerFactory { 42 | 43 | /** 44 | * Package instantiation only. 45 | */ 46 | public CommonsLoggingLoggerFactory() { 47 | } 48 | 49 | /** 50 | * Method getLog. 51 | * @param clazz Class<?> 52 | * @return Log 53 | * @see net.ggtools.grand.log.LoggerFactory#getLog(java.lang.Class) 54 | */ 55 | public final Log getLog(final Class clazz) { 56 | return LogFactory.getLog(clazz); 57 | } 58 | 59 | /** 60 | * Method getLog. 61 | * @param name String 62 | * @return Log 63 | * @see net.ggtools.grand.log.LoggerFactory#getLog(java.lang.String) 64 | */ 65 | public final Log getLog(final String name) { 66 | return LogFactory.getLog(name); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/AboutAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* ==================================================================== 3 | * Copyright (c) 2002-2003, Christophe Labouisse 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package net.ggtools.grand.ui.actions; 33 | 34 | import net.ggtools.grand.ui.widgets.AboutDialog; 35 | import net.ggtools.grand.ui.widgets.GraphWindow; 36 | 37 | import org.eclipse.jface.action.Action; 38 | 39 | /** 40 | * 41 | * 42 | * @author Christophe Labouisse 43 | */ 44 | public class AboutAction extends Action { 45 | 46 | /** 47 | * Field DEFAULT_ACTION_NAME. 48 | * (value is {@value #DEFAULT_ACTION_NAME}) 49 | */ 50 | private static final String DEFAULT_ACTION_NAME = "About Grand"; 51 | 52 | /** 53 | * Field window. 54 | */ 55 | private final GraphWindow window; 56 | 57 | /** 58 | * Constructor for AboutAction. 59 | * @param parent GraphWindow 60 | */ 61 | public AboutAction(final GraphWindow parent) { 62 | super(DEFAULT_ACTION_NAME); 63 | window = parent; 64 | } 65 | 66 | /** 67 | * Method run. 68 | * @see org.eclipse.jface.action.IAction#run() 69 | */ 70 | @Override 71 | public final void run() { 72 | final AboutDialog dialog = new AboutDialog(window.getShell()); 73 | dialog.open(); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/PageSetupAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* ==================================================================== 3 | * Copyright (c) 2002-2003, Christophe Labouisse 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package net.ggtools.grand.ui.actions; 33 | 34 | import net.ggtools.grand.ui.widgets.GraphWindow; 35 | import net.ggtools.grand.ui.widgets.PageSetupDialog; 36 | 37 | import org.eclipse.jface.action.Action; 38 | 39 | /** 40 | * 41 | * 42 | * @author Christophe Labouisse 43 | */ 44 | public class PageSetupAction extends Action { 45 | 46 | /** 47 | * Field DEFAULT_ACTION_NAME. 48 | * (value is {@value #DEFAULT_ACTION_NAME}) 49 | */ 50 | private static final String DEFAULT_ACTION_NAME = "Page Setup"; 51 | 52 | /** 53 | * Field window. 54 | */ 55 | private final GraphWindow window; 56 | 57 | /** 58 | * Constructor for PageSetupAction. 59 | * @param parent GraphWindow 60 | */ 61 | public PageSetupAction(final GraphWindow parent) { 62 | super(DEFAULT_ACTION_NAME); 63 | window = parent; 64 | } 65 | 66 | /** 67 | * Method run. 68 | * @see org.eclipse.jface.action.IAction#run() 69 | */ 70 | @Override 71 | public final void run() { 72 | final PageSetupDialog dialog = new PageSetupDialog(window.getShell()); 73 | dialog.open(); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/event/DispatcherAdapter.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.event; 30 | 31 | /** 32 | * Adapter class providing a straightforward implementation of dispatch. This 33 | * class is meant to be subclassed by defining the 34 | * {@link net.ggtools.grand.ui.event.Dispatcher#sendEventToSubscriber(Object, Object)} 35 | * method. 36 | * 37 | * @author Christophe Labouisse 38 | */ 39 | abstract class DispatcherAdapter implements Dispatcher { 40 | 41 | /** 42 | * Field eventManager. 43 | */ 44 | private final EventManager eventManager; 45 | 46 | /** 47 | * @param manager EventManager 48 | */ 49 | protected DispatcherAdapter(final EventManager manager) { 50 | eventManager = manager; 51 | } 52 | 53 | /** 54 | * Ask the EventManager to dispatch an event to the subscribers. 55 | * @param eventData Object 56 | * @see net.ggtools.grand.ui.event.Dispatcher#dispatch(Object) 57 | */ 58 | public final void dispatch(final Object eventData) { 59 | eventManager.dispatchEvent(eventData, this); 60 | } 61 | 62 | /** 63 | * @return Returns the eventManager. 64 | */ 65 | protected final EventManager getEventManager() { 66 | return eventManager; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/config/Grand.svg: -------------------------------------------------------------------------------- 1 | 2 | G 3 | G 4 | 5 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/FilterFromNodeAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.actions; 30 | 31 | import net.ggtools.grand.filters.FromNodeFilter; 32 | import net.ggtools.grand.filters.GraphFilter; 33 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 34 | import net.ggtools.grand.ui.graph.GraphListener; 35 | 36 | /** 37 | * Action to select only node on which the current node depend. 38 | * 39 | * @author Christophe Labouisse 40 | */ 41 | public class FilterFromNodeAction extends GraphSelectionAction 42 | implements GraphListener { 43 | 44 | /** 45 | * Field DEFAULT_ACTION_NAME. 46 | * (value is {@value #DEFAULT_ACTION_NAME}) 47 | */ 48 | private static final String DEFAULT_ACTION_NAME = 49 | "Filter from selected node"; 50 | 51 | /** 52 | * Constructor for FilterFromNodeAction. 53 | * @param parent GraphControllerProvider 54 | */ 55 | public FilterFromNodeAction(final GraphControllerProvider parent) { 56 | super(parent, DEFAULT_ACTION_NAME); 57 | } 58 | 59 | /** 60 | * Method run. 61 | * @see org.eclipse.jface.action.IAction#run() 62 | */ 63 | @Override 64 | public final void run() { 65 | final GraphFilter filter = new FromNodeFilter(getCurrentNode()); 66 | getGraphController().addFilter(filter); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/ShowSourcePanelAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* ==================================================================== 3 | * Copyright (c) 2002-2003, Christophe Labouisse 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package net.ggtools.grand.ui.actions; 33 | 34 | import net.ggtools.grand.ui.widgets.GraphWindow; 35 | 36 | import org.eclipse.jface.action.Action; 37 | import org.eclipse.swt.SWT; 38 | 39 | /** 40 | * 41 | * 42 | * @author Christophe Labouisse 43 | */ 44 | public class ShowSourcePanelAction extends Action { 45 | 46 | /** 47 | * Field DEFAULT_ACTION_NAME. 48 | * (value is {@value #DEFAULT_ACTION_NAME}) 49 | */ 50 | private static final String DEFAULT_ACTION_NAME = "Show source panel"; 51 | 52 | /** 53 | * Field window. 54 | */ 55 | private final GraphWindow window; 56 | 57 | /** 58 | * Constructor for ShowSourcePanelAction. 59 | * @param parent GraphWindow 60 | */ 61 | public ShowSourcePanelAction(final GraphWindow parent) { 62 | super(DEFAULT_ACTION_NAME); 63 | window = parent; 64 | setChecked(parent.isSourcePanelVisible()); 65 | setAccelerator((SWT.getPlatform().equals("cocoa") ? SWT.MOD1 : SWT.CONTROL) | SWT.ALT | 'S'); 66 | } 67 | 68 | /** 69 | * Method run. 70 | * @see org.eclipse.jface.action.IAction#run() 71 | */ 72 | @Override 73 | public final void run() { 74 | window.setSourcePanelVisible(isChecked()); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/ShowOutlinePanelAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* ==================================================================== 3 | * Copyright (c) 2002-2003, Christophe Labouisse 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package net.ggtools.grand.ui.actions; 33 | 34 | import net.ggtools.grand.ui.widgets.GraphWindow; 35 | 36 | import org.eclipse.jface.action.Action; 37 | import org.eclipse.swt.SWT; 38 | 39 | /** 40 | * 41 | * 42 | * @author Christophe Labouisse 43 | */ 44 | public class ShowOutlinePanelAction extends Action { 45 | 46 | /** 47 | * Field DEFAULT_ACTION_NAME. 48 | * (value is {@value #DEFAULT_ACTION_NAME}) 49 | */ 50 | private static final String DEFAULT_ACTION_NAME = "Show outline panel"; 51 | 52 | /** 53 | * Field window. 54 | */ 55 | private final GraphWindow window; 56 | 57 | /** 58 | * Constructor for ShowOutlinePanelAction. 59 | * @param parent GraphWindow 60 | */ 61 | public ShowOutlinePanelAction(final GraphWindow parent) { 62 | super(DEFAULT_ACTION_NAME); 63 | window = parent; 64 | setChecked(parent.isOutlinePanelVisible()); 65 | setAccelerator((SWT.getPlatform().equals("cocoa") ? SWT.MOD1 : SWT.CONTROL) | SWT.ALT | 'O'); 66 | } 67 | 68 | /** 69 | * Method run. 70 | * @see org.eclipse.jface.action.IAction#run() 71 | */ 72 | @Override 73 | public final void run() { 74 | window.setOutlinePanelVisible(isChecked()); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/FilterConnectedToNodeAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.actions; 30 | 31 | import net.ggtools.grand.filters.ConnectedToNodeFilter; 32 | import net.ggtools.grand.filters.GraphFilter; 33 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 34 | import net.ggtools.grand.ui.graph.GraphListener; 35 | 36 | /** 37 | * An action to add a filter to the currently selected node. 38 | * 39 | * @author Christophe Labouisse 40 | */ 41 | public class FilterConnectedToNodeAction extends GraphSelectionAction 42 | implements GraphListener { 43 | 44 | /** 45 | * Field DEFAULT_ACTION_NAME. 46 | * (value is {@value #DEFAULT_ACTION_NAME}) 47 | */ 48 | private static final String DEFAULT_ACTION_NAME = 49 | "Filter connected to selected node"; 50 | 51 | /** 52 | * Method run. 53 | * @see org.eclipse.jface.action.IAction#run() 54 | */ 55 | @Override 56 | public final void run() { 57 | final GraphFilter filter = new ConnectedToNodeFilter(getCurrentNode()); 58 | getGraphController().addFilter(filter); 59 | } 60 | 61 | /** 62 | * Constructor for FilterConnectedToNodeAction. 63 | * @param parent GraphControllerProvider 64 | */ 65 | public FilterConnectedToNodeAction(final GraphControllerProvider parent) { 66 | super(parent, DEFAULT_ACTION_NAME); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/FilterIsolatedNodesAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.actions; 30 | 31 | import net.ggtools.grand.filters.GraphFilter; 32 | import net.ggtools.grand.filters.IsolatedNodeFilter; 33 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 34 | 35 | import org.eclipse.swt.SWT; 36 | 37 | /** 38 | * An action to filter the isolated nodes. 39 | * 40 | * @author Christophe Labouisse 41 | */ 42 | public class FilterIsolatedNodesAction extends GraphControllerAction { 43 | 44 | /** 45 | * Field DEFAULT_ACTION_NAME. 46 | * (value is {@value #DEFAULT_ACTION_NAME}) 47 | */ 48 | private static final String DEFAULT_ACTION_NAME = 49 | "Filter out isolated nodes"; 50 | 51 | /** 52 | * Method run. 53 | * @see org.eclipse.jface.action.IAction#run() 54 | */ 55 | @Override 56 | public final void run() { 57 | final GraphFilter filter = new IsolatedNodeFilter(); 58 | getGraphController().addFilter(filter); 59 | } 60 | 61 | /** 62 | * Constructor for FilterIsolatedNodesAction. 63 | * @param parent GraphControllerProvider 64 | */ 65 | public FilterIsolatedNodesAction(final GraphControllerProvider parent) { 66 | super(parent, DEFAULT_ACTION_NAME); 67 | setAccelerator((SWT.getPlatform().equals("cocoa") ? SWT.MOD1 : SWT.CONTROL) | SWT.ALT | 'I'); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/FilterMissingNodesAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.actions; 30 | 31 | import net.ggtools.grand.filters.GraphFilter; 32 | import net.ggtools.grand.filters.MissingNodeFilter; 33 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 34 | 35 | import org.eclipse.swt.SWT; 36 | 37 | /** 38 | * An action to filter the missing nodes. 39 | * 40 | * @author Christophe Labouisse 41 | */ 42 | public class FilterMissingNodesAction extends GraphControllerAction { 43 | 44 | /** 45 | * Field DEFAULT_ACTION_NAME. 46 | * (value is {@value #DEFAULT_ACTION_NAME}) 47 | */ 48 | private static final String DEFAULT_ACTION_NAME = 49 | "Filter out missing nodes"; 50 | 51 | /** 52 | * Method run. 53 | * @see org.eclipse.jface.action.IAction#run() 54 | */ 55 | @Override 56 | public final void run() { 57 | final GraphFilter filter = new MissingNodeFilter(); 58 | getGraphController().addFilter(filter); 59 | } 60 | 61 | /** 62 | * Constructor for FilterMissingNodesAction. 63 | * @param parent GraphControllerProvider 64 | */ 65 | public FilterMissingNodesAction(final GraphControllerProvider parent) { 66 | super(parent, DEFAULT_ACTION_NAME); 67 | setAccelerator((SWT.getPlatform().equals("cocoa") ? SWT.MOD1 : SWT.CONTROL) | SWT.ALT | 'M'); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/FilterPrefixedNodesAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.actions; 30 | 31 | import net.ggtools.grand.filters.GraphFilter; 32 | import net.ggtools.grand.filters.PrefixedNodeFilter; 33 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 34 | 35 | import org.eclipse.swt.SWT; 36 | 37 | /** 38 | * An action to filter the prefixed nodes. 39 | * 40 | * @author Christophe Labouisse 41 | */ 42 | public class FilterPrefixedNodesAction extends GraphControllerAction { 43 | 44 | /** 45 | * Field DEFAULT_ACTION_NAME. 46 | * (value is {@value #DEFAULT_ACTION_NAME}) 47 | */ 48 | private static final String DEFAULT_ACTION_NAME = 49 | "Filter out prefixed nodes"; 50 | 51 | /** 52 | * Method run. 53 | * @see org.eclipse.jface.action.IAction#run() 54 | */ 55 | @Override 56 | public final void run() { 57 | final GraphFilter filter = new PrefixedNodeFilter(); 58 | getGraphController().addFilter(filter); 59 | } 60 | 61 | /** 62 | * Constructor for FilterPrefixedNodesAction. 63 | * @param parent GraphControllerProvider 64 | */ 65 | public FilterPrefixedNodesAction(final GraphControllerProvider parent) { 66 | super(parent, DEFAULT_ACTION_NAME); 67 | setAccelerator((SWT.getPlatform().equals("cocoa") ? SWT.MOD1 : SWT.CONTROL) | SWT.ALT | 'P'); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/FilterToNodeAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.actions; 30 | 31 | import net.ggtools.grand.filters.GraphFilter; 32 | import net.ggtools.grand.filters.ToNodeFilter; 33 | import net.ggtools.grand.ui.graph.GraphControllerListener; 34 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 35 | import net.ggtools.grand.ui.graph.GraphListener; 36 | 37 | /** 38 | * Action to select only node depending on the selected node. 39 | * 40 | * @author Christophe Labouisse 41 | */ 42 | public class FilterToNodeAction extends GraphSelectionAction 43 | implements GraphControllerListener, GraphListener { 44 | 45 | /** 46 | * Field DEFAULT_ACTION_NAME. 47 | * (value is {@value #DEFAULT_ACTION_NAME}) 48 | */ 49 | private static final String DEFAULT_ACTION_NAME = "Filter to selected node"; 50 | 51 | /** 52 | * Constructor for FilterToNodeAction. 53 | * @param parent GraphControllerProvider 54 | */ 55 | public FilterToNodeAction(final GraphControllerProvider parent) { 56 | super(parent, DEFAULT_ACTION_NAME); 57 | } 58 | 59 | /** 60 | * Method run. 61 | * @see org.eclipse.jface.action.IAction#run() 62 | */ 63 | @Override 64 | public final void run() { 65 | final GraphFilter filter = new ToNodeFilter(getCurrentNode()); 66 | getGraphController().addFilter(filter); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/ReloadGraphAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.actions; 30 | 31 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 32 | 33 | import org.eclipse.swt.SWT; 34 | 35 | /** 36 | * @author Christophe Labouisse 37 | * @see org.eclipse.jface.action.Action 38 | */ 39 | public class ReloadGraphAction extends GraphControllerAction { 40 | 41 | /** 42 | * Field DEFAULT_ACTION_NAME. 43 | * (value is {@value #DEFAULT_ACTION_NAME}) 44 | */ 45 | private static final String DEFAULT_ACTION_NAME = "Reload Graph"; 46 | 47 | /** 48 | * Method run. 49 | * @see org.eclipse.jface.action.IAction#run() 50 | */ 51 | @Override 52 | public final void run() { 53 | getGraphController().reloadGraph(); 54 | } 55 | 56 | /** 57 | * Creates a new ReloadGraphAction object. 58 | * 59 | * @param parent GraphWindow 60 | */ 61 | public ReloadGraphAction(final GraphControllerProvider parent) { 62 | this(parent, DEFAULT_ACTION_NAME); 63 | } 64 | 65 | /** 66 | * Creates a new QuickOpenFileAction object with specific name. 67 | * 68 | * @param parent GraphWindow 69 | * @param name String 70 | */ 71 | public ReloadGraphAction(final GraphControllerProvider parent, 72 | final String name) { 73 | super(parent, name); 74 | setAccelerator(SWT.F5); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/PreferenceAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.actions; 30 | 31 | import net.ggtools.grand.ui.prefs.GrandUiPreferenceManager; 32 | import net.ggtools.grand.ui.widgets.GraphWindow; 33 | 34 | import org.eclipse.jface.action.Action; 35 | import org.eclipse.jface.preference.PreferenceDialog; 36 | 37 | /** 38 | * @author Christophe Labouisse 39 | * @see org.eclipse.jface.action.Action 40 | */ 41 | public class PreferenceAction extends Action { 42 | 43 | /** 44 | * Field DEFAULT_ACTION_NAME. 45 | * (value is {@value #DEFAULT_ACTION_NAME}) 46 | */ 47 | private static final String DEFAULT_ACTION_NAME = "Preferences"; 48 | 49 | /** 50 | * Field window. 51 | */ 52 | private final GraphWindow window; 53 | 54 | /** 55 | * Method run. 56 | * @see org.eclipse.jface.action.IAction#run() 57 | */ 58 | @Override 59 | public final void run() { 60 | final GrandUiPreferenceManager pm = new GrandUiPreferenceManager(); 61 | final PreferenceDialog dialog = 62 | new PreferenceDialog(window.getShell(), pm); 63 | dialog.open(); 64 | } 65 | 66 | /** 67 | * Creates a new PreferenceAction object. 68 | * 69 | * @param parent GraphWindow 70 | */ 71 | public PreferenceAction(final GraphWindow parent) { 72 | super(DEFAULT_ACTION_NAME); 73 | window = parent; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/graph/draw2d/ConstrainedPageFlowLayout.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.graph.draw2d; 29 | 30 | import org.eclipse.draw2d.text.FlowPage; 31 | import org.eclipse.draw2d.text.PageFlowLayout; 32 | 33 | /** 34 | * A layout for {@link org.eclipse.draw2d.text.FlowPage}object with a maximum 35 | * width. 36 | * 37 | * @author Christophe Labouisse 38 | */ 39 | public class ConstrainedPageFlowLayout extends PageFlowLayout { 40 | 41 | /** 42 | * Field maxFlowWidth. 43 | */ 44 | private int maxFlowWidth = -1; // Default is not to bound lines. 45 | 46 | /** 47 | * Creates a new instance without any constrained width. 48 | * @param page FlowPage 49 | */ 50 | public ConstrainedPageFlowLayout(final FlowPage page) { 51 | super(page); 52 | } 53 | 54 | /** 55 | * @return Returns the maximum flow width or -1 if not set. 56 | */ 57 | public final int getMaxFlowWidth() { 58 | return maxFlowWidth; 59 | } 60 | 61 | /** 62 | * Sets the maximum with of the flow. When set to a positive value, the 63 | * layout will ensure that the flow lines won't be wider than this value. 64 | * 65 | * @param maxFlowWidth 66 | * The maxFlowWidth to set or -1 not to bound the 67 | * flow width. 68 | */ 69 | public final void setMaxFlowWidth(final int maxFlowWidth) { 70 | this.maxFlowWidth = maxFlowWidth; 71 | invalidate(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/menu/FileMenuManager.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* ==================================================================== 3 | * Copyright (c) 2002-2003, Christophe Labouisse 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package net.ggtools.grand.ui.menu; 33 | 34 | import net.ggtools.grand.ui.actions.OpenFileAction; 35 | import net.ggtools.grand.ui.actions.PageSetupAction; 36 | import net.ggtools.grand.ui.actions.PreferenceAction; 37 | import net.ggtools.grand.ui.actions.PrintAction; 38 | import net.ggtools.grand.ui.actions.QuickOpenFileAction; 39 | import net.ggtools.grand.ui.actions.QuitAction; 40 | import net.ggtools.grand.ui.widgets.GraphWindow; 41 | 42 | import org.eclipse.jface.action.MenuManager; 43 | import org.eclipse.jface.action.Separator; 44 | import org.eclipse.swt.SWT; 45 | 46 | /** 47 | * 48 | * 49 | * @author Christophe Labouisse 50 | */ 51 | public class FileMenuManager extends MenuManager { 52 | /** 53 | * Constructor for FileMenuManager. 54 | * @param window GraphWindow 55 | */ 56 | public FileMenuManager(final GraphWindow window) { 57 | super("File"); 58 | add(new QuickOpenFileAction(window)); 59 | add(new OpenFileAction(window)); 60 | add(new Separator("recent files")); 61 | add(new RecentFilesMenu(window)); 62 | add(new Separator("print")); 63 | add(new PageSetupAction(window)); 64 | add(new PrintAction(window)); 65 | if (!SWT.getPlatform().equals("cocoa")) { 66 | add(new PreferenceAction(window)); 67 | add(new Separator("quit")); 68 | add(new QuitAction()); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/menu/ViewMenu.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* ==================================================================== 3 | * Copyright (c) 2002-2003, Christophe Labouisse 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package net.ggtools.grand.ui.menu; 33 | 34 | import net.ggtools.grand.ui.actions.ShowLogAction; 35 | import net.ggtools.grand.ui.actions.ShowOutlinePanelAction; 36 | import net.ggtools.grand.ui.actions.ShowSourcePanelAction; 37 | import net.ggtools.grand.ui.actions.UseBusRoutingAction; 38 | import net.ggtools.grand.ui.actions.ZoomInAction; 39 | import net.ggtools.grand.ui.actions.ZoomOutAction; 40 | import net.ggtools.grand.ui.actions.ZoomResetAction; 41 | import net.ggtools.grand.ui.widgets.GraphWindow; 42 | 43 | import org.eclipse.jface.action.MenuManager; 44 | import org.eclipse.jface.action.Separator; 45 | 46 | /** 47 | * 48 | * 49 | * @author Christophe Labouisse 50 | */ 51 | public class ViewMenu extends MenuManager { 52 | 53 | /** 54 | * Constructor for ViewMenu. 55 | * @param window GraphWindow 56 | */ 57 | public ViewMenu(final GraphWindow window) { 58 | super("View"); 59 | add(new Separator("panels")); 60 | add(new ShowSourcePanelAction(window)); 61 | add(new ShowOutlinePanelAction(window)); 62 | add(new Separator("display")); 63 | add(new UseBusRoutingAction(window)); 64 | add(new Separator("zoom")); 65 | add(new ZoomInAction(window)); 66 | add(new ZoomOutAction(window)); 67 | add(new ZoomResetAction(window)); 68 | // Zoom menu 69 | add(new Separator("misc")); 70 | add(new ShowLogAction(window)); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/EditGraphPropertiesAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.actions; 30 | 31 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 32 | import net.ggtools.grand.ui.widgets.PropertyEditionDialog; 33 | 34 | import org.eclipse.jface.window.Window; 35 | import org.eclipse.swt.SWT; 36 | 37 | /** 38 | * An action to remove all filters currently enabled. 39 | * 40 | * @author Christophe Labouisse 41 | */ 42 | public class EditGraphPropertiesAction extends GraphControllerAction { 43 | 44 | /** 45 | * Field DEFAULT_ACTION_NAME. 46 | * (value is {@value #DEFAULT_ACTION_NAME}) 47 | */ 48 | private static final String DEFAULT_ACTION_NAME = "Edit Properties"; 49 | 50 | /** 51 | * Method run. 52 | * @see org.eclipse.jface.action.IAction#run() 53 | */ 54 | @Override 55 | public final void run() { 56 | final PropertyEditionDialog dialog = 57 | new PropertyEditionDialog(getGraphController().getWindow().getShell()); 58 | dialog.setProperties(getGraphController().getGraphProperties()); 59 | if (dialog.open() == Window.OK) { 60 | getGraphController().reloadGraph(dialog.getProperties()); 61 | } 62 | } 63 | 64 | /** 65 | * Constructor for EditGraphPropertiesAction. 66 | * @param parent GraphControllerProvider 67 | */ 68 | public EditGraphPropertiesAction(final GraphControllerProvider parent) { 69 | super(parent, DEFAULT_ACTION_NAME); 70 | setAccelerator((SWT.getPlatform().equals("cocoa") ? SWT.MOD1 : SWT.CONTROL) | 'E'); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/test/java/net/ggtools/grand/ui/widgets/property/PropertyEditorTestApp.java: -------------------------------------------------------------------------------- 1 | //$Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.widgets.property; 29 | 30 | import java.util.Properties; 31 | 32 | import org.eclipse.swt.SWT; 33 | import org.eclipse.swt.layout.FillLayout; 34 | import org.eclipse.swt.widgets.Composite; 35 | import org.eclipse.swt.widgets.Display; 36 | import org.eclipse.swt.widgets.Shell; 37 | 38 | /** 39 | * @author Christophe Labouisse 40 | */ 41 | public class PropertyEditorTestApp { 42 | /** 43 | * Main method to launch the window. 44 | * @param args String[] 45 | */ 46 | public static void main(final String[] args) { 47 | final Shell shell = new Shell(); 48 | shell.setText("Property List - TableViewer Example"); 49 | shell.setLayout(new FillLayout()); 50 | final Composite composite = new Composite(shell, SWT.NONE); 51 | composite.setLayout(new FillLayout()); 52 | final PropertyEditor propertyViewer = new PropertyEditor(composite, SWT.NONE); 53 | final Properties props = new Properties(); 54 | props.setProperty("ga", "azerty"); 55 | props.setProperty("bu", "aqsdfzerty"); 56 | props.setProperty("zo", "12345"); 57 | propertyViewer.setInput(props); 58 | 59 | // Ask the shell to display its content 60 | shell.open(); 61 | final Display display = shell.getDisplay(); 62 | while (!shell.isDisposed()) { 63 | if (!display.readAndDispatch()) { 64 | display.sleep(); 65 | } 66 | } 67 | System.err.println(propertyViewer.getPropertyList()); 68 | System.exit(0); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/graph/GraphDisplayer.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.graph; 30 | 31 | import net.ggtools.grand.ant.AntTargetNode.SourceElement; 32 | import net.ggtools.grand.ui.graph.draw2d.Draw2dGraph; 33 | 34 | import org.eclipse.swt.widgets.Menu; 35 | 36 | /** 37 | * Interface to be implemented by classes displaying graphs. 38 | * 39 | * @author Christophe Labouisse 40 | */ 41 | public interface GraphDisplayer extends GraphControllerProvider { 42 | 43 | /** 44 | * Get the widget context menu. 45 | * @return Menu 46 | */ 47 | Menu getContextMenu(); 48 | 49 | /** 50 | * Scroll the canvas to display a specific node. 51 | * 52 | * @param nodeName 53 | * Node to be shown. 54 | */ 55 | void jumpToNode(final String nodeName); 56 | 57 | /** 58 | * Ask to display the supplied figure. 59 | * @param graph Draw2dGraph 60 | * @param name String 61 | * @param toolTip String 62 | */ 63 | void setGraph(Draw2dGraph graph, String name, String toolTip); 64 | 65 | /** 66 | * @param richSource SourceElement[] 67 | */ 68 | void setRichSource(SourceElement[] richSource); 69 | 70 | /** 71 | * Sets a text to display. 72 | * @param text String 73 | */ 74 | void setSourceText(String text); 75 | 76 | /** 77 | * Zoom in the displayed graph by one step. 78 | * 79 | */ 80 | void zoomIn(); 81 | 82 | /** 83 | * Zoom out the displayed graph by one step. 84 | * 85 | */ 86 | void zoomOut(); 87 | 88 | /** 89 | * Reset the zoom factor to 1:1. 90 | * 91 | */ 92 | void zoomReset(); 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/widgets/property/PropertyPair.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.widgets.property; 29 | 30 | import java.util.Map.Entry; 31 | 32 | /** 33 | * @author Christophe Labouisse 34 | */ 35 | class PropertyPair { 36 | /** 37 | * Field name. 38 | */ 39 | private String name; 40 | 41 | /** 42 | * Field value. 43 | */ 44 | private String value; 45 | 46 | /** 47 | * Constructor for PropertyPair. 48 | * @param name Object 49 | * @param value Object 50 | */ 51 | public PropertyPair(final Object name, final Object value) { 52 | this.name = (name instanceof String) ? (String) name : name.toString(); 53 | this.value = (value instanceof String) ? (String) value : value.toString(); 54 | } 55 | 56 | /** 57 | * Creates a new PropertyPair from a Map.Entry. The entry key & value should 58 | * be both instance of String. 59 | * 60 | * @param entry Entry<Object, Object> 61 | */ 62 | public PropertyPair(final Entry entry) { 63 | this(entry.getKey(), entry.getValue()); 64 | } 65 | 66 | /** 67 | * Method getName. 68 | * @return String 69 | */ 70 | public final String getName() { 71 | return name; 72 | } 73 | 74 | /** 75 | * Method setName. 76 | * @param name String 77 | */ 78 | public final void setName(final String name) { 79 | this.name = name; 80 | } 81 | 82 | /** 83 | * Method getValue. 84 | * @return String 85 | */ 86 | public final String getValue() { 87 | return value; 88 | } 89 | 90 | /** 91 | * Method setValue. 92 | * @param value String 93 | */ 94 | public final void setValue(final String value) { 95 | this.value = value; 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /src/main/resources/log4j.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/widgets/LogWindow.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.widgets; 29 | 30 | import net.ggtools.grand.ui.log.LogEventBufferImpl; 31 | import net.ggtools.grand.ui.log.LogViewer; 32 | 33 | import org.eclipse.jface.window.Window; 34 | import org.eclipse.swt.SWT; 35 | import org.eclipse.swt.layout.GridLayout; 36 | import org.eclipse.swt.widgets.Composite; 37 | import org.eclipse.swt.widgets.Control; 38 | import org.eclipse.swt.widgets.Shell; 39 | 40 | /** 41 | * Window containing a {@link net.ggtools.grand.ui.log.LogViewer} widget. 42 | * 43 | * @author Christophe Labouisse 44 | */ 45 | public class LogWindow extends Window { 46 | 47 | /** 48 | * Field viewer. 49 | */ 50 | private LogViewer viewer; 51 | 52 | /** 53 | * @param parentShell Shell 54 | */ 55 | public LogWindow(final Shell parentShell) { 56 | super(parentShell); 57 | setShellStyle(SWT.SHELL_TRIM); 58 | setBlockOnOpen(false); 59 | } 60 | 61 | /** 62 | * Method configureShell. 63 | * @param newShell Shell 64 | * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) 65 | */ 66 | @Override 67 | protected final void configureShell(final Shell newShell) { 68 | super.configureShell(newShell); 69 | newShell.setText("Logs"); 70 | } 71 | 72 | /** 73 | * Method createContents. 74 | * @param parent Composite 75 | * @return Control 76 | * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) 77 | */ 78 | @Override 79 | protected final Control createContents(final Composite parent) { 80 | final GridLayout layout = new GridLayout(); 81 | parent.setLayout(layout); 82 | viewer = new LogViewer(parent, SWT.BORDER); 83 | viewer.setLogBuffer(LogEventBufferImpl.getInstance()); 84 | return parent; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/event/SimpleDispatcher.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.event; 30 | 31 | import java.lang.reflect.InvocationTargetException; 32 | import java.lang.reflect.Method; 33 | 34 | import org.apache.commons.logging.Log; 35 | import org.apache.commons.logging.LogFactory; 36 | 37 | /** 38 | * A simple dispatcher implementation of InternalDispatcher using 39 | * invoke to actually dispatch the events. 40 | * 41 | * @author Christophe Labouisse 42 | */ 43 | class SimpleDispatcher extends DispatcherAdapter implements Dispatcher { 44 | /** 45 | * Field log. 46 | */ 47 | private static final Log LOG = LogFactory.getLog(SimpleDispatcher.class); 48 | 49 | /** 50 | * Field method. 51 | */ 52 | private final Method method; 53 | 54 | /** 55 | * Constructor for SimpleDispatcher. 56 | * @param manager EventManager 57 | * @param method Method 58 | */ 59 | SimpleDispatcher(final EventManager manager, final Method method) { 60 | super(manager); 61 | this.method = method; 62 | } 63 | 64 | /** 65 | * Method sendEventToSubscriber. 66 | * @param subscriber Object 67 | * @param eventData Object 68 | * @see net.ggtools.grand.ui.event.Dispatcher#sendEventToSubscriber(java.lang.Object, java.lang.Object) 69 | */ 70 | public void sendEventToSubscriber(final Object subscriber, 71 | final Object eventData) { 72 | try { 73 | method.invoke(subscriber, eventData); 74 | } catch (final IllegalAccessException e) { 75 | LOG.fatal(getEventManager().getName() + " dispatchOneEvent", e); 76 | throw new RuntimeException(e); 77 | } catch (final InvocationTargetException e) { 78 | LOG.error(getEventManager().getName() + " dispatchOneEvent", e); 79 | throw new RuntimeException(e.getCause()); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/graph/SelectionManager.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.graph; 30 | 31 | import java.util.Collection; 32 | 33 | import net.ggtools.grand.ui.graph.draw2d.Draw2dNode; 34 | 35 | /** 36 | * 37 | * 38 | * @author Christophe Labouisse 39 | */ 40 | public interface SelectionManager { 41 | /** 42 | * Method addListener. 43 | * @param listener GraphListener 44 | */ 45 | void addListener(GraphListener listener); 46 | 47 | /** 48 | * Deselect all nodes in the graph. 49 | */ 50 | void deselectAllNodes(); 51 | 52 | /** 53 | * Deselect a node. 54 | * 55 | * @param node Draw2dNode 56 | */ 57 | void deselectNode(Draw2dNode node); 58 | 59 | /** 60 | * Returns a collection of the current selection. 61 | * 62 | * @return a read-only collection of the selected nodes. 63 | */ 64 | Collection getSelection(); 65 | 66 | /** 67 | * Method removeSelectionListener. 68 | * @param listener GraphListener 69 | */ 70 | void removeSelectionListener(GraphListener listener); 71 | 72 | /** 73 | * Selects a specific node in the graph. 74 | * 75 | * @param node 76 | * node to select 77 | * @param addToSelection 78 | * if true the node is added to the current 79 | * selection rather than replacing it. 80 | */ 81 | void selectNode(final Draw2dNode node, final boolean addToSelection); 82 | 83 | /** 84 | * Selects a specific node in the graph. 85 | * 86 | * @param nodeName 87 | * name of the node to select 88 | * @param addToSelection 89 | * if true the node is added to the current 90 | * selection rather than replacing it. 91 | */ 92 | void selectNodeByName(final String nodeName, final boolean addToSelection); 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/prefs/GrandUiPreferenceManager.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.prefs; 29 | 30 | import net.ggtools.grand.ui.Application; 31 | 32 | import org.eclipse.jface.preference.IPersistentPreferenceStore; 33 | import org.eclipse.jface.preference.IPreferenceNode; 34 | import org.eclipse.jface.preference.PreferenceManager; 35 | import org.eclipse.jface.preference.PreferenceNode; 36 | import org.eclipse.jface.preference.PreferencePage; 37 | 38 | /** 39 | * @author Christophe Labouisse 40 | */ 41 | public class GrandUiPreferenceManager extends PreferenceManager { 42 | 43 | /** 44 | * Constructor for GrandUiPreferenceManager. 45 | */ 46 | public GrandUiPreferenceManager() { 47 | final PreferencePage generalPage = new GeneralPreferencePage(); 48 | final IPersistentPreferenceStore preferenceStore = 49 | Application.getInstance().getPreferenceStore(); 50 | generalPage.setPreferenceStore(preferenceStore); 51 | final IPreferenceNode generalPageNode = 52 | new PreferenceNode("General", generalPage); 53 | addToRoot(generalPageNode); 54 | final PreferencePage graphPage = new GraphPreferencePage(); 55 | graphPage.setPreferenceStore(preferenceStore); 56 | final IPreferenceNode graphNode = 57 | new PreferenceNode("Graph", graphPage); 58 | addToRoot(graphNode); 59 | final PreferencePage nodePage = new NodesPreferencePage(); 60 | nodePage.setPreferenceStore(preferenceStore); 61 | final IPreferenceNode nodesNode = new PreferenceNode("Nodes", nodePage); 62 | graphNode.add(nodesNode); 63 | final PreferencePage linksPage = new LinksPreferencePage(); 64 | linksPage.setPreferenceStore(preferenceStore); 65 | final IPreferenceNode linksNode = 66 | new PreferenceNode("Nodes", linksPage); 67 | graphNode.add(linksNode); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/OpenFileAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* ==================================================================== 3 | * Copyright (c) 2002-2003, Christophe Labouisse 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package net.ggtools.grand.ui.actions; 33 | 34 | import net.ggtools.grand.ui.widgets.GraphWindow; 35 | import net.ggtools.grand.ui.widgets.OpenFileWizard; 36 | 37 | import org.eclipse.jface.action.Action; 38 | import org.eclipse.jface.wizard.IWizard; 39 | import org.eclipse.jface.wizard.WizardDialog; 40 | import org.eclipse.swt.SWT; 41 | 42 | /** 43 | * Open a build file allowing setting some properties. 44 | * 45 | * @author Christophe Labouisse 46 | * @see org.eclipse.jface.action.Action 47 | */ 48 | public class OpenFileAction extends Action { 49 | 50 | /** 51 | * Field DEFAULT_ACTION_NAME. 52 | * (value is {@value #DEFAULT_ACTION_NAME}) 53 | */ 54 | private static final String DEFAULT_ACTION_NAME = "Open with properties"; 55 | 56 | /** 57 | * Field window. 58 | */ 59 | private final GraphWindow window; 60 | 61 | /** 62 | * Method run. 63 | * @see org.eclipse.jface.action.IAction#run() 64 | */ 65 | @Override 66 | public final void run() { 67 | final IWizard wizard = new OpenFileWizard(window); 68 | final WizardDialog dialog = new WizardDialog(window.getShell(), wizard); 69 | dialog.create(); 70 | dialog.open(); 71 | } 72 | 73 | /** 74 | * Creates a new QuickOpenFileAction object. 75 | * 76 | * @param parent GraphWindow 77 | */ 78 | public OpenFileAction(final GraphWindow parent) { 79 | super(DEFAULT_ACTION_NAME); 80 | window = parent; 81 | setAccelerator(SWT.SHIFT | (SWT.getPlatform().equals("cocoa") ? SWT.MOD1 : SWT.CONTROL) | 'O'); 82 | } 83 | 84 | /** 85 | * Creates a new QuickOpenFileAction object with specific name. 86 | * 87 | * @param name String 88 | * @param parent GraphWindow 89 | */ 90 | public OpenFileAction(final String name, final GraphWindow parent) { 91 | super(name); 92 | window = parent; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/prefs/GraphPreferencePage.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.prefs; 29 | 30 | import org.eclipse.jface.preference.BooleanFieldEditor; 31 | import org.eclipse.jface.preference.FieldEditorPreferencePage; 32 | import org.eclipse.jface.preference.IPreferenceStore; 33 | import org.eclipse.swt.widgets.Composite; 34 | 35 | /** 36 | * @author Christophe Labouisse 37 | */ 38 | public class GraphPreferencePage extends FieldEditorPreferencePage 39 | implements PreferenceKeys { 40 | /** 41 | * Method setDefaults. 42 | * @param prefs IPreferenceStore 43 | */ 44 | public static void setDefaults(final IPreferenceStore prefs) { 45 | prefs.setDefault(GRAPH_BUS_ENABLED_DEFAULT, false); 46 | prefs.setDefault(GRAPH_BUS_IN_THRESHOLD, 5); 47 | prefs.setDefault(GRAPH_BUS_OUT_THRESHOLD, 5); 48 | } 49 | 50 | /** 51 | * 52 | */ 53 | public GraphPreferencePage() { 54 | super("Graph", GRID); 55 | } 56 | 57 | /** 58 | * Method createFieldEditors. 59 | * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() 60 | */ 61 | @Override 62 | protected final void createFieldEditors() { 63 | final Composite parent = getFieldEditorParent(); 64 | final BooleanFieldEditor enableBusRouting = 65 | new BooleanFieldEditor(GRAPH_BUS_ENABLED_DEFAULT, 66 | "Bus routing enabled on graph loading", parent); 67 | addField(enableBusRouting); 68 | final SpinnerFieldEditor inThreshold = 69 | new SpinnerFieldEditor(GRAPH_BUS_IN_THRESHOLD, 70 | "Bus routing in threshold", parent); 71 | inThreshold.setValidRange(1, 99); 72 | addField(inThreshold); 73 | final SpinnerFieldEditor outThreshold = 74 | new SpinnerFieldEditor(GRAPH_BUS_OUT_THRESHOLD, 75 | "Bus routing out threshold", parent); 76 | outThreshold.setValidRange(1, 99); 77 | addField(outThreshold); 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/test/resources/seq-build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/graph/draw2d/XYRelativeAnchor.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.graph.draw2d; 30 | 31 | import org.eclipse.draw2d.ConnectionAnchorBase; 32 | import org.eclipse.draw2d.IFigure; 33 | import org.eclipse.draw2d.geometry.Point; 34 | 35 | /** 36 | * An anchor positioned to a XY position relatively to a 37 | * {@link org.eclipse.draw2d.IFigure}. 38 | * 39 | * @author Christophe Labouisse 40 | */ 41 | public class XYRelativeAnchor extends ConnectionAnchorBase { 42 | /** 43 | * Field owner. 44 | */ 45 | private final IFigure owner; 46 | 47 | /** 48 | * Field location. 49 | */ 50 | private final Point location; 51 | 52 | /** 53 | * 54 | * @param owner IFigure 55 | * @param location Point 56 | */ 57 | public XYRelativeAnchor(final IFigure owner, final Point location) { 58 | this.owner = owner; 59 | this.location = location; 60 | } 61 | 62 | /** 63 | * Method getLocation. 64 | * @param reference Point 65 | * @return Point 66 | * @see org.eclipse.draw2d.ConnectionAnchor#getLocation(org.eclipse.draw2d.geometry.Point) 67 | */ 68 | public final Point getLocation(final Point reference) { 69 | final Point result = location.getCopy(); 70 | getOwner().translateToAbsolute(result); 71 | return result; 72 | } 73 | 74 | /** 75 | * Method getOwner. 76 | * @return IFigure 77 | * @see org.eclipse.draw2d.ConnectionAnchor#getOwner() 78 | */ 79 | public final IFigure getOwner() { 80 | return owner; 81 | } 82 | 83 | /** 84 | * Method getReferencePoint. 85 | * @return Point 86 | * @see org.eclipse.draw2d.ConnectionAnchor#getReferencePoint() 87 | */ 88 | public final Point getReferencePoint() { 89 | return location; 90 | } 91 | 92 | /** 93 | * Method setLocation. 94 | * @param p Point 95 | */ 96 | public final void setLocation(final Point p) { 97 | location.setLocation(p); 98 | fireAnchorMoved(); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/widgets/ExceptionDialog.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.widgets; 29 | 30 | import org.eclipse.core.runtime.IStatus; 31 | import org.eclipse.core.runtime.MultiStatus; 32 | import org.eclipse.core.runtime.Status; 33 | import org.eclipse.jface.dialogs.ErrorDialog; 34 | import org.eclipse.swt.widgets.Display; 35 | import org.eclipse.swt.widgets.Shell; 36 | 37 | /** 38 | * A dialog specialized in displaying exception. Quite minimal at the moment, 39 | * except for a high level openException taking directly an exception. 40 | * 41 | * @author Christophe Labouisse 42 | */ 43 | public final class ExceptionDialog extends ErrorDialog { 44 | /** 45 | * Constructor for ExceptionDialog. 46 | * @param parentShell Shell 47 | * @param dialogTitle String 48 | * @param message String 49 | * @param status IStatus 50 | * @param displayMask int 51 | */ 52 | private ExceptionDialog(final Shell parentShell, final String dialogTitle, 53 | final String message, final IStatus status, final int displayMask) { 54 | super(parentShell, dialogTitle, message, status, displayMask); 55 | } 56 | 57 | /** 58 | * Opens a dialog to display an error caused by an exception. 59 | * This method is intended to work regardless of the current thread. 60 | * 61 | * @param parent Shell 62 | * @param message String 63 | * @param e Throwable 64 | */ 65 | public static void openException(final Shell parent, final String message, 66 | final Throwable e) { 67 | final MultiStatus topStatus = new MultiStatus("GrandUI", 0, message, e); 68 | for (Throwable nested = e; nested != null; nested = nested.getCause()) { 69 | final IStatus status = new Status(IStatus.ERROR, "GraphUI", 0, 70 | nested.getMessage(), nested); 71 | topStatus.add(status); 72 | } 73 | Display display; 74 | if (parent == null) { 75 | display = Display.getCurrent(); 76 | } else { 77 | display = parent.getDisplay(); 78 | } 79 | display.syncExec(() -> ErrorDialog.openError(parent, message, e.getMessage(), topStatus)); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/menu/GraphMenu.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* ==================================================================== 3 | * Copyright (c) 2002-2003, Christophe Labouisse 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following 15 | * disclaimer in the documentation and/or other materials provided 16 | * with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package net.ggtools.grand.ui.menu; 33 | 34 | import net.ggtools.grand.ui.actions.ClearFiltersAction; 35 | import net.ggtools.grand.ui.actions.EditGraphPropertiesAction; 36 | import net.ggtools.grand.ui.actions.ExportGraphAction; 37 | import net.ggtools.grand.ui.actions.FilterConnectedToNodeAction; 38 | import net.ggtools.grand.ui.actions.FilterFromNodeAction; 39 | import net.ggtools.grand.ui.actions.FilterIsolatedNodesAction; 40 | import net.ggtools.grand.ui.actions.FilterMissingNodesAction; 41 | import net.ggtools.grand.ui.actions.FilterPrefixedNodesAction; 42 | import net.ggtools.grand.ui.actions.FilterSelectedNodesAction; 43 | import net.ggtools.grand.ui.actions.FilterToNodeAction; 44 | import net.ggtools.grand.ui.actions.ReloadGraphAction; 45 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 46 | 47 | import org.eclipse.jface.action.MenuManager; 48 | import org.eclipse.jface.action.Separator; 49 | 50 | /** 51 | * 52 | * 53 | * @author Christophe Labouisse 54 | */ 55 | public class GraphMenu extends MenuManager { 56 | 57 | /** 58 | * Constructor for GraphMenu. 59 | * @param controllerProvider GraphControllerProvider 60 | */ 61 | public GraphMenu(final GraphControllerProvider controllerProvider) { 62 | super("Graph"); 63 | add(new ReloadGraphAction(controllerProvider)); 64 | add(new EditGraphPropertiesAction(controllerProvider)); 65 | add(new ExportGraphAction(controllerProvider)); 66 | add(new Separator("general filters")); 67 | add(new FilterIsolatedNodesAction(controllerProvider)); 68 | add(new FilterMissingNodesAction(controllerProvider)); 69 | add(new FilterPrefixedNodesAction(controllerProvider)); 70 | add(new Separator("selected node filters")); 71 | add(new FilterSelectedNodesAction(controllerProvider)); 72 | add(new FilterConnectedToNodeAction(controllerProvider)); 73 | add(new FilterFromNodeAction(controllerProvider)); 74 | add(new FilterToNodeAction(controllerProvider)); 75 | add(new Separator("clear filters")); 76 | add(new ClearFiltersAction(controllerProvider)); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/UseBusRoutingAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.actions; 29 | 30 | import net.ggtools.grand.ui.graph.GraphController; 31 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 32 | 33 | /** 34 | * @author Christophe Labouisse 35 | */ 36 | public class UseBusRoutingAction extends GraphListenerAction { 37 | 38 | /** 39 | * Field DEFAULT_ACTION_NAME. 40 | * (value is {@value #DEFAULT_ACTION_NAME}) 41 | */ 42 | private static final String DEFAULT_ACTION_NAME = "Bus Routing"; 43 | 44 | /** 45 | * @param parent GraphControllerProvider 46 | */ 47 | public UseBusRoutingAction(final GraphControllerProvider parent) { 48 | super(parent, DEFAULT_ACTION_NAME, AS_CHECK_BOX); 49 | } 50 | 51 | /** 52 | * Method parameterChanged. 53 | * @param controller GraphController 54 | * @see net.ggtools.grand.ui.graph.GraphListener#parameterChanged(GraphController) 55 | */ 56 | @Override 57 | public final void parameterChanged(final GraphController controller) { 58 | final boolean newState = getGraphController().isBusRoutingEnabled(); 59 | if (newState != isChecked()) { 60 | setChecked(newState); 61 | } 62 | } 63 | 64 | /** 65 | * Method run. 66 | * @see org.eclipse.jface.action.IAction#run() 67 | */ 68 | @Override 69 | public final void run() { 70 | getGraphController().enableBusRouting(isChecked()); 71 | } 72 | 73 | /** 74 | * Method postAddHook. 75 | * @see GraphControllerAction#postAddHook() 76 | */ 77 | @Override 78 | protected final void postAddHook() { 79 | super.postAddHook(); 80 | setEnabled(true); 81 | setChecked(getGraphController().isBusRoutingEnabled()); 82 | } 83 | 84 | /** 85 | * Method postInitHook. 86 | * @see GraphControllerAction#postInitHook() 87 | */ 88 | @Override 89 | protected final void postInitHook() { 90 | super.postInitHook(); 91 | if (getGraphController() != null) { 92 | setChecked(getGraphController().isBusRoutingEnabled()); 93 | setEnabled(true); 94 | } else { 95 | setEnabled(false); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/PrintAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.actions; 30 | 31 | import net.ggtools.grand.ui.widgets.GraphWindow; 32 | 33 | import org.apache.commons.logging.Log; 34 | import org.apache.commons.logging.LogFactory; 35 | import org.eclipse.swt.SWT; 36 | import org.eclipse.swt.printing.PrintDialog; 37 | import org.eclipse.swt.printing.Printer; 38 | import org.eclipse.swt.printing.PrinterData; 39 | 40 | /** 41 | * @author Christophe Labouisse 42 | * @see org.eclipse.jface.action.Action 43 | */ 44 | public class PrintAction extends GraphControllerAction { 45 | 46 | /** 47 | * Field log. 48 | */ 49 | private static final Log LOG = LogFactory.getLog(PrintAction.class); 50 | 51 | /** 52 | * Field DEFAULT_ACTION_NAME. 53 | * (value is {@value #DEFAULT_ACTION_NAME}) 54 | */ 55 | private static final String DEFAULT_ACTION_NAME = "Print"; 56 | 57 | /** 58 | * Field window. 59 | */ 60 | private final GraphWindow window; 61 | 62 | /** 63 | * Method run. 64 | * @see org.eclipse.jface.action.IAction#run() 65 | */ 66 | @Override 67 | public final void run() { 68 | final PrintDialog dialog = new PrintDialog(window.getShell()); 69 | final PrinterData printerData = dialog.open(); 70 | LOG.debug("Dialog returned " + printerData); 71 | if (printerData != null) { 72 | final Printer printer = new Printer(printerData); 73 | getGraphController().print(printer); 74 | printer.dispose(); 75 | } 76 | /* 77 | * else { log.error("No printer available, disabling print"); 78 | * setEnabled(false); } 79 | */ 80 | } 81 | 82 | /** 83 | * Creates a new PrintAction object. 84 | * 85 | * @param parent GraphWindow 86 | */ 87 | public PrintAction(final GraphWindow parent) { 88 | this(parent, DEFAULT_ACTION_NAME); 89 | } 90 | 91 | /** 92 | * Creates a new QuickOpenFileAction object with specific name. 93 | * 94 | * @param parent GraphWindow 95 | * @param name String 96 | */ 97 | public PrintAction(final GraphWindow parent, final String name) { 98 | super(parent, name); 99 | window = parent; 100 | setAccelerator((SWT.getPlatform().equals("cocoa") ? SWT.MOD1 : SWT.CONTROL) | 'P'); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/test/resources/build-ticket-9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A more complex build file to test Grand. 5 | This build file feature two distinct graphs. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 36 | 37 | 43 | 51 | 52 | 53 | 56 | 57 | 60 | 61 | 62 | 63 | 64 | 65 | 68 | Cleaning dependency graph intermediate files 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 88 | 89 | 90 | 93 | Creating dependency dot file for ${source.antfile} 94 | 95 | 96 | 97 | 98 | 101 | 102 | 103 | 107 | Creating dependency graph 108 | 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/widgets/property/PropertyListLabelProvider.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.widgets.property; 29 | 30 | import org.eclipse.jface.viewers.ITableLabelProvider; 31 | import org.eclipse.jface.viewers.LabelProvider; 32 | import org.eclipse.swt.graphics.Image; 33 | 34 | /** 35 | * Label provider for 36 | * {@link net.ggtools.grand.ui.widgets.property.PropertyEditor}. Takes a 37 | * {@link net.ggtools.grand.ui.widgets.property.PropertyPair} as input and 38 | * return the pair name for the column #0 and the pair values for all others. 39 | * 40 | * @author Christophe Labouisse 41 | */ 42 | final class PropertyListLabelProvider extends LabelProvider 43 | implements ITableLabelProvider { 44 | /** 45 | * Method getColumnImage. 46 | * @param element Object 47 | * @param columnIndex int 48 | * @return Image 49 | * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(Object, int) 50 | */ 51 | public Image getColumnImage(final Object element, final int columnIndex) { 52 | return null; 53 | } 54 | 55 | /** 56 | * Method getColumnText. 57 | * @param element Object 58 | * @param columnIndex int 59 | * @return String 60 | * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(Object, int) 61 | */ 62 | public String getColumnText(final Object element, final int columnIndex) { 63 | String rc = null; 64 | 65 | if (element instanceof PropertyPair) { 66 | final PropertyPair pair = (PropertyPair) element; 67 | switch (columnIndex) { 68 | case PropertyEditor.STATUS_COLUMN_NUM: 69 | rc = null; 70 | break; 71 | 72 | case PropertyEditor.NAME_COLUMN_NUM: 73 | rc = pair.getName(); 74 | break; 75 | 76 | case PropertyEditor.VALUE_COLUMN_NUM: 77 | rc = pair.getValue(); 78 | break; 79 | 80 | default: 81 | break; 82 | } 83 | } 84 | return rc; 85 | } 86 | 87 | /** 88 | * Method getText. 89 | * @param element Object 90 | * @return String 91 | * @see org.eclipse.jface.viewers.ILabelProvider#getText(Object) 92 | */ 93 | @Override 94 | public String getText(final Object element) { 95 | if (element instanceof PropertyPair) { 96 | final PropertyPair pair = (PropertyPair) element; 97 | return pair.getName(); 98 | } else { 99 | return element.toString(); 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/widgets/CanvasScroller.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.widgets; 29 | 30 | import org.eclipse.draw2d.Cursors; 31 | import org.eclipse.draw2d.FigureCanvas; 32 | import org.eclipse.draw2d.Viewport; 33 | import org.eclipse.draw2d.geometry.Point; 34 | import org.eclipse.swt.events.MouseEvent; 35 | import org.eclipse.swt.events.MouseMoveListener; 36 | 37 | /** 38 | * @author Christophe Labouisse 39 | */ 40 | public final class CanvasScroller implements MouseMoveListener { 41 | 42 | /** 43 | * Field canvas. 44 | */ 45 | private final FigureCanvas canvas; 46 | 47 | /** 48 | * Field gotStartPoint. 49 | */ 50 | private boolean gotStartPoint; 51 | 52 | /** 53 | * Field inDragMode. 54 | */ 55 | private boolean inDragMode; 56 | 57 | /** 58 | * Field startDragX. 59 | */ 60 | private int startDragX; 61 | 62 | /** 63 | * Field startDragY. 64 | */ 65 | private int startDragY; 66 | 67 | /** 68 | * Field viewport. 69 | */ 70 | private final Viewport viewport; 71 | 72 | /** 73 | * Constructor for CanvasScroller. 74 | * @param c FigureCanvas 75 | */ 76 | public CanvasScroller(final FigureCanvas c) { 77 | canvas = c; 78 | viewport = canvas.getViewport(); 79 | inDragMode = false; 80 | gotStartPoint = false; 81 | } 82 | 83 | /** 84 | * Put the scroller in drag mode. 85 | */ 86 | public void enterDragMode() { 87 | if (!inDragMode) { 88 | canvas.addMouseMoveListener(this); 89 | canvas.setCursor(Cursors.SIZEALL); 90 | inDragMode = true; 91 | gotStartPoint = false; 92 | } 93 | } 94 | 95 | /** 96 | * 97 | */ 98 | public void leaveDragMode() { 99 | if (inDragMode) { 100 | canvas.removeMouseMoveListener(this); 101 | canvas.setCursor(Cursors.ARROW); 102 | inDragMode = false; 103 | } 104 | } 105 | 106 | /** 107 | * Method mouseMove. 108 | * @param e MouseEvent 109 | * @see org.eclipse.swt.events.MouseMoveListener#mouseMove(org.eclipse.swt.events.MouseEvent) 110 | */ 111 | public void mouseMove(final MouseEvent e) { 112 | if (gotStartPoint) { 113 | canvas.scrollTo(startDragX - e.x, startDragY - e.y); 114 | } else { 115 | final Point vpLocation = viewport.getViewLocation(); 116 | startDragX = vpLocation.x + e.x; 117 | startDragY = vpLocation.y + e.y; 118 | gotStartPoint = true; 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/widgets/Splash.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.widgets; 29 | 30 | import org.eclipse.swt.SWT; 31 | import org.eclipse.swt.graphics.GC; 32 | import org.eclipse.swt.graphics.Image; 33 | import org.eclipse.swt.graphics.Point; 34 | import org.eclipse.swt.graphics.Rectangle; 35 | import org.eclipse.swt.layout.FillLayout; 36 | import org.eclipse.swt.widgets.Display; 37 | import org.eclipse.swt.widgets.Label; 38 | import org.eclipse.swt.widgets.Shell; 39 | 40 | /** 41 | * @author Christophe Labouisse 42 | */ 43 | public class Splash { 44 | /** 45 | * Field display. 46 | */ 47 | @SuppressWarnings("unused") 48 | private final Display display; 49 | 50 | /** 51 | * Field image. 52 | */ 53 | private final Image image; 54 | 55 | /** 56 | * Field shell. 57 | */ 58 | private final Shell shell; 59 | 60 | /** 61 | * Constructor for Splash. 62 | * @param display Display 63 | * @param versionString String 64 | */ 65 | public Splash(final Display display, final String versionString) { 66 | this.display = display; 67 | shell = new Shell(display, SWT.NO_TRIM | SWT.NO_BACKGROUND | SWT.ON_TOP); 68 | shell.setLayout(new FillLayout()); 69 | image = new Image(display, getClass().getResourceAsStream( 70 | "/net/ggtools/grand/ui/resource/splash.png")); 71 | final Label label = new Label(shell, SWT.NONE); 72 | label.setImage(image); 73 | final Rectangle displayBounds = display.getPrimaryMonitor().getBounds(); 74 | final Rectangle imageBounds = image.getBounds(); 75 | final GC gc = new GC(image); 76 | gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK)); 77 | final Point size = gc.stringExtent(versionString); 78 | gc.drawText(versionString, 210, imageBounds.height - size.y - 10, true); 79 | gc.dispose(); 80 | shell.setBounds(displayBounds.x + ((displayBounds.width - imageBounds.width) / 2), 81 | displayBounds.y + ((displayBounds.height - imageBounds.height) / 2), 82 | imageBounds.width, imageBounds.height); 83 | // shell.addPaintListener(this); 84 | } 85 | 86 | /** 87 | * Method close. 88 | */ 89 | public final void close() { 90 | shell.close(); 91 | } 92 | 93 | /** 94 | * Method dispose. 95 | */ 96 | public final void dispose() { 97 | shell.dispose(); 98 | image.dispose(); 99 | } 100 | 101 | /** 102 | * Method open. 103 | */ 104 | public final void open() { 105 | shell.open(); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/FilterSelectedNodesAction.java: -------------------------------------------------------------------------------- 1 | //$Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.actions; 29 | 30 | import java.util.Collection; 31 | import java.util.LinkedList; 32 | import java.util.List; 33 | 34 | import net.ggtools.grand.filters.GraphFilter; 35 | import net.ggtools.grand.filters.NodeRemoverFilter; 36 | import net.ggtools.grand.ui.graph.GraphControllerProvider; 37 | import net.ggtools.grand.ui.graph.draw2d.Draw2dNode; 38 | 39 | import org.apache.commons.logging.Log; 40 | import org.apache.commons.logging.LogFactory; 41 | 42 | /** 43 | * @author Christophe Labouisse 44 | */ 45 | public class FilterSelectedNodesAction extends GraphListenerAction { 46 | /** 47 | * Field DEFAULT_ACTION_NAME. 48 | * (value is {@value #DEFAULT_ACTION_NAME}) 49 | */ 50 | private static final String DEFAULT_ACTION_NAME = 51 | "Filter out selected nodes"; 52 | 53 | /** 54 | * Field log. 55 | */ 56 | private static final Log LOG = 57 | LogFactory.getLog(FilterSelectedNodesAction.class); 58 | 59 | 60 | /** 61 | * @param parent GraphControllerProvider 62 | */ 63 | public FilterSelectedNodesAction(final GraphControllerProvider parent) { 64 | super(parent, DEFAULT_ACTION_NAME); 65 | 66 | boolean isEnabled = false; 67 | 68 | if (getGraphController() != null) { 69 | final Collection selectedNodes = getGraphController().getSelection(); 70 | isEnabled = !selectedNodes.isEmpty(); 71 | } 72 | setEnabled(isEnabled); 73 | } 74 | 75 | /** 76 | * Method run. 77 | * @see org.eclipse.jface.action.IAction#run() 78 | */ 79 | @Override 80 | public final void run() { 81 | if (LOG.isDebugEnabled()) { 82 | LOG.debug("run() - start"); 83 | } 84 | 85 | final List nodeList = new LinkedList<>(); 86 | for (final Draw2dNode node : getGraphController().getSelection()) { 87 | nodeList.add(node.getName()); 88 | } 89 | final GraphFilter filter = new NodeRemoverFilter(nodeList); 90 | getGraphController().addFilter(filter); 91 | 92 | if (LOG.isDebugEnabled()) { 93 | LOG.debug("run() - end"); 94 | } 95 | } 96 | 97 | /** 98 | * Method selectionChanged. 99 | * @param selectedNodes Collection<Draw2dNode> 100 | * @see net.ggtools.grand.ui.graph.GraphListener#selectionChanged(Collection) 101 | */ 102 | @Override 103 | public final void selectionChanged(final Collection selectedNodes) { 104 | setEnabled(!selectedNodes.isEmpty()); 105 | } 106 | 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/prefs/PreferenceKeys.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2004, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | package net.ggtools.grand.ui.prefs; 29 | 30 | /** 31 | * @author Christophe Labouisse 32 | */ 33 | public interface PreferenceKeys { 34 | /** 35 | * Field MAX_RECENT_FILES_PREFS_KEY. 36 | * (value is {@value #MAX_RECENT_FILES_PREFS_KEY}) 37 | */ 38 | String MAX_RECENT_FILES_PREFS_KEY = "max recent files"; 39 | 40 | /** 41 | * Field RECENT_FILES_PREFS_KEY. 42 | * (value is {@value #RECENT_FILES_PREFS_KEY}) 43 | */ 44 | String RECENT_FILES_PREFS_KEY = "recent files"; 45 | 46 | /** 47 | * Field GRAPH_PREFIX. 48 | * (value is {@value #GRAPH_PREFIX}) 49 | */ 50 | String GRAPH_PREFIX = "graph."; 51 | 52 | /** 53 | * Field NODE_PREFIX. 54 | * (value is {@value #NODE_PREFIX}) 55 | */ 56 | String NODE_PREFIX = GRAPH_PREFIX + "node."; 57 | 58 | /** 59 | * Field GRAPH_BUS_ENABLED_DEFAULT. 60 | * (value is {@value #GRAPH_BUS_ENABLED_DEFAULT}) 61 | */ 62 | String GRAPH_BUS_ENABLED_DEFAULT = GRAPH_PREFIX + "bus.enabled.default"; 63 | 64 | /** 65 | * Field GRAPH_BUS_OUT_THRESHOLD. 66 | * (value is {@value #GRAPH_BUS_OUT_THRESHOLD}) 67 | */ 68 | String GRAPH_BUS_OUT_THRESHOLD = GRAPH_PREFIX + "bus.out.threshold"; 69 | 70 | /** 71 | * Field GRAPH_BUS_IN_THRESHOLD. 72 | * (value is {@value #GRAPH_BUS_IN_THRESHOLD}) 73 | */ 74 | String GRAPH_BUS_IN_THRESHOLD = GRAPH_PREFIX + "bus.in.threshold"; 75 | 76 | /** 77 | * Field LINK_SUBANT_COLOR. 78 | * (value is {@value #LINK_SUBANT_COLOR}) 79 | */ 80 | String LINK_SUBANT_COLOR = GRAPH_PREFIX + "link.subant.color"; 81 | 82 | /** 83 | * Field LINK_SUBANT_LINEWIDTH. 84 | * (value is {@value #LINK_SUBANT_LINEWIDTH}) 85 | */ 86 | String LINK_SUBANT_LINEWIDTH = GRAPH_PREFIX + "link.subant.linewidth"; 87 | 88 | /** 89 | * Field LINK_WEAK_COLOR. 90 | * (value is {@value #LINK_WEAK_COLOR}) 91 | */ 92 | String LINK_WEAK_COLOR = GRAPH_PREFIX + "link.weak.color"; 93 | 94 | /** 95 | * Field LINK_WEAK_LINEWIDTH. 96 | * (value is {@value #LINK_WEAK_LINEWIDTH}) 97 | */ 98 | String LINK_WEAK_LINEWIDTH = GRAPH_PREFIX + "link.weak.linewidth"; 99 | 100 | /** 101 | * Field LINK_DEFAULT_COLOR. 102 | * (value is {@value #LINK_DEFAULT_COLOR}) 103 | */ 104 | String LINK_DEFAULT_COLOR = GRAPH_PREFIX + "link.default.color"; 105 | 106 | /** 107 | * Field LINK_DEFAULT_LINEWIDTH. 108 | * (value is {@value #LINK_DEFAULT_LINEWIDTH}) 109 | */ 110 | String LINK_DEFAULT_LINEWIDTH = GRAPH_PREFIX + "link.default.linewidth"; 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/net/ggtools/grand/ui/actions/QuickOpenFileAction.java: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | /* 3 | * ==================================================================== 4 | * Copyright (c) 2002-2003, Christophe Labouisse All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | package net.ggtools.grand.ui.actions; 30 | 31 | import java.io.File; 32 | 33 | import net.ggtools.grand.ui.widgets.GraphWindow; 34 | 35 | import org.apache.commons.logging.Log; 36 | import org.apache.commons.logging.LogFactory; 37 | import org.eclipse.jface.action.Action; 38 | import org.eclipse.swt.SWT; 39 | import org.eclipse.swt.widgets.FileDialog; 40 | 41 | /** 42 | * Open a file quickly that is using the default values for 43 | * properties. 44 | * 45 | * @author Christophe Labouisse 46 | * @see org.eclipse.jface.action.Action 47 | */ 48 | public class QuickOpenFileAction extends Action { 49 | 50 | /** 51 | * Field log. 52 | */ 53 | private static final Log LOG = LogFactory.getLog(QuickOpenFileAction.class); 54 | 55 | /** 56 | * Field FILTER_EXTENSIONS. 57 | */ 58 | private static final String[] FILTER_EXTENSIONS = 59 | new String[]{"*.xml", "*"}; 60 | 61 | /** 62 | * Field DEFAULT_ACTION_NAME. 63 | * (value is {@value #DEFAULT_ACTION_NAME}) 64 | */ 65 | private static final String DEFAULT_ACTION_NAME = "Quick Open"; 66 | 67 | /** 68 | * Field window. 69 | */ 70 | private final GraphWindow window; 71 | 72 | /** 73 | * Field previousPath. 74 | */ 75 | private String previousPath; 76 | 77 | /** 78 | * Method run. 79 | * @see org.eclipse.jface.action.IAction#run() 80 | */ 81 | @Override 82 | public final void run() { 83 | final FileDialog dialog = new FileDialog(window.getShell()); 84 | dialog.setFilterExtensions(FILTER_EXTENSIONS); 85 | dialog.setFilterPath(previousPath); 86 | final String buildFileName = dialog.open(); 87 | LOG.debug("Dialog returned " + buildFileName); 88 | if (buildFileName != null) { 89 | previousPath = dialog.getFilterPath(); 90 | window.openGraphInNewDisplayer(new File(buildFileName), null); 91 | } 92 | } 93 | 94 | /** 95 | * Creates a new QuickOpenFileAction object. 96 | * 97 | * @param parent GraphWindow 98 | */ 99 | public QuickOpenFileAction(final GraphWindow parent) { 100 | super(DEFAULT_ACTION_NAME); 101 | window = parent; 102 | setAccelerator((SWT.getPlatform().equals("cocoa") ? SWT.MOD1 : SWT.CONTROL) | 'O'); 103 | } 104 | 105 | /** 106 | * Creates a new QuickOpenFileAction object with specific name. 107 | * 108 | * @param name String 109 | * @param parent GraphWindow 110 | */ 111 | public QuickOpenFileAction(final String name, final GraphWindow parent) { 112 | super(name); 113 | window = parent; 114 | } 115 | } 116 | --------------------------------------------------------------------------------