Add Language separation in CompilerDefinition, CompilerRegistry and TOC

This commit is contained in:
peterdell 2021-09-26 13:21:52 +02:00
parent 2c89002812
commit 04e36c48ba
26 changed files with 324 additions and 120 deletions

View File

@ -28,10 +28,11 @@
<extension point="com.wudsn.ide.lng.compilers"> <extension point="com.wudsn.ide.lng.compilers">
<compiler <compiler
class="com.wudsn.ide.lng.asm.compiler.test.TestCompiler" class="com.wudsn.ide.lng.asm.compiler.test.TestCompiler"
defaultParameters="-o${outputFilePath} ${sourceFilePath}"
defaultHardware="TEST" defaultHardware="TEST"
defaultParameters="-o${outputFilePath} ${sourceFilePath}"
homePageURL="https://www.wudsn.com" homePageURL="https://www.wudsn.com"
id="test" id="test"
language="ASM"
name="%com.wudsn.ide.lng.asm.compiler.test.TestCompiler.name" name="%com.wudsn.ide.lng.asm.compiler.test.TestCompiler.name"
version="none"> version="none">
<supportedTarget <supportedTarget

View File

@ -1,11 +1,5 @@
com.wudsn.ide.lng.Hardware.GENERIC=Generic com.wudsn.ide.lng.Language.ASM=Assembler
com.wudsn.ide.lng.Hardware.APPLE2=Apple 2 com.wudsn.ide.lng.Language.PAS=Pascal
com.wudsn.ide.lng.Hardware.ATARI2600=Atari 2600
com.wudsn.ide.lng.Hardware.ATARI7800=Atari 7800
com.wudsn.ide.lng.Hardware.ATARI8BIT=Atari 8-bit
com.wudsn.ide.lng.Hardware.C64=C64
com.wudsn.ide.lng.Hardware.NES=NES
com.wudsn.ide.lng.Hardware.TEST=Test
com.wudsn.ide.lng.Target.MOS6502=6502 com.wudsn.ide.lng.Target.MOS6502=6502
com.wudsn.ide.lng.Target.MOS6502_ILLEGAL=6502 with illegal opcodes com.wudsn.ide.lng.Target.MOS6502_ILLEGAL=6502 with illegal opcodes
@ -47,6 +41,9 @@ com.wudsn.ide.lng.editor.LanguageEditorToggleBreakpointCommand.name=Toggle Break
com.wudsn.ide.lng.editor.LanguageEditorOpenDeclarationCommand.name=Open Declaration com.wudsn.ide.lng.editor.LanguageEditorOpenDeclarationCommand.name=Open Declaration
com.wudsn.ide.lng.editor.LanguageEditorEnableDisableBreakpointCommand.name=Enable/Disable Breakpoint com.wudsn.ide.lng.editor.LanguageEditorEnableDisableBreakpointCommand.name=Enable/Disable Breakpoint
com.wudsn.ide.lng.editor.LanguageEditorContentAssistProposal_label=Content Assist
com.wudsn.ide.lng.editor.LanguageEditorToggleCommentCommand_label=Toggle Comment
com.wudsn.ide.lng.editor.LanguageHyperlinkDetector.name=Hyperlink Detector com.wudsn.ide.lng.editor.LanguageHyperlinkDetector.name=Hyperlink Detector
com.wudsn.ide.lng.editor.LanguageHyperlinkDetectorEditorTarget.name=Source Code Editor com.wudsn.ide.lng.editor.LanguageHyperlinkDetectorEditorTarget.name=Source Code Editor

View File

@ -1,11 +1,5 @@
com.wudsn.ide.lng.Hardware.GENERIC=Generisch com.wudsn.ide.lng.Language.ASM=Assembler
com.wudsn.ide.lng.Hardware.APPLE2=Apple 2 com.wudsn.ide.lng.Language.PAS=Pascal
com.wudsn.ide.lng.Hardware.ATARI2600=Atari 2600
com.wudsn.ide.lng.Hardware.ATARI7800=Atari 7800
com.wudsn.ide.lng.Hardware.ATARI8BIT=Atari 8-bit
com.wudsn.ide.lng.Hardware.C64=C64
com.wudsn.ide.lng.Hardware.NES=NES
com.wudsn.ide.lng.Hardware.TEST=Test
com.wudsn.ide.lng.Target.MOS6502=6502 com.wudsn.ide.lng.Target.MOS6502=6502
com.wudsn.ide.lng.Target.MOS6502_ILLEGAL=6502 mit illegalen Opcodes com.wudsn.ide.lng.Target.MOS6502_ILLEGAL=6502 mit illegalen Opcodes
@ -15,9 +9,12 @@ com.wudsn.ide.lng.Target.MOS65816=65816
com.wudsn.ide.lng.compiler.CompilerSourceFile.name=Quelltext-Datei com.wudsn.ide.lng.compiler.CompilerSourceFile.name=Quelltext-Datei
com.wudsn.ide.lng.editor.LanguageEditorAssemblerMenu.label=Assembler
com.wudsn.ide.lng.editor.LanguageEditorAssemblerMenu.mnemonic=s
com.wudsn.ide.lng.editor.LanguageEditorCompilerMenu.label=Kompiler com.wudsn.ide.lng.editor.LanguageEditorCompilerMenu.label=Kompiler
com.wudsn.ide.lng.editor.LanguageEditorCompilerMenu.mnemonic=K com.wudsn.ide.lng.editor.LanguageEditorCompilerMenu.mnemonic=K
com.wudsn.ide.lng.editor.LanguageEditorAssemblerToolbar.label=Assembler
com.wudsn.ide.lng.editor.LanguageEditorCompilerToolbar.label=Kompiler com.wudsn.ide.lng.editor.LanguageEditorCompilerToolbar.label=Kompiler
com.wudsn.ide.lng.editor.LanguageEditorCommands.name=Quelltext Editor Befehle com.wudsn.ide.lng.editor.LanguageEditorCommands.name=Quelltext Editor Befehle
@ -25,6 +22,13 @@ com.wudsn.ide.lng.editor.LanguageEditorOpenSourceFolderCommand.name=Quell-Ordner
com.wudsn.ide.lng.editor.LanguageEditorOpenSourceFolderCommand.mnemonic=Q com.wudsn.ide.lng.editor.LanguageEditorOpenSourceFolderCommand.mnemonic=Q
com.wudsn.ide.lng.editor.LanguageEditorOpenOutputFolderCommand.name=Ausgabe-Ordner öffnen com.wudsn.ide.lng.editor.LanguageEditorOpenOutputFolderCommand.name=Ausgabe-Ordner öffnen
com.wudsn.ide.lng.editor.LanguageEditorOpenOutputFolderCommand.mnemonic=A com.wudsn.ide.lng.editor.LanguageEditorOpenOutputFolderCommand.mnemonic=A
com.wudsn.ide.lng.editor.LanguageEditorAssembleCommand.name=Assemblieren
com.wudsn.ide.lng.editor.LanguageEditorAssembleCommand.mnemonic=A
com.wudsn.ide.lng.editor.LanguageEditorAssembleAndRunCommand.name=Assemblieren und Ausführen
com.wudsn.ide.lng.editor.LanguageEditorAssembleAndRunCommand.mnemonic=f
com.wudsn.ide.lng.editor.LanguageEditorAssembleAndRunWithCommand.name=Assemblieren und Ausführen mit...
com.wudsn.ide.lng.editor.LanguageEditorAssemblerHelpCommand.name=Assembler Hilfe
com.wudsn.ide.lng.editor.LanguageEditorAssemblerHelpCommand.mnemonic=H
com.wudsn.ide.lng.editor.LanguageEditorCompileCommand.name=Kompilieren com.wudsn.ide.lng.editor.LanguageEditorCompileCommand.name=Kompilieren
com.wudsn.ide.lng.editor.LanguageEditorCompileCommand.mnemonic=K com.wudsn.ide.lng.editor.LanguageEditorCompileCommand.mnemonic=K
com.wudsn.ide.lng.editor.LanguageEditorCompileAndRunCommand.name=Kompilieren und Ausführen com.wudsn.ide.lng.editor.LanguageEditorCompileAndRunCommand.name=Kompilieren und Ausführen
@ -37,7 +41,7 @@ com.wudsn.ide.lng.editor.LanguageEditorToggleBreakpointCommand.name=Breakpoint u
com.wudsn.ide.lng.editor.LanguageEditorOpenDeclarationCommand.name=Deklaration öffnen com.wudsn.ide.lng.editor.LanguageEditorOpenDeclarationCommand.name=Deklaration öffnen
com.wudsn.ide.lng.editor.LanguageEditorEnableDisableBreakpointCommand.name=Breakpoint ein/ausschalten com.wudsn.ide.lng.editor.LanguageEditorEnableDisableBreakpointCommand.name=Breakpoint ein/ausschalten
com.wudsn.ide.lng.editor.LanguageHyperlinkDetector.name=Hyperlink Detector com.wudsn.ide.lng.editor.LanguageHyperlinkDetector.name=Hyperlink Detektor
com.wudsn.ide.lng.editor.LanguageHyperlinkDetectorEditorTarget.name=Quelltext Editor com.wudsn.ide.lng.editor.LanguageHyperlinkDetectorEditorTarget.name=Quelltext Editor
com.wudsn.ide.lng.breakpoint.LanguageBreakpoint.name=Unterbrechungspunkt com.wudsn.ide.lng.breakpoint.LanguageBreakpoint.name=Unterbrechungspunkt

