Loading plugins/org.etsi.mts.tdl.wizards/src/org/etsi/mts/tdl/wizards/importWizards/ImportWizardPage.java +42 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import org.eclipse.jface.preference.FileFieldEditor; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.ListEditor; import org.eclipse.jface.preference.PathEditor; import org.eclipse.jface.preference.StringFieldEditor; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; Loading @@ -38,6 +39,7 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.ui.dialogs.WizardNewFileCreationPage; import org.eclipse.xtext.util.StringInputStream; import org.etsi.mts.tdl.transform.Converter; import org.etsi.mts.tdl.transform.ProtocolServerBridge; import org.osgi.service.prefs.Preferences; public class ImportWizardPage extends WizardNewFileCreationPage { Loading @@ -51,6 +53,8 @@ public class ImportWizardPage extends WizardNewFileCreationPage { private FileListEditor fileListEditor; private Composite fileSelectionArea; private String packageName; private String psAddress; private StringFieldEditor protocolServer; public ImportWizardPage(String pageName, IStructuredSelection selection) { super(pageName, selection); setTitle(pageName); //NON-NLS-1 Loading Loading @@ -129,6 +133,7 @@ public class ImportWizardPage extends WizardNewFileCreationPage { optionsLayout.marginHeight = 0; optionsArea.setLayout(optionsLayout); Button buttonCopy = new Button(optionsArea, SWT.CHECK); buttonCopy.setSelection(false); buttonCopy.addSelectionListener(SelectionListener.widgetSelectedAdapter(this::copyDataDefinitions)); Loading Loading @@ -157,6 +162,34 @@ public class ImportWizardPage extends WizardNewFileCreationPage { // fill empty cell new Label(optionsArea, SWT.NONE); new Label(parent, SWT.NONE); Composite psArea = new Composite(parent, SWT.NONE); GridData psData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); psArea.setLayoutData(psData); GridLayout psLayout = new GridLayout(); psLayout.numColumns = 3; psLayout.makeColumnsEqualWidth = false; psLayout.marginWidth = 0; psLayout.marginHeight = 0; psArea.setLayout(psLayout); protocolServer = new StringFieldEditor("protocolServerAddress", "Protocol Server Address:", 80, 1, StringFieldEditor.VALIDATE_ON_FOCUS_LOST, psArea); protocolServer.fillIntoGrid(psArea, 2); String lastUsedPS = "LAST_USED_PS"; protocolServer.getTextControl(psArea).addModifyListener(e -> { psAddress = ImportWizardPage.this.protocolServer.getStringValue(); if (psAddress != null) { preferences.put(lastUsedPS, psAddress); } }); protocolServer.getTextControl(psArea).setText(preferences.get(lastUsedPS, "")); setFileName("Imported.tdltx"); } Loading Loading @@ -206,9 +239,16 @@ public class ImportWizardPage extends WizardNewFileCreationPage { } } if (!asnFiles.isEmpty()) { Converter converter = Converter.getConverter("org.etsi.mts.tdl.asn2tdl"); //TODO: implement properly content += converter.processToString(asnFiles, asnFiles.getFirst()+"-generated.tdltx"); // Converter converter = Converter.getConverter("org.etsi.mts.tdl.asn2tdl"); // content += converter.processToString(asnFiles, asnFiles.getFirst()+"-generated.tdltx"); ProtocolServerBridge bridge = new ProtocolServerBridge(); //TODO: expose settings //TODO: get content content = "Package Imported {\n"; content += bridge.convertASN1toTDLRemote(psAddress, asnFiles, getContainerFullPath().append(getFileName()).toOSString()); content += "\n}\n"; } if (overwrite) { Loading Loading
plugins/org.etsi.mts.tdl.wizards/src/org/etsi/mts/tdl/wizards/importWizards/ImportWizardPage.java +42 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import org.eclipse.jface.preference.FileFieldEditor; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.ListEditor; import org.eclipse.jface.preference.PathEditor; import org.eclipse.jface.preference.StringFieldEditor; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; Loading @@ -38,6 +39,7 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.ui.dialogs.WizardNewFileCreationPage; import org.eclipse.xtext.util.StringInputStream; import org.etsi.mts.tdl.transform.Converter; import org.etsi.mts.tdl.transform.ProtocolServerBridge; import org.osgi.service.prefs.Preferences; public class ImportWizardPage extends WizardNewFileCreationPage { Loading @@ -51,6 +53,8 @@ public class ImportWizardPage extends WizardNewFileCreationPage { private FileListEditor fileListEditor; private Composite fileSelectionArea; private String packageName; private String psAddress; private StringFieldEditor protocolServer; public ImportWizardPage(String pageName, IStructuredSelection selection) { super(pageName, selection); setTitle(pageName); //NON-NLS-1 Loading Loading @@ -129,6 +133,7 @@ public class ImportWizardPage extends WizardNewFileCreationPage { optionsLayout.marginHeight = 0; optionsArea.setLayout(optionsLayout); Button buttonCopy = new Button(optionsArea, SWT.CHECK); buttonCopy.setSelection(false); buttonCopy.addSelectionListener(SelectionListener.widgetSelectedAdapter(this::copyDataDefinitions)); Loading Loading @@ -157,6 +162,34 @@ public class ImportWizardPage extends WizardNewFileCreationPage { // fill empty cell new Label(optionsArea, SWT.NONE); new Label(parent, SWT.NONE); Composite psArea = new Composite(parent, SWT.NONE); GridData psData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); psArea.setLayoutData(psData); GridLayout psLayout = new GridLayout(); psLayout.numColumns = 3; psLayout.makeColumnsEqualWidth = false; psLayout.marginWidth = 0; psLayout.marginHeight = 0; psArea.setLayout(psLayout); protocolServer = new StringFieldEditor("protocolServerAddress", "Protocol Server Address:", 80, 1, StringFieldEditor.VALIDATE_ON_FOCUS_LOST, psArea); protocolServer.fillIntoGrid(psArea, 2); String lastUsedPS = "LAST_USED_PS"; protocolServer.getTextControl(psArea).addModifyListener(e -> { psAddress = ImportWizardPage.this.protocolServer.getStringValue(); if (psAddress != null) { preferences.put(lastUsedPS, psAddress); } }); protocolServer.getTextControl(psArea).setText(preferences.get(lastUsedPS, "")); setFileName("Imported.tdltx"); } Loading Loading @@ -206,9 +239,16 @@ public class ImportWizardPage extends WizardNewFileCreationPage { } } if (!asnFiles.isEmpty()) { Converter converter = Converter.getConverter("org.etsi.mts.tdl.asn2tdl"); //TODO: implement properly content += converter.processToString(asnFiles, asnFiles.getFirst()+"-generated.tdltx"); // Converter converter = Converter.getConverter("org.etsi.mts.tdl.asn2tdl"); // content += converter.processToString(asnFiles, asnFiles.getFirst()+"-generated.tdltx"); ProtocolServerBridge bridge = new ProtocolServerBridge(); //TODO: expose settings //TODO: get content content = "Package Imported {\n"; content += bridge.convertASN1toTDLRemote(psAddress, asnFiles, getContainerFullPath().append(getFileName()).toOSString()); content += "\n}\n"; } if (overwrite) { Loading