From: Fabian Stemmler Date: Sat, 21 Sep 2019 11:34:42 +0000 (+0200) Subject: Added NewWizard for mpm files and fixed mpm content binding X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=798349d09b67a42e41a8bf21e011babca5ea60a8;p=Mograsim.git Added NewWizard for mpm files and fixed mpm content binding --- diff --git a/plugins/net.mograsim.plugin.core/OSGI-INF/l10n/bundle.properties b/plugins/net.mograsim.plugin.core/OSGI-INF/l10n/bundle.properties index 04c03e1a..9faa5eec 100644 --- a/plugins/net.mograsim.plugin.core/OSGI-INF/l10n/bundle.properties +++ b/plugins/net.mograsim.plugin.core/OSGI-INF/l10n/bundle.properties @@ -31,5 +31,8 @@ colorDefinition.label.10 = Simulation text color fontDefinition.label = Assembler Operation Style view.name.0 = Simulation View view.name.1 = Memory +wizards.newWizards.category = Mograsim +wizards.newWizards.mpm.name = Microprogram Memory +wizards.newWizards.mpm.desc = Creates a default new Microprogram Memory themeElementCategory.label.0 = Simulation Bundle-Vendor.0 = Mograsim Team \ No newline at end of file diff --git a/plugins/net.mograsim.plugin.core/plugin.xml b/plugins/net.mograsim.plugin.core/plugin.xml index 38f64cbe..e9c762a3 100644 --- a/plugins/net.mograsim.plugin.core/plugin.xml +++ b/plugins/net.mograsim.plugin.core/plugin.xml @@ -72,15 +72,12 @@ contentTypeId="net.mograsim.plugin.asm" editorId="org.eclipse.ui.genericeditor.GenericEditor"> - - + - - + + + + + %wizards.newWizards.mpm.desc + + + + \ No newline at end of file diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/wizards/newWizards/NewWizardMPM.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/wizards/newWizards/NewWizardMPM.java new file mode 100644 index 00000000..c18e9a18 --- /dev/null +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/wizards/newWizards/NewWizardMPM.java @@ -0,0 +1,41 @@ +package net.mograsim.plugin.wizards.newWizards; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; + +public class NewWizardMPM extends Wizard implements INewWizard +{ + + private IStructuredSelection selection; + private WizardPageMPM page; + + @Override + public void init(IWorkbench workbench, IStructuredSelection selection) + { + this.selection = selection; + } + + @Override + public void addPages() + { + addPage(page = new WizardPageMPM(selection)); + } + + @Override + public String getWindowTitle() + { + return "Create new Microprogram Memory"; + } + + @Override + public boolean performFinish() + { + IFile file = page.createNewFile(); + if (file != null) + return true; + return false; + } +} diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/wizards/newWizards/WizardPageMPM.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/wizards/newWizards/WizardPageMPM.java new file mode 100644 index 00000000..4614e265 --- /dev/null +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/wizards/newWizards/WizardPageMPM.java @@ -0,0 +1,14 @@ +package net.mograsim.plugin.wizards.newWizards; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.dialogs.WizardNewFileCreationPage; + +public class WizardPageMPM extends WizardNewFileCreationPage +{ + + public WizardPageMPM(IStructuredSelection selection) + { + super("Create ", selection); + setFileExtension("mpm"); + } +}