View File

@ -381,7 +381,7 @@
id="com.wudsn.ide.lng.editor.LanguageEditorAssemblerToolbar" id="com.wudsn.ide.lng.editor.LanguageEditorAssemblerToolbar"
label="%com.wudsn.ide.lng.editor.LanguageEditorAssemblerToolbar.label"> label="%com.wudsn.ide.lng.editor.LanguageEditorAssemblerToolbar.label">
<dynamic <dynamic
class="com.wudsn.ide.lng.editor.LanguageEditorAssembleAndRunCommandMenu" class="com.wudsn.ide.lng.editor.LanguageEditorCompileAndRunCommandMenu"
id="com.wudsn.ide.lng.editor.LanguageEditorAssembleAndRunCommandMenu"> id="com.wudsn.ide.lng.editor.LanguageEditorAssembleAndRunCommandMenu">
<visibleWhen <visibleWhen
checkEnabled="true"> checkEnabled="true">
@ -478,21 +478,21 @@
class="com.wudsn.ide.lng.breakpoint.LanguageBreakpoint" class="com.wudsn.ide.lng.breakpoint.LanguageBreakpoint"
id="languageBreakpoint" id="languageBreakpoint"
markerType="org.eclipse.debug.core.lineBreakpointMarker" markerType="org.eclipse.debug.core.lineBreakpointMarker"
name="%com.wudsn.ide.lng.editor.LanguageBreakpoint.name"> name="%com.wudsn.ide.lng.breakpoint.LanguageBreakpoint.name">
</breakpoint> </breakpoint>
</extension> </extension>
<extension <extension
point="org.eclipse.debug.ui.toggleBreakpointsTargetFactories"> point="org.eclipse.debug.ui.toggleBreakpointsTargetFactories">
<toggleTargetFactory <toggleTargetFactory
class="com.wudsn.ide.lng.breakpoint.LanguageBreakpointAdapterFactory" class="com.wudsn.ide.lng.breakpoint.LanguageBreakpointAdapterFactory"
id="com.wudsn.ide.lng.editor.LanguageBreakpointAdapterFactory"> id="com.wudsn.ide.lng.breakpoint.LanguageBreakpointAdapterFactory">
</toggleTargetFactory> </toggleTargetFactory>
</extension> </extension>
<extension <extension
point="org.eclipse.debug.ui.debugModelPresentations"> point="org.eclipse.debug.ui.debugModelPresentations">
<debugModelPresentation <debugModelPresentation
class="com.wudsn.ide.lng.breakpoint.LanguageBreakpoinDebugModelPresentation" class="com.wudsn.ide.lng.breakpoint.LanguageBreakpoinDebugModelPresentation"
id="com.wudsn.ide.asm"> id="com.wudsn.ide.lng">
</debugModelPresentation> </debugModelPresentation>
</extension> </extension>
@ -521,8 +521,8 @@
point="org.eclipse.ui.preferenceTransfer"> point="org.eclipse.ui.preferenceTransfer">
<transfer <transfer
icon="icons/hardware-generic-16x16.gif" icon="icons/hardware-generic-16x16.gif"
id="com.wudsn.ide.lng.preferences.LanguagePreferences" id="com.wudsn.ide.lng.preferences.LanguagesPreferences"
name="%com.wudsn.ide.lng.preferences.LanguagePreferences.name"> name="%com.wudsn.ide.lng.preferences.LanguagesPreferences.name">
<mapping <mapping
scope="instance"> scope="instance">
<entry <entry

View File

