diff --git a/README.md b/README.md index 757451f..40320bf 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ interfaces, and predict how much better your new designs will be. CogTool is free software, released under the FSF Lesser Gnu Public License. [See LICENSE.txt for details](https://github.com/CogTool-Modern/cogtool/blob/master/LICENSE.txt). -There is a separate repository of documentation, both for end users -and for developers: [https://github.com/cogtool/documentation.git](https://github.com/cogtool/documentation.git) -TODO Merge this seperate repo with the in-branch, GitHub Pages-powered `docs/` folder. +Comprehensive documentation is available on our website at [cogtool.org](http://www.cogtool.org), +including user guides, tutorials, developer documentation, and API references. The documentation +is maintained in the `docs/` folder and automatically published via GitHub Pages. ## Building To compile CogTool, diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html index 81778b1..a2cad87 100644 --- a/docs/_layouts/default.html +++ b/docs/_layouts/default.html @@ -1,236 +1,238 @@ - - - - - - - {% if page.title %} {{ page.title }} | {% endif %} {{ site.name }} - - - - - - - - - - - - - - - - - - - - -
- - - - -
- -
-
- {{ content }} -
-
- - -
- - - -
- - - - - - - - + + + + + + + {% if page.title %} {{ page.title }} | {% endif %} {{ site.name }} + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+
+ {{ content }} +
+
+ + +
+ + + +
+ + + + + + + + diff --git a/docs/building.md b/docs/building.md index 19da92f..a2be928 100644 --- a/docs/building.md +++ b/docs/building.md @@ -1,23 +1,183 @@ --- title: Building CogTool -author: justing -layout: page +layout: default --- -To compile CogTool, -1. Download the source code from [GitHub](https://github.com/CogTool-Modern/cogtool). -2. Install [Apache Ant](https://ant.apache.org/bindownload.cgi) -3. From within the project directory, run `ant` +# Building CogTool -Running the `ant` command begins the build process specified in `build.xml`. +This guide provides step-by-step instructions for building CogTool from source code. +## Quick Start + +### Prerequisites +- **Java Development Kit (JDK) 8 or later** (OpenJDK 11 recommended) +- **Apache Ant 1.8 or later** +- **Git** for cloning the repository + +### Build Steps +1. **Clone the repository**: + ```bash + git clone https://github.com/CogTool-Modern/cogtool.git + cd cogtool + ``` + +2. **Build CogTool**: + ```bash + ant clean + ant + ``` + +3. **Run CogTool**: + ```bash + java -jar dist/cogtool.jar + ``` + +## Platform-Specific Instructions + +### Windows
Building on Windows -The step in the build process for building Windows installers will only happen when building CogTool on Windows. This steps assumes that you have installed [NSIS](https://nsis.sourceforge.io/Main_Page) and the executable is available at `C:\Program Files (x86)\NSIS\makensis.exe` +**Additional Requirements:** +- [NSIS](https://nsis.sourceforge.io/Main_Page) for creating Windows installers +- Install to default location: `C:\Program Files (x86)\NSIS\makensis.exe` + +**Setup:** +1. Install JDK and set `JAVA_HOME` environment variable +2. Install Apache Ant and add to PATH +3. Install NSIS for installer creation + +**Build Commands:** +```cmd +git clone https://github.com/CogTool-Modern/cogtool.git +cd cogtool +ant clean +ant +``` + +The Windows installer will be created automatically when building on Windows. +
+ +### macOS +
+Building on macOS + +**Setup using Homebrew:** +```bash +# Install prerequisites +brew install openjdk@11 ant + +# Set JAVA_HOME +export JAVA_HOME=$(/usr/libexec/java_home -v 11) + +# Install Xcode Command Line Tools +xcode-select --install +``` + +**Build:** +```bash +git clone https://github.com/CogTool-Modern/cogtool.git +cd cogtool +ant clean +ant +``` +
+ +### Linux +
+Building on Linux + +**Ubuntu/Debian:** +```bash +# Install prerequisites +sudo apt update +sudo apt install openjdk-11-jdk ant git +# Set JAVA_HOME +export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 + +# Build +git clone https://github.com/CogTool-Modern/cogtool.git +cd cogtool +ant clean +ant +``` + +**CentOS/RHEL/Fedora:** +```bash +# Install prerequisites +sudo dnf install java-11-openjdk-devel ant git + +# Set JAVA_HOME +export JAVA_HOME=/usr/lib/jvm/java-11-openjdk + +# Build +git clone https://github.com/CogTool-Modern/cogtool.git +cd cogtool +ant clean +ant +```
-### Related -- [CogTool - 32-bit build instructions](https://github.com/cogtool/documentation/blob/master/Processes/configuring-development-machines.txt) -- [Download Apache Ant](https://ant.apache.org/bindownload.cgi) +## Build Targets + +The build system provides several targets: + +- `ant clean` - Clean all build artifacts +- `ant compile` - Compile Java sources only +- `ant jar` - Create JAR files +- `ant` - Full build (default target) +- `ant test` - Run unit tests +- `ant dist` - Create platform-specific distributions + +## Troubleshooting + +### Common Issues + +**Java Version Problems:** +```bash +# Check Java version +java -version +javac -version +# Should show JDK 8 or later +``` + +**Memory Issues:** +```bash +# Increase heap size for Ant +export ANT_OPTS="-Xmx2048m" +``` + +**SWT Library Issues:** +- Ensure correct platform architecture (32-bit vs 64-bit) +- Check for conflicting SWT installations + +## Development Setup + +For detailed development environment configuration, see: +- [**Development Machine Configuration**]({{site.baseurl}}/developer/configuring-development-machines/) - Complete setup guide +- [**Coding Conventions**]({{site.baseurl}}/developer/coding-conventions/) - Style guide and best practices + +## IDE Integration + +**Eclipse:** +1. File → Import → Existing Projects into Workspace +2. Select CogTool directory (project files included) + +**IntelliJ IDEA:** +1. File → Open → Select CogTool directory +2. IDEA will detect project structure + +**VS Code:** +1. Install Java Extension Pack +2. Open CogTool folder + +## Getting Help + +If you encounter build issues: +1. Check [GitHub Issues](https://github.com/CogTool-Modern/cogtool/issues) +2. Review error messages carefully +3. Verify all prerequisites are installed +4. Try a clean build: `ant clean && ant` + +For more detailed information, see the [Developer Documentation]({{site.baseurl}}/developer/). diff --git a/docs/developer.md b/docs/developer.md new file mode 100644 index 0000000..e51e2a7 --- /dev/null +++ b/docs/developer.md @@ -0,0 +1,192 @@ +--- +title: Developer Documentation +layout: default +--- + +# Developer Documentation + +This section contains resources for developers who want to contribute to CogTool, understand its architecture, or build custom extensions. + +## Getting Started with Development + +### Building CogTool + +To compile CogTool from source: + +1. **Prerequisites** + - Java Development Kit (JDK) 8 or later + - [Apache Ant](https://ant.apache.org/bindownload.cgi) + - Git + +2. **Build Process** + ```bash + git clone https://github.com/CogTool-Modern/cogtool.git + cd cogtool + ant + ``` + +For detailed build instructions, see [Building CogTool]({{site.baseurl}}/building/). + +### Development Environment Setup + +[**📄 Development Machine Configuration**]({{site.baseurl}}/developer/configuring-development-machines/) - Complete setup guide for development environments + +## Architecture and Design + +### Core Architecture +CogTool is built using Java and SWT (Standard Widget Toolkit) for cross-platform compatibility. The application follows a Model-View-Controller (MVC) architecture pattern. + +**Key Components:** +- **Model**: Data structures representing projects, designs, tasks, and scripts +- **View**: User interface components and editors +- **Controller**: Business logic and user interaction handling + +### Data Model +- Projects contain one or more Designs +- Designs contain Frames and Tasks +- Frames contain Widgets and Transitions +- Tasks are demonstrated through Scripts +- Scripts contain Steps that represent user actions + +### Cognitive Modeling Engine +CogTool integrates with ACT-R (Adaptive Control of Thought-Rational) to generate cognitive models from demonstrated tasks. The system automatically translates user interface interactions into cognitive model predictions. + +## Development Resources + +### Coding Standards +[**📄 Coding Conventions**]({{site.baseurl}}/developer/coding-conventions/) - Style guide and best practices + +### Build System +- **Primary Build Tool**: Apache Ant +- **Build Configuration**: `build.xml` in project root +- **Platform-Specific Builds**: Separate targets for Windows, macOS, and Linux + +### Testing +- Unit tests are located in the test directories +- Integration tests verify end-to-end functionality +- Performance tests validate prediction accuracy + +## Contributing + +### How to Contribute + +1. **Fork the Repository** + ```bash + git fork https://github.com/CogTool-Modern/cogtool.git + ``` + +2. **Create a Feature Branch** + ```bash + git checkout -b feature/your-feature-name + ``` + +3. **Make Changes** + - Follow coding conventions + - Add tests for new functionality + - Update documentation as needed + +4. **Submit a Pull Request** + - Provide clear description of changes + - Reference any related issues + - Ensure all tests pass + +### Development Workflow + +- **Main Branch**: `master` - stable release code +- **Development Branch**: `develop` - integration branch for new features +- **Feature Branches**: `feature/*` - individual feature development +- **Release Branches**: `release/*` - preparation for new releases + +## Advanced Topics + +### Extending CogTool + +#### Adding New Widget Types +1. Extend the base Widget class +2. Implement rendering logic +3. Define interaction behaviors +4. Add to widget palette + +#### Custom Cognitive Models +1. Understand ACT-R integration points +2. Define new cognitive operators +3. Implement model generation logic +4. Validate against empirical data + +#### Import/Export Formats +1. Define XML schema for new formats +2. Implement parser/generator +3. Add UI integration +4. Test with sample files + +### Performance Optimization + +- **Memory Management**: Efficient object lifecycle management +- **Rendering**: Optimized drawing for large designs +- **Model Generation**: Caching and incremental updates +- **File I/O**: Streaming for large project files + +## API Documentation + +### Core Classes + +- `Project`: Top-level container for all project data +- `Design`: Represents a user interface design +- `Frame`: Individual screen or state in a design +- `Widget`: Interactive element on a frame +- `Task`: User goal to be accomplished +- `Script`: Sequence of user actions +- `Transition`: Navigation between frames + +### Extension Points + +- **Widget Renderers**: Custom drawing for widget types +- **Action Handlers**: Processing user interactions +- **Import/Export**: Supporting new file formats +- **Model Generators**: Creating cognitive models + +## Troubleshooting + +### Common Build Issues + +**Java Version Conflicts** +- Ensure JDK 8+ is installed and in PATH +- Check JAVA_HOME environment variable + +**Ant Build Failures** +- Verify Ant installation and version +- Check build.xml for platform-specific requirements + +**SWT Library Issues** +- Platform-specific SWT libraries are included +- Verify correct architecture (32-bit vs 64-bit) + +### Development Environment Issues + +**IDE Setup** +- Eclipse project files are included +- IntelliJ IDEA can import the project structure +- VS Code works with appropriate Java extensions + +**Debugging** +- Use IDE debugger with main class `edu.cmu.cs.hcii.cogtool.CogTool` +- Enable verbose logging for troubleshooting +- Check console output for error messages + +## Resources + +### External Dependencies +- **SWT**: Standard Widget Toolkit for UI +- **ACT-R**: Cognitive modeling framework +- **Apache Commons**: Utility libraries +- **JUnit**: Testing framework + +### Documentation +- [SWT Documentation](https://www.eclipse.org/swt/) +- [ACT-R Website](http://act-r.psy.cmu.edu/) +- [Apache Ant Manual](https://ant.apache.org/manual/) + +### Community +- [GitHub Issues](https://github.com/CogTool-Modern/cogtool/issues) - Bug reports and feature requests +- [GitHub Discussions](https://github.com/CogTool-Modern/cogtool/discussions) - Community discussions +- [Research Papers]({{site.baseurl}}/publications/) - Academic publications about CogTool \ No newline at end of file diff --git a/docs/developer/coding-conventions.md b/docs/developer/coding-conventions.md new file mode 100644 index 0000000..a0ddd92 --- /dev/null +++ b/docs/developer/coding-conventions.md @@ -0,0 +1,428 @@ +--- +title: Coding Conventions +layout: default +--- + +# CogTool Coding Conventions + +This document outlines the coding standards and conventions used in the CogTool project to ensure consistency and maintainability across the codebase. + +## General Principles + +### Code Quality +- **Readability**: Code should be self-documenting and easy to understand +- **Consistency**: Follow established patterns throughout the codebase +- **Simplicity**: Prefer simple, clear solutions over complex ones +- **Maintainability**: Write code that can be easily modified and extended + +### Documentation +- Document public APIs with Javadoc +- Include inline comments for complex logic +- Keep documentation up-to-date with code changes +- Write meaningful commit messages + +## Java Coding Standards + +### Naming Conventions + +#### Classes and Interfaces +```java +// Classes: PascalCase +public class DesignEditor { } +public class ProjectManager { } + +// Interfaces: PascalCase, often with 'I' prefix or descriptive suffix +public interface IWidget { } +public interface Selectable { } +public interface ActionListener { } +``` + +#### Methods and Variables +```java +// Methods: camelCase, descriptive verbs +public void createNewProject() { } +public boolean isValidTransition() { } +public String getFrameName() { } + +// Variables: camelCase, descriptive nouns +private String projectName; +private List frameList; +private boolean isModified; +``` + +#### Constants +```java +// Constants: UPPER_CASE with underscores +public static final String DEFAULT_PROJECT_NAME = "Untitled Project"; +public static final int MAX_FRAME_COUNT = 1000; +private static final double EPSILON = 0.001; +``` + +#### Packages +```java +// Packages: lowercase, hierarchical +edu.cmu.cs.hcii.cogtool.model +edu.cmu.cs.hcii.cogtool.ui.editors +edu.cmu.cs.hcii.cogtool.util +``` + +### Code Formatting + +#### Indentation +- Use **4 spaces** for indentation (no tabs) +- Continuation lines should be indented 8 spaces + +```java +public void longMethodName(String parameter1, + String parameter2, + String parameter3) { + // Method body indented 4 spaces + if (someCondition && + anotherCondition) { + // Nested code indented 4 more spaces + doSomething(); + } +} +``` + +#### Line Length +- Maximum line length: **120 characters** +- Break long lines at logical points +- Align parameters and arguments when breaking lines + +#### Braces +- Use K&R style bracing (opening brace on same line) +- Always use braces, even for single statements + +```java +// Correct +if (condition) { + doSomething(); +} + +// Incorrect +if (condition) + doSomething(); +``` + +#### Spacing +```java +// Operators: spaces around binary operators +int result = a + b * c; +boolean flag = (x > 0) && (y < 10); + +// Method calls: no space before parentheses +methodCall(parameter1, parameter2); + +// Control structures: space before parentheses +if (condition) { } +for (int i = 0; i < count; i++) { } +while (running) { } +``` + +### Class Structure + +#### Order of Elements +1. Static fields (constants first) +2. Instance fields +3. Constructors +4. Methods (public first, then protected, then private) +5. Nested classes + +```java +public class ExampleClass { + // Static constants + public static final String CONSTANT_VALUE = "value"; + + // Static fields + private static int instanceCount = 0; + + // Instance fields + private String name; + private List items; + + // Constructors + public ExampleClass() { + this("default"); + } + + public ExampleClass(String name) { + this.name = name; + instanceCount++; + } + + // Public methods + public String getName() { + return name; + } + + // Protected methods + protected void internalMethod() { + // Implementation + } + + // Private methods + private void helperMethod() { + // Implementation + } + + // Nested classes + private static class InnerClass { + // Implementation + } +} +``` + +### Documentation Standards + +#### Javadoc Comments +```java +/** + * Creates a new frame in the design with the specified name. + * + * @param frameName the name for the new frame, must not be null + * @param backgroundImage optional background image for the frame + * @return the newly created frame + * @throws IllegalArgumentException if frameName is null or empty + * @throws DuplicateFrameException if a frame with the same name already exists + */ +public Frame createFrame(String frameName, Image backgroundImage) { + // Implementation +} +``` + +#### Inline Comments +```java +// Check if the project has been modified since last save +if (project.isModified()) { + // Prompt user to save changes before closing + int result = showSaveDialog(); + if (result == SAVE_OPTION) { + saveProject(); + } +} +``` + +## SWT-Specific Conventions + +### Resource Management +```java +// Always dispose of SWT resources +Image image = new Image(display, "path/to/image.png"); +try { + // Use the image + label.setImage(image); +} finally { + // Dispose when done + if (image != null && !image.isDisposed()) { + image.dispose(); + } +} + +// Or use try-with-resources for automatic disposal +try (FileInputStream stream = new FileInputStream(file)) { + Image image = new Image(display, stream); + // Use image +} // Stream automatically closed +``` + +### Event Handling +```java +// Use descriptive listener implementations +button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleButtonClick(); + } +}); + +// Or extract to named methods for complex handlers +private void setupEventHandlers() { + saveButton.addSelectionListener(createSaveButtonListener()); + cancelButton.addSelectionListener(createCancelButtonListener()); +} +``` + +## Error Handling + +### Exception Handling +```java +// Be specific about exceptions +try { + loadProject(filename); +} catch (FileNotFoundException e) { + showError("Project file not found: " + filename); +} catch (InvalidProjectFormatException e) { + showError("Invalid project format: " + e.getMessage()); +} catch (IOException e) { + showError("Error reading project file: " + e.getMessage()); +} + +// Don't catch and ignore exceptions +try { + riskyOperation(); +} catch (Exception e) { + // BAD: Silent failure +} + +// Better: Log or handle appropriately +try { + riskyOperation(); +} catch (Exception e) { + logger.error("Failed to perform risky operation", e); + throw new OperationFailedException("Operation failed", e); +} +``` + +### Validation +```java +// Validate parameters early +public void setFrameName(String name) { + if (name == null) { + throw new IllegalArgumentException("Frame name cannot be null"); + } + if (name.trim().isEmpty()) { + throw new IllegalArgumentException("Frame name cannot be empty"); + } + this.frameName = name.trim(); +} +``` + +## Performance Guidelines + +### Object Creation +```java +// Reuse objects when possible +private StringBuilder stringBuilder = new StringBuilder(); + +public String formatMessage(String template, Object... args) { + stringBuilder.setLength(0); // Clear previous content + // Build string + return stringBuilder.toString(); +} + +// Use appropriate collection sizes +List frames = new ArrayList<>(expectedSize); +Map widgets = new HashMap<>(expectedSize); +``` + +### String Handling +```java +// Use StringBuilder for multiple concatenations +StringBuilder sb = new StringBuilder(); +for (String item : items) { + sb.append(item).append(", "); +} +String result = sb.toString(); + +// Prefer String.format() for complex formatting +String message = String.format("Frame '%s' contains %d widgets", + frameName, widgetCount); +``` + +## Testing Conventions + +### Unit Test Structure +```java +public class FrameTest { + private Frame frame; + + @Before + public void setUp() { + frame = new Frame("Test Frame"); + } + + @Test + public void testAddWidget_ValidWidget_AddsSuccessfully() { + // Arrange + Widget widget = new Button("Test Button"); + + // Act + frame.addWidget(widget); + + // Assert + assertEquals(1, frame.getWidgetCount()); + assertTrue(frame.containsWidget(widget)); + } + + @Test(expected = IllegalArgumentException.class) + public void testAddWidget_NullWidget_ThrowsException() { + frame.addWidget(null); + } +} +``` + +### Test Naming +- Use descriptive test method names +- Format: `test[MethodName]_[Scenario]_[ExpectedResult]` +- Example: `testCreateFrame_ValidName_ReturnsNewFrame` + +## Version Control + +### Commit Messages +``` +Short summary (50 chars or less) + +Longer description if needed. Explain what changed and why. +Reference issue numbers when applicable. + +- Use bullet points for multiple changes +- Keep lines under 72 characters +- Use present tense ("Add feature" not "Added feature") + +Fixes #123 +``` + +### Branch Naming +- `feature/description` - New features +- `bugfix/description` - Bug fixes +- `hotfix/description` - Critical fixes +- `refactor/description` - Code refactoring + +## Code Review Guidelines + +### What to Look For +- **Correctness**: Does the code do what it's supposed to do? +- **Style**: Does it follow these conventions? +- **Performance**: Are there obvious performance issues? +- **Security**: Are there potential security vulnerabilities? +- **Maintainability**: Is the code easy to understand and modify? + +### Review Comments +- Be constructive and specific +- Explain the reasoning behind suggestions +- Acknowledge good practices +- Focus on the code, not the person + +## Tools and Automation + +### IDE Configuration +- Configure your IDE to follow these formatting rules +- Use automatic code formatting (Ctrl+Shift+F in Eclipse) +- Enable save actions to organize imports and format code + +### Static Analysis +- Use tools like FindBugs, PMD, or SpotBugs +- Address warnings and potential issues +- Configure build to fail on critical violations + +### Continuous Integration +- All code must pass automated tests +- Code coverage should be maintained or improved +- Style violations should be reported and addressed + +## Resources + +### Java Style Guides +- [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html) +- [Oracle Java Code Conventions](https://www.oracle.com/java/technologies/javase/codeconventions-contents.html) + +### Tools +- [Checkstyle](https://checkstyle.sourceforge.io/) - Style checking +- [PMD](https://pmd.github.io/) - Static analysis +- [SpotBugs](https://spotbugs.github.io/) - Bug detection + +### IDE Plugins +- Eclipse: Built-in formatting and style checking +- IntelliJ IDEA: Code inspection and formatting +- VS Code: Java extension pack with style support \ No newline at end of file diff --git a/docs/developer/configuring-development-machines.md b/docs/developer/configuring-development-machines.md new file mode 100644 index 0000000..5405cae --- /dev/null +++ b/docs/developer/configuring-development-machines.md @@ -0,0 +1,289 @@ +--- +title: Configuring Development Machines +layout: default +--- + +# Configuring Development Machines + +This guide provides detailed instructions for setting up a development environment for CogTool. + +## Prerequisites + +### Java Development Kit (JDK) +- **Required Version**: JDK 8 or later +- **Recommended**: OpenJDK 11 or Oracle JDK 11 +- **Download**: [OpenJDK](https://openjdk.java.net/) or [Oracle JDK](https://www.oracle.com/java/technologies/javase-downloads.html) + +### Apache Ant +- **Required Version**: Ant 1.8 or later +- **Download**: [Apache Ant](https://ant.apache.org/bindownload.cgi) +- **Installation**: Follow platform-specific instructions + +### Git +- **Required**: Git 2.0 or later +- **Download**: [Git](https://git-scm.com/downloads) + +## Platform-Specific Setup + +### Windows Development Environment + +#### JDK Installation +1. Download and install JDK +2. Set JAVA_HOME environment variable: + ``` + JAVA_HOME=C:\Program Files\Java\jdk-11.0.x + ``` +3. Add to PATH: + ``` + PATH=%JAVA_HOME%\bin;%PATH% + ``` + +#### Apache Ant Installation +1. Download Ant binary distribution +2. Extract to `C:\apache-ant-1.x.x` +3. Set ANT_HOME: + ``` + ANT_HOME=C:\apache-ant-1.x.x + ``` +4. Add to PATH: + ``` + PATH=%ANT_HOME%\bin;%PATH% + ``` + +#### Windows-Specific Build Requirements +- **NSIS**: Required for building Windows installers + - Download from [NSIS website](https://nsis.sourceforge.io/) + - Install to default location: `C:\Program Files (x86)\NSIS\` + - The build script expects `makensis.exe` at this location + +#### Visual Studio Code Setup (Optional) +1. Install VS Code +2. Install Java Extension Pack +3. Open CogTool project folder +4. Configure Java path in settings if needed + +### macOS Development Environment + +#### JDK Installation +1. Install via Homebrew (recommended): + ```bash + brew install openjdk@11 + ``` +2. Or download from Oracle/OpenJDK website +3. Set JAVA_HOME in shell profile: + ```bash + export JAVA_HOME=$(/usr/libexec/java_home -v 11) + ``` + +#### Apache Ant Installation +1. Install via Homebrew: + ```bash + brew install ant + ``` +2. Or download and install manually + +#### Xcode Command Line Tools +```bash +xcode-select --install +``` + +#### macOS-Specific Considerations +- **Code Signing**: For distribution, you'll need Apple Developer certificates +- **Notarization**: Required for macOS 10.15+ distribution +- **Architecture**: Support for both Intel and Apple Silicon + +### Linux Development Environment + +#### Ubuntu/Debian +```bash +# Install JDK +sudo apt update +sudo apt install openjdk-11-jdk + +# Install Ant +sudo apt install ant + +# Install Git (if not already installed) +sudo apt install git + +# Set JAVA_HOME (add to ~/.bashrc or ~/.profile) +export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 +``` + +#### CentOS/RHEL/Fedora +```bash +# Install JDK +sudo dnf install java-11-openjdk-devel # Fedora +# or +sudo yum install java-11-openjdk-devel # CentOS/RHEL + +# Install Ant +sudo dnf install ant # Fedora +# or +sudo yum install ant # CentOS/RHEL + +# Set JAVA_HOME +export JAVA_HOME=/usr/lib/jvm/java-11-openjdk +``` + +## IDE Configuration + +### Eclipse IDE +1. **Import Project**: + - File → Import → Existing Projects into Workspace + - Select CogTool root directory + - Eclipse project files are included in the repository + +2. **Configure Build Path**: + - Right-click project → Properties → Java Build Path + - Verify source folders and libraries are correctly configured + +3. **Run Configuration**: + - Main class: `edu.cmu.cs.hcii.cogtool.CogTool` + - VM arguments: `-Xmx1024m` (or higher for large projects) + +### IntelliJ IDEA +1. **Open Project**: + - File → Open → Select CogTool directory + - IDEA will detect the project structure + +2. **Configure SDK**: + - File → Project Structure → Project + - Set Project SDK to JDK 11 + +3. **Run Configuration**: + - Run → Edit Configurations → Add Application + - Main class: `edu.cmu.cs.hcii.cogtool.CogTool` + - VM options: `-Xmx1024m` + +## Build Verification + +### Test Your Setup +1. **Clone Repository**: + ```bash + git clone https://github.com/CogTool-Modern/cogtool.git + cd cogtool + ``` + +2. **Run Build**: + ```bash + ant clean + ant + ``` + +3. **Expected Output**: + - Build should complete without errors + - Executable files created in `dist/` directory + +### Common Build Issues + +#### Java Version Problems +```bash +# Check Java version +java -version +javac -version + +# Should show JDK 8 or later +``` + +#### Ant Configuration Issues +```bash +# Check Ant version +ant -version + +# Verify Ant can find Java +ant -diagnostics +``` + +#### Memory Issues +- Increase heap size for Ant: + ```bash + export ANT_OPTS="-Xmx2048m" + ``` + +## Development Workflow + +### Repository Structure +``` +cogtool/ +├── java/ # Java source code +├── lib/ # External libraries +├── build/ # Build output +├── dist/ # Distribution files +├── docs/ # Documentation +├── res/ # Resources +└── build.xml # Ant build script +``` + +### Build Targets +- `ant clean` - Clean build artifacts +- `ant compile` - Compile Java sources +- `ant jar` - Create JAR files +- `ant dist` - Create distribution packages +- `ant test` - Run unit tests + +### Development Best Practices + +#### Code Style +- Follow Java naming conventions +- Use 4-space indentation +- Maximum line length: 120 characters +- Add Javadoc for public methods + +#### Version Control +- Create feature branches for new work +- Write descriptive commit messages +- Keep commits focused and atomic +- Test before committing + +#### Testing +- Write unit tests for new functionality +- Run full test suite before submitting changes +- Test on multiple platforms when possible + +## Troubleshooting + +### Build Failures + +#### "Cannot find symbol" errors +- Check classpath configuration +- Verify all dependencies are present +- Clean and rebuild + +#### SWT library issues +- Platform-specific SWT libraries are included +- Verify correct architecture (32-bit vs 64-bit) +- Check for conflicting SWT installations + +#### Memory errors during build +- Increase heap size: `export ANT_OPTS="-Xmx2048m"` +- Close other applications to free memory + +### Runtime Issues + +#### Application won't start +- Check Java version compatibility +- Verify all required libraries are present +- Check console output for error messages + +#### UI rendering problems +- Update graphics drivers +- Try different Java versions +- Check SWT compatibility with OS version + +## Additional Resources + +### Documentation +- [Apache Ant Manual](https://ant.apache.org/manual/) +- [Eclipse SWT Documentation](https://www.eclipse.org/swt/) +- [Java Development Documentation](https://docs.oracle.com/en/java/) + +### Tools +- [Eclipse IDE](https://www.eclipse.org/ide/) +- [IntelliJ IDEA](https://www.jetbrains.com/idea/) +- [Visual Studio Code](https://code.visualstudio.com/) + +### Community +- [CogTool GitHub Repository](https://github.com/CogTool-Modern/cogtool) +- [Issue Tracker](https://github.com/CogTool-Modern/cogtool/issues) +- [Discussions](https://github.com/CogTool-Modern/cogtool/discussions) \ No newline at end of file diff --git a/docs/downloads/CogToolTutorial.pdf b/docs/downloads/CogToolTutorial.pdf new file mode 100644 index 0000000..c7c7542 Binary files /dev/null and b/docs/downloads/CogToolTutorial.pdf differ diff --git a/docs/downloads/CogToolUserGuide_1_2.pdf b/docs/downloads/CogToolUserGuide_1_2.pdf new file mode 100644 index 0000000..2331d3e Binary files /dev/null and b/docs/downloads/CogToolUserGuide_1_2.pdf differ diff --git a/docs/index.md b/docs/index.md index 7c5704a..f83b74f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -29,6 +29,30 @@ Bonnie E. John, Principal Investigator View older releases +## 📚 Documentation & Learning Resources + +Get started with CogTool using our comprehensive documentation: + + + + + +**Quick Links:** +- [Download User Guide (PDF)]({{site.baseurl}}/downloads/CogToolUserGuide_1_2.pdf) - Complete reference manual +- [Download Tutorial (PDF)]({{site.baseurl}}/downloads/CogToolTutorial.pdf) - Step-by-step tutorial +- [Building from Source]({{site.baseurl}}/building/) - Compilation instructions +- [FAQs]({{site.baseurl}}/faqs/) - Common questions and answers + ### ▶️ Integrating usability analysis and metrics into the development process