From 457f773b53a06aac1c6c21d880a296b6738eacca Mon Sep 17 00:00:00 2001 From: peterdell Date: Tue, 28 Sep 2021 01:19:16 +0200 Subject: [PATCH] Transform string helpDocumentsPath to sequence of element helpDocument in compiler definition. --- com.wudsn.ide.asm.compilers/plugin.xml | 53 +++++- com.wudsn.ide.asm/schema/compilers.exsd | 176 ++++++++++++------ .../src/com/wudsn/ide/lng/Texts.properties | 4 +- .../com/wudsn/ide/lng/Texts_de_DE.properties | 6 +- .../ide/lng/compiler/CompilerDefinition.java | 101 +++++----- .../wudsn/ide/lng/compiler/CompilerHelp.java | 42 ++--- .../ide/lng/compiler/CompilerRegistry.java | 20 +- ...guageEditorCompilerHelpCommandHandler.java | 24 +-- .../lng/help/LanguageHelpContentProducer.java | 12 +- .../ide/lng/help/LanguageTocProvider.java | 30 ++- com.wudsn.ide.pas/plugin.xml | 9 +- 11 files changed, 280 insertions(+), 197 deletions(-) diff --git a/com.wudsn.ide.asm.compilers/plugin.xml b/com.wudsn.ide.asm.compilers/plugin.xml index 363eb10b..70ef6708 100644 --- a/com.wudsn.ide.asm.compilers/plugin.xml +++ b/com.wudsn.ide.asm.compilers/plugin.xml @@ -55,7 +55,6 @@ class="com.wudsn.ide.lng.asm.compiler.acme.AcmeCompiler" defaultHardware="C64" defaultParameters="-f cbm -o ${outputFilePath} ${sourceFilePath} " - helpDocumentPaths="./docs" homePageURL="https://sourceforge.net/projects/acme-crossass" id="acme" language="ASM" @@ -73,13 +72,16 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/com.wudsn.ide.asm/schema/compilers.exsd b/com.wudsn.ide.asm/schema/compilers.exsd index ad328d1f..3dc0b245 100644 --- a/com.wudsn.ide.asm/schema/compilers.exsd +++ b/com.wudsn.ide.asm/schema/compilers.exsd @@ -2,46 +2,104 @@ - + - + This extension point allows for adding new assemblers and compilers to the WUDSN IDE. - - - - - - + - - - - + + + + + + + + + + + + + + + + + - + + + + + + - + Relative path of the help document or help folder, relative to the folder of the executables. +Or absolute URL starting with "http://" or "https://". - + - + The 2 letter "de" or 5 letter "de_DE" representation of the language of the document. +Use "*" is the entry is valid for all languages + + + + + + + + + + + + OSGI OS value as described in org.eclipse.core.runtime.Platform + + + + + + + + + + + + + + + + + OSGI OS archiecture value as described in org.eclipse.core.runtime.Platform + + + + + + + + + + + + + + + + + Relative path of the executable inside the base folder - - - @@ -54,6 +112,10 @@ + + + + @@ -83,9 +145,9 @@ Translatable name of the compiler. Typically contains only upper case letters. - + - + @@ -93,9 +155,9 @@ The name of the compiler class. - + - + @@ -112,17 +174,6 @@ - - - - The relative paths to the local help documents. -Multiple paths are separated by comma. -Adding a language constraint in parentheses like "./doc-de.html (de)" acts as filter. -Each file path is evluated based on the absolute path of the compiler executable in the preferences. -Alternatively abolute URLs to web sites can be specified. They are used, if not file paths match. - - - @@ -158,38 +209,47 @@ Alternatively abolute URLs to web sites can be specified. They are used, if not - + + + + + + - + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - + - + WUDSN IDE 1.1.0 @@ -197,9 +257,9 @@ Alternatively abolute URLs to web sites can be specified. They are used, if not - + - + To implement this extension point, you have to create a sub-class of com.wudsn.ide.lng.compiler.Compiler, a sub-class of com.wudsn.ide.lng.compiler.parser.CompilerSourceParser and a sub-class of com.wudsn.ide.lng.compiler.CompilerLogParser. In the constructor of the compiler you have to set the source parser instance. In the "createLogParser" method of the compiler you have to create a new instance of the corresponding log parser. @@ -207,9 +267,9 @@ Alternatively abolute URLs to web sites can be specified. They are used, if not - + - + (c) 2009 Peter Dell diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Texts.properties b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Texts.properties index d5ebf88a..f5d1df81 100644 --- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Texts.properties +++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Texts.properties @@ -167,7 +167,7 @@ TOC_TARGET_OPCODE_LABEL=Opcode MESSAGE_E100=Path to '{0}' {1} executable is not set in the '{2}' preferences. MESSAGE_E101=The {0} '{1}' does not specify default parameters. -MESSAGE_E102=The {0} '{1}' does not specify help document paths. +MESSAGE_E102=The {0} '{1}' does not specify help documents. MESSAGE_E103=Path to '{0}' {1} executable in the '{2}' preferences points to non-existing file '{3}'. MESSAGE_E104=Output file extension must be set in the preferences of {0} '{1}' or via the annotation '{2}'. MESSAGE_E105=Cannot execute {0} process '{1}' in working directory '{2}'. System error: {3} @@ -196,7 +196,7 @@ MESSAGE_E127={0} process ended with return code {1}. Check the error messages an MESSAGE_E128=Hardware not specified. Specify one of the following valid values '{0}'. MESSAGE_E129=Main source file specifies or defaults to hardware '{0}' while include file specifies or defaults to hardware '{1}'. MESSAGE_E130=Help for the '{0}' {1} cannot be displayed because the path to the executable is not set in the '{2}' preferences. -MESSAGE_E131=Help for the '{0}' {1} cannot be displayed because no help file was found in the paths '{2}' relative to the executable path '{3}'. +MESSAGE_E131=Help for the '{0}' {1} cannot be displayed because no help file was found in the paths relative to the executable path '{2}'. MESSAGE_E132=Disk image file '{0}' does not exist. Create a bootable disk image where the output file '{1}' can be stored. MESSAGE_E133=Disk image file '{0}' is not writeable. Make the disk image file is writeable, so the output file '{1}' can be stored. MESSAGE_E134=Disk image file '{0}' cannot be opened for reading. System error: {1} diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Texts_de_DE.properties b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Texts_de_DE.properties index c34a1948..ae1aef52 100644 --- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Texts_de_DE.properties +++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Texts_de_DE.properties @@ -165,7 +165,7 @@ TOC_TARGET_OPCODE_LABEL=Opcode MESSAGE_E100=Pfad zur ausführbaren Datei des Kompilers '{0}' ist in den '{1}' Voreinstellungen nicht angegeben. MESSAGE_E101=Der {0} '{1}' definiert keine Standardparameter. -MESSAGE_E102=Der {0} '{1}' definiert keine Pfade zu Hilfedokumenten. +MESSAGE_E102=Der {0} '{1}' definiert keine Hilfedokumentes. MESSAGE_E103=Pfad zur ausführbaren Datei des Kompilers '{0}' in den Voreinstellungen verweist auf die nicht existierende Datei '{1}'. MESSAGE_E104=Ausgabe-Dateierweiterung muss in den Voreinstellungen des Kompilers '{0}' oder mit der Annotation '{1}' angegeben werden. MESSAGE_E105=Kompilerprozess '{0}' kann im Arbeitsverzeichnis '{1}' nicht ausgeführt werden. Systemfehler: {2} @@ -193,8 +193,8 @@ MESSAGE_E126=Ausgabe-Datei erzeugt is aber leer. Pr MESSAGE_E127=Kompilerprozess endete mit dem Rückgabewert {0}. Prüfen Sie die Fehlermeldungen und die Konsolenausgabe. MESSAGE_E128=Hardware nicht angegeben. Gültige Werte sind '{0}'. MESSAGE_E129=Haupt-Quell-Datei spezifiziert oder verwendet die Hardware '{0}' während die Include-Quell-Datei die Hardware '{1}' spezifiziert oder verwendet. -MESSAGE_E130=Handbuch zum Kompiler '{0}' kann nicht angezeigt werden, da der Pfad zur ausführbaren Datei des Kompilers in den Voreinstellungen nicht angegeben ist. -MESSAGE_E131=Handbuch zum Kompiler '{0}' kann nicht angezeigt werden, da keine Hilfe-Datei in den Pfaden '{1}' relativ zur ausführbaren Datei '{2}' des Kompilers gefunden wurde. +MESSAGE_E130=Handbuch zum {0} '{1}' kann nicht angezeigt werden, da der Pfad zur ausführbaren Datei des Kompilers in den Voreinstellungen nicht angegeben ist. +MESSAGE_E131=Handbuch zum {0} '{1}' kann nicht angezeigt werden, da keine Hilfe-Datei in den Pfaden relativ zur ausführbaren Datei '{2}' des Kompilers gefunden wurde. MESSAGE_E132=Disketten-Image-Datei '{0}' existiert nicht. Lege ein bootfähiges Disketten-Image an, auf dem die Ausgabe-Datei '{1}' gespeichert werden kann. MESSAGE_E133=Disketten-Image-Datei '{0}' ist nicht schreibbar. Mache das Diskettenimage schreibbbar, damit die Ausgabe-Datei '{1}' gespeichert werden kann. MESSAGE_E134=Disketten-Image-Datei '{0}' kann not nicht zum Lesen geöffnet werden. Systemfehler: {1} diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/CompilerDefinition.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/CompilerDefinition.java index c59631dc..6883fb1c 100644 --- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/CompilerDefinition.java +++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/CompilerDefinition.java @@ -34,7 +34,7 @@ import com.wudsn.ide.lng.LanguagePlugin; import com.wudsn.ide.lng.LanguageUtility; import com.wudsn.ide.lng.Target; import com.wudsn.ide.lng.Texts; -import com.wudsn.ide.lng.compiler.CompilerHelp.HelpDocument; +import com.wudsn.ide.lng.compiler.CompilerHelp.InstalledHelpDocument; import com.wudsn.ide.lng.compiler.CompilerPaths.CompilerPath; import com.wudsn.ide.lng.compiler.syntax.CompilerSyntax; @@ -47,6 +47,27 @@ import com.wudsn.ide.lng.compiler.syntax.CompilerSyntax; */ public final class CompilerDefinition implements Comparable { + public final static class HelpDocument { + + public final String path; + public final String language; + + HelpDocument(String path, String language) { + if (path == null) { + throw new IllegalArgumentException("Parameter 'path' must not be null."); + } + if (language == null) { + throw new IllegalArgumentException("Parameter 'language' must not be null."); + } + this.path = path; + this.language = language; + } + + public boolean isURL() { + return path.startsWith("http://") || path.startsWith("https://"); + } + } + // Language private Language language; @@ -56,7 +77,7 @@ public final class CompilerDefinition implements Comparable private String className; // Installation and use. - private String helpDocumentPaths; + private List helpDocuments; private String homePageURL; // Editing and source parsing. @@ -240,40 +261,18 @@ public final class CompilerDefinition implements Comparable return homePageURL; } - /** - * Sets the help file paths to locate the help file for the compiler. Called by - * {@link CompilerRegistry} only. - * - * @param helpDocumentPaths The relative file path starting with "." to locate - * the help file for the compiler based on the folder - * of the executable. ".". ".." and "/" may be used to - * specify the file path. Alternatively the path can be - * an absolute URL. A path may end with a language in - * the form "(en)". Multiple paths are separated by - * ",". May be empty or null. - */ - final void setHelpDocumentPaths(String helpDocumentPaths) { - if (helpDocumentPaths == null) { - helpDocumentPaths = ""; + final void setHelpDocuments(List helpDocuments) { + if (helpDocuments == null) { + throw new IllegalArgumentException("Parameter 'helpDocuments' must not be null."); } - this.helpDocumentPaths = helpDocumentPaths; + this.helpDocuments = helpDocuments; } - /** - * Gets the help file paths to locate the help file for the compiler. - * - * @return The relative file path starting with "." to locate the help file for - * the compiler based on the folder of the executable. ".". ".." and "/" - * may be used to specify the file path. Alternatively the path can be - * an absolute URL. A path may end with a language in the form "(en)". - * Multiple paths are separated by ",". May be empty or - * null. - */ - public final String getHelpDocumentPaths() { - if (helpDocumentPaths == null) { - throw new IllegalStateException("Field 'helpDocumentPaths' must not be null."); + public List getHelpDocuments() { + if (helpDocuments == null) { + throw new IllegalStateException("Field 'helpDocuments' must not be null."); } - return helpDocumentPaths; + return helpDocuments; } /** @@ -282,8 +281,8 @@ public final class CompilerDefinition implements Comparable * @return true if this compiler offers a help file, * false otherwise. */ - public final boolean hasHelpDocumentPaths() { - return StringUtility.isSpecified(helpDocumentPaths); + public final boolean hasHelpDocuments() { + return !helpDocuments.isEmpty(); } /** @@ -298,13 +297,14 @@ public final class CompilerDefinition implements Comparable * does not specify a help path or no help file can be * found. */ - public final List getInstalledHelpDocuments(String compilerExecutablePath) throws CoreException { + private final List getInstalledHelpDocuments(String compilerExecutablePath) + throws CoreException { if (compilerExecutablePath == null) { throw new IllegalArgumentException("Parameter 'compilerExecutablePath' must not be null."); } String compilerText = LanguageUtility.getCompilerTextLower(language); - if (!hasHelpDocumentPaths()) { - // INFO: The {0} '{1}' does not specify help document paths. + if (!hasHelpDocuments()) { + // INFO: The {0} '{1}' does not specify help documents. throw new CoreException(new Status(IStatus.INFO, LanguagePlugin.ID, TextUtility.format(Texts.MESSAGE_E102, compilerText, name))); } @@ -316,25 +316,22 @@ public final class CompilerDefinition implements Comparable TextUtility.format(Texts.MESSAGE_E130, name, compilerText, compilerPreferencesText))); } - return getHelpDocuments(compilerExecutablePath); + return CompilerHelp.getInstalledHelpDocuments(getHelpDocuments(), compilerExecutablePath); } - public final List getHelpDocuments(String compilerExecutablePath) { - return CompilerHelp.getHelpDocuments(helpDocumentPaths, compilerExecutablePath); + public final InstalledHelpDocument getInstalledHelpForCurrentLocale(String compilerExecutablePath) + throws CoreException { - } + var helpDocuments = getInstalledHelpDocuments(compilerExecutablePath); - public final HelpDocument getHelpForCurrentLocale(String compilerExecutablePath) throws CoreException { - List helpDocuments = getInstalledHelpDocuments(compilerExecutablePath); - - String localeLanguage = Locale.getDefault().getLanguage(); + var localeLanguage = Locale.getDefault().getLanguage(); // Find the first existing local file and the first existing local file with // matching language. - HelpDocument firstFile = null; - HelpDocument firstLanguageFile = null; - for (HelpDocument helpDocument : helpDocuments) { + InstalledHelpDocument firstFile = null; + InstalledHelpDocument firstLanguageFile = null; + for (var helpDocument : helpDocuments) { if (helpDocument.file != null && helpDocument.file.exists()) { if (firstFile == null) { @@ -347,14 +344,14 @@ public final class CompilerDefinition implements Comparable } // Use language specific file if present, use first file otherwise. - HelpDocument result = firstLanguageFile; + var result = firstLanguageFile; if (result == null) { result = firstFile; } // No local file specified or found. Try the URIs. if (result == null) { - for (HelpDocument helpDocument : helpDocuments) { + for (InstalledHelpDocument helpDocument : helpDocuments) { if (helpDocument.uri != null) { if (firstFile == null) { firstFile = helpDocument; @@ -376,9 +373,9 @@ public final class CompilerDefinition implements Comparable if (result == null) { // ERROR: Help for the '{0}' {1} cannot be displayed because no help file was - // found in the paths '{2}' relative to the executable path '{3}'. + // found in the paths relative to the executable path '{2}'. throw new CoreException(new Status(IStatus.ERROR, LanguagePlugin.ID, TextUtility.format(Texts.MESSAGE_E131, - name, LanguageUtility.getCompilerTextLower(language), helpDocumentPaths, compilerExecutablePath))); + name, LanguageUtility.getCompilerTextLower(language), compilerExecutablePath))); } return result; diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/CompilerHelp.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/CompilerHelp.java index 4512c321..4101ab17 100644 --- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/CompilerHelp.java +++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/CompilerHelp.java @@ -24,10 +24,10 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; -import java.util.StringTokenizer; import com.wudsn.ide.base.common.FileUtility; import com.wudsn.ide.base.common.StringUtility; +import com.wudsn.ide.lng.compiler.CompilerDefinition.HelpDocument; /** * Compiler help access. @@ -37,43 +37,37 @@ import com.wudsn.ide.base.common.StringUtility; * @since 1.7.2 */ public final class CompilerHelp { - - public static class HelpDocument { + + public static class InstalledHelpDocument { public String path; public String language; public File file; public URI uri; } - public static List getHelpDocuments(String helpDocumentPaths, String compilerExecutablePath) { - List helpDocuments = new ArrayList(); + public static List getInstalledHelpDocuments(List list, + String compilerExecutablePath) { + var result = new ArrayList(); - StringTokenizer tokenizer = new StringTokenizer(helpDocumentPaths, ","); - while (tokenizer.hasMoreTokens()) { - String helpFilePath = tokenizer.nextToken().trim(); - String helpFileLanguage = ""; - int index = helpFilePath.lastIndexOf("("); - if (index > 0) { - helpFileLanguage = helpFilePath.substring(index + 1, index + 3); - helpFilePath = helpFilePath.substring(0, index - 1).trim(); - } - HelpDocument helpDocument = new HelpDocument(); - helpDocument.path = helpFilePath; - helpDocument.language = helpFileLanguage; + for (var helpDocument : list) { + + var installeHelpDocument = new InstalledHelpDocument(); + installeHelpDocument.path = helpDocument.path; + installeHelpDocument.language = helpDocument.language; // Relative paths are local files. - if (helpFilePath.startsWith(".") && StringUtility.isSpecified(compilerExecutablePath)) { - helpDocument.file = FileUtility - .getCanonicalFile(new File(new File(compilerExecutablePath).getParent(), helpFilePath)); + if (installeHelpDocument.path.startsWith(".") && StringUtility.isSpecified(compilerExecutablePath)) { + installeHelpDocument.file = FileUtility.getCanonicalFile( + new File(new File(compilerExecutablePath).getParent(), installeHelpDocument.path)); } else { try { - helpDocument.uri = new URI(helpFilePath); + installeHelpDocument.uri = new URI(installeHelpDocument.path); } catch (URISyntaxException ex) { - throw new RuntimeException("Invalid URI for '" + helpFilePath + "' help file path", ex); + throw new RuntimeException("Invalid URI for '" + helpDocument.path + "' help file path", ex); } } - helpDocuments.add(helpDocument); + result.add(installeHelpDocument); } - return helpDocuments; + return result; } } \ No newline at end of file diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/CompilerRegistry.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/CompilerRegistry.java index 717827f6..d329328b 100644 --- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/CompilerRegistry.java +++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/CompilerRegistry.java @@ -36,6 +36,7 @@ import com.wudsn.ide.base.hardware.Hardware; import com.wudsn.ide.lng.Language; import com.wudsn.ide.lng.Target; import com.wudsn.ide.lng.compiler.syntax.CompilerSyntax; +import com.wudsn.ide.lng.compiler.CompilerDefinition.HelpDocument; /** * Registry for compilers, based on the extension points @@ -97,18 +98,23 @@ public final class CompilerRegistry { compilerDefinition.setId(configurationElement.getAttribute("id")); compilerDefinition.setName(configurationElement.getAttribute("name")); compilerDefinition.setClassName(configurationElement.getAttribute("class")); - compilerDefinition.setHelpDocumentPaths(configurationElement.getAttribute("helpDocumentPaths")); + + var helpDocumentsArray = configurationElement.getChildren("helpDocument"); + var helpDocuments = new ArrayList(helpDocumentsArray.length); + for (var helpDocument : helpDocumentsArray) { + helpDocuments.add(new HelpDocument(helpDocument.getAttribute("path"), + helpDocument.getAttribute("language"))); + } + compilerDefinition.setHelpDocuments(Collections.unmodifiableList(helpDocuments)); compilerDefinition.setHomePageURL(configurationElement.getAttribute("homePageURL")); compilerDefinition.setDefaultParameters(configurationElement.getAttribute("defaultParameters")); - IConfigurationElement[] supportedTargetsArray; - supportedTargetsArray = configurationElement.getChildren("supportedTarget"); - List supportedTargets = new ArrayList(supportedTargetsArray.length); - for (IConfigurationElement supportedTarget : supportedTargetsArray) { + var supportedTargetsArray = configurationElement.getChildren("supportedTarget"); + var supportedTargets = new ArrayList(supportedTargetsArray.length); + for (var supportedTarget : supportedTargetsArray) { supportedTargets.add(Target.valueOf(supportedTarget.getAttribute("target"))); } - supportedTargets = Collections.unmodifiableList(supportedTargets); - compilerDefinition.setSupportedTargets(supportedTargets); + compilerDefinition.setSupportedTargets(Collections.unmodifiableList(supportedTargets)); compilerDefinition .setDefaultHardware(Hardware.valueOf(configurationElement.getAttribute("defaultHardware"))); diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/editor/LanguageEditorCompilerHelpCommandHandler.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/editor/LanguageEditorCompilerHelpCommandHandler.java index 552c1912..14f5ae39 100644 --- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/editor/LanguageEditorCompilerHelpCommandHandler.java +++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/editor/LanguageEditorCompilerHelpCommandHandler.java @@ -25,14 +25,8 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.program.Program; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorPart; import org.eclipse.ui.handlers.HandlerUtil; -import com.wudsn.ide.lng.compiler.CompilerDefinition; -import com.wudsn.ide.lng.compiler.CompilerHelp.HelpDocument; -import com.wudsn.ide.lng.preferences.CompilerPreferences; - /** * Event handler for the "Compiler Help" command. * @@ -42,24 +36,20 @@ public final class LanguageEditorCompilerHelpCommandHandler extends AbstractHand @Override public Object execute(ExecutionEvent event) throws ExecutionException { - Shell shell; - shell = HandlerUtil.getActiveShell(event); + var shell = HandlerUtil.getActiveShell(event); - IEditorPart editor; - editor = HandlerUtil.getActiveEditorChecked(event); + var editor = HandlerUtil.getActiveEditorChecked(event); if (!(editor instanceof LanguageEditor)) { return null; } - LanguageEditor languageEditor; - languageEditor = (LanguageEditor) editor; - - CompilerDefinition compilerDefinition = languageEditor.getCompilerDefinition(); - CompilerPreferences compilerPreferences = languageEditor.getCompilerPreferences(); - String compilerExecutablePath = compilerPreferences.getCompilerExecutablePathOrDefault(); + var languageEditor = (LanguageEditor) editor; + var compilerDefinition = languageEditor.getCompilerDefinition(); + var compilerPreferences = languageEditor.getCompilerPreferences(); + var compilerExecutablePath = compilerPreferences.getCompilerExecutablePathOrDefault(); try { - HelpDocument helpDocument = compilerDefinition.getHelpForCurrentLocale(compilerExecutablePath); + var helpDocument = compilerDefinition.getInstalledHelpForCurrentLocale(compilerExecutablePath); if (helpDocument.file != null) { Program.launch(helpDocument.file.getPath()); } else { diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/help/LanguageHelpContentProducer.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/help/LanguageHelpContentProducer.java index 67bbe30a..dfd6b570 100644 --- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/help/LanguageHelpContentProducer.java +++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/help/LanguageHelpContentProducer.java @@ -45,7 +45,6 @@ import org.eclipse.help.IHelpContentProducer; import com.wudsn.ide.base.common.EnumUtility; import com.wudsn.ide.base.common.HexUtility; import com.wudsn.ide.base.common.StringUtility; -import com.wudsn.ide.base.common.TextUtility; import com.wudsn.ide.base.hardware.Hardware; import com.wudsn.ide.base.hardware.HardwareUtility; import com.wudsn.ide.lng.Language; @@ -54,7 +53,6 @@ import com.wudsn.ide.lng.Target; import com.wudsn.ide.lng.TargetUtility; import com.wudsn.ide.lng.Texts; import com.wudsn.ide.lng.compiler.CompilerDefinition; -import com.wudsn.ide.lng.compiler.CompilerHelp.HelpDocument; import com.wudsn.ide.lng.compiler.CompilerPaths.CompilerPath; import com.wudsn.ide.lng.compiler.CompilerRegistry; import com.wudsn.ide.lng.compiler.syntax.CompilerSyntax; @@ -314,8 +312,8 @@ public final class LanguageHelpContentProducer implements IHelpContentProducer { Hardware.GENERIC); try { - HelpDocument helpDocDocument = compilerDefinition - .getHelpForCurrentLocale(compilerPreferences.getCompilerExecutablePathOrDefault()); + var helpDocDocument = compilerDefinition + .getInstalledHelpForCurrentLocale(compilerPreferences.getCompilerExecutablePathOrDefault()); File file = helpDocDocument.file; if (file == null) { throw new RuntimeException( @@ -373,13 +371,13 @@ public final class LanguageHelpContentProducer implements IHelpContentProducer { writer.writeTableRow(Texts.TOC_COMPILER_HOME_PAGE_LABEL, HTMLWriter.getLink(compilerDefinition.getHomePageURL(), compilerDefinition.getHomePageURL())); - List helpDocuments = compilerDefinition.getHelpDocuments(""); + var helpDocuments = compilerDefinition.getHelpDocuments(); HTMLWriter innerWriter = new HTMLWriter(); // TODO: Breaks layout if there are no paths if (!helpDocuments.isEmpty()) { innerWriter.beginTable(false); - for (HelpDocument helpDocument : helpDocuments) { + for (var helpDocument : helpDocuments) { innerWriter.beginTableRow(); - if (helpDocument.uri != null) { + if (helpDocument.isURL()) { innerWriter.writeTableCell(HTMLWriter.getLink(helpDocument.path, helpDocument.path)); } else { innerWriter.writeTableCell(helpDocument.path); diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/help/LanguageTocProvider.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/help/LanguageTocProvider.java index 394e83c0..e48ce24e 100644 --- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/help/LanguageTocProvider.java +++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/help/LanguageTocProvider.java @@ -45,10 +45,7 @@ import com.wudsn.ide.lng.LanguagePlugin; import com.wudsn.ide.lng.Target; import com.wudsn.ide.lng.Texts; import com.wudsn.ide.lng.compiler.CompilerDefinition; -import com.wudsn.ide.lng.compiler.CompilerHelp.HelpDocument; import com.wudsn.ide.lng.compiler.CompilerRegistry; -import com.wudsn.ide.lng.preferences.CompilerPreferences; -import com.wudsn.ide.lng.preferences.LanguagePreferences; /** * Dynamic help content provider. Uses static pages and the meta data from the @@ -251,31 +248,30 @@ public final class LanguageTocProvider extends AbstractTocProvider { if (compilerDefinitions == null) { throw new IllegalArgumentException("Parameter 'compilerDefinitions' must not be null."); } - int size = compilerDefinitions.size(); - List compilerTopics = new ArrayList(size); + var size = compilerDefinitions.size(); + var compilerTopics = new ArrayList(size); for (int i = 0; i < size; i++) { - CompilerDefinition compilerDefinition = compilerDefinitions.get(i); + var compilerDefinition = compilerDefinitions.get(i); - String href = LanguageHelpContentProducer.getComplierHref(compilerDefinition, + var href = LanguageHelpContentProducer.getComplierHref(compilerDefinition, LanguageHelpContentProducer.SECTION_GENERAL, null); - ITopic generalTopic = createTopic("", Texts.TOC_COMPILER_GENERAL_TOPIC_LABEL, href, null); + var generalTopic = createTopic("", Texts.TOC_COMPILER_GENERAL_TOPIC_LABEL, href, null); href = LanguageHelpContentProducer.getComplierHref(compilerDefinition, LanguageHelpContentProducer.SECTION_INSTRUCTIONS, null); - ITopic opcodesTopic = createTopic("", Texts.TOC_COMPILER_INSTRUCTIONS_TOPIC_LABEL, href, null); + var opcodesTopic = createTopic("", Texts.TOC_COMPILER_INSTRUCTIONS_TOPIC_LABEL, href, null); - LanguagePreferences languagePreferences = LanguagePlugin.getInstance() + var languagePreferences = LanguagePlugin.getInstance() .getLanguagePreferences(compilerDefinition.getLanguage()); - CompilerPreferences compilerPreferences = languagePreferences.getCompilerPreferences(compilerDefinition, - Hardware.GENERIC); - String compilerExecutablePath = compilerPreferences.getCompilerExecutablePathOrDefault(); + var compilerPreferences = languagePreferences.getCompilerPreferences(compilerDefinition, Hardware.GENERIC); + var compilerExecutablePath = compilerPreferences.getCompilerExecutablePathOrDefault(); - String icon = ""; - List manualTopics = new ArrayList(); + var icon = ""; + var manualTopics = new ArrayList(); try { - HelpDocument helpDocument = compilerDefinition.getHelpForCurrentLocale(compilerExecutablePath); + var helpDocument = compilerDefinition.getInstalledHelpForCurrentLocale(compilerExecutablePath); if (helpDocument.file != null) { File file = helpDocument.file; @@ -327,7 +323,7 @@ public final class LanguageTocProvider extends AbstractTocProvider { LanguageHelpContentProducer.SECTION_MANUAL, null); } - ITopic manualTopic = createTopic(icon, Texts.TOC_COMPILER_MANUAL_TOPIC_LABEL, href, + var manualTopic = createTopic(icon, Texts.TOC_COMPILER_MANUAL_TOPIC_LABEL, href, createTopicsArray(manualTopics)); compilerTopics.add(createTopic("", compilerDefinition.getName(), "", diff --git a/com.wudsn.ide.pas/plugin.xml b/com.wudsn.ide.pas/plugin.xml index c01f6781..a5e49da0 100644 --- a/com.wudsn.ide.pas/plugin.xml +++ b/com.wudsn.ide.pas/plugin.xml @@ -112,7 +112,6 @@ class="com.wudsn.ide.lng.pas.compiler.mp.MadPascalCompiler" defaultHardware="ATARI8BIT" defaultParameters="${sourceFilePath} " - helpDocumentPaths="https://mads.atari8.info/doc/en/index.html, https://mads.atari8.info/doc/pl/index.html (pl)" homePageURL="https://github.com/tebe6502/Mad-Pascal/releases" id="MP" language="PAS" @@ -120,6 +119,14 @@ version="1.6.5"> + + + +