@ -2,9 +2,9 @@
<!-- Schema file written by PDE --> <!-- Schema file written by PDE -->
<schema targetNamespace="com.wudsn.ide.lng" xmlns="http://www.w3.org/2001/XMLSchema"> <schema targetNamespace="com.wudsn.ide.lng" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation> <annotation>
<appinfo> <appInfo>
<meta.schema plugin="com.wudsn.ide.lng" id="compilers" name="Compilers"/> <meta.schema plugin="com.wudsn.ide.lng" id="compilers" name="Compilers"/>
</appinfo> </appInfo>
<documentation> <documentation>
This extension point allows for adding new assemblers and compilers to the WUDSN IDE. This extension point allows for adding new assemblers and compilers to the WUDSN IDE.
</documentation> </documentation>
@ -12,9 +12,9 @@
<element name="extension"> <element name="extension">
<annotation> <annotation>
<appinfo> <appInfo>
<meta.element /> <meta.element />
</appinfo> </appInfo>
</annotation> </annotation>
<complexType> <complexType>
<sequence minOccurs="1" maxOccurs="unbounded"> <sequence minOccurs="1" maxOccurs="unbounded">
@ -39,9 +39,9 @@
<documentation> <documentation>
</documentation> </documentation>
<appinfo> <appInfo>
<meta.attribute translatable="true"/> <meta.attribute translatable="true"/>
</appinfo> </appInfo>
</annotation> </annotation>
</attribute> </attribute>
</complexType> </complexType>
@ -51,15 +51,22 @@
<complexType> <complexType>
<choice> <choice>
<sequence> <sequence>
<element ref="supportedCPU" minOccurs="1" maxOccurs="unbounded"/> <element ref="supportedTarget" minOccurs="1" maxOccurs="unbounded"/>
</sequence> </sequence>
<sequence> <sequence>
</sequence> </sequence>
</choice> </choice>
<attribute name="language" type="string" use="required">
<annotation>
<documentation>
The technical ID of the language.
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string" use="required"> <attribute name="id" type="string" use="required">
<annotation> <annotation>
<documentation> <documentation>
The technical id of the compiler. Must consist of lower case letters or digits. The technical ID of the compiler. Must consist of lower case letters or digits. Must be unique without one language.
</documentation> </documentation>
</annotation> </annotation>
</attribute> </attribute>
@ -68,9 +75,9 @@
<documentation> <documentation>
Translatable name of the compiler. Typically contains only upper case letters. Translatable name of the compiler. Typically contains only upper case letters.
</documentation> </documentation>
<appinfo> <appInfo>
<meta.attribute translatable="true"/> <meta.attribute translatable="true"/>
</appinfo> </appInfo>
</annotation> </annotation>
</attribute> </attribute>
<attribute name="class" type="string" use="required"> <attribute name="class" type="string" use="required">
@ -78,9 +85,9 @@
<documentation> <documentation>
The name of the compiler class. The name of the compiler class.
</documentation> </documentation>
<appinfo> <appInfo>
<meta.attribute kind="java" basedOn="com.wudsn.ide.lng.compiler.Compiler:"/> <meta.attribute kind="java" basedOn="com.wudsn.ide.lng.compiler.Compiler:"/>
</appinfo> </appInfo>
</annotation> </annotation>
</attribute> </attribute>
<attribute name="version" type="string" use="required"> <attribute name="version" type="string" use="required">
@ -166,9 +173,9 @@
</element> </element>
<annotation> <annotation>
<appinfo> <appInfo>
<meta.section type="since"/> <meta.section type="since"/>
</appinfo> </appInfo>
<documentation> <documentation>
WUDSN IDE 1.1.0 WUDSN IDE 1.1.0
</documentation> </documentation>
@ -176,9 +183,9 @@
<annotation> <annotation>
<appinfo> <appInfo>
<meta.section type="apiinfo"/> <meta.section type="apiinfo"/>
</appinfo> </appInfo>
<documentation> <documentation>
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 &quot;createLogParser&quot; method of the compiler you have to create a new instance of the corresponding log parser. 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 &quot;createLogParser&quot; method of the compiler you have to create a new instance of the corresponding log parser.
</documentation> </documentation>
@ -186,9 +193,9 @@
<annotation> <annotation>
<appinfo> <appInfo>
<meta.section type="copyright"/> <meta.section type="copyright"/>
</appinfo> </appInfo>
<documentation> <documentation>
(c) 2009 Peter Dell (c) 2009 Peter Dell
</documentation> </documentation>

View File

@ -1,3 +0,0 @@
# Used by LanguageEditor
com.wudsn.ide.lng.editor.ContentAssistProposal_label=Content Assist
com.wudsn.ide.lng.editor.LanguageEditorToggleCommentCommand_label=Toggle Comment

View File

