Skip to content

Commit d40d297

Browse files
committed
Update next steps document
1 parent 32b9a40 commit d40d297

File tree

1 file changed

+14
-136
lines changed

1 file changed

+14
-136
lines changed

NEXT.md

Lines changed: 14 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This document outlines the remaining work for the scijava-desktop component.
77
scijava-desktop provides unified desktop integration for SciJava applications, managing:
88
1. **URI link scheme registration & handling** (Linux, Windows, macOS)
99
2. **Desktop icon generation** (Linux .desktop file, Windows Start Menu - planned)
10-
3. **File extension registration** (planned)
10+
3. **File extension registration** (Linux .desktop file, Windows registry)
1111

1212
The component uses a plugin system where Platform implementations (LinuxPlatform, WindowsPlatform, MacOSPlatform) handle platform-specific integration.
1313

@@ -20,138 +20,17 @@ The component uses a plugin system where Platform implementations (LinuxPlatform
2020
- DesktopIntegrationProvider interface for platform capabilities
2121
- OptionsDesktop plugin for user preferences (Edit > Options > Desktop...)
2222
- Platform plugins for Linux, Windows, and macOS
23-
24-
### ⚠️ Partially Implemented (Needs Fixes)
25-
- **Hardcoded scheme names**: WindowsPlatform:86,102 and LinuxPlatform:112,129 hardcode "fiji" scheme
26-
- **Hardcoded OS checks**: DefaultLinkService:119-132 directly checks OS name strings and instantiates platform-specific installers
23+
- File extension registration
2724

2825
### ❌ Not Yet Implemented
29-
- File extension registration
3026
- Windows Start Menu icon generation
3127
- First launch dialog for desktop integration opt-in
3228

33-
## Implementation Phases
34-
35-
### Phase 1: Fix Hardcoded Elements (High Priority)
36-
These fixes are required for scijava-desktop to work for applications other than Fiji.
37-
38-
### Phase 2: File Extension Registration (High Priority)
39-
Core functionality for Fiji and other scientific applications.
40-
41-
### Phase 3: Polish (Medium Priority)
42-
First launch dialog, Windows desktop icon, etc.
43-
4429
---
4530

4631
## Priority Work Items
4732

48-
### 1. Remove Hardcoded Scheme Names
49-
50-
**Problem**: Both Windows and Linux platforms hardcode the "fiji" scheme instead of querying registered LinkHandlers.
51-
52-
**Files to modify**:
53-
- `src/main/java/org/scijava/desktop/platform/windows/WindowsPlatform.java` (lines 86, 102)
54-
- `src/main/java/org/scijava/desktop/platform/linux/LinuxPlatform.java` (lines 112, 129)
55-
56-
**Solution**: Query LinkService for all registered schemes from LinkHandler plugins.
57-
58-
**Example** (WindowsPlatform.java):
59-
```java
60-
@Override
61-
public boolean isWebLinksEnabled() {
62-
final WindowsSchemeInstaller installer = new WindowsSchemeInstaller(log);
63-
final Set<String> schemes = collectSchemes();
64-
if (schemes.isEmpty()) return false;
65-
66-
// Check if any scheme is installed
67-
for (String scheme : schemes) {
68-
if (installer.isInstalled(scheme)) return true;
69-
}
70-
return false;
71-
}
72-
73-
@Override
74-
public void setWebLinksEnabled(final boolean enable) throws IOException {
75-
final WindowsSchemeInstaller installer = new WindowsSchemeInstaller(log);
76-
final String executablePath = System.getProperty("scijava.app.executable");
77-
if (executablePath == null) {
78-
throw new IOException("No executable path set (scijava.app.executable property)");
79-
}
80-
81-
final Set<String> schemes = collectSchemes();
82-
for (String scheme : schemes) {
83-
if (enable) {
84-
installer.install(scheme, executablePath);
85-
} else {
86-
installer.uninstall(scheme);
87-
}
88-
}
89-
}
90-
91-
private Set<String> collectSchemes() {
92-
final Set<String> schemes = new HashSet<>();
93-
if (linkService == null) return schemes;
94-
95-
for (final LinkHandler handler : linkService.getInstances()) {
96-
schemes.addAll(handler.getSchemes());
97-
}
98-
return schemes;
99-
}
100-
```
101-
102-
Similar changes needed for LinuxPlatform.
103-
104-
### 2. Add getSchemeInstaller method
105-
106-
**Goal**: Allow platforms to provide SchemeInstaller instances without hardcoding in DefaultLinkService.
107-
108-
**New method**: `DesktopIntegrationProvider#getSchemeInstaller()`
109-
110-
**Files to modify**:
111-
- WindowsPlatform.java - implement getSchemeInstaller
112-
- LinuxPlatform.java - implement getSchemeInstaller
113-
- MacOSPlatform.java - implement getSchemeInstaller (return null)
114-
115-
### 3. Refactor DefaultLinkService#createInstaller()
116-
117-
**Problem**: Hardcoded OS checks violate the plugin architecture.
118-
119-
**Current code** (lines 119-132):
120-
```java
121-
private SchemeInstaller createInstaller() {
122-
final String os = System.getProperty("os.name");
123-
if (os == null) return null;
124-
125-
final String osLower = os.toLowerCase();
126-
if (osLower.contains("linux")) {
127-
return new LinuxSchemeInstaller(log);
128-
}
129-
else if (osLower.contains("win")) {
130-
return new WindowsSchemeInstaller(log);
131-
}
132-
133-
return null;
134-
}
135-
```
136-
137-
**Refactored code**:
138-
```java
139-
@Parameter(required = false)
140-
private PlatformService platformService;
141-
142-
private SchemeInstaller createInstaller() {
143-
if (platformService == null) return null;
144-
145-
final Platform platform = platformService.platform();
146-
if (platform instanceof DesktopIntegrationProvider) {
147-
return ((DesktopIntegrationProvider) platform).getSchemeInstaller();
148-
}
149-
150-
return null;
151-
}
152-
```
153-
154-
### 4. First Launch Dialog (Optional)
33+
### 1. First Launch Dialog (Optional)
15534

15635
**Goal**: Prompt user on first launch to enable desktop integration.
15736

@@ -181,7 +60,7 @@ Either way: "To change these settings in the future, use Edit > Options > Deskto
18160
- If user selects "No", do nothing
18261
- Store user preference by writing to a local configuration file -- avoids showing dialog again
18362

184-
### 5. File Extension Registration (High Priority)
63+
### 2. File Extension Registration (High Priority)
18564

18665
**Scope**: Extend DesktopIntegrationProvider to support file type associations.
18766

@@ -198,13 +77,13 @@ void setFileExtensionsEnabled(boolean enable) throws IOException;
19877

19978
**Problem**: Microscopy formats (.sdt, .czi, .nd2, .lif, etc.) lack standard MIME types.
20079

201-
**Solution**: Register custom MIME types in `~/.local/share/mime/packages/fiji.xml`
80+
**Solution**: Register custom MIME types in `~/.local/share/mime/packages/{appName}.xml`
20281

20382
**Steps**:
20483
1. Create extension → MIME type mapping
20584
- Standard formats: use existing types (`image/tiff`, `image/png`)
20685
- Microscopy formats: define custom types (`application/x-zeiss-czi`, `application/x-nikon-nd2`)
207-
2. Generate `fiji.xml` with MIME type definitions
86+
2. Generate `{appName}.xml` with MIME type definitions
20887
3. Install to `~/.local/share/mime/packages/`
20988
4. Run `update-mime-database ~/.local/share/mime`
21089
5. Add MIME types to .desktop file's `MimeType=` field
@@ -215,22 +94,22 @@ void setFileExtensionsEnabled(boolean enable) throws IOException;
21594

21695
**Unregistration**:
21796
- Remove MIME types from .desktop file (preserve URI schemes)
218-
- Optionally delete `~/.local/share/mime/packages/fiji.xml`
97+
- Optionally delete `~/.local/share/mime/packages/{appName}.xml`
21998
- Run `update-mime-database` again
22099

221100
#### Windows (Simple - SupportedTypes Only)
222101

223-
**Solution**: Use `Applications\fiji.exe\SupportedTypes` registry approach
102+
**Solution**: Use `Applications\{appName}.exe\SupportedTypes` registry approach
224103

225104
**Steps**:
226-
1. Create `HKCU\Software\Classes\Applications\fiji.exe\SupportedTypes`
105+
1. Create `HKCU\Software\Classes\Applications\{appName}.exe\SupportedTypes`
227106
2. Add each extension as a value: `.tif = ""`
228107
3. All ~150-200 extensions in one registry location
229108

230-
**Safety**: Deletion is safe - only removes our own `Applications\fiji.exe` tree
109+
**Safety**: Deletion is safe - only removes our own `Applications\{appName}.exe` tree
231110

232111
**Unregistration**:
233-
- Delete entire `HKCU\Software\Classes\Applications\fiji.exe` key
112+
- Delete entire `HKCU\Software\Classes\Applications\{appName}.exe` key
234113

235114
#### macOS (Build-Time Only)
236115

@@ -240,7 +119,7 @@ void setFileExtensionsEnabled(boolean enable) throws IOException;
240119

241120
**No runtime action needed** - this is a packaging/build concern
242121

243-
### 6. Windows Start Menu Icon
122+
### 3. Windows Start Menu Icon
244123

245124
**Goal**: Add desktop icon support for Windows.
246125

@@ -251,17 +130,16 @@ void setFileExtensionsEnabled(boolean enable) throws IOException;
251130

252131
## Testing Checklist
253132

254-
### Phase 1 (Hardcoded Elements)
133+
### Scheme Registration
255134
- [ ] Test URI scheme registration on Windows (registry manipulation)
256135
- [ ] Test URI scheme registration on Linux (.desktop file updates)
257136
- [ ] Test desktop icon installation on Linux
258137
- [ ] Verify macOS reports correct read-only status
259138
- [ ] Test OptionsDesktop UI with multiple schemes
260139
- [ ] Verify scheme collection from LinkHandler plugins
261140
- [ ] Test toggling features on/off via UI
262-
- [ ] Verify no hardcoded "fiji" references remain
263141

264-
### Phase 2 (File Extensions)
142+
### File Extensions
265143
- [ ] Test Linux MIME type generation and installation
266144
- [ ] Verify `update-mime-database` runs successfully
267145
- [ ] Test file extension associations appear in file managers (Nautilus, Dolphin)

0 commit comments

Comments
 (0)