Loading plugins/org.etsi.mts.tdl.wizards/src/org/etsi/mts/tdl/wizards/importWizards/ImportWizardPage.java +30 −2 Original line number Diff line number Diff line Loading @@ -37,12 +37,14 @@ public class ImportWizardPage extends WizardNewFileCreationPage { protected FileFieldEditor editor; private boolean inline = false; private boolean copySource = false; private boolean overwrite = true; private IPath sourcePath; LinkedHashMap<String, String> dataFormats = new LinkedHashMap<>(); public ImportWizardPage(String pageName, IStructuredSelection selection) { super(pageName, selection); setTitle(pageName); //NON-NLS-1 setAllowExistingResources(overwrite); setDescription("Import data definitions from a file from the local file system into the workspace"); //NON-NLS-1 loadDataFormat("org.etsi.mts.tdl.openapi2tdl.next", "OpenAPI", "*.yaml"); loadDataFormat("org.etsi.mts.tdl.asn2tdl", "ASN.1", "*.asn1;*.asn"); Loading Loading @@ -105,6 +107,16 @@ public class ImportWizardPage extends WizardNewFileCreationPage { Button buttonFlatten = new Button(fileSelectionArea, SWT.CHECK); buttonFlatten.setSelection(false); buttonFlatten.addSelectionListener(SelectionListener.widgetSelectedAdapter(this::flattenDataDefinitions)); // fill empty cell new Label(fileSelectionArea, SWT.NONE); Label labelOverwrite = new Label(fileSelectionArea, SWT.NONE); //TODO: for OpenAPI only? labelOverwrite.setText("Overwrite File:"); //TODO: link and verify results Button buttonOverwrite = new Button(fileSelectionArea, SWT.CHECK); buttonOverwrite.setSelection(true); buttonOverwrite.addSelectionListener(SelectionListener.widgetSelectedAdapter(this::overwriteDefinitions)); // fill empty cell new Label(fileSelectionArea, SWT.NONE); } Loading Loading @@ -133,9 +145,11 @@ public class ImportWizardPage extends WizardNewFileCreationPage { // IWorkspace workspace = ResourcesPlugin.getWorkspace(); // IWorkspaceRoot root = workspace.getRoot(); // IPath location = root.getLocation(); String content = ConverterNext.processToString(editor.getStringValue(), // editor.getStringValue()+".tdltx", // location.append(getContainerFullPath()).append(getFileName()).toOSString(), // ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())).getRawLocation().toOSString(), getContainerFullPath().append(getFileName()).toOSString(), "SOURCE_MAPPING", "TARGET_MAPPING", Loading Loading @@ -185,7 +199,7 @@ public class ImportWizardPage extends WizardNewFileCreationPage { if (this.editor != null) { IPath sourcePath = Path.fromOSString(this.editor.getStringValue()); boolean exists = sourcePath.toFile().exists(); if (!exists) { if (!overwrite && exists) { setErrorMessage("The selected data file path is not valid."); } return exists && validatePage; Loading @@ -198,6 +212,12 @@ public class ImportWizardPage extends WizardNewFileCreationPage { inline = ((Button) e.getSource()).getSelection(); } private void overwriteDefinitions(SelectionEvent e) { overwrite = ((Button) e.getSource()).getSelection(); setAllowExistingResources(overwrite); } private void copyDataDefinitions(SelectionEvent e) { setCopySource(((Button) e.getSource()).getSelection()); } Loading @@ -217,4 +237,12 @@ public class ImportWizardPage extends WizardNewFileCreationPage { public void setSourcePath(IPath sourcePath) { this.sourcePath = sourcePath; } public boolean isOverwrite() { return overwrite; } public void setOverwrite(boolean overwrite) { this.overwrite = overwrite; } } Loading
plugins/org.etsi.mts.tdl.wizards/src/org/etsi/mts/tdl/wizards/importWizards/ImportWizardPage.java +30 −2 Original line number Diff line number Diff line Loading @@ -37,12 +37,14 @@ public class ImportWizardPage extends WizardNewFileCreationPage { protected FileFieldEditor editor; private boolean inline = false; private boolean copySource = false; private boolean overwrite = true; private IPath sourcePath; LinkedHashMap<String, String> dataFormats = new LinkedHashMap<>(); public ImportWizardPage(String pageName, IStructuredSelection selection) { super(pageName, selection); setTitle(pageName); //NON-NLS-1 setAllowExistingResources(overwrite); setDescription("Import data definitions from a file from the local file system into the workspace"); //NON-NLS-1 loadDataFormat("org.etsi.mts.tdl.openapi2tdl.next", "OpenAPI", "*.yaml"); loadDataFormat("org.etsi.mts.tdl.asn2tdl", "ASN.1", "*.asn1;*.asn"); Loading Loading @@ -105,6 +107,16 @@ public class ImportWizardPage extends WizardNewFileCreationPage { Button buttonFlatten = new Button(fileSelectionArea, SWT.CHECK); buttonFlatten.setSelection(false); buttonFlatten.addSelectionListener(SelectionListener.widgetSelectedAdapter(this::flattenDataDefinitions)); // fill empty cell new Label(fileSelectionArea, SWT.NONE); Label labelOverwrite = new Label(fileSelectionArea, SWT.NONE); //TODO: for OpenAPI only? labelOverwrite.setText("Overwrite File:"); //TODO: link and verify results Button buttonOverwrite = new Button(fileSelectionArea, SWT.CHECK); buttonOverwrite.setSelection(true); buttonOverwrite.addSelectionListener(SelectionListener.widgetSelectedAdapter(this::overwriteDefinitions)); // fill empty cell new Label(fileSelectionArea, SWT.NONE); } Loading Loading @@ -133,9 +145,11 @@ public class ImportWizardPage extends WizardNewFileCreationPage { // IWorkspace workspace = ResourcesPlugin.getWorkspace(); // IWorkspaceRoot root = workspace.getRoot(); // IPath location = root.getLocation(); String content = ConverterNext.processToString(editor.getStringValue(), // editor.getStringValue()+".tdltx", // location.append(getContainerFullPath()).append(getFileName()).toOSString(), // ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())).getRawLocation().toOSString(), getContainerFullPath().append(getFileName()).toOSString(), "SOURCE_MAPPING", "TARGET_MAPPING", Loading Loading @@ -185,7 +199,7 @@ public class ImportWizardPage extends WizardNewFileCreationPage { if (this.editor != null) { IPath sourcePath = Path.fromOSString(this.editor.getStringValue()); boolean exists = sourcePath.toFile().exists(); if (!exists) { if (!overwrite && exists) { setErrorMessage("The selected data file path is not valid."); } return exists && validatePage; Loading @@ -198,6 +212,12 @@ public class ImportWizardPage extends WizardNewFileCreationPage { inline = ((Button) e.getSource()).getSelection(); } private void overwriteDefinitions(SelectionEvent e) { overwrite = ((Button) e.getSource()).getSelection(); setAllowExistingResources(overwrite); } private void copyDataDefinitions(SelectionEvent e) { setCopySource(((Button) e.getSource()).getSelection()); } Loading @@ -217,4 +237,12 @@ public class ImportWizardPage extends WizardNewFileCreationPage { public void setSourcePath(IPath sourcePath) { this.sourcePath = sourcePath; } public boolean isOverwrite() { return overwrite; } public void setOverwrite(boolean overwrite) { this.overwrite = overwrite; } }