@ -19,7 +19,10 @@
package com.wudsn.ide.lng; package com.wudsn.ide.lng;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -56,6 +59,8 @@ public final class LanguagePlugin extends AbstractIDEPlugin {
*/ */
private static LanguagePlugin plugin; private static LanguagePlugin plugin;
private List<Language> languages;
/** /**
* The preferences. * The preferences.
*/ */
@ -92,6 +97,10 @@ public final class LanguagePlugin extends AbstractIDEPlugin {
compilerConsole = null; compilerConsole = null;
runnerRegistry = new RunnerRegistry(); runnerRegistry = new RunnerRegistry();
properties = new HashMap<QualifiedName, String>(10); properties = new HashMap<QualifiedName, String>(10);
languages = new ArrayList<Language>(2);
languages.add(Language.ASM);
languages.add(Language.PAS);
languages = Collections.unmodifiableList(languages);
} }
/** /**
@ -161,6 +170,16 @@ public final class LanguagePlugin extends AbstractIDEPlugin {
return plugin; return plugin;
} }
/**
* Gets the unmodifiable list of supported languages.
*
* @return The unmodifiable list of supported languages, may be empty, not
* <code>null</code>,
*/
public List<Language> getLanguages() {
return languages;
}
/** /**
* Gets the compiler registry for this plugin. * Gets the compiler registry for this plugin.
* *

View File

@ -218,6 +218,8 @@ public final class Texts extends NLS {
public static String TOC_IDE_TOPIC_LABEL; public static String TOC_IDE_TOPIC_LABEL;
public static String TOC_LANGUAGES_TOPIC_LABEL;
public static String TOC_COMPILERS_TOPIC_LABEL; public static String TOC_COMPILERS_TOPIC_LABEL;
public static String TOC_COMPILER_GENERAL_TOPIC_LABEL; public static String TOC_COMPILER_GENERAL_TOPIC_LABEL;
public static String TOC_COMPILER_NAME_LABEL; public static String TOC_COMPILER_NAME_LABEL;

View File

@ -114,6 +114,8 @@ TOC_WUDSN_IDE_LABEL=WUDSN IDE Guide
TOC_IDE_TOPIC_LABEL=WUDSN IDE TOC_IDE_TOPIC_LABEL=WUDSN IDE
TOC_LANGUAGES_TOPIC_LABEL=Languages
TOC_COMPILERS_TOPIC_LABEL={0} TOC_COMPILERS_TOPIC_LABEL={0}
TOC_COMPILER_GENERAL_TOPIC_LABEL=General TOC_COMPILER_GENERAL_TOPIC_LABEL=General
TOC_COMPILER_NAME_LABEL=Name TOC_COMPILER_NAME_LABEL=Name

View File

@ -112,6 +112,8 @@ TOC_WUDSN_IDE_LABEL=WUDSN IDE Handbuch
TOC_IDE_TOPIC_LABEL=WUDSN IDE TOC_IDE_TOPIC_LABEL=WUDSN IDE
TOC_LANGUAGES_TOPIC_LABEL=Sprachen
TOC_COMPILERS_TOPIC_LABEL={0} TOC_COMPILERS_TOPIC_LABEL={0}
TOC_COMPILER_GENERAL_TOPIC_LABEL=Allgemein TOC_COMPILER_GENERAL_TOPIC_LABEL=Allgemein
TOC_COMPILER_NAME_LABEL=Name TOC_COMPILER_NAME_LABEL=Name

View File

@ -28,7 +28,6 @@ import com.wudsn.ide.lng.compiler.parser.CompilerSourceParser;
*/ */
public abstract class Compiler { public abstract class Compiler {
// See {@link CompilerId} for predefined ids.
private CompilerDefinition definition; private CompilerDefinition definition;
/** /**

View File

@ -46,6 +46,9 @@ import com.wudsn.ide.lng.compiler.syntax.CompilerSyntax;
*/ */
public final class CompilerDefinition implements Comparable<CompilerDefinition> { public final class CompilerDefinition implements Comparable<CompilerDefinition> {
// Language
private String language;
// Id // Id
private String id; private String id;
private String name; private String name;
@ -72,6 +75,51 @@ public final class CompilerDefinition implements Comparable<CompilerDefinition>
} }
/**
* Gets the key that uniquely identifies the compiler. They key has the format
* "<language>/<id>".
*
* @return The key that uniquely identifies the compiler, not <code>null</code>.
*/
public String getKey() {
if (language == null) {
throw new IllegalStateException("Field 'language' must not be null for this or for argument.");
}
if (id == null) {
throw new IllegalStateException("Field 'id' must not be null for this or for argument.");
}
return language + "/" + id;
}
/**
* Sets the language of the compiler. Called by {@link CompilerRegistry} only.
*
* @param language The language of the compiler, not empty and not
* <code>null</code>.
*/
final void setLanguage(String language) {
if (language == null) {
throw new IllegalArgumentException("Parameter 'language' must not be null.");
}
if (StringUtility.isEmpty(language)) {
throw new IllegalArgumentException("Parameter 'language' must not be empty.");
}
this.language = language;
}
/**
* Gets the language of the compiler.
*
* @return The language of the compiler, not empty and not <code>null</code>.
*/
public final String getLanguage() {
if (language == null) {
throw new IllegalStateException("Field 'language' must not be null.");
}
return language;
}
/** /**
* Sets the id of the compiler. Called by {@link CompilerRegistry} only. * Sets the id of the compiler. Called by {@link CompilerRegistry} only.
* *
@ -295,8 +343,8 @@ public final class CompilerDefinition implements Comparable<CompilerDefinition>
/** /**
* Sets the list of supported targets. Called by {@link CompilerRegistry} only. * Sets the list of supported targets. Called by {@link CompilerRegistry} only.
* *
* @param supportedTargets The unmodifiable list of supported CPUs, not empty and * @param supportedTargets The unmodifiable list of supported CPUs, not empty
* not <code>null</code>. * and not <code>null</code>.
* @since 1.6.1 * @since 1.6.1
*/ */
final void setSupportedTargets(List<Target> supportedTargets) { final void setSupportedTargets(List<Target> supportedTargets) {
@ -408,17 +456,13 @@ public final class CompilerDefinition implements Comparable<CompilerDefinition>
if (o == null) { if (o == null) {
throw new IllegalArgumentException("Parameter 'o' must not be null."); throw new IllegalArgumentException("Parameter 'o' must not be null.");
} }
if (id == null || o.id == null) {
if (id == null) { return getKey().compareTo(o.getKey());
throw new IllegalStateException("Field 'id' must not be null for this or for argument.");
}
}
return id.compareTo(o.id);
} }
@Override @Override
public String toString() { public String toString() {
return id; return getKey();
} }
} }

View File

