diff --git a/com.wudsn.ide.asm.compilers.test/plugin.xml b/com.wudsn.ide.asm.compilers.test/plugin.xml
index df8c4a21..9872d9d8 100644
--- a/com.wudsn.ide.asm.compilers.test/plugin.xml
+++ b/com.wudsn.ide.asm.compilers.test/plugin.xml
@@ -28,10 +28,11 @@
@@ -478,21 +478,21 @@
class="com.wudsn.ide.lng.breakpoint.LanguageBreakpoint"
id="languageBreakpoint"
markerType="org.eclipse.debug.core.lineBreakpointMarker"
- name="%com.wudsn.ide.lng.editor.LanguageBreakpoint.name">
+ name="%com.wudsn.ide.lng.breakpoint.LanguageBreakpoint.name">
+ id="com.wudsn.ide.lng.breakpoint.LanguageBreakpointAdapterFactory">
+ id="com.wudsn.ide.lng">
@@ -521,8 +521,8 @@
point="org.eclipse.ui.preferenceTransfer">
+ id="com.wudsn.ide.lng.preferences.LanguagesPreferences"
+ name="%com.wudsn.ide.lng.preferences.LanguagesPreferences.name">
-
+
-
+
This extension point allows for adding new assemblers and compilers to the WUDSN IDE.
@@ -12,9 +12,9 @@
-
+
-
+
@@ -39,9 +39,9 @@
-
+
-
+
@@ -51,15 +51,22 @@
-
+
+
+
+
+ The technical ID of the language.
+
+
+
- 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.
@@ -68,9 +75,9 @@
Translatable name of the compiler. Typically contains only upper case letters.
-
+
-
+
@@ -78,9 +85,9 @@
The name of the compiler class.
-
+
-
+
@@ -166,9 +173,9 @@
-
+
-
+
WUDSN IDE 1.1.0
@@ -176,9 +183,9 @@
-
+
-
+
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.
@@ -186,9 +193,9 @@
-
+
-
+
(c) 2009 Peter Dell
diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Actions.properties b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Actions.properties
deleted file mode 100644
index 2b6835ca..00000000
--- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Actions.properties
+++ /dev/null
@@ -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
\ No newline at end of file
diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/LanguagePlugin.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/LanguagePlugin.java
index e34b3d93..9571d4d0 100644
--- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/LanguagePlugin.java
+++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/LanguagePlugin.java
@@ -19,7 +19,10 @@
package com.wudsn.ide.lng;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -56,6 +59,8 @@ public final class LanguagePlugin extends AbstractIDEPlugin {
*/
private static LanguagePlugin plugin;
+ private List languages;
+
/**
* The preferences.
*/
@@ -92,6 +97,10 @@ public final class LanguagePlugin extends AbstractIDEPlugin {
compilerConsole = null;
runnerRegistry = new RunnerRegistry();
properties = new HashMap(10);
+ languages = new ArrayList(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;
}
+ /**
+ * Gets the unmodifiable list of supported languages.
+ *
+ * @return The unmodifiable list of supported languages, may be empty, not
+ * null
,
+ */
+ public List getLanguages() {
+ return languages;
+ }
+
/**
* Gets the compiler registry for this plugin.
*
diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Texts.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Texts.java
index 8337e531..729f50f5 100644
--- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Texts.java
+++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/Texts.java
@@ -218,6 +218,8 @@ public final class Texts extends NLS {
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_COMPILER_GENERAL_TOPIC_LABEL;
public static String TOC_COMPILER_NAME_LABEL;
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 dc056e45..ad571860 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
@@ -114,6 +114,8 @@ TOC_WUDSN_IDE_LABEL=WUDSN IDE Guide
TOC_IDE_TOPIC_LABEL=WUDSN IDE
+TOC_LANGUAGES_TOPIC_LABEL=Languages
+
TOC_COMPILERS_TOPIC_LABEL={0}
TOC_COMPILER_GENERAL_TOPIC_LABEL=General
TOC_COMPILER_NAME_LABEL=Name
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 7ad9480e..21131877 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
@@ -112,6 +112,8 @@ TOC_WUDSN_IDE_LABEL=WUDSN IDE Handbuch
TOC_IDE_TOPIC_LABEL=WUDSN IDE
+TOC_LANGUAGES_TOPIC_LABEL=Sprachen
+
TOC_COMPILERS_TOPIC_LABEL={0}
TOC_COMPILER_GENERAL_TOPIC_LABEL=Allgemein
TOC_COMPILER_NAME_LABEL=Name
diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/Compiler.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/Compiler.java
index fae0c2aa..a79b3baa 100644
--- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/Compiler.java
+++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/compiler/Compiler.java
@@ -28,7 +28,6 @@ import com.wudsn.ide.lng.compiler.parser.CompilerSourceParser;
*/
public abstract class Compiler {
- // See {@link CompilerId} for predefined ids.
private CompilerDefinition definition;
/**
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 f9875fdc..adcab74e 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
@@ -46,6 +46,9 @@ import com.wudsn.ide.lng.compiler.syntax.CompilerSyntax;
*/
public final class CompilerDefinition implements Comparable {
+ // Language
+ private String language;
+
// Id
private String id;
private String name;
@@ -72,6 +75,51 @@ public final class CompilerDefinition implements Comparable
}
+ /**
+ * Gets the key that uniquely identifies the compiler. They key has the format
+ * "/".
+ *
+ * @return The key that uniquely identifies the compiler, not null
.
+ */
+ 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
+ * null
.
+ */
+ 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 null
.
+ */
+ 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.
*
@@ -295,8 +343,8 @@ public final class CompilerDefinition implements Comparable
/**
* Sets the list of supported targets. Called by {@link CompilerRegistry} only.
*
- * @param supportedTargets The unmodifiable list of supported CPUs, not empty and
- * not null
.
+ * @param supportedTargets The unmodifiable list of supported CPUs, not empty
+ * and not null
.
* @since 1.6.1
*/
final void setSupportedTargets(List supportedTargets) {
@@ -408,17 +456,13 @@ public final class CompilerDefinition implements Comparable
if (o == null) {
throw new IllegalArgumentException("Parameter 'o' must not be null.");
}
- if (id == null || o.id == null) {
- if (id == null) {
- throw new IllegalStateException("Field 'id' must not be null for this or for argument.");
- }
- }
- return id.compareTo(o.id);
+
+ return getKey().compareTo(o.getKey());
}
@Override
public String toString() {
- return id;
+ return getKey();
}
}
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 5158f7f5..0735d2ec 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
@@ -33,6 +33,7 @@ import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
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;
@@ -92,6 +93,7 @@ public final class CompilerRegistry {
try {
CompilerDefinition compilerDefinition;
compilerDefinition = new CompilerDefinition();
+ compilerDefinition.setId(configurationElement.getAttribute("language"));
compilerDefinition.setId(configurationElement.getAttribute("id"));
compilerDefinition.setName(configurationElement.getAttribute("name"));
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.
*
- *
- * @return The unmodifiable list of compiler definitions, sorted by their id,
+ * @param language The language or null
.
+ * @return The unmodifiable list of compiler definitions, sorted by their key,
* may be empty, not null
*
* @since 1.6.1
*/
- public List getCompilerDefinitions() {
+ public List getCompilerDefinitions(Language language) {
+
+ List result=new ArrayList();
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.
*
- * @param compilerId The compiler id, not null
.
+ * @param key The compiler key, not null
.
*
* @return The compiler, not null
.
*/
- public Compiler getCompiler(String compilerId) {
- if (compilerId == null) {
- throw new IllegalArgumentException("Parameter 'compilerId' must not be null.");
+ public Compiler getCompiler(String key) {
+ if (key == null) {
+ throw new IllegalArgumentException("Parameter 'key' must not be null.");
}
Compiler result;
synchronized (compilerMap) {
- result = compilerMap.get(compilerId);
+ result = compilerMap.get(key);
}
if (result == null) {
- throw new IllegalArgumentException("Unknown compiler id '" + compilerId + "'.");
+ throw new IllegalArgumentException("Unknown compiler id '" + key + "'.");
}
return result;
diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/editor/LanguageEditor.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/editor/LanguageEditor.java
index d98cb5d6..a7d7b3f3 100644
--- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/editor/LanguageEditor.java
+++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/editor/LanguageEditor.java
@@ -25,7 +25,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Locale;
import java.util.ResourceBundle;
import org.eclipse.core.resources.IFile;
@@ -54,11 +53,12 @@ import org.eclipse.ui.texteditor.TextOperationAction;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
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.lng.LanguagePlugin;
import com.wudsn.ide.lng.LanguageProperties;
-import com.wudsn.ide.lng.Target;
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.CompilerDefinition;
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 {
+ 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 LanguageEditorFilesLogic filesLogic;
@@ -240,21 +247,20 @@ public abstract class LanguageEditor extends TextEditor {
protected final void createActions() {
super.createActions();
- ResourceBundle bundle = ResourceBundle.getBundle("com.wudsn.ide.lng.Actions", Locale.getDefault(),
- LanguageEditor.class.getClassLoader());
+ ResourceBundle bundle = ResourceBundleUtility.getResourceBundle(Actions.class);
String actionDefintionId;
String actionId;
- actionDefintionId = ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS;
- actionId = "com.wudsn.ide.lng.editor.ContentAssistProposal";
+ actionDefintionId = LanguageEditorActionDefinitionIds.LanguageContentAssistProposal;
+ actionId = Actions.LanguageContentAssistProposal;
IAction action = new TextOperationAction(bundle, actionId + ".", this, ISourceViewer.CONTENTASSIST_PROPOSALS);
action.setActionDefinitionId(actionDefintionId);
setAction(actionId, action);
markAsStateDependentAction(actionId, true);
SourceViewer sourceViewer = (SourceViewer) getSourceViewer();
- actionDefintionId = "com.wudsn.ide.lng.editor.LanguageEditorToggleCommentCommand";
- actionId = actionDefintionId;
+ actionDefintionId = LanguageEditorActionDefinitionIds.LanguageEditorToggleCommentCommand;
+ actionId = Actions.LanguageEditorToggleCommentCommand;
action = new LanguageEditorToggleCommentAction(bundle, actionId + ".", this, sourceViewer);
action.setActionDefinitionId(actionId);
setAction(actionId, action);
@@ -262,8 +268,8 @@ public abstract class LanguageEditor extends TextEditor {
// Register rule double click.
ToggleBreakpointAction toggleBreakpointAction;
- actionDefintionId = "org.eclipse.debug.ui.commands.ToggleBreakpoint";
- actionId = "RulerDoubleClick";
+ actionDefintionId = LanguageEditorActionDefinitionIds.ToggleBreakpoint;
+ actionId = Actions.RulerDoubleClick;
action.setActionDefinitionId(actionId);
toggleBreakpointAction = new ToggleBreakpointAction(this, getDocumentProvider().getDocument(getEditorInput()),
getVerticalRuler());
diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/editor/LanguageEditorActionDefinitionIds.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/editor/LanguageEditorActionDefinitionIds.java
new file mode 100644
index 00000000..bb9e907c
--- /dev/null
+++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/editor/LanguageEditorActionDefinitionIds.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (C) 2009 - 2021 Peter Dell
+ *
+ * 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 .
+ */
+
+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";
+
+}
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 e998cee1..6f080fee 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
@@ -48,6 +48,7 @@ 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;
import com.wudsn.ide.lng.LanguagePlugin;
import com.wudsn.ide.lng.Target;
import com.wudsn.ide.lng.Texts;
@@ -115,7 +116,7 @@ public final class LanguageHelpContentProducer implements IHelpContentProducer {
} else if (href.startsWith(SCHEMA_HARDWARE)) {
return getHardwareInputStream(href);
} 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
return getHTMLInputStream(href);
}
@@ -593,7 +594,7 @@ public final class LanguageHelpContentProducer implements IHelpContentProducer {
return getInputStream(writer);
}
- private InputStream getCPUInputStream(String href) {
+ private InputStream getCPUInputStream( Language language, String href) {
if (href == 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_COMPILER_INSTRUCTION_DESCRIPTION_LABEL);
- List compilerDefinitions = compilerRegistry.getCompilerDefinitions();
+ List compilerDefinitions = compilerRegistry.getCompilerDefinitions(language);
int compilerDefinitionCount = compilerDefinitions.size();
InstructionSet[] instructionSets = new InstructionSet[compilerDefinitions.size()];
for (int c = 0; c < compilerDefinitionCount; c++) {
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 3c0f10f8..50215306 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
@@ -38,7 +38,9 @@ import org.eclipse.help.ITopic2;
import org.eclipse.help.IUAElement;
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.lng.Language;
import com.wudsn.ide.lng.LanguagePlugin;
import com.wudsn.ide.lng.Target;
import com.wudsn.ide.lng.Texts;
@@ -158,9 +160,10 @@ public final class LanguageTocProvider extends AbstractTocProvider {
String label;
String key = href;
try {
+ Class clazz = LanguageTocProvider.class;
ResourceBundle resourceBundle;
- resourceBundle = ResourceBundle.getBundle("com/wudsn/ide/asm/help/LanguageTocProvider",
- Locale.getDefault(), LanguageTocProvider.class.getClassLoader());
+ resourceBundle = ResourceBundle.getBundle(clazz.getName().replace('.', '/'), Locale.getDefault(),
+ clazz.getClassLoader());
label = resourceBundle.getString(key);
} catch (MissingResourceException ex) {
label = href + " - Text missing";
@@ -195,25 +198,40 @@ public final class LanguageTocProvider extends AbstractTocProvider {
}
static ITopic[] createTopics() {
- LanguagePlugin languagePlugin = LanguagePlugin.getInstance();
- CompilerRegistry compilerRegistry = languagePlugin.getCompilerRegistry();
- List compilerDefinitions = compilerRegistry.getCompilerDefinitions();
-
- List ideTopics = createIDETopics();
- List compilerTopics = createCompilerTopics(compilerDefinitions);
- List hardwareTopics = createHardwareTopics();
- List cpuTopics = createTargetTopics();
-
List topics = new ArrayList();
+ LanguagePlugin languagePlugin = LanguagePlugin.getInstance();
+
+ List ideTopics = createIDETopics();
topics.add(createTopic("", Texts.TOC_IDE_TOPIC_LABEL, "", createTopicsArray(ideTopics)));
- topics.add(createTopic("", Texts.TOC_COMPILERS_TOPIC_LABEL, "", createTopicsArray(compilerTopics)));
+
+ List languagesTopics = createLanguagesTopics(languagePlugin);
+ topics.add(createTopic("", Texts.TOC_LANGUAGES_TOPIC_LABEL, "", createTopicsArray(languagesTopics)));
+
+ List hardwareTopics = createHardwareTopics();
topics.add(createTopic("", Texts.TOC_HARDWARES_TOPIC_LABEL, "", createTopicsArray(hardwareTopics)));
+
+ List cpuTopics = createTargetTopics();
topics.add(createTopic("", Texts.TOC_TARGETS_TOPIC_LABEL, "", createTopicsArray(cpuTopics)));
return createTopicsArray(topics);
}
+ private static List createLanguagesTopics(LanguagePlugin languagePlugin) {
+ List topics = new ArrayList();
+ for (Language language : languagePlugin.getLanguages()) {
+ CompilerRegistry compilerRegistry = languagePlugin.getCompilerRegistry();
+
+ List compilerDefinitions = compilerRegistry.getCompilerDefinitions(language);
+
+ List compilerTopics = createCompilersTopics(compilerDefinitions);
+ topics.add(
+ createTopic("", TextUtility.format(Texts.TOC_COMPILERS_TOPIC_LABEL, EnumUtility.getText(language)),
+ "", createTopicsArray(compilerTopics)));
+ }
+ return topics;
+ }
+
private static List createIDETopics() {
List topics = new ArrayList();
@@ -226,7 +244,8 @@ public final class LanguageTocProvider extends AbstractTocProvider {
return topics;
}
- private static List createCompilerTopics(List compilerDefinitions) {
+ private static List createCompilersTopics(List compilerDefinitions) {
+
if (compilerDefinitions == null) {
throw new IllegalArgumentException("Parameter 'compilerDefinitions' must not be null.");
}
diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/preferences/LanguagePreferencesCompilersPage.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/preferences/LanguagePreferencesCompilersPage.java
index 085e19df..aa4e940d 100644
--- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/preferences/LanguagePreferencesCompilersPage.java
+++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/preferences/LanguagePreferencesCompilersPage.java
@@ -169,7 +169,7 @@ public abstract class LanguagePreferencesCompilersPage extends FieldEditorPrefer
/**
* The language.
*/
- final Language langauge;
+ final Language language;
/**
* The type of hardware used to filter the compilers and emulators.
@@ -207,7 +207,7 @@ public abstract class LanguagePreferencesCompilersPage extends FieldEditorPrefer
if (hardware == null) {
throw new IllegalArgumentException("Parameter 'hardware' must not be null.");
}
- this.langauge = language;
+ this.language = language;
this.hardware = hardware;
plugin = LanguagePlugin.getInstance();
IPreferenceStore preferencesStore = plugin.getPreferenceStore();
@@ -253,7 +253,7 @@ public abstract class LanguagePreferencesCompilersPage extends FieldEditorPrefer
// Create the editors for all compilers of the hardware.
CompilerRegistry compilerRegistry = plugin.getCompilerRegistry();
- List compilerDefinitions = compilerRegistry.getCompilerDefinitions();
+ List compilerDefinitions = compilerRegistry.getCompilerDefinitions(language);
tabFolder = new TabFolder(parent, SWT.FLAT);
for (CompilerDefinition compilerDefinition : compilerDefinitions) {
diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/preferences/LanguagePreferencesInitializer.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/preferences/LanguagePreferencesInitializer.java
index c4d00d37..76d448ec 100644
--- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/preferences/LanguagePreferencesInitializer.java
+++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/preferences/LanguagePreferencesInitializer.java
@@ -30,6 +30,7 @@ import org.eclipse.swt.widgets.Display;
import com.wudsn.ide.base.hardware.Hardware;
import com.wudsn.ide.base.hardware.HardwareUtility;
+import com.wudsn.ide.lng.Language;
import com.wudsn.ide.lng.LanguagePlugin;
import com.wudsn.ide.lng.compiler.CompilerDefinition;
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.");
}
- CompilerRegistry compilerRegistry = LanguagePlugin.getInstance().getCompilerRegistry();
+ LanguagePlugin languagePlugin = LanguagePlugin.getInstance();
+ CompilerRegistry compilerRegistry = languagePlugin.getCompilerRegistry();
+ for (Language language : languagePlugin.getLanguages()) {
- List compilerDefinitions = compilerRegistry.getCompilerDefinitions();
- for (CompilerDefinition compilerDefinition : compilerDefinitions) {
- String compilerId;
- String name;
- compilerId = compilerDefinition.getId();
+ List compilerDefinitions = compilerRegistry.getCompilerDefinitions(language);
+ for (CompilerDefinition compilerDefinition : compilerDefinitions) {
+ String compilerId;
+ String name;
+ compilerId = compilerDefinition.getId();
- for (Hardware hardware : Hardware.values()) {
- if (hardware.equals(Hardware.GENERIC)) {
- continue;
+ for (Hardware hardware : Hardware.values()) {
+ if (hardware.equals(Hardware.GENERIC)) {
+ 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);
}
-
}
}
}
diff --git a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/preferences/LanguagePreferencesPage.java b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/preferences/LanguagePreferencesPage.java
index d87fc36c..44a9a0d7 100644
--- a/com.wudsn.ide.asm/src/com/wudsn/ide/lng/preferences/LanguagePreferencesPage.java
+++ b/com.wudsn.ide.asm/src/com/wudsn/ide/lng/preferences/LanguagePreferencesPage.java
@@ -459,7 +459,7 @@ public abstract class LanguagePreferencesPage extends FieldEditorPreferencePage
// Create the editors for all compilers of the hardware.
CompilerRegistry compilerRegistry = plugin.getCompilerRegistry();
- List compilerDefinitions = compilerRegistry.getCompilerDefinitions();
+ List compilerDefinitions = compilerRegistry.getCompilerDefinitions(language);
for (CompilerDefinition compilerDefinition : compilerDefinitions) {
String compilerId = compilerDefinition.getId();
diff --git a/com.wudsn.ide.base/OSGI-INF/l10n/bundle.properties b/com.wudsn.ide.base/OSGI-INF/l10n/bundle.properties
index 1c5cd2bc..5c9b6f7a 100644
--- a/com.wudsn.ide.base/OSGI-INF/l10n/bundle.properties
+++ b/com.wudsn.ide.base/OSGI-INF/l10n/bundle.properties
@@ -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.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.ATARI_ATASCII=Atari ATASCII
com.wudsn.ide.base.hardware.HardwareCharacterSet.ATARI_ATASCII_SCREEN_CODE=Atari ATASCII Screen Code
diff --git a/com.wudsn.ide.base/OSGI-INF/l10n/bundle_de_DE.properties b/com.wudsn.ide.base/OSGI-INF/l10n/bundle_de_DE.properties
index 0a2ddd6c..cbb0f8d6 100644
--- a/com.wudsn.ide.base/OSGI-INF/l10n/bundle_de_DE.properties
+++ b/com.wudsn.ide.base/OSGI-INF/l10n/bundle_de_DE.properties
@@ -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.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.ATARI_ATASCII=Atari ATASCII
com.wudsn.ide.base.hardware.HardwareCharacterSet.ATARI_ATASCII_SCREEN_CODE=Atari ATASCII Bildschirmcode
diff --git a/com.wudsn.ide.base/src/com/wudsn/ide/base/common/EnumUtility.java b/com.wudsn.ide.base/src/com/wudsn/ide/base/common/EnumUtility.java
index 717d39b8..262dc86c 100644
--- a/com.wudsn.ide.base/src/com/wudsn/ide/base/common/EnumUtility.java
+++ b/com.wudsn.ide.base/src/com/wudsn/ide/base/common/EnumUtility.java
@@ -52,7 +52,7 @@ public final class EnumUtility {
try {
ResourceBundle resourceBundle;
- resourceBundle = ResourceBundle.getBundle("OSGI-INF/l10n/bundle", Locale.getDefault(), enumClass.getClassLoader());
+ resourceBundle = ResourceBundleUtility.getResourceBundle(enumClass);
result = resourceBundle.getString(key);
} catch (MissingResourceException ex) {
result = enumValue.name() + " - Text missing";
diff --git a/com.wudsn.ide.base/src/com/wudsn/ide/base/common/ResourceBundleUtility.java b/com.wudsn.ide.base/src/com/wudsn/ide/base/common/ResourceBundleUtility.java
new file mode 100644
index 00000000..367ef83b
--- /dev/null
+++ b/com.wudsn.ide.base/src/com/wudsn/ide/base/common/ResourceBundleUtility.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright (C) 2009 - 2021 Peter Dell
+ *
+ * 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 .
+ */
+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;
+ }
+}
diff --git a/com.wudsn.ide.base/src/com/wudsn/ide/base/gui/EnumField.java b/com.wudsn.ide.base/src/com/wudsn/ide/base/gui/EnumField.java
index 01261f6a..6ad5e2f9 100644
--- a/com.wudsn.ide.base/src/com/wudsn/ide/base/gui/EnumField.java
+++ b/com.wudsn.ide.base/src/com/wudsn/ide/base/gui/EnumField.java
@@ -31,6 +31,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
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
@@ -83,8 +84,7 @@ public final class EnumField> extends Field {
combo = new Combo(parent, SWT.DROP_DOWN);
ResourceBundle resourceBundle;
- resourceBundle = ResourceBundle.getBundle("OSGI-INF/l10n/bundle", Locale.getDefault(),
- enumClass.getClassLoader());
+ resourceBundle = ResourceBundleUtility.getResourceBundle(enumClass);
T[] constants = enumClass.getEnumConstants();
diff --git a/com.wudsn.ide.tst/help/toc.xml b/com.wudsn.ide.tst/help/toc.xml
index 03c45227..049d3cce 100644
--- a/com.wudsn.ide.tst/help/toc.xml
+++ b/com.wudsn.ide.tst/help/toc.xml
@@ -1,2 +1,2 @@
-TODO Have sections in TOC
\ No newline at end of file
+
\ No newline at end of file