diff options
author | Nicolas FAUVERGUE | 2016-06-02 12:12:57 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-07-06 14:28:28 +0000 |
commit | 312d483433e09ba9242f261a519a8c052485a7d8 (patch) | |
tree | 281c5d13e689bd7d2c8a60964694719a8f504f4e /plugins/infra/nattable | |
parent | 6ca94f4eed71ecc8c0c501b9e0f8bab084e07c59 (diff) | |
download | org.eclipse.papyrus-312d483433e09ba9242f261a519a8c052485a7d8.tar.gz org.eclipse.papyrus-312d483433e09ba9242f261a519a8c052485a7d8.tar.xz org.eclipse.papyrus-312d483433e09ba9242f261a519a8c052485a7d8.zip |
Bug 495787: [Table][Tests] Create a file export to manage the paste
without using clipboard
https://bugs.eclipse.org/bugs/show_bug.cgi?id=495787
- Add the export to file of the table contents (not as menu item)
- Replace the selectAll+copy to check the table contents by the export
file check
- The first copy/paste is replaced by a command parameter with text to
copy.
Change-Id: I27d782da13f54fb7d368629a9c56716c46463f66
Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
Diffstat (limited to 'plugins/infra/nattable')
15 files changed, 947 insertions, 167 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF index adaf51605c4..3d900ab09a8 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF @@ -14,6 +14,8 @@ Export-Package: org.eclipse.papyrus.infra.nattable, org.eclipse.papyrus.infra.nattable.dialog, org.eclipse.papyrus.infra.nattable.display.converter, org.eclipse.papyrus.infra.nattable.export, + org.eclipse.papyrus.infra.nattable.export.file, + org.eclipse.papyrus.infra.nattable.export.file.command, org.eclipse.papyrus.infra.nattable.fillhandle.command, org.eclipse.papyrus.infra.nattable.filter, org.eclipse.papyrus.infra.nattable.filter.configuration, @@ -39,6 +41,7 @@ Export-Package: org.eclipse.papyrus.infra.nattable, org.eclipse.papyrus.infra.nattable.reorder, org.eclipse.papyrus.infra.nattable.selection, org.eclipse.papyrus.infra.nattable.sort, + org.eclipse.papyrus.infra.nattable.style.configattribute, org.eclipse.papyrus.infra.nattable.tester, org.eclipse.papyrus.infra.nattable.tree, org.eclipse.papyrus.infra.nattable.utils, diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusGridLayerConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusGridLayerConfiguration.java index 15e7e9602cc..133f86cb0b6 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusGridLayerConfiguration.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusGridLayerConfiguration.java @@ -1,67 +1,78 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.configuration;
-
-import org.eclipse.nebula.widgets.nattable.grid.layer.config.DefaultGridLayerConfiguration;
-import org.eclipse.nebula.widgets.nattable.layer.CompositeLayer;
-import org.eclipse.papyrus.infra.nattable.export.PapyrusExportBindings;
-
-/**
- * We change the edit configuration
- *
- * @author Vincent Lorenzo
- *
- */
-public class PapyrusGridLayerConfiguration extends DefaultGridLayerConfiguration {
-
- /**
- *
- * Constructor.
- *
- * @param gridLayer
- */
- public PapyrusGridLayerConfiguration(CompositeLayer gridLayer) {
- super(gridLayer);
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.grid.layer.config.DefaultGridLayerConfiguration#addEditingHandlerConfig()
- *
- */
- @Override
- protected void addEditingHandlerConfig() {
- addConfiguration(new EditConfiguration());
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.grid.layer.config.DefaultGridLayerConfiguration#addEditingUIConfig()
- *
- */
- @Override
- protected void addEditingUIConfig() {
- addConfiguration(new PapyrusDefaultEditBindings());
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.grid.layer.config.DefaultGridLayerConfiguration#addExcelExportUIBindings()
- *
- */
- @Override
- protected void addExcelExportUIBindings() {
- addConfiguration(new PapyrusExportBindings());
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.nattable.configuration; + +import org.eclipse.nebula.widgets.nattable.grid.layer.config.DefaultGridLayerConfiguration; +import org.eclipse.nebula.widgets.nattable.layer.CompositeLayer; +import org.eclipse.papyrus.infra.nattable.export.PapyrusExportBindings; +import org.eclipse.papyrus.infra.nattable.export.file.PapyrusFileExportBindings; + +/** + * We change the edit configuration + * + * @author Vincent Lorenzo + * + */ +public class PapyrusGridLayerConfiguration extends DefaultGridLayerConfiguration { + + /** + * + * Constructor. + * + * @param gridLayer + */ + public PapyrusGridLayerConfiguration(CompositeLayer gridLayer) { + super(gridLayer); + addFileExportUIBindings(); + } + + /** + * + * @see org.eclipse.nebula.widgets.nattable.grid.layer.config.DefaultGridLayerConfiguration#addEditingHandlerConfig() + * + */ + @Override + protected void addEditingHandlerConfig() { + addConfiguration(new EditConfiguration()); + } + + /** + * + * @see org.eclipse.nebula.widgets.nattable.grid.layer.config.DefaultGridLayerConfiguration#addEditingUIConfig() + * + */ + @Override + protected void addEditingUIConfig() { + addConfiguration(new PapyrusDefaultEditBindings()); + } + + /** + * + * @see org.eclipse.nebula.widgets.nattable.grid.layer.config.DefaultGridLayerConfiguration#addExcelExportUIBindings() + * + */ + @Override + protected void addExcelExportUIBindings() { + addConfiguration(new PapyrusExportBindings()); + } + + /** + * Add the file export binding. + * + * @since 2.0 + */ + protected void addFileExportUIBindings(){ + addConfiguration(new PapyrusFileExportBindings()); + } +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/PapyrusFileExportBindings.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/PapyrusFileExportBindings.java new file mode 100644 index 00000000000..b5bddae102d --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/PapyrusFileExportBindings.java @@ -0,0 +1,38 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.nattable.export.file; + +import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; +import org.eclipse.nebula.widgets.nattable.export.config.DefaultExportBindings; +import org.eclipse.papyrus.infra.nattable.style.configattribute.PapyrusExportConfigAttributes; + +/** + * The bindings for the file export. + * + * @since 2.0 + */ +public class PapyrusFileExportBindings extends DefaultExportBindings { + + /** + * {@inheritDoc} + * + * @see org.eclipse.nebula.widgets.nattable.export.config.DefaultExportBindings#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry) + */ + @Override + public void configureRegistry(final IConfigRegistry configRegistry) { + configRegistry.registerConfigAttribute(PapyrusExportConfigAttributes.SIMPLE_FILE_EXPORTER, new PapyrusFileExporter()); + } + + +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/PapyrusFileExportCommandHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/PapyrusFileExportCommandHandler.java new file mode 100644 index 00000000000..8b20cefa36a --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/PapyrusFileExportCommandHandler.java @@ -0,0 +1,85 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.nattable.export.file; + +import org.eclipse.nebula.widgets.nattable.command.AbstractLayerCommandHandler; +import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; +import org.eclipse.nebula.widgets.nattable.layer.ILayer; +import org.eclipse.papyrus.infra.nattable.export.file.command.PapyrusFileExportCommand; +import org.eclipse.swt.widgets.Shell; + +/** + * The handler for the file export. + * + * @since 2.0 + */ +public class PapyrusFileExportCommandHandler extends + AbstractLayerCommandHandler<PapyrusFileExportCommand> { + + /** + * The layer to use. + */ + private final ILayer layer; + + /** + * Boolean to determinate if this must be used in a shell or not. + */ + private final boolean runInShell; + + /** + * Constructor. + * + * @param layer The layer to use. + */ + public PapyrusFileExportCommandHandler(final ILayer layer) { + this(layer, true); + } + + /** + * Constructor. + * + * @param layer The layer to use. + * @param runInShell Boolean to determinate if this must be used in a shell or not. + */ + public PapyrusFileExportCommandHandler(final ILayer layer, final boolean runInShell) { + this.layer = layer; + this.runInShell = runInShell; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.nebula.widgets.nattable.command.AbstractLayerCommandHandler#doCommand(org.eclipse.nebula.widgets.nattable.command.ILayerCommand) + */ + @Override + public boolean doCommand(final PapyrusFileExportCommand command) { + final Shell shell = command.getShell(); + final IConfigRegistry configRegistry = command.getConfigRegistry(); + + new PapyrusFileNatExporter(shell, runInShell).exportSingleLayer(this.layer, configRegistry); + + return true; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.nebula.widgets.nattable.command.ILayerCommandHandler#getCommandClass() + */ + @Override + public Class<PapyrusFileExportCommand> getCommandClass() { + return PapyrusFileExportCommand.class; + } + +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/PapyrusFileExporter.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/PapyrusFileExporter.java new file mode 100644 index 00000000000..49a66aedac3 --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/PapyrusFileExporter.java @@ -0,0 +1,220 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.nattable.export.file; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; + +import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; +import org.eclipse.nebula.widgets.nattable.export.FileOutputStreamProvider; +import org.eclipse.nebula.widgets.nattable.export.ILayerExporter; +import org.eclipse.nebula.widgets.nattable.export.IOutputStreamProvider; +import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; +import org.eclipse.papyrus.infra.nattable.Activator; +import org.eclipse.swt.widgets.Shell; + +/** + * This class is used to export a NatTable to a simple file. + * + * @since 2.0 + */ +public class PapyrusFileExporter implements ILayerExporter { + + /** + * The IOutputStreamProvider that is used to create new OutputStreams on + * beginning new export operations. + */ + private final IOutputStreamProvider outputStreamProvider; + + /** + * The file name if the output stream provider is not used. + */ + private final String fileName; + + /** + * Creates a new ExcelExporter using a FileOutputStreamProvider with default + * values. + */ + public PapyrusFileExporter() { + this(new FileOutputStreamProvider("table_export.txt", //$NON-NLS-1$ + new String[] { "Text (*.txt)" }, new String[] { "*.txt" })); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * Constructor. + * + * @param fileName The file name if the output stream provider is not used. + */ + public PapyrusFileExporter(final String fileName) { + this(null, fileName); + } + + /** + * Creates a new ExcelExporter that uses the given IOutputStreamProvider for + * retrieving the OutputStream to write the export to. + * + * @param outputStreamProvider + * The IOutputStreamProvider that is used to retrieve the + * OutputStream to write the export to. + */ + public PapyrusFileExporter(final IOutputStreamProvider outputStreamProvider) { + this(outputStreamProvider, null); + } + + /** + * Creates a new ExcelExporter that uses the given IOutputStreamProvider for + * retrieving the OutputStream to write the export to. + * + * @param outputStreamProvider + * The IOutputStreamProvider that is used to retrieve the + * OutputStream to write the export to. + * @param fileName The file name if the output stream provider is not used. + */ + private PapyrusFileExporter(final IOutputStreamProvider outputStreamProvider, final String fileName) { + this.outputStreamProvider = outputStreamProvider; + this.fileName = fileName; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.nebula.widgets.nattable.export.ILayerExporter#getOutputStream(org.eclipse.swt.widgets.Shell) + */ + @Override + public OutputStream getOutputStream(final Shell shell) { + OutputStream result = null; + if(null != this.fileName){ + try { + result = new PrintStream(this.fileName); + } catch (final FileNotFoundException e) { + Activator.log.error(e); + } + }else{ + result = this.outputStreamProvider.getOutputStream(shell); + } + return result; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.nebula.widgets.nattable.export.ILayerExporter#exportBegin(java.io.OutputStream) + */ + @Override + public void exportBegin(final OutputStream outputStream) throws IOException { + // Do nothing + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.nebula.widgets.nattable.export.ILayerExporter#exportEnd(java.io.OutputStream) + */ + @Override + public void exportEnd(final OutputStream outputStream) throws IOException { + outputStream.flush(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.nebula.widgets.nattable.export.ILayerExporter#exportLayerBegin(java.io.OutputStream, java.lang.String) + */ + @Override + public void exportLayerBegin(final OutputStream outputStream, final String layerName) throws IOException { + // Do nothing + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.nebula.widgets.nattable.export.ILayerExporter#exportLayerEnd(java.io.OutputStream, java.lang.String) + */ + @Override + public void exportLayerEnd(final OutputStream outputStream, final String layerName) throws IOException { + // Do nothing + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.nebula.widgets.nattable.export.ILayerExporter#exportRowBegin(java.io.OutputStream, int) + */ + @Override + public void exportRowBegin(final OutputStream outputStream, final int rowPosition) throws IOException { + // Do nothing + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.nebula.widgets.nattable.export.ILayerExporter#exportRowEnd(java.io.OutputStream, int) + */ + @Override + public void exportRowEnd(final OutputStream outputStream, final int rowPosition) throws IOException { + // Do nothing + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.nebula.widgets.nattable.export.ILayerExporter#exportCell(java.io.OutputStream, java.lang.Object, org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry) + */ + @Override + public void exportCell(final OutputStream outputStream, + final Object exportDisplayValue, final ILayerCell cell, + final IConfigRegistry configRegistry) throws IOException { + + outputStream.write(asBytes(exportDisplayValue != null ? exportDisplayValue.toString() : "")); //$NON-NLS-1$ + + // add a tab if this is not the last cell + if(cell.getColumnPosition() < cell.getLayer().getColumnCount()-1){ + outputStream.write(asBytes("\t")); //$NON-NLS-1$ + }else{ + // add a line end if this is the last column and not the last row + if(cell.getRowPosition() < cell.getLayer().getRowCount()-1){ + // add a line end if this is the last column + outputStream.write(asBytes("\n")); //$NON-NLS-1$ + } + } + } + + /** + * Convert the string as bytes. + * + * @param string the string to convert as bytes. + * @return Th string converted. + */ + private byte[] asBytes(final String string) { + return string.getBytes(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.nebula.widgets.nattable.export.ILayerExporter#getResult() + */ + @Override + public Object getResult() { + Object result = null; + if(null != this.fileName){ + result = this.fileName; + }else{ + result = this.outputStreamProvider.getResult(); + } + return result; + } +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/PapyrusFileNatExporter.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/PapyrusFileNatExporter.java new file mode 100644 index 00000000000..92f04ce93fc --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/PapyrusFileNatExporter.java @@ -0,0 +1,245 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.nattable.export.file; + +import java.io.IOException; +import java.io.OutputStream; + +import org.eclipse.nebula.widgets.nattable.Messages; +import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; +import org.eclipse.nebula.widgets.nattable.export.ExportConfigAttributes; +import org.eclipse.nebula.widgets.nattable.export.IExportFormatter; +import org.eclipse.nebula.widgets.nattable.export.ILayerExporter; +import org.eclipse.nebula.widgets.nattable.formula.command.DisableFormulaEvaluationCommand; +import org.eclipse.nebula.widgets.nattable.formula.command.EnableFormulaEvaluationCommand; +import org.eclipse.nebula.widgets.nattable.layer.ILayer; +import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; +import org.eclipse.nebula.widgets.nattable.print.command.PrintEntireGridCommand; +import org.eclipse.nebula.widgets.nattable.print.command.TurnViewportOffCommand; +import org.eclipse.nebula.widgets.nattable.print.command.TurnViewportOnCommand; +import org.eclipse.nebula.widgets.nattable.style.DisplayMode; +import org.eclipse.nebula.widgets.nattable.summaryrow.command.CalculateSummaryRowValuesCommand; +import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; +import org.eclipse.papyrus.infra.nattable.Activator; +import org.eclipse.papyrus.infra.nattable.style.configattribute.PapyrusExportConfigAttributes; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.ProgressBar; +import org.eclipse.swt.widgets.Shell; + +/** + * The nattable file exporter. + * + * @since 2.0 + */ +public class PapyrusFileNatExporter { + + /** + * The parent shell. + */ + private final Shell shell; + + /** + * Boolean to determinate if this must be used in a shell or not. + */ + private final boolean runInShell; + + /** + * Constructor. + * + * @param shell The parent shell. + */ + public PapyrusFileNatExporter(final Shell shell) { + this(shell, true); + } + + /** + * Constructor. + * + * @param shell The parent shell. + * @param runInShell Boolean to determinate if this must be used in a shell or not. + */ + public PapyrusFileNatExporter(final Shell shell, final boolean runInShell) { + this.shell = shell; + this.runInShell = runInShell; + } + + /** + * Exports a single ILayer using the ILayerExporter registered in the + * ConfigRegistry. + * + * @param layer + * The ILayer to export, usually a NatTable instance. + * @param configRegistry + * The ConfigRegistry of the NatTable instance to export, that contains the necessary export configurations. + */ + public void exportSingleLayer( + final ILayer layer, + final IConfigRegistry configRegistry) { + + final ILayerExporter exporter = configRegistry.getConfigAttribute( + PapyrusExportConfigAttributes.SIMPLE_FILE_EXPORTER, + DisplayMode.NORMAL); + + final OutputStream outputStream = exporter.getOutputStream(this.shell); + if (null == outputStream) { + return; + } + + Runnable exportRunnable = new Runnable() { + @Override + public void run() { + try { + exporter.exportBegin(outputStream); + + exportLayer(exporter, outputStream, "", layer, configRegistry); //$NON-NLS-1$ + + exporter.exportEnd(outputStream); + } catch (final IOException e) { + throw new RuntimeException("Failed to export.", e); //$NON-NLS-1$ + } finally { + try { + outputStream.close(); + } catch (IOException e) { + Activator.log.error("Failed to close the output stream", e); //$NON-NLS-1$ + } + } + } + }; + + if (null != this.shell && runInShell) { + // Run with the SWT display so that the progress bar can paint + this.shell.getDisplay().asyncExec(exportRunnable); + } else { + exportRunnable.run(); + } + } + + /** + * Exports the given layer to the outputStream using the provided exporter. + * The exporter.exportBegin() method should be called before this method is + * invoked, and exporter.exportEnd() should be called after this method + * returns. If multiple layers are being exported as part of a single + * logical export operation, then exporter.exportBegin() will be called once + * at the very beginning, followed by n calls to this exportLayer() method, + * and finally followed by exporter.exportEnd(). + * + * @param exporter The exporter to use writing the outputstream. + * @param outputStream The outputstream where write the result. + * @param layerName The layer name. + * @param layer The ILayer to export, usually a NatTable instance. + * @param configRegistry The ConfigRegistry of the NatTable instance to export, that contains the necessary export configurations. + */ + protected void exportLayer( + final ILayerExporter exporter, + final OutputStream outputStream, + final String layerName, + final ILayer layer, + final IConfigRegistry configRegistry) { + + final IClientAreaProvider originalClientAreaProvider = layer.getClientAreaProvider(); + + // This needs to be done so that the layer can return all the cells + // not just the ones visible in the viewport + layer.doCommand(new TurnViewportOffCommand()); + setClientAreaToMaximum(layer); + + // if a SummaryRowLayer is in the layer stack, we need to ensure that + // the values are calculated + layer.doCommand(new CalculateSummaryRowValuesCommand()); + + // if a FormulaDataProvider is involved, we need to ensure that the + // formula evaluation is disabled so the formula itself is exported + // instead of the calculated value + layer.doCommand(new DisableFormulaEvaluationCommand()); + + ProgressBar progressBar = null; + + if (null != this.shell && runInShell) { + final Shell childShell = new Shell(this.shell.getDisplay(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); + childShell.setText(Messages.getString("NatExporter.exporting")); //$NON-NLS-1$ + + int startRow = 0; + int endRow = layer.getRowCount() - 1; + + progressBar = new ProgressBar(childShell, SWT.SMOOTH); + progressBar.setMinimum(startRow); + progressBar.setMaximum(endRow); + progressBar.setBounds(0, 0, 400, 25); + progressBar.setFocus(); + + childShell.pack(); + childShell.open(); + } + + try { + exporter.exportLayerBegin(outputStream, layerName); + + for (int rowPosition = 0; rowPosition < layer.getRowCount(); rowPosition++) { + exporter.exportRowBegin(outputStream, rowPosition); + if (null != progressBar) { + progressBar.setSelection(rowPosition); + } + + for (int columnPosition = 0; columnPosition < layer.getColumnCount(); columnPosition++) { + final ILayerCell cell = layer.getCellByPosition(columnPosition, rowPosition); + + final IExportFormatter exportFormatter = configRegistry.getConfigAttribute( + ExportConfigAttributes.EXPORT_FORMATTER, + cell.getDisplayMode(), + cell.getConfigLabels().getLabels()); + final Object exportDisplayValue = exportFormatter.formatForExport(cell, configRegistry); + + exporter.exportCell(outputStream, exportDisplayValue, cell, configRegistry); + } + + exporter.exportRowEnd(outputStream, rowPosition); + } + + exporter.exportLayerEnd(outputStream, layerName); + } catch (final Exception e) { + Activator.log.error("Export failed", e); //$NON-NLS-1$ + } finally { + // These must be fired at the end of the thread execution + layer.setClientAreaProvider(originalClientAreaProvider); + layer.doCommand(new TurnViewportOnCommand()); + + layer.doCommand(new EnableFormulaEvaluationCommand()); + + if (null != progressBar) { + Shell childShell = progressBar.getShell(); + progressBar.dispose(); + childShell.dispose(); + } + } + } + + /** + * This allows to maximize the client area. + * + * @param layer The ILayer to export, usually a NatTable instance. + */ + private void setClientAreaToMaximum(final ILayer layer) { + final Rectangle maxClientArea = new Rectangle(0, 0, layer.getWidth(), layer.getHeight()); + + layer.setClientAreaProvider(new IClientAreaProvider() { + @Override + public Rectangle getClientArea() { + return maxClientArea; + } + }); + + layer.doCommand(new PrintEntireGridCommand()); + } +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/command/PapyrusFileExportCommand.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/command/PapyrusFileExportCommand.java new file mode 100644 index 00000000000..60cc3ccb1db --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/export/file/command/PapyrusFileExportCommand.java @@ -0,0 +1,65 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@ll4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.nattable.export.file.command; + +import org.eclipse.nebula.widgets.nattable.command.AbstractContextFreeCommand; +import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; +import org.eclipse.swt.widgets.Shell; + +/** + * The file export command. + * + * @since 2.0 + */ +public class PapyrusFileExportCommand extends AbstractContextFreeCommand { + + /** + * The config registry. + */ + private IConfigRegistry configRegistry; + + /** + * The parent shell. + */ + private final Shell shell; + + /** + * Constructor. + * + * @param configRegistry The config registry. + * @param shell The parent shell. + */ + public PapyrusFileExportCommand(final IConfigRegistry configRegistry, final Shell shell) { + this.configRegistry = configRegistry; + this.shell = shell; + } + + /** + * Get the config registry. + * + * @return The config registry. + */ + public IConfigRegistry getConfigRegistry() { + return this.configRegistry; + } + + /** + * Get the shell. + * + * @return The shell. + */ + public Shell getShell() { + return this.shell; + } +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ExportToFileHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ExportToFileHandler.java new file mode 100644 index 00000000000..b9e1c6c9753 --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ExportToFileHandler.java @@ -0,0 +1,41 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@ll4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.nattable.handler; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; + +/** + * The file export of the table contents. + * + * This is create but not displays as menu item. + */ +public class ExportToFileHandler extends AbstractTableHandler { + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(final ExecutionEvent arg0) throws ExecutionException { + final INattableModelManager manager = getCurrentNattableModelManager(); + if (null != manager) { + manager.exportToFile(); + } + return null; + } + +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/InsertInTableHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/InsertInTableHandler.java index ebec337bc98..1ac580df7bc 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/InsertInTableHandler.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/InsertInTableHandler.java @@ -74,10 +74,12 @@ public class InsertInTableHandler extends AbstractPasteInsertInTableHandler { final Object userAction = event.getParameters().get(USER_ACTION__PREFERRED_USER_ACTION); final int preferredUserAction = null == userAction ? UserActionConstants.UNDEFINED_USER_ACTION : Integer.parseInt(userAction.toString()); + final Object textToPaste = event.getParameters().get(TEXT_TO_PASTE); + final String clipboardContentsAsString = null != textToPaste ? (String) textToPaste : TableClipboardUtils.getClipboardContentsAsString(); + IStatus result = null; - final String clipboardContentsAsString = TableClipboardUtils.getClipboardContentsAsString(); if (null != clipboardContentsAsString && !clipboardContentsAsString.isEmpty()) { - final InsertInNattableManager pasteManager = new InsertInNattableManager(currentNattableModelManager, pasteHelper, openProgressMonitor, openDialog, preferredUserAction, tableSelectionWrapper, TableClipboardUtils.getClipboardContentsAsString()); + final InsertInNattableManager pasteManager = new InsertInNattableManager(currentNattableModelManager, pasteHelper, openProgressMonitor, openDialog, preferredUserAction, tableSelectionWrapper, clipboardContentsAsString); result = pasteManager.doAction(); } else { result = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.PasteImportHandler_EmptyClipboardString); diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/PasteInTableHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/PasteInTableHandler.java index 86e3bddaca8..ec01eece16c 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/PasteInTableHandler.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/PasteInTableHandler.java @@ -75,8 +75,10 @@ public class PasteInTableHandler extends AbstractPasteInsertInTableHandler { final Object userAction = event.getParameters().get(USER_ACTION__PREFERRED_USER_ACTION); final int preferredUserAction = null == userAction ? UserActionConstants.UNDEFINED_USER_ACTION : Integer.parseInt(userAction.toString()); + final Object textToPaste = event.getParameters().get(TEXT_TO_PASTE); + final String clipboardContentsAsString = null != textToPaste ? (String) textToPaste : TableClipboardUtils.getClipboardContentsAsString(); + IStatus result = null; - final String clipboardContentsAsString = TableClipboardUtils.getClipboardContentsAsString(); if (null != clipboardContentsAsString && !clipboardContentsAsString.isEmpty()) { final PasteAxisInNattableManager pasteManager = new PasteAxisInNattableManager(currentNattableModelManager, pasteHelper, openProgressMonitor, openDialog, preferredUserAction, tableSelectionWrapper, clipboardContentsAsString); result = pasteManager.doAction(); diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusGridLayer.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusGridLayer.java index baaa1c20af7..77bfd700853 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusGridLayer.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusGridLayer.java @@ -1,97 +1,111 @@ -/*****************************************************************************
- * Copyright (c) 2013, 2014 CEA LIST and others.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- * Christian W. Damus (CEA) - bug 402525
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.layer;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.nebula.widgets.nattable.command.ILayerCommandHandler;
-import org.eclipse.nebula.widgets.nattable.edit.command.EditCellCommand;
-import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer;
-import org.eclipse.nebula.widgets.nattable.layer.ILayer;
-import org.eclipse.papyrus.infra.nattable.configuration.PapyrusGridLayerConfiguration;
-import org.eclipse.papyrus.infra.nattable.handler.TransactionalEditCellCommandHandler;
-
-/**
- * This grid layer ovverride the default edition behavior
- *
- * @author Vincent Lorenzo
- *
- */
-public class PapyrusGridLayer extends GridLayer {
-
- private final TransactionalEditingDomain domain;
-
- /**
- *
- * Constructor.
- *
- * @param bodyLayer
- * @param columnHeaderLayer
- * @param rowHeaderLayer
- * @param cornerLayer
- */
- public PapyrusGridLayer(TransactionalEditingDomain domain, ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer) {
- super(bodyLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
-
- this.domain = domain;
- }
-
- /**
- *
- * Constructor.
- *
- * @param bodyLayer
- * @param columnHeaderLayer
- * @param rowHeaderLayer
- * @param cornerLayer
- * @param useDefaultConfiguration
- */
- public PapyrusGridLayer(TransactionalEditingDomain domain, ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer, boolean useDefaultConfiguration) {
- super(bodyLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer, useDefaultConfiguration);
-
- this.domain = domain;
- }
-
- /**
- *
- * Constructor.
- *
- * @param useDefaultConfiguration
- */
- public PapyrusGridLayer(TransactionalEditingDomain domain, boolean useDefaultConfiguration) {
- super(useDefaultConfiguration);
-
- this.domain = domain;
- }
-
- @Override
- protected void init(boolean useDefaultConfiguration) {
- registerCommandHandlers();
-
- if (useDefaultConfiguration) {
- addConfiguration(new PapyrusGridLayerConfiguration(this));
- }
- }
-
- @Override
- public void registerCommandHandler(ILayerCommandHandler<?> commandHandler) {
- // Override the default edit handler
- if (commandHandler.getCommandClass() == EditCellCommand.class) {
- commandHandler = new TransactionalEditCellCommandHandler(domain);
- }
-
- super.registerCommandHandler(commandHandler);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2013, 2014 CEA LIST and others. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 402525 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.nattable.layer; + +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.nebula.widgets.nattable.command.ILayerCommandHandler; +import org.eclipse.nebula.widgets.nattable.edit.command.EditCellCommand; +import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer; +import org.eclipse.nebula.widgets.nattable.layer.ILayer; +import org.eclipse.papyrus.infra.nattable.configuration.PapyrusGridLayerConfiguration; +import org.eclipse.papyrus.infra.nattable.export.file.PapyrusFileExportCommandHandler; +import org.eclipse.papyrus.infra.nattable.handler.TransactionalEditCellCommandHandler; + +/** + * This grid layer ovverride the default edition behavior + * + * @author Vincent Lorenzo + * + */ +public class PapyrusGridLayer extends GridLayer { + + private final TransactionalEditingDomain domain; + + /** + * + * Constructor. + * + * @param bodyLayer + * @param columnHeaderLayer + * @param rowHeaderLayer + * @param cornerLayer + */ + public PapyrusGridLayer(TransactionalEditingDomain domain, ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer) { + super(bodyLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer); + + this.domain = domain; + } + + /** + * + * Constructor. + * + * @param bodyLayer + * @param columnHeaderLayer + * @param rowHeaderLayer + * @param cornerLayer + * @param useDefaultConfiguration + */ + public PapyrusGridLayer(TransactionalEditingDomain domain, ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer, boolean useDefaultConfiguration) { + super(bodyLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer, useDefaultConfiguration); + + this.domain = domain; + } + + /** + * + * Constructor. + * + * @param useDefaultConfiguration + */ + public PapyrusGridLayer(TransactionalEditingDomain domain, boolean useDefaultConfiguration) { + super(useDefaultConfiguration); + + this.domain = domain; + } + + @Override + protected void init(boolean useDefaultConfiguration) { + registerCommandHandlers(); + + if (useDefaultConfiguration) { + addConfiguration(new PapyrusGridLayerConfiguration(this)); + } + } + + @Override + public void registerCommandHandler(ILayerCommandHandler<?> commandHandler) { + // Override the default edit handler + if (commandHandler.getCommandClass() == EditCellCommand.class) { + commandHandler = new TransactionalEditCellCommandHandler(domain); + } + + super.registerCommandHandler(commandHandler); + + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer#registerCommandHandlers() + */ + @Override + protected void registerCommandHandlers() { + super.registerCommandHandlers(); + // register the file export command handler on the gird layer for the body layer + registerCommandHandler(new PapyrusFileExportCommandHandler(getBodyLayer())); + } + +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java index 21d5317b8c7..889ce48c28a 100755 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java @@ -98,6 +98,7 @@ import org.eclipse.papyrus.infra.nattable.dataprovider.ColumnLabelHeaderDataProv import org.eclipse.papyrus.infra.nattable.dataprovider.CompositeColumnHeaderDataProvider; import org.eclipse.papyrus.infra.nattable.dataprovider.CompositeRowHeaderDataProvider; import org.eclipse.papyrus.infra.nattable.display.converter.ObjectNameAndPathDisplayConverter; +import org.eclipse.papyrus.infra.nattable.export.file.command.PapyrusFileExportCommand; import org.eclipse.papyrus.infra.nattable.fillhandle.config.PapyrusFillHandleConfiguration; import org.eclipse.papyrus.infra.nattable.filter.configuration.IFilterConfiguration; import org.eclipse.papyrus.infra.nattable.layer.FilterRowHeaderComposite; @@ -1291,6 +1292,16 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan public void exportToXLS() { this.natTable.doCommand(new ExportCommand(this.natTable.getConfigRegistry(), this.natTable.getShell())); } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager#exportToFile() + */ + @Override + public void exportToFile() { + this.natTable.doCommand(new PapyrusFileExportCommand(this.natTable.getConfigRegistry(), this.natTable.getShell())); + } public void copyToClipboard() { this.natTable.doCommand(new CopyDataToClipboardCommand("\t", System.getProperty("line.separator"), this.natTable.getConfigRegistry())); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/INattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/INattableModelManager.java index 65ae39577b0..a97fdac8617 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/INattableModelManager.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/INattableModelManager.java @@ -119,6 +119,13 @@ public interface INattableModelManager extends ITableAxisElementProvider, IDispo public void selectAll(); public void exportToXLS(); + + /** + * This allows to export the table contents into a file. + * + * @since 2.0 + */ + public void exportToFile(); /** * Opens a dialog to choose the columns to display or to destroy. This action doesn't create or destroy model element. It can only create/destroy diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/style/configattribute/PapyrusExportConfigAttributes.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/style/configattribute/PapyrusExportConfigAttributes.java new file mode 100644 index 00000000000..91d22107a00 --- /dev/null +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/style/configattribute/PapyrusExportConfigAttributes.java @@ -0,0 +1,31 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.nattable.style.configattribute; + +import org.eclipse.nebula.widgets.nattable.export.ILayerExporter; +import org.eclipse.nebula.widgets.nattable.style.ConfigAttribute; + +/** + * Papyrus configuration attributes that are used to configure the export functionality. + * + * @since 2.0 + */ +public interface PapyrusExportConfigAttributes { + + /** + * The configuration attribute for specifying the concrete implementation + * instance of ILayerExporter that should be used for a file export. + */ + ConfigAttribute<ILayerExporter> SIMPLE_FILE_EXPORTER = new ConfigAttribute<ILayerExporter>(); +} diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AbstractPasteInsertInTableHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AbstractPasteInsertInTableHandler.java index 3068653f5ef..7c9a1a1901d 100644 --- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AbstractPasteInsertInTableHandler.java +++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AbstractPasteInsertInTableHandler.java @@ -39,6 +39,11 @@ public abstract class AbstractPasteInsertInTableHandler extends AbstractTableHan * The variable name to determinate if the paste action must use the progress monitor; */ public static final String OPEN__PROGRESS_MONITOR_DIALOG = "openProgressMonitorDialog"; //$NON-NLS-1$ + + /** + * The variable name to determinate the text to paste + */ + public static final String TEXT_TO_PASTE = "textToPaste"; //$NON-NLS-1$ /** * The variable name to determinate the preferred user action to use for the row insert action when he is not determinate. |