@ -33,6 +33,7 @@ import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import com.wudsn.ide.base.hardware.Hardware; import com.wudsn.ide.base.hardware.Hardware;
import com.wudsn.ide.lng.Language;
import com.wudsn.ide.lng.Target; import com.wudsn.ide.lng.Target;
import com.wudsn.ide.lng.compiler.syntax.CompilerSyntax; import com.wudsn.ide.lng.compiler.syntax.CompilerSyntax;
@ -92,6 +93,7 @@ public final class CompilerRegistry {
try { try {
CompilerDefinition compilerDefinition; CompilerDefinition compilerDefinition;
compilerDefinition = new CompilerDefinition(); compilerDefinition = new CompilerDefinition();
compilerDefinition.setId(configurationElement.getAttribute("language"));
compilerDefinition.setId(configurationElement.getAttribute("id")); compilerDefinition.setId(configurationElement.getAttribute("id"));
compilerDefinition.setName(configurationElement.getAttribute("name")); compilerDefinition.setName(configurationElement.getAttribute("name"));
compilerDefinition.setClassName(configurationElement.getAttribute("class")); compilerDefinition.setClassName(configurationElement.getAttribute("class"));
@ -175,38 +177,40 @@ public final class CompilerRegistry {
} }
/** /**
* Gets the unmodifiable list of compiler definitions, sorted by their id. * Gets the unmodifiable list of compiler definitions for a language, sorted by their key.
* *
* * @param language The language or <code>null</code>.
* @return The unmodifiable list of compiler definitions, sorted by their id, * @return The unmodifiable list of compiler definitions, sorted by their key,
* may be empty, not <code>null</code> * may be empty, not <code>null</code>
* *
* @since 1.6.1 * @since 1.6.1
*/ */
public List<CompilerDefinition> getCompilerDefinitions() { public List<CompilerDefinition> getCompilerDefinitions(Language language) {
List<CompilerDefinition> result=new ArrayList<CompilerDefinition>();
return compilerDefinitionList; return compilerDefinitionList;
} }
/** /**
* Gets the compiler for a given id. Instances of compiler are stateless * Gets the compiler for a given key. Instances of compiler are stateless
* singletons within the plugin. * singletons within the plugin.
* *
* @param compilerId The compiler id, not <code>null</code>. * @param key The compiler key, not <code>null</code>.
* *
* @return The compiler, not <code>null</code>. * @return The compiler, not <code>null</code>.
*/ */
public Compiler getCompiler(String compilerId) { public Compiler getCompiler(String key) {
if (compilerId == null) { if (key == null) {
throw new IllegalArgumentException("Parameter 'compilerId' must not be null."); throw new IllegalArgumentException("Parameter 'key' must not be null.");
} }
Compiler result; Compiler result;
synchronized (compilerMap) { synchronized (compilerMap) {
result = compilerMap.get(compilerId); result = compilerMap.get(key);
} }
if (result == null) { if (result == null) {
throw new IllegalArgumentException("Unknown compiler id '" + compilerId + "'."); throw new IllegalArgumentException("Unknown compiler id '" + key + "'.");
} }
return result; return result;

View File

@ -25,7 +25,6 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
@ -54,11 +53,12 @@ import org.eclipse.ui.texteditor.TextOperationAction;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage; import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import com.wudsn.ide.base.common.Profiler; import com.wudsn.ide.base.common.Profiler;
import com.wudsn.ide.base.common.ResourceBundleUtility;
import com.wudsn.ide.base.hardware.Hardware; import com.wudsn.ide.base.hardware.Hardware;
import com.wudsn.ide.lng.LanguagePlugin; import com.wudsn.ide.lng.LanguagePlugin;
import com.wudsn.ide.lng.LanguageProperties; import com.wudsn.ide.lng.LanguageProperties;
import com.wudsn.ide.lng.Target;
import com.wudsn.ide.lng.LanguageProperties.InvalidLanguagePropertyException; import com.wudsn.ide.lng.LanguageProperties.InvalidLanguagePropertyException;
import com.wudsn.ide.lng.Target;
import com.wudsn.ide.lng.compiler.Compiler; import com.wudsn.ide.lng.compiler.Compiler;
import com.wudsn.ide.lng.compiler.CompilerDefinition; import com.wudsn.ide.lng.compiler.CompilerDefinition;
import com.wudsn.ide.lng.compiler.parser.CompilerSourceFile; import com.wudsn.ide.lng.compiler.parser.CompilerSourceFile;
@ -76,6 +76,13 @@ import com.wudsn.ide.lng.preferences.CompilerPreferences;
*/ */
public abstract class LanguageEditor extends TextEditor { public abstract class LanguageEditor extends TextEditor {
private static final class Actions {
public static final String LanguageContentAssistProposal = "com.wudsn.ide.lng.editor.LanguageContentAssistProposal";
public static final String LanguageEditorToggleCommentCommand = "com.wudsn.ide.lng.editor.LanguageEditorToggleCommentCommand";
public static final String RulerDoubleClick = "RulerDoubleClick";
}
private LanguagePlugin plugin; private LanguagePlugin plugin;
private LanguageEditorFilesLogic filesLogic; private LanguageEditorFilesLogic filesLogic;
@ -240,21 +247,20 @@ public abstract class LanguageEditor extends TextEditor {
protected final void createActions() { protected final void createActions() {
super.createActions(); super.createActions();
ResourceBundle bundle = ResourceBundle.getBundle("com.wudsn.ide.lng.Actions", Locale.getDefault(), ResourceBundle bundle = ResourceBundleUtility.getResourceBundle(Actions.class);
LanguageEditor.class.getClassLoader());
String actionDefintionId; String actionDefintionId;
String actionId; String actionId;
actionDefintionId = ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS; actionDefintionId = LanguageEditorActionDefinitionIds.LanguageContentAssistProposal;
actionId = "com.wudsn.ide.lng.editor.ContentAssistProposal"; actionId = Actions.LanguageContentAssistProposal;
IAction action = new TextOperationAction(bundle, actionId + ".", this, ISourceViewer.CONTENTASSIST_PROPOSALS); IAction action = new TextOperationAction(bundle, actionId + ".", this, ISourceViewer.CONTENTASSIST_PROPOSALS);
action.setActionDefinitionId(actionDefintionId); action.setActionDefinitionId(actionDefintionId);
setAction(actionId, action); setAction(actionId, action);
markAsStateDependentAction(actionId, true); markAsStateDependentAction(actionId, true);
SourceViewer sourceViewer = (SourceViewer) getSourceViewer(); SourceViewer sourceViewer = (SourceViewer) getSourceViewer();
actionDefintionId = "com.wudsn.ide.lng.editor.LanguageEditorToggleCommentCommand"; actionDefintionId = LanguageEditorActionDefinitionIds.LanguageEditorToggleCommentCommand;
actionId = actionDefintionId; actionId = Actions.LanguageEditorToggleCommentCommand;
action = new LanguageEditorToggleCommentAction(bundle, actionId + ".", this, sourceViewer); action = new LanguageEditorToggleCommentAction(bundle, actionId + ".", this, sourceViewer);
action.setActionDefinitionId(actionId); action.setActionDefinitionId(actionId);
setAction(actionId, action); setAction(actionId, action);
@ -262,8 +268,8 @@ public abstract class LanguageEditor extends TextEditor {
// Register rule double click. // Register rule double click.
ToggleBreakpointAction toggleBreakpointAction; ToggleBreakpointAction toggleBreakpointAction;
actionDefintionId = "org.eclipse.debug.ui.commands.ToggleBreakpoint"; actionDefintionId = LanguageEditorActionDefinitionIds.ToggleBreakpoint;
actionId = "RulerDoubleClick"; actionId = Actions.RulerDoubleClick;
action.setActionDefinitionId(actionId); action.setActionDefinitionId(actionId);
toggleBreakpointAction = new ToggleBreakpointAction(this, getDocumentProvider().getDocument(getEditorInput()), toggleBreakpointAction = new ToggleBreakpointAction(this, getDocumentProvider().getDocument(getEditorInput()),
getVerticalRuler()); getVerticalRuler());

View File

@ -0,0 +1,41 @@
/**
* Copyright (C) 2009 - 2021 <a href="https://www.wudsn.com" target="_top">Peter Dell</a>
*
* This file is part of WUDSN IDE.
*
* WUDSN IDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* WUDSN IDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WUDSN IDE. If not, see <http://www.gnu.org/licenses/>.
*/
package com.wudsn.ide.lng.editor;
/**
* Constant definitions for action definition IDs.
*
* @author Peter Dell
*
*/
public final class LanguageEditorActionDefinitionIds {
/**
* Creation is private.
*/
private LanguageEditorActionDefinitionIds() {
}
public static final String LanguageContentAssistProposal = "com.wudsn.ide.lng.editor.LanguageContentAssistProposal";
public static final String LanguageEditorToggleCommentCommand = "com.wudsn.ide.lng.editor.LanguageEditorToggleCommentCommand";
public static final String ToggleBreakpoint = "org.eclipse.debug.ui.commands.ToggleBreakpoint";
}

View File

@ -48,6 +48,7 @@ import com.wudsn.ide.base.common.StringUtility;
import com.wudsn.ide.base.common.TextUtility; import com.wudsn.ide.base.common.TextUtility;
import com.wudsn.ide.base.hardware.Hardware; import com.wudsn.ide.base.hardware.Hardware;
import com.wudsn.ide.base.hardware.HardwareUtility; import com.wudsn.ide.base.hardware.HardwareUtility;
import com.wudsn.ide.lng.Language;
import com.wudsn.ide.lng.LanguagePlugin; import com.wudsn.ide.lng.LanguagePlugin;
import com.wudsn.ide.lng.Target; import com.wudsn.ide.lng.Target;
import com.wudsn.ide.lng.Texts; import com.wudsn.ide.lng.Texts;
@ -115,7 +116,7 @@ public final class LanguageHelpContentProducer implements IHelpContentProducer {
} else if (href.startsWith(SCHEMA_HARDWARE)) { } else if (href.startsWith(SCHEMA_HARDWARE)) {
return getHardwareInputStream(href); return getHardwareInputStream(href);
} else if (href.startsWith(SCHEMA_TARGET)) { } else if (href.startsWith(SCHEMA_TARGET)) {
return getCPUInputStream(href); return getCPUInputStream(Language.ASM, href); // TODO: Language handling
} else if (href.endsWith(".html")) { // Web site documents } else if (href.endsWith(".html")) { // Web site documents
return getHTMLInputStream(href); return getHTMLInputStream(href);
} }
@ -593,7 +594,7 @@ public final class LanguageHelpContentProducer implements IHelpContentProducer {
return getInputStream(writer); return getInputStream(writer);
} }
private InputStream getCPUInputStream(String href) { private InputStream getCPUInputStream( Language language, String href) {
if (href == null) { if (href == null) {
throw new IllegalArgumentException("Parameter 'href' must not be null."); throw new IllegalArgumentException("Parameter 'href' must not be null.");
@ -622,7 +623,7 @@ public final class LanguageHelpContentProducer implements IHelpContentProducer {
writer.writeTableHeader(Texts.TOC_TARGET_OPCODE_LABEL); writer.writeTableHeader(Texts.TOC_TARGET_OPCODE_LABEL);
writer.writeTableHeader(Texts.TOC_COMPILER_INSTRUCTION_DESCRIPTION_LABEL); writer.writeTableHeader(Texts.TOC_COMPILER_INSTRUCTION_DESCRIPTION_LABEL);
List<CompilerDefinition> compilerDefinitions = compilerRegistry.getCompilerDefinitions(); List<CompilerDefinition> compilerDefinitions = compilerRegistry.getCompilerDefinitions(language);
int compilerDefinitionCount = compilerDefinitions.size(); int compilerDefinitionCount = compilerDefinitions.size();
InstructionSet[] instructionSets = new InstructionSet[compilerDefinitions.size()]; InstructionSet[] instructionSets = new InstructionSet[compilerDefinitions.size()];
for (int c = 0; c < compilerDefinitionCount; c++) { for (int c = 0; c < compilerDefinitionCount; c++) {

View File

@ -38,7 +38,9 @@ import org.eclipse.help.ITopic2;
import org.eclipse.help.IUAElement; import org.eclipse.help.IUAElement;
import com.wudsn.ide.base.common.EnumUtility; import com.wudsn.ide.base.common.EnumUtility;
import com.wudsn.ide.base.common.TextUtility;
import com.wudsn.ide.base.hardware.Hardware; import com.wudsn.ide.base.hardware.Hardware;
import com.wudsn.ide.lng.Language;
import com.wudsn.ide.lng.LanguagePlugin; import com.wudsn.ide.lng.LanguagePlugin;
import com.wudsn.ide.lng.Target; import com.wudsn.ide.lng.Target;
import com.wudsn.ide.lng.Texts; import com.wudsn.ide.lng.Texts;
@ -158,9 +160,10 @@ public final class LanguageTocProvider extends AbstractTocProvider {
String label; String label;
String key = href; String key = href;
try { try {
Class<LanguageTocProvider> clazz = LanguageTocProvider.class;
ResourceBundle resourceBundle; ResourceBundle resourceBundle;
resourceBundle = ResourceBundle.getBundle("com/wudsn/ide/asm/help/LanguageTocProvider", resourceBundle = ResourceBundle.getBundle(clazz.getName().replace('.', '/'), Locale.getDefault(),
Locale.getDefault(), LanguageTocProvider.class.getClassLoader()); clazz.getClassLoader());
label = resourceBundle.getString(key); label = resourceBundle.getString(key);
} catch (MissingResourceException ex) { } catch (MissingResourceException ex) {
label = href + " - Text missing"; label = href + " - Text missing";
@ -195,25 +198,40 @@ public final class LanguageTocProvider extends AbstractTocProvider {
} }
static ITopic[] createTopics() { static ITopic[] createTopics() {
LanguagePlugin languagePlugin = LanguagePlugin.getInstance();
CompilerRegistry compilerRegistry = languagePlugin.getCompilerRegistry();
List<CompilerDefinition> compilerDefinitions = compilerRegistry.getCompilerDefinitions();
List<ITopic> ideTopics = createIDETopics();
List<ITopic> compilerTopics = createCompilerTopics(compilerDefinitions);
List<ITopic> hardwareTopics = createHardwareTopics();
List<ITopic> cpuTopics = createTargetTopics();
List<ITopic> topics = new ArrayList<ITopic>(); List<ITopic> topics = new ArrayList<ITopic>();
LanguagePlugin languagePlugin = LanguagePlugin.getInstance();
List<ITopic> ideTopics = createIDETopics();
topics.add(createTopic("", Texts.TOC_IDE_TOPIC_LABEL, "", createTopicsArray(ideTopics))); topics.add(createTopic("", Texts.TOC_IDE_TOPIC_LABEL, "", createTopicsArray(ideTopics)));
topics.add(createTopic("", Texts.TOC_COMPILERS_TOPIC_LABEL, "", createTopicsArray(compilerTopics)));
List<ITopic> languagesTopics = createLanguagesTopics(languagePlugin);
topics.add(createTopic("", Texts.TOC_LANGUAGES_TOPIC_LABEL, "", createTopicsArray(languagesTopics)));
List<ITopic> hardwareTopics = createHardwareTopics();
topics.add(createTopic("", Texts.TOC_HARDWARES_TOPIC_LABEL, "", createTopicsArray(hardwareTopics))); topics.add(createTopic("", Texts.TOC_HARDWARES_TOPIC_LABEL, "", createTopicsArray(hardwareTopics)));
List<ITopic> cpuTopics = createTargetTopics();
topics.add(createTopic("", Texts.TOC_TARGETS_TOPIC_LABEL, "", createTopicsArray(cpuTopics))); topics.add(createTopic("", Texts.TOC_TARGETS_TOPIC_LABEL, "", createTopicsArray(cpuTopics)));
return createTopicsArray(topics); return createTopicsArray(topics);
} }
private static List<ITopic> createLanguagesTopics(LanguagePlugin languagePlugin) {
List<ITopic> topics = new ArrayList<ITopic>();
for (Language language : languagePlugin.getLanguages()) {
CompilerRegistry compilerRegistry = languagePlugin.getCompilerRegistry();
List<CompilerDefinition> compilerDefinitions = compilerRegistry.getCompilerDefinitions(language);
List<ITopic> compilerTopics = createCompilersTopics(compilerDefinitions);
topics.add(
createTopic("", TextUtility.format(Texts.TOC_COMPILERS_TOPIC_LABEL, EnumUtility.getText(language)),
"", createTopicsArray(compilerTopics)));
}
return topics;
}
private static List<ITopic> createIDETopics() { private static List<ITopic> createIDETopics() {
List<ITopic> topics = new ArrayList<ITopic>(); List<ITopic> topics = new ArrayList<ITopic>();
@ -226,7 +244,8 @@ public final class LanguageTocProvider extends AbstractTocProvider {
return topics; return topics;
} }
private static List<ITopic> createCompilerTopics(List<CompilerDefinition> compilerDefinitions) { private static List<ITopic> createCompilersTopics(List<CompilerDefinition> compilerDefinitions) {
if (compilerDefinitions == null) { if (compilerDefinitions == null) {
throw new IllegalArgumentException("Parameter 'compilerDefinitions' must not be null."); throw new IllegalArgumentException("Parameter 'compilerDefinitions' must not be null.");
} }

View File

@ -169,7 +169,7 @@ public abstract class LanguagePreferencesCompilersPage extends FieldEditorPrefer
/** /**
* The language. * The language.
*/ */
final Language langauge; final Language language;
/** /**
* The type of hardware used to filter the compilers and emulators. * The type of hardware used to filter the compilers and emulators.
@ -207,7 +207,7 @@ public abstract class LanguagePreferencesCompilersPage extends FieldEditorPrefer
if (hardware == null) { if (hardware == null) {
throw new IllegalArgumentException("Parameter 'hardware' must not be null."); throw new IllegalArgumentException("Parameter 'hardware' must not be null.");
} }
this.langauge = language; this.language = language;
this.hardware = hardware; this.hardware = hardware;
plugin = LanguagePlugin.getInstance(); plugin = LanguagePlugin.getInstance();
IPreferenceStore preferencesStore = plugin.getPreferenceStore(); IPreferenceStore preferencesStore = plugin.getPreferenceStore();
@ -253,7 +253,7 @@ public abstract class LanguagePreferencesCompilersPage extends FieldEditorPrefer
// Create the editors for all compilers of the hardware. // Create the editors for all compilers of the hardware.
CompilerRegistry compilerRegistry = plugin.getCompilerRegistry(); CompilerRegistry compilerRegistry = plugin.getCompilerRegistry();
List<CompilerDefinition> compilerDefinitions = compilerRegistry.getCompilerDefinitions(); List<CompilerDefinition> compilerDefinitions = compilerRegistry.getCompilerDefinitions(language);
tabFolder = new TabFolder(parent, SWT.FLAT); tabFolder = new TabFolder(parent, SWT.FLAT);
for (CompilerDefinition compilerDefinition : compilerDefinitions) { for (CompilerDefinition compilerDefinition : compilerDefinitions) {

View File

@ -30,6 +30,7 @@ import org.eclipse.swt.widgets.Display;
import com.wudsn.ide.base.hardware.Hardware; import com.wudsn.ide.base.hardware.Hardware;
import com.wudsn.ide.base.hardware.HardwareUtility; import com.wudsn.ide.base.hardware.HardwareUtility;
import com.wudsn.ide.lng.Language;
import com.wudsn.ide.lng.LanguagePlugin; import com.wudsn.ide.lng.LanguagePlugin;
import com.wudsn.ide.lng.compiler.CompilerDefinition; import com.wudsn.ide.lng.compiler.CompilerDefinition;
import com.wudsn.ide.lng.compiler.CompilerOutputFolderMode; import com.wudsn.ide.lng.compiler.CompilerOutputFolderMode;
@ -111,31 +112,34 @@ public final class LanguagePreferencesInitializer extends AbstractPreferenceInit
throw new IllegalArgumentException("Parameter 'store' must not be null."); throw new IllegalArgumentException("Parameter 'store' must not be null.");
} }
CompilerRegistry compilerRegistry = LanguagePlugin.getInstance().getCompilerRegistry(); LanguagePlugin languagePlugin = LanguagePlugin.getInstance();
CompilerRegistry compilerRegistry = languagePlugin.getCompilerRegistry();
for (Language language : languagePlugin.getLanguages()) {
List<CompilerDefinition> compilerDefinitions = compilerRegistry.getCompilerDefinitions(); List<CompilerDefinition> compilerDefinitions = compilerRegistry.getCompilerDefinitions(language);
for (CompilerDefinition compilerDefinition : compilerDefinitions) { for (CompilerDefinition compilerDefinition : compilerDefinitions) {
String compilerId; String compilerId;
String name; String name;
compilerId = compilerDefinition.getId(); compilerId = compilerDefinition.getId();
for (Hardware hardware : Hardware.values()) { for (Hardware hardware : Hardware.values()) {
if (hardware.equals(Hardware.GENERIC)) { if (hardware.equals(Hardware.GENERIC)) {
continue; continue;
}
store.setDefault(LanguagePreferencesConstants.getCompilerTargetName(compilerId, hardware),
compilerDefinition.getSupportedTargets().get(0).toString());
name = LanguagePreferencesConstants.getCompilerParametersName(compilerId, hardware);
store.setDefault(name, compilerDefinition.getDefaultParameters());
name = LanguagePreferencesConstants.getCompilerOutputFolderModeName(compilerId, hardware);
store.setDefault(name, CompilerOutputFolderMode.TEMP_FOLDER);
name = LanguagePreferencesConstants.getCompilerOutputFileExtensionName(compilerId, hardware);
store.setDefault(name, HardwareUtility.getDefaultFileExtension(hardware));
name = LanguagePreferencesConstants.getCompilerRunnerIdName(compilerId, hardware);
store.setDefault(name, RunnerId.DEFAULT_APPLICATION);
} }
store.setDefault(LanguagePreferencesConstants.getCompilerTargetName(compilerId, hardware),
compilerDefinition.getSupportedTargets().get(0).toString());
name = LanguagePreferencesConstants.getCompilerParametersName(compilerId, hardware);
store.setDefault(name, compilerDefinition.getDefaultParameters());
name = LanguagePreferencesConstants.getCompilerOutputFolderModeName(compilerId, hardware);
store.setDefault(name, CompilerOutputFolderMode.TEMP_FOLDER);
name = LanguagePreferencesConstants.getCompilerOutputFileExtensionName(compilerId, hardware);
store.setDefault(name, HardwareUtility.getDefaultFileExtension(hardware));
name = LanguagePreferencesConstants.getCompilerRunnerIdName(compilerId, hardware);
store.setDefault(name, RunnerId.DEFAULT_APPLICATION);
} }
} }
} }
} }

View File

@ -459,7 +459,7 @@ public abstract class LanguagePreferencesPage extends FieldEditorPreferencePage
// Create the editors for all compilers of the hardware. // Create the editors for all compilers of the hardware.
CompilerRegistry compilerRegistry = plugin.getCompilerRegistry(); CompilerRegistry compilerRegistry = plugin.getCompilerRegistry();
List<CompilerDefinition> compilerDefinitions = compilerRegistry.getCompilerDefinitions(); List<CompilerDefinition> compilerDefinitions = compilerRegistry.getCompilerDefinitions(language);
for (CompilerDefinition compilerDefinition : compilerDefinitions) { for (CompilerDefinition compilerDefinition : compilerDefinitions) {
String compilerId = compilerDefinition.getId(); String compilerId = compilerDefinition.getId();

View File

@ -28,6 +28,15 @@ com.wudsn.ide.base.editor.text.TextEditorReverseLinesCommand.mnemonic=R
com.wudsn.ide.base.editor.BinaryFile.name=Binary File com.wudsn.ide.base.editor.BinaryFile.name=Binary File
com.wudsn.ide.base.hardware.Hardware.GENERIC=Generic
com.wudsn.ide.base.hardware.Hardware.APPLE2=Apple 2
com.wudsn.ide.base.hardware.Hardware.ATARI2600=Atari 2600
com.wudsn.ide.base.hardware.Hardware.ATARI7800=Atari 7800
com.wudsn.ide.base.hardware.Hardware.ATARI8BIT=Atari 8-bit
com.wudsn.ide.base.hardware.Hardware.C64=C64
com.wudsn.ide.base.hardware.Hardware.NES=NES
com.wudsn.ide.base.hardware.Hardware.TEST=Test
com.wudsn.ide.base.hardware.HardwareCharacterSet.ASCII=ASCII com.wudsn.ide.base.hardware.HardwareCharacterSet.ASCII=ASCII
com.wudsn.ide.base.hardware.HardwareCharacterSet.ATARI_ATASCII=Atari ATASCII com.wudsn.ide.base.hardware.HardwareCharacterSet.ATARI_ATASCII=Atari ATASCII
com.wudsn.ide.base.hardware.HardwareCharacterSet.ATARI_ATASCII_SCREEN_CODE=Atari ATASCII Screen Code com.wudsn.ide.base.hardware.HardwareCharacterSet.ATARI_ATASCII_SCREEN_CODE=Atari ATASCII Screen Code

View File

@ -28,6 +28,15 @@ com.wudsn.ide.base.editor.text.TextEditorReverseLinesCommand.mnemonic=U
com.wudsn.ide.base.editor.BinaryFile.name=Binär-Datei com.wudsn.ide.base.editor.BinaryFile.name=Binär-Datei
com.wudsn.ide.base.hardware.Hardware.GENERIC=Generisch
com.wudsn.ide.base.hardware.Hardware.APPLE2=Apple 2
com.wudsn.ide.base.hardware.Hardware.ATARI2600=Atari 2600
com.wudsn.ide.base.hardware.Hardware.ATARI7800=Atari 7800
com.wudsn.ide.base.hardware.Hardware.ATARI8BIT=Atari 8-bit
com.wudsn.ide.base.hardware.Hardware.C64=C64
com.wudsn.ide.base.hardware.Hardware.NES=NES
com.wudsn.ide.base.hardware.Hardware.TEST=Test
com.wudsn.ide.base.hardware.HardwareCharacterSet.ASCII=ASCII com.wudsn.ide.base.hardware.HardwareCharacterSet.ASCII=ASCII
com.wudsn.ide.base.hardware.HardwareCharacterSet.ATARI_ATASCII=Atari ATASCII com.wudsn.ide.base.hardware.HardwareCharacterSet.ATARI_ATASCII=Atari ATASCII
com.wudsn.ide.base.hardware.HardwareCharacterSet.ATARI_ATASCII_SCREEN_CODE=Atari ATASCII Bildschirmcode com.wudsn.ide.base.hardware.HardwareCharacterSet.ATARI_ATASCII_SCREEN_CODE=Atari ATASCII Bildschirmcode

View File

@ -52,7 +52,7 @@ public final class EnumUtility {
try { try {
ResourceBundle resourceBundle; ResourceBundle resourceBundle;
resourceBundle = ResourceBundle.getBundle("OSGI-INF/l10n/bundle", Locale.getDefault(), enumClass.getClassLoader()); resourceBundle = ResourceBundleUtility.getResourceBundle(enumClass);
result = resourceBundle.getString(key); result = resourceBundle.getString(key);
} catch (MissingResourceException ex) { } catch (MissingResourceException ex) {
result = enumValue.name() + " - Text missing"; result = enumValue.name() + " - Text missing";

View File

@ -0,0 +1,37 @@
/**
* Copyright (C) 2009 - 2021 <a href="https://www.wudsn.com" target="_top">Peter Dell</a>
*
* This file is part of WUDSN IDE.
*
* WUDSN IDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* WUDSN IDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WUDSN IDE. If not, see <http://www.gnu.org/licenses/>.
*/
package com.wudsn.ide.base.common;
import java.util.Locale;
import java.util.ResourceBundle;
/**
* Utility class to access localization resource bundles in the default
* localization folder of a plugin.
*
* @author Peter Dell
*/
public final class ResourceBundleUtility {
public static ResourceBundle getResourceBundle(Class<?> clazz) {
ResourceBundle bundle = ResourceBundle.getBundle("OSGI-INF/l10n/bundle", Locale.getDefault(),
clazz.getClassLoader());
return bundle;
}
}

View File

@ -31,6 +31,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import com.wudsn.ide.base.BasePlugin; import com.wudsn.ide.base.BasePlugin;
import com.wudsn.ide.base.common.ResourceBundleUtility;
/** /**
* Combo field offering the elements of an enum class in generic and type safe * Combo field offering the elements of an enum class in generic and type safe
@ -83,8 +84,7 @@ public final class EnumField<T extends Enum<?>> extends Field {
combo = new Combo(parent, SWT.DROP_DOWN); combo = new Combo(parent, SWT.DROP_DOWN);
ResourceBundle resourceBundle; ResourceBundle resourceBundle;
resourceBundle = ResourceBundle.getBundle("OSGI-INF/l10n/bundle", Locale.getDefault(), resourceBundle = ResourceBundleUtility.getResourceBundle(enumClass);
enumClass.getClassLoader());
T[] constants = enumClass.getEnumConstants(); T[] constants = enumClass.getEnumConstants();

View File

@ -1,2 +1,2 @@
<!--comment--> <!--comment-->
TODO Have sections in TOC <!-- TODO Have sections in TOC -->