mirror of
https://github.com/Minres/RDL-Editor.git
synced 2025-06-12 13:22:23 +02:00
Cleanup and fix of old settings
This commit is contained in:
@ -4,7 +4,6 @@
|
||||
package com.minres.rdl.ui;
|
||||
|
||||
import com.minres.rdl.ui.AbstractRDLUiModule;
|
||||
import com.minres.rdl.ui.JDTFreeStructuralProjectCreator;
|
||||
import com.minres.rdl.ui.RDLEObjectDocumentationProvider;
|
||||
import com.minres.rdl.ui.RDLEObjectHoverProvider;
|
||||
import com.minres.structural.ui.hyperlink.MyHyperlinkHelper;
|
||||
@ -17,7 +16,6 @@ import org.eclipse.xtext.ui.editor.hyperlinking.HyperlinkHelper;
|
||||
import org.eclipse.xtext.ui.editor.hyperlinking.XtextHyperlink;
|
||||
import org.eclipse.xtext.ui.resource.IResourceSetProvider;
|
||||
import org.eclipse.xtext.ui.resource.SimpleResourceSetProvider;
|
||||
import org.eclipse.xtext.ui.wizard.IProjectCreator;
|
||||
|
||||
/**
|
||||
* Use this class to register components to be used within the Eclipse IDE.
|
||||
@ -33,11 +31,6 @@ public class RDLUiModule extends AbstractRDLUiModule {
|
||||
return RDLEObjectDocumentationProvider.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IProjectCreator> bindIProjectCreator() {
|
||||
return JDTFreeStructuralProjectCreator.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IResourceSetProvider> bindIResourceSetProvider() {
|
||||
return SimpleResourceSetProvider.class;
|
||||
@ -51,7 +44,7 @@ public class RDLUiModule extends AbstractRDLUiModule {
|
||||
return MyXtextHyperlink.class;
|
||||
}
|
||||
|
||||
public RDLUiModule(final AbstractUIPlugin arg0) {
|
||||
super(arg0);
|
||||
public RDLUiModule(final AbstractUIPlugin plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,95 @@
|
||||
/**
|
||||
* generated by Xtext 2.14.0
|
||||
*/
|
||||
package com.minres.rdl.ui.wizard;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.jdt.core.JavaCore;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.ui.XtextProjectHelper;
|
||||
import org.eclipse.xtext.ui.util.PluginProjectFactory;
|
||||
import org.eclipse.xtext.ui.wizard.template.AbstractProjectTemplate;
|
||||
import org.eclipse.xtext.ui.wizard.template.BooleanTemplateVariable;
|
||||
import org.eclipse.xtext.ui.wizard.template.GroupTemplateVariable;
|
||||
import org.eclipse.xtext.ui.wizard.template.IProjectGenerator;
|
||||
import org.eclipse.xtext.ui.wizard.template.ProjectTemplate;
|
||||
import org.eclipse.xtext.ui.wizard.template.StringSelectionTemplateVariable;
|
||||
import org.eclipse.xtext.ui.wizard.template.StringTemplateVariable;
|
||||
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
|
||||
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
|
||||
|
||||
@ProjectTemplate(label = "Hello World", icon = "project_template.png", description = "<p><b>Hello World</b></p>\n<p>This is a parameterized hello world for RDL. You can set a parameter to modify the content in the generated file\nand a parameter to set the package the file is created in.</p>")
|
||||
@SuppressWarnings("all")
|
||||
public final class HelloWorldProject extends AbstractProjectTemplate {
|
||||
private final BooleanTemplateVariable advanced = this.check("Advanced:", false);
|
||||
|
||||
private final GroupTemplateVariable advancedGroup = this.group("Properties");
|
||||
|
||||
private final StringSelectionTemplateVariable name = this.combo("Name:", new String[] { "Xtext", "World", "Foo", "Bar" }, "The name to say \'Hello\' to", this.advancedGroup);
|
||||
|
||||
private final StringTemplateVariable path = this.text("Package:", "mydsl", "The package path to place the files in", this.advancedGroup);
|
||||
|
||||
@Override
|
||||
protected void updateVariables() {
|
||||
this.name.setEnabled(this.advanced.getValue());
|
||||
this.path.setEnabled(this.advanced.getValue());
|
||||
boolean _value = this.advanced.getValue();
|
||||
boolean _not = (!_value);
|
||||
if (_not) {
|
||||
this.name.setValue("Xtext");
|
||||
this.path.setValue("rdl");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IStatus validate() {
|
||||
Status _xifexpression = null;
|
||||
boolean _matches = this.path.getValue().matches("[a-z][a-z0-9_]*(/[a-z][a-z0-9_]*)*");
|
||||
if (_matches) {
|
||||
_xifexpression = null;
|
||||
} else {
|
||||
_xifexpression = new Status(IStatus.ERROR, "Wizard", (("\'" + this.path) + "\' is not a valid package name"));
|
||||
}
|
||||
return _xifexpression;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateProjects(final IProjectGenerator generator) {
|
||||
PluginProjectFactory _pluginProjectFactory = new PluginProjectFactory();
|
||||
final Procedure1<PluginProjectFactory> _function = (PluginProjectFactory it) -> {
|
||||
it.setProjectName(this.getProjectInfo().getProjectName());
|
||||
it.setLocation(this.getProjectInfo().getLocationPath());
|
||||
List<String> _projectNatures = it.getProjectNatures();
|
||||
Iterables.<String>addAll(_projectNatures, Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature", XtextProjectHelper.NATURE_ID)));
|
||||
List<String> _builderIds = it.getBuilderIds();
|
||||
_builderIds.add(JavaCore.BUILDER_ID);
|
||||
List<String> _folders = it.getFolders();
|
||||
_folders.add("src");
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("src/");
|
||||
_builder.append(this.path);
|
||||
_builder.append("/Model.rdl");
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("/*");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("* This is an example model");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("*/");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("Hello ");
|
||||
_builder_1.append(this.name);
|
||||
_builder_1.append("!");
|
||||
_builder_1.newLineIfNotEmpty();
|
||||
this.addFile(it, _builder, _builder_1);
|
||||
};
|
||||
PluginProjectFactory _doubleArrow = ObjectExtensions.<PluginProjectFactory>operator_doubleArrow(_pluginProjectFactory, _function);
|
||||
generator.generate(_doubleArrow);
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/**
|
||||
* generated by Xtext 2.14.0
|
||||
*/
|
||||
package com.minres.rdl.ui.wizard;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.generator.IFileSystemAccess2;
|
||||
import org.eclipse.xtext.resource.FileExtensionProvider;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class RDLNewProjectWizardInitialContents {
|
||||
@Inject
|
||||
private FileExtensionProvider fileExtensionProvider;
|
||||
|
||||
public void generateInitialContents(final IFileSystemAccess2 fsa) {
|
||||
String _primaryFileExtension = this.fileExtensionProvider.getPrimaryFileExtension();
|
||||
String _plus = ("src/model/Model." + _primaryFileExtension);
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("/*");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("* This is an example model");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("*/");
|
||||
_builder.newLine();
|
||||
_builder.append("Hello Xtext!");
|
||||
_builder.newLine();
|
||||
fsa.generateFile(_plus, _builder);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* generated by Xtext 2.14.0
|
||||
*/
|
||||
package com.minres.rdl.ui.wizard;
|
||||
|
||||
import com.minres.rdl.ui.wizard.HelloWorldProject;
|
||||
import org.eclipse.xtext.ui.wizard.template.AbstractProjectTemplate;
|
||||
import org.eclipse.xtext.ui.wizard.template.IProjectTemplateProvider;
|
||||
|
||||
/**
|
||||
* Create a list with all project templates to be shown in the template new project wizard.
|
||||
*
|
||||
* Each template is able to generate one or more projects. Each project can be configured such that any number of files are included.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class RDLProjectTemplateProvider implements IProjectTemplateProvider {
|
||||
@Override
|
||||
public AbstractProjectTemplate[] getProjectTemplates() {
|
||||
HelloWorldProject _helloWorldProject = new HelloWorldProject();
|
||||
return new AbstractProjectTemplate[] { _helloWorldProject };
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user