Commit 5657e780 authored by Julian Kranz's avatar Julian Kranz

Merge branch 'master' of versioncontrolseidl.in.tum.de:endress/gdsl-toolkit

parents 98e2377b 5e414196
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/gdsl.plugin.sdk_1.0.0.qualifier.jar" id="gdsl.plugin.sdk" version="1.0.0.qualifier">
<category name="gdslIde"/>
</feature>
<category-def name="gdslIde" label="GDSL IDE"/>
</site>
<?xml version="1.0" encoding="UTF-8"?>
<feature id="gdsl.plugin.sdk"
label="GDSL SDK Feature "
version="1.0.0.qualifier">
<plugin
id="gdsl.plugin"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gdsl.plugin.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<feature
id="gdsl.plugin.sdk"
label="GDSL Development Environment"
version="1.0.0.qualifier">
<plugin
id="gdsl.plugin"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gdsl.plugin.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gdsl.plugin.ui.pref</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Pref
Bundle-SymbolicName: gdsl.plugin.ui.pref;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: gdsl.plugin.pref.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
gdsl.plugin;bundle-version="1.0.0",
gdsl.plugin.ui;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer
class="gdsl.plugin.preferences.PreferenceInitializer">
</initializer>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
category="gdsl.plugin.GDSL"
class="gdsl.plugin.ui.pref.preferences.GdslPreferencePage"
id="gdsl.plugin.ui.pref.preferences.GdslPreferencePage"
name="External GDSL Compiler">
</page>
</extension>
</plugin>
package gdsl.plugin.pref;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "gdsl.plugin.pref"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
}
package gdsl.plugin.ui.pref.preferences;
import java.io.File;
import java.util.ArrayList;
import java.util.StringTokenizer;
import org.eclipse.jface.preference.ListEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.List;
public class FilePathEditor extends ListEditor {
private final String[] extensions;
private String lastPath;
public FilePathEditor(String name, String labelText, String[] extensions, Composite parent){
init(name, labelText);
this.extensions = extensions;
createControl(parent);
}
@Override
protected String createList(String[] items) {
StringBuffer files = new StringBuffer("");//$NON-NLS-1$
for(String item : items){
files.append(item);
files.append(File.pathSeparator);
}
return files.toString();
}
@Override
protected String getNewInputObject() {
FileDialog dialog = new FileDialog(getShell(), SWT.SHEET);
if (lastPath != null) {
if (new File(lastPath).exists()) {
dialog.setFilterPath(lastPath);
}
}
dialog.setFilterExtensions(extensions);
String file = dialog.open();
if (file != null) {
file = file.trim();
if (file.length() == 0) {
return null;
}
lastPath = (new File(file)).getParent();
}
return file;
}
@Override
protected String[] parseString(String stringList) {
StringTokenizer st = new StringTokenizer(stringList, File.pathSeparator
+ "\n\r");//$NON-NLS-1$
ArrayList<Object> v = new ArrayList<Object>();
while (st.hasMoreElements()) {
v.add(st.nextElement());
}
return (String[]) v.toArray(new String[v.size()]);
}
}
package gdsl.plugin.ui.pref.preferences;
import gdsl.plugin.preferences.GDSLPluginPreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.FileFieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.StringButtonFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
/**
* This class represents a preference page that
* is contributed to the Preferences dialog. By
* subclassing <samp>FieldEditorPreferencePage</samp>, we
* can use the field support built into JFace that allows
* us to create a page that is small and knows how to
* save, restore and apply itself.
* <p>
* This page is used to modify preferences only. They
* are stored in the preference store that belongs to
* the main plug-in class. That way, preferences can
* be accessed directly via the preference store.
*/
public class GdslPreferencePage
extends FieldEditorPreferencePage
implements IWorkbenchPreferencePage {
private final String[] FILE_EXTENSIONS = {"*.ml", "*"};
public GdslPreferencePage() {
super(org.eclipse.jface.preference.FieldEditorPreferencePage.FLAT);
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "gdsl.plugin");
setPreferenceStore(store);
setDescription("Settings for the external GDSL Compiler");
}
/**
* Creates the field editors. Field editors are abstractions of
* the common GUI blocks needed to manipulate various types
* of preferences. Each field editor knows how to save and
* restore itself.
*/
public void createFieldEditors() {
final FileFieldEditor compilerCall = new FileFieldEditor(GDSLPluginPreferences.P_COMPILER_CALL, "Compiler call", true, StringButtonFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent());
final FileFieldEditor compilerPath = new FileFieldEditor(GDSLPluginPreferences.P_COMPILER_PATH, "SML Load", true, StringButtonFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent());
final StringFieldEditor compileArguments = new StringFieldEditor(GDSLPluginPreferences.P_COMPILE_ARGUMENTS, "Arguments", getFieldEditorParent());
final DirectoryFieldEditor runtimeEnvironment = new DirectoryFieldEditor(GDSLPluginPreferences.P_RUNTIME_FOLDER, "Codegen Folder", getFieldEditorParent());
final FilePathEditor compileFiles = new FilePathEditor(GDSLPluginPreferences.P_COMPILE_FILES, "Files to compile", FILE_EXTENSIONS, getFieldEditorParent());
addField(compilerCall);
addField(compilerPath);
addField(compileArguments);
addField(runtimeEnvironment);
addField(compileFiles);
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
public void init(IWorkbench workbench) {
}
}
\ No newline at end of file
......@@ -15,7 +15,8 @@ Require-Bundle: gdsl.plugin;visibility:=reexport,
org.antlr.runtime,
org.eclipse.xtext.common.types.ui,
org.eclipse.xtext.ui.codetemplates.ui,
org.eclipse.compare
org.eclipse.compare,
org.eclipse.jdt.ui;bundle-version="3.9.2"
Import-Package: org.apache.log4j,
org.eclipse.xtext.xbase.lib
Bundle-RequiredExecutionEnvironment: J2SE-1.5
......
......@@ -253,6 +253,9 @@
class="gdsl.plugin.ui.GDSLExecutableExtensionFactory:org.eclipse.xtext.builder.IXtextBuilderParticipant">
</participant>
</extension>
<!--
Commented out to remove compiler pages.
These specify settings for code generation.
<extension
point="org.eclipse.ui.preferencePages">
<page
......@@ -277,6 +280,7 @@
<filter name="projectNature" value="org.eclipse.xtext.ui.shared.xtextNature"/>
</page>
</extension>
-->
<!-- Quick Outline -->
<extension
......
T__29=29
RULE_ID=4
T__64=64
T__28=28
T__29=29
T__65=65
T__28=28
T__27=27
T__62=62
T__26=26
T__63=63
RULE_SYM_WO_USCORE_WO_SLASH_WO_BS_WO_DOT_WO_LESS_WO_GREATER=13
RULE_CONS_WO_S=19
T__25=25
T__61=61
T__60=60
T__55=55
......@@ -14,17 +15,18 @@ T__56=56
T__57=57
T__58=58
T__51=51
RULE_DOT=10
RULE_DOT=11
T__52=52
T__53=53
T__54=54
RULE_IDCHAR=23
RULE_IDCHAR=19
T__59=59
RULE_S=18
RULE_SYM_WO_USCORE_SLASH_BS_DOT_LESS_GREATER=14
RULE_S=5
T__50=50
T__42=42
T__43=43
RULE_GREATER=12
RULE_GREATER=13
T__40=40
T__41=41
T__46=46
......@@ -33,69 +35,69 @@ T__44=44
T__45=45
T__48=48
T__49=49
RULE_USCORE=5
RULE_SL_COMMENT=26
RULE_HEXINT=4
RULE_ML_COMMENT=25
RULE_BS=9
RULE_BINS=17
RULE_USCORE=9
RULE_SL_COMMENT=24
RULE_HEXINT=7
RULE_ML_COMMENT=23
RULE_BS=10
RULE_BINS=6
T__30=30
T__31=31
RULE_STRING=20
RULE_STRING=18
T__32=32
RULE_MIXID=8
T__33=33
T__34=34
T__35=35
RULE_ID_WO_CONS=6
T__36=36
T__37=37
T__38=38
RULE_OTHERSYM=22
RULE_OTHERSYM=21
T__39=39
RULE_NEGINT=14
RULE_DUALS=16
RULE_LESS=11
RULE_SLASH=7
RULE_CHARSYM=21
RULE_WS=24
RULE_POSINT_WO_DUALS=15
'|'=36
'end'=49
'~'=54
'then'=50
'val'=37
'type'=34
'export'=32
';'=31
'='=35
'@'=58
'+'=27
')'=45
'=>'=48
'^'=53
'%'=30
'->'=46
RULE_NEGINT=15
RULE_DUALS=17
RULE_LESS=12
RULE_CHARSYM=20
RULE_WS=22
RULE_POSINT_WO_DUALS=16
'end'=50
'|'=38
'~'=55
'then'=51
'string'=26
'val'=39
'type'=36
'export'=34
';'=33
'='=37
'unit'=27
'@'=59
'+'=28
'=>'=49
')'=47
'^'=54
'%'=31
'->'=48
'do'=62
'case'=60
'$'=55
'<-'=52
'}'=43
'else'=51
'$'=56
'<-'=53
'}'=45
'else'=52
'let'=65
'and'=64
'{'=42
'\''=57
'int'=59
'{'=44
'\''=58
'int'=25
'if'=61
':'=33
'('=44
':'=35
'('=46
'or'=63
'['=38
'*'=29
'-'=28
','=40
'of'=41
'in'=56
'()'=47
']'=39
'*'=30
'-'=29
'['=40
','=42
'of'=43
'in'=57
'()'=32
']'=41
/*
* generated by Xtext
*/
package gdsl.plugin.ui.labeling
import com.google.inject.Inject
import gdsl.plugin.gDSL.ConDecl
import gdsl.plugin.gDSL.DeclExport
import gdsl.plugin.gDSL.Val
import gdsl.plugin.gDSL.Ty
import gdsl.plugin.gDSL.Type
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider
import org.eclipse.jdt.ui.ISharedImages
import org.eclipse.jdt.ui.JavaUI
import org.eclipse.jface.viewers.StyledString
import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider
import static extension org.eclipse.xtext.EcoreUtil2.*
/**
* Provides labels for a EObjects.
*
* @author Daniel Endress
*
* see http://www.eclipse.org/Xtext/documentation.html#labelProvider
*/
class GDSLLabelProvider extends org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider {
class GDSLLabelProvider extends DefaultEObjectLabelProvider {
@Inject
new(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider delegate) {
new(AdapterFactoryLabelProvider delegate) {
super(delegate);
}
// Labels and icons can be computed like this:
def text(DeclExport e){
e.name.name
}
def image(DeclExport e){
JavaUI.sharedImages.getImage(ISharedImages.IMG_OBJS_PRIVATE)
}
def text(Type t){
var result = new StyledString()
result.append(t.name)
if(null != t.value){
val style = StyledString.DECORATIONS_STYLER
result.append(" = " + text(t.value), style)
}
return result
}
def String text(Ty t){
var result = new StringBuilder()
if(null != t.value){
result.append(t.value)
}
if(null != t.typeRef){
result.append(t.typeRef.name)
}
if(null != t.type){
result.append(t.type)
}
if(null != t.elements && t.elements.length > 0){
result.append('{')
result.append(t.elements.get(0).name + ':' + text(t.elements.get(0).value))
var i = 1
while(i < t.elements.length){
result.append(", " + t.elements.get(i).name + ':' + text(t.elements.get(i).value))
i=i+1
}
result.append('}')
}
result.toString
}
def image(Type t){
JavaUI.sharedImages.getImage(ISharedImages.IMG_OBJS_PROTECTED)
}
def text(ConDecl cd){
val style = StyledString.COUNTER_STYLER
var result = new StyledString()
result.append(cd.name.conName)
if(null != cd.ty){
result.append(' (' + text(cd.ty) + ')', style)
}
result.append(' : ' + cd.getContainerOfType(typeof(Type)).name, style)
return result
}
def image(ConDecl cd){
JavaUI.sharedImages.getImage(ISharedImages.IMG_OBJS_IMPDECL)
}
def text(Val v){
var result = new StyledString()
result.append(v.name)
val decPat = v.decPat
if(null != decPat && decPat.length > 0){
var bitPat = new StringBuilder()
for(s : decPat){
bitPat.append(" " + s)
}
result.append(" [" + bitPat.toString.trim + "]", StyledString.QUALIFIER_STYLER)
}
val attr = v.attr
if(null != attr && attr.length > 0){
val style = StyledString.COUNTER_STYLER
result.append(" (", style)
result.append(attr.get(0), style)
var i = 1;
while(i < attr.length){
result.append(", " + attr.get(i), style)
i=i+1
}
result.append(")", style)
}
return result
}
def image(Val v){
JavaUI.sharedImages.getImage(ISharedImages.IMG_OBJS_PUBLIC)
}
// def text(Greeting ele) {
// 'A greeting to ' + ele.name
// }
//